1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

[Editor] Unselect correctly removed editors

- After undoing a deletion of several editors, they appeared to be selected (they had a red border)
when in fact they were not, consequently, this patch aims to remove the selectedEditor class when
an editor is removed;
- Add a test with some ink editors.
This commit is contained in:
Calixte Denizet 2022-07-22 12:13:47 +02:00
parent 6138e16ce2
commit 5bbe0d0782
6 changed files with 127 additions and 31 deletions

View file

@ -73,3 +73,19 @@ function getComputedStyleSelector(id) {
return `getComputedStyle(${getQuerySelector(id)})`;
}
exports.getComputedStyleSelector = getComputedStyleSelector;
const editorPrefix = "#pdfjs_internal_editor_";
exports.editorPrefix = editorPrefix;
function getSelectedEditors(page) {
return page.evaluate(prefix => {
const elements = document.querySelectorAll(".selectedEditor");
const results = [];
for (const { id } of elements) {
results.push(parseInt(id.slice(prefix.length)));
}
results.sort();
return results;
}, editorPrefix.slice(1));
}
exports.getSelectedEditors = getSelectedEditors;