@14ch/svelte-md-outliner 0.0.17 → 0.0.18

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,17 @@ 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.18] - 2026-09-28
9
+
10
+ ### Fixed
11
+
12
+ - Copying a deeply nested list item no longer carries its depth into the paste.
13
+ The levels that had held the copied items came along as empty bullets, so
14
+ pasting at the top of a document rebuilt the original nesting instead of
15
+ landing where the cursor was. A copy now starts from the item you selected,
16
+ keeping only the nesting between the copied items. Selecting from the
17
+ outermost item still copies the whole structure as before.
18
+
8
19
  ## [0.0.17] - 2026-09-25
9
20
 
10
21
  ### Fixed
@@ -28,7 +28,35 @@ export function serializeSlice(slice) {
28
28
  return line.type.spec.code ? line.textContent : writeLine(line);
29
29
  }
30
30
  // スライスは単体では文書として成立しないため、内容検証を伴わないコンテナへ載せる
31
- return serializeMarkdown(n.doc.create(null, wrapTableRows(slice.content)));
31
+ return serializeMarkdown(n.doc.create(null, wrapTableRows(withoutCutItems(slice.content))));
32
+ }
33
+ /**
34
+ * 切り口に残った、**行を持たない項目**を取り除く。
35
+ *
36
+ * 深い項目を選ぶと、断片にはその項目を囲んでいた親の項目も入る。親の行(先頭の段落)は
37
+ * 選択の外なので切り落とされ、中身が入れ子の項目だけになった**抜け殻**が残る。そのまま
38
+ * 書き出すと記号だけが並び(`- - - 1-1-1`)、貼ると写した覚えのない空の項目ごと、
39
+ * もとの深さで入る(利用者の指摘、2026-09-26)。
40
+ *
41
+ * **写したのは選んだ項目であって、それを囲んでいた入れ物ではない。** 抜け殻を外すと、
42
+ * 書き出しは選んだ項目を頂点とする形になり、選んだ項目どうしの深さの関係だけが残る。
43
+ * 見出しが貼り先の深さへ付け替わるのと同じ考え方である(→ `markdownClipboard` の
44
+ * `relevel`)。
45
+ *
46
+ * **見るのは断片の先頭だけである。** 切り口は選択の始まりにしかなく、行を持つ項目に
47
+ * 行き当たった時点で、そこから先は選択の中にまるごと入っている。
48
+ */
49
+ function withoutCutItems(content) {
50
+ const first = content.firstChild;
51
+ if (!first)
52
+ return content;
53
+ // セクションは行を持たない入れ物である。切り口は中にある
54
+ if (first.type === n.section || first.type === n.intro_section) {
55
+ return content.replaceChild(0, first.copy(withoutCutItems(first.content)));
56
+ }
57
+ if (first.type !== n.list || first.firstChild?.isTextblock)
58
+ return content;
59
+ return withoutCutItems(first.content).append(content.cut(first.nodeSize));
32
60
  }
33
61
  /**
34
62
  * 選択が 1 つの行(テキストブロック)の中で完結しているなら、その行を返す。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@14ch/svelte-md-outliner",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
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.",