You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
importQuillfrom'quill'importQuillMarkdownfrom'quilljs-markdown'import'quilljs-markdown/dist/quilljs-markdown-common-style.css'// recommend import css, @option improve common styleconstoptions={theme:'snow'}document.addEventListener('DOMContentLoaded',()=>{consteditor=newQuill('#editor',options)constmarkdownOptions={/** ignoreTags: [ 'pre', 'strikethrough'], // @option - if you need to ignore some tags. tags: { //@option if you need to change for trigger pattern for some tags. blockquote: { pattern: /^(\|){1,6}\s/g, }, bold: { pattern: /^(\|){1,6}\s/g, }, italic: { pattern: /(\_){1}(.+?)(?:\1){1}/g, }, }, */};// markdown is enabledconstquillMarkdown=newQuillMarkdown(editor,markdownOptions)// markdown is now disabled// quillMarkdown.destroy()})
Javascript 2 (Enable to Standard style for Quilljs)
importQuillfrom'quill'importQuillMarkdownfrom'../src/app'consttoolbarOptions=[['bold','italic','underline','strike'],['link','image'],// add's image support];constoptions={theme:'snow',modules:{toolbar:toolbarOptions,QuillMarkdown:{ignoreTags:['pre','strikethrough'],//@option - if you need to ignore some tags.tags:{//@option if you need to change for trigger pattern for some tags.blockquote:{pattern:/^(\|){1,6}\s/g,},bold:{pattern:/^(\|){1,6}\s/g,},italic:{pattern:/(\_){1}(.+?)(?:\1){1}/g,},},}}}document.addEventListener('DOMContentLoaded',()=>{console.log('HOHO')Quill.register('modules/QuillMarkdown',QuillMarkdown,true)newQuill('#editor',options)})
HTML
<scriptsrc="https://cdn.quilljs.com/1.3.6/quill.js"></script><scriptsrc="https://cdn.jsdelivr.net/npm/quilljs-markdown@latest/dist/quilljs-markdown.js"><script><link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet"><link href="https://cdn.jsdelivr.net/npm/quilljs-markdown@latest/dist/quilljs-markdown-common-style.css" rel="stylesheet" ><script> document.addEventListener('DOMContentLoaded', () => { var quill = new Quill('#editor', { theme: 'snow' }); var markdownOptions = { ignoreTags: [ 'strikethrough'], // @option - if you need to ignore some tags. tags: { // @option if you need to change for trigger pattern for some tags. blockquote: { pattern: /^(\|){1,6}\s/g, }, bold: { pattern: /^(\|){1,6}\s/g, }, italic: { pattern: /(\_){1}(.+?)(?:\1){1}/g, }, }, }; new QuillMarkdown(editor, markdownOptions) })<script>
destroy
Calldestroy() to remove the event listener and disable markdown support:
const quillMarkdown = new QuillMarkdown(editor, markdownOptions)// markdown is enabledquillMarkdown.destroy()// markdown is now disabled