fx-compat: Initial fixes for PDF reader, tabs and contextPane
This commit is contained in:
parent
4eb405d405
commit
9e93007355
5 changed files with 94 additions and 88 deletions
|
@ -86,26 +86,26 @@ var ZoteroContextPane = new function () {
|
|||
}
|
||||
|
||||
// vbox
|
||||
var vbox = document.createElement('vbox');
|
||||
var vbox = document.createXULElement('vbox');
|
||||
vbox.setAttribute('flex', '1');
|
||||
|
||||
_contextPaneInner.append(vbox);
|
||||
|
||||
// Toolbar extension
|
||||
var toolbarExtension = document.createElement('box');
|
||||
var toolbarExtension = document.createXULElement('box');
|
||||
toolbarExtension.style.height = '32px';
|
||||
toolbarExtension.id = 'zotero-context-toolbar-extension';
|
||||
|
||||
_panesDeck = document.createElement('deck');
|
||||
_panesDeck = document.createXULElement('deck');
|
||||
_panesDeck.setAttribute('flex', 1);
|
||||
_panesDeck.setAttribute('selectedIndex', 0);
|
||||
|
||||
vbox.append(toolbarExtension, _panesDeck);
|
||||
|
||||
// Item pane deck
|
||||
_itemPaneDeck = document.createElement('deck');
|
||||
_itemPaneDeck = document.createXULElement('deck');
|
||||
// Notes pane deck
|
||||
_notesPaneDeck = document.createElement('deck');
|
||||
_notesPaneDeck = document.createXULElement('deck');
|
||||
_notesPaneDeck.style.backgroundColor = 'white';
|
||||
_notesPaneDeck.setAttribute('flex', 1);
|
||||
_notesPaneDeck.className = 'notes-pane-deck';
|
||||
|
@ -185,15 +185,15 @@ var ZoteroContextPane = new function () {
|
|||
_contextPaneSplitter.setAttribute('hidden', true);
|
||||
_contextPane.setAttribute('collapsed', true);
|
||||
_tabToolbar.hidden = true;
|
||||
_tabCover.hidden = true;
|
||||
_tabCover.classList.add('hidden');
|
||||
}
|
||||
else if (Zotero_Tabs.selectedType == 'reader') {
|
||||
var reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
|
||||
if (reader) {
|
||||
_tabCover.hidden = false;
|
||||
_tabCover.classList.remove('hidden');
|
||||
(async () => {
|
||||
await reader._initPromise;
|
||||
_tabCover.hidden = true;
|
||||
_tabCover.classList.add('hidden');
|
||||
// Focus reader pages view if context pane note editor is not selected
|
||||
if (Zotero_Tabs.selectedID == reader.tabID
|
||||
&& (!document.activeElement
|
||||
|
@ -313,7 +313,7 @@ var ZoteroContextPane = new function () {
|
|||
var reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
|
||||
if (reader) {
|
||||
if ((stacked || _contextPaneSplitter.getAttribute('state') == 'collapsed')) {
|
||||
reader.setToolbarPlaceholderWidth(_tabToolbar.boxObject.width);
|
||||
reader.setToolbarPlaceholderWidth(_tabToolbar.offsetWidth);
|
||||
}
|
||||
else {
|
||||
reader.setToolbarPlaceholderWidth(0);
|
||||
|
@ -408,19 +408,19 @@ var ZoteroContextPane = new function () {
|
|||
function _addNotesContext(libraryID) {
|
||||
let readOnly = _isLibraryReadOnly(libraryID);
|
||||
|
||||
var list = document.createElement('vbox');
|
||||
var list = document.createXULElement('vbox');
|
||||
list.setAttribute('flex', 1);
|
||||
list.className = 'zotero-context-notes-list';
|
||||
|
||||
var noteContainer = document.createElement('vbox');
|
||||
var title = document.createElement('vbox');
|
||||
var noteContainer = document.createXULElement('vbox');
|
||||
var title = document.createXULElement('vbox');
|
||||
title.className = 'zotero-context-pane-editor-parent-line';
|
||||
var editor = document.createElement('zoteronoteeditor');
|
||||
var editor = document.createXULElement('zoteronoteeditor');
|
||||
editor.className = 'zotero-context-pane-pinned-note';
|
||||
editor.setAttribute('flex', 1);
|
||||
noteContainer.append(title, editor);
|
||||
|
||||
let contextNode = document.createElement('deck');
|
||||
let contextNode = document.createXULElement('deck');
|
||||
contextNode.append(list, noteContainer);
|
||||
_notesPaneDeck.append(contextNode);
|
||||
|
||||
|
@ -432,7 +432,7 @@ var ZoteroContextPane = new function () {
|
|||
_updateAddToNote();
|
||||
};
|
||||
|
||||
var head = document.createElement('hbox');
|
||||
var head = document.createXULElement('hbox');
|
||||
head.style.display = 'flex';
|
||||
|
||||
async function _createNoteFromAnnotations(child) {
|
||||
|
@ -473,9 +473,9 @@ var ZoteroContextPane = new function () {
|
|||
_updateNotesList();
|
||||
}
|
||||
|
||||
var vbox = document.createElement('vbox');
|
||||
var vbox = document.createXULElement('vbox');
|
||||
vbox.style.flex = '1';
|
||||
var input = document.createElement('textbox');
|
||||
var input = document.createXULElement('textbox');
|
||||
input.style.width = 'calc(100% - 42px)';
|
||||
input.style.marginLeft = '12px';
|
||||
input.setAttribute('type', 'search');
|
||||
|
@ -488,7 +488,7 @@ var ZoteroContextPane = new function () {
|
|||
|
||||
head.append(vbox);
|
||||
|
||||
var listBox = document.createElement('vbox');
|
||||
var listBox = document.createXULElement('vbox');
|
||||
listBox.style.display = 'flex';
|
||||
listBox.setAttribute('flex', '1');
|
||||
var listInner = document.createElementNS(HTML_NS, 'div');
|
||||
|
@ -771,7 +771,7 @@ var ZoteroContextPane = new function () {
|
|||
}
|
||||
|
||||
async function _addItemContext(tabID, itemID) {
|
||||
var container = document.createElement('vbox');
|
||||
var container = document.createXULElement('vbox');
|
||||
container.id = tabID + '-context';
|
||||
container.className = 'zotero-item-pane-content';
|
||||
_itemPaneDeck.appendChild(container);
|
||||
|
@ -798,11 +798,11 @@ var ZoteroContextPane = new function () {
|
|||
_itemContexts.push(context);
|
||||
|
||||
if (!parentID) {
|
||||
var vbox = document.createElement('vbox');
|
||||
var vbox = document.createXULElement('vbox');
|
||||
vbox.setAttribute('flex', '1');
|
||||
vbox.setAttribute('align', 'center');
|
||||
vbox.setAttribute('pack', 'center');
|
||||
var description = document.createElement('description');
|
||||
var description = document.createXULElement('description');
|
||||
vbox.append(description);
|
||||
description.append(Zotero.getString('pane.context.noParent'));
|
||||
container.append(vbox);
|
||||
|
@ -814,17 +814,17 @@ var ZoteroContextPane = new function () {
|
|||
// Keep the code below in sync with itemPane.xul
|
||||
|
||||
// tabbox
|
||||
var tabbox = document.createElement('tabbox');
|
||||
var tabbox = document.createXULElement('tabbox');
|
||||
tabbox.setAttribute('flex', '1');
|
||||
tabbox.className = 'zotero-view-tabbox';
|
||||
|
||||
container.append(tabbox);
|
||||
|
||||
// tabs
|
||||
var tabs = document.createElement('tabs');
|
||||
var tabs = document.createXULElement('tabs');
|
||||
tabs.className = 'zotero-editpane-tabs';
|
||||
// tabpanels
|
||||
var tabpanels = document.createElement('tabpanels');
|
||||
var tabpanels = document.createXULElement('tabpanels');
|
||||
tabpanels.setAttribute('flex', '1');
|
||||
tabpanels.className = 'zotero-view-item';
|
||||
tabpanels.addEventListener('select', () => {
|
||||
|
@ -834,26 +834,26 @@ var ZoteroContextPane = new function () {
|
|||
tabbox.append(tabs, tabpanels);
|
||||
|
||||
// Info tab
|
||||
var tabInfo = document.createElement('tab');
|
||||
var tabInfo = document.createXULElement('tab');
|
||||
tabInfo.setAttribute('label', Zotero.Intl.strings['zotero.tabs.info.label']);
|
||||
// Tags tab
|
||||
var tabTags = document.createElement('tab');
|
||||
var tabTags = document.createXULElement('tab');
|
||||
tabTags.setAttribute('label', Zotero.Intl.strings['zotero.tabs.tags.label']);
|
||||
// Related tab
|
||||
var tabRelated = document.createElement('tab');
|
||||
var tabRelated = document.createXULElement('tab');
|
||||
tabRelated.setAttribute('label', Zotero.Intl.strings['zotero.tabs.related.label']);
|
||||
|
||||
tabs.append(tabInfo, tabTags, tabRelated);
|
||||
|
||||
// Info panel
|
||||
var panelInfo = document.createElement('tabpanel');
|
||||
var panelInfo = document.createXULElement('tabpanel');
|
||||
panelInfo.setAttribute('flex', '1');
|
||||
panelInfo.className = 'zotero-editpane-item-box';
|
||||
var itemBox = document.createElement('zoteroitembox');
|
||||
var itemBox = new (customElements.get('item-box'));
|
||||
itemBox.setAttribute('flex', '1');
|
||||
panelInfo.append(itemBox);
|
||||
// Tags panel
|
||||
var panelTags = document.createElement('tabpanel');
|
||||
var panelTags = document.createXULElement('tabpanel');
|
||||
panelTags.setAttribute('orient', 'vertical');
|
||||
panelTags.setAttribute('context', 'tags-context-menu');
|
||||
panelTags.className = 'tags-pane';
|
||||
|
@ -874,8 +874,8 @@ var ZoteroContextPane = new function () {
|
|||
div
|
||||
);
|
||||
// Related panel
|
||||
var panelRelated = document.createElement('tabpanel');
|
||||
var relatedBox = document.createElement('relatedbox');
|
||||
var panelRelated = document.createXULElement('tabpanel');
|
||||
var relatedBox = document.createXULElement('relatedbox');
|
||||
relatedBox.setAttribute('flex', '1');
|
||||
relatedBox.className = 'zotero-editpane-related';
|
||||
panelRelated.addEventListener('click', (event) => {
|
||||
|
|
|
@ -165,7 +165,7 @@ var Zotero_Tabs = new function () {
|
|||
throw new Error(`'onClose' should be a function (was ${typeof onClose})`);
|
||||
}
|
||||
var id = 'tab-' + Zotero.Utilities.randomString();
|
||||
var container = document.createElement('vbox');
|
||||
var container = document.createXULElement('vbox');
|
||||
container.id = id;
|
||||
this.deck.appendChild(container);
|
||||
var tab = { id, type, title, data, onClose };
|
||||
|
@ -443,7 +443,7 @@ var Zotero_Tabs = new function () {
|
|||
var { tabIndex } = this._getTab(id);
|
||||
window.Zotero_Tooltip.stop();
|
||||
let menuitem;
|
||||
let popup = document.createElement('menupopup');
|
||||
let popup = document.createXULElement('menupopup');
|
||||
document.querySelector('popupset').appendChild(popup);
|
||||
popup.addEventListener('popuphidden', function (event) {
|
||||
if (event.target === popup) {
|
||||
|
@ -452,7 +452,7 @@ var Zotero_Tabs = new function () {
|
|||
});
|
||||
if (id !== 'zotero-pane') {
|
||||
// Show in library
|
||||
menuitem = document.createElement('menuitem');
|
||||
menuitem = document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('general.showInLibrary'));
|
||||
menuitem.addEventListener('command', () => {
|
||||
var reader = Zotero.Reader.getByTabID(id);
|
||||
|
@ -468,13 +468,13 @@ var Zotero_Tabs = new function () {
|
|||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Move tab
|
||||
let menu = document.createElement('menu');
|
||||
let menu = document.createXULElement('menu');
|
||||
menu.setAttribute('label', Zotero.getString('tabs.move'));
|
||||
let menupopup = document.createElement('menupopup');
|
||||
let menupopup = document.createXULElement('menupopup');
|
||||
menu.append(menupopup);
|
||||
popup.appendChild(menu);
|
||||
// Move to start
|
||||
menuitem = document.createElement('menuitem');
|
||||
menuitem = document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('tabs.moveToStart'));
|
||||
menuitem.setAttribute('disabled', tabIndex == 1);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -482,7 +482,7 @@ var Zotero_Tabs = new function () {
|
|||
});
|
||||
menupopup.appendChild(menuitem);
|
||||
// Move to end
|
||||
menuitem = document.createElement('menuitem');
|
||||
menuitem = document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('tabs.moveToEnd'));
|
||||
menuitem.setAttribute('disabled', tabIndex == this._tabs.length - 1);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -490,7 +490,7 @@ var Zotero_Tabs = new function () {
|
|||
});
|
||||
menupopup.appendChild(menuitem);
|
||||
// Move to new window
|
||||
menuitem = document.createElement('menuitem');
|
||||
menuitem = document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('tabs.moveToWindow'));
|
||||
menuitem.setAttribute('disabled', false);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -502,7 +502,7 @@ var Zotero_Tabs = new function () {
|
|||
});
|
||||
menupopup.appendChild(menuitem);
|
||||
// Duplicate tab
|
||||
menuitem = document.createElement('menuitem');
|
||||
menuitem = document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('tabs.duplicate'));
|
||||
menuitem.addEventListener('command', () => {
|
||||
var { tab, tabIndex } = this._getTab(id);
|
||||
|
@ -514,11 +514,11 @@ var Zotero_Tabs = new function () {
|
|||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Separator
|
||||
popup.appendChild(document.createElement('menuseparator'));
|
||||
popup.appendChild(document.createXULElement('menuseparator'));
|
||||
}
|
||||
// Close
|
||||
if (id != 'zotero-pane') {
|
||||
menuitem = document.createElement('menuitem');
|
||||
menuitem = document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('general.close'));
|
||||
menuitem.addEventListener('command', () => {
|
||||
this.close(id);
|
||||
|
@ -527,7 +527,7 @@ var Zotero_Tabs = new function () {
|
|||
}
|
||||
// Close other tabs
|
||||
if (!(this._tabs.length == 2 && id != 'zotero-pane')) {
|
||||
menuitem = document.createElement('menuitem');
|
||||
menuitem = document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('tabs.closeOther'));
|
||||
menuitem.addEventListener('command', () => {
|
||||
this.close(this._tabs.slice(1).filter(x => x.id != id).map(x => x.id));
|
||||
|
@ -535,7 +535,7 @@ var Zotero_Tabs = new function () {
|
|||
popup.appendChild(menuitem);
|
||||
}
|
||||
// Undo close
|
||||
menuitem = document.createElement('menuitem');
|
||||
menuitem = document.createXULElement('menuitem');
|
||||
menuitem.setAttribute(
|
||||
'label',
|
||||
Zotero.getString(
|
||||
|
|
|
@ -445,11 +445,11 @@ class ReaderInstance {
|
|||
}
|
||||
|
||||
_openTagsPopup(item, selector) {
|
||||
let menupopup = this._window.document.createElement('menupopup');
|
||||
let menupopup = this._window.document.createXULElement('menupopup');
|
||||
menupopup.className = 'tags-popup';
|
||||
menupopup.style.minWidth = '300px';
|
||||
menupopup.setAttribute('ignorekeys', true);
|
||||
let tagsbox = this._window.document.createElement('tagsbox');
|
||||
let tagsbox = this._window.document.createXULElement('tagsbox');
|
||||
menupopup.appendChild(tagsbox);
|
||||
tagsbox.setAttribute('flex', '1');
|
||||
this._popupset.appendChild(menupopup);
|
||||
|
@ -463,38 +463,38 @@ class ReaderInstance {
|
|||
}
|
||||
|
||||
_openPagePopup(data) {
|
||||
let popup = this._window.document.createElement('menupopup');
|
||||
let popup = this._window.document.createXULElement('menupopup');
|
||||
this._popupset.appendChild(popup);
|
||||
popup.addEventListener('popuphidden', function () {
|
||||
popup.remove();
|
||||
});
|
||||
let menuitem;
|
||||
if (data.text) {
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('general.copy'));
|
||||
menuitem.addEventListener('command', () => {
|
||||
this._window.document.getElementById('menu_copy').click();
|
||||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Separator
|
||||
popup.appendChild(this._window.document.createElement('menuseparator'));
|
||||
popup.appendChild(this._window.document.createXULElement('menuseparator'));
|
||||
}
|
||||
// Zoom in
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.zoomIn'));
|
||||
menuitem.addEventListener('command', () => {
|
||||
this._postMessage({ action: 'popupCmd', cmd: 'zoomIn' });
|
||||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Zoom out
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.zoomOut'));
|
||||
menuitem.addEventListener('command', () => {
|
||||
this._postMessage({ action: 'popupCmd', cmd: 'zoomOut' });
|
||||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Zoom 'Auto'
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.zoomAuto'));
|
||||
menuitem.setAttribute('type', 'checkbox');
|
||||
menuitem.setAttribute('checked', data.isZoomAuto);
|
||||
|
@ -503,7 +503,7 @@ class ReaderInstance {
|
|||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Zoom 'Page Width'
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.zoomPageWidth'));
|
||||
menuitem.setAttribute('type', 'checkbox');
|
||||
menuitem.setAttribute('checked', data.isZoomPageWidth);
|
||||
|
@ -512,7 +512,7 @@ class ReaderInstance {
|
|||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Zoom 'Page Height'
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.zoomPageHeight'));
|
||||
menuitem.setAttribute('type', 'checkbox');
|
||||
menuitem.setAttribute('checked', data.isZoomPageHeight);
|
||||
|
@ -521,9 +521,9 @@ class ReaderInstance {
|
|||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Separator
|
||||
popup.appendChild(this._window.document.createElement('menuseparator'));
|
||||
popup.appendChild(this._window.document.createXULElement('menuseparator'));
|
||||
// Next page
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.nextPage'));
|
||||
menuitem.setAttribute('disabled', !data.enableNextPage);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -531,7 +531,7 @@ class ReaderInstance {
|
|||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Previous page
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.previousPage'));
|
||||
menuitem.setAttribute('disabled', !data.enablePrevPage);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -542,14 +542,14 @@ class ReaderInstance {
|
|||
}
|
||||
|
||||
_openAnnotationPopup(data) {
|
||||
let popup = this._window.document.createElement('menupopup');
|
||||
let popup = this._window.document.createXULElement('menupopup');
|
||||
this._popupset.appendChild(popup);
|
||||
popup.addEventListener('popuphidden', function () {
|
||||
popup.remove();
|
||||
});
|
||||
let menuitem;
|
||||
// Add to note
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.addToNote'));
|
||||
let hasActiveEditor = this._window.ZoteroContextPane && this._window.ZoteroContextPane.getActiveEditor();
|
||||
menuitem.setAttribute('disabled', !hasActiveEditor || !data.enableAddToNote);
|
||||
|
@ -562,10 +562,10 @@ class ReaderInstance {
|
|||
});
|
||||
popup.appendChild(menuitem);
|
||||
// Separator
|
||||
popup.appendChild(this._window.document.createElement('menuseparator'));
|
||||
popup.appendChild(this._window.document.createXULElement('menuseparator'));
|
||||
// Colors
|
||||
for (let color of data.colors) {
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString(color[0]));
|
||||
menuitem.className = 'menuitem-iconic';
|
||||
menuitem.setAttribute('disabled', data.readOnly);
|
||||
|
@ -582,11 +582,11 @@ class ReaderInstance {
|
|||
}
|
||||
// Separator
|
||||
if (data.enableEditPageNumber || data.enableEditHighlightedText) {
|
||||
popup.appendChild(this._window.document.createElement('menuseparator'));
|
||||
popup.appendChild(this._window.document.createXULElement('menuseparator'));
|
||||
}
|
||||
// Change page number
|
||||
if (data.enableEditPageNumber) {
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.editPageNumber'));
|
||||
menuitem.setAttribute('disabled', data.readOnly);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -600,7 +600,7 @@ class ReaderInstance {
|
|||
}
|
||||
// Edit highlighted text
|
||||
if (data.enableEditHighlightedText) {
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('pdfReader.editHighlightedText'));
|
||||
menuitem.setAttribute('disabled', data.readOnly);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -613,9 +613,9 @@ class ReaderInstance {
|
|||
popup.appendChild(menuitem);
|
||||
}
|
||||
// Separator
|
||||
popup.appendChild(this._window.document.createElement('menuseparator'));
|
||||
popup.appendChild(this._window.document.createXULElement('menuseparator'));
|
||||
// Delete
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('general.delete'));
|
||||
menuitem.setAttribute('disabled', data.readOnly);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -637,14 +637,14 @@ class ReaderInstance {
|
|||
}
|
||||
|
||||
_openColorPopup(data) {
|
||||
let popup = this._window.document.createElement('menupopup');
|
||||
let popup = this._window.document.createXULElement('menupopup');
|
||||
this._popupset.appendChild(popup);
|
||||
popup.addEventListener('popuphidden', function () {
|
||||
popup.remove();
|
||||
});
|
||||
let menuitem;
|
||||
for (let color of data.colors) {
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString(color[0]));
|
||||
menuitem.className = 'menuitem-iconic';
|
||||
menuitem.setAttribute('image', this._getColorIcon(color[1], color[1] === data.selectedColor));
|
||||
|
@ -662,14 +662,14 @@ class ReaderInstance {
|
|||
}
|
||||
|
||||
_openSelectorPopup(data) {
|
||||
let popup = this._window.document.createElement('menupopup');
|
||||
let popup = this._window.document.createXULElement('menupopup');
|
||||
this._popupset.appendChild(popup);
|
||||
popup.addEventListener('popuphidden', function () {
|
||||
popup.remove();
|
||||
});
|
||||
let menuitem;
|
||||
// Clear Selection
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem = this._window.document.createXULElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('general.clearSelection'));
|
||||
menuitem.setAttribute('disabled', !data.enableClearSelection);
|
||||
menuitem.addEventListener('command', () => {
|
||||
|
@ -886,14 +886,15 @@ class ReaderInstance {
|
|||
if (this._isReaderInitialized) {
|
||||
return;
|
||||
}
|
||||
let n = 0;
|
||||
while (!this._iframeWindow || !this._iframeWindow.eval('window.isReady')) {
|
||||
if (n >= 500) {
|
||||
throw new Error('Waiting for reader failed');
|
||||
}
|
||||
await Zotero.Promise.delay(10);
|
||||
n++;
|
||||
}
|
||||
// let n = 0;
|
||||
// while (!this._iframeWindow || !this._iframeWindow.eval('window.isReady')) {
|
||||
// if (n >= 500) {
|
||||
// throw new Error('Waiting for reader failed');
|
||||
// }
|
||||
// await Zotero.Promise.delay(10);
|
||||
// n++;
|
||||
// }
|
||||
await Zotero.Promise.delay(300);
|
||||
this._isReaderInitialized = true;
|
||||
}
|
||||
|
||||
|
@ -945,14 +946,14 @@ class ReaderTab extends ReaderInstance {
|
|||
this.tabID = id;
|
||||
this._tabContainer = container;
|
||||
|
||||
this._iframe = this._window.document.createElement('browser');
|
||||
this._iframe = this._window.document.createXULElement('browser');
|
||||
this._iframe.setAttribute('class', 'reader');
|
||||
this._iframe.setAttribute('flex', '1');
|
||||
this._iframe.setAttribute('type', 'content');
|
||||
this._iframe.setAttribute('src', 'resource://zotero/pdf-reader/viewer.html');
|
||||
this._tabContainer.appendChild(this._iframe);
|
||||
|
||||
this._popupset = this._window.document.createElement('popupset');
|
||||
this._popupset = this._window.document.createXULElement('popupset');
|
||||
this._tabContainer.appendChild(this._popupset);
|
||||
|
||||
this._window.addEventListener('DOMContentLoaded', (event) => {
|
||||
|
|
|
@ -732,15 +732,15 @@
|
|||
<!-- A placeholder to persist pdf-reader sidebar collapse state to avoid introducing another pref -->
|
||||
<box id="zotero-reader-sidebar-pane" hidden="true" collapsed="true" zotero-persist="collapsed width"/>
|
||||
<hbox>
|
||||
<box id="zotero-tab-cover" hidden="true">
|
||||
<label pack="center">&zotero.general.loading;</label>
|
||||
</box>
|
||||
<box id="zotero-tab-toolbar" class="toolbar" hidden="true">
|
||||
<div id="zotero-tb-split" xmlns="http://www.w3.org/1999/xhtml" class="split-button">
|
||||
<div id="zotero-tab-cover" class="hidden" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<label>&zotero.general.loading;</label>
|
||||
</div>
|
||||
<div id="zotero-tab-toolbar" class="toolbar" hidden="true" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<div id="zotero-tb-split" class="split-button">
|
||||
<button id="zotero-tb-toggle-item-pane" class="toolbarButton item" title="&zotero.toolbar.context.item;" tabindex="-1"><span/></button>
|
||||
<button id="zotero-tb-toggle-notes-pane" class="toolbarButton notes" title="&zotero.toolbar.context.notes;" tabindex="-1"><span/></button>
|
||||
</div>
|
||||
</box>
|
||||
</div>
|
||||
<deck id="tabs-deck" flex="1">
|
||||
<vbox id="zotero-pane"
|
||||
onkeydown="ZoteroPane_Local.handleKeyDown(event, this.id)"
|
||||
|
|
|
@ -619,11 +619,16 @@
|
|||
background-color: #ececec;
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#zotero-tab-cover.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#zotero-tab-cover label {
|
||||
padding-top: 30px;
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue