diff --git a/apps/client/src/widgets/type_widgets/editable_code.ts b/apps/client/src/widgets/type_widgets/editable_code.ts index b60e8e422..3f037ce34 100644 --- a/apps/client/src/widgets/type_widgets/editable_code.ts +++ b/apps/client/src/widgets/type_widgets/editable_code.ts @@ -46,19 +46,11 @@ export default class EditableCodeTypeWidget extends AbstractCodeTypeWidget { return { placeholder: t("editable_code.placeholder"), vimKeybindings: options.is("vimKeymapEnabled"), - onContentChanged: () => this.spacedUpdate.scheduleUpdate() + onContentChanged: () => this.spacedUpdate.scheduleUpdate(), + tabIndex: 300 } } - // getExtraOpts(): Partial { - // return { - // lint: true, - // gutters: ["CodeMirror-lint-markers"], - // tabindex: 300, - // dragDrop: false, // with true the editor inlines dropped files which is not what we expect - // }; - // } - async doRefresh(note: FNote) { const blob = await this.note?.getBlob(); diff --git a/packages/codemirror/src/index.ts b/packages/codemirror/src/index.ts index 5661b4fc6..bb0f8c608 100644 --- a/packages/codemirror/src/index.ts +++ b/packages/codemirror/src/index.ts @@ -18,6 +18,7 @@ export interface EditorConfig { lineWrapping?: boolean; vimKeybindings?: boolean; readOnly?: boolean; + tabIndex?: number; onContentChanged?: ContentChangedListener; } @@ -81,6 +82,11 @@ export default class CodeMirror extends EditorView { parent: config.parent, extensions }); + + if (config.tabIndex) { + this.dom.tabIndex = config.tabIndex; + } + this.config = config; this.languageCompartment = languageCompartment; this.historyCompartment = historyCompartment;