@14ch/svelte-md-outliner 0.0.6 → 0.0.8
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,6 +5,24 @@ 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.8] - 2026-09-10
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- An empty line directly after a table can be deleted again. Backspace there did
|
|
13
|
+
nothing but point at the table, so the line stayed and a second press removed
|
|
14
|
+
the whole table. The line is now removed and the cursor moves to the end of the
|
|
15
|
+
last cell, as it already did after code blocks and quotes.
|
|
16
|
+
|
|
17
|
+
## [0.0.7] - 2026-09-09
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- A read-only editor no longer shows the empty "Front Matter" placeholder. The
|
|
22
|
+
label is an entry point for adding metadata, which a read-only editor cannot
|
|
23
|
+
do; the empty block now takes no space at all. Front matter with content is
|
|
24
|
+
still shown as before.
|
|
25
|
+
|
|
8
26
|
## [0.0.6] - 2026-09-08
|
|
9
27
|
|
|
10
28
|
### Changed
|
|
@@ -954,6 +954,16 @@
|
|
|
954
954
|
display: block;
|
|
955
955
|
}
|
|
956
956
|
|
|
957
|
+
/**
|
|
958
|
+
* **読み取り専用では、空のフロントマターは場所ごと出さない。** 名前は「メタデータを
|
|
959
|
+
* 書き足す入口」であり、書けない状態で出すと、何もできない場所へ入口を広告することになる
|
|
960
|
+
* (押せる面のホバー表示を読み取り専用で出さないのと同じ理由)。キャレットの着地点も
|
|
961
|
+
* 要らない——中へ入る経路そのものが無い。中身があれば従来どおり読める形で出す。
|
|
962
|
+
*/
|
|
963
|
+
.markdown-editor__surface[aria-readonly] .markdown-editor__front-matter--empty {
|
|
964
|
+
display: none;
|
|
965
|
+
}
|
|
966
|
+
|
|
957
967
|
/**
|
|
958
968
|
* 読むあいだ、機械向けの日時表記は人の読む形で覆う(→ `dateText`)。
|
|
959
969
|
*
|
|
@@ -142,6 +142,25 @@ export declare function insertSectionAfter(state: EditorState, dispatch?: (tr: T
|
|
|
142
142
|
* (→ `keepingOneLine`)。
|
|
143
143
|
*/
|
|
144
144
|
export declare function removeEmptyLeadingBlock(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* 繋げる相手がいない空の行を取り除く。
|
|
147
|
+
*
|
|
148
|
+
* 表は中身と繋がらない(`isolating`)ため、**表のすぐ後ろの空行では結合の連鎖が何もできず**、
|
|
149
|
+
* 最後の受け皿が表を指した状態にするだけになる。書き手から見ると空行が消せず、もう一度
|
|
150
|
+
* 押すと表ごと消える行き止まりになる。繋げる相手がいないなら、繋げるかわりにその行を
|
|
151
|
+
* 取り除く(文書の先頭での判断と同じ → `removeEmptyLeadingBlock`)。
|
|
152
|
+
*
|
|
153
|
+
* **繋げられるかどうかを種別で数えない。** 結合そのものに尋ね、繋げられるならそちらへ譲る
|
|
154
|
+
* (コードブロック・引用・箇条書きの後ろの空行は、従来どおり結合が吸収する)。
|
|
155
|
+
*
|
|
156
|
+
* 対象は空の段落だけである。表のセルやコードブロックの空の行は、消すと表の形やブロック
|
|
157
|
+
* 自身が壊れる(要選択ブロックはまず指してから消す)。項目の本文も箇条書きの側が受け持つ
|
|
158
|
+
* (→ `listCommands.backspace`)。
|
|
159
|
+
*
|
|
160
|
+
* カーソルは直前のブロックの末尾へ置く。表なら最後のセルの末尾で、コードブロックや引用の
|
|
161
|
+
* 後ろで空行を消したときと同じ位置になる。
|
|
162
|
+
*/
|
|
163
|
+
export declare function removeUnjoinableEmptyBlock(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
|
145
164
|
/**
|
|
146
165
|
* 項目・段落を見出しへ変換する。
|
|
147
166
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { joinTextblockBackward } from 'prosemirror-commands';
|
|
1
2
|
import { Selection, TextSelection } from 'prosemirror-state';
|
|
2
3
|
import { MAX_HEADING_LEVEL } from '../../models/document/document.types';
|
|
3
4
|
import { bodyCount, bodyIndex, bodyStart } from '../../models/document/bodySelection';
|
|
@@ -525,6 +526,45 @@ export function removeEmptyLeadingBlock(state, dispatch) {
|
|
|
525
526
|
dispatch(tr.scrollIntoView());
|
|
526
527
|
return true;
|
|
527
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* 繋げる相手がいない空の行を取り除く。
|
|
531
|
+
*
|
|
532
|
+
* 表は中身と繋がらない(`isolating`)ため、**表のすぐ後ろの空行では結合の連鎖が何もできず**、
|
|
533
|
+
* 最後の受け皿が表を指した状態にするだけになる。書き手から見ると空行が消せず、もう一度
|
|
534
|
+
* 押すと表ごと消える行き止まりになる。繋げる相手がいないなら、繋げるかわりにその行を
|
|
535
|
+
* 取り除く(文書の先頭での判断と同じ → `removeEmptyLeadingBlock`)。
|
|
536
|
+
*
|
|
537
|
+
* **繋げられるかどうかを種別で数えない。** 結合そのものに尋ね、繋げられるならそちらへ譲る
|
|
538
|
+
* (コードブロック・引用・箇条書きの後ろの空行は、従来どおり結合が吸収する)。
|
|
539
|
+
*
|
|
540
|
+
* 対象は空の段落だけである。表のセルやコードブロックの空の行は、消すと表の形やブロック
|
|
541
|
+
* 自身が壊れる(要選択ブロックはまず指してから消す)。項目の本文も箇条書きの側が受け持つ
|
|
542
|
+
* (→ `listCommands.backspace`)。
|
|
543
|
+
*
|
|
544
|
+
* カーソルは直前のブロックの末尾へ置く。表なら最後のセルの末尾で、コードブロックや引用の
|
|
545
|
+
* 後ろで空行を消したときと同じ位置になる。
|
|
546
|
+
*/
|
|
547
|
+
export function removeUnjoinableEmptyBlock(state, dispatch) {
|
|
548
|
+
const $cursor = state.selection instanceof TextSelection ? state.selection.$cursor : null;
|
|
549
|
+
if (!$cursor || $cursor.parent.type !== n.paragraph || $cursor.parent.content.size !== 0)
|
|
550
|
+
return false;
|
|
551
|
+
if (joinTextblockBackward(state))
|
|
552
|
+
return false;
|
|
553
|
+
const container = $cursor.node($cursor.depth - 1);
|
|
554
|
+
const index = $cursor.index($cursor.depth - 1);
|
|
555
|
+
if (container.type === n.list && index === 0)
|
|
556
|
+
return false;
|
|
557
|
+
// 取り除くとコンテナの中身が成り立たなくなるなら、何もしない
|
|
558
|
+
if (!container.canReplace(index, index + 1))
|
|
559
|
+
return false;
|
|
560
|
+
if (!dispatch)
|
|
561
|
+
return true;
|
|
562
|
+
const at = $cursor.before();
|
|
563
|
+
const tr = state.tr.delete(at, $cursor.after());
|
|
564
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(at), -1));
|
|
565
|
+
dispatch(tr.scrollIntoView());
|
|
566
|
+
return true;
|
|
567
|
+
}
|
|
528
568
|
/**
|
|
529
569
|
* カーソルが、本文のいちばん先頭にある空の段落・見出しにあるとき、その位置。
|
|
530
570
|
*
|
|
@@ -9,7 +9,7 @@ import { insertLineBreak } from '../commands/lineBreak';
|
|
|
9
9
|
import { toggleLink } from '../commands/link';
|
|
10
10
|
import { listCommands } from '../commands/list';
|
|
11
11
|
import { mermaidBlockOnEnter } from '../commands/mermaidBlock';
|
|
12
|
-
import { dissolveHeadingAtStart, insertHeadingBefore, insertSectionAfter, removeEmptyLeadingBlock, targetSection } from '../commands/section';
|
|
12
|
+
import { dissolveHeadingAtStart, insertHeadingBefore, insertSectionAfter, removeEmptyLeadingBlock, removeUnjoinableEmptyBlock, targetSection } from '../commands/section';
|
|
13
13
|
import { requiredSelectionBlock } from '../commands/selectedBlock';
|
|
14
14
|
import { tableCommands } from '../commands/table';
|
|
15
15
|
import { verticalFromSelectedBlock } from '../plugins/requiredSelectionEntry';
|
|
@@ -703,6 +703,25 @@ export const coreActions = [
|
|
|
703
703
|
keys: [{ key: 'Backspace' }],
|
|
704
704
|
command: holdBackspaceAtFrontMatter
|
|
705
705
|
},
|
|
706
|
+
/**
|
|
707
|
+
* 繋げる相手がいない空行の削除(→ `removeUnjoinableEmptyBlock`)。
|
|
708
|
+
*
|
|
709
|
+
* 表は中身と繋がらないため、その直後の空行では結合の連鎖が最後まで誰も受け止めず、
|
|
710
|
+
* **空行だけが消せない**状態になっていた。文書の先頭での判断
|
|
711
|
+
* (`editing.removeEmptyLeadingBlock`)と同じく、繋げるかわりに行を取り除く。
|
|
712
|
+
*
|
|
713
|
+
* 結合の受け皿(`editing.joinBackward`)より前に置く。あちらは受け止められない場面でも
|
|
714
|
+
* 「直前のブロックを指す」で必ず受け止めてしまい、ここへ来なくなる。
|
|
715
|
+
*/
|
|
716
|
+
{
|
|
717
|
+
id: 'editing.removeUnjoinableEmptyBlock',
|
|
718
|
+
category: 'document',
|
|
719
|
+
scope: 'input',
|
|
720
|
+
listed: false,
|
|
721
|
+
changesDocument: true,
|
|
722
|
+
keys: [{ key: 'Backspace' }],
|
|
723
|
+
command: removeUnjoinableEmptyBlock
|
|
724
|
+
},
|
|
706
725
|
/**
|
|
707
726
|
* 削除の結合。**項目の本文の先頭だけ、箇条書きの側が受け持つ。**
|
|
708
727
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@14ch/svelte-md-outliner",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
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.",
|