From bdb49c232c21097497f8d28ce28d55c411b30073 Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Mon, 4 Nov 2024 00:16:20 +0800 Subject: [PATCH] feat: support tab of codemirror6 --- src/streams-outliner-lib/keyboard-shortcuts/indent-node.tid | 1 + .../keyboard-shortcuts/save-and-continue.tid | 1 + src/streams-outliner-lib/widgets/keyboard-plus.js | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/streams-outliner-lib/keyboard-shortcuts/indent-node.tid b/src/streams-outliner-lib/keyboard-shortcuts/indent-node.tid index e4e2ecf..e5c31e4 100644 --- a/src/streams-outliner-lib/keyboard-shortcuts/indent-node.tid +++ b/src/streams-outliner-lib/keyboard-shortcuts/indent-node.tid @@ -3,5 +3,6 @@ tags: $:/tags/streams/keyboard-shortcuts $:/tags/streams/contextmenu key: ((streams-indent)) sq-contextmenu-name : <> sq-contextmenu-subtitle: +prevent-default: no <> \ No newline at end of file diff --git a/src/streams-outliner-lib/keyboard-shortcuts/save-and-continue.tid b/src/streams-outliner-lib/keyboard-shortcuts/save-and-continue.tid index e4492df..7ce001d 100644 --- a/src/streams-outliner-lib/keyboard-shortcuts/save-and-continue.tid +++ b/src/streams-outliner-lib/keyboard-shortcuts/save-and-continue.tid @@ -1,5 +1,6 @@ title: $:/plugins/linonetwo/streams-outliner-lib/keyboard-shortcuts/save-and-continue tags: $:/tags/streams/keyboard-shortcuts key: ((streams-save-and-continue)) +prevent-default: no <> \ No newline at end of file diff --git a/src/streams-outliner-lib/widgets/keyboard-plus.js b/src/streams-outliner-lib/widgets/keyboard-plus.js index 5072f45..2fb8601 100644 --- a/src/streams-outliner-lib/widgets/keyboard-plus.js +++ b/src/streams-outliner-lib/widgets/keyboard-plus.js @@ -39,7 +39,7 @@ KeyboardWidget.prototype.render = function(parent,nextSibling) { // Add a keyboard event handler - domNode.addEventListener("keydown",function (event) { + domNode.addEventListener("keydown", (event) => { // CM triggers two events // second event has: // defaultPrevented : true @@ -96,7 +96,7 @@ KeyboardWidget.prototype.execute = function() { tiddlerFields = this.wiki.getTiddler(title).fields; this.shortcutKeysList[i] = tiddlerFields.key !== undefined ? tiddlerFields.key : undefined; this.shortcutActionList[i] = tiddlerFields.text; - this.shortcutPreventDefaultList[i] = tiddlerFields["prevent-default"] && tiddlerFields["prevent-default"] === "no" ? false : true; + this.shortcutPreventDefaultList[i] = tiddlerFields["prevent-default"] === "no" ? false : true; this.shortcutParsedList[i] = this.shortcutKeysList[i] !== undefined ? $tw.keyboardManager.parseKeyDescriptors(this.shortcutKeysList[i]) : undefined; }