mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-31 08:02:42 +01:00
e3230f8f21
Fixed broken build system in broken webpack version. Also updates module system to standardise on ES6 import/exports, Especially since babel has changed it's 'default' logic for the old module system.
43 lines
1003 B
JavaScript
43 lines
1003 B
JavaScript
import codeLib from "../services/code";
|
|
|
|
const methods = {
|
|
show() {
|
|
if (!this.editor) this.editor = codeLib.popupEditor(this.$refs.editor, this.language);
|
|
this.$refs.overlay.style.display = 'flex';
|
|
},
|
|
hide() {
|
|
this.$refs.overlay.style.display = 'none';
|
|
},
|
|
updateEditorMode(language) {
|
|
codeLib.setMode(this.editor, language);
|
|
},
|
|
updateLanguage(lang) {
|
|
this.language = lang;
|
|
this.updateEditorMode(lang);
|
|
},
|
|
open(code, language, callback) {
|
|
this.show();
|
|
this.updateEditorMode(language);
|
|
this.language = language;
|
|
codeLib.setContent(this.editor, code);
|
|
this.code = code;
|
|
this.callback = callback;
|
|
},
|
|
save() {
|
|
if (!this.callback) return;
|
|
this.callback(this.editor.getValue(), this.language);
|
|
this.hide();
|
|
}
|
|
};
|
|
|
|
const data = {
|
|
editor: null,
|
|
language: '',
|
|
code: '',
|
|
callback: null
|
|
};
|
|
|
|
export default {
|
|
methods,
|
|
data
|
|
}; |