@14ch/svelte-md-outliner 0.0.19 → 0.0.20

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/README.ja.md +47 -24
  3. package/README.md +47 -24
  4. package/dist/assets/styles/editor.css +42 -2
  5. package/dist/components/ContextMenu.svelte +1 -1
  6. package/dist/components/EditorSurface.svelte +2 -2
  7. package/dist/components/MarkdownEditor.svelte +69 -17
  8. package/dist/components/MarkdownEditor.svelte.d.ts +16 -3
  9. package/dist/components/ShortcutHelpDialog.svelte +3 -3
  10. package/dist/index.d.ts +12 -4
  11. package/dist/index.js +4 -2
  12. package/dist/markdown.d.ts +2 -0
  13. package/dist/markdown.js +1 -0
  14. package/dist/messages/index.d.ts +2 -2
  15. package/dist/messages/index.js +2 -2
  16. package/dist/models/document/bodySelection.js +1 -1
  17. package/dist/models/document/schema.d.ts +10 -1
  18. package/dist/models/document/schema.js +13 -2
  19. package/dist/models/document/sectionTree.d.ts +1 -1
  20. package/dist/models/document/sectionTree.js +2 -2
  21. package/dist/models/markdown/normalize.d.ts +20 -0
  22. package/dist/models/markdown/normalize.js +25 -0
  23. package/dist/models/markdown/parser.js +8 -6
  24. package/dist/models/markdown/serializer.js +12 -11
  25. package/dist/models/viewState/viewStateCodec.d.ts +1 -1
  26. package/dist/models/viewState/viewStateCodec.js +3 -3
  27. package/dist/operations/autoformat.js +3 -3
  28. package/dist/operations/commands/block.js +4 -4
  29. package/dist/operations/commands/element.js +9 -9
  30. package/dist/operations/commands/fencedBlock.js +2 -2
  31. package/dist/operations/commands/frontMatter.js +5 -5
  32. package/dist/operations/commands/lineBreak.js +1 -1
  33. package/dist/operations/commands/link.js +1 -1
  34. package/dist/operations/commands/list.js +59 -6
  35. package/dist/operations/commands/section.d.ts +1 -1
  36. package/dist/operations/commands/section.js +5 -5
  37. package/dist/operations/commands/sectionFold.d.ts +1 -1
  38. package/dist/operations/commands/sectionFold.js +5 -5
  39. package/dist/operations/commands/sectionJump.js +2 -2
  40. package/dist/operations/commands/selectedBlock.js +3 -3
  41. package/dist/operations/commands/table.js +43 -2
  42. package/dist/operations/documentDiff.d.ts +12 -0
  43. package/dist/operations/documentDiff.js +191 -0
  44. package/dist/operations/keymap/assemble.js +5 -5
  45. package/dist/operations/keymap/coreActions.js +13 -13
  46. package/dist/operations/keymap/menuItems.js +2 -2
  47. package/dist/operations/keymap/shortcutKeys.js +1 -1
  48. package/dist/operations/keymap/viewActions.js +5 -5
  49. package/dist/operations/plugins/blockHandle.js +1 -1
  50. package/dist/operations/plugins/compositionState.d.ts +30 -0
  51. package/dist/operations/plugins/compositionState.js +65 -0
  52. package/dist/operations/plugins/contextMenu.js +2 -2
  53. package/dist/operations/plugins/focus.js +19 -8
  54. package/dist/operations/plugins/foldClick.js +1 -1
  55. package/dist/operations/plugins/foldGuard.js +2 -2
  56. package/dist/operations/plugins/frontMatterGuard.js +4 -4
  57. package/dist/operations/plugins/frontMatterView.js +3 -3
  58. package/dist/operations/plugins/headingLevel.js +1 -1
  59. package/dist/operations/plugins/imagePaste.js +2 -2
  60. package/dist/operations/plugins/imageView.js +1 -1
  61. package/dist/operations/plugins/linkPaste.js +2 -2
  62. package/dist/operations/plugins/listStructure.js +1 -1
  63. package/dist/operations/plugins/markdownClipboard.js +8 -8
  64. package/dist/operations/plugins/mermaidView.js +2 -2
  65. package/dist/operations/plugins/requiredSelectionEntry.js +1 -1
  66. package/dist/operations/plugins/sectionView.js +1 -1
  67. package/dist/operations/plugins/tableHandles.js +2 -2
  68. package/dist/operations/transactionOrigin.d.ts +9 -5
  69. package/dist/operations/transactionOrigin.js +2 -1
  70. package/dist/states/contextMenuController.svelte.js +5 -5
  71. package/dist/states/editorSession.js +69 -50
  72. package/dist/states/editorSession.types.d.ts +41 -3
  73. package/dist/states/outlineViewController.svelte.d.ts +1 -7
  74. package/dist/states/outlineViewController.svelte.js +7 -22
  75. package/package.json +1 -1
@@ -3,15 +3,19 @@ import type { Transaction } from 'prosemirror-state';
3
3
  * 変更の由来を Transaction に書き添える。
4
4
  *
5
5
  * 判定する側(フォーカス範囲外への波及を塞ぐ仕組み)は、変更の内容だけを見ても
6
- * 「書き手が編集した」のか「利用者のアプリが本文を差し替えた」のかを区別できない。
6
+ * 「書き手が編集した」のか「利用者のアプリが本文を当てた」のかを区別できない。
7
7
  * 区別できないまま一律に塞ぐと、利用者の変更が黙って落ちる。
8
8
  *
9
- * - `host`: 利用者のアプリ由来(`bind:value` の反映)。塞がずに通す
9
+ * - `replacement`: 利用者の操作として取り消せる置き換え(`bind:value` と `replaceMarkdown`)
10
+ * - `remote`: 他の書き手の変更の同期反映。取り消し履歴に積まない
10
11
  * - `fold`: 折りたたみの切り替え。表示だけを変えるため通す
11
12
  * - `metadata`: フロントマターへの項目の書き込み。領域は表示範囲の外にあるため、
12
- * 印が無ければ黙って落ちる。`host` を流用しないのは、表示範囲を絞る仕組みが
13
- * `host` を見て連なりを組み直し、書き込みのたびにその組み直しが走るためである
13
+ * 印が無ければ黙って落ちる
14
+ *
15
+ * **値は「何をした変更か」を表し、「その後に何を組み直すか」は表さない。** 組み直しの
16
+ * 要否は変更そのものから決める(→ `focus.ts`)。印の値で決めると、同期反映を足すたびに
17
+ * 組み直しの引き金が増える。
14
18
  */
15
- export type TransactionOrigin = 'host' | 'fold' | 'metadata';
19
+ export type TransactionOrigin = 'replacement' | 'remote' | 'fold' | 'metadata';
16
20
  export declare function markOrigin<T extends Transaction>(transaction: T, origin: TransactionOrigin): T;
17
21
  export declare function originOf(transaction: Transaction): TransactionOrigin | null;
@@ -1,9 +1,10 @@
1
1
  const ORIGIN = 'markdown-editor:origin';
2
+ const ORIGINS = ['replacement', 'remote', 'fold', 'metadata'];
2
3
  export function markOrigin(transaction, origin) {
3
4
  transaction.setMeta(ORIGIN, origin);
4
5
  return transaction;
5
6
  }
6
7
  export function originOf(transaction) {
7
8
  const origin = transaction.getMeta(ORIGIN);
8
- return origin === 'host' || origin === 'fold' || origin === 'metadata' ? origin : null;
9
+ return ORIGINS.includes(origin) ? origin : null;
9
10
  }
@@ -1,8 +1,8 @@
1
- import { editorKeymap } from '../operations/keymap/assemble';
2
- import { describedIds, keyLabelledActions, menuGroupsFor } from '../operations/keymap/menuItems';
3
- import { createKeyStrokeMatcher } from '../operations/keymap/shortcutKeys';
4
- import { createContextMenuShortcut } from '../operations/keymap/viewActions';
5
- import { createContextMenuPlugin } from '../operations/plugins/contextMenu';
1
+ import { editorKeymap } from '../operations/keymap/assemble.js';
2
+ import { describedIds, keyLabelledActions, menuGroupsFor } from '../operations/keymap/menuItems.js';
3
+ import { createKeyStrokeMatcher } from '../operations/keymap/shortcutKeys.js';
4
+ import { createContextMenuShortcut } from '../operations/keymap/viewActions.js';
5
+ import { createContextMenuPlugin } from '../operations/plugins/contextMenu.js';
6
6
  /**
7
7
  * メニューの開閉・錨・項目を、エディタ 1 インスタンスに閉じて持つ。
8
8
  *
@@ -4,28 +4,30 @@ import { closeHistory, history } from 'prosemirror-history';
4
4
  import { EditorState } from 'prosemirror-state';
5
5
  import { tableEditing } from 'prosemirror-tables';
6
6
  import { EditorView } from 'prosemirror-view';
7
- import { parseMarkdown } from '../models/markdown/parser';
8
- import { serializeMarkdown } from '../models/markdown/serializer';
9
- import { editorKeymap } from '../operations/keymap/assemble';
10
- import { DEFAULT_LANG, resolveMessages } from '../messages';
11
- import { sectionViewPlugin } from '../operations/plugins/sectionView';
12
- import { mermaidViewPlugin } from '../operations/plugins/mermaidView';
13
- import { imagePastePlugin } from '../operations/plugins/imagePaste';
14
- import { imageViewPlugin } from '../operations/plugins/imageView';
15
- import { blockHandlePlugin } from '../operations/plugins/blockHandle';
16
- import { frontMatterGuardPlugin } from '../operations/plugins/frontMatterGuard';
17
- import { editorFocusPlugin } from '../operations/plugins/editorFocus';
18
- import { frontMatterViewPlugin } from '../operations/plugins/frontMatterView';
19
- import { headingLevelPlugin } from '../operations/plugins/headingLevel';
20
- import { listStructurePlugin } from '../operations/plugins/listStructure';
21
- import { markdownClipboardPlugin } from '../operations/plugins/markdownClipboard';
22
- import { tablePastePlugin } from '../operations/plugins/tablePaste';
23
- import { requiredSelectionEntryPlugin } from '../operations/plugins/requiredSelectionEntry';
24
- import { tableHandlesPlugin } from '../operations/plugins/tableHandles';
25
- import { writeFrontMatterFields as writeFrontMatterFieldsCommand } from '../operations/commands/frontMatter';
26
- import { bodySelection } from '../models/document/bodySelection';
27
- import { outlineSchema } from '../models/document/schema';
28
- import { markOrigin } from '../operations/transactionOrigin';
7
+ import { parseMarkdown } from '../models/markdown/parser.js';
8
+ import { serializeMarkdown } from '../models/markdown/serializer.js';
9
+ import { editorKeymap } from '../operations/keymap/assemble.js';
10
+ import { DEFAULT_LANG, resolveMessages } from '../messages/index.js';
11
+ import { sectionViewPlugin } from '../operations/plugins/sectionView.js';
12
+ import { mermaidViewPlugin } from '../operations/plugins/mermaidView.js';
13
+ import { imagePastePlugin } from '../operations/plugins/imagePaste.js';
14
+ import { imageViewPlugin } from '../operations/plugins/imageView.js';
15
+ import { blockHandlePlugin } from '../operations/plugins/blockHandle.js';
16
+ import { frontMatterGuardPlugin } from '../operations/plugins/frontMatterGuard.js';
17
+ import { editorFocusPlugin } from '../operations/plugins/editorFocus.js';
18
+ import { frontMatterViewPlugin } from '../operations/plugins/frontMatterView.js';
19
+ import { headingLevelPlugin } from '../operations/plugins/headingLevel.js';
20
+ import { listStructurePlugin } from '../operations/plugins/listStructure.js';
21
+ import { markdownClipboardPlugin } from '../operations/plugins/markdownClipboard.js';
22
+ import { tablePastePlugin } from '../operations/plugins/tablePaste.js';
23
+ import { requiredSelectionEntryPlugin } from '../operations/plugins/requiredSelectionEntry.js';
24
+ import { tableHandlesPlugin } from '../operations/plugins/tableHandles.js';
25
+ import { writeFrontMatterFields as writeFrontMatterFieldsCommand } from '../operations/commands/frontMatter.js';
26
+ import { bodySelection } from '../models/document/bodySelection.js';
27
+ import { outlineSchema } from '../models/document/schema.js';
28
+ import { diffTransaction } from '../operations/documentDiff.js';
29
+ import { createCompositionState } from '../operations/plugins/compositionState.js';
30
+ import { markOrigin } from '../operations/transactionOrigin.js';
29
31
  /**
30
32
  * 編集セッションを 1 つ作る。
31
33
  *
@@ -51,7 +53,14 @@ export function createEditorSession(element, options) {
51
53
  const listeners = new Set();
52
54
  /** 画像の文言。**貼り付けと表示の 2 つが同じものを読む**(読むたびに最新を返す) */
53
55
  const imageText = () => presentation.imageText ?? defaultImageText();
56
+ /**
57
+ * 外から書き込めるかの**唯一の情報源**。3 つの命令と `value` の経路がこれを読む。
58
+ * 判定を 2 通り持つと、経路ごとに食い違う
59
+ */
60
+ const composition = createCompositionState();
54
61
  const plugins = [
62
+ // 変換の出来事を受け止める。**キーの割り当てより前**に置く(出来事を取りこぼさない)
63
+ composition.plugin,
55
64
  // 上下キーが押されたことの記録は、**キーの割り当てより前**に置く。
56
65
  // 後ろに置くと、割り当てが受け止めたキー(表のセル移動など)を見逃し、
57
66
  // 表から出た先の要選択ブロックを指せない
@@ -151,28 +160,45 @@ export function createEditorSession(element, options) {
151
160
  for (const listener of listeners)
152
161
  listener(change);
153
162
  }
163
+ function outcome(status) {
164
+ return { ok: true, value: { status, markdown: cachedMarkdown } };
165
+ }
166
+ /** 見送り。文書・カーソル・取り消し履歴・購読者への通知のいずれも変えない */
167
+ function deferred() {
168
+ return { ok: true, value: { status: 'deferred', markdown: cachedMarkdown } };
169
+ }
154
170
  return {
155
171
  ok: true,
156
172
  value: {
157
173
  getMarkdown: () => cachedMarkdown,
158
- applyMarkdown(markdown) {
174
+ /**
175
+ * **書き込めるかを最初に見る。** 読み取りを先に行うと、見送るだけの呼び出しでも
176
+ * 毎回読み取りの費用が掛かる。利用側は見送られているあいだ繰り返し呼ぶ。
177
+ *
178
+ * 見送った本文は控えない。当て直しは利用側が自分の引き金で行う
179
+ */
180
+ applyMarkdown(markdown, kind) {
181
+ if (!composition.canWriteFromOutside(view))
182
+ return deferred();
159
183
  const result = parseMarkdown(markdown);
160
184
  if (!result.ok)
161
185
  return result;
162
186
  const transaction = diffTransaction(view.state, result.value);
163
187
  if (!transaction)
164
- return { ok: true, value: undefined };
165
- // 直前の文字入力とは独立した取り消し単位にする。
166
- // 由来を書き添えるのは、表示範囲を絞る仕組みがこれを見て素通しするためである
167
- // (塞ぐと、利用者が渡した本文が黙って落ちる)
168
- view.dispatch(markOrigin(closeHistory(transaction), 'host'));
169
- return { ok: true, value: undefined };
188
+ return outcome('unchanged');
189
+ view.dispatch(applyRule(kind)(transaction));
190
+ return outcome('applied');
170
191
  },
171
192
  /**
172
193
  * 命令を呼び、変更があれば当てて、結果を返すだけ。**判断を持たない。**
173
- * 見送り・同値・失敗の決定はいずれも命令の側にある
194
+ * 同値・失敗の決定は命令の側にある。
195
+ *
196
+ * 見送りだけはこの層で見る。項目を組み立てる純関数は `EditorState` しか
197
+ * 受け取らず、変換中かどうかを見られない(署名も中身も変えない)
174
198
  */
175
199
  writeFrontMatterFields(fields) {
200
+ if (!composition.canWriteFromOutside(view))
201
+ return { ok: true, value: 'skipped' };
176
202
  const result = writeFrontMatterFieldsCommand(view.state, fields);
177
203
  if (!result.ok)
178
204
  return result;
@@ -278,26 +304,19 @@ function sameMermaidText(a, b) {
278
304
  a.loadError === b.loadError);
279
305
  }
280
306
  /**
281
- * 変わった箇所だけを置き換える Transaction を作る。差分がなければ `null`。
307
+ * 適用の種類ごとの、取り消し履歴の扱いと変更の由来。
282
308
  *
283
- * 全置換にしないのは、カーソル位置と取り消し履歴を守るためである。
284
- * 前後の両端から一致する部分を除いて、中間の範囲を 1 回の置換にする
285
- * (最小差分は求めない。守りたいのはカーソルと履歴であって差分の最小性ではない)。
309
+ * 由来を書き添えるのは、表示範囲を絞る仕組みがこれを見て素通しするためである
310
+ * (塞ぐと、利用者が渡した本文が黙って落ちる)。
286
311
  */
287
- function diffTransaction(state, next) {
288
- const current = state.doc;
289
- const start = current.content.findDiffStart(next.content);
290
- if (start === null)
291
- return null;
292
- const ends = current.content.findDiffEnd(next.content);
293
- if (!ends)
294
- return null;
295
- let { a: endInCurrent, b: endInNext } = ends;
296
- // 置換範囲が前方の一致部分へ食い込まないようにそろえる
297
- const overlap = start - Math.min(endInCurrent, endInNext);
298
- if (overlap > 0) {
299
- endInCurrent += overlap;
300
- endInNext += overlap;
301
- }
302
- return state.tr.replace(start, endInCurrent, next.slice(start, endInNext));
312
+ const APPLY_RULES = {
313
+ // 直前の文字入力とは独立した取り消し単位にする
314
+ replacement: { origin: 'replacement', keep: true },
315
+ // 履歴に積まない。積むと、利用者が自分の入力を戻すつもりで他の書き手の変更を消す。
316
+ // 履歴の中の位置は `prosemirror-history` が写す
317
+ remote: { origin: 'remote', keep: false }
318
+ };
319
+ function applyRule(kind) {
320
+ const { origin, keep } = APPLY_RULES[kind];
321
+ return (transaction) => markOrigin(keep ? closeHistory(transaction) : transaction.setMeta('addToHistory', false), origin);
303
322
  }
@@ -53,15 +53,53 @@ export interface EditorSessionOptions extends EditorPresentation {
53
53
  */
54
54
  readonly imageUpload?: ImageUploadSource;
55
55
  }
56
+ /**
57
+ * 適用の種類。利用者の操作として取り消せる置き換えか、他の書き手の変更の同期反映か。
58
+ *
59
+ * **既定値を持たない。** 取り消し履歴の扱いが種類で決まるため、呼び出し側が必ず渡す。
60
+ */
61
+ export type ApplyKind = 'replacement' | 'remote';
62
+ export type ApplyStatus =
63
+ /** 当てた */
64
+ 'applied'
65
+ /** 内容が同じだったため何もしなかった */
66
+ | 'unchanged'
67
+ /** かな漢字変換の確定した文字が入りきっていないため見送った。**失敗ではない** */
68
+ | 'deferred';
69
+ /**
70
+ * 本文を書き込めなかった理由。本文を受け取る 3 つの命令(`resetDocument` /
71
+ * `replaceMarkdown` / `applyRemoteChange`)が共通で返す。
72
+ *
73
+ * **未準備を読み取りの失敗に混ぜない。** 混ぜると、利用側は自分の渡した本文が壊れて
74
+ * いるのか呼ぶのが早すぎたのかを区別できず、手がかりが `detail` の文字列しか残らない
75
+ * (内部の説明文であって、約束ではない)。`FrontMatterWriteError` が同じ形を持っている。
76
+ *
77
+ * **見送りを含めない。** 見送りは失敗ではなく正常な流れの一部であり、`ApplyStatus` が表す。
78
+ * 失敗として返すと、利用側のエラー処理が常時発火して本当の失敗が埋もれる。
79
+ */
80
+ export type MarkdownWriteError = MarkdownParseError | {
81
+ readonly kind: 'not-ready';
82
+ };
83
+ export interface ApplyOutcome {
84
+ readonly status: ApplyStatus;
85
+ /** 正規化した後の本文。`deferred` のときは当てる前の本文 */
86
+ readonly markdown: string;
87
+ }
56
88
  export interface EditorSession {
57
89
  getMarkdown(): string;
58
- /** 差分として適用する。カーソル位置と取り消し履歴を保持する */
59
- applyMarkdown(markdown: string): Result<void, MarkdownParseError>;
90
+ /**
91
+ * 外から渡された本文を、変わった箇所ごとの置き換えとして当てる。
92
+ * 取り消し履歴の扱いと変更の由来は `kind` が決める。
93
+ *
94
+ * 変換の確定した文字が入りきるまでは当てず、`deferred` を返す
95
+ */
96
+ applyMarkdown(markdown: string, kind: ApplyKind): Result<ApplyOutcome, MarkdownParseError>;
60
97
  /** 文書全体を入れ替え、取り消し履歴を初期化する */
61
98
  resetDocument(markdown: string): Result<void, MarkdownParseError>;
62
99
  /**
63
100
  * フロントマターへ項目を書き込む。取り消し履歴に積まず、本文とカーソルを変えない。
64
- * 利用者がその項目を編集している最中は見送り、`skipped` を返す
101
+ * 利用者がその項目を編集している最中、および変換の確定した文字が入りきるまでは
102
+ * 見送り、`skipped` を返す
65
103
  */
66
104
  writeFrontMatterFields(fields: FrontMatterFields): Result<FrontMatterWriteOutcome, FrontMatterWriteError>;
67
105
  focus(): void;
@@ -1,5 +1,5 @@
1
1
  import type { Result } from '../utils/result.types';
2
- import { type FocusBreadcrumbItem } from '../operations/plugins/focus';
2
+ import { type FocusBreadcrumbItem } from '../operations/plugins/focus.js';
3
3
  import type { SectionPath } from '../models/document/document.types';
4
4
  import type { ViewState, ViewStateError } from '../models/viewState/viewState.types';
5
5
  import type { EditorExtension, EditorSession } from './editorSession.types';
@@ -33,12 +33,6 @@ export interface OutlineViewController {
33
33
  focusPath(path: SectionPath): void;
34
34
  getViewState(): ViewState;
35
35
  applyViewState(value: unknown): Result<void, ViewStateError>;
36
- /**
37
- * 本文の差し替えを挟んで、見出しの折りたたみを引き継ぐ。
38
- * 差分適用は変更範囲のノードを作り直すため、そのままでは折りたたみが失われる。
39
- * `resetDocument`(別の文書を開く)には用いない。
40
- */
41
- preserveFolds<T>(apply: () => T): T;
42
36
  }
43
37
  /**
44
38
  * 表示状態のまとめ役。
@@ -1,9 +1,9 @@
1
- import { foldCommands } from '../operations/commands/sectionFold';
2
- import { foldClickPlugin } from '../operations/plugins/foldClick';
3
- import { foldGuardPlugin } from '../operations/plugins/foldGuard';
4
- import { createFocusPlugin } from '../operations/plugins/focus';
5
- import { createViewActions } from '../operations/keymap/viewActions';
6
- import { EMPTY_VIEW_STATE, viewStateCodec } from '../models/viewState/viewStateCodec';
1
+ import { foldCommands } from '../operations/commands/sectionFold.js';
2
+ import { foldClickPlugin } from '../operations/plugins/foldClick.js';
3
+ import { foldGuardPlugin } from '../operations/plugins/foldGuard.js';
4
+ import { createFocusPlugin } from '../operations/plugins/focus.js';
5
+ import { createViewActions } from '../operations/keymap/viewActions.js';
6
+ import { EMPTY_VIEW_STATE, viewStateCodec } from '../models/viewState/viewStateCodec.js';
7
7
  /**
8
8
  * 表示状態のまとめ役。
9
9
  *
@@ -96,20 +96,6 @@ export function createOutlineViewController(options) {
96
96
  focus.applyFocus(path)(view.state, view.dispatch.bind(view), view);
97
97
  sync();
98
98
  }
99
- function preserveFolds(apply) {
100
- const before = getViewState();
101
- const result = apply();
102
- const view = viewOf();
103
- if (!view)
104
- return result;
105
- // 突合キーによる照合をそのまま使うため、本当に変わったセクションには当たらない
106
- const decoded = viewStateCodec.decode(before, view.state.doc);
107
- if (decoded.ok && decoded.value.foldedPaths.length > 0) {
108
- foldCommands.applyFoldedPaths(decoded.value.foldedPaths)(view.state, view.dispatch.bind(view), view);
109
- }
110
- sync();
111
- return result;
112
- }
113
99
  return {
114
100
  extension,
115
101
  sync,
@@ -128,7 +114,6 @@ export function createOutlineViewController(options) {
128
114
  clearFocus,
129
115
  focusPath,
130
116
  getViewState,
131
- applyViewState,
132
- preserveFolds
117
+ applyViewState
133
118
  };
134
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@14ch/svelte-md-outliner",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
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.",