From bbc2ebc30fe2f6ae1ea4a7de3abc042e51dd88fb Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Thu, 3 Sep 2020 15:42:34 +0200 Subject: [PATCH] Use new editor, hide [[,]] from sidebar --- editor/package-lock.json | 6 +++--- editor/package.json | 2 +- editor/src/index.js | 14 +++++++++++--- editor/src/styles.scss | 8 ++++++++ templates/edit.html | 2 +- templates/editorjs.html | 2 +- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/editor/package-lock.json b/editor/package-lock.json index 916aa77..cc38d9c 100644 --- a/editor/package-lock.json +++ b/editor/package-lock.json @@ -9267,9 +9267,9 @@ } }, "wiki-list-editor": { - "version": "0.8.12", - "resolved": "https://registry.npmjs.org/wiki-list-editor/-/wiki-list-editor-0.8.12.tgz", - "integrity": "sha512-1YdtzQv38WdbtyGFV9DAO5bJi7ndcyQlFXG64aJRimbguu6x1YRP8dzGiStGKfoVqZpR5zZ8Q+7HrqsxKVb24g==", + "version": "0.8.13", + "resolved": "https://registry.npmjs.org/wiki-list-editor/-/wiki-list-editor-0.8.13.tgz", + "integrity": "sha512-UMKzZ91WA4O2w6kL0lxS5KIfOMWIXW3AK63BVMP4vyFn2X4uvBEGJSknGVEoSxyXDhYoWTYzejb8B9RNefkNPA==", "requires": { "dragula": "^3.7.2", "he": "^1.2.0", diff --git a/editor/package.json b/editor/package.json index 3a1d005..efa055d 100644 --- a/editor/package.json +++ b/editor/package.json @@ -41,7 +41,7 @@ "vis-data": "^6.6.1", "vis-network": "^7.6.10", "vis-util": "^4.3.2", - "wiki-list-editor": "^0.8.12" + "wiki-list-editor": "^0.8.13" }, "scripts": { "test": "node_modules/.bin/mocha -r esm", diff --git a/editor/src/index.js b/editor/src/index.js index 4e93e19..f48b58a 100644 --- a/editor/src/index.js +++ b/editor/src/index.js @@ -210,8 +210,14 @@ MD.use(MarkdownItWikilinks({ }, })).use(MarkdownItMark).use(MarkdownItKatex) -let holder = document.getElementById('editor'); -if (holder) { +let holders = document.getElementsByClassName('wiki-list-editor'); + +_.forEach(holders, (item, i) => { + console.log(i, item) + let EDITOR = new Editor(item) +}) + +function Editor(holder) { const options = { transform(text, element) { let converted = text @@ -255,7 +261,7 @@ if (holder) { }) editor.on('change', function () { - let element = document.getElementById('editor'); + let element = holder let indicator = Indicator(document.getElementById('save-indicator'), 2); let saveUrl = element.dataset.saveurl; let page = element.dataset.page; @@ -463,6 +469,8 @@ if (holder) { }) menu.connectContextMenu(editor) + + return editor } let timeout = null; diff --git a/editor/src/styles.scss b/editor/src/styles.scss index 44d87fa..c3e3164 100644 --- a/editor/src/styles.scss +++ b/editor/src/styles.scss @@ -215,6 +215,14 @@ mark { .sidebar { padding: 0 12px; width: 100%; + + + .wiki-link { + &::before, &::after { + content: ''; + } + } + } } diff --git a/templates/edit.html b/templates/edit.html index a242528..36ddc0d 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -32,7 +32,7 @@
{{ if .ShowGraph }} -
+
{{ end }}
diff --git a/templates/editorjs.html b/templates/editorjs.html index f0ca905..c3f581e 100644 --- a/templates/editorjs.html +++ b/templates/editorjs.html @@ -1 +1 @@ -
+