mirror of
https://github.com/zotero/zotero.git
synced 2026-09-20 00:12:49 +00:00
Add rotation options to Edit menu to rotate the current PDF page
(cherry picked from commit d8d6054927)
This commit is contained in:
parent
03ba306018
commit
454a2c186b
4 changed files with 60 additions and 0 deletions
|
|
@ -126,6 +126,25 @@
|
|||
<menuitem id="menu_selectAll"
|
||||
key="key_selectAll"
|
||||
command="cmd_selectAll" data-l10n-id="text-action-select-all"/>
|
||||
<menuseparator class="menu-type-reader"/>
|
||||
<menuitem
|
||||
id="edit-menuitem-rotate-left"
|
||||
class="menu-type-reader"
|
||||
label="&zotero.pdfReader.rotateLeft;"
|
||||
oncommand="menuCmd('rotateLeft')"
|
||||
/>
|
||||
<menuitem
|
||||
id="edit-menuitem-rotate-right"
|
||||
class="menu-type-reader"
|
||||
label="&zotero.pdfReader.rotateRight;"
|
||||
oncommand="menuCmd('rotateRight')"
|
||||
/>
|
||||
<menuitem
|
||||
id="edit-menuitem-rotate-180"
|
||||
class="menu-type-reader"
|
||||
label="&zotero.pdfReader.rotate180;"
|
||||
oncommand="menuCmd('rotate180')"
|
||||
/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="View" onpopupshowing="onViewMenuOpen()">
|
||||
|
|
|
|||
|
|
@ -389,6 +389,18 @@ class ReaderInstance {
|
|||
}
|
||||
return;
|
||||
}
|
||||
else if (cmd === 'rotateLeft') {
|
||||
await this._rotateCurrentPage(270);
|
||||
return;
|
||||
}
|
||||
else if (cmd === 'rotateRight') {
|
||||
await this._rotateCurrentPage(90);
|
||||
return;
|
||||
}
|
||||
else if (cmd === 'rotate180') {
|
||||
await this._rotateCurrentPage(180);
|
||||
return;
|
||||
}
|
||||
else if (cmd === 'splitVertically') {
|
||||
this._splitVertically();
|
||||
}
|
||||
|
|
@ -608,6 +620,13 @@ class ReaderInstance {
|
|||
return `data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect shape-rendering="geometricPrecision" fill="${fill}" stroke-width="2" x="2" y="2" stroke="${stroke}" width="12" height="12" rx="3"/></svg>`;
|
||||
}
|
||||
|
||||
async _rotateCurrentPage(degrees) {
|
||||
let pageIndex = this._iframeWindow.wrappedJSObject.PDFViewerApplication.pdfViewer.currentPageNumber - 1;
|
||||
this._postMessage({ action: 'reloading' });
|
||||
await Zotero.PDFWorker.rotatePages(this._itemID, [pageIndex], degrees, true);
|
||||
await this.reload({ rotatedPageIndexes: [pageIndex] });
|
||||
}
|
||||
|
||||
_splitVertically() {
|
||||
if (this.isSplitVerticallyActive()) {
|
||||
this._iframeWindow.wrappedJSObject.unsplitView();
|
||||
|
|
|
|||
|
|
@ -273,6 +273,25 @@
|
|||
<menuitem id="menu_selectAll"
|
||||
key="key_selectAll"
|
||||
command="cmd_selectAll" data-l10n-id="text-action-select-all"/>
|
||||
<menuseparator class="menu-type-reader"/>
|
||||
<menuitem
|
||||
id="edit-menuitem-rotate-left"
|
||||
class="menu-type-reader"
|
||||
label="&zotero.pdfReader.rotateLeft;"
|
||||
oncommand="ZoteroStandalone.onReaderCmd('rotateLeft')"
|
||||
/>
|
||||
<menuitem
|
||||
id="edit-menuitem-rotate-right"
|
||||
class="menu-type-reader"
|
||||
label="&zotero.pdfReader.rotateRight;"
|
||||
oncommand="ZoteroStandalone.onReaderCmd('rotateRight')"
|
||||
/>
|
||||
<menuitem
|
||||
id="edit-menuitem-rotate-180"
|
||||
class="menu-type-reader"
|
||||
label="&zotero.pdfReader.rotate180;"
|
||||
oncommand="ZoteroStandalone.onReaderCmd('rotate180')"
|
||||
/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_find" label="&findCmd.label;"
|
||||
key="key_find" accesskey="&findCmd.accesskey;"
|
||||
|
|
|
|||
|
|
@ -327,3 +327,6 @@
|
|||
<!ENTITY zotero.pdfReader.splitVertically "Split Vertically">
|
||||
<!ENTITY zotero.pdfReader.splitHorizontally "Split Horizontally">
|
||||
<!ENTITY zotero.pdfReader.transferFromPDF "Import Annotations…">
|
||||
<!ENTITY zotero.pdfReader.rotateLeft "Rotate Left">
|
||||
<!ENTITY zotero.pdfReader.rotateRight "Rotate Right">
|
||||
<!ENTITY zotero.pdfReader.rotate180 "Rotate 180°">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue