1/* DOKUWIKI:include stackedit.min.js */
2
3function openStackedit() {
4	const el = document.querySelector('textarea');
5	const stackedit = new Stackedit();
6	stackedit.openFile({
7		content: {
8			text: el.value
9		}
10	});
11	stackedit.on('fileChange', (file) => {
12		el.value = file.content.text;
13	});
14}
15function addBtnActionClick($btn, props, edid) {
16    $btn.click(function() {
17		openStackedit();
18        return false;
19    });
20
21    return 'click';
22}
23if (typeof window.toolbar !== 'undefined') {
24    window.toolbar[window.toolbar.length] = {
25        type: "Click",
26        title: "StackEdit",
27        icon: "../../plugins/stackedit/stackedit.png"
28    };
29}