Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Import the lib.
- import Stackedit from 'stackedit-js';
- // Get the textarea.
- const el = document.querySelector('textarea');
- // Create the Stackedit object.
- const stackedit = new Stackedit();
- // Open the iframe
- stackedit.openFile({
- name: 'Filename', // with a filename
- content: {
- text: el.value // and the Markdown content.
- }
- });
- // Listen to StackEdit events and apply the changes to the textarea.
- stackedit.on('fileChange', (file) => {
- el.value = file.content.text;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement