mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
CM6: Fixed a range of issues during browser testing
- Fixed some keybindings not running as expected, due to some editor defaults overriding or further actions taking place since the action would not indicate it's been dealt with (by returning boolean). - Fixed spacing/border-radius being used on codeblocks on non-intended areas like the MD editor. - Fixed lack of BG on default light theme, visible on full screen md editor. - Fixed error thrown when the user does not have access to change the current editor (Likely non-cm related existing issue)
This commit is contained in:
parent
94f464cd14
commit
3e738b1471
@ -186,12 +186,12 @@ export function markdownEditor(elem, onChange, domEventHandlers, keyBindings) {
|
||||
parent: elem.parentElement,
|
||||
doc: content,
|
||||
extensions: [
|
||||
keymap.of(keyBindings),
|
||||
...editorExtensions(elem.parentElement),
|
||||
EditorView.updateListener.of((v) => {
|
||||
onChange(v);
|
||||
}),
|
||||
EditorView.domEventHandlers(domEventHandlers),
|
||||
keymap.of(keyBindings),
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -49,6 +49,7 @@ const defaultLightHighlightStyle = HighlightStyle.define([
|
||||
|
||||
const defaultThemeSpec = {
|
||||
"&": {
|
||||
backgroundColor: "#FFF",
|
||||
color: "#000",
|
||||
},
|
||||
"&.cm-focused": {
|
||||
|
@ -22,7 +22,7 @@ export class PageEditor extends Component {
|
||||
this.draftDisplayIcon = this.$refs.draftDisplayIcon;
|
||||
this.changelogInput = this.$refs.changelogInput;
|
||||
this.changelogDisplay = this.$refs.changelogDisplay;
|
||||
this.changeEditorButtons = this.$manyRefs.changeEditor;
|
||||
this.changeEditorButtons = this.$manyRefs.changeEditor || [];
|
||||
this.switchDialogContainer = this.$refs.switchDialog;
|
||||
|
||||
// Translations
|
||||
|
@ -7,7 +7,7 @@ function provide(editor) {
|
||||
const shortcuts = {};
|
||||
|
||||
// Insert Image shortcut
|
||||
shortcuts['Mod-Alt-i'] = cm => editor.actions.insertImage();
|
||||
shortcuts['Shift-Mod-i'] = cm => editor.actions.insertImage();
|
||||
|
||||
// Save draft
|
||||
shortcuts['Mod-s'] = cm => window.$events.emit('editor-save-draft');
|
||||
@ -49,8 +49,15 @@ export function provideKeyBindings(editor) {
|
||||
const shortcuts= provide(editor);
|
||||
const keyBindings = [];
|
||||
|
||||
const wrapAction = (action) => {
|
||||
return () => {
|
||||
action();
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
for (const [shortcut, action] of Object.entries(shortcuts)) {
|
||||
keyBindings.push({key: shortcut, run: action, preventDefault: true});
|
||||
keyBindings.push({key: shortcut, run: wrapAction(action), preventDefault: true});
|
||||
}
|
||||
|
||||
return keyBindings;
|
||||
|
@ -5,8 +5,12 @@
|
||||
.cm-editor {
|
||||
font-size: 12px;
|
||||
border: 1px solid #ddd;
|
||||
margin-bottom: $-l;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.page-content .cm-editor,
|
||||
.CodeMirrorContainer .cm-editor {
|
||||
margin-bottom: $-l;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user