@hyebook/vue3-adapter 2.2.6 → 2.3.0

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.
@@ -12,9 +12,38 @@ export interface EditorWorkbenchOptions {
12
12
  previewAnnotations?: EditorWorkbenchPreviewAnnotationOptions;
13
13
  title?: string;
14
14
  pageWidth?: number;
15
+ fullscreen?: EditorWorkbenchFullscreenOptions;
16
+ extension?: EditorWorkbenchExtensionOptions;
17
+ debug?: boolean | EditorWorkbenchDebugOptions;
15
18
  upload?: EditorWorkbenchUploadOptions;
16
19
  importDocx?: EditorWorkbenchDocxImportOptions;
17
- onDocumentChange?: (doc: EbookDoc) => void;
20
+ onDocumentChange?: (doc: EbookDoc) => void | Promise<void>;
21
+ onFullscreenSave?: (doc: EbookDoc) => void | Promise<void>;
22
+ }
23
+ export interface EditorWorkbenchFullscreenOptions {
24
+ exitButtonText?: string;
25
+ }
26
+ export interface EditorWorkbenchExtensionActionContext {
27
+ getDocument: () => EbookDoc;
28
+ isFullscreen: () => boolean;
29
+ getMode: () => "editor" | "preview";
30
+ setMode: (mode: "editor" | "preview") => void;
31
+ closeFullscreenAndSave: () => Promise<void>;
32
+ }
33
+ export interface EditorWorkbenchExtensionActionButton {
34
+ id: string;
35
+ text: string;
36
+ color?: string;
37
+ textColor?: string;
38
+ borderColor?: string;
39
+ onClick?: (context: EditorWorkbenchExtensionActionContext, event: MouseEvent) => void | Promise<void>;
40
+ }
41
+ export interface EditorWorkbenchExtensionOptions {
42
+ actions?: EditorWorkbenchExtensionActionButton[];
43
+ }
44
+ export interface EditorWorkbenchDebugOptions {
45
+ enabled?: boolean;
46
+ prefix?: string;
18
47
  }
19
48
  export interface EditorWorkbenchPreviewAnnotationActions {
20
49
  canDelete?: boolean;
@@ -52,9 +81,12 @@ export interface EditorWorkbenchUploadOptions {
52
81
  export interface EditorWorkbenchHandle {
53
82
  destroy: () => void;
54
83
  getDocument: () => EbookDoc;
84
+ isFullscreen: () => boolean;
55
85
  getMode: () => Mode;
56
86
  getPageIndex: () => number;
57
87
  importDocx: (file: File) => Promise<void>;
88
+ openFullscreen: () => void;
89
+ closeFullscreenAndSave: () => Promise<void>;
58
90
  setMode: (mode: Mode) => void;
59
91
  loadPreviewAnnotations: () => PreviewAnnotations;
60
92
  savePreviewAnnotations: (annotations: PreviewAnnotations | null | undefined) => PreviewAnnotations;
@@ -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;AAsLxB,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC5C,kBAAkB,CAAC,EAAE,uCAAuC,CAAC;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,4BAA4B,CAAC;IACtC,UAAU,CAAC,EAAE,gCAAgC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,uCAAuC;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,uCAAuC;IACtD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,wBAAwB,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;IAClD,iBAAiB,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MAAM,MAAM,CAAC;IAC3B,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,sBAAsB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC9B,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;IACjD,sBAAsB,EAAE,CACtB,WAAW,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,KAC/C,kBAAkB,CAAC;IACxB,WAAW,EAAE,MAAM,uBAAuB,CAAC;IAC3C,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAC;CACnE;AAED,eAAO,MAAM,iCAAiC,EAAE,uBAM/C,CAAC;AAEF,KAAK,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAoSjC,wBAAgB,8BAA8B,IAAI,QAAQ,CA6GzD;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,sBAA2B,GACnC,qBAAqB,CAozKvB"}
@@ -1,15 +1,18 @@
1
1
  import { addPageCommand } from "../editor/commands";
2
2
  import { EditorEngine } from "../editor/engine";
3
3
  const WORKBENCH_STYLE_ID = "hy-ebook-workbench-style";
4
- const WORKBENCH_STYLE_VERSION = "0.2.3";
4
+ const WORKBENCH_STYLE_VERSION = "0.3.0";
5
5
  const WORKBENCH_CSS = `
6
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
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}
8
8
  .hyewb-header{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
9
9
  .hyewb-title{font-size:14px;font-weight:600}
10
+ .hyewb-header-actions{margin-left:auto;display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap}
10
11
  .hyewb-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
11
12
  .hyewb-top-control{position:relative;z-index:120000;background:#f8fbff;isolation:isolate}
12
13
  .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}
14
+ .hyewb-btn.hyewb-btn-text{width:auto;min-width:96px;padding:0 12px}
15
+ .hyewb-header-action-btn{height:34px}
13
16
  .hyewb-btn.active{border-color:#0b7285;background:#0b7285;color:#fff}
14
17
  .hyewb-btn:disabled{cursor:not-allowed;opacity:.55}
15
18
  .hyewb-btn svg,.hyewb-upload-close svg{width:16px;height:16px;stroke-width:2}
@@ -25,10 +28,10 @@ const WORKBENCH_CSS = `
25
28
  .hyewb-field-icon{position:absolute;left:10px;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;color:#64748b;pointer-events:none;z-index:1}
26
29
  .hyewb-field-icon svg{width:14px;height:14px;stroke-width:2}
27
30
  .hyewb-field-with-icon .hyewb-select,.hyewb-field-with-icon .hyewb-number{padding-left:30px}
28
- .hyewb-shell{border:1px dashed #b8c3d1;border-radius:10px;background:#eef4ff;padding:10px;overflow-x:auto;overflow-y:auto;overscroll-behavior:auto;-webkit-overflow-scrolling:touch}
31
+ .hyewb-shell{border:1px dashed #b8c3d1;border-radius:10px;background:#eef4ff;padding:10px;overflow-x:auto;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
29
32
  .hyewb-preview-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;align-items:start}
30
33
  .hyewb-preview-layout.with-annotation-panel{grid-template-columns:minmax(0,1fr) 300px}
31
- .hyewb-canvas{position:relative;background:#fff;border:1px solid #d9e3ee;border-radius:8px;min-height:420px;padding:20px 24px;box-shadow:0 6px 16px rgba(15,23,42,.08);margin:0 auto;max-width:100%;box-sizing:border-box}
34
+ .hyewb-canvas{position:relative;background:#fff;border:1px solid #d9e3ee;border-radius:8px;min-height:420px;padding:20px 24px;box-shadow:0 6px 16px rgba(15,23,42,.08);margin:16px auto;max-width:100%;box-sizing:border-box;}
32
35
  .hyewb-editor{min-height:360px;outline:none;line-height:1.7;font-size:16px;color:#1e293b}
33
36
  .hyewb-float{position:fixed;z-index:9999;display:none;align-items:center;gap:6px;padding:6px 8px;border-radius:10px;border:1px solid #0f172a;background:rgba(15,23,42,.96);box-shadow:0 10px 24px rgba(15,23,42,.22)}
34
37
  .hyewb-float.show{display:inline-flex}
@@ -175,8 +178,14 @@ const WORKBENCH_CSS = `
175
178
  .hyewb-preview-selection-btn svg{width:16px;height:16px}
176
179
  .hyewb-preview-annotation-flash{animation:hyewb-preview-annotation-pulse .9s ease}
177
180
  @keyframes hyewb-preview-annotation-pulse{0%{box-shadow:0 0 0 0 rgba(14,116,144,.4)}100%{box-shadow:0 0 0 12px rgba(14,116,144,0)}}
178
- .hyewb-root:fullscreen .hyewb-editor,.hyewb-root:fullscreen .hyewb-preview{min-height:1000px}
179
- .hyewb-root:-webkit-full-screen .hyewb-editor,.hyewb-root:-webkit-full-screen .hyewb-preview{min-height:1000px}
181
+ .hyewb-overlay{position:fixed;inset:0;z-index:2147483000;background:rgba(15,23,42,.35);padding:0;box-sizing:border-box;overflow:hidden;overscroll-behavior:contain}
182
+ .hyewb-overlay-layer{min-height:100vh;min-height:100dvh;height:100vh;height:100dvh;display:flex;align-items:stretch;justify-content:stretch;overflow:hidden}
183
+ .hyewb-root.hyewb-overlay-active{width:100%;max-width:none;min-height:100vh;min-height:100dvh;height:100vh;height:100dvh;margin:0;border-radius:0;box-shadow:none;grid-template-rows:auto auto minmax(0,1fr);overflow:hidden}
184
+ .hyewb-root.hyewb-overlay-active .hyewb-preview-layout{height:100%;min-height:0;align-items:stretch;grid-template-rows:minmax(0,1fr)}
185
+ .hyewb-root.hyewb-overlay-active .hyewb-shell{height:100%;max-height:none;min-height:0;padding:0;background:transparent}
186
+ .hyewb-root.hyewb-overlay-active .hyewb-canvas{height:auto;min-height:100%;border-radius:0;box-shadow:none}
187
+ .hyewb-root.hyewb-overlay-active .hyewb-preview-annotation-panel{height:100%;max-height:none}
188
+ .hyewb-root.hyewb-overlay-active .hyewb-editor,.hyewb-root.hyewb-overlay-active .hyewb-preview{min-height:100%}
180
189
  `;
181
190
  export const DEFAULT_EDITOR_WORKBENCH_FEATURES = {
182
191
  textToolbar: true,
@@ -447,13 +456,50 @@ export function mountEditorWorkbench(container, options = {}) {
447
456
  const paperWidth = resolvePaperWidth(options.pageWidth, state.doc.settings.page.width);
448
457
  const root = document.createElement("section");
449
458
  root.className = "hyewb-root";
459
+ const extensionActionConfigs = Array.isArray(options.extension?.actions)
460
+ ? options.extension.actions.filter((action) => {
461
+ return (!!action &&
462
+ typeof action.id === "string" &&
463
+ action.id.trim().length > 0 &&
464
+ typeof action.text === "string" &&
465
+ action.text.trim().length > 0);
466
+ })
467
+ : [];
450
468
  const header = document.createElement("header");
451
469
  header.className = "hyewb-header hyewb-top-control";
452
470
  const title = document.createElement("div");
453
471
  title.className = "hyewb-title";
454
472
  title.textContent = options.title ?? "hy-ebook Editor Workbench";
473
+ const headerActions = document.createElement("div");
474
+ headerActions.className = "hyewb-header-actions";
455
475
  const fullscreenBtn = createButton("fullscreen");
456
- header.append(title);
476
+ const extensionActionButtons = extensionActionConfigs.map((action) => {
477
+ const button = document.createElement("button");
478
+ button.type = "button";
479
+ button.className = "hyewb-btn hyewb-btn-text hyewb-header-action-btn";
480
+ const text = action.text.trim();
481
+ button.textContent = text;
482
+ button.title = text;
483
+ button.setAttribute("aria-label", text);
484
+ button.style.display = "none";
485
+ const color = typeof action.color === "string" ? action.color.trim() : "";
486
+ if (color) {
487
+ button.style.backgroundColor = color;
488
+ button.style.borderColor = color;
489
+ }
490
+ const textColor = typeof action.textColor === "string" ? action.textColor.trim() : "";
491
+ if (textColor) {
492
+ button.style.color = textColor;
493
+ }
494
+ const borderColor = typeof action.borderColor === "string" ? action.borderColor.trim() : "";
495
+ if (borderColor) {
496
+ button.style.borderColor = borderColor;
497
+ }
498
+ headerActions.append(button);
499
+ return { action, button };
500
+ });
501
+ headerActions.append(fullscreenBtn);
502
+ header.append(title, headerActions);
457
503
  const toolbar = document.createElement("div");
458
504
  toolbar.className = "hyewb-row hyewb-top-control";
459
505
  const boldBtn = createButton("bold");
@@ -722,8 +768,7 @@ export function mountEditorWorkbench(container, options = {}) {
722
768
  const addPageBtn = createButton("addPage");
723
769
  const pageInfo = document.createElement("span");
724
770
  pageInfo.className = "hyewb-status";
725
- fullscreenBtn.style.marginLeft = "auto";
726
- pageRow.append(prevPageBtn, nextPageBtn, addPageBtn, pageInfo, fullscreenBtn);
771
+ pageRow.append(prevPageBtn, nextPageBtn, addPageBtn, pageInfo);
727
772
  const previewLayout = document.createElement("div");
728
773
  previewLayout.className = "hyewb-preview-layout";
729
774
  const shell = document.createElement("div");
@@ -852,6 +897,41 @@ export function mountEditorWorkbench(container, options = {}) {
852
897
  const status = document.createElement("p");
853
898
  status.className = "hyewb-status";
854
899
  status.textContent = "已加载默认编辑器能力";
900
+ const debugEnabled = options.debug === true ||
901
+ (typeof options.debug === "object" &&
902
+ options.debug !== null &&
903
+ options.debug.enabled !== false);
904
+ const debugPrefix = typeof options.debug === "object" &&
905
+ options.debug !== null &&
906
+ options.debug.prefix
907
+ ? options.debug.prefix
908
+ : "[hyebook:workbench]";
909
+ const debugLog = (message) => {
910
+ if (!debugEnabled) {
911
+ return;
912
+ }
913
+ console.log(`${debugPrefix} ${message}`);
914
+ };
915
+ let lastDebugStatusMessage = "";
916
+ const flushDebugStatus = () => {
917
+ const nextMessage = String(status.textContent || "").trim();
918
+ if (!nextMessage || nextMessage === lastDebugStatusMessage) {
919
+ return;
920
+ }
921
+ lastDebugStatusMessage = nextMessage;
922
+ debugLog(nextMessage);
923
+ };
924
+ const statusObserver = debugEnabled && typeof MutationObserver !== "undefined"
925
+ ? new MutationObserver(() => {
926
+ flushDebugStatus();
927
+ })
928
+ : null;
929
+ statusObserver?.observe(status, {
930
+ childList: true,
931
+ characterData: true,
932
+ subtree: true,
933
+ });
934
+ flushDebugStatus();
855
935
  const uploadBackdrop = document.createElement("div");
856
936
  uploadBackdrop.className = "hyewb-upload-backdrop";
857
937
  const uploadDialog = document.createElement("div");
@@ -890,7 +970,7 @@ export function mountEditorWorkbench(container, options = {}) {
890
970
  const colorGrid = document.createElement("div");
891
971
  colorGrid.className = "hyewb-color-grid";
892
972
  colorPalette.append(colorGrid);
893
- root.append(header, toolbar, pageRow, previewLayout, status, colorPalette, tablePicker, tableTools, tableRowDeleteBtn, tableMoveHandle, tableScaleHandle, tableColEdgeLayer, tableRowEdgeLayer, tableRowGapInsertBtn, tableColGapInsertBtn, tableDropIndicator, tableContextMenu, uploadBackdrop, previewNoteBackdrop, docxInput, previewSelectionToolbar);
973
+ root.append(header, toolbar, pageRow, previewLayout, colorPalette, tablePicker, tableTools, tableRowDeleteBtn, tableMoveHandle, tableScaleHandle, tableColEdgeLayer, tableRowEdgeLayer, tableRowGapInsertBtn, tableColGapInsertBtn, tableDropIndicator, tableContextMenu, uploadBackdrop, previewNoteBackdrop, docxInput, previewSelectionToolbar);
894
974
  container.innerHTML = "";
895
975
  root.append(floatingToolbar);
896
976
  container.append(root);
@@ -935,32 +1015,55 @@ export function mountEditorWorkbench(container, options = {}) {
935
1015
  speedMbps: undefined,
936
1016
  error: undefined,
937
1017
  };
938
- let shouldRestoreFullscreenAfterFilePicker = false;
1018
+ let fullscreenOverlay = null;
1019
+ let fullscreenAnchor = null;
1020
+ let bodyOverflowBeforeOverlay = null;
1021
+ let htmlOverflowBeforeOverlay = null;
1022
+ let isOverlayFullscreen = false;
1023
+ const fullscreenExitButtonText = typeof options.fullscreen?.exitButtonText === "string"
1024
+ ? options.fullscreen.exitButtonText.trim()
1025
+ : "";
939
1026
  const setButtonIcon = (button, iconName) => {
940
- button.innerHTML = "";
1027
+ button.classList.remove("hyewb-btn-text");
1028
+ button.textContent = "";
941
1029
  button.append(createIconPlaceholder(iconName));
942
1030
  };
943
- const getFullscreenElement = () => {
944
- const webkitDocument = document;
945
- return (document.fullscreenElement ||
946
- webkitDocument.webkitFullscreenElement ||
947
- null);
1031
+ const setButtonText = (button, text) => {
1032
+ button.classList.add("hyewb-btn-text");
1033
+ button.textContent = text;
948
1034
  };
949
1035
  const isWorkbenchFullscreen = () => {
950
- return getFullscreenElement() === root;
1036
+ return isOverlayFullscreen;
951
1037
  };
952
1038
  const updateFullscreenButtonState = () => {
953
1039
  const isFullscreen = isWorkbenchFullscreen();
954
1040
  setButtonActive(fullscreenBtn, isFullscreen);
955
- setButtonIcon(fullscreenBtn, isFullscreen ? "fullscreen-exit" : "fullscreen-enter");
956
- const label = isFullscreen ? "退出全屏" : "全屏";
957
- fullscreenBtn.title = label;
958
- fullscreenBtn.setAttribute("aria-label", label);
1041
+ const shouldUseExitText = isFullscreen && fullscreenExitButtonText.length > 0;
1042
+ if (shouldUseExitText) {
1043
+ setButtonText(fullscreenBtn, fullscreenExitButtonText);
1044
+ }
1045
+ else {
1046
+ setButtonIcon(fullscreenBtn, isFullscreen ? "fullscreen-exit" : "fullscreen-enter");
1047
+ }
1048
+ const label = isFullscreen ? "保存并退出" : "全屏";
1049
+ const ariaLabel = shouldUseExitText ? fullscreenExitButtonText : label;
1050
+ fullscreenBtn.title = ariaLabel;
1051
+ fullscreenBtn.setAttribute("aria-label", ariaLabel);
1052
+ fullscreenBtn.style.display = isFullscreen ? "inline-flex" : "none";
1053
+ extensionActionButtons.forEach(({ button }) => {
1054
+ button.style.display = isFullscreen ? "inline-flex" : "none";
1055
+ });
959
1056
  };
960
1057
  const updateShellViewportHeight = () => {
1058
+ if (isWorkbenchFullscreen()) {
1059
+ shell.style.height = "100%";
1060
+ shell.style.maxHeight = "";
1061
+ return;
1062
+ }
1063
+ shell.style.height = "";
961
1064
  const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
962
1065
  const top = root.getBoundingClientRect().top;
963
- const bottomPadding = isWorkbenchFullscreen() ? 16 : 24;
1066
+ const bottomPadding = 24;
964
1067
  const nextHeight = Math.max(320, Math.floor(viewportHeight - top - bottomPadding));
965
1068
  shell.style.maxHeight = `${nextHeight}px`;
966
1069
  };
@@ -986,69 +1089,102 @@ export function mountEditorWorkbench(container, options = {}) {
986
1089
  const rounded = Math.round(top);
987
1090
  return Math.min(rounded, maxTop);
988
1091
  };
989
- const requestWorkbenchFullscreen = async () => {
990
- const target = root;
991
- if (typeof target.requestFullscreen === "function") {
992
- await target.requestFullscreen();
993
- return;
994
- }
995
- if (typeof target.webkitRequestFullscreen === "function") {
996
- target.webkitRequestFullscreen();
1092
+ const syncWorkbenchLayoutAfterFullscreenChange = () => {
1093
+ updateFullscreenButtonState();
1094
+ updateShellViewportHeight();
1095
+ updateTopControlShieldHeight();
1096
+ updateInlineResizeOverlay();
1097
+ syncTableToolsPosition();
1098
+ syncFocusedTableControls();
1099
+ syncPreviewSelectionToolbar();
1100
+ };
1101
+ const openWorkbenchFullscreen = () => {
1102
+ if (isWorkbenchFullscreen()) {
997
1103
  return;
998
1104
  }
999
- throw new Error("当前环境不支持全屏");
1105
+ const parentNode = root.parentNode;
1106
+ if (!parentNode) {
1107
+ return;
1108
+ }
1109
+ fullscreenAnchor = document.createComment("hyewb-fullscreen-anchor");
1110
+ parentNode.insertBefore(fullscreenAnchor, root);
1111
+ fullscreenOverlay = document.createElement("div");
1112
+ fullscreenOverlay.className = "hyewb-overlay";
1113
+ const fullscreenOverlayLayer = document.createElement("div");
1114
+ fullscreenOverlayLayer.className = "hyewb-overlay-layer";
1115
+ fullscreenOverlay.append(fullscreenOverlayLayer);
1116
+ fullscreenOverlayLayer.append(root);
1117
+ document.body.append(fullscreenOverlay);
1118
+ htmlOverflowBeforeOverlay = document.documentElement.style.overflow;
1119
+ document.documentElement.style.overflow = "hidden";
1120
+ bodyOverflowBeforeOverlay = document.body.style.overflow;
1121
+ document.body.style.overflow = "hidden";
1122
+ root.classList.add("hyewb-overlay-active");
1123
+ isOverlayFullscreen = true;
1124
+ render();
1125
+ status.textContent = "已进入页面全屏编辑";
1126
+ syncWorkbenchLayoutAfterFullscreenChange();
1000
1127
  };
1001
- const exitWorkbenchFullscreen = async () => {
1002
- const webkitDocument = document;
1003
- if (typeof document.exitFullscreen === "function") {
1004
- await document.exitFullscreen();
1128
+ const closeWorkbenchFullscreen = () => {
1129
+ if (!isWorkbenchFullscreen()) {
1005
1130
  return;
1006
1131
  }
1007
- if (typeof webkitDocument.webkitExitFullscreen === "function") {
1008
- webkitDocument.webkitExitFullscreen();
1009
- return;
1132
+ if (fullscreenAnchor && fullscreenAnchor.parentNode) {
1133
+ fullscreenAnchor.parentNode.insertBefore(root, fullscreenAnchor);
1134
+ fullscreenAnchor.parentNode.removeChild(fullscreenAnchor);
1010
1135
  }
1011
- if (typeof webkitDocument.webkitCancelFullScreen === "function") {
1012
- webkitDocument.webkitCancelFullScreen();
1136
+ else {
1137
+ container.append(root);
1013
1138
  }
1014
- };
1015
- const toggleWorkbenchFullscreen = async () => {
1016
- try {
1017
- if (isWorkbenchFullscreen()) {
1018
- await exitWorkbenchFullscreen();
1019
- }
1020
- else {
1021
- await requestWorkbenchFullscreen();
1022
- }
1139
+ fullscreenAnchor = null;
1140
+ if (fullscreenOverlay && fullscreenOverlay.parentNode) {
1141
+ fullscreenOverlay.parentNode.removeChild(fullscreenOverlay);
1023
1142
  }
1024
- catch {
1025
- status.textContent = "当前浏览器不支持全屏";
1143
+ fullscreenOverlay = null;
1144
+ root.classList.remove("hyewb-overlay-active");
1145
+ isOverlayFullscreen = false;
1146
+ render();
1147
+ if (bodyOverflowBeforeOverlay !== null) {
1148
+ document.body.style.overflow = bodyOverflowBeforeOverlay;
1149
+ bodyOverflowBeforeOverlay = null;
1026
1150
  }
1027
- finally {
1028
- updateFullscreenButtonState();
1029
- updateShellViewportHeight();
1151
+ if (htmlOverflowBeforeOverlay !== null) {
1152
+ document.documentElement.style.overflow = htmlOverflowBeforeOverlay;
1153
+ htmlOverflowBeforeOverlay = null;
1030
1154
  }
1155
+ syncWorkbenchLayoutAfterFullscreenChange();
1031
1156
  };
1032
- const restoreWorkbenchFullscreenIfNeeded = async () => {
1033
- if (!shouldRestoreFullscreenAfterFilePicker) {
1034
- return;
1035
- }
1036
- shouldRestoreFullscreenAfterFilePicker = false;
1037
- if (isWorkbenchFullscreen()) {
1157
+ const closeWorkbenchFullscreenAndSave = async () => {
1158
+ if (!isWorkbenchFullscreen()) {
1038
1159
  return;
1039
1160
  }
1040
1161
  try {
1041
- await requestWorkbenchFullscreen();
1042
- }
1043
- catch {
1044
- // Ignore restore failure when browser blocks fullscreen without activation.
1162
+ syncEditorToDoc({ emitChange: false });
1163
+ const snapshot = clone(state.doc);
1164
+ if (options.onFullscreenSave) {
1165
+ await options.onFullscreenSave(snapshot);
1166
+ }
1167
+ else {
1168
+ await Promise.resolve(options.onDocumentChange?.(snapshot));
1169
+ }
1170
+ closeWorkbenchFullscreen();
1171
+ status.textContent = "已保存并退出页面全屏";
1045
1172
  }
1046
- finally {
1047
- updateFullscreenButtonState();
1048
- updateShellViewportHeight();
1049
- updateTopControlShieldHeight();
1173
+ catch (error) {
1174
+ const errorMessage = error instanceof Error && error.message ? error.message : "请稍后重试";
1175
+ status.textContent = `保存失败:${errorMessage}`;
1050
1176
  }
1051
1177
  };
1178
+ const getExtensionActionContext = () => {
1179
+ syncEditorToDoc({ emitChange: false });
1180
+ return {
1181
+ getDocument: () => clone(state.doc),
1182
+ isFullscreen: isWorkbenchFullscreen,
1183
+ getMode: () => state.mode,
1184
+ setMode,
1185
+ closeFullscreenAndSave: closeWorkbenchFullscreenAndSave,
1186
+ };
1187
+ };
1052
1188
  const formatUploadProgress = (percent) => {
1053
1189
  const safe = Number.isFinite(percent) ? percent : 0;
1054
1190
  const clamped = Math.max(0, Math.min(100, safe));
@@ -2963,7 +3099,7 @@ export function mountEditorWorkbench(container, options = {}) {
2963
3099
  });
2964
3100
  colorGrid.append(swatch);
2965
3101
  });
2966
- const syncEditorToDoc = () => {
3102
+ const syncEditorToDoc = (options) => {
2967
3103
  if (state.mode !== "editor") {
2968
3104
  return;
2969
3105
  }
@@ -2975,7 +3111,9 @@ export function mountEditorWorkbench(container, options = {}) {
2975
3111
  page.blocks = replaceFlowBlocks(page.blocks, flowBlocks);
2976
3112
  state.doc.meta.updatedAt = new Date().toISOString();
2977
3113
  editor.setDocument(state.doc);
2978
- emitDocumentChange();
3114
+ if (options?.emitChange !== false) {
3115
+ emitDocumentChange();
3116
+ }
2979
3117
  };
2980
3118
  const updateAlign = (align) => {
2981
3119
  if (selectedInlineImage &&
@@ -3499,12 +3637,12 @@ export function mountEditorWorkbench(container, options = {}) {
3499
3637
  previewArea.classList.toggle("show", state.mode === "preview");
3500
3638
  editorArea.style.display = state.mode === "editor" ? "block" : "none";
3501
3639
  const showEditorControls = state.mode === "editor";
3502
- header.style.display = showEditorControls ? "flex" : "none";
3640
+ header.style.display =
3641
+ showEditorControls || isWorkbenchFullscreen() ? "flex" : "none";
3503
3642
  toolbar.style.display =
3504
3643
  showEditorControls && state.features.textToolbar ? "flex" : "none";
3505
- pageRow.style.display = state.features.pageNav ? "flex" : "none";
3506
- addPageBtn.style.display =
3507
- showEditorControls && state.features.pageNav ? "inline-flex" : "none";
3644
+ pageRow.style.display = "none";
3645
+ addPageBtn.style.display = "none";
3508
3646
  videoAddBtn.style.display = state.features.video ? "inline-block" : "none";
3509
3647
  imageUploadBtn.style.display = "inline-block";
3510
3648
  status.style.display = showEditorControls ? "block" : "none";
@@ -3535,7 +3673,14 @@ export function mountEditorWorkbench(container, options = {}) {
3535
3673
  return Math.max(max, nextBottom);
3536
3674
  }, 0);
3537
3675
  const nextCanvasMinHeight = Math.max(420, Math.round(mediaBottom + 60));
3538
- canvas.style.minHeight = `${nextCanvasMinHeight}px`;
3676
+ if (isWorkbenchFullscreen()) {
3677
+ const shellHeight = Math.max(0, Math.round(shell.clientHeight));
3678
+ const fullscreenCanvasMinHeight = Math.max(nextCanvasMinHeight, shellHeight);
3679
+ canvas.style.minHeight = `${fullscreenCanvasMinHeight}px`;
3680
+ }
3681
+ else {
3682
+ canvas.style.minHeight = `${nextCanvasMinHeight}px`;
3683
+ }
3539
3684
  mediaStage.classList.toggle("preview", state.mode === "preview");
3540
3685
  mediaStage.innerHTML = "";
3541
3686
  mediaBlocks.forEach((item, index) => {
@@ -4525,19 +4670,6 @@ export function mountEditorWorkbench(container, options = {}) {
4525
4670
  };
4526
4671
  window.addEventListener("resize", handleWindowResize);
4527
4672
  window.addEventListener("scroll", handleWindowScroll, true);
4528
- const handleFullscreenChange = () => {
4529
- window.requestAnimationFrame(() => {
4530
- updateFullscreenButtonState();
4531
- updateShellViewportHeight();
4532
- updateTopControlShieldHeight();
4533
- updateInlineResizeOverlay();
4534
- syncTableToolsPosition();
4535
- syncFocusedTableControls();
4536
- syncPreviewSelectionToolbar();
4537
- });
4538
- };
4539
- document.addEventListener("fullscreenchange", handleFullscreenChange);
4540
- document.addEventListener("webkitfullscreenchange", handleFullscreenChange);
4541
4673
  document.addEventListener("selectionchange", handleSelectionChange);
4542
4674
  const handleDocumentPointerDownForPalette = (event) => {
4543
4675
  const clickTarget = event.target;
@@ -4613,7 +4745,29 @@ export function mountEditorWorkbench(container, options = {}) {
4613
4745
  document.addEventListener("pointerdown", handleDocumentPointerDownForPalette);
4614
4746
  document.addEventListener("keydown", handleDocumentKeyDown);
4615
4747
  fullscreenBtn.addEventListener("click", () => {
4616
- void toggleWorkbenchFullscreen();
4748
+ void closeWorkbenchFullscreenAndSave();
4749
+ });
4750
+ extensionActionButtons.forEach(({ action, button }) => {
4751
+ button.addEventListener("click", (event) => {
4752
+ if (!action.onClick) {
4753
+ return;
4754
+ }
4755
+ try {
4756
+ const result = action.onClick(getExtensionActionContext(), event);
4757
+ void Promise.resolve(result).catch((error) => {
4758
+ const errorMessage = error instanceof Error && error.message
4759
+ ? error.message
4760
+ : "请稍后重试";
4761
+ status.textContent = `扩展按钮执行失败:${errorMessage}`;
4762
+ });
4763
+ }
4764
+ catch (error) {
4765
+ const errorMessage = error instanceof Error && error.message
4766
+ ? error.message
4767
+ : "请稍后重试";
4768
+ status.textContent = `扩展按钮执行失败:${errorMessage}`;
4769
+ }
4770
+ });
4617
4771
  });
4618
4772
  tableAddBtn.addEventListener("mousedown", preserveSelectionForInputControl);
4619
4773
  videoAddBtn.addEventListener("mousedown", preserveSelectionForInputControl);
@@ -4644,12 +4798,10 @@ export function mountEditorWorkbench(container, options = {}) {
4644
4798
  status.textContent = "请先切换到编辑模式后再导入 Word";
4645
4799
  return;
4646
4800
  }
4647
- shouldRestoreFullscreenAfterFilePicker = isWorkbenchFullscreen();
4648
4801
  docxInput.value = "";
4649
4802
  docxInput.click();
4650
4803
  });
4651
4804
  docxInput.addEventListener("change", () => {
4652
- void restoreWorkbenchFullscreenIfNeeded();
4653
4805
  const picked = docxInput.files?.[0] || null;
4654
4806
  docxInput.value = "";
4655
4807
  if (!picked) {
@@ -4657,11 +4809,7 @@ export function mountEditorWorkbench(container, options = {}) {
4657
4809
  }
4658
4810
  void importDocxFile(picked);
4659
4811
  });
4660
- uploadInput.addEventListener("click", () => {
4661
- shouldRestoreFullscreenAfterFilePicker = isWorkbenchFullscreen();
4662
- });
4663
4812
  uploadInput.addEventListener("change", () => {
4664
- void restoreWorkbenchFullscreenIfNeeded();
4665
4813
  const picked = uploadInput.files?.[0] || null;
4666
4814
  uploadState.progress = 0;
4667
4815
  uploadState.speedMbps = undefined;
@@ -4696,10 +4844,6 @@ export function mountEditorWorkbench(container, options = {}) {
4696
4844
  uploadDialog.addEventListener("click", (event) => {
4697
4845
  event.stopPropagation();
4698
4846
  });
4699
- const handleWindowFocusForFullscreenRestore = () => {
4700
- void restoreWorkbenchFullscreenIfNeeded();
4701
- };
4702
- window.addEventListener("focus", handleWindowFocusForFullscreenRestore);
4703
4847
  prevPageBtn.addEventListener("click", () => jumpPage(-1));
4704
4848
  nextPageBtn.addEventListener("click", () => jumpPage(1));
4705
4849
  addPageBtn.addEventListener("click", addPage);
@@ -4710,6 +4854,8 @@ export function mountEditorWorkbench(container, options = {}) {
4710
4854
  emitDocumentChange();
4711
4855
  return {
4712
4856
  destroy: () => {
4857
+ statusObserver?.disconnect();
4858
+ closeWorkbenchFullscreen();
4713
4859
  hideTablePicker();
4714
4860
  hideTableTools();
4715
4861
  document.removeEventListener("selectionchange", handleSelectionChange);
@@ -4717,17 +4863,17 @@ export function mountEditorWorkbench(container, options = {}) {
4717
4863
  document.removeEventListener("pointerup", onMediaPointerUp);
4718
4864
  window.removeEventListener("resize", handleWindowResize);
4719
4865
  window.removeEventListener("scroll", handleWindowScroll, true);
4720
- window.removeEventListener("focus", handleWindowFocusForFullscreenRestore);
4721
4866
  document.removeEventListener("pointerdown", handleDocumentPointerDownForPalette);
4722
4867
  document.removeEventListener("keydown", handleDocumentKeyDown);
4723
- document.removeEventListener("fullscreenchange", handleFullscreenChange);
4724
- document.removeEventListener("webkitfullscreenchange", handleFullscreenChange);
4725
4868
  container.innerHTML = "";
4726
4869
  },
4727
4870
  getDocument: () => clone(state.doc),
4871
+ isFullscreen: isWorkbenchFullscreen,
4728
4872
  getMode: () => state.mode,
4729
4873
  getPageIndex: () => state.pageIndex,
4730
4874
  importDocx: importDocxFile,
4875
+ openFullscreen: openWorkbenchFullscreen,
4876
+ closeFullscreenAndSave: closeWorkbenchFullscreenAndSave,
4731
4877
  setMode,
4732
4878
  loadPreviewAnnotations,
4733
4879
  savePreviewAnnotations,
@@ -1,10 +1,13 @@
1
- import { EditorEngine, PlayerEngine, type EditorWorkbenchHandle, type EditorWorkbenchOptions, type EbookDoc, type PlayerDataProvider } from "@hyebook/core";
1
+ import { EBookPlayer, EditorEngine, PlayerEngine, type EBookPlayerOptions, type EditorWorkbenchHandle, type EditorWorkbenchOptions, type EbookDoc, type PlayerDataProvider, type PlayerEngineOptions } from "@hyebook/core";
2
2
  export interface Vue3EditorAdapterOptions {
3
3
  initialDoc: EbookDoc;
4
4
  onDocumentChange?: (doc: EbookDoc) => void;
5
5
  }
6
6
  export interface Vue3PlayerAdapterOptions {
7
7
  provider: PlayerDataProvider;
8
+ engineOptions?: PlayerEngineOptions;
9
+ }
10
+ export interface Vue3EBookPlayerAdapterOptions extends EBookPlayerOptions {
8
11
  }
9
12
  export interface Vue3EditorWorkbenchOptions extends EditorWorkbenchOptions {
10
13
  }
@@ -12,5 +15,6 @@ export interface Vue3EditorWorkbenchHandle extends EditorWorkbenchHandle {
12
15
  }
13
16
  export declare function createVue3EditorAdapter(options: Vue3EditorAdapterOptions): EditorEngine;
14
17
  export declare function createVue3PlayerAdapter(options: Vue3PlayerAdapterOptions): PlayerEngine;
18
+ export declare function createEBookPlayerAdapter(container: HTMLElement, options: Vue3EBookPlayerAdapterOptions): EBookPlayer;
15
19
  export declare function mountVue3EditorWorkbench(container: HTMLElement, options?: Vue3EditorWorkbenchOptions): Vue3EditorWorkbenchHandle;
16
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAEZ,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,QAAQ,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;CAAG;AAE7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