@14ch/svelte-md-outliner 0.0.19 → 0.0.21
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 +43 -1
- package/README.ja.md +48 -25
- package/README.md +48 -25
- package/dist/assets/styles/editor.css +57 -7
- package/dist/assets/styles/theme.css +66 -11
- package/dist/components/ContextMenu.svelte +1 -1
- package/dist/components/EditorSurface.svelte +2 -2
- package/dist/components/FocusBreadcrumb.svelte +7 -1
- package/dist/components/MarkdownEditor.svelte +69 -17
- package/dist/components/MarkdownEditor.svelte.d.ts +16 -3
- package/dist/components/ShortcutHelpDialog.svelte +3 -3
- package/dist/components/internal/Modal.svelte +3 -3
- package/dist/components/internal/Popup.svelte +3 -3
- package/dist/index.d.ts +12 -4
- package/dist/index.js +4 -2
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +1 -0
- package/dist/messages/index.d.ts +2 -2
- package/dist/messages/index.js +2 -2
- package/dist/models/document/bodySelection.js +1 -1
- package/dist/models/document/schema.d.ts +10 -1
- package/dist/models/document/schema.js +13 -2
- package/dist/models/document/sectionTree.d.ts +1 -1
- package/dist/models/document/sectionTree.js +2 -2
- package/dist/models/markdown/normalize.d.ts +20 -0
- package/dist/models/markdown/normalize.js +25 -0
- package/dist/models/markdown/parser.js +8 -6
- package/dist/models/markdown/serializer.js +12 -11
- package/dist/models/viewState/viewStateCodec.d.ts +1 -1
- package/dist/models/viewState/viewStateCodec.js +3 -3
- package/dist/operations/autoformat.js +3 -3
- package/dist/operations/commands/block.js +4 -4
- package/dist/operations/commands/element.js +9 -9
- package/dist/operations/commands/fencedBlock.js +2 -2
- package/dist/operations/commands/frontMatter.js +5 -5
- package/dist/operations/commands/lineBreak.js +1 -1
- package/dist/operations/commands/link.js +1 -1
- package/dist/operations/commands/list.js +59 -6
- package/dist/operations/commands/section.d.ts +1 -1
- package/dist/operations/commands/section.js +5 -5
- package/dist/operations/commands/sectionFold.d.ts +1 -1
- package/dist/operations/commands/sectionFold.js +5 -5
- package/dist/operations/commands/sectionJump.js +2 -2
- package/dist/operations/commands/selectedBlock.js +3 -3
- package/dist/operations/commands/table.js +43 -2
- package/dist/operations/documentDiff.d.ts +12 -0
- package/dist/operations/documentDiff.js +191 -0
- package/dist/operations/keymap/assemble.js +5 -5
- package/dist/operations/keymap/coreActions.js +13 -13
- package/dist/operations/keymap/menuItems.js +2 -2
- package/dist/operations/keymap/shortcutKeys.js +1 -1
- package/dist/operations/keymap/viewActions.js +5 -5
- package/dist/operations/plugins/blockHandle.js +1 -1
- package/dist/operations/plugins/compositionState.d.ts +30 -0
- package/dist/operations/plugins/compositionState.js +65 -0
- package/dist/operations/plugins/contextMenu.js +2 -2
- package/dist/operations/plugins/focus.js +19 -8
- package/dist/operations/plugins/foldClick.js +1 -1
- package/dist/operations/plugins/foldGuard.js +2 -2
- package/dist/operations/plugins/frontMatterGuard.js +4 -4
- package/dist/operations/plugins/frontMatterView.js +3 -3
- package/dist/operations/plugins/headingLevel.js +1 -1
- package/dist/operations/plugins/imagePaste.js +2 -2
- package/dist/operations/plugins/imageView.js +1 -1
- package/dist/operations/plugins/linkPaste.js +2 -2
- package/dist/operations/plugins/listStructure.js +1 -1
- package/dist/operations/plugins/markdownClipboard.js +8 -8
- package/dist/operations/plugins/mermaidView.js +2 -2
- package/dist/operations/plugins/requiredSelectionEntry.js +1 -1
- package/dist/operations/plugins/sectionView.js +1 -1
- package/dist/operations/plugins/tableHandles.js +2 -2
- package/dist/operations/transactionOrigin.d.ts +9 -5
- package/dist/operations/transactionOrigin.js +2 -1
- package/dist/states/contextMenuController.svelte.js +5 -5
- package/dist/states/editorSession.js +69 -50
- package/dist/states/editorSession.types.d.ts +41 -3
- package/dist/states/outlineViewController.svelte.d.ts +1 -7
- package/dist/states/outlineViewController.svelte.js +7 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,47 @@ 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.21] - 2026-10-11
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Breaking:** `--markdown-editor-surface` is now
|
|
13
|
+
`--markdown-editor-surface-elevated`, and sits one step lighter than the page
|
|
14
|
+
behind it on a dark surface. Menus and dialogs are the only surfaces the
|
|
15
|
+
editor paints.
|
|
16
|
+
- **Breaking:** text selection is drawn by the browser again, so it matches the
|
|
17
|
+
rest of your page — style `::selection` yourself to change it. The
|
|
18
|
+
`--markdown-editor-text-selection` property is gone;
|
|
19
|
+
`--markdown-editor-selection` stays for the selections the browser does not
|
|
20
|
+
draw (a container covered by `Cmd/Ctrl + A`, table cells).
|
|
21
|
+
- Menu and dialog shadows are custom properties
|
|
22
|
+
(`--markdown-editor-popup-shadow-*`, `--markdown-editor-dialog-shadow-*`) and
|
|
23
|
+
deepen on a dark surface.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- Links in the focus breadcrumb are no longer black on a dark surface.
|
|
28
|
+
|
|
29
|
+
## [0.0.20] - 2026-10-09
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- Collaborative editing: another writer's changes can be applied to a document
|
|
34
|
+
the user is editing.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- **Breaking:** `resetDocument` returns `{ kind: 'not-ready' }` before the editor
|
|
39
|
+
has mounted, where it used to return `{ kind: 'invalid-structure', detail }`.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- A long code line or URL no longer widens the document past its container.
|
|
44
|
+
- Making a list no longer puts a bullet on a code block, table or rule in the
|
|
45
|
+
selection.
|
|
46
|
+
- A blank line at the end of a code block no longer reappears on reopen.
|
|
47
|
+
- Shift-arrowing into a table no longer clears the selection outside it.
|
|
48
|
+
|
|
8
49
|
## [0.0.19] - 2026-10-04
|
|
9
50
|
|
|
10
51
|
### Changed
|
|
@@ -23,7 +64,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
23
64
|
dropped the item, and both behave the same now. Typing `>` inside a quotation
|
|
24
65
|
still nests it, and blocks that sit after an item's own text are untouched.
|
|
25
66
|
- Pressing Enter after a fence opens a code block, not only a diagram one.
|
|
26
|
-
|
|
67
|
+
A fence that named `mermaid` converted on Enter, while one that named `ts`
|
|
68
|
+
— or a fence with no language at all — waited for a space.
|
|
27
69
|
|
|
28
70
|
## [0.0.18] - 2026-09-28
|
|
29
71
|
|
package/README.ja.md
CHANGED
|
@@ -51,26 +51,28 @@ import '@14ch/svelte-md-outliner/styles/editor.css';
|
|
|
51
51
|
<MarkdownEditor bind:value bind:viewState label="議事録" maxWidth="42rem" />
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
| | 型 | 既定 |
|
|
55
|
-
| ------------------- | ----------------------------------------- | ---------- |
|
|
56
|
-
| `value` | `string` | `''` | 本文のマークダウン(`bind:`
|
|
57
|
-
| `onChange` | `(markdown: string) => void` | — | `bind:value` を使うなら不要
|
|
58
|
-
| `viewState` | `ViewState` | — | どの見出しを畳んでいるか、どこをフォーカスしているか
|
|
59
|
-
| `onViewStateChange` | `(viewState: ViewState) => void` | — | `bind:viewState` を使うなら不要
|
|
60
|
-
| `label` | `string` | 内蔵の文言 | 編集エリアのアクセシブルネーム
|
|
61
|
-
| `readonly` | `boolean` | `false` | 入力・編集コマンド・貼り付けを受け付けない
|
|
62
|
-
| `autofocus` | `boolean` | `false` | マウント時にフォーカスする
|
|
63
|
-
| `class` | `string` | `''` | 追加のクラス名
|
|
64
|
-
| `padding` | `string` | トークン | CSS の `padding` と同じ書き方
|
|
65
|
-
| `maxWidth` | `string` | トークン | 行の長さ。**クリックできる範囲は元の幅のまま**
|
|
66
|
-
| `lang` | `'en' \| 'ja'` | `'en'` | 同梱の言語
|
|
67
|
-
| `messages` | `EditorMessagesOverride` | — | 文字列の差し替え。同梱しない言語は一式を渡す
|
|
68
|
-
| `shortcutHelp` | `boolean` | `true` | 組み込みのショートカット一覧(`Mod-Alt-/`)
|
|
69
|
-
| `contextMenu` | `boolean` | `true` | 組み込みのコンテキストメニュー(右クリック / `Mod-/`)
|
|
70
|
-
| `uploadImage` | `(file: File) => Promise<string \| null>` | — | 貼り付けられた画像を引き受け、表示に使う URL を返す
|
|
54
|
+
| | 型 | 既定 | |
|
|
55
|
+
| ------------------- | ----------------------------------------- | ---------- | ---------------------------------------------------------------- |
|
|
56
|
+
| `value` | `string` | `''` | 本文のマークダウン(`bind:` 可)。取り消せる置き換えとして当たる |
|
|
57
|
+
| `onChange` | `(markdown: string) => void` | — | `bind:value` を使うなら不要 |
|
|
58
|
+
| `viewState` | `ViewState` | — | どの見出しを畳んでいるか、どこをフォーカスしているか |
|
|
59
|
+
| `onViewStateChange` | `(viewState: ViewState) => void` | — | `bind:viewState` を使うなら不要 |
|
|
60
|
+
| `label` | `string` | 内蔵の文言 | 編集エリアのアクセシブルネーム |
|
|
61
|
+
| `readonly` | `boolean` | `false` | 入力・編集コマンド・貼り付けを受け付けない |
|
|
62
|
+
| `autofocus` | `boolean` | `false` | マウント時にフォーカスする |
|
|
63
|
+
| `class` | `string` | `''` | 追加のクラス名 |
|
|
64
|
+
| `padding` | `string` | トークン | CSS の `padding` と同じ書き方 |
|
|
65
|
+
| `maxWidth` | `string` | トークン | 行の長さ。**クリックできる範囲は元の幅のまま** |
|
|
66
|
+
| `lang` | `'en' \| 'ja'` | `'en'` | 同梱の言語 |
|
|
67
|
+
| `messages` | `EditorMessagesOverride` | — | 文字列の差し替え。同梱しない言語は一式を渡す |
|
|
68
|
+
| `shortcutHelp` | `boolean` | `true` | 組み込みのショートカット一覧(`Mod-Alt-/`) |
|
|
69
|
+
| `contextMenu` | `boolean` | `true` | 組み込みのコンテキストメニュー(右クリック / `Mod-/`) |
|
|
70
|
+
| `uploadImage` | `(file: File) => Promise<string \| null>` | — | 貼り付けられた画像を引き受け、表示に使う URL を返す |
|
|
71
71
|
|
|
72
72
|
`viewState` は**今どう見ているか**であって、文書の内容ではない。このモジュールは何も保存しないので、保存先は利用側が決める(保存しなくてもよい)。
|
|
73
73
|
|
|
74
|
+
かな漢字変換の最中は、外から書き込むもの(`value`・`replaceMarkdown`・`applyRemoteChange`・`writeFrontMatterFields`)がいずれも当たらない。確定した文字を消さないための規則である。変換中に渡した `value` は変換が済んでから当たり、メソッドは `'deferred'` を返す(当て直す時機は利用側が決める)。
|
|
75
|
+
|
|
74
76
|
### 画像
|
|
75
77
|
|
|
76
78
|
`` は実際の画像として描かれる。画像を貼り付けると `uploadImage` が生の `File` を受け取り、返した URL が画像記法として貼り付け位置へ入る。どこへ保存するか、どの形式と大きさを受け入れるか、中身をどう無害化するか(SVG など)は**すべて利用側の裁量**である。モジュールが見るのは「クリップボードに画像ファイルがあるか」だけで、保存は一切持たない。
|
|
@@ -103,13 +105,19 @@ const fr: EditorMessages = { ...en, editorLabel: 'Éditeur' /* … */ };
|
|
|
103
105
|
<button onclick={() => editor?.resetDocument('# 別の文書\n')}>開き直す</button>
|
|
104
106
|
```
|
|
105
107
|
|
|
106
|
-
| |
|
|
107
|
-
| -------------------------------- |
|
|
108
|
-
| `getMarkdown()` | 現在のマークダウン
|
|
109
|
-
| `getViewState()` | 現在の表示状態
|
|
110
|
-
| `resetDocument(markdown)` | 文書を入れ替え、取り消し履歴を初期化する
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
108
|
+
| | |
|
|
109
|
+
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| `getMarkdown()` | 現在のマークダウン |
|
|
111
|
+
| `getViewState()` | 現在の表示状態 |
|
|
112
|
+
| `resetDocument(markdown)` | 文書を入れ替え、取り消し履歴を初期化する |
|
|
113
|
+
| `replaceMarkdown(markdown)` | 本文を置き換える。利用者の操作として**取り消せる**(取り込みなど) |
|
|
114
|
+
| `applyRemoteChange(markdown)` | 他の書き手の変更を反映する。**取り消し履歴に積まず**、変わった箇所だけを当てる(ほかの場所のカーソル・取り消しの手順・折りたたみは動かない) |
|
|
115
|
+
| `writeFrontMatterFields(fields)` | 取り消し履歴・カーソル・選択・本文に触れずに項目を書く。編集中の項目への書き込みは見送る |
|
|
116
|
+
| `focus()` | 編集エリアへフォーカスする |
|
|
117
|
+
|
|
118
|
+
`replaceMarkdown` と `applyRemoteChange` は `Result<ApplyOutcome, MarkdownWriteError>` を返す。`ApplyOutcome.status` は `'applied'`・`'unchanged'`(内容が同じだった)・`'deferred'`(変換が済むまで見送った。失敗ではないので、好きな時機に呼び直す)で、`ApplyOutcome.markdown` は正規化した後の本文である(読み戻しが要らない)。
|
|
119
|
+
|
|
120
|
+
本文を受け取る 3 つの命令(`resetDocument` を含む)は、失敗を `MarkdownWriteError` で返す。本文が読めなかったか、エディタがまだ用意できていない(`{ kind: 'not-ready' }`)かのどちらかである。
|
|
113
121
|
|
|
114
122
|
## キーボード
|
|
115
123
|
|
|
@@ -154,7 +162,7 @@ import './my-theme.css';
|
|
|
154
162
|
}
|
|
155
163
|
|
|
156
164
|
:where([data-theme='dark']) {
|
|
157
|
-
--markdown-editor-surface: #16181d;
|
|
165
|
+
--markdown-editor-surface-elevated: #16181d;
|
|
158
166
|
}
|
|
159
167
|
```
|
|
160
168
|
|
|
@@ -180,9 +188,24 @@ const blocks = readBodyBlocks(readBody(markdown));
|
|
|
180
188
|
| `readBodyBlocks(body)` | 本文のブロック一覧(種別・本文中の位置・見出しのパス) |
|
|
181
189
|
| `readPlainText(markdown)` | インライン記法を取り除いたテキスト |
|
|
182
190
|
| `writeFrontMatterFields(markdown, fields)` | フロントマターへの書き込み。区切り・クォート・挿入位置は内部で処理する |
|
|
191
|
+
| `normalizeMarkdown(markdown)` | 書き方を正準形へ揃える。`Result<string, MarkdownParseError>` を返す |
|
|
183
192
|
|
|
184
193
|
**値は文字列のまま返し、型として解釈しない。** これが、このモジュールを YAML の解析器として使い始めないための境界である。
|
|
185
194
|
|
|
195
|
+
### 別の経路で書かれた本文と突き合わせる
|
|
196
|
+
|
|
197
|
+
`normalizeMarkdown` は**意味を変えずに書き方だけを揃える**。`*` は `-` に、下線の見出しは `#` に、表の区切りは間隔のそろった形に、番号付きの項目は振り直され、余分な空行と `\r\n` は落ち、末尾の改行は 1 つになる。2 回通しても変わらない。
|
|
198
|
+
|
|
199
|
+
**約束は、エディタを通した本文と文字列として一致することである。** 読み込み直後の `getMarkdown()`、`resetDocument` の後、`replaceMarkdown` / `applyRemoteChange` の戻り値の `markdown`——どれも同じ文字列になる。したがって、出どころの違う本文を突き合わせる・統合するときは(エージェントが書いた本文、マイグレーションが書いた行、古い版のアプリが書いたもの)、先に全部これを通す。通さないと、書き方の違いだけでほぼ全行が「変更あり」に見える。
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import { normalizeMarkdown } from '@14ch/svelte-md-outliner/markdown';
|
|
203
|
+
|
|
204
|
+
const theirs = normalizeMarkdown(fromServer);
|
|
205
|
+
if (!theirs.ok) return; // 読み取れなかった
|
|
206
|
+
const merged = merge(base, mine, theirs.value); // mine はすでに正準形
|
|
207
|
+
```
|
|
208
|
+
|
|
186
209
|
## 知っておく制約
|
|
187
210
|
|
|
188
211
|
- **シングルトンの状態を持たない。** 同じページに複数置いても互いに干渉しない
|
package/README.md
CHANGED
|
@@ -51,26 +51,28 @@ import '@14ch/svelte-md-outliner/styles/editor.css';
|
|
|
51
51
|
<MarkdownEditor bind:value bind:viewState label="Meeting notes" maxWidth="42rem" />
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
| | Type | Default |
|
|
55
|
-
| ------------------- | ----------------------------------------- | -------- |
|
|
56
|
-
| `value` | `string` | `''` | Markdown source (bindable)
|
|
57
|
-
| `onChange` | `(markdown: string) => void` | — | Not needed when you use `bind:value`
|
|
58
|
-
| `viewState` | `ViewState` | — | Which headings are folded, which section is zoomed
|
|
59
|
-
| `onViewStateChange` | `(viewState: ViewState) => void` | — | Not needed when you use `bind:viewState`
|
|
60
|
-
| `label` | `string` | built-in | Accessible name for the editing surface
|
|
61
|
-
| `readonly` | `boolean` | `false` | Rejects typing, commands and pastes
|
|
62
|
-
| `autofocus` | `boolean` | `false` | Focus on mount
|
|
63
|
-
| `class` | `string` | `''` | Extra class names
|
|
64
|
-
| `padding` | `string` | token | Written exactly like CSS `padding`
|
|
65
|
-
| `maxWidth` | `string` | token | Line length. **The clickable surface keeps the full width**
|
|
66
|
-
| `lang` | `'en' \| 'ja'` | `'en'` | Bundled UI language
|
|
67
|
-
| `messages` | `EditorMessagesOverride` | — | Replace individual strings, or supply a whole language
|
|
68
|
-
| `shortcutHelp` | `boolean` | `true` | Built-in shortcut sheet (`Mod-Alt-/`)
|
|
69
|
-
| `contextMenu` | `boolean` | `true` | Built-in context menu (right click / `Mod-/`)
|
|
70
|
-
| `uploadImage` | `(file: File) => Promise<string \| null>` | — | Takes a pasted image, returns the URL to display
|
|
54
|
+
| | Type | Default | |
|
|
55
|
+
| ------------------- | ----------------------------------------- | -------- | -------------------------------------------------------------- |
|
|
56
|
+
| `value` | `string` | `''` | Markdown source (bindable). Applied as an undoable replacement |
|
|
57
|
+
| `onChange` | `(markdown: string) => void` | — | Not needed when you use `bind:value` |
|
|
58
|
+
| `viewState` | `ViewState` | — | Which headings are folded, which section is zoomed |
|
|
59
|
+
| `onViewStateChange` | `(viewState: ViewState) => void` | — | Not needed when you use `bind:viewState` |
|
|
60
|
+
| `label` | `string` | built-in | Accessible name for the editing surface |
|
|
61
|
+
| `readonly` | `boolean` | `false` | Rejects typing, commands and pastes |
|
|
62
|
+
| `autofocus` | `boolean` | `false` | Focus on mount |
|
|
63
|
+
| `class` | `string` | `''` | Extra class names |
|
|
64
|
+
| `padding` | `string` | token | Written exactly like CSS `padding` |
|
|
65
|
+
| `maxWidth` | `string` | token | Line length. **The clickable surface keeps the full width** |
|
|
66
|
+
| `lang` | `'en' \| 'ja'` | `'en'` | Bundled UI language |
|
|
67
|
+
| `messages` | `EditorMessagesOverride` | — | Replace individual strings, or supply a whole language |
|
|
68
|
+
| `shortcutHelp` | `boolean` | `true` | Built-in shortcut sheet (`Mod-Alt-/`) |
|
|
69
|
+
| `contextMenu` | `boolean` | `true` | Built-in context menu (right click / `Mod-/`) |
|
|
70
|
+
| `uploadImage` | `(file: File) => Promise<string \| null>` | — | Takes a pasted image, returns the URL to display |
|
|
71
71
|
|
|
72
72
|
`viewState` is **how you are looking at the document**, not its content. This module stores nothing, so persist it wherever you like — or not at all.
|
|
73
73
|
|
|
74
|
+
While the user is in the middle of IME composition, anything written from outside — `value`, `replaceMarkdown`, `applyRemoteChange`, `writeFrontMatterFields` — is held back so that committed characters are never swallowed. A `value` you set during composition is applied once the composition settles; the methods return `'deferred'` and leave retrying to you.
|
|
75
|
+
|
|
74
76
|
### Images
|
|
75
77
|
|
|
76
78
|
`` is rendered as a real image. Paste an image and `uploadImage` receives the raw `File`; the URL you return is inserted as image notation at the paste position. Where the bytes go, which formats and sizes you accept, and how you sanitize them (SVG, for instance) are all yours — this module only checks whether the clipboard holds an image file, and never stores anything itself.
|
|
@@ -103,13 +105,19 @@ Modifier symbols (`⌘` and friends) follow the platform, not the language.
|
|
|
103
105
|
<button onclick={() => editor?.resetDocument('# Another document\n')}>Open another</button>
|
|
104
106
|
```
|
|
105
107
|
|
|
106
|
-
| |
|
|
107
|
-
| -------------------------------- |
|
|
108
|
-
| `getMarkdown()` | Current Markdown
|
|
109
|
-
| `getViewState()` | Current view state
|
|
110
|
-
| `resetDocument(markdown)` | Replace the document and clear undo history
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
108
|
+
| | |
|
|
109
|
+
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
110
|
+
| `getMarkdown()` | Current Markdown |
|
|
111
|
+
| `getViewState()` | Current view state |
|
|
112
|
+
| `resetDocument(markdown)` | Replace the document and clear undo history |
|
|
113
|
+
| `replaceMarkdown(markdown)` | Replace the body as a user action. **Undoable**, like importing a file |
|
|
114
|
+
| `applyRemoteChange(markdown)` | Apply another writer's changes. **Not added to undo history**; only the changed spots are replaced, so cursor, undo steps and folds elsewhere stay put |
|
|
115
|
+
| `writeFrontMatterFields(fields)` | Write front matter without touching undo history, cursor, selection or body. Skips while the user edits that entry |
|
|
116
|
+
| `focus()` | Focus the editing surface |
|
|
117
|
+
|
|
118
|
+
Both `replaceMarkdown` and `applyRemoteChange` return `Result<ApplyOutcome, MarkdownWriteError>`. `ApplyOutcome.status` is `'applied'`, `'unchanged'` (the text was already identical) or `'deferred'` (held back until IME composition settles — not a failure; call again when you like), and `ApplyOutcome.markdown` is the normalized text, so you do not need to read it back.
|
|
119
|
+
|
|
120
|
+
All three commands that take Markdown — including `resetDocument` — report a failure as `MarkdownWriteError`: either the text could not be read, or `{ kind: 'not-ready' }` because the editor is not mounted yet.
|
|
113
121
|
|
|
114
122
|
## Keyboard
|
|
115
123
|
|
|
@@ -154,7 +162,7 @@ import './my-theme.css';
|
|
|
154
162
|
}
|
|
155
163
|
|
|
156
164
|
:where([data-theme='dark']) {
|
|
157
|
-
--markdown-editor-surface: #16181d;
|
|
165
|
+
--markdown-editor-surface-elevated: #16181d;
|
|
158
166
|
}
|
|
159
167
|
```
|
|
160
168
|
|
|
@@ -180,9 +188,24 @@ const blocks = readBodyBlocks(readBody(markdown));
|
|
|
180
188
|
| `readBodyBlocks(body)` | Top-level blocks: kind, offsets within the body, heading path |
|
|
181
189
|
| `readPlainText(markdown)` | Readable text with inline markup stripped |
|
|
182
190
|
| `writeFrontMatterFields(markdown, fields)` | Write entries; delimiters, quoting and placement are handled for you |
|
|
191
|
+
| `normalizeMarkdown(markdown)` | Canonical spelling. Returns `Result<string, MarkdownParseError>` |
|
|
183
192
|
|
|
184
193
|
Values come back as strings and are never coerced. That boundary keeps this module from turning into a YAML parser.
|
|
185
194
|
|
|
195
|
+
### Comparing text that came from somewhere else
|
|
196
|
+
|
|
197
|
+
`normalizeMarkdown` settles spelling without changing meaning: `*` becomes `-`, setext headings become `#`, table delimiters get even spacing, ordered items get renumbered, stray blank lines and `\r\n` go away, and the text ends with exactly one newline. Running it twice changes nothing.
|
|
198
|
+
|
|
199
|
+
**What it guarantees is a string match with text that went through the editor** — `getMarkdown()` right after loading, after `resetDocument`, and the `markdown` returned by `replaceMarkdown` / `applyRemoteChange` all produce the same string. So if you diff or merge text from two sources — a file an agent wrote, a row a migration left behind, an older version of your own app — put every side through this first. Otherwise spelling alone makes nearly every line look changed.
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import { normalizeMarkdown } from '@14ch/svelte-md-outliner/markdown';
|
|
203
|
+
|
|
204
|
+
const theirs = normalizeMarkdown(fromServer);
|
|
205
|
+
if (!theirs.ok) return; // the text could not be read
|
|
206
|
+
const merged = merge(base, mine, theirs.value); // mine is already canonical
|
|
207
|
+
```
|
|
208
|
+
|
|
186
209
|
## Constraints worth knowing
|
|
187
210
|
|
|
188
211
|
- **No singleton state.** Several editors on one page never interfere.
|
|
@@ -176,6 +176,27 @@
|
|
|
176
176
|
flex: 1 0 auto;
|
|
177
177
|
min-height: 100%;
|
|
178
178
|
|
|
179
|
+
/**
|
|
180
|
+
* **幅は置いた先の箱が決める。中身に決めさせない。**
|
|
181
|
+
*
|
|
182
|
+
* 上の `flex` は高さの話として書いたものだが、置いた先が flex の**行**なら同じ宣言が
|
|
183
|
+
* 横に効き、「縮めない(`flex-shrink: 0`)× 中身のぶんの基準(`flex-basis: auto`)」で
|
|
184
|
+
* 箱より広い面ができる。grid では自動の最低幅(`min-width: auto`)が中身の最低幅に
|
|
185
|
+
* なって同じことが起きる。**どちらも横に長いコードブロック 1 つで起こる**
|
|
186
|
+
* (`white-space: pre` の行は折れないため、長い行がそのまま最低幅になる)。
|
|
187
|
+
*
|
|
188
|
+
* 2 つ要る。`max-width` は flex の行の基準を箱の幅で抑え、`min-width` は grid の
|
|
189
|
+
* 最低幅を外す(最低幅は最大幅に勝つので、片方だけでは止まらない)。
|
|
190
|
+
* 高さの受け渡しには触らない——`max-width: 100%` は箱いっぱいであり、面は狭めない。
|
|
191
|
+
*
|
|
192
|
+
* **ここで抑えられるのは、面そのものが flex / grid の子である場合だけである。**
|
|
193
|
+
* 中身の最低幅はその外へも伝わるため(`max-width` の百分率は最低幅の計算では
|
|
194
|
+
* 無視される)、置いた先が包みを 1 枚挟めばその包みが縮まなくなる。幅を中身から
|
|
195
|
+
* 切り離すのは中身の側の役目である(→ コードブロックの `> code`、面の `overflow-wrap`)。
|
|
196
|
+
*/
|
|
197
|
+
min-width: 0;
|
|
198
|
+
max-width: 100%;
|
|
199
|
+
|
|
179
200
|
color: var(--markdown-editor-text);
|
|
180
201
|
font-family: var(--markdown-editor-font);
|
|
181
202
|
line-height: var(--markdown-editor-line-height);
|
|
@@ -284,7 +305,14 @@
|
|
|
284
305
|
*/
|
|
285
306
|
cursor: default;
|
|
286
307
|
white-space: pre-wrap;
|
|
287
|
-
|
|
308
|
+
/**
|
|
309
|
+
* 切れ目の無い長い文字列(URL など)を、必要なら途中で折る。
|
|
310
|
+
*
|
|
311
|
+
* **`anywhere` は最低幅(min-content)の計算にも効く。** `break-word` では
|
|
312
|
+
* 折り返しはするが最低幅が縮まないため、長い URL 1 つで編集エリアが
|
|
313
|
+
* 置いた先の箱より広くなる(表のセルが同じ理由で同じ指定を採っている)。
|
|
314
|
+
*/
|
|
315
|
+
overflow-wrap: anywhere;
|
|
288
316
|
}
|
|
289
317
|
|
|
290
318
|
/**
|
|
@@ -344,9 +372,17 @@
|
|
|
344
372
|
margin-inline: auto;
|
|
345
373
|
}
|
|
346
374
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
375
|
+
/*
|
|
376
|
+
* **文字をなぞった範囲は、実行環境が描くものをそのまま使う**(`::selection` を持たない)。
|
|
377
|
+
*
|
|
378
|
+
* 置いた先のアプリと同じ見え方になり、暗い面でも、実行環境の高コントラストの設定でも、
|
|
379
|
+
* 選んだ文字の色まで含めて実行環境が面倒を見る。自前で敷くと背景だけを塗り替えることに
|
|
380
|
+
* なり、20% の薄い色は暗い面で灰色の帯に見えていた(利用者の報告、2026-10-11)。
|
|
381
|
+
*
|
|
382
|
+
* **配下ごと覆った状態は実行環境が描かない**ので、そちらは自前で塗る
|
|
383
|
+
* (`--markdown-editor-cover-fill`。編集基盤が `ProseMirror-hideselection` を付けて
|
|
384
|
+
* 実行環境の敷き色を止めるため、塗らなければ何も出ない)。
|
|
385
|
+
*/
|
|
350
386
|
|
|
351
387
|
/**
|
|
352
388
|
* ブロックそのものを指している状態。
|
|
@@ -376,8 +412,10 @@
|
|
|
376
412
|
* コンテナを配下ごと覆っている状態(`Cmd/Ctrl + A` の段階的な拡大)。
|
|
377
413
|
*
|
|
378
414
|
* **枠では描かない。** 枠は「そのブロックを指している」ことの印であり、指した状態から
|
|
379
|
-
*
|
|
380
|
-
*
|
|
415
|
+
* だけ構造操作の入口が開く。覆いは選んだ範囲であって指した状態ではないので、**塗り**で
|
|
416
|
+
* 描く。役割が違うものを同じ見た目にしない。文字をなぞったときの色は実行環境のもので
|
|
417
|
+
* あり(→ 上の `::selection` の注記)、こちらから合わせる手立ては無い。塗られていること
|
|
418
|
+
* 自体が「選んだ範囲」の印になる。
|
|
381
419
|
*
|
|
382
420
|
* ここに並ぶ種別は `selectedBlock.ts` の `isCoveringContainer` と対になる。
|
|
383
421
|
* 覆えるコンテナを足したら、この並びにも足す。**項目はここに並べない**(印まで塗りを
|
|
@@ -882,6 +920,17 @@
|
|
|
882
920
|
.markdown-editor__code-block > code {
|
|
883
921
|
display: block;
|
|
884
922
|
overflow-x: auto;
|
|
923
|
+
/**
|
|
924
|
+
* **中身の幅を外へ伝えない。** 折り返さない行(`white-space: pre`)はそのまま
|
|
925
|
+
* 最低幅(min-content)になり、面・編集エリア・置いた先の箱まで押し広げる。
|
|
926
|
+
* `max-width` では止まらない——百分率は最低幅の計算では無視されるため、
|
|
927
|
+
* 置いた先が flex / grid なら長いコード 1 行で文書全体が横に伸びる
|
|
928
|
+
* (利用者の指摘、2026-10-06)。
|
|
929
|
+
*
|
|
930
|
+
* 幅を中身から切り離せば、収まらない行はこの箱の中で横に送られる。
|
|
931
|
+
* 折り返しはしない——コードの行は書いたとおりの行である。
|
|
932
|
+
*/
|
|
933
|
+
contain: inline-size;
|
|
885
934
|
font-family: inherit;
|
|
886
935
|
}
|
|
887
936
|
|
|
@@ -1081,10 +1130,11 @@
|
|
|
1081
1130
|
margin: 0 0 0.75em;
|
|
1082
1131
|
}
|
|
1083
1132
|
|
|
1084
|
-
/* 中の `code`
|
|
1133
|
+
/* 中の `code` の縮みを止め、幅を外へ伝えない(→ コードブロックの `> code`) */
|
|
1085
1134
|
.markdown-editor__mermaid-source > code {
|
|
1086
1135
|
display: block;
|
|
1087
1136
|
overflow-x: auto;
|
|
1137
|
+
contain: inline-size;
|
|
1088
1138
|
font-family: inherit;
|
|
1089
1139
|
}
|
|
1090
1140
|
|
|
@@ -154,6 +154,18 @@
|
|
|
154
154
|
--markdown-editor-white-900-transparent: rgba(255, 255, 255, 0.9);
|
|
155
155
|
--markdown-editor-white-950-transparent: rgba(255, 255, 255, 0.95);
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* 影の黒。**面の色の段とは別に持つ。** 影は面に塗る色ではなく、面の下に落ちる暗がりで
|
|
159
|
+
* ある。明るい面の暖色寄りの中性色(`base-*`)でも、暗いサーフェスの白(`white-*`)でも
|
|
160
|
+
* なく、素の黒で持つ。段は 6 つ——重ねる 3 段を、明るい面と暗いサーフェスでそれぞれ持つ。
|
|
161
|
+
*/
|
|
162
|
+
--markdown-editor-black-100-transparent: rgba(0, 0, 0, 0.12);
|
|
163
|
+
--markdown-editor-black-200-transparent: rgba(0, 0, 0, 0.14);
|
|
164
|
+
--markdown-editor-black-300-transparent: rgba(0, 0, 0, 0.2);
|
|
165
|
+
--markdown-editor-black-400-transparent: rgba(0, 0, 0, 0.4);
|
|
166
|
+
--markdown-editor-black-500-transparent: rgba(0, 0, 0, 0.45);
|
|
167
|
+
--markdown-editor-black-600-transparent: rgba(0, 0, 0, 0.6);
|
|
168
|
+
|
|
157
169
|
/**
|
|
158
170
|
* 文字の濃さは 2 段で持つ。**名前は同梱の svelte-ui に揃える**
|
|
159
171
|
* (`--svelte-ui-text-color` / `--svelte-ui-text-subtle-color`)。同じ意味の色が
|
|
@@ -183,13 +195,19 @@
|
|
|
183
195
|
*/
|
|
184
196
|
--markdown-editor-guide: var(--markdown-editor-base-100-transparent);
|
|
185
197
|
/**
|
|
186
|
-
*
|
|
198
|
+
* 浮き上がる面の色(メニュー・ダイアログ)。**ここだけは不透明にする**
|
|
187
199
|
* (透かすと下の文字が透けて、サーフェスに見えない)。
|
|
188
200
|
*
|
|
189
201
|
* **編集エリアの背景ではない。** あちらは自分の見た目を持たず、置いた先の背景を
|
|
190
|
-
* そのまま透かす(→ 用途の `--markdown-editor-background
|
|
202
|
+
* そのまま透かす(→ 用途の `--markdown-editor-background`)。**このエディタが塗る面は
|
|
203
|
+
* 浮き上がる面だけ**なので、地の面の色は持たない。
|
|
204
|
+
*
|
|
205
|
+
* 名前と値は同梱の svelte-ui の `--svelte-ui-surface-elevated-color` に揃える
|
|
206
|
+
* (`--svelte-ui-surface-color` ではない。あちらの地の面に当たるものは、ここでは
|
|
207
|
+
* 置いた先の背景である)。暗いサーフェスでは**地の面より一段明るくする**——暗いところでは
|
|
208
|
+
* 「明るい=手前」が奥行きの合図であり、同じ濃さだと浮かずに沈む。
|
|
191
209
|
*/
|
|
192
|
-
--markdown-editor-surface: var(--markdown-editor-white);
|
|
210
|
+
--markdown-editor-surface-elevated: var(--markdown-editor-white);
|
|
193
211
|
/* 敷く色(コードブロック・図の枠内・表の見出し行)。面をわずかに沈ませるだけ */
|
|
194
212
|
--markdown-editor-surface-accent: var(--markdown-editor-base-50-transparent);
|
|
195
213
|
/* 強調色は不透明。透かすと色味が背景に混ざり、強調に見えない */
|
|
@@ -204,8 +222,12 @@
|
|
|
204
222
|
* **編集用のパレット(`edit-*`)から採る**。文書の色を
|
|
205
223
|
* 変えても操作の見え方は変わらず、逆も同じである。
|
|
206
224
|
*
|
|
207
|
-
*
|
|
225
|
+
* 選んだ範囲に敷く色は**文字の上に重なる**ため透かす
|
|
208
226
|
* (不透明だと、敷いた色と文字の濃さの関係が背景によって変わる)。
|
|
227
|
+
*
|
|
228
|
+
* **文字をなぞった範囲の色はここに無い。** 実行環境が描くものに委ねている
|
|
229
|
+
* (→ `editor.css` の `::selection` の注記)。ここにあるのは、実行環境が描かない
|
|
230
|
+
* 選び方——配下ごと覆った状態(`cover-fill`)と表のセル範囲——に敷く色である。
|
|
209
231
|
*/
|
|
210
232
|
--markdown-editor-selection: var(--markdown-editor-edit-100-transparent);
|
|
211
233
|
/* 選んだセルへ重ねる色。内容の上に敷くため、透ける値にする */
|
|
@@ -232,6 +254,20 @@
|
|
|
232
254
|
* 明暗でも変えない**(明るい面でも背後は暗くする)。
|
|
233
255
|
*/
|
|
234
256
|
--markdown-editor-scrim: rgb(0 0 0 / 40%);
|
|
257
|
+
/**
|
|
258
|
+
* 浮き上がりの影。**3 段を重ねて 1 つの影にする**(内側の濃い影・中間・外へ広がる薄い影)。
|
|
259
|
+
* 名前と値は同梱の svelte-ui の `--svelte-ui-shadow-color-*` に揃える(`-color` の接尾辞は
|
|
260
|
+
* 付けない。意味の色は素の名前で持つのがこのファイルの作法である)。
|
|
261
|
+
*
|
|
262
|
+
* **重ね方(ずらす量とぼかし)は部品の側が持つ。** あれは寸法であって配色ではなく、
|
|
263
|
+
* テーマに混ざると何を変えるためのファイルなのかがぼやける。
|
|
264
|
+
*
|
|
265
|
+
* **暗いサーフェスでは濃くする**(→ 下の暗いサーフェスのブロック)。線と同じ事情で、
|
|
266
|
+
* 黒い影は暗い背景に沈んで見えない。
|
|
267
|
+
*/
|
|
268
|
+
--markdown-editor-shadow-strong: var(--markdown-editor-black-300-transparent);
|
|
269
|
+
--markdown-editor-shadow: var(--markdown-editor-black-200-transparent);
|
|
270
|
+
--markdown-editor-shadow-weak: var(--markdown-editor-black-100-transparent);
|
|
235
271
|
|
|
236
272
|
/**
|
|
237
273
|
* ここから下は**用途ごとの色**である。上の基礎トークン(意味の色。明暗で裏返る)を
|
|
@@ -297,8 +333,7 @@
|
|
|
297
333
|
--markdown-editor-table-handle-hover-border: var(--markdown-editor-accent);
|
|
298
334
|
--markdown-editor-table-handle-hover-color: var(--markdown-editor-accent);
|
|
299
335
|
|
|
300
|
-
/*
|
|
301
|
-
--markdown-editor-text-selection: var(--markdown-editor-selection);
|
|
336
|
+
/* コンテナを配下ごと覆っている状態(文字をなぞった範囲は実行環境が描く) */
|
|
302
337
|
--markdown-editor-cover-fill: var(--markdown-editor-selection);
|
|
303
338
|
|
|
304
339
|
/* ブロックを指している枠と、押せることを示す帯 */
|
|
@@ -339,9 +374,13 @@
|
|
|
339
374
|
--markdown-editor-breadcrumb-focus-ring: var(--markdown-editor-accent);
|
|
340
375
|
|
|
341
376
|
/* 重ねて出すコンテナ(コンテキストメニューの土台) */
|
|
342
|
-
--markdown-editor-popup-background: var(--markdown-editor-surface);
|
|
377
|
+
--markdown-editor-popup-background: var(--markdown-editor-surface-elevated);
|
|
343
378
|
--markdown-editor-popup-border: var(--markdown-editor-border-weak);
|
|
344
379
|
--markdown-editor-popup-text: var(--markdown-editor-text);
|
|
380
|
+
/* 浮き上がりの影。3 段を重ねて 1 つの影にする(重ね方は部品の側が持つ) */
|
|
381
|
+
--markdown-editor-popup-shadow-strong: var(--markdown-editor-shadow-strong);
|
|
382
|
+
--markdown-editor-popup-shadow: var(--markdown-editor-shadow);
|
|
383
|
+
--markdown-editor-popup-shadow-weak: var(--markdown-editor-shadow-weak);
|
|
345
384
|
|
|
346
385
|
/* コンテキストメニュー */
|
|
347
386
|
--markdown-editor-menu-separator: var(--markdown-editor-border);
|
|
@@ -354,13 +393,17 @@
|
|
|
354
393
|
--markdown-editor-menu-target-fill: var(--markdown-editor-target-fill);
|
|
355
394
|
|
|
356
395
|
/* ダイアログ */
|
|
357
|
-
--markdown-editor-dialog-background: var(--markdown-editor-surface);
|
|
396
|
+
--markdown-editor-dialog-background: var(--markdown-editor-surface-elevated);
|
|
358
397
|
--markdown-editor-dialog-backdrop: var(--markdown-editor-scrim);
|
|
359
398
|
--markdown-editor-dialog-text: var(--markdown-editor-text);
|
|
360
399
|
--markdown-editor-dialog-border: var(--markdown-editor-border);
|
|
361
400
|
--markdown-editor-dialog-title-color: var(--markdown-editor-text);
|
|
362
401
|
/* 見出しと脚を本文から分ける線(巻き取るときだけ出る) */
|
|
363
402
|
--markdown-editor-dialog-divider: var(--markdown-editor-border);
|
|
403
|
+
/* 浮き上がりの影。メニューとは別の部品なので別に持つ(同じ濃さなのは結果) */
|
|
404
|
+
--markdown-editor-dialog-shadow-strong: var(--markdown-editor-shadow-strong);
|
|
405
|
+
--markdown-editor-dialog-shadow: var(--markdown-editor-shadow);
|
|
406
|
+
--markdown-editor-dialog-shadow-weak: var(--markdown-editor-shadow-weak);
|
|
364
407
|
|
|
365
408
|
/* ショートカット一覧 */
|
|
366
409
|
--markdown-editor-shortcut-group-title-color: var(--markdown-editor-text-subtle);
|
|
@@ -424,6 +467,9 @@
|
|
|
424
467
|
* **不透明度は明るい面より強い。** 線は、同じ不透明度では暗いサーフェスで見分けにくい
|
|
425
468
|
* (計算上の段差は暗いサーフェスの方が大きく出るのに、細い線は実際に見ると沈む)。
|
|
426
469
|
* そのため暗いサーフェスでは各段を上げる(線は 0.35 → 0.4、コンテナの縁は 0.15 → 0.2)。
|
|
470
|
+
* **影も同じ**で、黒い影は暗い背景に沈んで見えないため濃くする(0.2 / 0.14 / 0.12 →
|
|
471
|
+
* 0.6 / 0.45 / 0.4)。**浮き上がる面は逆に明るくする**——暗いところでは「明るい=手前」が
|
|
472
|
+
* 奥行きの合図なので、地の面(置いた先の背景)より一段明るい `base-900` を採る。
|
|
427
473
|
*
|
|
428
474
|
* 不透明のまま持つのは、明るい面と同じ 3 つだけ——強調色・指している枠・浮いているサーフェスである。
|
|
429
475
|
*
|
|
@@ -459,7 +505,10 @@
|
|
|
459
505
|
--markdown-editor-cell-selection: var(--markdown-editor-edit-900-transparent);
|
|
460
506
|
--markdown-editor-block-selection: var(--markdown-editor-edit-lighter);
|
|
461
507
|
--markdown-editor-block-hover: var(--markdown-editor-edit-800-transparent);
|
|
462
|
-
--markdown-editor-surface: var(--markdown-editor-base-
|
|
508
|
+
--markdown-editor-surface-elevated: var(--markdown-editor-base-900);
|
|
509
|
+
--markdown-editor-shadow-strong: var(--markdown-editor-black-600-transparent);
|
|
510
|
+
--markdown-editor-shadow: var(--markdown-editor-black-500-transparent);
|
|
511
|
+
--markdown-editor-shadow-weak: var(--markdown-editor-black-400-transparent);
|
|
463
512
|
--markdown-editor-hover-overlay: var(--markdown-editor-white-100-transparent);
|
|
464
513
|
--markdown-editor-target-fill: var(--markdown-editor-edit-950-transparent);
|
|
465
514
|
}
|
|
@@ -480,7 +529,10 @@
|
|
|
480
529
|
--markdown-editor-cell-selection: var(--markdown-editor-edit-900-transparent);
|
|
481
530
|
--markdown-editor-block-selection: var(--markdown-editor-edit-lighter);
|
|
482
531
|
--markdown-editor-block-hover: var(--markdown-editor-edit-800-transparent);
|
|
483
|
-
--markdown-editor-surface: var(--markdown-editor-base-
|
|
532
|
+
--markdown-editor-surface-elevated: var(--markdown-editor-base-900);
|
|
533
|
+
--markdown-editor-shadow-strong: var(--markdown-editor-black-600-transparent);
|
|
534
|
+
--markdown-editor-shadow: var(--markdown-editor-black-500-transparent);
|
|
535
|
+
--markdown-editor-shadow-weak: var(--markdown-editor-black-400-transparent);
|
|
484
536
|
--markdown-editor-hover-overlay: var(--markdown-editor-white-100-transparent);
|
|
485
537
|
--markdown-editor-target-fill: var(--markdown-editor-edit-950-transparent);
|
|
486
538
|
}
|
|
@@ -506,7 +558,10 @@
|
|
|
506
558
|
--markdown-editor-cell-selection: var(--markdown-editor-edit-100-transparent);
|
|
507
559
|
--markdown-editor-block-selection: var(--markdown-editor-edit-color);
|
|
508
560
|
--markdown-editor-block-hover: var(--markdown-editor-edit-200-transparent);
|
|
509
|
-
--markdown-editor-surface: var(--markdown-editor-white);
|
|
561
|
+
--markdown-editor-surface-elevated: var(--markdown-editor-white);
|
|
562
|
+
--markdown-editor-shadow-strong: var(--markdown-editor-black-300-transparent);
|
|
563
|
+
--markdown-editor-shadow: var(--markdown-editor-black-200-transparent);
|
|
564
|
+
--markdown-editor-shadow-weak: var(--markdown-editor-black-100-transparent);
|
|
510
565
|
--markdown-editor-hover-overlay: var(--markdown-editor-base-100-transparent);
|
|
511
566
|
--markdown-editor-target-fill: var(--markdown-editor-edit-50-transparent);
|
|
512
567
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { tick } from 'svelte';
|
|
10
10
|
|
|
11
11
|
import type { EditorMessages } from '../messages/messages.types';
|
|
12
|
-
import { formatShortcutKeys } from '../operations/keymap/shortcutKeys';
|
|
12
|
+
import { formatShortcutKeys } from '../operations/keymap/shortcutKeys.js';
|
|
13
13
|
import type { EditorAction, ShortcutCategory } from '../operations/operations.types';
|
|
14
14
|
import type { ContextMenuController } from '../states/contextMenuController.svelte';
|
|
15
15
|
import Popup from './internal/Popup.svelte';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
|
-
import { serverPlaceholderMark } from './serverPlaceholder';
|
|
4
|
-
import { createEditorSession } from '../states/editorSession';
|
|
3
|
+
import { serverPlaceholderMark } from './serverPlaceholder.js';
|
|
4
|
+
import { createEditorSession } from '../states/editorSession.js';
|
|
5
5
|
import type {
|
|
6
6
|
EditorPresentation,
|
|
7
7
|
EditorSession,
|
|
@@ -118,11 +118,17 @@
|
|
|
118
118
|
color: var(--markdown-editor-breadcrumb-current-color);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
/*
|
|
121
|
+
/*
|
|
122
|
+
* 押せる階層。文字の並びを崩さないよう、ボタンらしい箱は持たせない。
|
|
123
|
+
*
|
|
124
|
+
* **色は継がせる**(`font: inherit` に色は含まれない)。実行環境の既定(`buttontext`)は
|
|
125
|
+
* 継承より強く、暗いサーフェスでも黒のまま残る。
|
|
126
|
+
*/
|
|
122
127
|
.markdown-editor-focus-breadcrumb__link {
|
|
123
128
|
padding: 0;
|
|
124
129
|
background: none;
|
|
125
130
|
border: none;
|
|
131
|
+
color: inherit;
|
|
126
132
|
font: inherit;
|
|
127
133
|
cursor: pointer;
|
|
128
134
|
}
|