@14ch/svelte-md-outliner 0.0.11 → 0.0.12
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,19 @@ 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.12] - 2026-09-18
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Outdenting a top-level list item now turns it into a paragraph where it
|
|
13
|
+
stands. The item used to move to the end of the list first, so the line you
|
|
14
|
+
pressed on jumped away from where you were reading. Turning a line into a
|
|
15
|
+
paragraph from the block-type menu has always left it in place and split the
|
|
16
|
+
list in two; outdenting now does the same. The list does split, and an ordered
|
|
17
|
+
list restarts its numbering after the paragraph — moving the paragraph out of
|
|
18
|
+
the run joins the list again. In exchange, Shift+Tab followed by Tab now
|
|
19
|
+
returns the line to where it was.
|
|
20
|
+
|
|
8
21
|
## [0.0.11] - 2026-09-17
|
|
9
22
|
|
|
10
23
|
### Fixed
|
|
@@ -109,11 +109,3 @@ export declare function correctItemDepth(state: EditorState): Transaction | null
|
|
|
109
109
|
* **対象が項目であることの確かめ**だけである。
|
|
110
110
|
*/
|
|
111
111
|
export declare function moveItemAcrossSection(direction: MoveDirection): EditorCommand;
|
|
112
|
-
/**
|
|
113
|
-
* `from` 以降で、連続する項目が終わるインデックス。
|
|
114
|
-
*
|
|
115
|
-
* **セクションの中身の末尾ではない。** 間に段落や表が挟まっていれば、そこで止まる。飛び越えると、
|
|
116
|
-
* 書き手が見ている「このリスト」の外へ出てしまう。既存の `blockRunEnd` はブロック全体の
|
|
117
|
-
* 連なりを返すもので種別を見ないため流用できない。
|
|
118
|
-
*/
|
|
119
|
-
export declare function listRunEnd(parent: Node, from: number): number;
|
|
@@ -492,10 +492,15 @@ function indentList(state, dispatch) {
|
|
|
492
492
|
/**
|
|
493
493
|
* 項目を 1 段浅くする。最上位の項目では箇条書きを解除して段落に戻す。
|
|
494
494
|
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
* 1 段浅くなっているので、包み直しは要らない。
|
|
495
|
+
* **入れ子の項目は、持ち上げるのではなく移す。** 対象を元の親の配下すべての後ろへ出す。
|
|
496
|
+
* 持ち上げる変換は文書の並び順を変えないため、対象の後ろに並んでいた兄弟が対象の配下へ
|
|
497
|
+
* 取り込まれてしまう。書き手が触っていない項目の親子関係が黙って変わることになる。
|
|
498
|
+
* 移り終えた時点で深さは 1 段浅くなっているので、包み直しは要らない。
|
|
499
|
+
*
|
|
500
|
+
* **最上位の項目は、その場で解く。** 行き先が無いので動かす必要がない。リストは
|
|
501
|
+
* 押した行で 2 つに割れ、番号付きなら後半の連番は振り直される。それは
|
|
502
|
+
* 「この行を段落にする」(ブロック種別の変換)と同じ結果であり、**同じことをする 2 つの
|
|
503
|
+
* 操作が違う結果を出さない**。割れたリストは、段落を並びの外へ動かせばまた 1 つに戻る。
|
|
499
504
|
*
|
|
500
505
|
* 分岐は**親が項目かどうか**の 1 つだけである。折りたたみ・種別・空かどうかを
|
|
501
506
|
* 分岐条件に持ち込まない。
|
|
@@ -512,7 +517,7 @@ function dedentList(state, dispatch) {
|
|
|
512
517
|
items.push(range.parent.child(index));
|
|
513
518
|
}
|
|
514
519
|
const tr = state.tr;
|
|
515
|
-
const at = moveContent(tr, range.start, range.end,
|
|
520
|
+
const at = nested ? moveContent(tr, range.start, range.end, afterParent(range)) : range.start;
|
|
516
521
|
if (!nested)
|
|
517
522
|
unwrapItems(tr, at, items);
|
|
518
523
|
// 覆った範囲の先頭からの隔たりを、移り先の同じ隔たりへ置き直す。覆っていない側まで
|
|
@@ -529,17 +534,8 @@ function dedentList(state, dispatch) {
|
|
|
529
534
|
function afterParent(range) {
|
|
530
535
|
return range.$from.after(range.depth);
|
|
531
536
|
}
|
|
532
|
-
/** 最上位の項目の行き先。連続する項目の並びの後ろ(→ `listRunEnd`) */
|
|
533
|
-
function afterRun(range) {
|
|
534
|
-
const runEnd = listRunEnd(range.parent, range.endIndex);
|
|
535
|
-
let at = range.end;
|
|
536
|
-
for (let index = range.endIndex; index < runEnd; index += 1) {
|
|
537
|
-
at += range.parent.child(index).nodeSize;
|
|
538
|
-
}
|
|
539
|
-
return at;
|
|
540
|
-
}
|
|
541
537
|
/**
|
|
542
|
-
*
|
|
538
|
+
* 項目を解いて段落へ戻す。配下は 1 段浅い項目として、その段落の後ろへ並ぶ。
|
|
543
539
|
*
|
|
544
540
|
* **後ろの項目から順に解く。** 前から解くと、後ろの項目の位置が解いた分だけずれる。
|
|
545
541
|
*/
|
|
@@ -570,19 +566,6 @@ function unwrappedOffset(items, offset) {
|
|
|
570
566
|
}
|
|
571
567
|
return unwrapped + rest;
|
|
572
568
|
}
|
|
573
|
-
/**
|
|
574
|
-
* `from` 以降で、連続する項目が終わるインデックス。
|
|
575
|
-
*
|
|
576
|
-
* **セクションの中身の末尾ではない。** 間に段落や表が挟まっていれば、そこで止まる。飛び越えると、
|
|
577
|
-
* 書き手が見ている「このリスト」の外へ出てしまう。既存の `blockRunEnd` はブロック全体の
|
|
578
|
-
* 連なりを返すもので種別を見ないため流用できない。
|
|
579
|
-
*/
|
|
580
|
-
export function listRunEnd(parent, from) {
|
|
581
|
-
let index = from;
|
|
582
|
-
while (index < parent.childCount && isListNode(parent.child(index)))
|
|
583
|
-
index += 1;
|
|
584
|
-
return index;
|
|
585
|
-
}
|
|
586
569
|
/** 選択が覆っている項目の範囲。覆ったかどうかの決め方は見出しと共通(→ `coveredEnd`) */
|
|
587
570
|
function selectedListsRange(state) {
|
|
588
571
|
const { $from } = state.selection;
|
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.12",
|
|
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.",
|