-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditor.php
32 lines (27 loc) · 908 Bytes
/
editor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<form action="/action_page.php" id="usrform">
Name: <input type="text" name="usrname">
<input type="submit">
</form>
<br>
<textarea rows="4" cols="50" name="comment" form="usrform">
Enter text here...</textarea>
<script src="https://unpkg.com/stackedit-js@1.0.7/docs/lib/stackedit.min.js" type="module"></script>
<script>
// 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;
});
</script>