@14ch/svelte-md-outliner 0.0.31 → 0.0.32
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,14 @@ 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.32] - 2026-11-20
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- The code language popup no longer sticks to the top of the screen in a long
|
|
13
|
+
code block, where it covered the code. It stays above the block and scrolls
|
|
14
|
+
with it.
|
|
15
|
+
|
|
8
16
|
## [0.0.31] - 2026-11-19
|
|
9
17
|
|
|
10
18
|
### Fixed
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
コードブロックが選択されているときに、ブロックの上に出す言語の Select。
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
とどまり、ブロックの下端まで来たらブロックと一緒に画面の外へ出る。とどまっているあいだは
|
|
8
|
-
コードの行に重なる。
|
|
4
|
+
本文の中に絶対配置で置き、本文と一緒に動く。**長いブロックでも画面の上端にとどめない。**
|
|
5
|
+
とどめるとコードの行に重なって読めなくなる。言語を変えるのはブロックにつきほぼ一度なので、
|
|
6
|
+
上端まで戻る手間のほうが小さい。
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
リンクの吹き出しの `AnchoredLayer` は使わない。上に収まらないと下へ返すので、長いブロック
|
|
9
|
+
ではブロックの末尾の下という離れた場所に出る。いつもブロックの上に置く。
|
|
11
10
|
|
|
12
11
|
フォーカスがポップアップの中にあるかを、コントローラへ知らせる。Select は一覧を開くと
|
|
13
12
|
フォーカスを移すが、一覧は DOM の上では Select の要素の中にあるので、ポップアップの外へ
|
|
@@ -30,44 +29,33 @@
|
|
|
30
29
|
const GAP = 6;
|
|
31
30
|
|
|
32
31
|
let layerRef: HTMLDivElement | undefined = $state();
|
|
33
|
-
let trackRef: HTMLDivElement | undefined = $state();
|
|
34
32
|
let popoverRef: HTMLDivElement | undefined = $state();
|
|
35
33
|
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* 出すブロックが変わったときと、本文が折り返し直す(表示領域の幅が変わる)ときに置き直す。
|
|
36
|
+
* スクロールでは置き直さない——本文と一緒に動くからである。ブロックの中で打っても
|
|
37
|
+
* ブロックの上端は動かない。
|
|
40
38
|
*/
|
|
41
39
|
$effect(() => {
|
|
42
40
|
const block = controller.block && controller.blockElement();
|
|
43
|
-
if (!block || !
|
|
41
|
+
if (!block || !popoverRef) return;
|
|
44
42
|
|
|
45
|
-
place(block);
|
|
46
|
-
const observer = new ResizeObserver(() => place(block));
|
|
47
|
-
observer.observe(block);
|
|
48
|
-
observer.observe(popoverRef);
|
|
49
43
|
const onResize = () => place(block);
|
|
44
|
+
onResize();
|
|
50
45
|
window.addEventListener('resize', onResize);
|
|
51
|
-
return () =>
|
|
52
|
-
observer.disconnect();
|
|
53
|
-
window.removeEventListener('resize', onResize);
|
|
54
|
-
};
|
|
46
|
+
return () => window.removeEventListener('resize', onResize);
|
|
55
47
|
});
|
|
56
48
|
|
|
57
49
|
function place(block: HTMLElement): void {
|
|
58
50
|
const layer = layerRef;
|
|
59
|
-
const track = trackRef;
|
|
60
51
|
const popover = popoverRef;
|
|
61
|
-
if (!layer || !
|
|
52
|
+
if (!layer || !popover) return;
|
|
62
53
|
|
|
63
54
|
const origin = layer.getBoundingClientRect();
|
|
64
55
|
const rect = block.getBoundingClientRect();
|
|
65
|
-
const lift = popover.offsetHeight + GAP;
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
track.style.width = `${rect.width}px`;
|
|
70
|
-
track.style.height = `${rect.height + lift}px`;
|
|
57
|
+
popover.style.top = `${rect.top - origin.top - popover.offsetHeight - GAP}px`;
|
|
58
|
+
popover.style.left = `${rect.left - origin.left}px`;
|
|
71
59
|
}
|
|
72
60
|
|
|
73
61
|
/**
|
|
@@ -100,25 +88,23 @@
|
|
|
100
88
|
<!-- 位置の原点にする層。高さを持たず、並びを押し広げない -->
|
|
101
89
|
<div class="markdown-editor-code-language-popover-layer" bind:this={layerRef}>
|
|
102
90
|
{#if controller.block}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/>
|
|
121
|
-
</div>
|
|
91
|
+
<!-- 押してもフォーカスを移さないための受け止め。キーで届く操作は Select が持つ -->
|
|
92
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
93
|
+
<div
|
|
94
|
+
class="markdown-editor-code-language-popover"
|
|
95
|
+
bind:this={popoverRef}
|
|
96
|
+
onpointerdown={onPointerDown}
|
|
97
|
+
onmousedown={onMouseDown}
|
|
98
|
+
onfocusin={onFocusIn}
|
|
99
|
+
onfocusout={onFocusOut}
|
|
100
|
+
>
|
|
101
|
+
<Select
|
|
102
|
+
value={controller.value}
|
|
103
|
+
options={[...controller.options]}
|
|
104
|
+
ariaLabel={text.codeLanguage}
|
|
105
|
+
inline
|
|
106
|
+
onchange={(value) => controller.choose(String(value ?? ''))}
|
|
107
|
+
/>
|
|
122
108
|
</div>
|
|
123
109
|
{/if}
|
|
124
110
|
</div>
|
|
@@ -131,16 +117,9 @@
|
|
|
131
117
|
height: 0;
|
|
132
118
|
}
|
|
133
119
|
|
|
134
|
-
/** ブロックに沿った箱。押しても下のコードに届く */
|
|
135
|
-
.markdown-editor-code-language-popover-track {
|
|
136
|
-
position: absolute;
|
|
137
|
-
pointer-events: none;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
120
|
.markdown-editor-code-language-popover {
|
|
141
|
-
position:
|
|
142
|
-
|
|
143
|
-
display: inline-flex;
|
|
121
|
+
position: absolute;
|
|
122
|
+
display: flex;
|
|
144
123
|
box-sizing: border-box;
|
|
145
124
|
align-items: center;
|
|
146
125
|
/* 高さはリンクの吹き出し・選択ツールバーと揃える */
|
|
@@ -157,7 +136,6 @@
|
|
|
157
136
|
color: var(--markdown-editor-code-language-popover-text);
|
|
158
137
|
font-size: var(--markdown-editor-font-size-sm);
|
|
159
138
|
line-height: normal;
|
|
160
|
-
pointer-events: auto;
|
|
161
139
|
animation: markdown-editor-code-language-popover-in 120ms forwards;
|
|
162
140
|
}
|
|
163
141
|
|
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.32",
|
|
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.",
|