mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-24 16:07:22 +02:00
Add a new badge close to the Manage button in the sidebar.
This commit is contained in:
parent
a398a55ac0
commit
85d88e59f3
@ -779,3 +779,7 @@ pdfjs-views-manager-paste-button-before =
|
|||||||
# $page (Number) - the page number after which the paste button is.
|
# $page (Number) - the page number after which the paste button is.
|
||||||
pdfjs-views-manager-paste-button-after =
|
pdfjs-views-manager-paste-button-after =
|
||||||
.title = Paste after page { $page }
|
.title = Paste after page { $page }
|
||||||
|
|
||||||
|
# Badge used to promote a new feature in the UI, keep it as short as possible.
|
||||||
|
# It's spelled uppercase for English, but it can be translated as usual.
|
||||||
|
pdfjs-new-badge-content = NEW
|
||||||
|
|||||||
@ -600,6 +600,7 @@ const PDFViewerApplication = {
|
|||||||
pageColors,
|
pageColors,
|
||||||
abortSignal,
|
abortSignal,
|
||||||
enableSplitMerge,
|
enableSplitMerge,
|
||||||
|
enableNewBadge: AppOptions.get("enableNewBadge"),
|
||||||
statusBar: viewsManager.viewsManagerStatusBar,
|
statusBar: viewsManager.viewsManagerStatusBar,
|
||||||
undoBar: viewsManager.viewsManagerUndoBar,
|
undoBar: viewsManager.viewsManagerUndoBar,
|
||||||
manageMenu: viewsManager.manageMenu,
|
manageMenu: viewsManager.manageMenu,
|
||||||
|
|||||||
@ -250,6 +250,11 @@ const defaultOptions = {
|
|||||||
value: true,
|
value: true,
|
||||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
||||||
},
|
},
|
||||||
|
enableNewBadge: {
|
||||||
|
/** @type {boolean} */
|
||||||
|
value: typeof PDFJSDev === "undefined" || PDFJSDev.test("MOZCENTRAL"),
|
||||||
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
||||||
|
},
|
||||||
enableOptimizedPartialRendering: {
|
enableOptimizedPartialRendering: {
|
||||||
/** @type {boolean} */
|
/** @type {boolean} */
|
||||||
value: false,
|
value: false,
|
||||||
|
|||||||
@ -64,6 +64,8 @@ const SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT = 15;
|
|||||||
* mode.
|
* mode.
|
||||||
* @property {AbortSignal} [abortSignal] - The AbortSignal for the window
|
* @property {AbortSignal} [abortSignal] - The AbortSignal for the window
|
||||||
* events.
|
* events.
|
||||||
|
* @property {boolean} [enableNewBadge] - Enables the "new" badge for the split
|
||||||
|
* and merge features.
|
||||||
* @property {boolean} [enableSplitMerge] - Enables split and merge features.
|
* @property {boolean} [enableSplitMerge] - Enables split and merge features.
|
||||||
* The default value is `false`.
|
* The default value is `false`.
|
||||||
* @property {Object} [statusBar] - The status bar elements to manage the status
|
* @property {Object} [statusBar] - The status bar elements to manage the status
|
||||||
@ -170,6 +172,7 @@ class PDFThumbnailViewer {
|
|||||||
pageColors,
|
pageColors,
|
||||||
abortSignal,
|
abortSignal,
|
||||||
enableSplitMerge,
|
enableSplitMerge,
|
||||||
|
enableNewBadge,
|
||||||
statusBar,
|
statusBar,
|
||||||
undoBar,
|
undoBar,
|
||||||
manageMenu,
|
manageMenu,
|
||||||
@ -205,6 +208,14 @@ class PDFThumbnailViewer {
|
|||||||
delete: del,
|
delete: del,
|
||||||
exportSelected,
|
exportSelected,
|
||||||
} = manageMenu;
|
} = manageMenu;
|
||||||
|
|
||||||
|
if (enableNewBadge) {
|
||||||
|
const newSpan = document.createElement("span");
|
||||||
|
newSpan.setAttribute("data-l10n-id", "pdfjs-new-badge-content");
|
||||||
|
newSpan.classList.add("newBadge");
|
||||||
|
button.parentElement.before(newSpan);
|
||||||
|
}
|
||||||
|
|
||||||
this.eventBus.on(
|
this.eventBus.on(
|
||||||
"pagesloaded",
|
"pagesloaded",
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -36,6 +36,9 @@
|
|||||||
--loading-icon-delay: 400ms;
|
--loading-icon-delay: 400ms;
|
||||||
--focus-ring-color: light-dark(#0060df, #0df);
|
--focus-ring-color: light-dark(#0060df, #0df);
|
||||||
--focus-ring-outline: 2px solid var(--focus-ring-color);
|
--focus-ring-outline: 2px solid var(--focus-ring-color);
|
||||||
|
--new-badge-bg: light-dark(#070, #37b847);
|
||||||
|
--new-badge-color: light-dark(#fff, #15141a);
|
||||||
|
--new-badge-border-color: light-dark(#fbfbfe / 40%, #15141a / 40%);
|
||||||
|
|
||||||
@media screen and (forced-colors: active) {
|
@media screen and (forced-colors: active) {
|
||||||
--pdfViewer-padding-bottom: 9px;
|
--pdfViewer-padding-bottom: 9px;
|
||||||
@ -43,9 +46,28 @@
|
|||||||
--page-border: 1px solid CanvasText;
|
--page-border: 1px solid CanvasText;
|
||||||
--spreadHorizontalWrapped-margin-LR: 3.5px;
|
--spreadHorizontalWrapped-margin-LR: 3.5px;
|
||||||
--focus-ring-color: CanvasText;
|
--focus-ring-color: CanvasText;
|
||||||
|
--new-badge-bg: AccentColor;
|
||||||
|
--new-badge-color: ButtonFace;
|
||||||
|
--new-badge-border-color: CanvasText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.newBadge {
|
||||||
|
background-color: var(--new-badge-bg);
|
||||||
|
color: var(--new-badge-color);
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid var(--new-badge-border-color);
|
||||||
|
padding-inline: 4px;
|
||||||
|
margin-inline: 4px;
|
||||||
|
font: menu;
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: normal;
|
||||||
|
flex: 0 0 fit-content;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
[data-main-rotation="90"] {
|
[data-main-rotation="90"] {
|
||||||
transform: rotate(90deg) translateY(-100%);
|
transform: rotate(90deg) translateY(-100%);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user