@14ch/svelte-md-outliner 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,10 +5,21 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.0.23] - 2026-10-23
9
+
10
+ ### Fixed
11
+
12
+ - Pressing Backspace while composing with an IME no longer leaves the editor
13
+ unable to commit the conversion or move the cursor. Keys pressed during
14
+ composition, including Tab and Enter, are now left to the IME.
15
+
8
16
  ## [0.0.22] - 2026-10-23
9
17
 
10
18
  ### Fixed
11
19
 
20
+ - IME composition no longer reports Backspace or Enter as handled without
21
+ applying the change, allowing DOM edits and subsequent cursor movement to proceed.
22
+
12
23
  - Pasting Markdown containing headings and tables now preserves the heading
13
24
  hierarchy when the clipboard also contains HTML.
14
25
 
@@ -1,7 +1,7 @@
1
1
  import { baseKeymap, chainCommands } from 'prosemirror-commands';
2
2
  import { closeHistory } from 'prosemirror-history';
3
3
  import { InputRule, inputRules } from 'prosemirror-inputrules';
4
- import { keydownHandler, keymap } from 'prosemirror-keymap';
4
+ import { keydownHandler } from 'prosemirror-keymap';
5
5
  import { Plugin } from 'prosemirror-state';
6
6
  import { autoformatRules } from '../autoformat.js';
7
7
  import { linkPastePlugin } from '../plugins/linkPaste.js';
@@ -39,13 +39,25 @@ function createPlugins(extraActions) {
39
39
  // 表示操作は編集可否の判定より前に配る(→ viewKeymap)
40
40
  viewKeymap(withoutCoreKeys(viewBindings, coreBindings)),
41
41
  // 塞ぐかどうかは各定義の「文書を変えるか」で決まる。基盤と拡張で扱いを分けない
42
- keymap(coreBindings),
43
- keymap(bindingsOf(extraActions.filter((action) => action.category !== 'view'))),
44
- keymap(baseKeymap),
42
+ compositionAwareKeymap(coreBindings),
43
+ compositionAwareKeymap(bindingsOf(extraActions.filter((action) => action.category !== 'view'))),
44
+ compositionAwareKeymap(baseKeymap),
45
45
  inputRules({ rules: autoformatRules.map(ruleAsOwnUndoStep) }),
46
46
  linkPastePlugin()
47
47
  ];
48
48
  }
49
+ /**
50
+ * DOM の変更を取り込む際にも handleKeyDown は呼ばれる。
51
+ * 変換中は「処理済み」にせず、標準キーを含めて IME の変更の取り込みへ譲る。
52
+ */
53
+ function compositionAwareKeymap(bindings) {
54
+ const handler = keydownHandler(bindings);
55
+ return new Plugin({
56
+ props: {
57
+ handleKeyDown: (view, event) => view.composing || event.isComposing || event.keyCode === 229 ? false : handler(view, event)
58
+ }
59
+ });
60
+ }
49
61
  /**
50
62
  * 表示操作のキーを、編集できるかどうかの判定より前に配る。
51
63
  *
@@ -63,6 +75,8 @@ function viewKeymap(bindings) {
63
75
  props: {
64
76
  handleDOMEvents: {
65
77
  keydown: (view, event) => {
78
+ if (view.composing || event.isComposing || event.keyCode === 229)
79
+ return false;
66
80
  if (!handler(view, event))
67
81
  return false;
68
82
  event.preventDefault();
@@ -154,12 +168,12 @@ function ruleAsOwnUndoStep(rule) {
154
168
  }
155
169
  /**
156
170
  * IME で変換が確定していない間は、ショートカット・階層操作・既定の Enter 処理を実行しない。
157
- * `true` を返して既定動作も止める(変換確定の Enter で段落が割れる事故を防ぐ)。
171
+ * 未処理を返す。処理済みにすると DOM からの削除の取り込みまで止めてしまう。
158
172
  */
159
173
  function withoutComposition(command) {
160
174
  return (state, dispatch, view) => {
161
175
  if (view?.composing)
162
- return true;
176
+ return false;
163
177
  return command(state, dispatch, view);
164
178
  };
165
179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@14ch/svelte-md-outliner",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "An outliner-style Markdown editor for Svelte 5. Headings form a real section tree you can fold, focus, and re-nest from the keyboard.",