mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-27 16:41:53 +03:00
This is a copy of the ProseMirror/prosemirror-menu repo files which suggest working from a fork of this. These changes include the ability to select callouts from the menubar.
18 lines
661 B
JavaScript
18 lines
661 B
JavaScript
import MarkdownView from "./editor/MarkdownView";
|
|
import ProseMirrorView from "./editor/ProseMirrorView";
|
|
|
|
// Next step: https://prosemirror.net/examples/menu/
|
|
|
|
const place = document.querySelector("#editor");
|
|
let view = new ProseMirrorView(place, document.getElementById('content').innerHTML);
|
|
|
|
const markdownToggle = document.getElementById('markdown-toggle');
|
|
markdownToggle.addEventListener('change', event => {
|
|
const View = markdownToggle.checked ? MarkdownView : ProseMirrorView;
|
|
if (view instanceof View) return
|
|
const content = view.content
|
|
console.log(content);
|
|
view.destroy()
|
|
view = new View(place, content)
|
|
view.focus()
|
|
}); |