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:
parent
6138e16ce2
commit
5bbe0d0782
6 changed files with 127 additions and 31 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue