mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-02 13:58:57 +08:00
b27a5c7fb8
- Changed default focus styles - Updated dropdowns with keyboard navigation - Updated modals with esc exiting - Added accessibility attirbutes where needed - Made many more elements focusable - Updated hover effects of many items to also apply when focused within Related to #1320 and #1198
43 lines
1009 B
JavaScript
43 lines
1009 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.components.overlay.show();
|
|
},
|
|
hide() {
|
|
this.$refs.overlay.components.overlay.hide();
|
|
},
|
|
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
|
|
}; |