NOW MANAGED ON CODEBERG
CM6: Fixed a range of issues during browser testing
Dan Brown3e738b14715e
diff --git a/resources/js/code/index.mjs b/resources/js/code/index.mjsindex 60b4df997..1064feda4 100644--- a/resources/js/code/index.mjs+++ b/resources/js/code/index.mjs@@ -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),],};diff --git a/resources/js/code/themes.js b/resources/js/code/themes.jsindex 492ca4a99..d20383078 100644--- a/resources/js/code/themes.js+++ b/resources/js/code/themes.js@@ -49,6 +49,7 @@ const defaultLightHighlightStyle = HighlightStyle.define([const defaultThemeSpec = {"&": {+ backgroundColor: "#FFF",color: "#000",},"&.cm-focused": {diff --git a/resources/js/components/page-editor.js b/resources/js/components/page-editor.jsindex c58f45b66..e2b92ff68 100644--- a/resources/js/components/page-editor.js+++ b/resources/js/components/page-editor.js@@ -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;// Translationsdiff --git a/resources/js/markdown/shortcuts.js b/resources/js/markdown/shortcuts.jsindex 336b276d1..c4a86e544 100644--- a/resources/js/markdown/shortcuts.js+++ b/resources/js/markdown/shortcuts.js@@ -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 draftshortcuts['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;diff --git a/resources/sass/_codemirror.scss b/resources/sass/_codemirror.scssindex de82d4989..ed56ac8d4 100644--- a/resources/sass/_codemirror.scss+++ b/resources/sass/_codemirror.scss@@ -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;}