summaryrefslogtreecommitdiff
path: root/includes/editor.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/editor.php')
-rw-r--r--includes/editor.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/editor.php b/includes/editor.php
index c3a4a56..b697254 100644
--- a/includes/editor.php
+++ b/includes/editor.php
@@ -3,6 +3,7 @@
<script>
let editor;
+ let lastData = null;
ClassicEditor
.create(document.querySelector( '#editor-box' ), {
@@ -25,7 +26,18 @@
fullPage: true
})
.then((newEditor) => {
- editor = newEditor;
+ editor = window.error = newEditor;
+
+ setInterval(() => {
+ if (lastData) {
+ if (lastData !== editor.getData()) {
+ if (window.oneditorchange) window.oneditorchange(editor.getData());
+ lastData = editor.getData();
+ }
+ } else {
+ lastData = editor.getData();
+ }
+ });
})
</script>
<style>