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

polar-tui-editor

v2.5.1

Published

GFM Markdown Wysiwyg Editor - Productive and Extensible

Downloads

11

Readme

TOAST UI Editor

npm

🚩 Table of Contents

Collect Statistics on the Use of Open Source

TOAST UI products apply 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 option when creating the instance.

const options = {
  // ...
  usageStatistics: false
};

const editor = new Editor(options);

📙 Documents

You can also see the older versions of API page on the releases page.

💾 Install

TOAST UI products can be used by using the package manager or downloading the source directly. However, we highly recommend using the package manager.

Via Package Manager

TOAST UI products are registered in two package managers, npm. You can conveniently install it using the commands provided by the package manager. When using npm, be sure to use it in the environment Node.js is installed.

npm

$ npm install --save @toast-ui/editor # Latest Version
$ npm install --save @toast-ui/editor@<version> # Specific Version

Via Contents Delivery Network (CDN)

TOAST UI products are available over the CDN powered by TOAST Cloud.

You can use the CDN as below.

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

If you want to use a specific version, use the tag name instead of latest in the url's path.

The CDN directory has the following structure:

- uicdn.toast.com/
   ├─ editor/
   │     ├─ latest/
   │     │    ├─ toastui-editor-all.js
   │     │    ├─ toastui-editor-all.min.js
   │     │    ├─ toastui-editor-viewer.js
   │     │    ├─ toastui-editor-viewer.min.js
   │     │    ├─ toastui-editor.css
   │     │    ├─ toastui-editor.min.css
   │     │    ├─ toastui-editor-viewer.css
   │     │    ├─ toastui-editor-viewer.min.css
   │     │    ├─ toastui-editor-only.css
   │     │    └─ toastui-editor-only.min.css
   │     ├─ 2.0.0/
   │     │    └─ ...

Download Source Files

🔨 Usage

First, you need to add the container element where TOAST UI Editor (henceforth referred to as 'Editor') will be created.

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

The editor can be used by creating an instance with the constructor function. To get the constructor function, you should import the module using one of the following ways depending on your environment.

Using Module Format in Node Environment

  • ES6 Modules
import Editor from '@toast-ui/editor';
  • CommonJS
const Editor = require('@toast-ui/editor');

Using Namespace in Browser Environment

const Editor = toastui.Editor;

Then, you need to add the CSS files needed for the Editor. Import CSS files in node environment, and add it to html file when using CDN. When using the markdown editor, you need to add a style for the CodeMirror.

Using in Node Environment

import 'codemirror/lib/codemirror.css'; // Editor's Dependency Style
import '@toast-ui/editor/dist/toastui-editor.css'; // Editor's Style

Using in Browser Environment by CDN

...
<head>
  ...
  <!-- Editor's Dependecy Style -->
  <link
    rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.4/codemirror.min.css"
  />
  <!-- Editor's Style -->
  <link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor.min.css" />
</head>
...

Finally you can create an instance with options and call various API after creating an instance.

const editor = new Editor({
  el: document.querySelector('#editor'),
  height: '500px',
  initialEditType: 'markdown',
  previewStyle: 'vertical'
});

editor.getHtml();

Default Options

  • height: Height in string or auto ex) 300px | auto
  • initialEditType: Initial type to show markdown | wysiwyg
  • initialValue: Initial value. Set Markdown string
  • previewStyle: Preview style of Markdown mode tab | vertical
  • usageStatistics: Let us know the hostname. We want to learn from you how you are using the Editor. You are free to disable it. true | false

Find out more options here.

🦄 Tutorials