mirror of
https://github.com/zotero/zotero.git
synced 2026-09-16 23:41:08 +00:00
Enable text actions context menu across all reader text fields
Fixes #3676
This commit is contained in:
parent
364e87a57f
commit
d9c2abd701
2 changed files with 29 additions and 0 deletions
|
|
@ -348,6 +348,7 @@
|
|||
primary="true"
|
||||
transparent="transparent"
|
||||
src="resource://zotero/reader/reader.html"
|
||||
context="textbox-contextmenu"
|
||||
flex="1"/>
|
||||
<popupset id="zotero-reader-popupset">
|
||||
</popupset>
|
||||
|
|
|
|||
|
|
@ -1098,6 +1098,7 @@ class ReaderTab extends ReaderInstance {
|
|||
this._iframe.setAttribute('type', 'content');
|
||||
this._iframe.setAttribute('transparent', 'true');
|
||||
this._iframe.setAttribute('src', 'resource://zotero/reader/reader.html');
|
||||
this._iframe.setAttribute('context', 'textbox-contextmenu');
|
||||
this._tabContainer.appendChild(this._iframe);
|
||||
this._iframe.docShell.windowDraggingAllowed = true;
|
||||
|
||||
|
|
@ -1108,6 +1109,8 @@ class ReaderTab extends ReaderInstance {
|
|||
this._window.addEventListener('pointerdown', this._handlePointerDown);
|
||||
this._window.addEventListener('pointerup', this._handlePointerUp);
|
||||
|
||||
this._window.goBuildEditContextMenu();
|
||||
|
||||
this._iframe.setAttribute('tooltip', 'html-tooltip');
|
||||
|
||||
this._open({ location: options.location, secondViewState: options.secondViewState });
|
||||
|
|
@ -1127,6 +1130,19 @@ class ReaderTab extends ReaderInstance {
|
|||
this._window.removeEventListener('DOMContentLoaded', this._handleLoad);
|
||||
this._iframeWindow = this._iframe.contentWindow;
|
||||
this._iframeWindow.addEventListener('error', event => Zotero.logError(event.error));
|
||||
|
||||
// Disable text direction switching option because it tries to change direction
|
||||
// for the whole window and crashes it
|
||||
this._iframeWindow.addEventListener('contextmenu', () => {
|
||||
let popup = this._window.goBuildEditContextMenu();
|
||||
this._window.goUpdateGlobalEditMenuItems(true);
|
||||
popup.addEventListener('popupshowing', (e) => {
|
||||
let menuitemSwitchTextDirection = e.target.querySelector("[command='cmd_switchTextDirection']");
|
||||
if (menuitemSwitchTextDirection) {
|
||||
menuitemSwitchTextDirection.hidden = true;
|
||||
}
|
||||
}, { once: true });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1226,6 +1242,18 @@ class ReaderWindow extends ReaderInstance {
|
|||
if (this._iframe.contentWindow && this._iframe.contentWindow.document === event.target) {
|
||||
this._iframeWindow = this._window.document.getElementById('reader').contentWindow;
|
||||
this._iframeWindow.addEventListener('error', event => Zotero.logError(event.error));
|
||||
this._window.goBuildEditContextMenu();
|
||||
// Disable text direction switching option because it changes direction for the whole window
|
||||
this._iframeWindow.addEventListener('contextmenu', () => {
|
||||
let popup = this._window.goBuildEditContextMenu();
|
||||
this._window.goUpdateGlobalEditMenuItems(true);
|
||||
popup.addEventListener('popupshowing', (e) => {
|
||||
let menuitemSwitchTextDirection = e.target.querySelector("[command='cmd_switchTextDirection']");
|
||||
if (menuitemSwitchTextDirection) {
|
||||
menuitemSwitchTextDirection.hidden = true;
|
||||
}
|
||||
}, { once: true });
|
||||
});
|
||||
}
|
||||
|
||||
this._switchReaderSubtype(this._type);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue