Improve editor ir merge dialog

This commit is contained in:
Martynas Bagdonas 2021-02-18 17:38:51 +02:00 committed by Dan Stillman
parent a225c498ec
commit aa836d77af
2 changed files with 8 additions and 1 deletions

View file

@ -103,6 +103,7 @@
popup: document.getAnonymousElementByAttribute(this, 'anonid', 'editor-menu'), popup: document.getAnonymousElementByAttribute(this, 'anonid', 'editor-menu'),
onNavigate: this._navigateHandler, onNavigate: this._navigateHandler,
readOnly: !this.editable, readOnly: !this.editable,
disableUI: this.mode == 'merge',
onReturn: this._returnHandler, onReturn: this._returnHandler,
placeholder: this.placeholder placeholder: this.placeholder
}); });

View file

@ -45,6 +45,7 @@ class EditorInstance {
this.onNavigate = options.onNavigate; this.onNavigate = options.onNavigate;
this._item = options.item; this._item = options.item;
this._readOnly = options.readOnly; this._readOnly = options.readOnly;
this._disableUI = options.disableUI;
this._onReturn = options.onReturn; this._onReturn = options.onReturn;
this._iframeWindow = options.iframeWindow; this._iframeWindow = options.iframeWindow;
this._popup = options.popup; this._popup = options.popup;
@ -79,6 +80,7 @@ class EditorInstance {
action: 'init', action: 'init',
value: this._state || this._item.note, value: this._state || this._item.note,
readOnly: this._readOnly, readOnly: this._readOnly,
disableUI: this._disableUI,
enableReturnButton: !!this._onReturn, enableReturnButton: !!this._onReturn,
placeholder: options.placeholder, placeholder: options.placeholder,
dir: Zotero.dir, dir: Zotero.dir,
@ -526,7 +528,11 @@ class EditorInstance {
} }
} }
// Make sure attachment key belongs to the actual parent note, // Make sure attachment key belongs to the actual parent note,
// otherwise it would be a security risk // otherwise it would be a security risk.
// TODO: Figure out what to do with images not being
// displayed in merge dialog because of this,
// although another reason is because items
// are synced before image attachments
else if(item.parentID === this._item.id) { else if(item.parentID === this._item.id) {
let src = await this._getDataURL(item); let src = await this._getDataURL(item);
this._postMessage({ action: 'notifyProvider', id, type, data: { src } }); this._postMessage({ action: 'notifyProvider', id, type, data: { src } });