@rhc-office/sdk 6.6.351 → 6.6.367
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/annotation-tool.d.ts +25 -0
- package/dist/api/annotation-tool.d.ts.map +1 -1
- package/dist/api/digital-sign-environment.d.ts +6 -0
- package/dist/api/digital-sign-environment.d.ts.map +1 -1
- package/dist/api/document-tool.d.ts +3 -0
- package/dist/api/document-tool.d.ts.map +1 -1
- package/dist/browser/document-viewer.js +1 -1
- package/dist/browser/document-viewer.js.map +1 -1
- package/dist/browser.d.ts +4 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/index.js +279 -244
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/tools/AnnotationToolImpl.d.ts +3 -0
- package/dist/tools/AnnotationToolImpl.d.ts.map +1 -1
- package/dist/viewer/DocumentSDK.d.ts +3 -0
- package/dist/viewer/DocumentSDK.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/annotation-tool.ts +31 -0
- package/src/api/digital-sign-environment.ts +56 -20
- package/src/api/document-tool.ts +3 -0
- package/src/browser.ts +5 -0
- package/src/tools/AnnotationToolImpl.ts +15 -0
- package/src/viewer/DocumentSDK.ts +65 -3
|
@@ -13,6 +13,9 @@ export declare class AnnotationToolImpl implements AnnotationTool {
|
|
|
13
13
|
canRedoAnnotation: AnnotationTool['canRedoAnnotation'];
|
|
14
14
|
selectAnnotationTool: AnnotationTool['selectAnnotationTool'];
|
|
15
15
|
selectAnnotationStamp: AnnotationTool['selectAnnotationStamp'];
|
|
16
|
+
getCustomStamps: AnnotationTool['getCustomStamps'];
|
|
17
|
+
addCustomTextStamp: AnnotationTool['addCustomTextStamp'];
|
|
18
|
+
addCustomImageStamp: AnnotationTool['addCustomImageStamp'];
|
|
16
19
|
setAnnotationPenColor: AnnotationTool['setAnnotationPenColor'];
|
|
17
20
|
setAnnotationPenWidth: AnnotationTool['setAnnotationPenWidth'];
|
|
18
21
|
setAnnotationPenStyle: AnnotationTool['setAnnotationPenStyle'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnotationToolImpl.d.ts","sourceRoot":"","sources":["../../src/tools/AnnotationToolImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,wBAAwB,EAE9B,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"AnnotationToolImpl.d.ts","sourceRoot":"","sources":["../../src/tools/AnnotationToolImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,wBAAwB,EAE9B,MAAM,6BAA6B,CAAC;AA+ErC,qBAAa,kBAAmB,YAAW,cAAc;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;gBAE7B,OAAO,EAAE,wBAAwB;IAQ7C,kBAAkB,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAEtD;IAEF,mBAAmB,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAExD;IAEF,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAEhD;IAEF,gBAAgB,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAElD;IAEF,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAE9C;IAEF,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAE9C;IAEF,iBAAiB,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAEpD;IAEF,iBAAiB,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAEpD;IAEF,oBAAoB,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAE1D;IAEF,qBAAqB,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAE5D;IAEF,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAEhD;IAEF,kBAAkB,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAEtD;IAEF,mBAAmB,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAExD;IAEF,qBAAqB,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAE5D;IAEF,qBAAqB,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAE5D;IAEF,qBAAqB,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAE5D;IAEF,kBAAkB,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAEtD;IAEF,iBAAiB,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAEpD;IAEF,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAE9C;IAEF,mBAAmB,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAExD;IAEF,0BAA0B,EAAE,cAAc,CAAC,4BAA4B,CAAC,CAEtE;CACH"}
|
|
@@ -33,6 +33,7 @@ export declare class DocumentSDK implements IDocumentSDK {
|
|
|
33
33
|
private readerElement;
|
|
34
34
|
private readerId;
|
|
35
35
|
private normalizedConfiguration;
|
|
36
|
+
private runtimeRestoreState;
|
|
36
37
|
private sessionUser?;
|
|
37
38
|
private sessionData?;
|
|
38
39
|
private readonly nativeEventCleanupCallbacks;
|
|
@@ -68,6 +69,8 @@ export declare class DocumentSDK implements IDocumentSDK {
|
|
|
68
69
|
readonly createDigitalSignOptions: IDocumentSDK['createDigitalSignOptions'];
|
|
69
70
|
readonly createKVField: IDocumentSDK['createKVField'];
|
|
70
71
|
private readonly mountReader;
|
|
72
|
+
private applyReaderRuntimeConfig;
|
|
73
|
+
private restoreReaderRuntimeConfig;
|
|
71
74
|
private readonly bindNativeReaderEvents;
|
|
72
75
|
private readonly cleanupNativeEventForwarders;
|
|
73
76
|
private readonly cleanupThemeBinding;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentSDK.d.ts","sourceRoot":"","sources":["../../src/viewer/DocumentSDK.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK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C,aAAa,EAAE,YAAY,CAAC,eAAe,CAAC,CAEnD;IAEF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAoD1B;IAEF,OAAO,CAAC,wBAAwB;IAwBhC,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAsCrC;IAEF,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAE3C;IAEF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAGlC;IAEF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAE9B;IAEF,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAOhC;IAEF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAMjC;CACH;AAED,eAAO,MAAM,oBAAoB,GAAI,UAAU,yBAAyB,KAAG,YAE1E,CAAC"}
|
package/package.json
CHANGED
|
@@ -95,6 +95,31 @@ export type AnnotationStampOptions =
|
|
|
95
95
|
| AnnotationTextStampOptions
|
|
96
96
|
| AnnotationImageStampOptions;
|
|
97
97
|
|
|
98
|
+
export interface AnnotationCustomTextStampInput {
|
|
99
|
+
fontFamily?: string;
|
|
100
|
+
fontSize: number;
|
|
101
|
+
name?: string;
|
|
102
|
+
text: string;
|
|
103
|
+
textColor: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface AnnotationCustomImageStampInput {
|
|
107
|
+
height?: number;
|
|
108
|
+
imageData: string;
|
|
109
|
+
mimeType?: string;
|
|
110
|
+
name?: string;
|
|
111
|
+
naturalHeight: number;
|
|
112
|
+
naturalWidth: number;
|
|
113
|
+
width?: number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface AnnotationCustomStampRecord {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
stamp: AnnotationStampOptions;
|
|
120
|
+
type: 'image' | 'text';
|
|
121
|
+
}
|
|
122
|
+
|
|
98
123
|
export interface AnnotationTextBoxOptions {
|
|
99
124
|
text?: string;
|
|
100
125
|
fontFamily?: string;
|
|
@@ -267,6 +292,12 @@ export interface AnnotationTool {
|
|
|
267
292
|
|
|
268
293
|
selectAnnotationStamp(stamp: AnnotationStampOptions): void;
|
|
269
294
|
|
|
295
|
+
getCustomStamps(): Promise<AnnotationCustomStampRecord[]>;
|
|
296
|
+
|
|
297
|
+
addCustomTextStamp(input: AnnotationCustomTextStampInput): Promise<AnnotationCustomStampRecord>;
|
|
298
|
+
|
|
299
|
+
addCustomImageStamp(input: AnnotationCustomImageStampInput): Promise<AnnotationCustomStampRecord>;
|
|
300
|
+
|
|
270
301
|
setAnnotationPenColor(hexColor: string): void;
|
|
271
302
|
|
|
272
303
|
setAnnotationPenWidth(penWidth: number): void;
|
|
@@ -111,6 +111,12 @@ interface DigitalSignEnvironmentRuntimeStore {
|
|
|
111
111
|
overrides: DigitalSignEnvironmentPatch;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
export interface DigitalSignEnvironmentSourceSnapshot {
|
|
115
|
+
current: DigitalSignEnvironmentConfig;
|
|
116
|
+
defaults: DigitalSignEnvironmentConfig;
|
|
117
|
+
overrides: DigitalSignEnvironmentPatch;
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
const DIGITAL_SIGN_ENVIRONMENT_STORE_KEY = '__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__';
|
|
115
121
|
|
|
116
122
|
const EMPTY_DIGITAL_SIGN_ENVIRONMENT: DigitalSignEnvironmentConfig = {
|
|
@@ -302,24 +308,51 @@ const mergeEnvironmentPatchState = (
|
|
|
302
308
|
base: DigitalSignEnvironmentPatch,
|
|
303
309
|
patch: DigitalSignEnvironmentPatch,
|
|
304
310
|
): DigitalSignEnvironmentPatch => {
|
|
311
|
+
const mergedDefaultsBjca =
|
|
312
|
+
base.defaults?.bjca || patch.defaults?.bjca
|
|
313
|
+
? {
|
|
314
|
+
...base.defaults?.bjca,
|
|
315
|
+
...patch.defaults?.bjca,
|
|
316
|
+
}
|
|
317
|
+
: undefined;
|
|
318
|
+
const mergedDefaultsKol =
|
|
319
|
+
base.defaults?.kol || patch.defaults?.kol
|
|
320
|
+
? {
|
|
321
|
+
...base.defaults?.kol,
|
|
322
|
+
...patch.defaults?.kol,
|
|
323
|
+
}
|
|
324
|
+
: undefined;
|
|
325
|
+
const mergedDefaultsPlugin =
|
|
326
|
+
base.defaults?.plugin || patch.defaults?.plugin
|
|
327
|
+
? {
|
|
328
|
+
...base.defaults?.plugin,
|
|
329
|
+
...patch.defaults?.plugin,
|
|
330
|
+
}
|
|
331
|
+
: undefined;
|
|
332
|
+
const mergedSignServerKol =
|
|
333
|
+
base.signServer?.kol || patch.signServer?.kol
|
|
334
|
+
? {
|
|
335
|
+
...base.signServer?.kol,
|
|
336
|
+
...patch.signServer?.kol,
|
|
337
|
+
}
|
|
338
|
+
: undefined;
|
|
339
|
+
const mergedSignServerUsbKey =
|
|
340
|
+
base.signServer?.usbKey || patch.signServer?.usbKey
|
|
341
|
+
? {
|
|
342
|
+
...base.signServer?.usbKey,
|
|
343
|
+
...patch.signServer?.usbKey,
|
|
344
|
+
}
|
|
345
|
+
: undefined;
|
|
346
|
+
|
|
305
347
|
return {
|
|
306
348
|
defaults:
|
|
307
349
|
base.defaults || patch.defaults
|
|
308
350
|
? {
|
|
309
351
|
...base.defaults,
|
|
310
352
|
...patch.defaults,
|
|
311
|
-
bjca: {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
},
|
|
315
|
-
kol: {
|
|
316
|
-
...(base.defaults?.kol ?? {}),
|
|
317
|
-
...(patch.defaults?.kol ?? {}),
|
|
318
|
-
},
|
|
319
|
-
plugin: {
|
|
320
|
-
...(base.defaults?.plugin ?? {}),
|
|
321
|
-
...(patch.defaults?.plugin ?? {}),
|
|
322
|
-
},
|
|
353
|
+
...(mergedDefaultsBjca ? { bjca: mergedDefaultsBjca } : {}),
|
|
354
|
+
...(mergedDefaultsKol ? { kol: mergedDefaultsKol } : {}),
|
|
355
|
+
...(mergedDefaultsPlugin ? { plugin: mergedDefaultsPlugin } : {}),
|
|
323
356
|
}
|
|
324
357
|
: undefined,
|
|
325
358
|
signServer:
|
|
@@ -327,14 +360,8 @@ const mergeEnvironmentPatchState = (
|
|
|
327
360
|
? {
|
|
328
361
|
...base.signServer,
|
|
329
362
|
...patch.signServer,
|
|
330
|
-
kol: {
|
|
331
|
-
|
|
332
|
-
...(patch.signServer?.kol ?? {}),
|
|
333
|
-
},
|
|
334
|
-
usbKey: {
|
|
335
|
-
...(base.signServer?.usbKey ?? {}),
|
|
336
|
-
...(patch.signServer?.usbKey ?? {}),
|
|
337
|
-
},
|
|
363
|
+
...(mergedSignServerKol ? { kol: mergedSignServerKol } : {}),
|
|
364
|
+
...(mergedSignServerUsbKey ? { usbKey: mergedSignServerUsbKey } : {}),
|
|
338
365
|
}
|
|
339
366
|
: undefined,
|
|
340
367
|
};
|
|
@@ -365,6 +392,15 @@ export const getDigitalSignEnvironment = (): DigitalSignEnvironmentConfig => {
|
|
|
365
392
|
return resolveRuntimeStore().current;
|
|
366
393
|
};
|
|
367
394
|
|
|
395
|
+
export const getDigitalSignEnvironmentSource = (): DigitalSignEnvironmentSourceSnapshot => {
|
|
396
|
+
const store = resolveRuntimeStore();
|
|
397
|
+
return {
|
|
398
|
+
current: cloneEnvironmentConfig(store.current),
|
|
399
|
+
defaults: cloneEnvironmentConfig(store.defaults),
|
|
400
|
+
overrides: cloneEnvironmentPatch(store.overrides),
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
|
|
368
404
|
export const initializeDigitalSignEnvironment = (
|
|
369
405
|
defaults: DigitalSignEnvironmentConfig,
|
|
370
406
|
): DigitalSignEnvironmentConfig => {
|
package/src/api/document-tool.ts
CHANGED
|
@@ -28,6 +28,9 @@ export interface IFileOpenOptions {
|
|
|
28
28
|
fontSize: number;
|
|
29
29
|
};
|
|
30
30
|
uploadUrl?: string;
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
formData?: Record<string, string | number | boolean>;
|
|
33
|
+
fileFieldName?: string;
|
|
31
34
|
readOnly?: boolean;
|
|
32
35
|
fromCache?: boolean;
|
|
33
36
|
viewMode?: 'view' | 'annotation' | 'digital-sign';
|
package/src/browser.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
WatermarkDisplay,
|
|
5
5
|
createNewDocumentSdk,
|
|
6
6
|
getDigitalSignEnvironment,
|
|
7
|
+
getDigitalSignEnvironmentSource,
|
|
7
8
|
initializeDigitalSignEnvironment,
|
|
8
9
|
patchDigitalSignEnvironment,
|
|
9
10
|
resetDigitalSignEnvironment,
|
|
@@ -18,6 +19,7 @@ export interface RHCOfficeSDKBrowserNamespace {
|
|
|
18
19
|
createNewDocumentSdk: typeof createNewDocumentSdk;
|
|
19
20
|
newDocumentSDK: typeof createNewDocumentSdk;
|
|
20
21
|
getDigitalSignEnvironment: typeof getDigitalSignEnvironment;
|
|
22
|
+
getDigitalSignEnvironmentSource: typeof getDigitalSignEnvironmentSource;
|
|
21
23
|
initializeDigitalSignEnvironment: typeof initializeDigitalSignEnvironment;
|
|
22
24
|
patchDigitalSignEnvironment: typeof patchDigitalSignEnvironment;
|
|
23
25
|
resetDigitalSignEnvironment: typeof resetDigitalSignEnvironment;
|
|
@@ -31,6 +33,7 @@ export const RHCOfficeSDK: RHCOfficeSDKBrowserNamespace = {
|
|
|
31
33
|
createNewDocumentSdk,
|
|
32
34
|
newDocumentSDK: createNewDocumentSdk,
|
|
33
35
|
getDigitalSignEnvironment,
|
|
36
|
+
getDigitalSignEnvironmentSource,
|
|
34
37
|
initializeDigitalSignEnvironment,
|
|
35
38
|
patchDigitalSignEnvironment,
|
|
36
39
|
resetDigitalSignEnvironment,
|
|
@@ -62,6 +65,7 @@ declare global {
|
|
|
62
65
|
createNewDocumentSdk: typeof createNewDocumentSdk;
|
|
63
66
|
newDocumentSDK(options?: ConstructorParameters<typeof DocumentSDK>[0]): IDocumentSDK;
|
|
64
67
|
getDigitalSignEnvironment: typeof getDigitalSignEnvironment;
|
|
68
|
+
getDigitalSignEnvironmentSource: typeof getDigitalSignEnvironmentSource;
|
|
65
69
|
initializeDigitalSignEnvironment: typeof initializeDigitalSignEnvironment;
|
|
66
70
|
patchDigitalSignEnvironment: typeof patchDigitalSignEnvironment;
|
|
67
71
|
resetDigitalSignEnvironment: typeof resetDigitalSignEnvironment;
|
|
@@ -76,6 +80,7 @@ export {
|
|
|
76
80
|
WatermarkDisplay,
|
|
77
81
|
createNewDocumentSdk,
|
|
78
82
|
getDigitalSignEnvironment,
|
|
83
|
+
getDigitalSignEnvironmentSource,
|
|
79
84
|
initializeDigitalSignEnvironment,
|
|
80
85
|
patchDigitalSignEnvironment,
|
|
81
86
|
resetDigitalSignEnvironment,
|
|
@@ -79,6 +79,9 @@ const ANNOTATION_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
|
79
79
|
canRedoAnnotation: { kind: 'query' },
|
|
80
80
|
selectAnnotationTool: { kind: 'command' },
|
|
81
81
|
selectAnnotationStamp: { kind: 'command' },
|
|
82
|
+
getCustomStamps: { kind: 'query' },
|
|
83
|
+
addCustomTextStamp: { kind: 'query' },
|
|
84
|
+
addCustomImageStamp: { kind: 'query' },
|
|
82
85
|
setAnnotationPenColor: { kind: 'command' },
|
|
83
86
|
setAnnotationPenWidth: { kind: 'command' },
|
|
84
87
|
setAnnotationPenStyle: { kind: 'command' },
|
|
@@ -135,6 +138,18 @@ export class AnnotationToolImpl implements AnnotationTool {
|
|
|
135
138
|
return this.adapter.selectAnnotationStamp(stamp);
|
|
136
139
|
};
|
|
137
140
|
|
|
141
|
+
getCustomStamps: AnnotationTool['getCustomStamps'] = () => {
|
|
142
|
+
return this.adapter.getCustomStamps();
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
addCustomTextStamp: AnnotationTool['addCustomTextStamp'] = (input) => {
|
|
146
|
+
return this.adapter.addCustomTextStamp(input);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
addCustomImageStamp: AnnotationTool['addCustomImageStamp'] = (input) => {
|
|
150
|
+
return this.adapter.addCustomImageStamp(input);
|
|
151
|
+
};
|
|
152
|
+
|
|
138
153
|
setAnnotationPenColor: AnnotationTool['setAnnotationPenColor'] = (hexColor) => {
|
|
139
154
|
return this.adapter.setAnnotationPenColor(hexColor);
|
|
140
155
|
};
|
|
@@ -53,8 +53,26 @@ interface DocumentSDKRuntimeOptions {
|
|
|
53
53
|
requestTimeoutMs?: number;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
type ReaderHostRuntimeKind = 'server' | 'browser-static' | 'mobile-webview' | 'desktop-shell';
|
|
57
|
+
|
|
58
|
+
interface ReaderHostRuntimeConfig {
|
|
59
|
+
hostKind?: ReaderHostRuntimeKind | (string & {});
|
|
60
|
+
server?: {
|
|
61
|
+
baseUrl?: string;
|
|
62
|
+
paths?: Record<string, string | undefined>;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
56
66
|
type NativeReaderEventName = 'documentLoaded' | 'documentStateChange' | 'documentError';
|
|
57
67
|
type ReaderThemeCleanup = () => void;
|
|
68
|
+
const READER_RUNTIME_GLOBAL_KEY = '__RHC_OFFICE_READER_RUNTIME__' as const;
|
|
69
|
+
const READER_RUNTIME_PROPERTY_KEY = '__rhcOfficeReaderRuntimeConfig' as const;
|
|
70
|
+
type ReaderRuntimeBrowserGlobal = typeof globalThis & {
|
|
71
|
+
__RHC_OFFICE_READER_RUNTIME__?: ReaderHostRuntimeConfig;
|
|
72
|
+
};
|
|
73
|
+
type ReaderRuntimeElement = HTMLElement & {
|
|
74
|
+
[READER_RUNTIME_PROPERTY_KEY]?: ReaderHostRuntimeConfig;
|
|
75
|
+
};
|
|
58
76
|
type CompatibleMediaQueryList = MediaQueryList & {
|
|
59
77
|
addListener?: (listener: (event: MediaQueryListEvent) => void) => void;
|
|
60
78
|
removeListener?: (listener: (event: MediaQueryListEvent) => void) => void;
|
|
@@ -248,6 +266,10 @@ export class DocumentSDK implements IDocumentSDK {
|
|
|
248
266
|
private readerElement: HTMLElement | null = null;
|
|
249
267
|
private readerId: string | null = null;
|
|
250
268
|
private normalizedConfiguration: NormalizedReaderEmbedOptions | null = null;
|
|
269
|
+
private runtimeRestoreState: {
|
|
270
|
+
hadPreviousRuntime: boolean;
|
|
271
|
+
previousRuntime?: ReaderHostRuntimeConfig;
|
|
272
|
+
} | null = null;
|
|
251
273
|
private sessionUser?: Parameters<IDocumentSDK['setSessionUser']>[0];
|
|
252
274
|
private sessionData?: string;
|
|
253
275
|
private readonly nativeEventCleanupCallbacks: Array<() => void> = [];
|
|
@@ -277,9 +299,9 @@ export class DocumentSDK implements IDocumentSDK {
|
|
|
277
299
|
this.themeCleanup = null;
|
|
278
300
|
this.normalizedConfiguration = this.normalizedConfiguration
|
|
279
301
|
? {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
302
|
+
...this.normalizedConfiguration,
|
|
303
|
+
theme,
|
|
304
|
+
}
|
|
283
305
|
: null;
|
|
284
306
|
|
|
285
307
|
if (!this.readerElement) {
|
|
@@ -356,6 +378,7 @@ export class DocumentSDK implements IDocumentSDK {
|
|
|
356
378
|
this.mountToken += 1;
|
|
357
379
|
this.cleanupNativeEventForwarders();
|
|
358
380
|
this.cleanupThemeBinding();
|
|
381
|
+
this.restoreReaderRuntimeConfig();
|
|
359
382
|
|
|
360
383
|
if (this.readerElement?.parentNode) {
|
|
361
384
|
this.readerElement.parentNode.removeChild(this.readerElement);
|
|
@@ -460,6 +483,7 @@ export class DocumentSDK implements IDocumentSDK {
|
|
|
460
483
|
this.readerId = readerId;
|
|
461
484
|
this.bridge.setReaderId(readerId);
|
|
462
485
|
applyReaderElementLayout(readerElement);
|
|
486
|
+
this.applyReaderRuntimeConfig(readerElement, configuration);
|
|
463
487
|
const shouldUseCompactMode =
|
|
464
488
|
configuration.compactViewer === true && configuration.keepPCMenu !== true;
|
|
465
489
|
readerElement.toggleAttribute('data-sdk-compact-mode', shouldUseCompactMode);
|
|
@@ -496,6 +520,44 @@ export class DocumentSDK implements IDocumentSDK {
|
|
|
496
520
|
}
|
|
497
521
|
};
|
|
498
522
|
|
|
523
|
+
private applyReaderRuntimeConfig(
|
|
524
|
+
readerElement: HTMLElement,
|
|
525
|
+
configuration: NormalizedReaderEmbedOptions,
|
|
526
|
+
): void {
|
|
527
|
+
this.restoreReaderRuntimeConfig();
|
|
528
|
+
const readerHost: ReaderHostRuntimeConfig = {
|
|
529
|
+
hostKind: 'server',
|
|
530
|
+
server: {
|
|
531
|
+
baseUrl: configuration.appUrl,
|
|
532
|
+
},
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
const runtimeElement = readerElement as ReaderRuntimeElement;
|
|
536
|
+
runtimeElement[READER_RUNTIME_PROPERTY_KEY] = readerHost;
|
|
537
|
+
|
|
538
|
+
const browserGlobal = globalThis as ReaderRuntimeBrowserGlobal;
|
|
539
|
+
const previousRuntime = browserGlobal[READER_RUNTIME_GLOBAL_KEY];
|
|
540
|
+
this.runtimeRestoreState = {
|
|
541
|
+
hadPreviousRuntime: previousRuntime !== undefined,
|
|
542
|
+
...(previousRuntime !== undefined ? { previousRuntime } : {}),
|
|
543
|
+
};
|
|
544
|
+
browserGlobal[READER_RUNTIME_GLOBAL_KEY] = readerHost;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
private restoreReaderRuntimeConfig(): void {
|
|
548
|
+
if (!this.runtimeRestoreState) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
const browserGlobal = globalThis as ReaderRuntimeBrowserGlobal;
|
|
553
|
+
if (this.runtimeRestoreState.hadPreviousRuntime) {
|
|
554
|
+
browserGlobal[READER_RUNTIME_GLOBAL_KEY] = this.runtimeRestoreState.previousRuntime;
|
|
555
|
+
} else {
|
|
556
|
+
Reflect.deleteProperty(browserGlobal, READER_RUNTIME_GLOBAL_KEY);
|
|
557
|
+
}
|
|
558
|
+
this.runtimeRestoreState = null;
|
|
559
|
+
}
|
|
560
|
+
|
|
499
561
|
private readonly bindNativeReaderEvents = (readerElement: HTMLElement): void => {
|
|
500
562
|
this.cleanupNativeEventForwarders();
|
|
501
563
|
|