parent: elem.parentElement,
doc: content,
extensions: [
+ keymap.of(keyBindings),
...editorExtensions(elem.parentElement),
EditorView.updateListener.of((v) => {
onChange(v);
}),
EditorView.domEventHandlers(domEventHandlers),
- keymap.of(keyBindings),
],
};
const defaultThemeSpec = {
"&": {
+ backgroundColor: "#FFF",
color: "#000",
},
"&.cm-focused": {
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
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');
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;
.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;
}