Reorganize note-editor toolbar
This commit is contained in:
parent
7a4b27e774
commit
b5edc0d9c1
3 changed files with 50 additions and 26 deletions
|
@ -746,36 +746,48 @@ class EditorInstance {
|
|||
}
|
||||
|
||||
_openPopup(x, y, pos, itemGroups) {
|
||||
let appendItems = (parentNode, itemGroups) => {
|
||||
for (let itemGroup of itemGroups) {
|
||||
for (let item of itemGroup) {
|
||||
if (item.groups) {
|
||||
let menu = parentNode.ownerDocument.createElement('menu');
|
||||
menu.setAttribute('label', item.label);
|
||||
let menupopup = parentNode.ownerDocument.createElement('menupopup');
|
||||
menu.append(menupopup);
|
||||
appendItems(menupopup, item.groups);
|
||||
parentNode.appendChild(menu);
|
||||
}
|
||||
else {
|
||||
let menuitem = parentNode.ownerDocument.createElement('menuitem');
|
||||
menuitem.setAttribute('value', item.name);
|
||||
menuitem.setAttribute('label', item.label);
|
||||
menuitem.setAttribute('disabled', !item.enabled);
|
||||
menuitem.setAttribute('checked', item.checked);
|
||||
menuitem.addEventListener('command', () => {
|
||||
this._postMessage({
|
||||
action: 'contextMenuAction',
|
||||
ctxAction: item.name,
|
||||
pos
|
||||
});
|
||||
});
|
||||
parentNode.appendChild(menuitem);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemGroups.indexOf(itemGroup) !== itemGroups.length - 1) {
|
||||
let separator = parentNode.ownerDocument.createElement('menuseparator');
|
||||
parentNode.appendChild(separator);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this._popup.hidePopup();
|
||||
|
||||
while (this._popup.firstChild) {
|
||||
this._popup.removeChild(this._popup.firstChild);
|
||||
}
|
||||
|
||||
for (let itemGroup of itemGroups) {
|
||||
for (let item of itemGroup) {
|
||||
let menuitem = this._popup.ownerDocument.createElement('menuitem');
|
||||
menuitem.setAttribute('value', item.name);
|
||||
menuitem.setAttribute('label', item.label);
|
||||
if (!item.enabled) {
|
||||
menuitem.setAttribute('disabled', true);
|
||||
}
|
||||
menuitem.addEventListener('command', () => {
|
||||
this._postMessage({
|
||||
action: 'contextMenuAction',
|
||||
ctxAction: item.name,
|
||||
pos
|
||||
});
|
||||
});
|
||||
this._popup.appendChild(menuitem);
|
||||
}
|
||||
|
||||
if (itemGroups.indexOf(itemGroup) !== itemGroups.length - 1) {
|
||||
let separator = this._popup.ownerDocument.createElement('menuseparator');
|
||||
this._popup.appendChild(separator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
appendItems(this._popup, itemGroups);
|
||||
this._popup.openPopupAtScreen(x, y, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,12 @@ general.item = Item
|
|||
general.pdf = PDF
|
||||
general.back = Back
|
||||
|
||||
general.yellow = Yellow
|
||||
general.red = Red
|
||||
general.green = Green
|
||||
general.blue = Blue
|
||||
general.purple = Purple
|
||||
|
||||
general.operationInProgress = A Zotero operation is currently in progress.
|
||||
general.operationInProgress.waitUntilFinished = Please wait until it has finished.
|
||||
general.operationInProgress.waitUntilFinishedAndTryAgain = Please wait until it has finished and try again.
|
||||
|
@ -1279,9 +1285,14 @@ noteEditor.bulletList = Bulleted List
|
|||
noteEditor.orderedList = Numbered List
|
||||
noteEditor.blockquote = Block Quote
|
||||
noteEditor.formatText = Format Text
|
||||
noteEditor.highlightText = Highlight Text
|
||||
noteEditor.removeColor = Remove Color
|
||||
noteEditor.bold = Bold
|
||||
noteEditor.italic = Italic
|
||||
noteEditor.underline = Underline
|
||||
noteEditor.strikethrough = Strikethrough
|
||||
noteEditor.subscript = Subscript
|
||||
noteEditor.superscript = Superscript
|
||||
noteEditor.returnToNotesList = Return to Notes List
|
||||
noteEditor.insertLink = Insert Link
|
||||
noteEditor.clearFormatting = Clear Formatting
|
||||
|
@ -1310,6 +1321,7 @@ noteEditor.addCitation = Add Citation
|
|||
noteEditor.findAndReplace = Find and Replace
|
||||
noteEditor.showInLibrary = Show in Library
|
||||
noteEditor.editInWindow = Edit in a Separate Window
|
||||
noteEditor.applyAnnotationColors = Apply Annotation Colors
|
||||
|
||||
pdfReader.annotations = Annotations
|
||||
pdfReader.showAnnotations = Show Annotations
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c801eb5df1b15b73e118494a7dffb9c86f55ba29
|
||||
Subproject commit 0651ded628bb5a00b0b471ea5d43cf9fac015361
|
Loading…
Reference in a new issue