@4tw/vue-cli-plugin-pdfjs-viewer 1.4.0 → 1.5.0
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/CHANGELOG.md +4 -0
- package/assets/build/pdf.mjs +973 -220
- package/assets/build/pdf.mjs.map +1 -1
- package/assets/build/pdf.sandbox.mjs +3 -3
- package/assets/build/pdf.sandbox.mjs.map +1 -1
- package/assets/build/pdf.worker.mjs +66 -19
- package/assets/build/pdf.worker.mjs.map +1 -1
- package/assets/web/images/toolbarButton-editorHighlight.svg +6 -0
- package/assets/web/locale/be/viewer.ftl +35 -0
- package/assets/web/locale/br/viewer.ftl +30 -0
- package/assets/web/locale/cs/viewer.ftl +35 -0
- package/assets/web/locale/cy/viewer.ftl +33 -0
- package/assets/web/locale/da/viewer.ftl +14 -0
- package/assets/web/locale/de/viewer.ftl +35 -0
- package/assets/web/locale/dsb/viewer.ftl +33 -0
- package/assets/web/locale/el/viewer.ftl +33 -0
- package/assets/web/locale/en-GB/viewer.ftl +33 -0
- package/assets/web/locale/en-US/viewer.ftl +36 -2
- package/assets/web/locale/es-AR/viewer.ftl +35 -0
- package/assets/web/locale/es-CL/viewer.ftl +33 -0
- package/assets/web/locale/es-ES/viewer.ftl +35 -0
- package/assets/web/locale/fi/viewer.ftl +33 -0
- package/assets/web/locale/fr/viewer.ftl +33 -0
- package/assets/web/locale/fur/viewer.ftl +14 -0
- package/assets/web/locale/fy-NL/viewer.ftl +35 -0
- package/assets/web/locale/gn/viewer.ftl +33 -0
- package/assets/web/locale/he/viewer.ftl +33 -0
- package/assets/web/locale/hsb/viewer.ftl +33 -0
- package/assets/web/locale/hu/viewer.ftl +35 -0
- package/assets/web/locale/ia/viewer.ftl +33 -0
- package/assets/web/locale/is/viewer.ftl +33 -0
- package/assets/web/locale/it/viewer.ftl +33 -0
- package/assets/web/locale/ja/viewer.ftl +14 -0
- package/assets/web/locale/ka/viewer.ftl +2 -0
- package/assets/web/locale/kab/viewer.ftl +12 -0
- package/assets/web/locale/kk/viewer.ftl +33 -0
- package/assets/web/locale/ko/viewer.ftl +33 -0
- package/assets/web/locale/nb-NO/viewer.ftl +33 -0
- package/assets/web/locale/nl/viewer.ftl +35 -0
- package/assets/web/locale/nn-NO/viewer.ftl +2 -0
- package/assets/web/locale/pa-IN/viewer.ftl +14 -0
- package/assets/web/locale/pl/viewer.ftl +35 -0
- package/assets/web/locale/pt-BR/viewer.ftl +33 -0
- package/assets/web/locale/rm/viewer.ftl +35 -0
- package/assets/web/locale/ru/viewer.ftl +33 -0
- package/assets/web/locale/sk/viewer.ftl +33 -0
- package/assets/web/locale/sl/viewer.ftl +35 -0
- package/assets/web/locale/sq/viewer.ftl +35 -0
- package/assets/web/locale/sv-SE/viewer.ftl +33 -0
- package/assets/web/locale/tg/viewer.ftl +35 -0
- package/assets/web/locale/tr/viewer.ftl +33 -0
- package/assets/web/locale/uk/viewer.ftl +35 -0
- package/assets/web/locale/vi/viewer.ftl +33 -0
- package/assets/web/locale/zh-CN/viewer.ftl +35 -0
- package/assets/web/locale/zh-TW/viewer.ftl +33 -0
- package/assets/web/viewer.css +524 -360
- package/assets/web/viewer.html +22 -11
- package/assets/web/viewer.mjs +343 -238
- package/assets/web/viewer.mjs.map +1 -1
- package/package.json +1 -1
package/assets/build/pdf.mjs
CHANGED
|
@@ -2511,7 +2511,7 @@ class AnnotationLayer {
|
|
|
2511
2511
|
/* harmony export */ SerializableEmpty: () => (/* binding */ SerializableEmpty)
|
|
2512
2512
|
/* harmony export */ });
|
|
2513
2513
|
/* harmony import */ var _shared_util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(266);
|
|
2514
|
-
/* harmony import */ var _editor_editor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
2514
|
+
/* harmony import */ var _editor_editor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(115);
|
|
2515
2515
|
/* harmony import */ var _shared_murmurhash3_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(825);
|
|
2516
2516
|
|
|
2517
2517
|
|
|
@@ -2801,7 +2801,7 @@ function getDocument(src) {
|
|
|
2801
2801
|
}
|
|
2802
2802
|
const fetchDocParams = {
|
|
2803
2803
|
docId,
|
|
2804
|
-
apiVersion: '4.0.
|
|
2804
|
+
apiVersion: '4.0.379',
|
|
2805
2805
|
data,
|
|
2806
2806
|
password,
|
|
2807
2807
|
disableAutoFetch,
|
|
@@ -4057,10 +4057,10 @@ class WorkerTransport {
|
|
|
4057
4057
|
});
|
|
4058
4058
|
messageHandler.on("commonobj", ([id, type, exportedData]) => {
|
|
4059
4059
|
if (this.destroyed) {
|
|
4060
|
-
return;
|
|
4060
|
+
return null;
|
|
4061
4061
|
}
|
|
4062
4062
|
if (this.commonObjs.has(id)) {
|
|
4063
|
-
return;
|
|
4063
|
+
return null;
|
|
4064
4064
|
}
|
|
4065
4065
|
switch (type) {
|
|
4066
4066
|
case "Font":
|
|
@@ -4089,6 +4089,24 @@ class WorkerTransport {
|
|
|
4089
4089
|
this.commonObjs.resolve(id, font);
|
|
4090
4090
|
});
|
|
4091
4091
|
break;
|
|
4092
|
+
case "CopyLocalImage":
|
|
4093
|
+
const {
|
|
4094
|
+
imageRef
|
|
4095
|
+
} = exportedData;
|
|
4096
|
+
(0,_shared_util_js__WEBPACK_IMPORTED_MODULE_0__.assert)(imageRef, "The imageRef must be defined.");
|
|
4097
|
+
for (const pageProxy of this.#pageCache.values()) {
|
|
4098
|
+
for (const [, data] of pageProxy.objs) {
|
|
4099
|
+
if (data.ref !== imageRef) {
|
|
4100
|
+
continue;
|
|
4101
|
+
}
|
|
4102
|
+
if (!data.dataLen) {
|
|
4103
|
+
return null;
|
|
4104
|
+
}
|
|
4105
|
+
this.commonObjs.resolve(id, structuredClone(data));
|
|
4106
|
+
return data.dataLen;
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
break;
|
|
4092
4110
|
case "FontPath":
|
|
4093
4111
|
case "Image":
|
|
4094
4112
|
case "Pattern":
|
|
@@ -4097,6 +4115,7 @@ class WorkerTransport {
|
|
|
4097
4115
|
default:
|
|
4098
4116
|
throw new Error(`Got unknown common object type ${type}`);
|
|
4099
4117
|
}
|
|
4118
|
+
return null;
|
|
4100
4119
|
});
|
|
4101
4120
|
messageHandler.on("obj", ([id, pageIndex, type, imageData]) => {
|
|
4102
4121
|
if (this.destroyed) {
|
|
@@ -4113,20 +4132,8 @@ class WorkerTransport {
|
|
|
4113
4132
|
switch (type) {
|
|
4114
4133
|
case "Image":
|
|
4115
4134
|
pageProxy.objs.resolve(id, imageData);
|
|
4116
|
-
if (imageData) {
|
|
4117
|
-
|
|
4118
|
-
if (imageData.bitmap) {
|
|
4119
|
-
const {
|
|
4120
|
-
width,
|
|
4121
|
-
height
|
|
4122
|
-
} = imageData;
|
|
4123
|
-
length = width * height * 4;
|
|
4124
|
-
} else {
|
|
4125
|
-
length = imageData.data?.length || 0;
|
|
4126
|
-
}
|
|
4127
|
-
if (length > _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.MAX_IMAGE_SIZE_TO_CACHE) {
|
|
4128
|
-
pageProxy._maybeCleanupAfterRender = true;
|
|
4129
|
-
}
|
|
4135
|
+
if (imageData?.dataLen > _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.MAX_IMAGE_SIZE_TO_CACHE) {
|
|
4136
|
+
pageProxy._maybeCleanupAfterRender = true;
|
|
4130
4137
|
}
|
|
4131
4138
|
break;
|
|
4132
4139
|
case "Pattern":
|
|
@@ -4354,7 +4361,7 @@ class PDFObjects {
|
|
|
4354
4361
|
}
|
|
4355
4362
|
has(objId) {
|
|
4356
4363
|
const obj = this.#objs[objId];
|
|
4357
|
-
return obj?.capability.settled
|
|
4364
|
+
return obj?.capability.settled ?? false;
|
|
4358
4365
|
}
|
|
4359
4366
|
resolve(objId, data = null) {
|
|
4360
4367
|
const obj = this.#ensureObj(objId);
|
|
@@ -4370,6 +4377,18 @@ class PDFObjects {
|
|
|
4370
4377
|
}
|
|
4371
4378
|
this.#objs = Object.create(null);
|
|
4372
4379
|
}
|
|
4380
|
+
*[Symbol.iterator]() {
|
|
4381
|
+
for (const objId in this.#objs) {
|
|
4382
|
+
const {
|
|
4383
|
+
capability,
|
|
4384
|
+
data
|
|
4385
|
+
} = this.#objs[objId];
|
|
4386
|
+
if (!capability.settled) {
|
|
4387
|
+
continue;
|
|
4388
|
+
}
|
|
4389
|
+
yield [objId, data];
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4373
4392
|
}
|
|
4374
4393
|
class RenderTask {
|
|
4375
4394
|
#internalRenderTask = null;
|
|
@@ -4530,8 +4549,8 @@ class InternalRenderTask {
|
|
|
4530
4549
|
}
|
|
4531
4550
|
}
|
|
4532
4551
|
}
|
|
4533
|
-
const version = '4.0.
|
|
4534
|
-
const build = '
|
|
4552
|
+
const version = '4.0.379';
|
|
4553
|
+
const build = '9e14d04fd';
|
|
4535
4554
|
|
|
4536
4555
|
__webpack_async_result__();
|
|
4537
4556
|
} catch(e) { __webpack_async_result__(e); } });
|
|
@@ -8297,6 +8316,9 @@ class DrawLayer {
|
|
|
8297
8316
|
this.#mapping.get(id).classList.remove(className);
|
|
8298
8317
|
}
|
|
8299
8318
|
remove(id) {
|
|
8319
|
+
if (this.#parent === null) {
|
|
8320
|
+
return;
|
|
8321
|
+
}
|
|
8300
8322
|
this.#mapping.get(id).remove();
|
|
8301
8323
|
this.#mapping.delete(id);
|
|
8302
8324
|
}
|
|
@@ -8312,7 +8334,7 @@ class DrawLayer {
|
|
|
8312
8334
|
|
|
8313
8335
|
/***/ }),
|
|
8314
8336
|
|
|
8315
|
-
/***/
|
|
8337
|
+
/***/ 629:
|
|
8316
8338
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
8317
8339
|
|
|
8318
8340
|
|
|
@@ -8323,8 +8345,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
8323
8345
|
|
|
8324
8346
|
// EXTERNAL MODULE: ./src/shared/util.js
|
|
8325
8347
|
var util = __webpack_require__(266);
|
|
8326
|
-
// EXTERNAL MODULE: ./src/display/editor/editor.js +
|
|
8327
|
-
var editor_editor = __webpack_require__(
|
|
8348
|
+
// EXTERNAL MODULE: ./src/display/editor/editor.js + 2 modules
|
|
8349
|
+
var editor_editor = __webpack_require__(115);
|
|
8328
8350
|
// EXTERNAL MODULE: ./src/display/editor/tools.js
|
|
8329
8351
|
var tools = __webpack_require__(812);
|
|
8330
8352
|
// EXTERNAL MODULE: ./src/display/annotation_layer.js + 1 modules
|
|
@@ -8840,6 +8862,350 @@ class FreeTextEditor extends editor_editor.AnnotationEditor {
|
|
|
8840
8862
|
}
|
|
8841
8863
|
}
|
|
8842
8864
|
|
|
8865
|
+
// EXTERNAL MODULE: ./src/display/editor/color_picker.js
|
|
8866
|
+
var color_picker = __webpack_require__(97);
|
|
8867
|
+
// EXTERNAL MODULE: ./src/display/editor/outliner.js
|
|
8868
|
+
var editor_outliner = __webpack_require__(405);
|
|
8869
|
+
;// CONCATENATED MODULE: ./src/display/editor/highlight.js
|
|
8870
|
+
|
|
8871
|
+
|
|
8872
|
+
|
|
8873
|
+
|
|
8874
|
+
|
|
8875
|
+
class HighlightEditor extends editor_editor.AnnotationEditor {
|
|
8876
|
+
#boxes;
|
|
8877
|
+
#clipPathId = null;
|
|
8878
|
+
#colorPicker = null;
|
|
8879
|
+
#focusOutlines = null;
|
|
8880
|
+
#highlightDiv = null;
|
|
8881
|
+
#highlightOutlines = null;
|
|
8882
|
+
#id = null;
|
|
8883
|
+
#lastPoint = null;
|
|
8884
|
+
#opacity;
|
|
8885
|
+
#outlineId = null;
|
|
8886
|
+
static _defaultColor = null;
|
|
8887
|
+
static _defaultOpacity = 1;
|
|
8888
|
+
static _l10nPromise;
|
|
8889
|
+
static _type = "highlight";
|
|
8890
|
+
static _editorType = util.AnnotationEditorType.HIGHLIGHT;
|
|
8891
|
+
constructor(params) {
|
|
8892
|
+
super({
|
|
8893
|
+
...params,
|
|
8894
|
+
name: "highlightEditor"
|
|
8895
|
+
});
|
|
8896
|
+
HighlightEditor._defaultColor ||= this._uiManager.highlightColors?.values().next().value || "#fff066";
|
|
8897
|
+
this.color = params.color || HighlightEditor._defaultColor;
|
|
8898
|
+
this.#opacity = params.opacity || HighlightEditor._defaultOpacity;
|
|
8899
|
+
this.#boxes = params.boxes || null;
|
|
8900
|
+
this._isDraggable = false;
|
|
8901
|
+
this.#createOutlines();
|
|
8902
|
+
this.#addToDrawLayer();
|
|
8903
|
+
this.rotate(this.rotation);
|
|
8904
|
+
}
|
|
8905
|
+
#createOutlines() {
|
|
8906
|
+
const outliner = new editor_outliner.Outliner(this.#boxes, 0.001);
|
|
8907
|
+
this.#highlightOutlines = outliner.getOutlines();
|
|
8908
|
+
({
|
|
8909
|
+
x: this.x,
|
|
8910
|
+
y: this.y,
|
|
8911
|
+
width: this.width,
|
|
8912
|
+
height: this.height
|
|
8913
|
+
} = this.#highlightOutlines.box);
|
|
8914
|
+
const outlinerForOutline = new editor_outliner.Outliner(this.#boxes, 0.0025, 0.001, this._uiManager.direction === "ltr");
|
|
8915
|
+
this.#focusOutlines = outlinerForOutline.getOutlines();
|
|
8916
|
+
const {
|
|
8917
|
+
lastPoint
|
|
8918
|
+
} = this.#focusOutlines.box;
|
|
8919
|
+
this.#lastPoint = [(lastPoint[0] - this.x) / this.width, (lastPoint[1] - this.y) / this.height];
|
|
8920
|
+
}
|
|
8921
|
+
static initialize(l10n) {
|
|
8922
|
+
editor_editor.AnnotationEditor.initialize(l10n);
|
|
8923
|
+
}
|
|
8924
|
+
static updateDefaultParams(type, value) {
|
|
8925
|
+
switch (type) {
|
|
8926
|
+
case util.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:
|
|
8927
|
+
HighlightEditor._defaultColor = value;
|
|
8928
|
+
break;
|
|
8929
|
+
}
|
|
8930
|
+
}
|
|
8931
|
+
get toolbarPosition() {
|
|
8932
|
+
return this.#lastPoint;
|
|
8933
|
+
}
|
|
8934
|
+
updateParams(type, value) {
|
|
8935
|
+
switch (type) {
|
|
8936
|
+
case util.AnnotationEditorParamsType.HIGHLIGHT_COLOR:
|
|
8937
|
+
this.#updateColor(value);
|
|
8938
|
+
break;
|
|
8939
|
+
}
|
|
8940
|
+
}
|
|
8941
|
+
static get defaultPropertiesToUpdate() {
|
|
8942
|
+
return [[util.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR, HighlightEditor._defaultColor]];
|
|
8943
|
+
}
|
|
8944
|
+
get propertiesToUpdate() {
|
|
8945
|
+
return [[util.AnnotationEditorParamsType.HIGHLIGHT_COLOR, this.color || HighlightEditor._defaultColor]];
|
|
8946
|
+
}
|
|
8947
|
+
#updateColor(color) {
|
|
8948
|
+
const savedColor = this.color;
|
|
8949
|
+
this.addCommands({
|
|
8950
|
+
cmd: () => {
|
|
8951
|
+
this.color = color;
|
|
8952
|
+
this.parent.drawLayer.changeColor(this.#id, color);
|
|
8953
|
+
this.#colorPicker?.updateColor(color);
|
|
8954
|
+
},
|
|
8955
|
+
undo: () => {
|
|
8956
|
+
this.color = savedColor;
|
|
8957
|
+
this.parent.drawLayer.changeColor(this.#id, savedColor);
|
|
8958
|
+
this.#colorPicker?.updateColor(savedColor);
|
|
8959
|
+
},
|
|
8960
|
+
mustExec: true,
|
|
8961
|
+
type: util.AnnotationEditorParamsType.HIGHLIGHT_COLOR,
|
|
8962
|
+
overwriteIfSameType: true,
|
|
8963
|
+
keepUndo: true
|
|
8964
|
+
});
|
|
8965
|
+
}
|
|
8966
|
+
async addEditToolbar() {
|
|
8967
|
+
const toolbar = await super.addEditToolbar();
|
|
8968
|
+
if (!toolbar) {
|
|
8969
|
+
return null;
|
|
8970
|
+
}
|
|
8971
|
+
if (this._uiManager.highlightColors) {
|
|
8972
|
+
this.#colorPicker = new color_picker.ColorPicker({
|
|
8973
|
+
editor: this
|
|
8974
|
+
});
|
|
8975
|
+
toolbar.addColorPicker(this.#colorPicker);
|
|
8976
|
+
}
|
|
8977
|
+
return toolbar;
|
|
8978
|
+
}
|
|
8979
|
+
disableEditing() {
|
|
8980
|
+
super.disableEditing();
|
|
8981
|
+
this.div.classList.toggle("disabled", true);
|
|
8982
|
+
}
|
|
8983
|
+
enableEditing() {
|
|
8984
|
+
super.enableEditing();
|
|
8985
|
+
this.div.classList.toggle("disabled", false);
|
|
8986
|
+
}
|
|
8987
|
+
fixAndSetPosition() {
|
|
8988
|
+
return super.fixAndSetPosition(0);
|
|
8989
|
+
}
|
|
8990
|
+
getRect(tx, ty) {
|
|
8991
|
+
return super.getRect(tx, ty, 0);
|
|
8992
|
+
}
|
|
8993
|
+
onceAdded() {
|
|
8994
|
+
this.parent.addUndoableEditor(this);
|
|
8995
|
+
this.div.focus();
|
|
8996
|
+
}
|
|
8997
|
+
remove() {
|
|
8998
|
+
super.remove();
|
|
8999
|
+
this.#cleanDrawLayer();
|
|
9000
|
+
}
|
|
9001
|
+
rebuild() {
|
|
9002
|
+
if (!this.parent) {
|
|
9003
|
+
return;
|
|
9004
|
+
}
|
|
9005
|
+
super.rebuild();
|
|
9006
|
+
if (this.div === null) {
|
|
9007
|
+
return;
|
|
9008
|
+
}
|
|
9009
|
+
this.#addToDrawLayer();
|
|
9010
|
+
if (!this.isAttachedToDOM) {
|
|
9011
|
+
this.parent.add(this);
|
|
9012
|
+
}
|
|
9013
|
+
}
|
|
9014
|
+
setParent(parent) {
|
|
9015
|
+
let mustBeSelected = false;
|
|
9016
|
+
if (this.parent && !parent) {
|
|
9017
|
+
this.#cleanDrawLayer();
|
|
9018
|
+
} else if (parent) {
|
|
9019
|
+
this.#addToDrawLayer(parent);
|
|
9020
|
+
mustBeSelected = !this.parent && this.div?.classList.contains("selectedEditor");
|
|
9021
|
+
}
|
|
9022
|
+
super.setParent(parent);
|
|
9023
|
+
if (mustBeSelected) {
|
|
9024
|
+
this.select();
|
|
9025
|
+
}
|
|
9026
|
+
}
|
|
9027
|
+
#cleanDrawLayer() {
|
|
9028
|
+
if (this.#id === null || !this.parent) {
|
|
9029
|
+
return;
|
|
9030
|
+
}
|
|
9031
|
+
this.parent.drawLayer.remove(this.#id);
|
|
9032
|
+
this.#id = null;
|
|
9033
|
+
this.parent.drawLayer.remove(this.#outlineId);
|
|
9034
|
+
this.#outlineId = null;
|
|
9035
|
+
}
|
|
9036
|
+
#addToDrawLayer(parent = this.parent) {
|
|
9037
|
+
if (this.#id !== null) {
|
|
9038
|
+
return;
|
|
9039
|
+
}
|
|
9040
|
+
({
|
|
9041
|
+
id: this.#id,
|
|
9042
|
+
clipPathId: this.#clipPathId
|
|
9043
|
+
} = parent.drawLayer.highlight(this.#highlightOutlines, this.color, this.#opacity));
|
|
9044
|
+
if (this.#highlightDiv) {
|
|
9045
|
+
this.#highlightDiv.style.clipPath = this.#clipPathId;
|
|
9046
|
+
}
|
|
9047
|
+
this.#outlineId = parent.drawLayer.highlightOutline(this.#focusOutlines);
|
|
9048
|
+
}
|
|
9049
|
+
static #rotateBbox({
|
|
9050
|
+
x,
|
|
9051
|
+
y,
|
|
9052
|
+
width,
|
|
9053
|
+
height
|
|
9054
|
+
}, angle) {
|
|
9055
|
+
switch (angle) {
|
|
9056
|
+
case 90:
|
|
9057
|
+
return {
|
|
9058
|
+
x: 1 - y - height,
|
|
9059
|
+
y: x,
|
|
9060
|
+
width: height,
|
|
9061
|
+
height: width
|
|
9062
|
+
};
|
|
9063
|
+
case 180:
|
|
9064
|
+
return {
|
|
9065
|
+
x: 1 - x - width,
|
|
9066
|
+
y: 1 - y - height,
|
|
9067
|
+
width,
|
|
9068
|
+
height
|
|
9069
|
+
};
|
|
9070
|
+
case 270:
|
|
9071
|
+
return {
|
|
9072
|
+
x: y,
|
|
9073
|
+
y: 1 - x - width,
|
|
9074
|
+
width: height,
|
|
9075
|
+
height: width
|
|
9076
|
+
};
|
|
9077
|
+
}
|
|
9078
|
+
return {
|
|
9079
|
+
x,
|
|
9080
|
+
y,
|
|
9081
|
+
width,
|
|
9082
|
+
height
|
|
9083
|
+
};
|
|
9084
|
+
}
|
|
9085
|
+
rotate(angle) {
|
|
9086
|
+
const {
|
|
9087
|
+
drawLayer
|
|
9088
|
+
} = this.parent;
|
|
9089
|
+
drawLayer.rotate(this.#id, angle);
|
|
9090
|
+
drawLayer.rotate(this.#outlineId, angle);
|
|
9091
|
+
drawLayer.updateBox(this.#id, HighlightEditor.#rotateBbox(this, angle));
|
|
9092
|
+
drawLayer.updateBox(this.#outlineId, HighlightEditor.#rotateBbox(this.#focusOutlines.box, angle));
|
|
9093
|
+
}
|
|
9094
|
+
render() {
|
|
9095
|
+
if (this.div) {
|
|
9096
|
+
return this.div;
|
|
9097
|
+
}
|
|
9098
|
+
const div = super.render();
|
|
9099
|
+
const highlightDiv = this.#highlightDiv = document.createElement("div");
|
|
9100
|
+
div.append(highlightDiv);
|
|
9101
|
+
highlightDiv.className = "internal";
|
|
9102
|
+
highlightDiv.style.clipPath = this.#clipPathId;
|
|
9103
|
+
const [parentWidth, parentHeight] = this.parentDimensions;
|
|
9104
|
+
this.setDims(this.width * parentWidth, this.height * parentHeight);
|
|
9105
|
+
(0,tools.bindEvents)(this, this.#highlightDiv, ["pointerover", "pointerleave"]);
|
|
9106
|
+
this.enableEditing();
|
|
9107
|
+
return div;
|
|
9108
|
+
}
|
|
9109
|
+
pointerover() {
|
|
9110
|
+
this.parent.drawLayer.addClass(this.#outlineId, "hovered");
|
|
9111
|
+
}
|
|
9112
|
+
pointerleave() {
|
|
9113
|
+
this.parent.drawLayer.removeClass(this.#outlineId, "hovered");
|
|
9114
|
+
}
|
|
9115
|
+
select() {
|
|
9116
|
+
super.select();
|
|
9117
|
+
this.parent?.drawLayer.removeClass(this.#outlineId, "hovered");
|
|
9118
|
+
this.parent?.drawLayer.addClass(this.#outlineId, "selected");
|
|
9119
|
+
}
|
|
9120
|
+
unselect() {
|
|
9121
|
+
super.unselect();
|
|
9122
|
+
this.parent?.drawLayer.removeClass(this.#outlineId, "selected");
|
|
9123
|
+
}
|
|
9124
|
+
#serializeBoxes() {
|
|
9125
|
+
const [pageWidth, pageHeight] = this.pageDimensions;
|
|
9126
|
+
const boxes = this.#boxes;
|
|
9127
|
+
const quadPoints = new Array(boxes.length * 8);
|
|
9128
|
+
let i = 0;
|
|
9129
|
+
for (const {
|
|
9130
|
+
x,
|
|
9131
|
+
y,
|
|
9132
|
+
width,
|
|
9133
|
+
height
|
|
9134
|
+
} of boxes) {
|
|
9135
|
+
const sx = x * pageWidth;
|
|
9136
|
+
const sy = (1 - y - height) * pageHeight;
|
|
9137
|
+
quadPoints[i] = quadPoints[i + 4] = sx;
|
|
9138
|
+
quadPoints[i + 1] = quadPoints[i + 3] = sy;
|
|
9139
|
+
quadPoints[i + 2] = quadPoints[i + 6] = sx + width * pageWidth;
|
|
9140
|
+
quadPoints[i + 5] = quadPoints[i + 7] = sy + height * pageHeight;
|
|
9141
|
+
i += 8;
|
|
9142
|
+
}
|
|
9143
|
+
return quadPoints;
|
|
9144
|
+
}
|
|
9145
|
+
#serializeOutlines() {
|
|
9146
|
+
const [pageWidth, pageHeight] = this.pageDimensions;
|
|
9147
|
+
const width = this.width * pageWidth;
|
|
9148
|
+
const height = this.height * pageHeight;
|
|
9149
|
+
const tx = this.x * pageWidth;
|
|
9150
|
+
const ty = (1 - this.y - this.height) * pageHeight;
|
|
9151
|
+
const outlines = [];
|
|
9152
|
+
for (const outline of this.#highlightOutlines.outlines) {
|
|
9153
|
+
const points = new Array(outline.length);
|
|
9154
|
+
for (let i = 0; i < outline.length; i += 2) {
|
|
9155
|
+
points[i] = tx + outline[i] * width;
|
|
9156
|
+
points[i + 1] = ty + (1 - outline[i + 1]) * height;
|
|
9157
|
+
}
|
|
9158
|
+
outlines.push(points);
|
|
9159
|
+
}
|
|
9160
|
+
return outlines;
|
|
9161
|
+
}
|
|
9162
|
+
static deserialize(data, parent, uiManager) {
|
|
9163
|
+
const editor = super.deserialize(data, parent, uiManager);
|
|
9164
|
+
const {
|
|
9165
|
+
rect,
|
|
9166
|
+
color,
|
|
9167
|
+
quadPoints
|
|
9168
|
+
} = data;
|
|
9169
|
+
editor.color = util.Util.makeHexColor(...color);
|
|
9170
|
+
editor.#opacity = data.opacity;
|
|
9171
|
+
const [pageWidth, pageHeight] = editor.pageDimensions;
|
|
9172
|
+
editor.width = (rect[2] - rect[0]) / pageWidth;
|
|
9173
|
+
editor.height = (rect[3] - rect[1]) / pageHeight;
|
|
9174
|
+
const boxes = editor.#boxes = [];
|
|
9175
|
+
for (let i = 0; i < quadPoints.length; i += 8) {
|
|
9176
|
+
boxes.push({
|
|
9177
|
+
x: quadPoints[4] / pageWidth,
|
|
9178
|
+
y: 1 - quadPoints[i + 5] / pageHeight,
|
|
9179
|
+
width: (quadPoints[i + 2] - quadPoints[i]) / pageWidth,
|
|
9180
|
+
height: (quadPoints[i + 5] - quadPoints[i + 1]) / pageHeight
|
|
9181
|
+
});
|
|
9182
|
+
}
|
|
9183
|
+
editor.#createOutlines();
|
|
9184
|
+
return editor;
|
|
9185
|
+
}
|
|
9186
|
+
serialize(isForCopying = false) {
|
|
9187
|
+
if (this.isEmpty() || isForCopying) {
|
|
9188
|
+
return null;
|
|
9189
|
+
}
|
|
9190
|
+
const rect = this.getRect(0, 0);
|
|
9191
|
+
const color = editor_editor.AnnotationEditor._colorManager.convert(this.color);
|
|
9192
|
+
return {
|
|
9193
|
+
annotationType: util.AnnotationEditorType.HIGHLIGHT,
|
|
9194
|
+
color,
|
|
9195
|
+
opacity: this.#opacity,
|
|
9196
|
+
quadPoints: this.#serializeBoxes(),
|
|
9197
|
+
outlines: this.#serializeOutlines(),
|
|
9198
|
+
pageIndex: this.pageIndex,
|
|
9199
|
+
rect,
|
|
9200
|
+
rotation: 0,
|
|
9201
|
+
structTreeParentId: this._structTreeParentId
|
|
9202
|
+
};
|
|
9203
|
+
}
|
|
9204
|
+
static canCreateNewEmptyEditor() {
|
|
9205
|
+
return false;
|
|
9206
|
+
}
|
|
9207
|
+
}
|
|
9208
|
+
|
|
8843
9209
|
// EXTERNAL MODULE: ./src/display/display_utils.js
|
|
8844
9210
|
var display_utils = __webpack_require__(473);
|
|
8845
9211
|
;// CONCATENATED MODULE: ./src/display/editor/ink.js
|
|
@@ -9277,7 +9643,7 @@ class InkEditor extends editor_editor.AnnotationEditor {
|
|
|
9277
9643
|
}
|
|
9278
9644
|
this.setInForeground();
|
|
9279
9645
|
event.preventDefault();
|
|
9280
|
-
if (
|
|
9646
|
+
if (!this.div.contains(document.activeElement)) {
|
|
9281
9647
|
this.div.focus({
|
|
9282
9648
|
preventScroll: true
|
|
9283
9649
|
});
|
|
@@ -10034,26 +10400,32 @@ class StampEditor extends editor_editor.AnnotationEditor {
|
|
|
10034
10400
|
|
|
10035
10401
|
|
|
10036
10402
|
|
|
10403
|
+
|
|
10037
10404
|
class AnnotationEditorLayer {
|
|
10038
10405
|
#accessibilityManager;
|
|
10039
10406
|
#allowClick = false;
|
|
10040
10407
|
#annotationLayer = null;
|
|
10041
10408
|
#boundPointerup = this.pointerup.bind(this);
|
|
10409
|
+
#boundPointerUpAfterSelection = this.pointerUpAfterSelection.bind(this);
|
|
10042
10410
|
#boundPointerdown = this.pointerdown.bind(this);
|
|
10043
10411
|
#editorFocusTimeoutId = null;
|
|
10412
|
+
#boundSelectionStart = this.selectionStart.bind(this);
|
|
10044
10413
|
#editors = new Map();
|
|
10045
10414
|
#hadPointerDown = false;
|
|
10046
10415
|
#isCleaningUp = false;
|
|
10047
10416
|
#isDisabling = false;
|
|
10417
|
+
#textLayer = null;
|
|
10048
10418
|
#uiManager;
|
|
10049
10419
|
static _initialized = false;
|
|
10050
|
-
static #editorTypes = new Map([FreeTextEditor, InkEditor, StampEditor].map(type => [type._editorType, type]));
|
|
10420
|
+
static #editorTypes = new Map([FreeTextEditor, InkEditor, StampEditor, HighlightEditor].map(type => [type._editorType, type]));
|
|
10051
10421
|
constructor({
|
|
10052
10422
|
uiManager,
|
|
10053
10423
|
pageIndex,
|
|
10054
10424
|
div,
|
|
10055
10425
|
accessibilityManager,
|
|
10056
10426
|
annotationLayer,
|
|
10427
|
+
drawLayer,
|
|
10428
|
+
textLayer,
|
|
10057
10429
|
viewport,
|
|
10058
10430
|
l10n
|
|
10059
10431
|
}) {
|
|
@@ -10071,6 +10443,8 @@ class AnnotationEditorLayer {
|
|
|
10071
10443
|
this.#accessibilityManager = accessibilityManager;
|
|
10072
10444
|
this.#annotationLayer = annotationLayer;
|
|
10073
10445
|
this.viewport = viewport;
|
|
10446
|
+
this.#textLayer = textLayer;
|
|
10447
|
+
this.drawLayer = drawLayer;
|
|
10074
10448
|
this.#uiManager.addLayer(this);
|
|
10075
10449
|
}
|
|
10076
10450
|
get isEmpty() {
|
|
@@ -10081,11 +10455,27 @@ class AnnotationEditorLayer {
|
|
|
10081
10455
|
}
|
|
10082
10456
|
updateMode(mode = this.#uiManager.getMode()) {
|
|
10083
10457
|
this.#cleanup();
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10458
|
+
switch (mode) {
|
|
10459
|
+
case util.AnnotationEditorType.NONE:
|
|
10460
|
+
this.disableTextSelection();
|
|
10461
|
+
this.togglePointerEvents(false);
|
|
10462
|
+
this.disableClick();
|
|
10463
|
+
break;
|
|
10464
|
+
case util.AnnotationEditorType.INK:
|
|
10465
|
+
this.addInkEditorIfNeeded(false);
|
|
10466
|
+
this.disableTextSelection();
|
|
10467
|
+
this.togglePointerEvents(true);
|
|
10468
|
+
this.disableClick();
|
|
10469
|
+
break;
|
|
10470
|
+
case util.AnnotationEditorType.HIGHLIGHT:
|
|
10471
|
+
this.enableTextSelection();
|
|
10472
|
+
this.togglePointerEvents(false);
|
|
10473
|
+
this.disableClick();
|
|
10474
|
+
break;
|
|
10475
|
+
default:
|
|
10476
|
+
this.disableTextSelection();
|
|
10477
|
+
this.togglePointerEvents(true);
|
|
10478
|
+
this.enableClick();
|
|
10089
10479
|
}
|
|
10090
10480
|
if (mode !== util.AnnotationEditorType.NONE) {
|
|
10091
10481
|
const {
|
|
@@ -10098,7 +10488,7 @@ class AnnotationEditorLayer {
|
|
|
10098
10488
|
}
|
|
10099
10489
|
}
|
|
10100
10490
|
addInkEditorIfNeeded(isCommitting) {
|
|
10101
|
-
if (
|
|
10491
|
+
if (this.#uiManager.getMode() !== util.AnnotationEditorType.INK) {
|
|
10102
10492
|
return;
|
|
10103
10493
|
}
|
|
10104
10494
|
if (!isCommitting) {
|
|
@@ -10188,6 +10578,7 @@ class AnnotationEditorLayer {
|
|
|
10188
10578
|
for (const editorType of AnnotationEditorLayer.#editorTypes.values()) {
|
|
10189
10579
|
classList.remove(`${editorType._type}Editing`);
|
|
10190
10580
|
}
|
|
10581
|
+
this.disableTextSelection();
|
|
10191
10582
|
this.#isDisabling = false;
|
|
10192
10583
|
}
|
|
10193
10584
|
getEditableAnnotation(id) {
|
|
@@ -10200,6 +10591,16 @@ class AnnotationEditorLayer {
|
|
|
10200
10591
|
}
|
|
10201
10592
|
this.#uiManager.setActiveEditor(editor);
|
|
10202
10593
|
}
|
|
10594
|
+
enableTextSelection() {
|
|
10595
|
+
if (this.#textLayer?.div) {
|
|
10596
|
+
document.addEventListener("selectstart", this.#boundSelectionStart);
|
|
10597
|
+
}
|
|
10598
|
+
}
|
|
10599
|
+
disableTextSelection() {
|
|
10600
|
+
if (this.#textLayer?.div) {
|
|
10601
|
+
document.removeEventListener("selectstart", this.#boundSelectionStart);
|
|
10602
|
+
}
|
|
10603
|
+
}
|
|
10203
10604
|
enableClick() {
|
|
10204
10605
|
this.div.addEventListener("pointerdown", this.#boundPointerdown);
|
|
10205
10606
|
this.div.addEventListener("pointerup", this.#boundPointerup);
|
|
@@ -10310,10 +10711,16 @@ class AnnotationEditorLayer {
|
|
|
10310
10711
|
getNextId() {
|
|
10311
10712
|
return this.#uiManager.getId();
|
|
10312
10713
|
}
|
|
10714
|
+
get #currentEditorType() {
|
|
10715
|
+
return AnnotationEditorLayer.#editorTypes.get(this.#uiManager.getMode());
|
|
10716
|
+
}
|
|
10313
10717
|
#createNewEditor(params) {
|
|
10314
|
-
const editorType =
|
|
10718
|
+
const editorType = this.#currentEditorType;
|
|
10315
10719
|
return editorType ? new editorType.prototype.constructor(params) : null;
|
|
10316
10720
|
}
|
|
10721
|
+
canCreateNewEmptyEditor() {
|
|
10722
|
+
return this.#currentEditorType?.canCreateNewEmptyEditor();
|
|
10723
|
+
}
|
|
10317
10724
|
pasteEditor(mode, params) {
|
|
10318
10725
|
this.#uiManager.updateToolbar(mode);
|
|
10319
10726
|
this.#uiManager.updateMode(mode);
|
|
@@ -10338,7 +10745,7 @@ class AnnotationEditorLayer {
|
|
|
10338
10745
|
deserialize(data) {
|
|
10339
10746
|
return AnnotationEditorLayer.#editorTypes.get(data.annotationType ?? data.annotationEditorType)?.deserialize(data, this, this.#uiManager) || null;
|
|
10340
10747
|
}
|
|
10341
|
-
#createAndAddNewEditor(event, isCentered) {
|
|
10748
|
+
#createAndAddNewEditor(event, isCentered, data = {}) {
|
|
10342
10749
|
const id = this.getNextId();
|
|
10343
10750
|
const editor = this.#createNewEditor({
|
|
10344
10751
|
parent: this,
|
|
@@ -10346,7 +10753,8 @@ class AnnotationEditorLayer {
|
|
|
10346
10753
|
x: event.offsetX,
|
|
10347
10754
|
y: event.offsetY,
|
|
10348
10755
|
uiManager: this.#uiManager,
|
|
10349
|
-
isCentered
|
|
10756
|
+
isCentered,
|
|
10757
|
+
...data
|
|
10350
10758
|
});
|
|
10351
10759
|
if (editor) {
|
|
10352
10760
|
this.add(editor);
|
|
@@ -10387,6 +10795,84 @@ class AnnotationEditorLayer {
|
|
|
10387
10795
|
unselect(editor) {
|
|
10388
10796
|
this.#uiManager.unselect(editor);
|
|
10389
10797
|
}
|
|
10798
|
+
selectionStart(_event) {
|
|
10799
|
+
this.#textLayer?.div.addEventListener("pointerup", this.#boundPointerUpAfterSelection, {
|
|
10800
|
+
once: true
|
|
10801
|
+
});
|
|
10802
|
+
}
|
|
10803
|
+
pointerUpAfterSelection(event) {
|
|
10804
|
+
const selection = document.getSelection();
|
|
10805
|
+
if (selection.rangeCount === 0) {
|
|
10806
|
+
return;
|
|
10807
|
+
}
|
|
10808
|
+
const range = selection.getRangeAt(0);
|
|
10809
|
+
if (range.collapsed) {
|
|
10810
|
+
return;
|
|
10811
|
+
}
|
|
10812
|
+
if (!this.#textLayer?.div.contains(range.commonAncestorContainer)) {
|
|
10813
|
+
return;
|
|
10814
|
+
}
|
|
10815
|
+
const {
|
|
10816
|
+
x: layerX,
|
|
10817
|
+
y: layerY,
|
|
10818
|
+
width: parentWidth,
|
|
10819
|
+
height: parentHeight
|
|
10820
|
+
} = this.#textLayer.div.getBoundingClientRect();
|
|
10821
|
+
const bboxes = range.getClientRects();
|
|
10822
|
+
let rotator;
|
|
10823
|
+
switch (this.viewport.rotation) {
|
|
10824
|
+
case 90:
|
|
10825
|
+
rotator = (x, y, w, h) => ({
|
|
10826
|
+
x: (y - layerY) / parentHeight,
|
|
10827
|
+
y: 1 - (x + w - layerX) / parentWidth,
|
|
10828
|
+
width: h / parentHeight,
|
|
10829
|
+
height: w / parentWidth
|
|
10830
|
+
});
|
|
10831
|
+
break;
|
|
10832
|
+
case 180:
|
|
10833
|
+
rotator = (x, y, w, h) => ({
|
|
10834
|
+
x: 1 - (x + w - layerX) / parentWidth,
|
|
10835
|
+
y: 1 - (y + h - layerY) / parentHeight,
|
|
10836
|
+
width: w / parentWidth,
|
|
10837
|
+
height: h / parentHeight
|
|
10838
|
+
});
|
|
10839
|
+
break;
|
|
10840
|
+
case 270:
|
|
10841
|
+
rotator = (x, y, w, h) => ({
|
|
10842
|
+
x: 1 - (y + h - layerY) / parentHeight,
|
|
10843
|
+
y: (x - layerX) / parentWidth,
|
|
10844
|
+
width: h / parentHeight,
|
|
10845
|
+
height: w / parentWidth
|
|
10846
|
+
});
|
|
10847
|
+
break;
|
|
10848
|
+
default:
|
|
10849
|
+
rotator = (x, y, w, h) => ({
|
|
10850
|
+
x: (x - layerX) / parentWidth,
|
|
10851
|
+
y: (y - layerY) / parentHeight,
|
|
10852
|
+
width: w / parentWidth,
|
|
10853
|
+
height: h / parentHeight
|
|
10854
|
+
});
|
|
10855
|
+
break;
|
|
10856
|
+
}
|
|
10857
|
+
const boxes = [];
|
|
10858
|
+
for (const {
|
|
10859
|
+
x,
|
|
10860
|
+
y,
|
|
10861
|
+
width,
|
|
10862
|
+
height
|
|
10863
|
+
} of bboxes) {
|
|
10864
|
+
if (width === 0 || height === 0) {
|
|
10865
|
+
continue;
|
|
10866
|
+
}
|
|
10867
|
+
boxes.push(rotator(x, y, width, height));
|
|
10868
|
+
}
|
|
10869
|
+
if (boxes.length !== 0) {
|
|
10870
|
+
this.#createAndAddNewEditor(event, false, {
|
|
10871
|
+
boxes
|
|
10872
|
+
});
|
|
10873
|
+
}
|
|
10874
|
+
selection.empty();
|
|
10875
|
+
}
|
|
10390
10876
|
pointerup(event) {
|
|
10391
10877
|
const {
|
|
10392
10878
|
isMac
|
|
@@ -10412,6 +10898,9 @@ class AnnotationEditorLayer {
|
|
|
10412
10898
|
this.#createAndAddNewEditor(event, false);
|
|
10413
10899
|
}
|
|
10414
10900
|
pointerdown(event) {
|
|
10901
|
+
if (this.#uiManager.getMode() === util.AnnotationEditorType.HIGHLIGHT) {
|
|
10902
|
+
this.enableTextSelection();
|
|
10903
|
+
}
|
|
10415
10904
|
if (this.#hadPointerDown) {
|
|
10416
10905
|
this.#hadPointerDown = false;
|
|
10417
10906
|
return;
|
|
@@ -10479,10 +10968,17 @@ class AnnotationEditorLayer {
|
|
|
10479
10968
|
viewport
|
|
10480
10969
|
}) {
|
|
10481
10970
|
this.#uiManager.commitOrRemove();
|
|
10971
|
+
const oldRotation = this.viewport.rotation;
|
|
10972
|
+
const rotation = viewport.rotation;
|
|
10482
10973
|
this.viewport = viewport;
|
|
10483
10974
|
(0,display_utils.setLayerDimensions)(this.div, {
|
|
10484
|
-
rotation
|
|
10975
|
+
rotation
|
|
10485
10976
|
});
|
|
10977
|
+
if (oldRotation !== rotation) {
|
|
10978
|
+
for (const editor of this.#editors.values()) {
|
|
10979
|
+
editor.rotate(rotation);
|
|
10980
|
+
}
|
|
10981
|
+
}
|
|
10486
10982
|
this.updateMode();
|
|
10487
10983
|
}
|
|
10488
10984
|
get pageDimensions() {
|
|
@@ -10497,11 +10993,176 @@ class AnnotationEditorLayer {
|
|
|
10497
10993
|
|
|
10498
10994
|
/***/ }),
|
|
10499
10995
|
|
|
10500
|
-
/***/
|
|
10996
|
+
/***/ 97:
|
|
10501
10997
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
10502
10998
|
|
|
10503
|
-
|
|
10504
|
-
|
|
10999
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11000
|
+
/* harmony export */ ColorPicker: () => (/* binding */ ColorPicker)
|
|
11001
|
+
/* harmony export */ });
|
|
11002
|
+
/* harmony import */ var _shared_util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(266);
|
|
11003
|
+
/* harmony import */ var _tools_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(812);
|
|
11004
|
+
/* harmony import */ var _display_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(473);
|
|
11005
|
+
|
|
11006
|
+
|
|
11007
|
+
|
|
11008
|
+
class ColorPicker {
|
|
11009
|
+
#boundKeyDown = this.#keyDown.bind(this);
|
|
11010
|
+
#button = null;
|
|
11011
|
+
#buttonSwatch = null;
|
|
11012
|
+
#defaultColor;
|
|
11013
|
+
#dropdown = null;
|
|
11014
|
+
#dropdownWasFromKeyboard = false;
|
|
11015
|
+
#isMainColorPicker = false;
|
|
11016
|
+
#eventBus;
|
|
11017
|
+
#uiManager = null;
|
|
11018
|
+
static get _keyboardManager() {
|
|
11019
|
+
return (0,_shared_util_js__WEBPACK_IMPORTED_MODULE_0__.shadow)(this, "_keyboardManager", new _tools_js__WEBPACK_IMPORTED_MODULE_1__.KeyboardManager([[["Escape", "mac+Escape"], ColorPicker.prototype._hideDropdownFromKeyboard], [[" ", "mac+ "], ColorPicker.prototype._colorSelectFromKeyboard], [["ArrowDown", "ArrowRight", "mac+ArrowDown", "mac+ArrowRight"], ColorPicker.prototype._moveToNext], [["ArrowUp", "ArrowLeft", "mac+ArrowUp", "mac+ArrowLeft"], ColorPicker.prototype._moveToPrevious], [["Home", "mac+Home"], ColorPicker.prototype._moveToBeginning], [["End", "mac+End"], ColorPicker.prototype._moveToEnd]]));
|
|
11020
|
+
}
|
|
11021
|
+
constructor({
|
|
11022
|
+
editor = null,
|
|
11023
|
+
uiManager = null
|
|
11024
|
+
}) {
|
|
11025
|
+
this.#isMainColorPicker = !editor;
|
|
11026
|
+
this.#uiManager = editor?._uiManager || uiManager;
|
|
11027
|
+
this.#eventBus = this.#uiManager._eventBus;
|
|
11028
|
+
this.#defaultColor = editor?.color || this.#uiManager?.highlightColors.values().next().value || "#FFFF98";
|
|
11029
|
+
}
|
|
11030
|
+
renderButton() {
|
|
11031
|
+
const button = this.#button = document.createElement("button");
|
|
11032
|
+
button.className = "colorPicker";
|
|
11033
|
+
button.tabIndex = "0";
|
|
11034
|
+
button.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-button");
|
|
11035
|
+
button.setAttribute("aria-haspopup", true);
|
|
11036
|
+
button.addEventListener("click", this.#openDropdown.bind(this));
|
|
11037
|
+
const swatch = this.#buttonSwatch = document.createElement("span");
|
|
11038
|
+
swatch.className = "swatch";
|
|
11039
|
+
swatch.style.backgroundColor = this.#defaultColor;
|
|
11040
|
+
button.append(swatch);
|
|
11041
|
+
return button;
|
|
11042
|
+
}
|
|
11043
|
+
renderMainDropdown() {
|
|
11044
|
+
const dropdown = this.#dropdown = this.#getDropdownRoot(_shared_util_js__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR);
|
|
11045
|
+
dropdown.setAttribute("aria-orientation", "horizontal");
|
|
11046
|
+
dropdown.setAttribute("aria-labelledby", "highlightColorPickerLabel");
|
|
11047
|
+
return dropdown;
|
|
11048
|
+
}
|
|
11049
|
+
#getDropdownRoot(paramType) {
|
|
11050
|
+
const div = document.createElement("div");
|
|
11051
|
+
div.addEventListener("contextmenu", _display_utils_js__WEBPACK_IMPORTED_MODULE_2__.noContextMenu);
|
|
11052
|
+
div.className = "dropdown";
|
|
11053
|
+
div.role = "listbox";
|
|
11054
|
+
div.setAttribute("aria-multiselectable", false);
|
|
11055
|
+
div.setAttribute("aria-orientation", "vertical");
|
|
11056
|
+
div.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-dropdown");
|
|
11057
|
+
for (const [name, color] of this.#uiManager.highlightColors) {
|
|
11058
|
+
const button = document.createElement("button");
|
|
11059
|
+
button.tabIndex = "0";
|
|
11060
|
+
button.role = "option";
|
|
11061
|
+
button.setAttribute("data-color", color);
|
|
11062
|
+
button.title = name;
|
|
11063
|
+
button.setAttribute("data-l10n-id", `pdfjs-editor-colorpicker-${name}`);
|
|
11064
|
+
const swatch = document.createElement("span");
|
|
11065
|
+
button.append(swatch);
|
|
11066
|
+
swatch.className = "swatch";
|
|
11067
|
+
swatch.style.backgroundColor = color;
|
|
11068
|
+
button.setAttribute("aria-selected", color === this.#defaultColor);
|
|
11069
|
+
button.addEventListener("click", this.#colorSelect.bind(this, paramType, color));
|
|
11070
|
+
div.append(button);
|
|
11071
|
+
}
|
|
11072
|
+
div.addEventListener("keydown", this.#boundKeyDown);
|
|
11073
|
+
return div;
|
|
11074
|
+
}
|
|
11075
|
+
#colorSelect(type, color, event) {
|
|
11076
|
+
event.stopPropagation();
|
|
11077
|
+
this.#eventBus.dispatch("switchannotationeditorparams", {
|
|
11078
|
+
source: this,
|
|
11079
|
+
type,
|
|
11080
|
+
value: color
|
|
11081
|
+
});
|
|
11082
|
+
}
|
|
11083
|
+
_colorSelectFromKeyboard(event) {
|
|
11084
|
+
const color = event.target.getAttribute("data-color");
|
|
11085
|
+
if (!color) {
|
|
11086
|
+
return;
|
|
11087
|
+
}
|
|
11088
|
+
this.#colorSelect(color, event);
|
|
11089
|
+
}
|
|
11090
|
+
_moveToNext(event) {
|
|
11091
|
+
if (event.target === this.#button) {
|
|
11092
|
+
this.#dropdown.firstChild?.focus();
|
|
11093
|
+
return;
|
|
11094
|
+
}
|
|
11095
|
+
event.target.nextSibling?.focus();
|
|
11096
|
+
}
|
|
11097
|
+
_moveToPrevious(event) {
|
|
11098
|
+
event.target.previousSibling?.focus();
|
|
11099
|
+
}
|
|
11100
|
+
_moveToBeginning() {
|
|
11101
|
+
this.#dropdown.firstChild?.focus();
|
|
11102
|
+
}
|
|
11103
|
+
_moveToEnd() {
|
|
11104
|
+
this.#dropdown.lastChild?.focus();
|
|
11105
|
+
}
|
|
11106
|
+
#keyDown(event) {
|
|
11107
|
+
ColorPicker._keyboardManager.exec(this, event);
|
|
11108
|
+
}
|
|
11109
|
+
#openDropdown(event) {
|
|
11110
|
+
if (this.#dropdown && !this.#dropdown.classList.contains("hidden")) {
|
|
11111
|
+
this.hideDropdown();
|
|
11112
|
+
return;
|
|
11113
|
+
}
|
|
11114
|
+
this.#button.addEventListener("keydown", this.#boundKeyDown);
|
|
11115
|
+
this.#dropdownWasFromKeyboard = event.detail === 0;
|
|
11116
|
+
if (this.#dropdown) {
|
|
11117
|
+
this.#dropdown.classList.remove("hidden");
|
|
11118
|
+
return;
|
|
11119
|
+
}
|
|
11120
|
+
const root = this.#dropdown = this.#getDropdownRoot(_shared_util_js__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.HIGHLIGHT_COLOR);
|
|
11121
|
+
this.#button.append(root);
|
|
11122
|
+
}
|
|
11123
|
+
hideDropdown() {
|
|
11124
|
+
this.#dropdown?.classList.add("hidden");
|
|
11125
|
+
}
|
|
11126
|
+
_hideDropdownFromKeyboard() {
|
|
11127
|
+
if (this.#isMainColorPicker || !this.#dropdown || this.#dropdown.classList.contains("hidden")) {
|
|
11128
|
+
return;
|
|
11129
|
+
}
|
|
11130
|
+
this.hideDropdown();
|
|
11131
|
+
this.#button.removeEventListener("keydown", this.#boundKeyDown);
|
|
11132
|
+
this.#button.focus({
|
|
11133
|
+
preventScroll: true,
|
|
11134
|
+
focusVisible: this.#dropdownWasFromKeyboard
|
|
11135
|
+
});
|
|
11136
|
+
}
|
|
11137
|
+
updateColor(color) {
|
|
11138
|
+
if (this.#buttonSwatch) {
|
|
11139
|
+
this.#buttonSwatch.style.backgroundColor = color;
|
|
11140
|
+
}
|
|
11141
|
+
if (!this.#dropdown) {
|
|
11142
|
+
return;
|
|
11143
|
+
}
|
|
11144
|
+
const i = this.#uiManager.highlightColors.values();
|
|
11145
|
+
for (const child of this.#dropdown.children) {
|
|
11146
|
+
child.setAttribute("aria-selected", i.next().value === color);
|
|
11147
|
+
}
|
|
11148
|
+
}
|
|
11149
|
+
destroy() {
|
|
11150
|
+
this.#button?.remove();
|
|
11151
|
+
this.#button = null;
|
|
11152
|
+
this.#buttonSwatch = null;
|
|
11153
|
+
this.#dropdown?.remove();
|
|
11154
|
+
this.#dropdown = null;
|
|
11155
|
+
}
|
|
11156
|
+
}
|
|
11157
|
+
|
|
11158
|
+
|
|
11159
|
+
/***/ }),
|
|
11160
|
+
|
|
11161
|
+
/***/ 115:
|
|
11162
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
11163
|
+
|
|
11164
|
+
|
|
11165
|
+
// EXPORTS
|
|
10505
11166
|
__webpack_require__.d(__webpack_exports__, {
|
|
10506
11167
|
AnnotationEditor: () => (/* binding */ AnnotationEditor)
|
|
10507
11168
|
});
|
|
@@ -10512,10 +11173,149 @@ var tools = __webpack_require__(812);
|
|
|
10512
11173
|
var util = __webpack_require__(266);
|
|
10513
11174
|
// EXTERNAL MODULE: ./src/display/display_utils.js
|
|
10514
11175
|
var display_utils = __webpack_require__(473);
|
|
11176
|
+
;// CONCATENATED MODULE: ./src/display/editor/alt_text.js
|
|
11177
|
+
|
|
11178
|
+
class AltText {
|
|
11179
|
+
#altText = "";
|
|
11180
|
+
#altTextDecorative = false;
|
|
11181
|
+
#altTextButton = null;
|
|
11182
|
+
#altTextTooltip = null;
|
|
11183
|
+
#altTextTooltipTimeout = null;
|
|
11184
|
+
#altTextWasFromKeyBoard = false;
|
|
11185
|
+
#editor = null;
|
|
11186
|
+
static _l10nPromise = null;
|
|
11187
|
+
constructor(editor) {
|
|
11188
|
+
this.#editor = editor;
|
|
11189
|
+
}
|
|
11190
|
+
static initialize(l10nPromise) {
|
|
11191
|
+
AltText._l10nPromise ||= l10nPromise;
|
|
11192
|
+
}
|
|
11193
|
+
async render() {
|
|
11194
|
+
const altText = this.#altTextButton = document.createElement("button");
|
|
11195
|
+
altText.className = "altText";
|
|
11196
|
+
const msg = await AltText._l10nPromise.get("pdfjs-editor-alt-text-button-label");
|
|
11197
|
+
altText.textContent = msg;
|
|
11198
|
+
altText.setAttribute("aria-label", msg);
|
|
11199
|
+
altText.tabIndex = "0";
|
|
11200
|
+
altText.addEventListener("contextmenu", display_utils.noContextMenu);
|
|
11201
|
+
altText.addEventListener("pointerdown", event => event.stopPropagation());
|
|
11202
|
+
const onClick = event => {
|
|
11203
|
+
event.preventDefault();
|
|
11204
|
+
this.#editor._uiManager.editAltText(this.#editor);
|
|
11205
|
+
};
|
|
11206
|
+
altText.addEventListener("click", onClick, {
|
|
11207
|
+
capture: true
|
|
11208
|
+
});
|
|
11209
|
+
altText.addEventListener("keydown", event => {
|
|
11210
|
+
if (event.target === altText && event.key === "Enter") {
|
|
11211
|
+
this.#altTextWasFromKeyBoard = true;
|
|
11212
|
+
onClick(event);
|
|
11213
|
+
}
|
|
11214
|
+
});
|
|
11215
|
+
await this.#setState();
|
|
11216
|
+
return altText;
|
|
11217
|
+
}
|
|
11218
|
+
finish() {
|
|
11219
|
+
if (!this.#altTextButton) {
|
|
11220
|
+
return;
|
|
11221
|
+
}
|
|
11222
|
+
this.#altTextButton.focus({
|
|
11223
|
+
focusVisible: this.#altTextWasFromKeyBoard
|
|
11224
|
+
});
|
|
11225
|
+
this.#altTextWasFromKeyBoard = false;
|
|
11226
|
+
}
|
|
11227
|
+
get data() {
|
|
11228
|
+
return {
|
|
11229
|
+
altText: this.#altText,
|
|
11230
|
+
decorative: this.#altTextDecorative
|
|
11231
|
+
};
|
|
11232
|
+
}
|
|
11233
|
+
set data({
|
|
11234
|
+
altText,
|
|
11235
|
+
decorative
|
|
11236
|
+
}) {
|
|
11237
|
+
if (this.#altText === altText && this.#altTextDecorative === decorative) {
|
|
11238
|
+
return;
|
|
11239
|
+
}
|
|
11240
|
+
this.#altText = altText;
|
|
11241
|
+
this.#altTextDecorative = decorative;
|
|
11242
|
+
this.#setState();
|
|
11243
|
+
}
|
|
11244
|
+
toggle(enabled = false) {
|
|
11245
|
+
if (!this.#altTextButton) {
|
|
11246
|
+
return;
|
|
11247
|
+
}
|
|
11248
|
+
if (!enabled && this.#altTextTooltipTimeout) {
|
|
11249
|
+
clearTimeout(this.#altTextTooltipTimeout);
|
|
11250
|
+
this.#altTextTooltipTimeout = null;
|
|
11251
|
+
}
|
|
11252
|
+
this.#altTextButton.disabled = !enabled;
|
|
11253
|
+
}
|
|
11254
|
+
destroy() {
|
|
11255
|
+
this.#altTextButton?.remove();
|
|
11256
|
+
this.#altTextButton = null;
|
|
11257
|
+
this.#altTextTooltip = null;
|
|
11258
|
+
}
|
|
11259
|
+
async #setState() {
|
|
11260
|
+
const button = this.#altTextButton;
|
|
11261
|
+
if (!button) {
|
|
11262
|
+
return;
|
|
11263
|
+
}
|
|
11264
|
+
if (!this.#altText && !this.#altTextDecorative) {
|
|
11265
|
+
button.classList.remove("done");
|
|
11266
|
+
this.#altTextTooltip?.remove();
|
|
11267
|
+
return;
|
|
11268
|
+
}
|
|
11269
|
+
button.classList.add("done");
|
|
11270
|
+
AltText._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(msg => {
|
|
11271
|
+
button.setAttribute("aria-label", msg);
|
|
11272
|
+
});
|
|
11273
|
+
let tooltip = this.#altTextTooltip;
|
|
11274
|
+
if (!tooltip) {
|
|
11275
|
+
this.#altTextTooltip = tooltip = document.createElement("span");
|
|
11276
|
+
tooltip.className = "tooltip";
|
|
11277
|
+
tooltip.setAttribute("role", "tooltip");
|
|
11278
|
+
const id = tooltip.id = `alt-text-tooltip-${this.#editor.id}`;
|
|
11279
|
+
button.setAttribute("aria-describedby", id);
|
|
11280
|
+
const DELAY_TO_SHOW_TOOLTIP = 100;
|
|
11281
|
+
button.addEventListener("mouseenter", () => {
|
|
11282
|
+
this.#altTextTooltipTimeout = setTimeout(() => {
|
|
11283
|
+
this.#altTextTooltipTimeout = null;
|
|
11284
|
+
this.#altTextTooltip.classList.add("show");
|
|
11285
|
+
this.#editor._uiManager._eventBus.dispatch("reporttelemetry", {
|
|
11286
|
+
source: this,
|
|
11287
|
+
details: {
|
|
11288
|
+
type: "editing",
|
|
11289
|
+
subtype: this.#editor.editorType,
|
|
11290
|
+
data: {
|
|
11291
|
+
action: "alt_text_tooltip"
|
|
11292
|
+
}
|
|
11293
|
+
}
|
|
11294
|
+
});
|
|
11295
|
+
}, DELAY_TO_SHOW_TOOLTIP);
|
|
11296
|
+
});
|
|
11297
|
+
button.addEventListener("mouseleave", () => {
|
|
11298
|
+
if (this.#altTextTooltipTimeout) {
|
|
11299
|
+
clearTimeout(this.#altTextTooltipTimeout);
|
|
11300
|
+
this.#altTextTooltipTimeout = null;
|
|
11301
|
+
}
|
|
11302
|
+
this.#altTextTooltip?.classList.remove("show");
|
|
11303
|
+
});
|
|
11304
|
+
}
|
|
11305
|
+
tooltip.innerText = this.#altTextDecorative ? await AltText._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip") : this.#altText;
|
|
11306
|
+
if (!tooltip.parentNode) {
|
|
11307
|
+
button.append(tooltip);
|
|
11308
|
+
}
|
|
11309
|
+
const element = this.#editor.getImageForAltText();
|
|
11310
|
+
element?.setAttribute("aria-describedby", tooltip.id);
|
|
11311
|
+
}
|
|
11312
|
+
}
|
|
11313
|
+
|
|
10515
11314
|
;// CONCATENATED MODULE: ./src/display/editor/toolbar.js
|
|
10516
11315
|
|
|
10517
11316
|
class EditorToolbar {
|
|
10518
11317
|
#toolbar = null;
|
|
11318
|
+
#colorPicker = null;
|
|
10519
11319
|
#editor;
|
|
10520
11320
|
#buttons = null;
|
|
10521
11321
|
constructor(editor) {
|
|
@@ -10529,6 +11329,15 @@ class EditorToolbar {
|
|
|
10529
11329
|
const buttons = this.#buttons = document.createElement("div");
|
|
10530
11330
|
buttons.className = "buttons";
|
|
10531
11331
|
editToolbar.append(buttons);
|
|
11332
|
+
const position = this.#editor.toolbarPosition;
|
|
11333
|
+
if (position) {
|
|
11334
|
+
const {
|
|
11335
|
+
style
|
|
11336
|
+
} = editToolbar;
|
|
11337
|
+
const x = this.#editor._uiManager.direction === "ltr" ? 1 - position[0] : position[0];
|
|
11338
|
+
style.insetInlineEnd = `${100 * x}%`;
|
|
11339
|
+
style.top = `calc(${100 * position[1]}% + var(--editor-toolbar-vert-offset))`;
|
|
11340
|
+
}
|
|
10532
11341
|
this.#addDeleteButton();
|
|
10533
11342
|
return editToolbar;
|
|
10534
11343
|
}
|
|
@@ -10556,6 +11365,7 @@ class EditorToolbar {
|
|
|
10556
11365
|
}
|
|
10557
11366
|
hide() {
|
|
10558
11367
|
this.#toolbar.classList.add("hidden");
|
|
11368
|
+
this.#colorPicker?.hideDropdown();
|
|
10559
11369
|
}
|
|
10560
11370
|
show() {
|
|
10561
11371
|
this.#toolbar.classList.remove("hidden");
|
|
@@ -10564,15 +11374,32 @@ class EditorToolbar {
|
|
|
10564
11374
|
const button = document.createElement("button");
|
|
10565
11375
|
button.className = "delete";
|
|
10566
11376
|
button.tabIndex = 0;
|
|
10567
|
-
button.setAttribute("data-l10n-id",
|
|
11377
|
+
button.setAttribute("data-l10n-id", `pdfjs-editor-remove-${this.#editor.editorType}-button`);
|
|
10568
11378
|
this.#addListenersToElement(button);
|
|
10569
11379
|
button.addEventListener("click", e => {
|
|
10570
11380
|
this.#editor._uiManager.delete();
|
|
10571
11381
|
});
|
|
10572
11382
|
this.#buttons.append(button);
|
|
10573
11383
|
}
|
|
11384
|
+
get #divider() {
|
|
11385
|
+
const divider = document.createElement("div");
|
|
11386
|
+
divider.className = "divider";
|
|
11387
|
+
return divider;
|
|
11388
|
+
}
|
|
11389
|
+
addAltTextButton(button) {
|
|
11390
|
+
this.#addListenersToElement(button);
|
|
11391
|
+
this.#buttons.prepend(button, this.#divider);
|
|
11392
|
+
}
|
|
11393
|
+
addColorPicker(colorPicker) {
|
|
11394
|
+
this.#colorPicker = colorPicker;
|
|
11395
|
+
const button = colorPicker.renderButton();
|
|
11396
|
+
this.#addListenersToElement(button);
|
|
11397
|
+
this.#buttons.prepend(button, this.#divider);
|
|
11398
|
+
}
|
|
10574
11399
|
remove() {
|
|
10575
11400
|
this.#toolbar.remove();
|
|
11401
|
+
this.#colorPicker?.destroy();
|
|
11402
|
+
this.#colorPicker = null;
|
|
10576
11403
|
}
|
|
10577
11404
|
}
|
|
10578
11405
|
|
|
@@ -10581,14 +11408,10 @@ class EditorToolbar {
|
|
|
10581
11408
|
|
|
10582
11409
|
|
|
10583
11410
|
|
|
11411
|
+
|
|
10584
11412
|
class AnnotationEditor {
|
|
10585
11413
|
#allResizerDivs = null;
|
|
10586
|
-
#altText =
|
|
10587
|
-
#altTextDecorative = false;
|
|
10588
|
-
#altTextButton = null;
|
|
10589
|
-
#altTextTooltip = null;
|
|
10590
|
-
#altTextTooltipTimeout = null;
|
|
10591
|
-
#altTextWasFromKeyBoard = false;
|
|
11414
|
+
#altText = null;
|
|
10592
11415
|
#keepAspectRatio = false;
|
|
10593
11416
|
#resizersDiv = null;
|
|
10594
11417
|
#savedDimensions = null;
|
|
@@ -10610,7 +11433,6 @@ class AnnotationEditor {
|
|
|
10610
11433
|
static _borderLineWidth = -1;
|
|
10611
11434
|
static _colorManager = new tools.ColorManager();
|
|
10612
11435
|
static _zIndex = 1;
|
|
10613
|
-
static SMALL_EDITOR_SIZE = 0;
|
|
10614
11436
|
static get _resizerKeyboardManager() {
|
|
10615
11437
|
const resize = AnnotationEditor.prototype._resizeWithKeyboard;
|
|
10616
11438
|
const small = tools.AnnotationEditorUIManager.TRANSLATE_SMALL;
|
|
@@ -10868,7 +11690,7 @@ class AnnotationEditor {
|
|
|
10868
11690
|
return [-x, -y];
|
|
10869
11691
|
}
|
|
10870
11692
|
}
|
|
10871
|
-
fixAndSetPosition() {
|
|
11693
|
+
fixAndSetPosition(rotation = this.rotation) {
|
|
10872
11694
|
const [pageWidth, pageHeight] = this.pageDimensions;
|
|
10873
11695
|
let {
|
|
10874
11696
|
x,
|
|
@@ -10880,7 +11702,7 @@ class AnnotationEditor {
|
|
|
10880
11702
|
height *= pageHeight;
|
|
10881
11703
|
x *= pageWidth;
|
|
10882
11704
|
y *= pageHeight;
|
|
10883
|
-
switch (
|
|
11705
|
+
switch (rotation) {
|
|
10884
11706
|
case 0:
|
|
10885
11707
|
x = Math.max(0, Math.min(pageWidth - width, x));
|
|
10886
11708
|
y = Math.max(0, Math.min(pageHeight - height, y));
|
|
@@ -10967,7 +11789,6 @@ class AnnotationEditor {
|
|
|
10967
11789
|
if (!this.#keepAspectRatio) {
|
|
10968
11790
|
this.div.style.height = `${(100 * height / parentHeight).toFixed(2)}%`;
|
|
10969
11791
|
}
|
|
10970
|
-
this.#altTextButton?.classList.toggle("small", width < AnnotationEditor.SMALL_EDITOR_SIZE || height < AnnotationEditor.SMALL_EDITOR_SIZE);
|
|
10971
11792
|
}
|
|
10972
11793
|
fixDims() {
|
|
10973
11794
|
const {
|
|
@@ -11019,7 +11840,7 @@ class AnnotationEditor {
|
|
|
11019
11840
|
if (event.button !== 0 || event.ctrlKey && isMac) {
|
|
11020
11841
|
return;
|
|
11021
11842
|
}
|
|
11022
|
-
this.#
|
|
11843
|
+
this.#altText?.toggle(false);
|
|
11023
11844
|
const boundResizerPointermove = this.#resizerPointermove.bind(this, name);
|
|
11024
11845
|
const savedDraggable = this._isDraggable;
|
|
11025
11846
|
this._isDraggable = false;
|
|
@@ -11038,7 +11859,7 @@ class AnnotationEditor {
|
|
|
11038
11859
|
this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(event.target).cursor;
|
|
11039
11860
|
const pointerUpCallback = () => {
|
|
11040
11861
|
this.parent.togglePointerEvents(true);
|
|
11041
|
-
this.#
|
|
11862
|
+
this.#altText?.toggle(true);
|
|
11042
11863
|
this._isDraggable = savedDraggable;
|
|
11043
11864
|
window.removeEventListener("pointerup", pointerUpCallback);
|
|
11044
11865
|
window.removeEventListener("blur", pointerUpCallback);
|
|
@@ -11166,118 +11987,19 @@ class AnnotationEditor {
|
|
|
11166
11987
|
this.setDims(parentWidth * newWidth, parentHeight * newHeight);
|
|
11167
11988
|
this.fixAndSetPosition();
|
|
11168
11989
|
}
|
|
11169
|
-
async addAltTextButton() {
|
|
11170
|
-
if (this.#altTextButton) {
|
|
11171
|
-
return;
|
|
11172
|
-
}
|
|
11173
|
-
const altText = this.#altTextButton = document.createElement("button");
|
|
11174
|
-
altText.className = "altText";
|
|
11175
|
-
const msg = await AnnotationEditor._l10nPromise.get("pdfjs-editor-alt-text-button-label");
|
|
11176
|
-
altText.textContent = msg;
|
|
11177
|
-
altText.setAttribute("aria-label", msg);
|
|
11178
|
-
altText.tabIndex = "0";
|
|
11179
|
-
altText.addEventListener("contextmenu", display_utils.noContextMenu);
|
|
11180
|
-
altText.addEventListener("pointerdown", event => event.stopPropagation());
|
|
11181
|
-
const onClick = event => {
|
|
11182
|
-
this.#altTextButton.hidden = true;
|
|
11183
|
-
event.preventDefault();
|
|
11184
|
-
this._uiManager.editAltText(this);
|
|
11185
|
-
};
|
|
11186
|
-
altText.addEventListener("click", onClick, {
|
|
11187
|
-
capture: true
|
|
11188
|
-
});
|
|
11189
|
-
altText.addEventListener("keydown", event => {
|
|
11190
|
-
if (event.target === altText && event.key === "Enter") {
|
|
11191
|
-
this.#altTextWasFromKeyBoard = true;
|
|
11192
|
-
onClick(event);
|
|
11193
|
-
}
|
|
11194
|
-
});
|
|
11195
|
-
this.#setAltTextButtonState();
|
|
11196
|
-
this.div.append(altText);
|
|
11197
|
-
if (!AnnotationEditor.SMALL_EDITOR_SIZE) {
|
|
11198
|
-
const PERCENT = 40;
|
|
11199
|
-
AnnotationEditor.SMALL_EDITOR_SIZE = Math.min(128, Math.round(altText.getBoundingClientRect().width * (1 + PERCENT / 100)));
|
|
11200
|
-
}
|
|
11201
|
-
}
|
|
11202
|
-
async #setAltTextButtonState() {
|
|
11203
|
-
const button = this.#altTextButton;
|
|
11204
|
-
if (!button) {
|
|
11205
|
-
return;
|
|
11206
|
-
}
|
|
11207
|
-
if (!this.#altText && !this.#altTextDecorative) {
|
|
11208
|
-
button.classList.remove("done");
|
|
11209
|
-
this.#altTextTooltip?.remove();
|
|
11210
|
-
return;
|
|
11211
|
-
}
|
|
11212
|
-
button.classList.add("done");
|
|
11213
|
-
AnnotationEditor._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(msg => {
|
|
11214
|
-
button.setAttribute("aria-label", msg);
|
|
11215
|
-
});
|
|
11216
|
-
let tooltip = this.#altTextTooltip;
|
|
11217
|
-
if (!tooltip) {
|
|
11218
|
-
this.#altTextTooltip = tooltip = document.createElement("span");
|
|
11219
|
-
tooltip.className = "tooltip";
|
|
11220
|
-
tooltip.setAttribute("role", "tooltip");
|
|
11221
|
-
const id = tooltip.id = `alt-text-tooltip-${this.id}`;
|
|
11222
|
-
button.setAttribute("aria-describedby", id);
|
|
11223
|
-
const DELAY_TO_SHOW_TOOLTIP = 100;
|
|
11224
|
-
button.addEventListener("mouseenter", () => {
|
|
11225
|
-
this.#altTextTooltipTimeout = setTimeout(() => {
|
|
11226
|
-
this.#altTextTooltipTimeout = null;
|
|
11227
|
-
this.#altTextTooltip.classList.add("show");
|
|
11228
|
-
this._uiManager._eventBus.dispatch("reporttelemetry", {
|
|
11229
|
-
source: this,
|
|
11230
|
-
details: {
|
|
11231
|
-
type: "editing",
|
|
11232
|
-
subtype: this.editorType,
|
|
11233
|
-
data: {
|
|
11234
|
-
action: "alt_text_tooltip"
|
|
11235
|
-
}
|
|
11236
|
-
}
|
|
11237
|
-
});
|
|
11238
|
-
}, DELAY_TO_SHOW_TOOLTIP);
|
|
11239
|
-
});
|
|
11240
|
-
button.addEventListener("mouseleave", () => {
|
|
11241
|
-
if (this.#altTextTooltipTimeout) {
|
|
11242
|
-
clearTimeout(this.#altTextTooltipTimeout);
|
|
11243
|
-
this.#altTextTooltipTimeout = null;
|
|
11244
|
-
}
|
|
11245
|
-
this.#altTextTooltip?.classList.remove("show");
|
|
11246
|
-
});
|
|
11247
|
-
}
|
|
11248
|
-
tooltip.innerText = this.#altTextDecorative ? await AnnotationEditor._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip") : this.#altText;
|
|
11249
|
-
if (!tooltip.parentNode) {
|
|
11250
|
-
button.append(tooltip);
|
|
11251
|
-
}
|
|
11252
|
-
const element = this.getImageForAltText();
|
|
11253
|
-
element?.setAttribute("aria-describedby", tooltip.id);
|
|
11254
|
-
}
|
|
11255
|
-
#toggleAltTextButton(enabled = false) {
|
|
11256
|
-
if (!this.#altTextButton) {
|
|
11257
|
-
return;
|
|
11258
|
-
}
|
|
11259
|
-
if (!enabled && this.#altTextTooltipTimeout) {
|
|
11260
|
-
clearTimeout(this.#altTextTooltipTimeout);
|
|
11261
|
-
this.#altTextTooltipTimeout = null;
|
|
11262
|
-
}
|
|
11263
|
-
this.#altTextButton.disabled = !enabled;
|
|
11264
|
-
}
|
|
11265
11990
|
altTextFinish() {
|
|
11266
|
-
|
|
11267
|
-
return;
|
|
11268
|
-
}
|
|
11269
|
-
this.#altTextButton.hidden = false;
|
|
11270
|
-
this.#altTextButton.focus({
|
|
11271
|
-
focusVisible: this.#altTextWasFromKeyBoard
|
|
11272
|
-
});
|
|
11273
|
-
this.#altTextWasFromKeyBoard = false;
|
|
11991
|
+
this.#altText?.finish();
|
|
11274
11992
|
}
|
|
11275
|
-
addEditToolbar() {
|
|
11993
|
+
async addEditToolbar() {
|
|
11276
11994
|
if (this.#editToolbar || this.#isInEditMode) {
|
|
11277
|
-
return;
|
|
11995
|
+
return this.#editToolbar;
|
|
11278
11996
|
}
|
|
11279
11997
|
this.#editToolbar = new EditorToolbar(this);
|
|
11280
11998
|
this.div.append(this.#editToolbar.render());
|
|
11999
|
+
if (this.#altText) {
|
|
12000
|
+
this.#editToolbar.addAltTextButton(await this.#altText.render());
|
|
12001
|
+
}
|
|
12002
|
+
return this.#editToolbar;
|
|
11281
12003
|
}
|
|
11282
12004
|
removeEditToolbar() {
|
|
11283
12005
|
if (!this.#editToolbar) {
|
|
@@ -11285,26 +12007,27 @@ class AnnotationEditor {
|
|
|
11285
12007
|
}
|
|
11286
12008
|
this.#editToolbar.remove();
|
|
11287
12009
|
this.#editToolbar = null;
|
|
12010
|
+
this.#altText?.destroy();
|
|
11288
12011
|
}
|
|
11289
12012
|
getClientDimensions() {
|
|
11290
12013
|
return this.div.getBoundingClientRect();
|
|
11291
12014
|
}
|
|
12015
|
+
async addAltTextButton() {
|
|
12016
|
+
if (this.#altText) {
|
|
12017
|
+
return;
|
|
12018
|
+
}
|
|
12019
|
+
AltText.initialize(AnnotationEditor._l10nPromise);
|
|
12020
|
+
this.#altText = new AltText(this);
|
|
12021
|
+
await this.addEditToolbar();
|
|
12022
|
+
}
|
|
11292
12023
|
get altTextData() {
|
|
11293
|
-
return
|
|
11294
|
-
altText: this.#altText,
|
|
11295
|
-
decorative: this.#altTextDecorative
|
|
11296
|
-
};
|
|
12024
|
+
return this.#altText?.data;
|
|
11297
12025
|
}
|
|
11298
|
-
set altTextData({
|
|
11299
|
-
altText
|
|
11300
|
-
decorative
|
|
11301
|
-
}) {
|
|
11302
|
-
if (this.#altText === altText && this.#altTextDecorative === decorative) {
|
|
12026
|
+
set altTextData(data) {
|
|
12027
|
+
if (!this.#altText) {
|
|
11303
12028
|
return;
|
|
11304
12029
|
}
|
|
11305
|
-
this.#altText =
|
|
11306
|
-
this.#altTextDecorative = decorative;
|
|
11307
|
-
this.#setAltTextButtonState();
|
|
12030
|
+
this.#altText.data = data;
|
|
11308
12031
|
}
|
|
11309
12032
|
render() {
|
|
11310
12033
|
this.div = document.createElement("div");
|
|
@@ -11334,12 +12057,23 @@ class AnnotationEditor {
|
|
|
11334
12057
|
return;
|
|
11335
12058
|
}
|
|
11336
12059
|
this.#hasBeenClicked = true;
|
|
11337
|
-
this
|
|
11338
|
-
|
|
11339
|
-
#setUpDragSession(event) {
|
|
11340
|
-
if (!this._isDraggable) {
|
|
12060
|
+
if (this._isDraggable) {
|
|
12061
|
+
this.#setUpDragSession(event);
|
|
11341
12062
|
return;
|
|
11342
12063
|
}
|
|
12064
|
+
this.#selectOnPointerEvent(event);
|
|
12065
|
+
}
|
|
12066
|
+
#selectOnPointerEvent(event) {
|
|
12067
|
+
const {
|
|
12068
|
+
isMac
|
|
12069
|
+
} = util.FeatureTest.platform;
|
|
12070
|
+
if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
|
|
12071
|
+
this.parent.toggleSelected(this);
|
|
12072
|
+
} else {
|
|
12073
|
+
this.parent.setSelected(this);
|
|
12074
|
+
}
|
|
12075
|
+
}
|
|
12076
|
+
#setUpDragSession(event) {
|
|
11343
12077
|
const isSelected = this._uiManager.isSelected(this);
|
|
11344
12078
|
this._uiManager.setUpDragSession();
|
|
11345
12079
|
let pointerMoveOptions, pointerMoveCallback;
|
|
@@ -11362,14 +12096,7 @@ class AnnotationEditor {
|
|
|
11362
12096
|
}
|
|
11363
12097
|
this.#hasBeenClicked = false;
|
|
11364
12098
|
if (!this._uiManager.endDragSession()) {
|
|
11365
|
-
|
|
11366
|
-
isMac
|
|
11367
|
-
} = util.FeatureTest.platform;
|
|
11368
|
-
if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
|
|
11369
|
-
this.parent.toggleSelected(this);
|
|
11370
|
-
} else {
|
|
11371
|
-
this.parent.setSelected(this);
|
|
11372
|
-
}
|
|
12099
|
+
this.#selectOnPointerEvent(event);
|
|
11373
12100
|
}
|
|
11374
12101
|
};
|
|
11375
12102
|
window.addEventListener("pointerup", pointerUpCallback);
|
|
@@ -11390,7 +12117,7 @@ class AnnotationEditor {
|
|
|
11390
12117
|
this.y = y;
|
|
11391
12118
|
this.fixAndSetPosition();
|
|
11392
12119
|
}
|
|
11393
|
-
getRect(tx, ty) {
|
|
12120
|
+
getRect(tx, ty, rotation = this.rotation) {
|
|
11394
12121
|
const scale = this.parentScale;
|
|
11395
12122
|
const [pageWidth, pageHeight] = this.pageDimensions;
|
|
11396
12123
|
const [pageX, pageY] = this.pageTranslation;
|
|
@@ -11400,7 +12127,7 @@ class AnnotationEditor {
|
|
|
11400
12127
|
const y = this.y * pageHeight;
|
|
11401
12128
|
const width = this.width * pageWidth;
|
|
11402
12129
|
const height = this.height * pageHeight;
|
|
11403
|
-
switch (
|
|
12130
|
+
switch (rotation) {
|
|
11404
12131
|
case 0:
|
|
11405
12132
|
return [x + shiftX + pageX, pageHeight - y - shiftY - height + pageY, x + shiftX + width + pageX, pageHeight - y - shiftY + pageY];
|
|
11406
12133
|
case 90:
|
|
@@ -11453,6 +12180,7 @@ class AnnotationEditor {
|
|
|
11453
12180
|
this.div?.addEventListener("focusin", this.#boundFocusin);
|
|
11454
12181
|
this.div?.addEventListener("focusout", this.#boundFocusout);
|
|
11455
12182
|
}
|
|
12183
|
+
rotate(_angle) {}
|
|
11456
12184
|
serialize(isForCopying = false, context = null) {
|
|
11457
12185
|
(0,util.unreachable)("An editor must be serializable");
|
|
11458
12186
|
}
|
|
@@ -11482,9 +12210,6 @@ class AnnotationEditor {
|
|
|
11482
12210
|
} else {
|
|
11483
12211
|
this._uiManager.removeEditor(this);
|
|
11484
12212
|
}
|
|
11485
|
-
this.#altTextButton?.remove();
|
|
11486
|
-
this.#altTextButton = null;
|
|
11487
|
-
this.#altTextTooltip = null;
|
|
11488
12213
|
if (this.#moveInDOMTimeout) {
|
|
11489
12214
|
clearTimeout(this.#moveInDOMTimeout);
|
|
11490
12215
|
this.#moveInDOMTimeout = null;
|
|
@@ -11502,6 +12227,9 @@ class AnnotationEditor {
|
|
|
11502
12227
|
(0,tools.bindEvents)(this, this.div, ["keydown"]);
|
|
11503
12228
|
}
|
|
11504
12229
|
}
|
|
12230
|
+
get toolbarPosition() {
|
|
12231
|
+
return null;
|
|
12232
|
+
}
|
|
11505
12233
|
keydown(event) {
|
|
11506
12234
|
if (!this.isResizable || event.target !== this.div || event.key !== "Enter") {
|
|
11507
12235
|
return;
|
|
@@ -11610,7 +12338,14 @@ class AnnotationEditor {
|
|
|
11610
12338
|
select() {
|
|
11611
12339
|
this.makeResizable();
|
|
11612
12340
|
this.div?.classList.add("selectedEditor");
|
|
11613
|
-
this
|
|
12341
|
+
if (!this.#editToolbar) {
|
|
12342
|
+
this.addEditToolbar().then(() => {
|
|
12343
|
+
if (this.div?.classList.contains("selectedEditor")) {
|
|
12344
|
+
this.#editToolbar?.show();
|
|
12345
|
+
}
|
|
12346
|
+
});
|
|
12347
|
+
return;
|
|
12348
|
+
}
|
|
11614
12349
|
this.#editToolbar?.show();
|
|
11615
12350
|
}
|
|
11616
12351
|
unselect() {
|
|
@@ -11622,16 +12357,8 @@ class AnnotationEditor {
|
|
|
11622
12357
|
this.#editToolbar?.hide();
|
|
11623
12358
|
}
|
|
11624
12359
|
updateParams(type, value) {}
|
|
11625
|
-
disableEditing() {
|
|
11626
|
-
|
|
11627
|
-
this.#altTextButton.hidden = true;
|
|
11628
|
-
}
|
|
11629
|
-
}
|
|
11630
|
-
enableEditing() {
|
|
11631
|
-
if (this.#altTextButton) {
|
|
11632
|
-
this.#altTextButton.hidden = false;
|
|
11633
|
-
}
|
|
11634
|
-
}
|
|
12360
|
+
disableEditing() {}
|
|
12361
|
+
enableEditing() {}
|
|
11635
12362
|
enterInEditMode() {}
|
|
11636
12363
|
getImageForAltText() {
|
|
11637
12364
|
return null;
|
|
@@ -11666,6 +12393,9 @@ class AnnotationEditor {
|
|
|
11666
12393
|
static get MIN_SIZE() {
|
|
11667
12394
|
return 16;
|
|
11668
12395
|
}
|
|
12396
|
+
static canCreateNewEmptyEditor() {
|
|
12397
|
+
return true;
|
|
12398
|
+
}
|
|
11669
12399
|
}
|
|
11670
12400
|
class FakeEditor extends AnnotationEditor {
|
|
11671
12401
|
constructor(params) {
|
|
@@ -12181,7 +12911,7 @@ class KeyboardManager {
|
|
|
12181
12911
|
if (checker && !checker(self, event)) {
|
|
12182
12912
|
return;
|
|
12183
12913
|
}
|
|
12184
|
-
callback.bind(self, ...args)();
|
|
12914
|
+
callback.bind(self, ...args, event)();
|
|
12185
12915
|
if (!bubbles) {
|
|
12186
12916
|
event.stopPropagation();
|
|
12187
12917
|
event.preventDefault();
|
|
@@ -12229,10 +12959,12 @@ class AnnotationEditorUIManager {
|
|
|
12229
12959
|
#editorsToRescale = new Set();
|
|
12230
12960
|
#filterFactory = null;
|
|
12231
12961
|
#focusMainContainerTimeoutId = null;
|
|
12962
|
+
#highlightColors = null;
|
|
12232
12963
|
#idManager = new IdManager();
|
|
12233
12964
|
#isEnabled = false;
|
|
12234
12965
|
#isWaiting = false;
|
|
12235
12966
|
#lastActiveElement = null;
|
|
12967
|
+
#mainHighlightColorPicker = null;
|
|
12236
12968
|
#mode = _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE;
|
|
12237
12969
|
#selectedEditors = new Set();
|
|
12238
12970
|
#pageColors = null;
|
|
@@ -12262,7 +12994,7 @@ class AnnotationEditorUIManager {
|
|
|
12262
12994
|
static get _keyboardManager() {
|
|
12263
12995
|
const proto = AnnotationEditorUIManager.prototype;
|
|
12264
12996
|
const arrowChecker = self => {
|
|
12265
|
-
return self.#container.contains(document.activeElement) && self.hasSomethingToControl();
|
|
12997
|
+
return self.#container.contains(document.activeElement) && document.activeElement.tagName !== "BUTTON" && self.hasSomethingToControl();
|
|
12266
12998
|
};
|
|
12267
12999
|
const textInputChecker = (_self, {
|
|
12268
13000
|
target: el
|
|
@@ -12317,7 +13049,7 @@ class AnnotationEditorUIManager {
|
|
|
12317
13049
|
checker: arrowChecker
|
|
12318
13050
|
}]]));
|
|
12319
13051
|
}
|
|
12320
|
-
constructor(container, viewer, altTextManager, eventBus, pdfDocument, pageColors) {
|
|
13052
|
+
constructor(container, viewer, altTextManager, eventBus, pdfDocument, pageColors, highlightColors) {
|
|
12321
13053
|
this.#container = container;
|
|
12322
13054
|
this.#viewer = viewer;
|
|
12323
13055
|
this.#altTextManager = altTextManager;
|
|
@@ -12329,6 +13061,7 @@ class AnnotationEditorUIManager {
|
|
|
12329
13061
|
this.#annotationStorage = pdfDocument.annotationStorage;
|
|
12330
13062
|
this.#filterFactory = pdfDocument.filterFactory;
|
|
12331
13063
|
this.#pageColors = pageColors;
|
|
13064
|
+
this.#highlightColors = highlightColors || null;
|
|
12332
13065
|
this.viewParameters = {
|
|
12333
13066
|
realScale: _display_utils_js__WEBPACK_IMPORTED_MODULE_1__.PixelsPerInch.PDF_TO_CSS_UNITS,
|
|
12334
13067
|
rotation: 0
|
|
@@ -12350,7 +13083,7 @@ class AnnotationEditorUIManager {
|
|
|
12350
13083
|
this.#activeEditor = null;
|
|
12351
13084
|
this.#selectedEditors.clear();
|
|
12352
13085
|
this.#commandManager.destroy();
|
|
12353
|
-
this.#altTextManager
|
|
13086
|
+
this.#altTextManager?.destroy();
|
|
12354
13087
|
if (this.#focusMainContainerTimeoutId) {
|
|
12355
13088
|
clearTimeout(this.#focusMainContainerTimeoutId);
|
|
12356
13089
|
this.#focusMainContainerTimeoutId = null;
|
|
@@ -12366,6 +13099,12 @@ class AnnotationEditorUIManager {
|
|
|
12366
13099
|
get direction() {
|
|
12367
13100
|
return (0,_shared_util_js__WEBPACK_IMPORTED_MODULE_0__.shadow)(this, "direction", getComputedStyle(this.#container).direction);
|
|
12368
13101
|
}
|
|
13102
|
+
get highlightColors() {
|
|
13103
|
+
return (0,_shared_util_js__WEBPACK_IMPORTED_MODULE_0__.shadow)(this, "highlightColors", this.#highlightColors ? new Map(this.#highlightColors.split(",").map(pair => pair.split("=").map(x => x.trim()))) : null);
|
|
13104
|
+
}
|
|
13105
|
+
setMainHighlightColorPicker(colorPicker) {
|
|
13106
|
+
this.#mainHighlightColorPicker = colorPicker;
|
|
13107
|
+
}
|
|
12369
13108
|
editAltText(editor) {
|
|
12370
13109
|
this.#altTextManager?.editAltText(this, editor);
|
|
12371
13110
|
}
|
|
@@ -12670,7 +13409,9 @@ class AnnotationEditorUIManager {
|
|
|
12670
13409
|
}
|
|
12671
13410
|
}
|
|
12672
13411
|
addNewEditorFromKeyboard() {
|
|
12673
|
-
this.currentLayer.
|
|
13412
|
+
if (this.currentLayer.canCreateNewEmptyEditor()) {
|
|
13413
|
+
this.currentLayer.addNewEditor();
|
|
13414
|
+
}
|
|
12674
13415
|
}
|
|
12675
13416
|
updateToolbar(mode) {
|
|
12676
13417
|
if (mode === this.#mode) {
|
|
@@ -12685,9 +13426,13 @@ class AnnotationEditorUIManager {
|
|
|
12685
13426
|
if (!this.#editorTypes) {
|
|
12686
13427
|
return;
|
|
12687
13428
|
}
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
13429
|
+
switch (type) {
|
|
13430
|
+
case _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.CREATE:
|
|
13431
|
+
this.currentLayer.addNewEditor();
|
|
13432
|
+
return;
|
|
13433
|
+
case _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:
|
|
13434
|
+
this.#mainHighlightColorPicker?.updateColor(value);
|
|
13435
|
+
break;
|
|
12691
13436
|
}
|
|
12692
13437
|
for (const editor of this.#selectedEditors) {
|
|
12693
13438
|
editor.updateParams(type, value);
|
|
@@ -12920,7 +13665,9 @@ class AnnotationEditorUIManager {
|
|
|
12920
13665
|
unselectAll() {
|
|
12921
13666
|
if (this.#activeEditor) {
|
|
12922
13667
|
this.#activeEditor.commitOrRemove();
|
|
12923
|
-
|
|
13668
|
+
if (this.#mode !== _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE) {
|
|
13669
|
+
return;
|
|
13670
|
+
}
|
|
12924
13671
|
}
|
|
12925
13672
|
if (!this.hasSelection) {
|
|
12926
13673
|
return;
|
|
@@ -15834,15 +16581,16 @@ __webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
15834
16581
|
/* harmony export */ AnnotationLayer: () => (/* reexport safe */ _display_annotation_layer_js__WEBPACK_IMPORTED_MODULE_6__.AnnotationLayer),
|
|
15835
16582
|
/* harmony export */ AnnotationMode: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode),
|
|
15836
16583
|
/* harmony export */ CMapCompressionType: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.CMapCompressionType),
|
|
16584
|
+
/* harmony export */ ColorPicker: () => (/* reexport safe */ _display_editor_color_picker_js__WEBPACK_IMPORTED_MODULE_7__.ColorPicker),
|
|
15837
16585
|
/* harmony export */ DOMSVGFactory: () => (/* reexport safe */ _display_display_utils_js__WEBPACK_IMPORTED_MODULE_2__.DOMSVGFactory),
|
|
15838
|
-
/* harmony export */ DrawLayer: () => (/* reexport safe */
|
|
16586
|
+
/* harmony export */ DrawLayer: () => (/* reexport safe */ _display_draw_layer_js__WEBPACK_IMPORTED_MODULE_8__.DrawLayer),
|
|
15839
16587
|
/* harmony export */ FeatureTest: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.FeatureTest),
|
|
15840
|
-
/* harmony export */ GlobalWorkerOptions: () => (/* reexport safe */
|
|
16588
|
+
/* harmony export */ GlobalWorkerOptions: () => (/* reexport safe */ _display_worker_options_js__WEBPACK_IMPORTED_MODULE_9__.GlobalWorkerOptions),
|
|
15841
16589
|
/* harmony export */ ImageKind: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.ImageKind),
|
|
15842
16590
|
/* harmony export */ InvalidPDFException: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.InvalidPDFException),
|
|
15843
16591
|
/* harmony export */ MissingPDFException: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.MissingPDFException),
|
|
15844
16592
|
/* harmony export */ OPS: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.OPS),
|
|
15845
|
-
/* harmony export */ Outliner: () => (/* reexport safe */
|
|
16593
|
+
/* harmony export */ Outliner: () => (/* reexport safe */ _display_editor_outliner_js__WEBPACK_IMPORTED_MODULE_10__.Outliner),
|
|
15846
16594
|
/* harmony export */ PDFDataRangeTransport: () => (/* reexport safe */ _display_api_js__WEBPACK_IMPORTED_MODULE_1__.PDFDataRangeTransport),
|
|
15847
16595
|
/* harmony export */ PDFDateString: () => (/* reexport safe */ _display_display_utils_js__WEBPACK_IMPORTED_MODULE_2__.PDFDateString),
|
|
15848
16596
|
/* harmony export */ PDFWorker: () => (/* reexport safe */ _display_api_js__WEBPACK_IMPORTED_MODULE_1__.PDFWorker),
|
|
@@ -15854,7 +16602,7 @@ __webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
15854
16602
|
/* harmony export */ UnexpectedResponseException: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseException),
|
|
15855
16603
|
/* harmony export */ Util: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.Util),
|
|
15856
16604
|
/* harmony export */ VerbosityLevel: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.VerbosityLevel),
|
|
15857
|
-
/* harmony export */ XfaLayer: () => (/* reexport safe */
|
|
16605
|
+
/* harmony export */ XfaLayer: () => (/* reexport safe */ _display_xfa_layer_js__WEBPACK_IMPORTED_MODULE_11__.XfaLayer),
|
|
15858
16606
|
/* harmony export */ build: () => (/* reexport safe */ _display_api_js__WEBPACK_IMPORTED_MODULE_1__.build),
|
|
15859
16607
|
/* harmony export */ createValidAbsoluteUrl: () => (/* reexport safe */ _shared_util_js__WEBPACK_IMPORTED_MODULE_0__.createValidAbsoluteUrl),
|
|
15860
16608
|
/* harmony export */ fetchData: () => (/* reexport safe */ _display_display_utils_js__WEBPACK_IMPORTED_MODULE_2__.fetchData),
|
|
@@ -15876,13 +16624,14 @@ __webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
15876
16624
|
/* harmony import */ var _display_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(406);
|
|
15877
16625
|
/* harmony import */ var _display_display_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(473);
|
|
15878
16626
|
/* harmony import */ var _display_text_layer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(739);
|
|
15879
|
-
/* harmony import */ var _display_editor_annotation_editor_layer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
16627
|
+
/* harmony import */ var _display_editor_annotation_editor_layer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(629);
|
|
15880
16628
|
/* harmony import */ var _display_editor_tools_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(812);
|
|
15881
16629
|
/* harmony import */ var _display_annotation_layer_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(640);
|
|
15882
|
-
/* harmony import */ var
|
|
15883
|
-
/* harmony import */ var
|
|
15884
|
-
/* harmony import */ var
|
|
15885
|
-
/* harmony import */ var
|
|
16630
|
+
/* harmony import */ var _display_editor_color_picker_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(97);
|
|
16631
|
+
/* harmony import */ var _display_draw_layer_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(423);
|
|
16632
|
+
/* harmony import */ var _display_worker_options_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(368);
|
|
16633
|
+
/* harmony import */ var _display_editor_outliner_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(405);
|
|
16634
|
+
/* harmony import */ var _display_xfa_layer_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(160);
|
|
15886
16635
|
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_display_api_js__WEBPACK_IMPORTED_MODULE_1__]);
|
|
15887
16636
|
_display_api_js__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
15888
16637
|
|
|
@@ -15896,8 +16645,9 @@ _display_api_js__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.t
|
|
|
15896
16645
|
|
|
15897
16646
|
|
|
15898
16647
|
|
|
15899
|
-
|
|
15900
|
-
const
|
|
16648
|
+
|
|
16649
|
+
const pdfjsVersion = '4.0.379';
|
|
16650
|
+
const pdfjsBuild = '9e14d04fd';
|
|
15901
16651
|
|
|
15902
16652
|
__webpack_async_result__();
|
|
15903
16653
|
} catch(e) { __webpack_async_result__(e); } });
|
|
@@ -16511,7 +17261,9 @@ const AnnotationEditorParamsType = {
|
|
|
16511
17261
|
FREETEXT_OPACITY: 13,
|
|
16512
17262
|
INK_COLOR: 21,
|
|
16513
17263
|
INK_THICKNESS: 22,
|
|
16514
|
-
INK_OPACITY: 23
|
|
17264
|
+
INK_OPACITY: 23,
|
|
17265
|
+
HIGHLIGHT_COLOR: 31,
|
|
17266
|
+
HIGHLIGHT_DEFAULT_COLOR: 32
|
|
16515
17267
|
};
|
|
16516
17268
|
const PermissionFlag = {
|
|
16517
17269
|
PRINT: 0x04,
|
|
@@ -17355,6 +18107,7 @@ const AnnotationPrefix = "pdfjs_internal_id_";
|
|
|
17355
18107
|
/******/ var __webpack_exports__AnnotationLayer = __webpack_exports__.AnnotationLayer;
|
|
17356
18108
|
/******/ var __webpack_exports__AnnotationMode = __webpack_exports__.AnnotationMode;
|
|
17357
18109
|
/******/ var __webpack_exports__CMapCompressionType = __webpack_exports__.CMapCompressionType;
|
|
18110
|
+
/******/ var __webpack_exports__ColorPicker = __webpack_exports__.ColorPicker;
|
|
17358
18111
|
/******/ var __webpack_exports__DOMSVGFactory = __webpack_exports__.DOMSVGFactory;
|
|
17359
18112
|
/******/ var __webpack_exports__DrawLayer = __webpack_exports__.DrawLayer;
|
|
17360
18113
|
/******/ var __webpack_exports__FeatureTest = __webpack_exports__.FeatureTest;
|
|
@@ -17392,7 +18145,7 @@ const AnnotationPrefix = "pdfjs_internal_id_";
|
|
|
17392
18145
|
/******/ var __webpack_exports__shadow = __webpack_exports__.shadow;
|
|
17393
18146
|
/******/ var __webpack_exports__updateTextLayer = __webpack_exports__.updateTextLayer;
|
|
17394
18147
|
/******/ var __webpack_exports__version = __webpack_exports__.version;
|
|
17395
|
-
/******/ export { __webpack_exports__AbortException as AbortException, __webpack_exports__AnnotationEditorLayer as AnnotationEditorLayer, __webpack_exports__AnnotationEditorParamsType as AnnotationEditorParamsType, __webpack_exports__AnnotationEditorType as AnnotationEditorType, __webpack_exports__AnnotationEditorUIManager as AnnotationEditorUIManager, __webpack_exports__AnnotationLayer as AnnotationLayer, __webpack_exports__AnnotationMode as AnnotationMode, __webpack_exports__CMapCompressionType as CMapCompressionType, __webpack_exports__DOMSVGFactory as DOMSVGFactory, __webpack_exports__DrawLayer as DrawLayer, __webpack_exports__FeatureTest as FeatureTest, __webpack_exports__GlobalWorkerOptions as GlobalWorkerOptions, __webpack_exports__ImageKind as ImageKind, __webpack_exports__InvalidPDFException as InvalidPDFException, __webpack_exports__MissingPDFException as MissingPDFException, __webpack_exports__OPS as OPS, __webpack_exports__Outliner as Outliner, __webpack_exports__PDFDataRangeTransport as PDFDataRangeTransport, __webpack_exports__PDFDateString as PDFDateString, __webpack_exports__PDFWorker as PDFWorker, __webpack_exports__PasswordResponses as PasswordResponses, __webpack_exports__PermissionFlag as PermissionFlag, __webpack_exports__PixelsPerInch as PixelsPerInch, __webpack_exports__PromiseCapability as PromiseCapability, __webpack_exports__RenderingCancelledException as RenderingCancelledException, __webpack_exports__UnexpectedResponseException as UnexpectedResponseException, __webpack_exports__Util as Util, __webpack_exports__VerbosityLevel as VerbosityLevel, __webpack_exports__XfaLayer as XfaLayer, __webpack_exports__build as build, __webpack_exports__createValidAbsoluteUrl as createValidAbsoluteUrl, __webpack_exports__fetchData as fetchData, __webpack_exports__getDocument as getDocument, __webpack_exports__getFilenameFromUrl as getFilenameFromUrl, __webpack_exports__getPdfFilenameFromUrl as getPdfFilenameFromUrl, __webpack_exports__getXfaPageViewport as getXfaPageViewport, __webpack_exports__isDataScheme as isDataScheme, __webpack_exports__isPdfFile as isPdfFile, __webpack_exports__noContextMenu as noContextMenu, __webpack_exports__normalizeUnicode as normalizeUnicode, __webpack_exports__renderTextLayer as renderTextLayer, __webpack_exports__setLayerDimensions as setLayerDimensions, __webpack_exports__shadow as shadow, __webpack_exports__updateTextLayer as updateTextLayer, __webpack_exports__version as version };
|
|
18148
|
+
/******/ export { __webpack_exports__AbortException as AbortException, __webpack_exports__AnnotationEditorLayer as AnnotationEditorLayer, __webpack_exports__AnnotationEditorParamsType as AnnotationEditorParamsType, __webpack_exports__AnnotationEditorType as AnnotationEditorType, __webpack_exports__AnnotationEditorUIManager as AnnotationEditorUIManager, __webpack_exports__AnnotationLayer as AnnotationLayer, __webpack_exports__AnnotationMode as AnnotationMode, __webpack_exports__CMapCompressionType as CMapCompressionType, __webpack_exports__ColorPicker as ColorPicker, __webpack_exports__DOMSVGFactory as DOMSVGFactory, __webpack_exports__DrawLayer as DrawLayer, __webpack_exports__FeatureTest as FeatureTest, __webpack_exports__GlobalWorkerOptions as GlobalWorkerOptions, __webpack_exports__ImageKind as ImageKind, __webpack_exports__InvalidPDFException as InvalidPDFException, __webpack_exports__MissingPDFException as MissingPDFException, __webpack_exports__OPS as OPS, __webpack_exports__Outliner as Outliner, __webpack_exports__PDFDataRangeTransport as PDFDataRangeTransport, __webpack_exports__PDFDateString as PDFDateString, __webpack_exports__PDFWorker as PDFWorker, __webpack_exports__PasswordResponses as PasswordResponses, __webpack_exports__PermissionFlag as PermissionFlag, __webpack_exports__PixelsPerInch as PixelsPerInch, __webpack_exports__PromiseCapability as PromiseCapability, __webpack_exports__RenderingCancelledException as RenderingCancelledException, __webpack_exports__UnexpectedResponseException as UnexpectedResponseException, __webpack_exports__Util as Util, __webpack_exports__VerbosityLevel as VerbosityLevel, __webpack_exports__XfaLayer as XfaLayer, __webpack_exports__build as build, __webpack_exports__createValidAbsoluteUrl as createValidAbsoluteUrl, __webpack_exports__fetchData as fetchData, __webpack_exports__getDocument as getDocument, __webpack_exports__getFilenameFromUrl as getFilenameFromUrl, __webpack_exports__getPdfFilenameFromUrl as getPdfFilenameFromUrl, __webpack_exports__getXfaPageViewport as getXfaPageViewport, __webpack_exports__isDataScheme as isDataScheme, __webpack_exports__isPdfFile as isPdfFile, __webpack_exports__noContextMenu as noContextMenu, __webpack_exports__normalizeUnicode as normalizeUnicode, __webpack_exports__renderTextLayer as renderTextLayer, __webpack_exports__setLayerDimensions as setLayerDimensions, __webpack_exports__shadow as shadow, __webpack_exports__updateTextLayer as updateTextLayer, __webpack_exports__version as version };
|
|
17396
18149
|
/******/
|
|
17397
18150
|
|
|
17398
18151
|
//# sourceMappingURL=pdf.mjs.map
|