From 95a2a1b86e636b2ddec077525d232f0f85faf966 Mon Sep 17 00:00:00 2001 From: Nikolai Riedel Date: Mon, 6 Nov 2023 18:37:22 +0100 Subject: [PATCH 1/5] Prevent delayed showing of toolbox on ios --- src/modules/highlight/TextHighlighter.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/highlight/TextHighlighter.ts b/src/modules/highlight/TextHighlighter.ts index 3ca9aac7..3a457321 100644 --- a/src/modules/highlight/TextHighlighter.ts +++ b/src/modules/highlight/TextHighlighter.ts @@ -655,7 +655,12 @@ export class TextHighlighter { window.addEventListener("resize", this.toolboxPlacement.bind(this)); } doc.addEventListener("selectionchange", this.toolboxPlacement.bind(this)); - doc.addEventListener("selectionchange", this.toolboxShowDelayed.bind(this)); + if (!this.isIOS()) { + doc.addEventListener( + "selectionchange", + this.toolboxShowDelayed.bind(this) + ); + } el.addEventListener("mousedown", this.toolboxHide.bind(this)); el.addEventListener("touchstart", this.toolboxHide.bind(this)); From a7cf28f519e27cf7fdcb4c309c7f65de2612b848 Mon Sep 17 00:00:00 2001 From: Aferdita Muriqi Date: Wed, 31 Jan 2024 08:32:01 -0500 Subject: [PATCH 2/5] version bump on debounce dependency --- build.ts | 2 +- package-lock.json | 22 ++++++++++++------- package.json | 2 +- src/modules/TTS/TTSModule2.ts | 2 +- src/modules/highlight/TextHighlighter.ts | 18 +++++---------- .../protection/ContentProtectionModule.ts | 2 +- .../sampleread/SampleReadEventHandler.ts | 2 +- src/modules/search/DefinitionsModule.ts | 2 +- src/navigator/IFrameNavigator.ts | 6 ++--- src/views/ReflowableBookView.ts | 2 +- 10 files changed, 29 insertions(+), 31 deletions(-) diff --git a/build.ts b/build.ts index 298d766b..a75755b3 100644 --- a/build.ts +++ b/build.ts @@ -3,7 +3,7 @@ import * as util from "util"; import chalk from "chalk"; import { promises as fs } from "fs"; import { watch } from "chokidar"; -import { debounce } from "debounce"; +import debounce from "debounce"; import copy0 from "copy"; import child_process0 from "child_process"; import sass0 from "sass"; diff --git a/package-lock.json b/package-lock.json index 2c224fa4..d1bf7514 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,7 @@ "chalk": "^4.1.2", "chokidar": "^3.5.2", "copy": "^0.3.2", - "debounce": "^1.2.1", + "debounce": "^2.0.0", "dita-streamer-js": "^1.1.3", "ecstatic": "^4.1.4", "esbuild": "^0.20.0", @@ -8175,10 +8175,16 @@ } }, "node_modules/debounce": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", - "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-2.0.0.tgz", + "integrity": "sha512-xRetU6gL1VJbs85Mc4FoEGSjQxzpdxRyFhe3lmWFyy2EzydIcD4xzUvRJMD+NPDfMwKNhxa3PvsIOU32luIWeA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/debug": { "version": "2.6.9", @@ -22025,9 +22031,9 @@ } }, "debounce": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", - "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-2.0.0.tgz", + "integrity": "sha512-xRetU6gL1VJbs85Mc4FoEGSjQxzpdxRyFhe3lmWFyy2EzydIcD4xzUvRJMD+NPDfMwKNhxa3PvsIOU32luIWeA==", "dev": true }, "debug": { diff --git a/package.json b/package.json index 1474a2a2..3c5f9b31 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "chalk": "^4.1.2", "chokidar": "^3.5.2", "copy": "^0.3.2", - "debounce": "^1.2.1", + "debounce": "^2.0.0", "dita-streamer-js": "^1.1.3", "ecstatic": "^4.1.4", "esbuild": "^0.20.0", diff --git a/src/modules/TTS/TTSModule2.ts b/src/modules/TTS/TTSModule2.ts index 72bf15d8..d362f67e 100644 --- a/src/modules/TTS/TTSModule2.ts +++ b/src/modules/TTS/TTSModule2.ts @@ -36,7 +36,7 @@ import { TextHighlighter } from "../highlight/TextHighlighter"; import { HighlightType, IHighlight } from "../highlight/common/highlight"; import { uniqueCssSelector } from "../highlight/renderer/common/cssselector2"; import { convertRange } from "../highlight/renderer/iframe/selection"; -import { debounce } from "debounce"; +import debounce from "debounce"; import { _getCssSelectorOptions, ISelectionInfo, diff --git a/src/modules/highlight/TextHighlighter.ts b/src/modules/highlight/TextHighlighter.ts index 3a457321..0bf37195 100644 --- a/src/modules/highlight/TextHighlighter.ts +++ b/src/modules/highlight/TextHighlighter.ts @@ -18,7 +18,7 @@ */ import { SHA256 } from "jscrypto/es6/SHA256"; -import { debounce } from "debounce"; +import debounce from "debounce"; import { IEventPayload_R2_EVENT_HIGHLIGHT_CLICK } from "./common/events"; import { @@ -1978,9 +1978,7 @@ export class TextHighlighter { ); highlightArea.style.setProperty( "border-bottom", - `2px solid rgba(${color.red}, ${color.green}, ${ - color.blue - }, ${1})`, + `2px solid rgba(${color.red}, ${color.green}, ${color.blue}, ${1})`, "important" ); } else if (TextHighlighter.isHexColor(highlight.color)) { @@ -1992,9 +1990,7 @@ export class TextHighlighter { ); highlightArea.style.setProperty( "border-bottom", - `2px solid rgba(${color.red}, ${color.green}, ${ - color.blue - }, ${1})`, + `2px solid rgba(${color.red}, ${color.green}, ${color.blue}, ${1})`, "important" ); } else { @@ -2872,9 +2868,7 @@ export class TextHighlighter { highlightArea.setAttribute( "style", - `mix-blend-mode: multiply; border-radius: ${roundedCorner}px !important; background-color: rgba(${ - color.red - }, ${color.green}, ${color.blue}, ${0}) !important; ${extra}` + `mix-blend-mode: multiply; border-radius: ${roundedCorner}px !important; background-color: rgba(${color.red}, ${color.green}, ${color.blue}, ${0}) !important; ${extra}` ); highlightArea.style.setProperty( "border-bottom", @@ -2885,9 +2879,7 @@ export class TextHighlighter { let color = TextHighlighter.hexToRgbChannels(highlight.color); highlightArea.setAttribute( "style", - `mix-blend-mode: multiply; border-radius: ${roundedCorner}px !important; background-color: rgba(${ - color.red - }, ${color.green}, ${color.blue}, ${0}) !important; ${extra}` + `mix-blend-mode: multiply; border-radius: ${roundedCorner}px !important; background-color: rgba(${color.red}, ${color.green}, ${color.blue}, ${0}) !important; ${extra}` ); highlightArea.style.setProperty( "border-bottom", diff --git a/src/modules/protection/ContentProtectionModule.ts b/src/modules/protection/ContentProtectionModule.ts index 804cfd96..e250c0d3 100644 --- a/src/modules/protection/ContentProtectionModule.ts +++ b/src/modules/protection/ContentProtectionModule.ts @@ -24,7 +24,7 @@ import { addEventListenerOptional, removeEventListenerOptional, } from "../../utils/EventHandler"; -import { debounce } from "debounce"; +import debounce from "debounce"; import { delay } from "../../utils"; import { addListener, launch } from "devtools-detector"; import log from "loglevel"; diff --git a/src/modules/sampleread/SampleReadEventHandler.ts b/src/modules/sampleread/SampleReadEventHandler.ts index 8b781179..8392f608 100644 --- a/src/modules/sampleread/SampleReadEventHandler.ts +++ b/src/modules/sampleread/SampleReadEventHandler.ts @@ -17,7 +17,7 @@ * Licensed to: Bibliotheca LLC under one or more contributor license agreements. */ -import { debounce } from "debounce"; +import debounce from "debounce"; import { IFrameNavigator } from "../../navigator/IFrameNavigator"; export default class SampleReadEventHandler { diff --git a/src/modules/search/DefinitionsModule.ts b/src/modules/search/DefinitionsModule.ts index c2f7b1a0..c24d0d2d 100644 --- a/src/modules/search/DefinitionsModule.ts +++ b/src/modules/search/DefinitionsModule.ts @@ -28,7 +28,7 @@ import { import * as lodash from "lodash"; import { searchDocDomSeek } from "./searchWithDomSeek"; import { HighlightType, IHighlight } from "../highlight/common/highlight"; -import { debounce } from "debounce"; +import debounce from "debounce"; import { ISelectionInfo } from "../highlight/common/selection"; import { SHA256 } from "jscrypto/es6/SHA256"; import { AnnotationMarker } from "../../model/Locator"; diff --git a/src/navigator/IFrameNavigator.ts b/src/navigator/IFrameNavigator.ts index b7eb106c..b0696382 100644 --- a/src/navigator/IFrameNavigator.ts +++ b/src/navigator/IFrameNavigator.ts @@ -59,7 +59,7 @@ import { TextHighlighterConfig, } from "../modules/highlight/TextHighlighter"; import { TimelineModule } from "../modules/positions/TimelineModule"; -import { debounce } from "debounce"; +import debounce from "debounce"; import TouchEventHandler from "../utils/TouchEventHandler"; import KeyboardEventHandler from "../utils/KeyboardEventHandler"; import BookView from "../views/BookView"; @@ -1670,8 +1670,8 @@ export class IFrameNavigator extends EventEmitter implements Navigator { e instanceof Error ? e : typeof e === "string" - ? new Error(e) - : new Error("An unknown error occurred in the IFrameNavigator."); + ? new Error(e) + : new Error("An unknown error occurred in the IFrameNavigator."); this.api.onError(trueError); } else { // otherwise just display the standard error UI diff --git a/src/views/ReflowableBookView.ts b/src/views/ReflowableBookView.ts index 7a2a5eb3..2dcf10b7 100644 --- a/src/views/ReflowableBookView.ts +++ b/src/views/ReflowableBookView.ts @@ -26,7 +26,7 @@ import { IFrameAttributes, IFrameNavigator, } from "../navigator/IFrameNavigator"; -import { debounce } from "debounce"; +import debounce from "debounce"; export default class ReflowableBookView implements BookView { layout = "reflowable"; From d0d9b6304473d9e5c351170afe5389ac75388c99 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:35:20 +0000 Subject: [PATCH 3/5] Bump typescript from 5.1.6 to 5.3.3 Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.1.6 to 5.3.3. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v5.1.6...v5.3.3) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index d1bf7514..d1e65b31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -100,7 +100,7 @@ "ts-node": "^10.9.1", "typedoc": "^0.25.1", "typedoc-plugin-rename-defaults": "^0.7.0", - "typescript": "5.1.6", + "typescript": "5.3.3", "urijs": "^1.19.11" }, "engines": { @@ -15864,9 +15864,9 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -27669,9 +27669,9 @@ } }, "typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index 3c5f9b31..a31d0bcd 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "ts-node": "^10.9.1", "typedoc": "^0.25.1", "typedoc-plugin-rename-defaults": "^0.7.0", - "typescript": "5.1.6", + "typescript": "5.3.3", "urijs": "^1.19.11" }, "files": [ From cdde81fbbd1fda79f45bfc901e2e01f410c19bf6 Mon Sep 17 00:00:00 2001 From: Aferdita Muriqi Date: Wed, 31 Jan 2024 08:38:19 -0500 Subject: [PATCH 4/5] version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d1e65b31..67ec3972 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@d-i-t-a/reader", - "version": "2.4.1", + "version": "2.4.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@d-i-t-a/reader", - "version": "2.4.1", + "version": "2.4.2", "license": "Apache-2.0", "dependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", diff --git a/package.json b/package.json index a31d0bcd..5879eb95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@d-i-t-a/reader", - "version": "2.4.1", + "version": "2.4.2", "description": "A viewer application for EPUB files.", "repository": "https://github.com/d-i-t-a/R2D2BC", "license": "Apache-2.0", From 1fc83e558904ef2f685862f0ab11496d8f06f090 Mon Sep 17 00:00:00 2001 From: Aferdita Muriqi Date: Wed, 31 Jan 2024 08:39:13 -0500 Subject: [PATCH 5/5] version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 67ec3972..5a4a6804 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@d-i-t-a/reader", - "version": "2.4.2", + "version": "2.4.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@d-i-t-a/reader", - "version": "2.4.2", + "version": "2.4.3", "license": "Apache-2.0", "dependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", diff --git a/package.json b/package.json index 5879eb95..780dab56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@d-i-t-a/reader", - "version": "2.4.2", + "version": "2.4.3", "description": "A viewer application for EPUB files.", "repository": "https://github.com/d-i-t-a/R2D2BC", "license": "Apache-2.0",