All Projects → benwinding → quill-html-edit-button

benwinding / quill-html-edit-button

Licence: MIT license
Quill.js Module which allows you to quickly view/edit the HTML in the editor

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Labels

Projects that are alternatives of or similar to quill-html-edit-button

Quill
Quill is a modern WYSIWYG editor built for compatibility and extensibility.
Stars: ✭ 31,554 (+29116.67%)
Mutual labels:  quill
Quill Sharedb Cursors
Collaborative editing with multi cursors sync using Quill and ShareDB.
Stars: ✭ 121 (+12.04%)
Mutual labels:  quill
Ngx Quill Editor
🍡@quilljs editor component for @angular
Stars: ✭ 234 (+116.67%)
Mutual labels:  quill
Yii2 Quill
Yii 2 implementation of Quill, modern WYSIWYG editor
Stars: ✭ 52 (-51.85%)
Mutual labels:  quill
Ultron.g8
A ZIO + http4s + Circe + Quill + Tapir giter8 template
Stars: ✭ 107 (-0.93%)
Mutual labels:  quill
Quill Cursors
A multi cursor module for Quill text editor.
Stars: ✭ 139 (+28.7%)
Mutual labels:  quill
Vue Quill Editor
🍡@quilljs editor component for @vuejs
Stars: ✭ 6,874 (+6264.81%)
Mutual labels:  quill
RuoYi-Vue-Oracle
🎉 (RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue & Element 的前后端分离权限管理系统
Stars: ✭ 225 (+108.33%)
Mutual labels:  quill
Ruoyi Vue Fast
(RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue & Element 的前后端分离权限管理系统
Stars: ✭ 107 (-0.93%)
Mutual labels:  quill
Vue2 Editor
A text editor using Vue.js and Quill
Stars: ✭ 2,316 (+2044.44%)
Mutual labels:  quill
Node Quill Converter
Convert HTML to a Quill Delta or a Quill Delta to HTML
Stars: ✭ 61 (-43.52%)
Mutual labels:  quill
Ngx Quill
Angular (>=2) components for the Quill Rich Text Editor
Stars: ✭ 1,382 (+1179.63%)
Mutual labels:  quill
Quill Better Table
Module for better table in Quill, more useful features are supported.
Stars: ✭ 175 (+62.04%)
Mutual labels:  quill
Scala Db Codegen
Scala code/boilerplate generator from a db schema
Stars: ✭ 49 (-54.63%)
Mutual labels:  quill
reagent-quill
Basic reagent recipe for quill rich text editor
Stars: ✭ 16 (-85.19%)
Mutual labels:  quill
Rating Stars
⭐️⭐️⭐️⭐️⭐️ A 5-star rating widget implemented in JS and CSS
Stars: ✭ 18 (-83.33%)
Mutual labels:  quill
Ngx Quill Example
demo app for the advanced usage of ngx-quill module
Stars: ✭ 137 (+26.85%)
Mutual labels:  quill
angular quill
Angular dart component for the Quill rich text editor
Stars: ✭ 22 (-79.63%)
Mutual labels:  quill
writebar
Experimental distraction-free text editor, based on the Macbook pro TouchBar
Stars: ✭ 37 (-65.74%)
Mutual labels:  quill
Flutter Quill
Rich text editor for Flutter
Stars: ✭ 177 (+63.89%)
Mutual labels:  quill

quill-html-edit-button

NPM Version License Downloads/week Github Issues

Quill.js Module which allows you to quickly view/edit the HTML in the editor

Demo

Install

yarn add quill-html-edit-button

Quickstart (Javascript)

import Quill from 'quill/core';
import Toolbar from 'quill/modules/toolbar';
import Snow from 'quill/themes/snow';

import htmlEditButton from "quill-html-edit-button";

Quill.register({
  'modules/toolbar': Toolbar,
  'themes/snow': Snow,
  "modules/htmlEditButton": htmlEditButton
})

const quill = new Quill(editor, {
  // ...
  modules: {
    // ...
    htmlEditButton: {}
  }
});

Quickstart (typescript)

Due to Quill's implementation, typescript integration is not trivial:

  • Follow the demo example here demos/typescript/src/index.ts
  • The file setup.js is to use the library without types (as they aren't implemented with quill modules).
  • Your tsconfig.json needs the following properties, to prevent errors:
  "compilerOptions": {
    "allowJs": true,
    "checkJs": false
  }

Quickstart (script tag)

<script src="https://unpkg.com/[email protected]/dist/quill.js"></script>
<script src="https://unpkg.com/[email protected]/dist/quill.htmlEditButton.min.js"></script>
<script>
  Quill.register("modules/htmlEditButton", htmlEditButton);
  const quill = new Quill(editor, {
    // ...
    modules: {
      // ...
      htmlEditButton: {}
    }
  });
</script>

Options

modules: {
  // ...
  htmlEditButton: {
    debug: true, // logging, default:false
    msg: "Edit the content in HTML format", //Custom message to display in the editor, default: Edit HTML here, when you click "OK" the quill editor's contents will be replaced
    okText: "Ok", // Text to display in the OK button, default: Ok,
    cancelText: "Cancel", // Text to display in the cancel button, default: Cancel
    buttonHTML: "&lt;&gt;", // Text to display in the toolbar button, default: <>
    buttonTitle: "Show HTML source", // Text to display as the tooltip for the toolbar button, default: Show HTML source
    syntax: false, // Show the HTML with syntax highlighting. Requires highlightjs on window.hljs (similar to Quill itself), default: false
    prependSelector: 'div#myelement', // a string used to select where you want to insert the overlayContainer, default: null (appends to body),
    editorModules: {} // The default mod
  }
}

Syntax Highlighting

By default syntax highlighting is off, if you want to enable it use syntax: true in the options (as shown above) and make sure you add the following script tags:

<link
  rel="stylesheet"
  href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.2/styles/github.min.css"
/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.2/highlight.min.js"></script>
<script
  charset="UTF-8"
  src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.2/languages/xml.min.js"
></script>

Alternatively, include these scripts in your package bundler, as long as highlightjs is available in the global space at window.hljs.

Customising The HTML Editor

The editor itself is actually a Quill Editor instance too! So you can pass in custom modules like this:

  // options
  htmlEditButton: {
    // Flags
    debug?: boolean;              // default:  false 
    syntax?: boolean;             // default:  false  
    // Overlay
    closeOnClickOverlay: boolean; // default:  true                       
    prependSelector: string;      // default:  null                       
    // Labels
    buttonHTML?: string;          // default:  "&lt;&gt;"
    buttonTitle?: string;         // default:  "Show HTML source"
    msg: string;                  // default:  'Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced'     
    okText: string;               // default:  "Ok"
    cancelText: string;           // default:  "Cancel"            
    // Quill Modules (for the HTML editor)
    editorModules?: {             // default:  null
      // Any modules here will be declared in HTML quill editor instance
      keyboard: {
        bindings: {
          custom: {
            key: 'a',
            handler: function(range, context) {
              console.log('A KEY PRESSED!');
            }
          },
        },
      },
    },
  },

Thanks

This project is based on quill-image-uploader, thanks mate!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].