mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
The `getSelectedEditors` function is largely a copy of the `getEditors` function, with three small differences: 1. `getEditors` allows getting any kind of editor whereas `getSelectedEditors` is harcoded to only getting selected editors. 2. `getEditors` returns editor selectors (strings) whereas `getSelectedEditors` returns editor IDs (integers). 3. `getSelectedEditors` returns a sorted array of editor IDs whereas `getEditors` does not ensure that the array is sorted. This commit makes the `getEditors` function a drop-in replacement for the `getSelectedEditors` function to deduplicate the code and to have a unified way of getting editors. Note that we don't actually use the contents of the returned array (only its length), so we can safely change `getEditors` to return a sorted array of integer editor IDs instead. Sorting the array makes the return value deterministic, which is a nice property for test stability, and integer IDs are also easier to handle in test assertions. Note that the corresponding selector strings can also easily be obtained from the integer IDs using the `getEditorSelector` function if needed. |
||
---|---|---|
.. | ||
chromium | ||
font | ||
fuzz | ||
images | ||
integration | ||
pdfs | ||
resources | ||
stats | ||
types | ||
unit | ||
.gitignore | ||
add_test.mjs | ||
annotation_layer_builder_overrides.css | ||
downloadutils.mjs | ||
draw_layer_test.css | ||
driver.js | ||
reporter.js | ||
test.mjs | ||
test_manifest.json | ||
test_slave.html | ||
testutils.mjs | ||
text_layer_test.css | ||
webserver.mjs | ||
xfa_layer_builder_overrides.css |