mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
[api-minor] Remove the textLayerFactory
in the viewer
Please note that this functionality has never really mattered for the Firefox PDF Viewer, the GENERIC viewer, or even the "simpleviewer"/"singlepageviewer" component-examples. Hence, in practice this means that only the "pageviewer" component-example[1] have ever really utilized this. Using factories to initialize various layers in the viewer, rather than simply invoking the relevant code directly, seems (at least to me) like a somewhat roundabout way of doing things. Not only does this lead to more code, both to write and maintain, but since many of the layers have common parameters (e.g. an `AnnotationStorage`-instance) there's also some duplication. Hence this patch, which removes the `textLayerFactory` and instead uses a lookup-function in the `PDFPageView`-class to access the external viewer-properties as necessary. Note that this should even be an improvement for the "pageviewer" component-example, since most layers will now work by default rather than require manual configuration. --- [1] In practice we generally suggest using the "simpleviewer", or "singlepageviewer", since it does *most* things out-of-the-box and given that a lot of functionality really require *a viewer* and not just a single page in order to work.
This commit is contained in:
parent
4c78290028
commit
c393148748
5 changed files with 15 additions and 107 deletions
|
@ -13,10 +13,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
DefaultTextLayerFactory,
|
||||
DefaultXfaLayerFactory,
|
||||
} from "./default_factory.js";
|
||||
import {
|
||||
LinkTarget,
|
||||
PDFLinkService,
|
||||
|
@ -30,6 +26,7 @@ import {
|
|||
SpreadMode,
|
||||
} from "./ui_utils.js";
|
||||
import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
|
||||
import { DefaultXfaLayerFactory } from "./default_factory.js";
|
||||
import { DownloadManager } from "./download_manager.js";
|
||||
import { EventBus } from "./event_utils.js";
|
||||
import { GenericL10n } from "./genericl10n.js";
|
||||
|
@ -68,6 +65,16 @@ class DefaultStructTreeLayerFactory {
|
|||
}
|
||||
}
|
||||
|
||||
class DefaultTextLayerFactory {
|
||||
constructor() {
|
||||
throw new Error(
|
||||
"The `DefaultTextLayerFactory` has been removed, " +
|
||||
"please use the `textLayerMode` option when initializing " +
|
||||
"the `PDFPageView`-instance to control TextLayer rendering."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
AnnotationLayerBuilder,
|
||||
DefaultAnnotationLayerFactory,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue