Replace the disableTextLayer and enhanceTextSelection options/preferences with a single textLayerMode option/preference

Rather than having two different (but connected) options for the textLayer, I think that it makes sense to try and unify this. For example: currently if `disableTextLayer === true`, then the value of `enhanceTextSelection` is simply ignored.

Since PDF.js version `2.0` already won't be backwards compatible in lots of ways, I don't think that we need to worry about migrating existing preferences here.
This commit is contained in:
Jonas Jenwald 2018-02-13 15:01:55 +01:00
parent 3a6f6d23d6
commit a1cfa5f4d7
7 changed files with 46 additions and 41 deletions

View file

@ -37,6 +37,12 @@ const RendererType = {
SVG: 'svg',
};
const TextLayerMode = {
DISABLE: 0,
ENABLE: 1,
ENABLE_ENHANCE: 2,
};
// Replaces {{arguments}} with their values.
function formatL10nValue(text, args) {
if (!args) {
@ -87,13 +93,6 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
PDFJS.disableHistory = (PDFJS.disableHistory === undefined ?
false : PDFJS.disableHistory);
/**
* Disables creation of the text layer that used for text selection and search.
* @var {boolean}
*/
PDFJS.disableTextLayer = (PDFJS.disableTextLayer === undefined ?
false : PDFJS.disableTextLayer);
if (typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
/**
@ -669,6 +668,7 @@ export {
cloneObj,
PresentationModeState,
RendererType,
TextLayerMode,
mozL10n,
NullL10n,
EventBus,