Use new editor, hide [[,]] from sidebar
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-09-03 15:42:34 +02:00
parent 30b24903f1
commit bbc2ebc30f
6 changed files with 25 additions and 9 deletions

View File

@ -9267,9 +9267,9 @@
} }
}, },
"wiki-list-editor": { "wiki-list-editor": {
"version": "0.8.12", "version": "0.8.13",
"resolved": "https://registry.npmjs.org/wiki-list-editor/-/wiki-list-editor-0.8.12.tgz", "resolved": "https://registry.npmjs.org/wiki-list-editor/-/wiki-list-editor-0.8.13.tgz",
"integrity": "sha512-1YdtzQv38WdbtyGFV9DAO5bJi7ndcyQlFXG64aJRimbguu6x1YRP8dzGiStGKfoVqZpR5zZ8Q+7HrqsxKVb24g==", "integrity": "sha512-UMKzZ91WA4O2w6kL0lxS5KIfOMWIXW3AK63BVMP4vyFn2X4uvBEGJSknGVEoSxyXDhYoWTYzejb8B9RNefkNPA==",
"requires": { "requires": {
"dragula": "^3.7.2", "dragula": "^3.7.2",
"he": "^1.2.0", "he": "^1.2.0",

View File

@ -41,7 +41,7 @@
"vis-data": "^6.6.1", "vis-data": "^6.6.1",
"vis-network": "^7.6.10", "vis-network": "^7.6.10",
"vis-util": "^4.3.2", "vis-util": "^4.3.2",
"wiki-list-editor": "^0.8.12" "wiki-list-editor": "^0.8.13"
}, },
"scripts": { "scripts": {
"test": "node_modules/.bin/mocha -r esm", "test": "node_modules/.bin/mocha -r esm",

View File

@ -210,8 +210,14 @@ MD.use(MarkdownItWikilinks({
}, },
})).use(MarkdownItMark).use(MarkdownItKatex) })).use(MarkdownItMark).use(MarkdownItKatex)
let holder = document.getElementById('editor'); let holders = document.getElementsByClassName('wiki-list-editor');
if (holder) {
_.forEach(holders, (item, i) => {
console.log(i, item)
let EDITOR = new Editor(item)
})
function Editor(holder) {
const options = { const options = {
transform(text, element) { transform(text, element) {
let converted = text let converted = text
@ -255,7 +261,7 @@ if (holder) {
}) })
editor.on('change', function () { editor.on('change', function () {
let element = document.getElementById('editor'); let element = holder
let indicator = Indicator(document.getElementById('save-indicator'), 2); let indicator = Indicator(document.getElementById('save-indicator'), 2);
let saveUrl = element.dataset.saveurl; let saveUrl = element.dataset.saveurl;
let page = element.dataset.page; let page = element.dataset.page;
@ -463,6 +469,8 @@ if (holder) {
}) })
menu.connectContextMenu(editor) menu.connectContextMenu(editor)
return editor
} }
let timeout = null; let timeout = null;

View File

@ -215,6 +215,14 @@ mark {
.sidebar { .sidebar {
padding: 0 12px; padding: 0 12px;
width: 100%; width: 100%;
.wiki-link {
&::before, &::after {
content: '';
}
}
} }
} }

View File

@ -1 +1 @@
<div id="editor" data-url="{{ .BaseURL }}{{ .Page }}?format=json" data-input="{{ .Data }}" data-saveurl="/save/" data-base-url="{{ .BaseURL }}" data-page="{{ .Page }}" save-type="{{ .ContentType }}"></div> <div class="wiki-list-editor" data-url="{{ .BaseURL }}{{ .Page }}?format=json" data-input="{{ .Data }}" data-saveurl="/save/" data-base-url="{{ .BaseURL }}" data-page="{{ .Page }}" save-type="{{ .ContentType }}"></div>