@14ch/svelte-md-outliner 0.0.21 → 0.0.22
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,13 @@ 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.22] - 2026-10-23
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Pasting Markdown containing headings and tables now preserves the heading
|
|
13
|
+
hierarchy when the clipboard also contains HTML.
|
|
14
|
+
|
|
8
15
|
## [0.0.21] - 2026-10-11
|
|
9
16
|
|
|
10
17
|
### Changed
|
|
@@ -60,21 +60,14 @@ export function markdownClipboardPlugin() {
|
|
|
60
60
|
return false;
|
|
61
61
|
if (isInTable(view.state))
|
|
62
62
|
return false;
|
|
63
|
-
/**
|
|
64
|
-
* **表が同時に届いているなら、文字ではなく表として貼られるべきである**
|
|
65
|
-
* (要件 1.2)。スプレッドシートはタブ区切りの文字と表の HTML を同時に
|
|
66
|
-
* 載せる。ここで文字を読むと、表が 1 行に潰れる。譲った先(編集基盤の
|
|
67
|
-
* 既定の貼り付け)が、HTML を表として取り込む。
|
|
68
|
-
*
|
|
69
|
-
* **置く位置が仕様である。** 読み取り専用・記法を解釈しない場所・表の中と
|
|
70
|
-
* いう 3 つの判断より後に置く。先に置くと、記法を解釈しない場所で表を
|
|
71
|
-
* 貼ったときに、譲った先が表を作ろうとする。
|
|
72
|
-
*/
|
|
73
|
-
if (hasPastedTable(event.clipboardData))
|
|
74
|
-
return false;
|
|
75
63
|
const parsed = parseMarkdown(text);
|
|
76
64
|
if (!parsed.ok)
|
|
77
65
|
return false;
|
|
66
|
+
// Markdown の表なら、見出しも含めて Markdown として読む。
|
|
67
|
+
// HTML に表があるだけで既定の取り込みへ譲ると、見出しの兄弟関係が失われる。
|
|
68
|
+
// TSV など、文字側に表の構造が無いときだけ HTML の表へ譲る。
|
|
69
|
+
if (hasPastedTable(event.clipboardData) && !containsTable(parsed.value))
|
|
70
|
+
return false;
|
|
78
71
|
// 文書全体への貼り付けは**差し替え**である。メタデータごと入れ替わる
|
|
79
72
|
if (view.state.selection instanceof AllSelection) {
|
|
80
73
|
const replaced = replaceDocument(view.state, parsed.value.content);
|
|
@@ -286,3 +279,13 @@ function toArray(content) {
|
|
|
286
279
|
content.forEach((child) => nodes.push(child));
|
|
287
280
|
return nodes;
|
|
288
281
|
}
|
|
282
|
+
/** Markdown として表の構造を読み取れたか(コード中の表記などは含めない)。 */
|
|
283
|
+
function containsTable(doc) {
|
|
284
|
+
let found = false;
|
|
285
|
+
doc.descendants((node) => {
|
|
286
|
+
if (node.type === n.table)
|
|
287
|
+
found = true;
|
|
288
|
+
return !found;
|
|
289
|
+
});
|
|
290
|
+
return found;
|
|
291
|
+
}
|
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.22",
|
|
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.",
|