@kubohiroya/turbowarp-plus-editor-project-folder 0.19.0 → 0.19.1
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/README.ja.md
CHANGED
|
@@ -113,6 +113,8 @@ TurboWarp Plus Editor は、ブロックパレットの設定を画面状態(`
|
|
|
113
113
|
|
|
114
114
|
この OPFS 対応は、ローカル連携の URL から開いた Editor の保存領域が対象です。通常の配信サイトとローカル連携では OPFS の保存領域が異なるため、配信サイトで既に作業している OPFS を直接共有しません。通常の配信サイトを開いたまま外部編集するための別オリジン接続は、この実装には含みません。
|
|
115
115
|
|
|
116
|
+
通常表示で内容の高さが表示領域より小さいときは、スクロール領域の上に操作ボタンの高さに合わせた空欄を設け、先頭行がボタンに隠れないようにします。内容の編集、画面サイズの変更、タブの再表示に応じて再計算します。差分表示にも、操作ボタンが差分や表示範囲の切り替えに重ならない空欄を設けています。
|
|
117
|
+
|
|
116
118
|
編集画面の右下には、ファイル全体と現在の表示範囲を示すミニマップを表示します。クリック・ドラッグで移動でき、ミニマップにフォーカスすると矢印・Page Up/Page Down・Home/End キーでもスクロールできます。編集、スクロール、パネルのサイズ変更、タブの再表示に追従します。差分表示では編集用のミニマップを隠します。
|
|
117
119
|
|
|
118
120
|
切り戻す場合はこの UI 変更を revert し、パッケージと Editor を再ビルドします。ファイル形式の変更やデータ移行はありません。対象のヘッドレス検証は `node --test test/text-file.browser.js` で実行します。
|
package/dist/explorer.js
CHANGED
|
@@ -1463,7 +1463,7 @@ function createFilePreview(directory, documentId, { name, path }, locale, readBa
|
|
|
1463
1463
|
status.textContent = message.large;
|
|
1464
1464
|
return;
|
|
1465
1465
|
}
|
|
1466
|
-
const [bytes, { decodeText, mountTextFile }] = await Promise.all([file.arrayBuffer(), import("./shared-
|
|
1466
|
+
const [bytes, { decodeText, mountTextFile }] = await Promise.all([file.arrayBuffer(), import("./shared-CeJrx6Ve.js")]);
|
|
1467
1467
|
if (disposed) return;
|
|
1468
1468
|
const content = decodeText(bytes);
|
|
1469
1469
|
if (content === null) {
|
|
@@ -30016,6 +30016,7 @@ max-height:40%;overflow:auto;border-radius:.3rem;background:var(--ui-primary,#ff
|
|
|
30016
30016
|
box-sizing:border-box;max-width:calc(100% - 2rem);margin:0;padding:.65rem 1rem;border-radius:.35rem;
|
|
30017
30017
|
background:#323232;color:#fff;font-size:.9em;box-shadow:0 2px 8px rgba(0,0,0,.3);pointer-events:none}
|
|
30018
30018
|
.twpf-file-edit,.twpf-file-diff{flex:1;min-height:0}
|
|
30019
|
+
.twpf-file-edit.twpf-file-short{padding-top:var(--twpf-toolbar-height,3.25rem)}
|
|
30019
30020
|
.twpf-file-diff{padding-top:var(--twpf-toolbar-height,3.25rem)}
|
|
30020
30021
|
.twpf-file-edit>.cm-editor{height:100%}
|
|
30021
30022
|
.twpf-text-file .cm-scroller{overflow:auto}
|
|
@@ -30292,8 +30293,10 @@ function mountTextFile(parent, options) {
|
|
|
30292
30293
|
parent.append(shell);
|
|
30293
30294
|
const toolbarObserver = browser && new browser.ResizeObserver(() => {
|
|
30294
30295
|
panel.style.setProperty("--twpf-toolbar-height", `calc(${toolbar.getBoundingClientRect().height}px + 1rem)`);
|
|
30296
|
+
measureToolbarSpace();
|
|
30295
30297
|
});
|
|
30296
30298
|
toolbarObserver === null || toolbarObserver === void 0 || toolbarObserver.observe(toolbar);
|
|
30299
|
+
toolbarObserver === null || toolbarObserver === void 0 || toolbarObserver.observe(editPane);
|
|
30297
30300
|
const editing = new Compartment();
|
|
30298
30301
|
const view = new EditorView({
|
|
30299
30302
|
parent: editPane,
|
|
@@ -30311,9 +30314,23 @@ function mountTextFile(parent, options) {
|
|
|
30311
30314
|
keymap.of([...defaultKeymap, ...historyKeymap]),
|
|
30312
30315
|
EditorView.updateListener.of((update) => {
|
|
30313
30316
|
if (update.docChanged) updateSaveState(void 0, true);
|
|
30317
|
+
if (update.docChanged || update.geometryChanged) measureToolbarSpace();
|
|
30314
30318
|
})
|
|
30315
30319
|
]
|
|
30316
30320
|
});
|
|
30321
|
+
function measureToolbarSpace() {
|
|
30322
|
+
if (disposed || comparison) return;
|
|
30323
|
+
view.requestMeasure({
|
|
30324
|
+
key: editPane,
|
|
30325
|
+
read: (view) => {
|
|
30326
|
+
const available = editPane.clientHeight;
|
|
30327
|
+
return available ? view.contentHeight < available : null;
|
|
30328
|
+
},
|
|
30329
|
+
write: (short) => {
|
|
30330
|
+
if (!disposed && !comparison && short !== null) editPane.classList.toggle("twpf-file-short", short);
|
|
30331
|
+
}
|
|
30332
|
+
});
|
|
30333
|
+
}
|
|
30317
30334
|
const dirty = () => !view.state.doc.eq(savedDoc);
|
|
30318
30335
|
const serialize = () => bom + (newline === "\n" ? view.state.doc.toString() : view.state.doc.toString().replace(/\n/gu, newline));
|
|
30319
30336
|
let wasDirty = false;
|
|
@@ -30491,6 +30508,7 @@ function mountTextFile(parent, options) {
|
|
|
30491
30508
|
++readVersion;
|
|
30492
30509
|
baselineLoading = false;
|
|
30493
30510
|
destroyDiff();
|
|
30511
|
+
measureToolbarSpace();
|
|
30494
30512
|
}
|
|
30495
30513
|
}
|
|
30496
30514
|
async function loadBaseline() {
|
package/package.json
CHANGED
package/src/text-file-editor.ts
CHANGED
|
@@ -95,6 +95,7 @@ max-height:40%;overflow:auto;border-radius:.3rem;background:var(--ui-primary,#ff
|
|
|
95
95
|
box-sizing:border-box;max-width:calc(100% - 2rem);margin:0;padding:.65rem 1rem;border-radius:.35rem;
|
|
96
96
|
background:#323232;color:#fff;font-size:.9em;box-shadow:0 2px 8px rgba(0,0,0,.3);pointer-events:none}
|
|
97
97
|
.twpf-file-edit,.twpf-file-diff{flex:1;min-height:0}
|
|
98
|
+
.twpf-file-edit.twpf-file-short{padding-top:var(--twpf-toolbar-height,3.25rem)}
|
|
98
99
|
.twpf-file-diff{padding-top:var(--twpf-toolbar-height,3.25rem)}
|
|
99
100
|
.twpf-file-edit>.cm-editor{height:100%}
|
|
100
101
|
.twpf-text-file .cm-scroller{overflow:auto}
|
|
@@ -328,8 +329,10 @@ export function mountTextFile(parent: HTMLElement, options: TextFileOptions) {
|
|
|
328
329
|
parent.append(shell);
|
|
329
330
|
const toolbarObserver = browser && new browser.ResizeObserver(() => {
|
|
330
331
|
panel.style.setProperty('--twpf-toolbar-height', `calc(${toolbar.getBoundingClientRect().height}px + 1rem)`);
|
|
332
|
+
measureToolbarSpace();
|
|
331
333
|
});
|
|
332
334
|
toolbarObserver?.observe(toolbar);
|
|
335
|
+
toolbarObserver?.observe(editPane);
|
|
333
336
|
|
|
334
337
|
const editing = new Compartment();
|
|
335
338
|
const view = new EditorView({
|
|
@@ -339,9 +342,26 @@ export function mountTextFile(parent: HTMLElement, options: TextFileOptions) {
|
|
|
339
342
|
highlightActiveLine(), textMinimap(message.minimap),
|
|
340
343
|
EditorView.contentAttributes.of({'aria-label': options.path}),
|
|
341
344
|
keymap.of([...defaultKeymap, ...historyKeymap]),
|
|
342
|
-
EditorView.updateListener.of(update => {
|
|
345
|
+
EditorView.updateListener.of(update => {
|
|
346
|
+
if (update.docChanged) updateSaveState(undefined, true);
|
|
347
|
+
if (update.docChanged || update.geometryChanged) measureToolbarSpace();
|
|
348
|
+
})
|
|
343
349
|
]
|
|
344
350
|
});
|
|
351
|
+
function measureToolbarSpace() {
|
|
352
|
+
if (disposed || comparison) return;
|
|
353
|
+
view.requestMeasure({
|
|
354
|
+
key: editPane,
|
|
355
|
+
read: view => {
|
|
356
|
+
// Include the reserved space when comparing, so adding it cannot flip the decision back.
|
|
357
|
+
const available = editPane.clientHeight;
|
|
358
|
+
return available ? view.contentHeight < available : null;
|
|
359
|
+
},
|
|
360
|
+
write: short => {
|
|
361
|
+
if (!disposed && !comparison && short !== null) editPane.classList.toggle('twpf-file-short', short);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
345
365
|
const dirty = () => !view.state.doc.eq(savedDoc);
|
|
346
366
|
const serialize = () => bom + (newline === '\n' ? view.state.doc.toString() : view.state.doc.toString().replace(/\n/gu, newline));
|
|
347
367
|
|
|
@@ -524,6 +544,7 @@ export function mountTextFile(parent: HTMLElement, options: TextFileOptions) {
|
|
|
524
544
|
++readVersion;
|
|
525
545
|
baselineLoading = false;
|
|
526
546
|
destroyDiff();
|
|
547
|
+
measureToolbarSpace();
|
|
527
548
|
}
|
|
528
549
|
}
|
|
529
550
|
|