mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[Editor] Add the possibility to paste an image from the clipboard (bug 1848317)
This commit is contained in:
parent
4b2eebf32e
commit
2dd6f07b57
4 changed files with 111 additions and 11 deletions
|
@ -919,8 +919,17 @@ class AnnotationEditorUIManager {
|
|||
*/
|
||||
paste(event) {
|
||||
event.preventDefault();
|
||||
const { clipboardData } = event;
|
||||
for (const item of clipboardData.items) {
|
||||
for (const editorType of this.#editorTypes) {
|
||||
if (editorType.isHandlingMimeForPasting(item.type)) {
|
||||
editorType.paste(item, this.currentLayer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let data = event.clipboardData.getData("application/pdfjs");
|
||||
let data = clipboardData.getData("application/pdfjs");
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
@ -1099,6 +1108,9 @@ class AnnotationEditorUIManager {
|
|||
* @param {string|null} editId
|
||||
*/
|
||||
updateMode(mode, editId = null) {
|
||||
if (this.#mode === mode) {
|
||||
return;
|
||||
}
|
||||
this.#mode = mode;
|
||||
if (mode === AnnotationEditorType.NONE) {
|
||||
this.setEditingState(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue