@d-i-t-a/reader 2.1.7 → 2.1.10
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/esm/index.js +60 -33
- package/dist/esm/index.js.map +2 -2
- package/dist/reader.js +19 -19
- package/dist/reader.js.map +2 -2
- package/dist/types/modules/citation/CitationModule.d.ts +4 -0
- package/dist/types/modules/history/HistoryModule.d.ts +5 -3
- package/dist/types/modules/protection/ContentProtectionModule.d.ts +3 -2
- package/dist/types/reader.d.ts +8 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -39506,17 +39506,7 @@ var TextHighlighter = class {
|
|
|
39506
39506
|
toolbox.style.top = ev.clientY + (self2.delegate.attributes?.navHeight ?? 0) + "px";
|
|
39507
39507
|
toolbox.style.left = ev.clientX + "px";
|
|
39508
39508
|
if (getComputedStyle(toolbox).display === "none") {
|
|
39509
|
-
let
|
|
39510
|
-
self2.delegate.annotationModule?.api?.addCommentToAnnotation(anno).then((result) => {
|
|
39511
|
-
self2.delegate.annotationModule?.updateAnnotation(result).then(async () => {
|
|
39512
|
-
import_loglevel5.default.log("update highlight " + result.id);
|
|
39513
|
-
toolbox.style.display = "none";
|
|
39514
|
-
self2.selectionMenuClosed();
|
|
39515
|
-
});
|
|
39516
|
-
toolbox.style.display = "none";
|
|
39517
|
-
self2.selectionMenuClosed();
|
|
39518
|
-
});
|
|
39519
|
-
}, deleteH = function() {
|
|
39509
|
+
let deleteH = function() {
|
|
39520
39510
|
if (self2.delegate.rights.enableAnnotations) {
|
|
39521
39511
|
self2.delegate.annotationModule?.deleteSelectedHighlight(anno).then(async () => {
|
|
39522
39512
|
import_loglevel5.default.log("delete highlight " + anno.id);
|
|
@@ -39551,14 +39541,6 @@ var TextHighlighter = class {
|
|
|
39551
39541
|
}
|
|
39552
39542
|
if (commentIcon) {
|
|
39553
39543
|
commentIcon.style.display = "none";
|
|
39554
|
-
let clone = commentIcon.cloneNode(true);
|
|
39555
|
-
let parent = commentIcon.parentElement;
|
|
39556
|
-
clone.style.display = "unset";
|
|
39557
|
-
clone.id = "cloneCommentIcon";
|
|
39558
|
-
clone.addEventListener("click", noteH, false);
|
|
39559
|
-
if (parent) {
|
|
39560
|
-
parent.append(clone);
|
|
39561
|
-
}
|
|
39562
39544
|
}
|
|
39563
39545
|
let deleteIcon = document.getElementById("deleteIcon");
|
|
39564
39546
|
let cloneDeleteIcon = document.getElementById("cloneDeleteIcon");
|
|
@@ -42266,6 +42248,9 @@ var ContentProtectionModule = class {
|
|
|
42266
42248
|
return true;
|
|
42267
42249
|
}
|
|
42268
42250
|
restrictCopy(event) {
|
|
42251
|
+
if (this.citation) {
|
|
42252
|
+
return;
|
|
42253
|
+
}
|
|
42269
42254
|
import_loglevel13.default.log("copy action initiated");
|
|
42270
42255
|
let win = this.delegate.iframes[0].contentWindow;
|
|
42271
42256
|
if (win) {
|
|
@@ -48281,24 +48266,30 @@ var HistoryModule = class {
|
|
|
48281
48266
|
addEventListenerOptional(this.historyBackAnchorElement, "click", this.handleHistoryBackClick.bind(this));
|
|
48282
48267
|
}
|
|
48283
48268
|
async handleHistoryForwardClick(event) {
|
|
48269
|
+
await this.historyForward();
|
|
48270
|
+
event.preventDefault();
|
|
48271
|
+
event.stopPropagation();
|
|
48272
|
+
}
|
|
48273
|
+
async historyForward() {
|
|
48284
48274
|
if (this.history.length > 0) {
|
|
48285
48275
|
if (this.historyCurrentIndex + 1 < this.history.length) {
|
|
48286
48276
|
this.historyCurrentIndex = this.historyCurrentIndex + 1;
|
|
48287
48277
|
await this.delegate.navigate(this.history[this.historyCurrentIndex], false);
|
|
48288
48278
|
}
|
|
48289
48279
|
}
|
|
48280
|
+
}
|
|
48281
|
+
async handleHistoryBackClick(event) {
|
|
48282
|
+
await this.historyBack();
|
|
48290
48283
|
event.preventDefault();
|
|
48291
48284
|
event.stopPropagation();
|
|
48292
48285
|
}
|
|
48293
|
-
async
|
|
48286
|
+
async historyBack() {
|
|
48294
48287
|
if (this.history.length > 0) {
|
|
48295
48288
|
if (this.historyCurrentIndex > 0) {
|
|
48296
48289
|
this.historyCurrentIndex = this.historyCurrentIndex - 1;
|
|
48297
48290
|
await this.delegate.navigate(this.history[this.historyCurrentIndex], false);
|
|
48298
48291
|
}
|
|
48299
48292
|
}
|
|
48300
|
-
event.preventDefault();
|
|
48301
|
-
event.stopPropagation();
|
|
48302
48293
|
}
|
|
48303
48294
|
};
|
|
48304
48295
|
|
|
@@ -48332,9 +48323,12 @@ var CitationModule = class {
|
|
|
48332
48323
|
return module;
|
|
48333
48324
|
}
|
|
48334
48325
|
async stop() {
|
|
48335
|
-
import_loglevel23.default.log("
|
|
48326
|
+
import_loglevel23.default.log("Citation module stop");
|
|
48336
48327
|
}
|
|
48337
48328
|
copyToClipboard(textToClipboard) {
|
|
48329
|
+
if (this.delegate?.contentProtectionModule) {
|
|
48330
|
+
this.delegate.contentProtectionModule.citation = true;
|
|
48331
|
+
}
|
|
48338
48332
|
let success = true;
|
|
48339
48333
|
if (window.clipboardData) {
|
|
48340
48334
|
window.clipboardData.setData("text/plain", textToClipboard);
|
|
@@ -48384,7 +48378,11 @@ var CitationModule = class {
|
|
|
48384
48378
|
let chicagoString = "";
|
|
48385
48379
|
let mlaString = "";
|
|
48386
48380
|
let apaString = "";
|
|
48387
|
-
if (self2.
|
|
48381
|
+
if (self2.properties.author) {
|
|
48382
|
+
apaString = apaString + self2.properties.author;
|
|
48383
|
+
mlaString = mlaString + self2.properties.author;
|
|
48384
|
+
chicagoString = chicagoString + self2.properties.author;
|
|
48385
|
+
} else if (self2.publication.Metadata.Author?.length > 0) {
|
|
48388
48386
|
let authorIndex = 0;
|
|
48389
48387
|
if (authorIndex === 0) {
|
|
48390
48388
|
if (self2.publication.Metadata.Author[0].Name) {
|
|
@@ -48405,11 +48403,18 @@ var CitationModule = class {
|
|
|
48405
48403
|
let chicagoString = "";
|
|
48406
48404
|
let mlaString = "";
|
|
48407
48405
|
let apaString = "";
|
|
48408
|
-
if (self2.
|
|
48406
|
+
if (self2.properties.publisher) {
|
|
48407
|
+
mlaString = mlaString + self2.properties.publisher + ", ";
|
|
48408
|
+
chicagoString = chicagoString + self2.properties.publisher + ", ";
|
|
48409
|
+
} else if (self2.publication.Metadata.Publisher && self2.publication.Metadata.Publisher[0].Name) {
|
|
48409
48410
|
mlaString = mlaString + self2.publication.Metadata.Publisher[0].Name + ", ";
|
|
48410
48411
|
chicagoString = chicagoString + self2.publication.Metadata.Publisher[0].Name + ", ";
|
|
48411
48412
|
}
|
|
48412
|
-
if (self2.
|
|
48413
|
+
if (self2.properties.published) {
|
|
48414
|
+
apaString = apaString + "(" + self2.properties.published + ")";
|
|
48415
|
+
mlaString = mlaString + self2.properties.published;
|
|
48416
|
+
chicagoString = chicagoString + self2.properties.published;
|
|
48417
|
+
} else if (self2.publication.Metadata.PublicationDate) {
|
|
48413
48418
|
if (self2.publication.Metadata.PublicationDate.getFullYear() > 0) {
|
|
48414
48419
|
apaString = apaString + "(" + self2.publication.Metadata.PublicationDate.getFullYear() + ")";
|
|
48415
48420
|
mlaString = mlaString + self2.publication.Metadata.PublicationDate.getFullYear();
|
|
@@ -48422,7 +48427,13 @@ var CitationModule = class {
|
|
|
48422
48427
|
return ["", "", ""];
|
|
48423
48428
|
};
|
|
48424
48429
|
let bookTitleFormatted = function() {
|
|
48425
|
-
if (self2.
|
|
48430
|
+
if (self2.properties.title) {
|
|
48431
|
+
return [
|
|
48432
|
+
self2.properties.title + ". ",
|
|
48433
|
+
self2.properties.title + ". ",
|
|
48434
|
+
self2.properties.title + ". "
|
|
48435
|
+
];
|
|
48436
|
+
} else if (self2.publication.Metadata.Title) {
|
|
48426
48437
|
return [
|
|
48427
48438
|
self2.publication.Metadata.Title + ". ",
|
|
48428
48439
|
self2.publication.Metadata.Title + ". ",
|
|
@@ -48439,7 +48450,11 @@ var CitationModule = class {
|
|
|
48439
48450
|
let chicagoString = "";
|
|
48440
48451
|
let mlaString = "";
|
|
48441
48452
|
let apaString = "";
|
|
48442
|
-
if (self2.
|
|
48453
|
+
if (self2.properties.publisher) {
|
|
48454
|
+
mlaString = mlaString + self2.properties.publisher + ", ";
|
|
48455
|
+
chicagoString = chicagoString + self2.properties.publisher + ", ";
|
|
48456
|
+
apaString = apaString + self2.properties.publisher + ", ";
|
|
48457
|
+
} else if (self2.publication.Metadata.Publisher && self2.publication.Metadata.Publisher[0].Name) {
|
|
48443
48458
|
mlaString = mlaString + self2.publication.Metadata.Publisher[0].Name + ", ";
|
|
48444
48459
|
chicagoString = chicagoString + self2.publication.Metadata.Publisher[0].Name + ", ";
|
|
48445
48460
|
apaString = apaString + self2.publication.Metadata.Publisher[0].Name + ", ";
|
|
@@ -48600,6 +48615,12 @@ var D2Reader = class {
|
|
|
48600
48615
|
this.addDefinition = async (definition) => {
|
|
48601
48616
|
await this.definitionsModule?.addDefinition(definition);
|
|
48602
48617
|
};
|
|
48618
|
+
this.historyBack = async () => {
|
|
48619
|
+
return this.historyModule?.historyBack();
|
|
48620
|
+
};
|
|
48621
|
+
this.historyForward = async () => {
|
|
48622
|
+
return this.historyModule?.historyForward();
|
|
48623
|
+
};
|
|
48603
48624
|
this.search = async (term, current) => {
|
|
48604
48625
|
return await this.searchModule?.search(term, current) ?? [];
|
|
48605
48626
|
};
|
|
@@ -48864,6 +48885,11 @@ var D2Reader = class {
|
|
|
48864
48885
|
publication,
|
|
48865
48886
|
delegate: navigator2
|
|
48866
48887
|
}) : void 0;
|
|
48888
|
+
const citationModule = rights.enableCitations ? await CitationModule.create(__spreadValues({
|
|
48889
|
+
publication,
|
|
48890
|
+
delegate: navigator2,
|
|
48891
|
+
highlighter
|
|
48892
|
+
}, initialConfig.citations)) : void 0;
|
|
48867
48893
|
const contentProtectionModule = rights.enableContentProtection ? await ContentProtectionModule.create(__spreadValues({
|
|
48868
48894
|
delegate: navigator2
|
|
48869
48895
|
}, initialConfig.protection)) : void 0;
|
|
@@ -48895,11 +48921,6 @@ var D2Reader = class {
|
|
|
48895
48921
|
delegate: navigator2,
|
|
48896
48922
|
headerMenu
|
|
48897
48923
|
}) : void 0;
|
|
48898
|
-
const citationModule = rights.enableCitations ? await CitationModule.create(__spreadValues({
|
|
48899
|
-
publication,
|
|
48900
|
-
delegate: navigator2,
|
|
48901
|
-
highlighter
|
|
48902
|
-
}, initialConfig.citations)) : void 0;
|
|
48903
48924
|
return new D2Reader(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule);
|
|
48904
48925
|
}
|
|
48905
48926
|
get hasMediaOverlays() {
|
|
@@ -48917,6 +48938,12 @@ var D2Reader = class {
|
|
|
48917
48938
|
get annotations() {
|
|
48918
48939
|
return this.annotationModule?.getAnnotations();
|
|
48919
48940
|
}
|
|
48941
|
+
get history() {
|
|
48942
|
+
return this.historyModule?.history;
|
|
48943
|
+
}
|
|
48944
|
+
get historyCurrentIndex() {
|
|
48945
|
+
return this.historyModule?.historyCurrentIndex;
|
|
48946
|
+
}
|
|
48920
48947
|
get currentResource() {
|
|
48921
48948
|
return this.navigator.currentResource();
|
|
48922
48949
|
}
|