mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-24 15:49:59 +08:00
Moved overlay component, migrated code-editor & added features
- Moved Code-editor from vue to component. - Updated popup code so it background click only hides if the click originated on the same background. Clicks within the popup will no longer cause it to hide. - Added session-level history tracking to code editor.
This commit is contained in:
@ -137,7 +137,7 @@ function codePlugin() {
|
||||
|
||||
if (!elemIsCodeBlock(selectedNode)) {
|
||||
const providedCode = editor.selection.getNode().textContent;
|
||||
window.vues['code-editor'].open(providedCode, '', (code, lang) => {
|
||||
window.components.first('code-editor').open(providedCode, '', (code, lang) => {
|
||||
const wrap = document.createElement('div');
|
||||
wrap.innerHTML = `<pre><code class="language-${lang}"></code></pre>`;
|
||||
wrap.querySelector('code').innerText = code;
|
||||
@ -155,7 +155,7 @@ function codePlugin() {
|
||||
let lang = selectedNode.hasAttribute('data-lang') ? selectedNode.getAttribute('data-lang') : '';
|
||||
let currentCode = selectedNode.querySelector('textarea').textContent;
|
||||
|
||||
window.vues['code-editor'].open(currentCode, lang, (code, lang) => {
|
||||
window.components.first('code-editor').open(currentCode, lang, (code, lang) => {
|
||||
const editorElem = selectedNode.querySelector('.CodeMirror');
|
||||
const cmInstance = editorElem.CodeMirror;
|
||||
if (cmInstance) {
|
||||
|
Reference in New Issue
Block a user