[api-minor] Remove the deprecated renderTextLayer and updateTextLayer functions (PR 18104 follow-up)

This commit is contained in:
Jonas Jenwald 2024-06-30 15:16:00 +02:00
parent 40b0c848ee
commit f3d177e3e4
4 changed files with 4 additions and 56 deletions

View file

@ -17,7 +17,7 @@
/** @typedef {import("./api").TextContent} TextContent */ /** @typedef {import("./api").TextContent} TextContent */
import { AbortException, Util, warn } from "../shared/util.js"; import { AbortException, Util, warn } from "../shared/util.js";
import { deprecated, setLayerDimensions } from "./display_utils.js"; import { setLayerDimensions } from "./display_utils.js";
/** /**
* @typedef {Object} TextLayerParameters * @typedef {Object} TextLayerParameters
@ -557,40 +557,4 @@ class TextLayer {
} }
} }
function renderTextLayer() { export { TextLayer };
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
return;
}
deprecated("`renderTextLayer`, please use `TextLayer` instead.");
const { textContentSource, container, viewport, ...rest } = arguments[0];
const restKeys = Object.keys(rest);
if (restKeys.length > 0) {
warn("Ignoring `renderTextLayer` parameters: " + restKeys.join(", "));
}
const textLayer = new TextLayer({
textContentSource,
container,
viewport,
});
const { textDivs, textContentItemsStr } = textLayer;
const promise = textLayer.render();
// eslint-disable-next-line consistent-return
return {
promise,
textDivs,
textContentItemsStr,
};
}
function updateTextLayer() {
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
return;
}
deprecated("`updateTextLayer`, please use `TextLayer` instead.");
}
export { renderTextLayer, TextLayer, updateTextLayer };

View file

@ -63,11 +63,6 @@ import {
RenderingCancelledException, RenderingCancelledException,
setLayerDimensions, setLayerDimensions,
} from "./display/display_utils.js"; } from "./display/display_utils.js";
import {
renderTextLayer,
TextLayer,
updateTextLayer,
} from "./display/text_layer.js";
import { AnnotationEditorLayer } from "./display/editor/annotation_editor_layer.js"; import { AnnotationEditorLayer } from "./display/editor/annotation_editor_layer.js";
import { AnnotationEditorUIManager } from "./display/editor/tools.js"; import { AnnotationEditorUIManager } from "./display/editor/tools.js";
import { AnnotationLayer } from "./display/annotation_layer.js"; import { AnnotationLayer } from "./display/annotation_layer.js";
@ -75,6 +70,7 @@ import { ColorPicker } from "./display/editor/color_picker.js";
import { DrawLayer } from "./display/draw_layer.js"; import { DrawLayer } from "./display/draw_layer.js";
import { GlobalWorkerOptions } from "./display/worker_options.js"; import { GlobalWorkerOptions } from "./display/worker_options.js";
import { Outliner } from "./display/editor/outliner.js"; import { Outliner } from "./display/editor/outliner.js";
import { TextLayer } from "./display/text_layer.js";
import { XfaLayer } from "./display/xfa_layer.js"; import { XfaLayer } from "./display/xfa_layer.js";
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
@ -121,12 +117,10 @@ export {
PermissionFlag, PermissionFlag,
PixelsPerInch, PixelsPerInch,
RenderingCancelledException, RenderingCancelledException,
renderTextLayer,
setLayerDimensions, setLayerDimensions,
shadow, shadow,
TextLayer, TextLayer,
UnexpectedResponseException, UnexpectedResponseException,
updateTextLayer,
Util, Util,
VerbosityLevel, VerbosityLevel,
version, version,

View file

@ -55,11 +55,6 @@ import {
RenderingCancelledException, RenderingCancelledException,
setLayerDimensions, setLayerDimensions,
} from "../../src/display/display_utils.js"; } from "../../src/display/display_utils.js";
import {
renderTextLayer,
TextLayer,
updateTextLayer,
} from "../../src/display/text_layer.js";
import { AnnotationEditorLayer } from "../../src/display/editor/annotation_editor_layer.js"; import { AnnotationEditorLayer } from "../../src/display/editor/annotation_editor_layer.js";
import { AnnotationEditorUIManager } from "../../src/display/editor/tools.js"; import { AnnotationEditorUIManager } from "../../src/display/editor/tools.js";
import { AnnotationLayer } from "../../src/display/annotation_layer.js"; import { AnnotationLayer } from "../../src/display/annotation_layer.js";
@ -67,6 +62,7 @@ import { ColorPicker } from "../../src/display/editor/color_picker.js";
import { DrawLayer } from "../../src/display/draw_layer.js"; import { DrawLayer } from "../../src/display/draw_layer.js";
import { GlobalWorkerOptions } from "../../src/display/worker_options.js"; import { GlobalWorkerOptions } from "../../src/display/worker_options.js";
import { Outliner } from "../../src/display/editor/outliner.js"; import { Outliner } from "../../src/display/editor/outliner.js";
import { TextLayer } from "../../src/display/text_layer.js";
import { XfaLayer } from "../../src/display/xfa_layer.js"; import { XfaLayer } from "../../src/display/xfa_layer.js";
const expectedAPI = Object.freeze({ const expectedAPI = Object.freeze({
@ -106,12 +102,10 @@ const expectedAPI = Object.freeze({
PermissionFlag, PermissionFlag,
PixelsPerInch, PixelsPerInch,
RenderingCancelledException, RenderingCancelledException,
renderTextLayer,
setLayerDimensions, setLayerDimensions,
shadow, shadow,
TextLayer, TextLayer,
UnexpectedResponseException, UnexpectedResponseException,
updateTextLayer,
Util, Util,
VerbosityLevel, VerbosityLevel,
version, version,

View file

@ -50,12 +50,10 @@ const {
PermissionFlag, PermissionFlag,
PixelsPerInch, PixelsPerInch,
RenderingCancelledException, RenderingCancelledException,
renderTextLayer,
setLayerDimensions, setLayerDimensions,
shadow, shadow,
TextLayer, TextLayer,
UnexpectedResponseException, UnexpectedResponseException,
updateTextLayer,
Util, Util,
VerbosityLevel, VerbosityLevel,
version, version,
@ -99,12 +97,10 @@ export {
PermissionFlag, PermissionFlag,
PixelsPerInch, PixelsPerInch,
RenderingCancelledException, RenderingCancelledException,
renderTextLayer,
setLayerDimensions, setLayerDimensions,
shadow, shadow,
TextLayer, TextLayer,
UnexpectedResponseException, UnexpectedResponseException,
updateTextLayer,
Util, Util,
VerbosityLevel, VerbosityLevel,
version, version,