Skip to content

Commit

Permalink
+ Added doc about destory
Browse files Browse the repository at this point in the history
  • Loading branch information
cloverhearts committed Dec 12, 2021
1 parent 70e07bd commit c61c682
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 5 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ document.addEventListener('DOMContentLoaded', () => {
},
*/
};
new QuillMarkdown(editor, markdownOptions)

// markdown is enabled
const quillMarkdown = new QuillMarkdown(editor, markdownOptions)

// markdown is now disabled
// quillMarkdown.destroy()

})


Expand Down Expand Up @@ -92,6 +98,22 @@ or
<script>
```
## destroy
Call `destroy()` to remove the event listener and disable markdown support:
```
const quillMarkdown = new QuillMarkdown(editor, markdownOptions)
// markdown is enabled
quillMarkdown.destroy()
// markdown is now disabled
```
To re-enable support, create a new instance.
### Paste support for Markdown format.
Pasting the Markdown form,
Expand Down
41 changes: 39 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@
},
*/
};
new QuillMarkdown(editor, markdownOptions)
// markdown is enabled
const quillMarkdown = new QuillMarkdown(editor, markdownOptions)
// markdown is now disabled
// quillMarkdown.destroy()
})
`,
mode: "javascript",
Expand All @@ -77,6 +82,19 @@
mode: "xml",
theme: "duotone-light"
})

CodeMirror(document.querySelector('#samplecode-destroy'), {
value: `
const editor = new Quill('#editor', options)
const quillMarkdown = new QuillMarkdown(editor, markdownOptions)
// markdown is enabled
quillMarkdown.destroy()
// markdown is now disabled
`,
mode: "javascript",
theme: "duotone-light"
})
})
</script>

Expand All @@ -87,6 +105,11 @@
margin: 0 auto;
}

p em {
background: rgba(225, 105, 180, .2);
font-weight: 600;
}

main > h1, .description, .badges {
text-align: center;
}
Expand All @@ -96,9 +119,12 @@
}

#samplecode-js .CodeMirror {
height: 500px;
height: 550px;
}

#samplecode-destroy .CodeMirror {
height: 150px;
}
#samplecode-html .CodeMirror {
height: 200px;
}
Expand Down Expand Up @@ -172,6 +198,17 @@ <h3>Javascript</h3>
</div>
<div id="samplecode-js"></div>

<div>
<h4>Destroy</h4>
</div>
<div>
<p>Call <em>destroy()</em> to remove the event listener and disable markdown support:</p>
<div id="samplecode-destroy"></div>
<p>
To re-enable support, create a new instance.
</p>
</div>

<div>
<h3>HTML</h3>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quilljs-markdown",
"version": "1.1.9",
"version": "1.1.10",
"description": "Markdown for Quill Editor",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit c61c682

Please sign in to comment.