npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@toast-ui/jquery-editor

v2.5.4

Published

TOAST UI Editor : jQuery Wrapper

Downloads

58

Readme

TOAST UI Editor for jQuery

This is a jQuery component wrapping TOAST UI Editor.

npm version

🚩 Table of Contents

Collect Statistics on the Use of Open Source

jQuery Wrapper of TOAST UI Editor applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Editor is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. ui.toast.com) is to be collected and the sole purpose is nothing but to measure statistics on the usage. To disable GA, use the following usageStatistics options when declare jquery Wrapper component.

const options = {
  ...
  usageStatistics: false
}

const editor = $('#editor').toastuiEditor(options);

📁 Bundle File Structure

Files distributed on npm

- node_modules/
  - @toast-ui/
    - jquery-editor/
      - dist/
        - toastui-jquery-editor.js
        - toastui-jquery-editor-viewer.js

Files distributed on CDN

The bundle files provided by CDN include TOAST UI Editor(@toast-ui/editor).

- uicdn.toast.com/
  - editor/
    - latest/
      - toastui-jquery-editor.js
      - toastui-jquery-editor.min.js
      - toastui-jquery-editor-viewer.js
      - toastui-jquery-editor-viewer.min.js

📦 Usage npm

Install

$ npm install --save @toast-ui/jquery-editor

Import

You can use TOAST UI Editor for jQuery as a ECMAScript module or a CommonJS module. As this module does not contain CSS files, you should import toastui-editor.css from @toast-ui/editor and codemirror.css from CodeMirror in the script.

  • ES Modules
import 'codemirror/lib/codemirror.css';
import '@toast-ui/editor/dist/toastui-editor.css';

import '@toast-ui/jquery-editor';
  • CommonJS
require('codemirror/lib/codemirror.css');
require('@toast-ui/editor/dist/toastui-editor.css');

require('@toast-ui/jquery-editor');

Creating Component

Before creating the instance, add the element that will create the editor. And you must import jQuery before the wrapper.

<body>
  <div id="editor"></div>
  ...
</body>

Using the Editor

It can be used by using the toastuiEditor function. If the first parameter type is an object, you can create an instance of the Editor using this object as an option. And if the parameter type is string, you can call API function. The options and method APIs are the same as those of the editor.

import 'codemirror/lib/codemirror.css';
import '@toast-ui/editor/dist/toastui-editor.css';

import $ from 'jquery';
import '@toast-ui/jquery-editor';

$('#editor').toastuiEditor({
  height: '500px',
  initialEditType: 'markdown',
  previewStyle: 'vertical'
});

const content = $('#editor').toastuiEditor('getHtml');

console.log(content);

The viewer option allows you to use it as a viewer.

$('#viewer').toastuiEditor({
  // ...
  viewer: true
});

Using the Viewer

If you want to use only the viewer, import the bundle file corresponding to the viewer.

import 'codemirror/lib/codemirror.css';
import '@toast-ui/editor/dist/toastui-editor.css';

import $ from 'jquery';
import '@toast-ui/jquery-editor/dist/toastui-jquery-editor-viewer';

$('#viewer').toastuiEditor({
  height: '500px',
  initialValue: '# hello'
});

🗂 Usage CDN

To use the wrapper, the jQuery's CDN file must be included.

Including Files

<body>
  ...
  <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
  <script src="https://uicdn.toast.com/editor/latest/toastui-jquery-editor.min.js"></script>
</body>

Creating Component

Before creating the instance, add the element that will create the editor.

<body>
  <div id="editor"></div>
  ...
</body>

Using Editor

$('#editor').toastuiEditor({
  height: '500px',
  initialEditType: 'markdown',
  previewStyle: 'vertical'
});

The viewer option allows you to use it as a viewer.

$('#viewer').toastuiEditor({
  // ...
  viewer: true
});

Using Viewer

If you want to use only the viewer, include the following file:

<script src="https://uicdn.toast.com/editor/latest/toastui-jquery-editor-viewer.min.js"></script>
$('#viewer').toastuiEditor({
  height: '500px',
  initialValue: '# hello'
});