@hyebook/vue3-adapter 2.2.6 → 2.2.7

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,25 +1,65 @@
1
1
  import type { EbookDoc } from "../types/ebook";
2
- import type { PlayerDataProvider, ReaderNote, ReaderProgress } from "../types/player";
2
+ import type { ReaderAnnotationChangeSource, ReaderAnnotationCreateEvent, ReaderAnnotationDeleteEvent, ReaderAnnotations, ReaderAnnotationsChangeEvent, ReaderAnnotationUpdateEvent, ReaderHighlight, PlayerDataProvider, PlayerEngineOptions, PlayerFeatures, ReaderNote, ReaderProgress } from "../types/player";
3
3
  export interface PlayerState {
4
4
  currentPage: number;
5
5
  zoom: number;
6
+ highlights: ReaderHighlight[];
6
7
  notes: ReaderNote[];
7
8
  progress: ReaderProgress | null;
8
9
  }
10
+ type AnnotationCreateListener = (event: ReaderAnnotationCreateEvent) => void;
11
+ type AnnotationUpdateListener = (event: ReaderAnnotationUpdateEvent) => void;
12
+ type AnnotationDeleteListener = (event: ReaderAnnotationDeleteEvent) => void;
13
+ type AnnotationsChangeListener = (event: ReaderAnnotationsChangeEvent) => void;
9
14
  export declare class PlayerEngine {
10
15
  private provider;
16
+ private features;
11
17
  private doc;
12
18
  private state;
13
- constructor(provider: PlayerDataProvider);
19
+ private annotationCreateListeners;
20
+ private annotationUpdateListeners;
21
+ private annotationDeleteListeners;
22
+ private annotationsChangeListeners;
23
+ constructor(provider: PlayerDataProvider, options?: PlayerEngineOptions);
14
24
  load(): Promise<EbookDoc>;
15
25
  getDocument(): EbookDoc;
16
26
  getState(): PlayerState;
27
+ getHighlights(): ReaderHighlight[];
28
+ getNotes(): ReaderNote[];
29
+ getAnnotations(): ReaderAnnotations;
30
+ getFeatures(): Required<PlayerFeatures>;
31
+ isBuiltInNotesModuleEnabled(): boolean;
32
+ reloadAnnotations(): Promise<ReaderAnnotations>;
33
+ goToHighlight(highlightId: string): number | null;
34
+ goToNote(noteId: string): number | null;
17
35
  goToPage(index: number): number;
18
36
  nextPage(): number;
19
37
  prevPage(): number;
20
38
  setZoom(zoom: number): number;
21
39
  saveProgress(): Promise<void>;
40
+ createHighlight(highlight: Omit<ReaderHighlight, "id" | "createdAt" | "updatedAt" | "bookId">, source?: ReaderAnnotationChangeSource): Promise<ReaderHighlight>;
41
+ updateHighlight(highlightId: string, patch: Partial<Omit<ReaderHighlight, "id" | "bookId" | "createdAt">>, source?: ReaderAnnotationChangeSource): Promise<ReaderHighlight | null>;
42
+ deleteHighlight(highlightId: string, source?: ReaderAnnotationChangeSource): Promise<boolean>;
22
43
  addNote(note: Omit<ReaderNote, "id" | "createdAt" | "updatedAt" | "bookId">): Promise<ReaderNote>;
44
+ createNote(note: Omit<ReaderNote, "id" | "createdAt" | "updatedAt" | "bookId">, source?: ReaderAnnotationChangeSource): Promise<ReaderNote>;
45
+ updateNote(noteId: string, patch: Partial<Omit<ReaderNote, "id" | "bookId" | "createdAt">>, source?: ReaderAnnotationChangeSource): Promise<ReaderNote | null>;
46
+ deleteNote(noteId: string, source?: ReaderAnnotationChangeSource): Promise<boolean>;
47
+ onAnnotationCreate(listener: AnnotationCreateListener): () => void;
48
+ onAnnotationUpdate(listener: AnnotationUpdateListener): () => void;
49
+ onAnnotationDelete(listener: AnnotationDeleteListener): () => void;
50
+ onAnnotationsChange(listener: AnnotationsChangeListener): () => void;
23
51
  private restoreUserState;
52
+ private loadAnnotationsState;
53
+ private findPageIndexByPageId;
54
+ private normalizeRange;
55
+ private normalizeAnnotations;
56
+ private mapPreviewAnnotationsToReader;
57
+ private persistAnnotations;
58
+ private emitAnnotationCreate;
59
+ private emitAnnotationUpdate;
60
+ private emitAnnotationDelete;
61
+ private emitAnnotationsChange;
62
+ private notifyListeners;
24
63
  }
64
+ export {};
25
65
  //# sourceMappingURL=engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../../../core/src/player/engine.ts"],"names":[],"mappings":"AAAA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,MAAM,EACd,MAAM,GAAE,4BAAoC,GAC3C,OAAO,CAAC,OAAO,CAAC;IAcnB,kBAAkB,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,IAAI;IAOlE,kBAAkB,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,IAAI;IAOlE,kBAAkB,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,IAAI;IAOlE,mBAAmB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,IAAI;YAOtD,gBAAgB;YAiBhB,oBAAoB;IA+BlC,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,6BAA6B;YA0CvB,kBAAkB;IAchC,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,eAAe;CAYxB"}
@@ -1,14 +1,26 @@
1
1
  import { assertEbookDoc } from "../utils/validate";
2
+ const DEFAULT_PLAYER_FEATURES = {
3
+ useBuiltInNotesModule: true,
4
+ };
2
5
  export class PlayerEngine {
3
- constructor(provider) {
6
+ constructor(provider, options = {}) {
4
7
  this.doc = null;
5
8
  this.state = {
6
9
  currentPage: 0,
7
10
  zoom: 1,
11
+ highlights: [],
8
12
  notes: [],
9
13
  progress: null,
10
14
  };
15
+ this.annotationCreateListeners = new Set();
16
+ this.annotationUpdateListeners = new Set();
17
+ this.annotationDeleteListeners = new Set();
18
+ this.annotationsChangeListeners = new Set();
11
19
  this.provider = provider;
20
+ this.features = {
21
+ useBuiltInNotesModule: options.features?.useBuiltInNotesModule ??
22
+ DEFAULT_PLAYER_FEATURES.useBuiltInNotesModule,
23
+ };
12
24
  }
13
25
  async load() {
14
26
  try {
@@ -30,7 +42,48 @@ export class PlayerEngine {
30
42
  return JSON.parse(JSON.stringify(this.doc));
31
43
  }
32
44
  getState() {
33
- return JSON.parse(JSON.stringify(this.state));
45
+ return clone(this.state);
46
+ }
47
+ getHighlights() {
48
+ return clone(this.state.highlights);
49
+ }
50
+ getNotes() {
51
+ return clone(this.state.notes);
52
+ }
53
+ getAnnotations() {
54
+ return {
55
+ highlights: this.getHighlights(),
56
+ notes: this.getNotes(),
57
+ };
58
+ }
59
+ getFeatures() {
60
+ return { ...this.features };
61
+ }
62
+ isBuiltInNotesModuleEnabled() {
63
+ return this.features.useBuiltInNotesModule;
64
+ }
65
+ async reloadAnnotations() {
66
+ if (!this.doc) {
67
+ throw new Error("Document is not loaded. Call load() first.");
68
+ }
69
+ await this.loadAnnotationsState();
70
+ return this.getAnnotations();
71
+ }
72
+ goToHighlight(highlightId) {
73
+ const target = this.state.highlights.find((item) => item.id === highlightId);
74
+ if (!target) {
75
+ return null;
76
+ }
77
+ const pageIndex = this.findPageIndexByPageId(target.pageId);
78
+ return pageIndex >= 0 ? this.goToPage(pageIndex) : null;
79
+ }
80
+ goToNote(noteId) {
81
+ const target = this.state.notes.find((item) => item.id === noteId);
82
+ if (!target) {
83
+ return null;
84
+ }
85
+ const pageIndex = this.findPageIndexByPageId(target.pageId);
86
+ return pageIndex >= 0 ? this.goToPage(pageIndex) : null;
34
87
  }
35
88
  goToPage(index) {
36
89
  const doc = this.getDocument();
@@ -62,7 +115,62 @@ export class PlayerEngine {
62
115
  this.state.progress = progress;
63
116
  await this.provider.saveProgress(progress);
64
117
  }
118
+ async createHighlight(highlight, source = "api") {
119
+ const doc = this.getDocument();
120
+ const now = new Date().toISOString();
121
+ const nextHighlight = {
122
+ ...highlight,
123
+ range: this.normalizeRange(highlight.range),
124
+ id: `highlight-${Date.now()}`,
125
+ bookId: doc.id,
126
+ createdAt: now,
127
+ updatedAt: now,
128
+ };
129
+ this.state.highlights.push(nextHighlight);
130
+ await this.persistAnnotations();
131
+ this.emitAnnotationCreate("highlight", nextHighlight, source);
132
+ return clone(nextHighlight);
133
+ }
134
+ async updateHighlight(highlightId, patch, source = "api") {
135
+ const index = this.state.highlights.findIndex((item) => item.id === highlightId);
136
+ if (index < 0) {
137
+ return null;
138
+ }
139
+ const current = this.state.highlights[index];
140
+ if (!current) {
141
+ return null;
142
+ }
143
+ const nextHighlight = {
144
+ ...current,
145
+ ...patch,
146
+ id: current.id,
147
+ bookId: current.bookId,
148
+ createdAt: current.createdAt,
149
+ updatedAt: new Date().toISOString(),
150
+ range: patch.range ? this.normalizeRange(patch.range) : current.range,
151
+ };
152
+ this.state.highlights[index] = nextHighlight;
153
+ await this.persistAnnotations();
154
+ this.emitAnnotationUpdate("highlight", current, nextHighlight, source);
155
+ return clone(nextHighlight);
156
+ }
157
+ async deleteHighlight(highlightId, source = "api") {
158
+ const index = this.state.highlights.findIndex((item) => item.id === highlightId);
159
+ if (index < 0) {
160
+ return false;
161
+ }
162
+ const [removedHighlight] = this.state.highlights.splice(index, 1);
163
+ if (!removedHighlight) {
164
+ return false;
165
+ }
166
+ await this.persistAnnotations();
167
+ this.emitAnnotationDelete("highlight", removedHighlight, source);
168
+ return true;
169
+ }
65
170
  async addNote(note) {
171
+ return this.createNote(note, "api");
172
+ }
173
+ async createNote(note, source = "api") {
66
174
  const doc = this.getDocument();
67
175
  const now = new Date().toISOString();
68
176
  const nextNote = {
@@ -73,10 +181,69 @@ export class PlayerEngine {
73
181
  updatedAt: now,
74
182
  };
75
183
  this.state.notes.push(nextNote);
76
- if (this.provider.saveNotes) {
77
- await this.provider.saveNotes(doc.id, this.state.notes);
184
+ await this.persistAnnotations();
185
+ this.emitAnnotationCreate("note", nextNote, source);
186
+ return clone(nextNote);
187
+ }
188
+ async updateNote(noteId, patch, source = "api") {
189
+ const index = this.state.notes.findIndex((item) => item.id === noteId);
190
+ if (index < 0) {
191
+ return null;
192
+ }
193
+ const current = this.state.notes[index];
194
+ if (!current) {
195
+ return null;
196
+ }
197
+ const nextNote = {
198
+ ...current,
199
+ ...patch,
200
+ id: current.id,
201
+ bookId: current.bookId,
202
+ createdAt: current.createdAt,
203
+ updatedAt: new Date().toISOString(),
204
+ ...(patch.range ? { range: this.normalizeRange(patch.range) } : {}),
205
+ };
206
+ this.state.notes[index] = nextNote;
207
+ await this.persistAnnotations();
208
+ this.emitAnnotationUpdate("note", current, nextNote, source);
209
+ return clone(nextNote);
210
+ }
211
+ async deleteNote(noteId, source = "api") {
212
+ const index = this.state.notes.findIndex((item) => item.id === noteId);
213
+ if (index < 0) {
214
+ return false;
78
215
  }
79
- return nextNote;
216
+ const [removedNote] = this.state.notes.splice(index, 1);
217
+ if (!removedNote) {
218
+ return false;
219
+ }
220
+ await this.persistAnnotations();
221
+ this.emitAnnotationDelete("note", removedNote, source);
222
+ return true;
223
+ }
224
+ onAnnotationCreate(listener) {
225
+ this.annotationCreateListeners.add(listener);
226
+ return () => {
227
+ this.annotationCreateListeners.delete(listener);
228
+ };
229
+ }
230
+ onAnnotationUpdate(listener) {
231
+ this.annotationUpdateListeners.add(listener);
232
+ return () => {
233
+ this.annotationUpdateListeners.delete(listener);
234
+ };
235
+ }
236
+ onAnnotationDelete(listener) {
237
+ this.annotationDeleteListeners.add(listener);
238
+ return () => {
239
+ this.annotationDeleteListeners.delete(listener);
240
+ };
241
+ }
242
+ onAnnotationsChange(listener) {
243
+ this.annotationsChangeListeners.add(listener);
244
+ return () => {
245
+ this.annotationsChangeListeners.delete(listener);
246
+ };
80
247
  }
81
248
  async restoreUserState() {
82
249
  if (!this.doc) {
@@ -90,10 +257,170 @@ export class PlayerEngine {
90
257
  this.state.zoom = progress.zoom;
91
258
  }
92
259
  }
93
- if (this.provider.loadNotes) {
94
- const notes = await this.provider.loadNotes(this.doc.id);
95
- this.state.notes = notes;
260
+ await this.loadAnnotationsState();
261
+ }
262
+ async loadAnnotationsState() {
263
+ if (!this.doc) {
264
+ return;
96
265
  }
266
+ let restoredFromAnnotationsProvider = false;
267
+ if (this.provider.loadAnnotations) {
268
+ const annotations = await this.provider.loadAnnotations(this.doc.id);
269
+ if (annotations) {
270
+ const normalized = this.normalizeAnnotations(annotations);
271
+ this.state.highlights = normalized.highlights;
272
+ this.state.notes = normalized.notes;
273
+ restoredFromAnnotationsProvider = true;
274
+ }
275
+ }
276
+ if (!restoredFromAnnotationsProvider) {
277
+ const fromDocument = this.mapPreviewAnnotationsToReader(this.doc.meta.previewAnnotations, this.doc.id);
278
+ this.state.highlights = fromDocument.highlights;
279
+ this.state.notes = fromDocument.notes;
280
+ if (this.provider.loadNotes) {
281
+ const notes = await this.provider.loadNotes(this.doc.id);
282
+ this.state.notes = Array.isArray(notes) ? clone(notes) : [];
283
+ }
284
+ }
285
+ }
286
+ findPageIndexByPageId(pageId) {
287
+ if (!this.doc) {
288
+ return -1;
289
+ }
290
+ return this.doc.pages.findIndex((page) => page.id === pageId);
291
+ }
292
+ normalizeRange(range) {
293
+ const safeStart = Math.max(0, Math.floor(range.start || 0));
294
+ const safeEnd = Math.max(0, Math.floor(range.end || 0));
295
+ return safeStart <= safeEnd
296
+ ? { start: safeStart, end: safeEnd }
297
+ : { start: safeEnd, end: safeStart };
298
+ }
299
+ normalizeAnnotations(annotations) {
300
+ const highlights = Array.isArray(annotations?.highlights)
301
+ ? clone(annotations.highlights)
302
+ : [];
303
+ const notes = Array.isArray(annotations?.notes)
304
+ ? clone(annotations.notes)
305
+ : [];
306
+ return { highlights, notes };
307
+ }
308
+ mapPreviewAnnotationsToReader(annotations, bookId) {
309
+ const now = new Date().toISOString();
310
+ const safe = annotations || { highlights: [], notes: [] };
311
+ const highlights = safe.highlights.map((item, index) => {
312
+ const range = this.normalizeRange({ start: item.start, end: item.end });
313
+ return {
314
+ id: item.id || `highlight-preview-${index}`,
315
+ bookId,
316
+ pageId: item.pageId,
317
+ blockId: item.blockId || "preview-flow-text",
318
+ range,
319
+ ...(item.selectedText !== undefined
320
+ ? { selectedText: item.selectedText }
321
+ : {}),
322
+ ...(item.color !== undefined ? { color: item.color } : {}),
323
+ createdAt: item.createdAt || now,
324
+ updatedAt: item.updatedAt || item.createdAt || now,
325
+ };
326
+ });
327
+ const notes = safe.notes.map((item, index) => {
328
+ const range = this.normalizeRange({ start: item.start, end: item.end });
329
+ return {
330
+ id: item.id || `note-preview-${index}`,
331
+ bookId,
332
+ pageId: item.pageId,
333
+ blockId: "preview-flow-text",
334
+ range,
335
+ content: item.text,
336
+ ...(item.color !== undefined ? { color: item.color } : {}),
337
+ createdAt: item.createdAt || now,
338
+ updatedAt: item.updatedAt || item.createdAt || now,
339
+ };
340
+ });
341
+ return {
342
+ highlights,
343
+ notes,
344
+ };
345
+ }
346
+ async persistAnnotations() {
347
+ if (!this.doc) {
348
+ return;
349
+ }
350
+ const all = this.getAnnotations();
351
+ if (this.provider.saveAnnotations) {
352
+ await this.provider.saveAnnotations(this.doc.id, all);
353
+ return;
354
+ }
355
+ if (this.provider.saveNotes) {
356
+ await this.provider.saveNotes(this.doc.id, all.notes);
357
+ }
358
+ }
359
+ emitAnnotationCreate(kind, annotation, source) {
360
+ const all = this.getAnnotations();
361
+ const event = {
362
+ kind,
363
+ source,
364
+ annotation: clone(annotation),
365
+ all,
366
+ };
367
+ this.notifyListeners(this.annotationCreateListeners, event);
368
+ this.emitAnnotationsChange({
369
+ action: "create",
370
+ kind,
371
+ source,
372
+ all,
373
+ current: event.annotation,
374
+ });
375
+ }
376
+ emitAnnotationUpdate(kind, previous, current, source) {
377
+ const all = this.getAnnotations();
378
+ const event = {
379
+ kind,
380
+ source,
381
+ previous: clone(previous),
382
+ current: clone(current),
383
+ all,
384
+ };
385
+ this.notifyListeners(this.annotationUpdateListeners, event);
386
+ this.emitAnnotationsChange({
387
+ action: "update",
388
+ kind,
389
+ source,
390
+ all,
391
+ current: event.current,
392
+ previous: event.previous,
393
+ });
394
+ }
395
+ emitAnnotationDelete(kind, annotation, source) {
396
+ const all = this.getAnnotations();
397
+ const event = {
398
+ kind,
399
+ source,
400
+ annotation: clone(annotation),
401
+ all,
402
+ };
403
+ this.notifyListeners(this.annotationDeleteListeners, event);
404
+ this.emitAnnotationsChange({
405
+ action: "delete",
406
+ kind,
407
+ source,
408
+ all,
409
+ previous: event.annotation,
410
+ });
411
+ }
412
+ emitAnnotationsChange(event) {
413
+ this.notifyListeners(this.annotationsChangeListeners, event);
414
+ }
415
+ notifyListeners(listeners, event) {
416
+ listeners.forEach((listener) => {
417
+ try {
418
+ listener(event);
419
+ }
420
+ catch (error) {
421
+ this.provider.onError?.(toError(error));
422
+ }
423
+ });
97
424
  }
98
425
  }
99
426
  function toError(error) {
@@ -102,3 +429,6 @@ function toError(error) {
102
429
  }
103
430
  return new Error(String(error));
104
431
  }
432
+ function clone(value) {
433
+ return JSON.parse(JSON.stringify(value));
434
+ }
@@ -1,4 +1,8 @@
1
1
  import type { EbookDoc } from "./ebook";
2
+ export interface ReaderRange {
3
+ start: number;
4
+ end: number;
5
+ }
2
6
  export interface ReaderProgress {
3
7
  bookId: string;
4
8
  lastPage: number;
@@ -10,19 +14,70 @@ export interface ReaderNote {
10
14
  bookId: string;
11
15
  pageId: string;
12
16
  blockId: string;
13
- range?: {
14
- start: number;
15
- end: number;
16
- };
17
+ range?: ReaderRange;
17
18
  content: string;
18
19
  color?: string;
19
20
  createdAt: string;
20
21
  updatedAt: string;
21
22
  }
23
+ export interface ReaderHighlight {
24
+ id: string;
25
+ bookId: string;
26
+ pageId: string;
27
+ blockId: string;
28
+ range: ReaderRange;
29
+ selectedText?: string;
30
+ color?: string;
31
+ createdAt: string;
32
+ updatedAt: string;
33
+ }
34
+ export interface ReaderAnnotations {
35
+ highlights: ReaderHighlight[];
36
+ notes: ReaderNote[];
37
+ }
38
+ export type ReaderAnnotationKind = "highlight" | "note";
39
+ export type ReaderAnnotationAction = "create" | "update" | "delete";
40
+ export type ReaderAnnotationChangeSource = "api" | "user";
41
+ export type ReaderAnnotation = ReaderHighlight | ReaderNote;
42
+ export interface ReaderAnnotationCreateEvent {
43
+ kind: ReaderAnnotationKind;
44
+ source: ReaderAnnotationChangeSource;
45
+ annotation: ReaderAnnotation;
46
+ all: ReaderAnnotations;
47
+ }
48
+ export interface ReaderAnnotationUpdateEvent {
49
+ kind: ReaderAnnotationKind;
50
+ source: ReaderAnnotationChangeSource;
51
+ previous: ReaderAnnotation;
52
+ current: ReaderAnnotation;
53
+ all: ReaderAnnotations;
54
+ }
55
+ export interface ReaderAnnotationDeleteEvent {
56
+ kind: ReaderAnnotationKind;
57
+ source: ReaderAnnotationChangeSource;
58
+ annotation: ReaderAnnotation;
59
+ all: ReaderAnnotations;
60
+ }
61
+ export interface ReaderAnnotationsChangeEvent {
62
+ action: ReaderAnnotationAction;
63
+ kind: ReaderAnnotationKind;
64
+ source: ReaderAnnotationChangeSource;
65
+ all: ReaderAnnotations;
66
+ current?: ReaderAnnotation;
67
+ previous?: ReaderAnnotation;
68
+ }
69
+ export interface PlayerFeatures {
70
+ useBuiltInNotesModule?: boolean;
71
+ }
72
+ export interface PlayerEngineOptions {
73
+ features?: PlayerFeatures;
74
+ }
22
75
  export interface PlayerDataProvider {
23
76
  getData: () => Promise<EbookDoc>;
24
77
  loadProgress?: (bookId: string) => Promise<ReaderProgress | null>;
25
78
  saveProgress?: (progress: ReaderProgress) => Promise<void>;
79
+ loadAnnotations?: (bookId: string) => Promise<ReaderAnnotations | null>;
80
+ saveAnnotations?: (bookId: string, annotations: ReaderAnnotations) => Promise<void>;
26
81
  loadNotes?: (bookId: string) => Promise<ReaderNote[]>;
27
82
  saveNotes?: (bookId: string, notes: ReaderNote[]) => Promise<void>;
28
83
  onError?: (error: Error) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/player.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACz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S,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC"}
@@ -14,7 +14,8 @@ export interface EditorWorkbenchOptions {
14
14
  pageWidth?: number;
15
15
  upload?: EditorWorkbenchUploadOptions;
16
16
  importDocx?: EditorWorkbenchDocxImportOptions;
17
- onDocumentChange?: (doc: EbookDoc) => void;
17
+ onDocumentChange?: (doc: EbookDoc) => void | Promise<void>;
18
+ onFullscreenSave?: (doc: EbookDoc) => void | Promise<void>;
18
19
  }
19
20
  export interface EditorWorkbenchPreviewAnnotationActions {
20
21
  canDelete?: boolean;
@@ -52,9 +53,12 @@ export interface EditorWorkbenchUploadOptions {
52
53
  export interface EditorWorkbenchHandle {
53
54
  destroy: () => void;
54
55
  getDocument: () => EbookDoc;
56
+ isFullscreen: () => boolean;
55
57
  getMode: () => Mode;
56
58
  getPageIndex: () => number;
57
59
  importDocx: (file: File) => Promise<void>;
60
+ openFullscreen: () => void;
61
+ closeFullscreenAndSave: () => Promise<void>;
58
62
  setMode: (mode: Mode) => void;
59
63
  loadPreviewAnnotations: () => PreviewAnnotations;
60
64
  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,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B,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,CA2oKvB"}
@@ -175,8 +175,10 @@ const WORKBENCH_CSS = `
175
175
  .hyewb-preview-selection-btn svg{width:16px;height:16px}
176
176
  .hyewb-preview-annotation-flash{animation:hyewb-preview-annotation-pulse .9s ease}
177
177
  @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}
178
+ .hyewb-overlay{position:fixed;inset:0;z-index:2147483000;background:rgba(15,23,42,.35);padding:0;box-sizing:border-box;overflow:auto}
179
+ .hyewb-overlay-layer{min-height:100%;display:flex;align-items:stretch;justify-content:stretch}
180
+ .hyewb-root.hyewb-overlay-active{width:100%;max-width:none;min-height:100%;margin:0;border-radius:0;box-shadow:none}
181
+ .hyewb-root.hyewb-overlay-active .hyewb-editor,.hyewb-root.hyewb-overlay-active .hyewb-preview{min-height:1000px}
180
182
  `;
181
183
  export const DEFAULT_EDITOR_WORKBENCH_FEATURES = {
182
184
  textToolbar: true,
@@ -453,7 +455,8 @@ export function mountEditorWorkbench(container, options = {}) {
453
455
  title.className = "hyewb-title";
454
456
  title.textContent = options.title ?? "hy-ebook Editor Workbench";
455
457
  const fullscreenBtn = createButton("fullscreen");
456
- header.append(title);
458
+ fullscreenBtn.style.marginLeft = "auto";
459
+ header.append(title, fullscreenBtn);
457
460
  const toolbar = document.createElement("div");
458
461
  toolbar.className = "hyewb-row hyewb-top-control";
459
462
  const boldBtn = createButton("bold");
@@ -722,8 +725,7 @@ export function mountEditorWorkbench(container, options = {}) {
722
725
  const addPageBtn = createButton("addPage");
723
726
  const pageInfo = document.createElement("span");
724
727
  pageInfo.className = "hyewb-status";
725
- fullscreenBtn.style.marginLeft = "auto";
726
- pageRow.append(prevPageBtn, nextPageBtn, addPageBtn, pageInfo, fullscreenBtn);
728
+ pageRow.append(prevPageBtn, nextPageBtn, addPageBtn, pageInfo);
727
729
  const previewLayout = document.createElement("div");
728
730
  previewLayout.className = "hyewb-preview-layout";
729
731
  const shell = document.createElement("div");
@@ -935,27 +937,25 @@ export function mountEditorWorkbench(container, options = {}) {
935
937
  speedMbps: undefined,
936
938
  error: undefined,
937
939
  };
938
- let shouldRestoreFullscreenAfterFilePicker = false;
940
+ let fullscreenOverlay = null;
941
+ let fullscreenAnchor = null;
942
+ let bodyOverflowBeforeOverlay = null;
943
+ let isOverlayFullscreen = false;
939
944
  const setButtonIcon = (button, iconName) => {
940
945
  button.innerHTML = "";
941
946
  button.append(createIconPlaceholder(iconName));
942
947
  };
943
- const getFullscreenElement = () => {
944
- const webkitDocument = document;
945
- return (document.fullscreenElement ||
946
- webkitDocument.webkitFullscreenElement ||
947
- null);
948
- };
949
948
  const isWorkbenchFullscreen = () => {
950
- return getFullscreenElement() === root;
949
+ return isOverlayFullscreen;
951
950
  };
952
951
  const updateFullscreenButtonState = () => {
953
952
  const isFullscreen = isWorkbenchFullscreen();
954
953
  setButtonActive(fullscreenBtn, isFullscreen);
955
954
  setButtonIcon(fullscreenBtn, isFullscreen ? "fullscreen-exit" : "fullscreen-enter");
956
- const label = isFullscreen ? "退出全屏" : "全屏";
955
+ const label = isFullscreen ? "保存并退出" : "全屏";
957
956
  fullscreenBtn.title = label;
958
957
  fullscreenBtn.setAttribute("aria-label", label);
958
+ fullscreenBtn.style.display = isFullscreen ? "inline-flex" : "none";
959
959
  };
960
960
  const updateShellViewportHeight = () => {
961
961
  const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
@@ -986,67 +986,82 @@ export function mountEditorWorkbench(container, options = {}) {
986
986
  const rounded = Math.round(top);
987
987
  return Math.min(rounded, maxTop);
988
988
  };
989
- const requestWorkbenchFullscreen = async () => {
990
- const target = root;
991
- if (typeof target.requestFullscreen === "function") {
992
- await target.requestFullscreen();
989
+ const syncWorkbenchLayoutAfterFullscreenChange = () => {
990
+ updateFullscreenButtonState();
991
+ updateShellViewportHeight();
992
+ updateTopControlShieldHeight();
993
+ updateInlineResizeOverlay();
994
+ syncTableToolsPosition();
995
+ syncFocusedTableControls();
996
+ syncPreviewSelectionToolbar();
997
+ };
998
+ const openWorkbenchFullscreen = () => {
999
+ if (isWorkbenchFullscreen()) {
993
1000
  return;
994
1001
  }
995
- if (typeof target.webkitRequestFullscreen === "function") {
996
- target.webkitRequestFullscreen();
1002
+ const parentNode = root.parentNode;
1003
+ if (!parentNode) {
997
1004
  return;
998
1005
  }
999
- throw new Error("当前环境不支持全屏");
1006
+ fullscreenAnchor = document.createComment("hyewb-fullscreen-anchor");
1007
+ parentNode.insertBefore(fullscreenAnchor, root);
1008
+ fullscreenOverlay = document.createElement("div");
1009
+ fullscreenOverlay.className = "hyewb-overlay";
1010
+ const fullscreenOverlayLayer = document.createElement("div");
1011
+ fullscreenOverlayLayer.className = "hyewb-overlay-layer";
1012
+ fullscreenOverlay.append(fullscreenOverlayLayer);
1013
+ fullscreenOverlayLayer.append(root);
1014
+ document.body.append(fullscreenOverlay);
1015
+ bodyOverflowBeforeOverlay = document.body.style.overflow;
1016
+ document.body.style.overflow = "hidden";
1017
+ root.classList.add("hyewb-overlay-active");
1018
+ isOverlayFullscreen = true;
1019
+ status.textContent = "已进入页面全屏编辑";
1020
+ syncWorkbenchLayoutAfterFullscreenChange();
1000
1021
  };
1001
- const exitWorkbenchFullscreen = async () => {
1002
- const webkitDocument = document;
1003
- if (typeof document.exitFullscreen === "function") {
1004
- await document.exitFullscreen();
1022
+ const closeWorkbenchFullscreen = () => {
1023
+ if (!isWorkbenchFullscreen()) {
1005
1024
  return;
1006
1025
  }
1007
- if (typeof webkitDocument.webkitExitFullscreen === "function") {
1008
- webkitDocument.webkitExitFullscreen();
1009
- return;
1026
+ if (fullscreenAnchor && fullscreenAnchor.parentNode) {
1027
+ fullscreenAnchor.parentNode.insertBefore(root, fullscreenAnchor);
1028
+ fullscreenAnchor.parentNode.removeChild(fullscreenAnchor);
1010
1029
  }
1011
- if (typeof webkitDocument.webkitCancelFullScreen === "function") {
1012
- webkitDocument.webkitCancelFullScreen();
1030
+ else {
1031
+ container.append(root);
1013
1032
  }
1014
- };
1015
- const toggleWorkbenchFullscreen = async () => {
1016
- try {
1017
- if (isWorkbenchFullscreen()) {
1018
- await exitWorkbenchFullscreen();
1019
- }
1020
- else {
1021
- await requestWorkbenchFullscreen();
1022
- }
1033
+ fullscreenAnchor = null;
1034
+ if (fullscreenOverlay && fullscreenOverlay.parentNode) {
1035
+ fullscreenOverlay.parentNode.removeChild(fullscreenOverlay);
1023
1036
  }
1024
- catch {
1025
- status.textContent = "当前浏览器不支持全屏";
1026
- }
1027
- finally {
1028
- updateFullscreenButtonState();
1029
- updateShellViewportHeight();
1037
+ fullscreenOverlay = null;
1038
+ root.classList.remove("hyewb-overlay-active");
1039
+ isOverlayFullscreen = false;
1040
+ if (bodyOverflowBeforeOverlay !== null) {
1041
+ document.body.style.overflow = bodyOverflowBeforeOverlay;
1042
+ bodyOverflowBeforeOverlay = null;
1030
1043
  }
1044
+ syncWorkbenchLayoutAfterFullscreenChange();
1031
1045
  };
1032
- const restoreWorkbenchFullscreenIfNeeded = async () => {
1033
- if (!shouldRestoreFullscreenAfterFilePicker) {
1034
- return;
1035
- }
1036
- shouldRestoreFullscreenAfterFilePicker = false;
1037
- if (isWorkbenchFullscreen()) {
1046
+ const closeWorkbenchFullscreenAndSave = async () => {
1047
+ if (!isWorkbenchFullscreen()) {
1038
1048
  return;
1039
1049
  }
1040
1050
  try {
1041
- await requestWorkbenchFullscreen();
1042
- }
1043
- catch {
1044
- // Ignore restore failure when browser blocks fullscreen without activation.
1051
+ syncEditorToDoc({ emitChange: false });
1052
+ const snapshot = clone(state.doc);
1053
+ if (options.onFullscreenSave) {
1054
+ await options.onFullscreenSave(snapshot);
1055
+ }
1056
+ else {
1057
+ await Promise.resolve(options.onDocumentChange?.(snapshot));
1058
+ }
1059
+ closeWorkbenchFullscreen();
1060
+ status.textContent = "已保存并退出页面全屏";
1045
1061
  }
1046
- finally {
1047
- updateFullscreenButtonState();
1048
- updateShellViewportHeight();
1049
- updateTopControlShieldHeight();
1062
+ catch (error) {
1063
+ const errorMessage = error instanceof Error && error.message ? error.message : "请稍后重试";
1064
+ status.textContent = `保存失败:${errorMessage}`;
1050
1065
  }
1051
1066
  };
1052
1067
  const formatUploadProgress = (percent) => {
@@ -2963,7 +2978,7 @@ export function mountEditorWorkbench(container, options = {}) {
2963
2978
  });
2964
2979
  colorGrid.append(swatch);
2965
2980
  });
2966
- const syncEditorToDoc = () => {
2981
+ const syncEditorToDoc = (options) => {
2967
2982
  if (state.mode !== "editor") {
2968
2983
  return;
2969
2984
  }
@@ -2975,7 +2990,9 @@ export function mountEditorWorkbench(container, options = {}) {
2975
2990
  page.blocks = replaceFlowBlocks(page.blocks, flowBlocks);
2976
2991
  state.doc.meta.updatedAt = new Date().toISOString();
2977
2992
  editor.setDocument(state.doc);
2978
- emitDocumentChange();
2993
+ if (options?.emitChange !== false) {
2994
+ emitDocumentChange();
2995
+ }
2979
2996
  };
2980
2997
  const updateAlign = (align) => {
2981
2998
  if (selectedInlineImage &&
@@ -3499,12 +3516,12 @@ export function mountEditorWorkbench(container, options = {}) {
3499
3516
  previewArea.classList.toggle("show", state.mode === "preview");
3500
3517
  editorArea.style.display = state.mode === "editor" ? "block" : "none";
3501
3518
  const showEditorControls = state.mode === "editor";
3502
- header.style.display = showEditorControls ? "flex" : "none";
3519
+ header.style.display =
3520
+ showEditorControls || isWorkbenchFullscreen() ? "flex" : "none";
3503
3521
  toolbar.style.display =
3504
3522
  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";
3523
+ pageRow.style.display = "none";
3524
+ addPageBtn.style.display = "none";
3508
3525
  videoAddBtn.style.display = state.features.video ? "inline-block" : "none";
3509
3526
  imageUploadBtn.style.display = "inline-block";
3510
3527
  status.style.display = showEditorControls ? "block" : "none";
@@ -4525,19 +4542,6 @@ export function mountEditorWorkbench(container, options = {}) {
4525
4542
  };
4526
4543
  window.addEventListener("resize", handleWindowResize);
4527
4544
  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
4545
  document.addEventListener("selectionchange", handleSelectionChange);
4542
4546
  const handleDocumentPointerDownForPalette = (event) => {
4543
4547
  const clickTarget = event.target;
@@ -4613,7 +4617,7 @@ export function mountEditorWorkbench(container, options = {}) {
4613
4617
  document.addEventListener("pointerdown", handleDocumentPointerDownForPalette);
4614
4618
  document.addEventListener("keydown", handleDocumentKeyDown);
4615
4619
  fullscreenBtn.addEventListener("click", () => {
4616
- void toggleWorkbenchFullscreen();
4620
+ void closeWorkbenchFullscreenAndSave();
4617
4621
  });
4618
4622
  tableAddBtn.addEventListener("mousedown", preserveSelectionForInputControl);
4619
4623
  videoAddBtn.addEventListener("mousedown", preserveSelectionForInputControl);
@@ -4644,12 +4648,10 @@ export function mountEditorWorkbench(container, options = {}) {
4644
4648
  status.textContent = "请先切换到编辑模式后再导入 Word";
4645
4649
  return;
4646
4650
  }
4647
- shouldRestoreFullscreenAfterFilePicker = isWorkbenchFullscreen();
4648
4651
  docxInput.value = "";
4649
4652
  docxInput.click();
4650
4653
  });
4651
4654
  docxInput.addEventListener("change", () => {
4652
- void restoreWorkbenchFullscreenIfNeeded();
4653
4655
  const picked = docxInput.files?.[0] || null;
4654
4656
  docxInput.value = "";
4655
4657
  if (!picked) {
@@ -4657,11 +4659,7 @@ export function mountEditorWorkbench(container, options = {}) {
4657
4659
  }
4658
4660
  void importDocxFile(picked);
4659
4661
  });
4660
- uploadInput.addEventListener("click", () => {
4661
- shouldRestoreFullscreenAfterFilePicker = isWorkbenchFullscreen();
4662
- });
4663
4662
  uploadInput.addEventListener("change", () => {
4664
- void restoreWorkbenchFullscreenIfNeeded();
4665
4663
  const picked = uploadInput.files?.[0] || null;
4666
4664
  uploadState.progress = 0;
4667
4665
  uploadState.speedMbps = undefined;
@@ -4696,10 +4694,6 @@ export function mountEditorWorkbench(container, options = {}) {
4696
4694
  uploadDialog.addEventListener("click", (event) => {
4697
4695
  event.stopPropagation();
4698
4696
  });
4699
- const handleWindowFocusForFullscreenRestore = () => {
4700
- void restoreWorkbenchFullscreenIfNeeded();
4701
- };
4702
- window.addEventListener("focus", handleWindowFocusForFullscreenRestore);
4703
4697
  prevPageBtn.addEventListener("click", () => jumpPage(-1));
4704
4698
  nextPageBtn.addEventListener("click", () => jumpPage(1));
4705
4699
  addPageBtn.addEventListener("click", addPage);
@@ -4710,6 +4704,7 @@ export function mountEditorWorkbench(container, options = {}) {
4710
4704
  emitDocumentChange();
4711
4705
  return {
4712
4706
  destroy: () => {
4707
+ closeWorkbenchFullscreen();
4713
4708
  hideTablePicker();
4714
4709
  hideTableTools();
4715
4710
  document.removeEventListener("selectionchange", handleSelectionChange);
@@ -4717,17 +4712,17 @@ export function mountEditorWorkbench(container, options = {}) {
4717
4712
  document.removeEventListener("pointerup", onMediaPointerUp);
4718
4713
  window.removeEventListener("resize", handleWindowResize);
4719
4714
  window.removeEventListener("scroll", handleWindowScroll, true);
4720
- window.removeEventListener("focus", handleWindowFocusForFullscreenRestore);
4721
4715
  document.removeEventListener("pointerdown", handleDocumentPointerDownForPalette);
4722
4716
  document.removeEventListener("keydown", handleDocumentKeyDown);
4723
- document.removeEventListener("fullscreenchange", handleFullscreenChange);
4724
- document.removeEventListener("webkitfullscreenchange", handleFullscreenChange);
4725
4717
  container.innerHTML = "";
4726
4718
  },
4727
4719
  getDocument: () => clone(state.doc),
4720
+ isFullscreen: isWorkbenchFullscreen,
4728
4721
  getMode: () => state.mode,
4729
4722
  getPageIndex: () => state.pageIndex,
4730
4723
  importDocx: importDocxFile,
4724
+ openFullscreen: openWorkbenchFullscreen,
4725
+ closeFullscreenAndSave: closeWorkbenchFullscreenAndSave,
4731
4726
  setMode,
4732
4727
  loadPreviewAnnotations,
4733
4728
  savePreviewAnnotations,
@@ -1,10 +1,11 @@
1
- import { EditorEngine, PlayerEngine, type EditorWorkbenchHandle, type EditorWorkbenchOptions, type EbookDoc, type PlayerDataProvider } from "@hyebook/core";
1
+ import { EditorEngine, PlayerEngine, 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;
8
9
  }
9
10
  export interface Vue3EditorWorkbenchOptions extends EditorWorkbenchOptions {
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.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,SAAQ,qBAAqB;CAAG;AAE3E,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,wBAAwB,GAChC,YAAY,CAId;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,wBAAwB,GAChC,YAAY,CAEd;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,0BAA+B,GACvC,yBAAyB,CAE3B"}
@@ -5,7 +5,7 @@ export function createVue3EditorAdapter(options) {
5
5
  return engine;
6
6
  }
7
7
  export function createVue3PlayerAdapter(options) {
8
- return new PlayerEngine(options.provider);
8
+ return new PlayerEngine(options.provider, options.engineOptions);
9
9
  }
10
10
  export function mountVue3EditorWorkbench(container, options = {}) {
11
11
  return mountEditorWorkbench(container, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyebook/vue3-adapter",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Vue3 adapter for hy-ebook core",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,11 +17,11 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@hyebook/core": "^2.2.6"
20
+ "@hyebook/core": "^2.2.7"
21
21
  },
22
22
  "scripts": {
23
23
  "build": "tsc -p tsconfig.json",
24
24
  "typecheck": "tsc -p tsconfig.json --noEmit",
25
25
  "lint": "echo 'No lint configured for @hyebook/vue3-adapter'"
26
26
  }
27
- }
27
+ }