@hyebook/vue3-adapter 0.2.3 → 0.2.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-workbench.d.ts","sourceRoot":"","sources":["../../../../../core/src/workbench/editor-workbench.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,EAKR,kBAAkB,EAWnB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"editor-workbench.d.ts","sourceRoot":"","sources":["../../../../../core/src/workbench/editor-workbench.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,10 +3,12 @@ import { EditorEngine } from "../editor/engine";
|
|
|
3
3
|
const WORKBENCH_STYLE_ID = "hy-ebook-workbench-style";
|
|
4
4
|
const WORKBENCH_STYLE_VERSION = "0.2.3";
|
|
5
5
|
const WORKBENCH_CSS = `
|
|
6
|
-
.hyewb-root{font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif;color:#0f172a;background:#f8fbff;border:1px solid #d8e0ea;border-radius:12px;padding:12px;display:grid;gap:10px}
|
|
6
|
+
.hyewb-root{font-family:"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif;color:#0f172a;background:#f8fbff;border:1px solid #d8e0ea;border-radius:12px;padding:12px;display:grid;gap:10px;position:relative;--hyewb-top-shield-height:0px}
|
|
7
|
+
.hyewb-root::before{content:"";position:absolute;left:0;right:0;top:0;height:var(--hyewb-top-shield-height);background:#f8fbff;z-index:119500;pointer-events:none}
|
|
7
8
|
.hyewb-header{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
|
|
8
9
|
.hyewb-title{font-size:14px;font-weight:600}
|
|
9
10
|
.hyewb-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
|
11
|
+
.hyewb-top-control{position:relative;z-index:120000;background:#f8fbff;isolation:isolate}
|
|
10
12
|
.hyewb-btn{border:1px solid #94a3b8;background:#fff;color:#0f172a;border-radius:8px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0;width:34px;height:34px;flex:0 0 auto}
|
|
11
13
|
.hyewb-btn.active{border-color:#0b7285;background:#0b7285;color:#fff}
|
|
12
14
|
.hyewb-btn:disabled{cursor:not-allowed;opacity:.55}
|
|
@@ -438,14 +440,14 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
438
440
|
const root = document.createElement("section");
|
|
439
441
|
root.className = "hyewb-root";
|
|
440
442
|
const header = document.createElement("header");
|
|
441
|
-
header.className = "hyewb-header";
|
|
443
|
+
header.className = "hyewb-header hyewb-top-control";
|
|
442
444
|
const title = document.createElement("div");
|
|
443
445
|
title.className = "hyewb-title";
|
|
444
446
|
title.textContent = options.title ?? "hy-ebook Editor Workbench";
|
|
445
447
|
const fullscreenBtn = createButton("fullscreen");
|
|
446
448
|
header.append(title);
|
|
447
449
|
const toolbar = document.createElement("div");
|
|
448
|
-
toolbar.className = "hyewb-row";
|
|
450
|
+
toolbar.className = "hyewb-row hyewb-top-control";
|
|
449
451
|
const boldBtn = createButton("bold");
|
|
450
452
|
const italicBtn = createButton("italic");
|
|
451
453
|
const underlineBtn = createButton("underline");
|
|
@@ -706,7 +708,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
706
708
|
const ctxStyleBorder = createTableContextItem("行/列边框样式");
|
|
707
709
|
tableContextMenu.append(ctxInsertRowUp, ctxInsertRowDown, ctxDeleteRow, ctxInsertColLeft, ctxInsertColRight, ctxDeleteCol, ctxSetRowHeight, ctxSetColWidth, ctxSelectRow, ctxSelectCol, ctxStyleBg, ctxStyleColor, ctxStyleAlign, ctxStyleBoldItalic, ctxStyleBorder);
|
|
708
710
|
const pageRow = document.createElement("div");
|
|
709
|
-
pageRow.className = "hyewb-row";
|
|
711
|
+
pageRow.className = "hyewb-row hyewb-top-control";
|
|
710
712
|
const prevPageBtn = createButton("prevPage");
|
|
711
713
|
const nextPageBtn = createButton("nextPage");
|
|
712
714
|
const addPageBtn = createButton("addPage");
|
|
@@ -744,7 +746,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
744
746
|
annotationPanel.className = "hyewb-preview-annotation-panel";
|
|
745
747
|
const annotationTitle = document.createElement("h3");
|
|
746
748
|
annotationTitle.className = "hyewb-preview-annotation-title";
|
|
747
|
-
annotationTitle.textContent = "
|
|
749
|
+
annotationTitle.textContent = "我的笔记";
|
|
748
750
|
const annotationTabs = document.createElement("div");
|
|
749
751
|
annotationTabs.className = "hyewb-preview-annotation-tabs";
|
|
750
752
|
const annotationHighlightTab = document.createElement("button");
|
|
@@ -922,6 +924,28 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
922
924
|
const nextHeight = Math.max(320, Math.floor(viewportHeight - top - bottomPadding));
|
|
923
925
|
shell.style.maxHeight = `${nextHeight}px`;
|
|
924
926
|
};
|
|
927
|
+
const updateTopControlShieldHeight = () => {
|
|
928
|
+
const rootRect = root.getBoundingClientRect();
|
|
929
|
+
const controls = [header, toolbar, pageRow];
|
|
930
|
+
let maxBottom = 0;
|
|
931
|
+
controls.forEach((control) => {
|
|
932
|
+
if (control.style.display === "none") {
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
const rect = control.getBoundingClientRect();
|
|
936
|
+
const relativeBottom = rect.bottom - rootRect.top;
|
|
937
|
+
maxBottom = Math.max(maxBottom, relativeBottom);
|
|
938
|
+
});
|
|
939
|
+
root.style.setProperty("--hyewb-top-shield-height", `${Math.max(0, Math.ceil(maxBottom + 6))}px`);
|
|
940
|
+
};
|
|
941
|
+
const clampFloatingTop = (top) => {
|
|
942
|
+
return Math.round(top);
|
|
943
|
+
};
|
|
944
|
+
const clampFloatingTopWithHeight = (top, elementHeight) => {
|
|
945
|
+
const maxTop = Math.round(window.innerHeight - elementHeight - 8);
|
|
946
|
+
const rounded = Math.round(top);
|
|
947
|
+
return Math.min(rounded, maxTop);
|
|
948
|
+
};
|
|
925
949
|
const requestWorkbenchFullscreen = async () => {
|
|
926
950
|
const target = root;
|
|
927
951
|
if (typeof target.requestFullscreen === "function") {
|
|
@@ -1640,7 +1664,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
1640
1664
|
text: selection.toString().trim(),
|
|
1641
1665
|
};
|
|
1642
1666
|
previewSelectionToolbar.style.left = `${Math.round(rect.left + rect.width / 2)}px`;
|
|
1643
|
-
previewSelectionToolbar.style.top = `${
|
|
1667
|
+
previewSelectionToolbar.style.top = `${clampFloatingTop(rect.top - 8)}px`;
|
|
1644
1668
|
previewSelectionToolbar.classList.add("show");
|
|
1645
1669
|
};
|
|
1646
1670
|
const hideFloatingToolbar = () => {
|
|
@@ -1697,7 +1721,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
1697
1721
|
const nextLeft = Math.max(8, Math.min(buttonRect.left, window.innerWidth - pickerRect.width - 8));
|
|
1698
1722
|
const nextTop = Math.min(window.innerHeight - pickerRect.height - 8, buttonRect.bottom + 8);
|
|
1699
1723
|
tablePicker.style.left = `${Math.round(nextLeft)}px`;
|
|
1700
|
-
tablePicker.style.top = `${Math.max(8, Math.round(nextTop))}px`;
|
|
1724
|
+
tablePicker.style.top = `${clampFloatingTopWithHeight(Math.max(8, Math.round(nextTop)), pickerRect.height)}px`;
|
|
1701
1725
|
};
|
|
1702
1726
|
const hideTableTools = () => {
|
|
1703
1727
|
if (tableToolsHideTimer !== null) {
|
|
@@ -1802,18 +1826,18 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
1802
1826
|
cancelTableToolsHide();
|
|
1803
1827
|
const tableRect = activeTableElement.getBoundingClientRect();
|
|
1804
1828
|
tableMoveHandle.style.left = `${Math.round(tableRect.left - 14)}px`;
|
|
1805
|
-
tableMoveHandle.style.top = `${
|
|
1829
|
+
tableMoveHandle.style.top = `${clampFloatingTop(tableRect.top - 14)}px`;
|
|
1806
1830
|
tableMoveHandle.classList.add("show");
|
|
1807
1831
|
tableScaleHandle.style.left = `${Math.round(tableRect.right - 10)}px`;
|
|
1808
|
-
tableScaleHandle.style.top = `${
|
|
1832
|
+
tableScaleHandle.style.top = `${clampFloatingTop(tableRect.bottom - 10)}px`;
|
|
1809
1833
|
tableScaleHandle.classList.add("show");
|
|
1810
1834
|
tableColEdgeLayer.style.left = `${Math.round(tableRect.left)}px`;
|
|
1811
|
-
tableColEdgeLayer.style.top = `${
|
|
1835
|
+
tableColEdgeLayer.style.top = `${clampFloatingTop(tableRect.top - 12)}px`;
|
|
1812
1836
|
tableColEdgeLayer.style.width = `${Math.max(0, Math.round(tableRect.width))}px`;
|
|
1813
1837
|
tableColEdgeLayer.style.height = "14px";
|
|
1814
1838
|
tableColEdgeLayer.classList.add("show");
|
|
1815
1839
|
tableRowEdgeLayer.style.left = `${Math.round(tableRect.left - 12)}px`;
|
|
1816
|
-
tableRowEdgeLayer.style.top = `${
|
|
1840
|
+
tableRowEdgeLayer.style.top = `${clampFloatingTop(tableRect.top)}px`;
|
|
1817
1841
|
tableRowEdgeLayer.style.width = "14px";
|
|
1818
1842
|
tableRowEdgeLayer.style.height = `${Math.max(0, Math.round(tableRect.height))}px`;
|
|
1819
1843
|
tableRowEdgeLayer.classList.add("show");
|
|
@@ -1821,7 +1845,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
1821
1845
|
if (activeTableRowElement) {
|
|
1822
1846
|
const rowRect = activeTableRowElement.getBoundingClientRect();
|
|
1823
1847
|
tableRowDeleteBtn.style.left = `${Math.round(rowRect.right - 2)}px`;
|
|
1824
|
-
tableRowDeleteBtn.style.top = `${
|
|
1848
|
+
tableRowDeleteBtn.style.top = `${clampFloatingTop(rowRect.top + rowRect.height / 2 - 10)}px`;
|
|
1825
1849
|
tableRowDeleteBtn.classList.add("show");
|
|
1826
1850
|
}
|
|
1827
1851
|
else {
|
|
@@ -2086,7 +2110,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
2086
2110
|
? Math.round(targetRow.top)
|
|
2087
2111
|
: Math.round(tableRect.bottom);
|
|
2088
2112
|
tableDropIndicator.style.left = `${Math.round(tableRect.left)}px`;
|
|
2089
|
-
tableDropIndicator.style.top = `${y - 1}px`;
|
|
2113
|
+
tableDropIndicator.style.top = `${clampFloatingTop(y - 1)}px`;
|
|
2090
2114
|
tableDropIndicator.style.width = `${Math.max(0, Math.round(tableRect.width))}px`;
|
|
2091
2115
|
tableDropIndicator.style.height = "2px";
|
|
2092
2116
|
}
|
|
@@ -2097,7 +2121,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
2097
2121
|
? Math.round(targetCol.left)
|
|
2098
2122
|
: Math.round(tableRect.right);
|
|
2099
2123
|
tableDropIndicator.style.left = `${x - 1}px`;
|
|
2100
|
-
tableDropIndicator.style.top = `${
|
|
2124
|
+
tableDropIndicator.style.top = `${clampFloatingTop(tableRect.top)}px`;
|
|
2101
2125
|
tableDropIndicator.style.width = "2px";
|
|
2102
2126
|
tableDropIndicator.style.height = `${Math.max(0, Math.round(tableRect.height))}px`;
|
|
2103
2127
|
}
|
|
@@ -2180,14 +2204,14 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
2180
2204
|
tableColGapInsertBtn.classList.remove("show");
|
|
2181
2205
|
// Row button offset is managed independently.
|
|
2182
2206
|
tableRowGapInsertBtn.style.left = `${Math.round(hover.x + rowGapOffset.x)}px`;
|
|
2183
|
-
tableRowGapInsertBtn.style.top = `${
|
|
2207
|
+
tableRowGapInsertBtn.style.top = `${clampFloatingTop(hover.y + rowGapOffset.y)}px`;
|
|
2184
2208
|
tableRowGapInsertBtn.classList.add("show");
|
|
2185
2209
|
return;
|
|
2186
2210
|
}
|
|
2187
2211
|
tableRowGapInsertBtn.classList.remove("show");
|
|
2188
2212
|
// Column button offset is managed independently.
|
|
2189
2213
|
tableColGapInsertBtn.style.left = `${Math.round(hover.x + colGapOffset.x)}px`;
|
|
2190
|
-
tableColGapInsertBtn.style.top = `${
|
|
2214
|
+
tableColGapInsertBtn.style.top = `${clampFloatingTop(hover.y + colGapOffset.y)}px`;
|
|
2191
2215
|
tableColGapInsertBtn.classList.add("show");
|
|
2192
2216
|
};
|
|
2193
2217
|
const resolveRowDropIndex = (table, clientY) => {
|
|
@@ -2368,7 +2392,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
2368
2392
|
const left = Math.max(8, Math.min(clientX, window.innerWidth - rect.width - 8));
|
|
2369
2393
|
const top = Math.max(8, Math.min(clientY, window.innerHeight - rect.height - 8));
|
|
2370
2394
|
tableContextMenu.style.left = `${Math.round(left)}px`;
|
|
2371
|
-
tableContextMenu.style.top = `${
|
|
2395
|
+
tableContextMenu.style.top = `${clampFloatingTopWithHeight(top, rect.height)}px`;
|
|
2372
2396
|
};
|
|
2373
2397
|
const openColorPalette = (anchor, target) => {
|
|
2374
2398
|
activeColorTarget = target;
|
|
@@ -2677,18 +2701,34 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
2677
2701
|
const updateFloatingToolbarBySelection = () => {
|
|
2678
2702
|
const activeElement = document.activeElement;
|
|
2679
2703
|
const isToolbarFocused = Boolean(activeElement && floatingToolbar.contains(activeElement));
|
|
2680
|
-
const
|
|
2704
|
+
const liveSelection = window.getSelection();
|
|
2705
|
+
if (liveSelection && liveSelection.rangeCount > 0) {
|
|
2706
|
+
const liveRange = liveSelection.getRangeAt(0);
|
|
2707
|
+
const insideEditor = editorArea.contains(liveRange.startContainer) &&
|
|
2708
|
+
editorArea.contains(liveRange.endContainer);
|
|
2709
|
+
if (insideEditor && liveSelection.isCollapsed) {
|
|
2710
|
+
lastSelection = null;
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
const hasExpandedSnapshot = () => {
|
|
2714
|
+
const snapshotRange = lastSelection?.range || rememberedRange;
|
|
2715
|
+
return Boolean(snapshotRange && !snapshotRange.collapsed);
|
|
2716
|
+
};
|
|
2717
|
+
const keepToolbarVisible = (keepSelectionOnToolbar || isToolbarFocused) && hasExpandedSnapshot();
|
|
2681
2718
|
const restoreFloatingToolbarFromSnapshot = () => {
|
|
2682
2719
|
const snapshotRange = lastSelection?.range || rememberedRange;
|
|
2683
2720
|
if (!snapshotRange) {
|
|
2684
2721
|
return false;
|
|
2685
2722
|
}
|
|
2723
|
+
if (snapshotRange.collapsed) {
|
|
2724
|
+
return false;
|
|
2725
|
+
}
|
|
2686
2726
|
try {
|
|
2687
2727
|
const rect = snapshotRange.getBoundingClientRect();
|
|
2688
2728
|
if (!rect.width && !rect.height) {
|
|
2689
2729
|
return false;
|
|
2690
2730
|
}
|
|
2691
|
-
const top =
|
|
2731
|
+
const top = clampFloatingTop(rect.top - 52);
|
|
2692
2732
|
const left = rect.left + rect.width / 2;
|
|
2693
2733
|
floatingToolbar.style.top = `${top}px`;
|
|
2694
2734
|
floatingToolbar.style.left = `${left}px`;
|
|
@@ -2740,7 +2780,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
2740
2780
|
range: range.cloneRange(),
|
|
2741
2781
|
rect,
|
|
2742
2782
|
};
|
|
2743
|
-
const top =
|
|
2783
|
+
const top = clampFloatingTop(rect.top - 52);
|
|
2744
2784
|
const left = rect.left + rect.width / 2;
|
|
2745
2785
|
floatingToolbar.style.top = `${top}px`;
|
|
2746
2786
|
floatingToolbar.style.left = `${left}px`;
|
|
@@ -2751,7 +2791,9 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
2751
2791
|
const shouldKeepFloatingToolbarVisible = () => {
|
|
2752
2792
|
const activeElement = document.activeElement;
|
|
2753
2793
|
const isToolbarFocused = Boolean(activeElement && floatingToolbar.contains(activeElement));
|
|
2754
|
-
|
|
2794
|
+
const snapshotRange = lastSelection?.range || rememberedRange;
|
|
2795
|
+
const hasExpandedSnapshot = Boolean(snapshotRange && !snapshotRange.collapsed);
|
|
2796
|
+
return (keepSelectionOnToolbar || isToolbarFocused) && hasExpandedSnapshot;
|
|
2755
2797
|
};
|
|
2756
2798
|
const withSelectionCommand = (action, successMessage) => {
|
|
2757
2799
|
if (state.mode !== "editor") {
|
|
@@ -3359,6 +3401,8 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
3359
3401
|
toolbar.style.display =
|
|
3360
3402
|
showEditorControls && state.features.textToolbar ? "flex" : "none";
|
|
3361
3403
|
pageRow.style.display = state.features.pageNav ? "flex" : "none";
|
|
3404
|
+
addPageBtn.style.display =
|
|
3405
|
+
showEditorControls && state.features.pageNav ? "inline-flex" : "none";
|
|
3362
3406
|
videoAddBtn.style.display = state.features.video ? "inline-block" : "none";
|
|
3363
3407
|
imageUploadBtn.style.display = "inline-block";
|
|
3364
3408
|
status.style.display = showEditorControls ? "block" : "none";
|
|
@@ -3373,6 +3417,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
3373
3417
|
hideTablePicker();
|
|
3374
3418
|
hideTableTools();
|
|
3375
3419
|
}
|
|
3420
|
+
updateTopControlShieldHeight();
|
|
3376
3421
|
prevPageBtn.disabled = state.pageIndex <= 0;
|
|
3377
3422
|
nextPageBtn.disabled = state.pageIndex >= state.doc.pages.length - 1;
|
|
3378
3423
|
pageInfo.textContent = `当前页 ${state.pageIndex + 1} / ${state.doc.pages.length}`;
|
|
@@ -4347,6 +4392,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
4347
4392
|
};
|
|
4348
4393
|
const handleWindowResize = () => {
|
|
4349
4394
|
updateShellViewportHeight();
|
|
4395
|
+
updateTopControlShieldHeight();
|
|
4350
4396
|
updateInlineResizeOverlay();
|
|
4351
4397
|
syncTableToolsPosition();
|
|
4352
4398
|
syncFocusedTableControls();
|
|
@@ -4357,6 +4403,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
4357
4403
|
};
|
|
4358
4404
|
const handleWindowScroll = () => {
|
|
4359
4405
|
updateShellViewportHeight();
|
|
4406
|
+
updateTopControlShieldHeight();
|
|
4360
4407
|
updateInlineResizeOverlay();
|
|
4361
4408
|
updateFloatingToolbarBySelection();
|
|
4362
4409
|
syncTableToolsPosition();
|
|
@@ -4381,6 +4428,7 @@ export function mountEditorWorkbench(container, options = {}) {
|
|
|
4381
4428
|
window.requestAnimationFrame(() => {
|
|
4382
4429
|
updateFullscreenButtonState();
|
|
4383
4430
|
updateShellViewportHeight();
|
|
4431
|
+
updateTopControlShieldHeight();
|
|
4384
4432
|
updateInlineResizeOverlay();
|
|
4385
4433
|
syncTableToolsPosition();
|
|
4386
4434
|
syncFocusedTableControls();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyebook/vue3-adapter",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Vue3 adapter for hy-ebook core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@hyebook/core": "^0.2.
|
|
20
|
+
"@hyebook/core": "^0.2.4"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc -p tsconfig.json",
|