mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[CRX] Make textLayerMode pref visible and add migration logic
In a1cfa5f4d7
, the textLayerMode
preference was introduced, to replace the disableTextLayer and
enhanceTextSelection preferences.
As a result, the text selection preference was no longer visible
in Chrome (because preferences are only rendered by default for
boolean preferences, not for enumerations).
This commit adds the necessary bits to
extensions/chromium/options/options.{html,js}
so that the textLayerMode preference can be changed again.
Also, migration logic has been added to move over preferences
from the old to the new names:
- In web/chromecom.js, the logic is added to translate
preferences that were set by an administrator (it is read-only,
so this layer is unavoidable).
- In extensions/chromium/options/migration.js, similar logic is
added, except in this case the preference storage is writable,
so this migration logic happens only once.
The "enhanced text selection" mode is still experimental, so it
has been marked as experimental to signal that there may be bugs.
The list of tasks that block promotion to stable is at #7584.
This commit is contained in:
parent
fc83ce1aae
commit
94a49fa048
5 changed files with 83 additions and 3 deletions
|
@ -81,6 +81,8 @@ Promise.all([
|
|||
renderPreference = renderSidebarViewOnLoad(prefSchema.title);
|
||||
} else if (prefName === 'cursorToolOnLoad') {
|
||||
renderPreference = renderCursorToolOnLoad(prefSchema.title);
|
||||
} else if (prefName === 'textLayerMode') {
|
||||
renderPreference = renderTextLayerMode(prefSchema.title);
|
||||
} else if (prefName === 'externalLinkTarget') {
|
||||
renderPreference = renderExternalLinkTarget(prefSchema.title);
|
||||
} else {
|
||||
|
@ -217,6 +219,23 @@ function renderCursorToolOnLoad(shortDescription) {
|
|||
return renderPreference;
|
||||
}
|
||||
|
||||
function renderTextLayerMode(shortDescription) {
|
||||
var wrapper = importTemplate('textLayerMode-template');
|
||||
var select = wrapper.querySelector('select');
|
||||
select.onchange = function() {
|
||||
storageArea.set({
|
||||
textLayerMode: parseInt(this.value),
|
||||
});
|
||||
};
|
||||
wrapper.querySelector('span').textContent = shortDescription;
|
||||
document.getElementById('settings-boxes').appendChild(wrapper);
|
||||
|
||||
function renderPreference(value) {
|
||||
select.value = value;
|
||||
}
|
||||
return renderPreference;
|
||||
}
|
||||
|
||||
function renderExternalLinkTarget(shortDescription) {
|
||||
var wrapper = importTemplate('externalLinkTarget-template');
|
||||
var select = wrapper.querySelector('select');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue