Skip to content

Commit

Permalink
Update pdf.js
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Jun 5, 2022
1 parent e30a9d9 commit 1c69e1f
Show file tree
Hide file tree
Showing 15 changed files with 1,776 additions and 270 deletions.
1,251 changes: 1,191 additions & 60 deletions build/pdf.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pdf.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/pdf.sandbox.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pdf.sandbox.js.map

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions build/pdf.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
exports["pdfjs-dist/build/pdf.worker"] = factory();
else
root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
})(this, () => {
})(globalThis, () => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
Expand Down Expand Up @@ -719,7 +719,7 @@ if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "unde
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
exports.arrayByteLength = arrayByteLength;
exports.arraysToBytes = arraysToBytes;
exports.assert = assert;
Expand Down Expand Up @@ -771,6 +771,13 @@ const AnnotationMode = {
ENABLE_STORAGE: 3
};
exports.AnnotationMode = AnnotationMode;
const AnnotationEditorPrefix = "pdfjs_internal_editor_";
exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
const AnnotationEditorType = {
NONE: 0,
FREETEXT: 3
};
exports.AnnotationEditorType = AnnotationEditorType;
const PermissionFlag = {
PRINT: 0x04,
MODIFY_CONTENTS: 0x08,
Expand Down Expand Up @@ -74469,7 +74476,7 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
var _worker = __w_pdfjs_require__(1);

const pdfjsVersion = '2.15.0';
const pdfjsBuild = '9bdf27e';
const pdfjsBuild = '9b22483';
})();

/******/ return __webpack_exports__;
Expand Down
2 changes: 1 addition & 1 deletion build/pdf.worker.js.map

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions web/images/toolbarButton-editorFreeText.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions web/images/toolbarButton-editorNone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions web/locale/en-US/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,11 @@ password_cancel=Cancel
printing_not_supported=Warning: Printing is not fully supported by this browser.
printing_not_ready=Warning: The PDF is not fully loaded for printing.
web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts.

# Editor
editor_none.title=Disable Annotation Editing
editor_none_label=Disable Editing
editor_free_text.title=Add FreeText Annotation
editor_free_text_label=FreeText Annotation

freetext_default_content=Enter some text…
2 changes: 1 addition & 1 deletion web/locale/it/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ find_next.title = Trova l’occorrenza successiva del testo da cercare
find_next_label = Successivo
find_highlight = Evidenzia
find_match_case_label = Maiuscole/minuscole
find_entire_word_label = Parole intere
find_match_diacritics_label = Segni diacritici
find_entire_word_label = Parole intere
find_reached_top = Raggiunto l’inizio della pagina, continua dalla fine
find_reached_bottom = Raggiunta la fine della pagina, continua dall’inizio
find_match_count = {[ plural(total) ]}
Expand Down
4 changes: 2 additions & 2 deletions web/locale/ka/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ find_previous_label=წინა
find_next.title=ფრაზის შემდეგი კონტექსტის პოვნა
find_next_label=შემდეგი
find_highlight=ყველას მონიშვნა
find_match_case_label=ემთხვევა მთავრული
find_match_diacritics_label=ემთხვევა ნიშნები
find_match_case_label=მთავრულით
find_match_diacritics_label=ნიშნებით
find_entire_word_label=მთლიანი სიტყვები
find_reached_top=მიღწეულია დოკუმენტის დასაწყისი, გრძელდება ბოლოდან
find_reached_bottom=მიღწეულია დოკუმენტის ბოლო, გრძელდება დასაწყისიდან
Expand Down
84 changes: 84 additions & 0 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,78 @@
}
}


:root {
--focus-outline: solid 2px red;
--hover-outline: dashed 2px blue;
}

.annotationEditorLayer {
background: transparent;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}

.annotationEditorLayer .freeTextEditor {
position: absolute;
background: transparent;
border-radius: 3px;
padding: 5px;
resize: none;
width: auto;
height: auto;
}

.annotationEditorLayer .freeTextEditor .internal {
background: transparent;
border: none;
top: 0;
left: 0;
min-height: 15px;
overflow: visible;
white-space: nowrap;
resize: none;
}

.annotationEditorLayer .freeTextEditor .overlay {
position: absolute;
display: none;
background: transparent;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

.annotationEditorLayer .freeTextEditor .overlay.enabled {
display: block;
}

.annotationEditorLayer .freeTextEditor .internal:empty::before {
content: attr(default-content);
color: gray;
}

.annotationEditorLayer .freeTextEditor .internal:focus {
outline: none;
}

.annotationEditorLayer .freeTextEditor:focus-within {
outline: var(--focus-outline);
}

.annotationEditorLayer .freeTextEditor:hover:not(:focus-within) {
outline: var(--hover-outline);
}

.annotationEditorLayer .selectedEditor {
outline: var(--focus-outline);
resize: none;
}

:root {
--viewer-container-height: 0;
--pdfViewer-padding-bottom: 0;
Expand Down Expand Up @@ -850,6 +922,8 @@
--loading-icon: url(images/loading.svg);
--treeitem-expanded-icon: url(images/treeitem-expanded.svg);
--treeitem-collapsed-icon: url(images/treeitem-collapsed.svg);
--toolbarButton-editorFreeText-icon: url(images/toolbarButton-editorFreeText.svg);
--toolbarButton-editorNone-icon: url(images/toolbarButton-editorNone.svg);
--toolbarButton-menuArrow-icon: url(images/toolbarButton-menuArrow.svg);
--toolbarButton-sidebarToggle-icon: url(images/toolbarButton-sidebarToggle.svg);
--toolbarButton-secondaryToolbarToggle-icon: url(images/toolbarButton-secondaryToolbarToggle.svg);
Expand Down Expand Up @@ -1910,6 +1984,16 @@ select {
mask-image: var(--toolbarButton-presentationMode-icon);
}

#editorNone::before {
-webkit-mask-image: var(--toolbarButton-editorNone-icon);
mask-image: var(--toolbarButton-editorNone-icon);
}

#editorFreeText::before {
-webkit-mask-image: var(--toolbarButton-editorFreeText-icon);
mask-image: var(--toolbarButton-editorFreeText-icon);
}

#print::before,
#secondaryPrint::before {
-webkit-mask-image: var(--toolbarButton-print-icon);
Expand Down
21 changes: 15 additions & 6 deletions web/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,28 +230,37 @@
<span id="numPages" class="toolbarLabel"></span>
</div>
<div id="toolbarViewerRight">
<button id="presentationMode" class="toolbarButton hiddenLargeView" title="Switch to Presentation Mode" tabindex="31" data-l10n-id="presentation_mode">
<div id="editorModeButtons" class="splitToolbarButton toggled hidden" role="radiogroup">
<button id="editorNone" class="toolbarButton toggled" title="Disable Annotation Editing" role="radio" aria-checked="true" tabindex="31" data-l10n-id="editor_none">
<span data-l10n-id="editor_none_label">Disable Editing</span>
</button>
<button id="editorFreeText" class="toolbarButton" title="Add FreeText Annotation" role="radio" aria-checked="false" tabindex="32" data-l10n-id="editor_free_text">
<span data-l10n-id="editor_free_text_label">FreeText Annotation</span>
</button>
</div>

<button id="presentationMode" class="toolbarButton hiddenLargeView" title="Switch to Presentation Mode" tabindex="43" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>

<button id="openFile" class="toolbarButton hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
<button id="openFile" class="toolbarButton hiddenLargeView" title="Open File" tabindex="44" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>

<button id="print" class="toolbarButton hiddenMediumView" title="Print" tabindex="33" data-l10n-id="print">
<button id="print" class="toolbarButton hiddenMediumView" title="Print" tabindex="45" data-l10n-id="print">
<span data-l10n-id="print_label">Print</span>
</button>

<button id="download" class="toolbarButton hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
<button id="download" class="toolbarButton hiddenMediumView" title="Download" tabindex="46" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span>
</button>
<a href="#" id="viewBookmark" class="toolbarButton hiddenSmallView" title="Current view (copy or open in new window)" tabindex="35" data-l10n-id="bookmark">
<a href="#" id="viewBookmark" class="toolbarButton hiddenSmallView" title="Current view (copy or open in new window)" tabindex="47" data-l10n-id="bookmark">
<span data-l10n-id="bookmark_label">Current View</span>
</a>

<div class="verticalToolbarSeparator hiddenSmallView"></div>

<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="36" data-l10n-id="tools" aria-expanded="false" aria-controls="secondaryToolbar">
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="48" data-l10n-id="tools" aria-expanded="false" aria-controls="secondaryToolbar">
<span data-l10n-id="tools_label">Tools</span>
</button>
</div>
Expand Down
Loading

0 comments on commit 1c69e1f

Please sign in to comment.