Skip to content

Commit

Permalink
[api-minor] Remove Outliner from the official API
Browse files Browse the repository at this point in the history
As far as I can tell `Outliner` is only exposed in the API because we need to access it when running some of the reference-tests, but is otherwise not used.
Hence this seems like something that should be kept *internal* and thus only exposed in TESTING-builds.
  • Loading branch information
Snuffleupagus committed Jul 16, 2024
1 parent f9e3b6b commit 8a979c2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ const pdfjsVersion =
const pdfjsBuild =
typeof PDFJSDev !== "undefined" ? PDFJSDev.eval("BUNDLE_BUILD") : void 0;

if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) {
globalThis.pdfjsTestingUtils = {
Outliner,
};
}

export {
AbortException,
AnnotationEditorLayer,
Expand Down Expand Up @@ -109,7 +115,6 @@ export {
noContextMenu,
normalizeUnicode,
OPS,
Outliner,
PasswordResponses,
PDFDataRangeTransport,
PDFDateString,
Expand Down
4 changes: 2 additions & 2 deletions test/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals pdfjsLib, pdfjsViewer */
/* globals pdfjsLib, pdfjsTestingUtils, pdfjsViewer */

const {
AnnotationLayer,
AnnotationMode,
DrawLayer,
getDocument,
GlobalWorkerOptions,
Outliner,
PixelsPerInch,
shadow,
TextLayer,
XfaLayer,
} = pdfjsLib;
const { Outliner } = pdfjsTestingUtils;
const { GenericL10n, parseQueryString, SimpleLinkService } = pdfjsViewer;

const WAITING_TIME = 100; // ms
Expand Down
2 changes: 0 additions & 2 deletions test/unit/pdf_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import { AnnotationLayer } from "../../src/display/annotation_layer.js";
import { ColorPicker } from "../../src/display/editor/color_picker.js";
import { DrawLayer } from "../../src/display/draw_layer.js";
import { GlobalWorkerOptions } from "../../src/display/worker_options.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";

Expand Down Expand Up @@ -94,7 +93,6 @@ const expectedAPI = Object.freeze({
noContextMenu,
normalizeUnicode,
OPS,
Outliner,
PasswordResponses,
PDFDataRangeTransport,
PDFDateString,
Expand Down
2 changes: 0 additions & 2 deletions web/pdfjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const {
noContextMenu,
normalizeUnicode,
OPS,
Outliner,
PasswordResponses,
PDFDataRangeTransport,
PDFDateString,
Expand Down Expand Up @@ -89,7 +88,6 @@ export {
noContextMenu,
normalizeUnicode,
OPS,
Outliner,
PasswordResponses,
PDFDataRangeTransport,
PDFDateString,
Expand Down

0 comments on commit 8a979c2

Please sign in to comment.