@d-i-t-a/reader 2.1.7 → 2.1.8

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 CHANGED
@@ -42266,6 +42266,9 @@ var ContentProtectionModule = class {
42266
42266
  return true;
42267
42267
  }
42268
42268
  restrictCopy(event) {
42269
+ if (this.citation) {
42270
+ return;
42271
+ }
42269
42272
  import_loglevel13.default.log("copy action initiated");
42270
42273
  let win = this.delegate.iframes[0].contentWindow;
42271
42274
  if (win) {
@@ -48332,9 +48335,12 @@ var CitationModule = class {
48332
48335
  return module;
48333
48336
  }
48334
48337
  async stop() {
48335
- import_loglevel23.default.log("Timeline module stop");
48338
+ import_loglevel23.default.log("Citation module stop");
48336
48339
  }
48337
48340
  copyToClipboard(textToClipboard) {
48341
+ if (this.delegate?.contentProtectionModule) {
48342
+ this.delegate.contentProtectionModule.citation = true;
48343
+ }
48338
48344
  let success = true;
48339
48345
  if (window.clipboardData) {
48340
48346
  window.clipboardData.setData("text/plain", textToClipboard);
@@ -48384,7 +48390,11 @@ var CitationModule = class {
48384
48390
  let chicagoString = "";
48385
48391
  let mlaString = "";
48386
48392
  let apaString = "";
48387
- if (self2.publication.Metadata.Author?.length > 0) {
48393
+ if (self2.properties.author) {
48394
+ apaString = apaString + self2.properties.author;
48395
+ mlaString = mlaString + self2.properties.author;
48396
+ chicagoString = chicagoString + self2.properties.author;
48397
+ } else if (self2.publication.Metadata.Author?.length > 0) {
48388
48398
  let authorIndex = 0;
48389
48399
  if (authorIndex === 0) {
48390
48400
  if (self2.publication.Metadata.Author[0].Name) {
@@ -48405,11 +48415,18 @@ var CitationModule = class {
48405
48415
  let chicagoString = "";
48406
48416
  let mlaString = "";
48407
48417
  let apaString = "";
48408
- if (self2.publication.Metadata.Publisher && self2.publication.Metadata.Publisher[0].Name) {
48418
+ if (self2.properties.publisher) {
48419
+ mlaString = mlaString + self2.properties.publisher + ", ";
48420
+ chicagoString = chicagoString + self2.properties.publisher + ", ";
48421
+ } else if (self2.publication.Metadata.Publisher && self2.publication.Metadata.Publisher[0].Name) {
48409
48422
  mlaString = mlaString + self2.publication.Metadata.Publisher[0].Name + ", ";
48410
48423
  chicagoString = chicagoString + self2.publication.Metadata.Publisher[0].Name + ", ";
48411
48424
  }
48412
- if (self2.publication.Metadata.PublicationDate) {
48425
+ if (self2.properties.published) {
48426
+ apaString = apaString + "(" + self2.properties.published + ")";
48427
+ mlaString = mlaString + self2.properties.published;
48428
+ chicagoString = chicagoString + self2.properties.published;
48429
+ } else if (self2.publication.Metadata.PublicationDate) {
48413
48430
  if (self2.publication.Metadata.PublicationDate.getFullYear() > 0) {
48414
48431
  apaString = apaString + "(" + self2.publication.Metadata.PublicationDate.getFullYear() + ")";
48415
48432
  mlaString = mlaString + self2.publication.Metadata.PublicationDate.getFullYear();
@@ -48422,7 +48439,13 @@ var CitationModule = class {
48422
48439
  return ["", "", ""];
48423
48440
  };
48424
48441
  let bookTitleFormatted = function() {
48425
- if (self2.publication.Metadata.Title) {
48442
+ if (self2.properties.title) {
48443
+ return [
48444
+ self2.properties.title + ". ",
48445
+ self2.properties.title + ". ",
48446
+ self2.properties.title + ". "
48447
+ ];
48448
+ } else if (self2.publication.Metadata.Title) {
48426
48449
  return [
48427
48450
  self2.publication.Metadata.Title + ". ",
48428
48451
  self2.publication.Metadata.Title + ". ",
@@ -48439,7 +48462,11 @@ var CitationModule = class {
48439
48462
  let chicagoString = "";
48440
48463
  let mlaString = "";
48441
48464
  let apaString = "";
48442
- if (self2.publication.Metadata.Publisher && self2.publication.Metadata.Publisher[0].Name) {
48465
+ if (self2.properties.publisher) {
48466
+ mlaString = mlaString + self2.properties.publisher + ", ";
48467
+ chicagoString = chicagoString + self2.properties.publisher + ", ";
48468
+ apaString = apaString + self2.properties.publisher + ", ";
48469
+ } else if (self2.publication.Metadata.Publisher && self2.publication.Metadata.Publisher[0].Name) {
48443
48470
  mlaString = mlaString + self2.publication.Metadata.Publisher[0].Name + ", ";
48444
48471
  chicagoString = chicagoString + self2.publication.Metadata.Publisher[0].Name + ", ";
48445
48472
  apaString = apaString + self2.publication.Metadata.Publisher[0].Name + ", ";
@@ -48864,6 +48891,11 @@ var D2Reader = class {
48864
48891
  publication,
48865
48892
  delegate: navigator2
48866
48893
  }) : void 0;
48894
+ const citationModule = rights.enableCitations ? await CitationModule.create(__spreadValues({
48895
+ publication,
48896
+ delegate: navigator2,
48897
+ highlighter
48898
+ }, initialConfig.citations)) : void 0;
48867
48899
  const contentProtectionModule = rights.enableContentProtection ? await ContentProtectionModule.create(__spreadValues({
48868
48900
  delegate: navigator2
48869
48901
  }, initialConfig.protection)) : void 0;
@@ -48895,11 +48927,6 @@ var D2Reader = class {
48895
48927
  delegate: navigator2,
48896
48928
  headerMenu
48897
48929
  }) : void 0;
48898
- const citationModule = rights.enableCitations ? await CitationModule.create(__spreadValues({
48899
- publication,
48900
- delegate: navigator2,
48901
- highlighter
48902
- }, initialConfig.citations)) : void 0;
48903
48930
  return new D2Reader(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule);
48904
48931
  }
48905
48932
  get hasMediaOverlays() {