Add color and tag selector to annotations sidebar (#2299)
This commit is contained in:
parent
f2e9efaf1d
commit
e46f210b6c
3 changed files with 35 additions and 1 deletions
|
@ -366,6 +366,7 @@ class ReaderInstance {
|
|||
|
||||
_openTagsPopup(x, y, item) {
|
||||
let menupopup = this._window.document.createElement('menupopup');
|
||||
menupopup.className = 'tags-popup';
|
||||
menupopup.style.minWidth = '300px';
|
||||
menupopup.setAttribute('ignorekeys', true);
|
||||
let tagsbox = this._window.document.createElement('tagsbox');
|
||||
|
@ -560,6 +561,28 @@ class ReaderInstance {
|
|||
popup.openPopup(element, 'after_start', 0, 0, true);
|
||||
}
|
||||
|
||||
_openSelectorPopup(data) {
|
||||
let popup = this._window.document.createElement('menupopup');
|
||||
this._popupset.appendChild(popup);
|
||||
popup.addEventListener('popuphidden', function () {
|
||||
popup.remove();
|
||||
});
|
||||
let menuitem;
|
||||
// Clear Selection
|
||||
menuitem = this._window.document.createElement('menuitem');
|
||||
menuitem.setAttribute('label', Zotero.getString('general.clearSelection'));
|
||||
menuitem.setAttribute('disabled', !data.enableClearSelection);
|
||||
menuitem.addEventListener('command', () => {
|
||||
this._postMessage({
|
||||
action: 'popupCmd',
|
||||
cmd: 'clearSelector',
|
||||
ids: data.ids
|
||||
});
|
||||
});
|
||||
popup.appendChild(menuitem);
|
||||
popup.openPopupAtScreen(data.x, data.y, true);
|
||||
}
|
||||
|
||||
async _postMessage(message, transfer) {
|
||||
await this._waitForReader();
|
||||
this._iframeWindow.postMessage({ itemID: this._itemID, message }, this._iframeWindow.origin, transfer);
|
||||
|
@ -656,6 +679,16 @@ class ReaderInstance {
|
|||
this._openColorPopup(message.data);
|
||||
return;
|
||||
}
|
||||
case 'closePopup': {
|
||||
// Note: This currently only closes tags popup when annotations are
|
||||
// disappearing from pdf-reader sidebar
|
||||
for (let child of Array.from(this._popupset.children)) {
|
||||
if (child.classList.contains('tags-popup')) {
|
||||
child.hidePopup();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'openURL': {
|
||||
let { url } = message;
|
||||
let win = Services.wm.getMostRecentWindow('navigator:browser');
|
||||
|
|
|
@ -89,6 +89,7 @@ general.default = Default
|
|||
general.custom = Custom
|
||||
general.loading = Loading…
|
||||
general.richText = Rich Text
|
||||
general.clearSelection = Clear Selection
|
||||
|
||||
general.yellow = Yellow
|
||||
general.red = Red
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit fcd6b5573ab5fcd60da7477661f935b5cfbd6b3e
|
||||
Subproject commit 753ce0b40d94c93cd1d45dc01dfec70c0da3ff48
|
Loading…
Reference in a new issue