Capitalize acronyms
This commit is contained in:
parent
1a4b2e8c7d
commit
8d87eeae35
4 changed files with 36 additions and 36 deletions
|
@ -152,12 +152,12 @@ class EditorInstance {
|
|||
async insertAnnotations(annotations) {
|
||||
let html = await this._digestAnnotations(annotations);
|
||||
if (html) {
|
||||
this._postMessage({ action: 'insertHtml', pos: -1, html });
|
||||
this._postMessage({ action: 'insertHTML', pos: -1, html });
|
||||
}
|
||||
}
|
||||
|
||||
_postMessage(message) {
|
||||
this._iframeWindow.postMessage({ instanceId: this.instanceID, message }, '*');
|
||||
this._iframeWindow.postMessage({ instanceID: this.instanceID, message }, '*');
|
||||
}
|
||||
|
||||
_getFont() {
|
||||
|
@ -177,7 +177,7 @@ class EditorInstance {
|
|||
async _digestAnnotations(annotations) {
|
||||
let html = '';
|
||||
for (let annotation of annotations) {
|
||||
let attachmentItem = await Zotero.Items.getAsync(annotation.attachmentItemId);
|
||||
let attachmentItem = await Zotero.Items.getAsync(annotation.attachmentItemID);
|
||||
if (!attachmentItem) {
|
||||
continue;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ class EditorInstance {
|
|||
}
|
||||
|
||||
_messageHandler = async (e) => {
|
||||
if (e.data.instanceId !== this.instanceID) {
|
||||
if (e.data.instanceID !== this.instanceID) {
|
||||
return;
|
||||
}
|
||||
let message = e.data.message;
|
||||
|
@ -310,7 +310,7 @@ class EditorInstance {
|
|||
html = await this._digestAnnotations(annotations);
|
||||
}
|
||||
if (html) {
|
||||
this._postMessage({ action: 'insertHtml', pos, html });
|
||||
this._postMessage({ action: 'insertHTML', pos, html });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ class EditorInstance {
|
|||
}
|
||||
return;
|
||||
}
|
||||
case 'openUrl': {
|
||||
case 'openURL': {
|
||||
let { url } = message;
|
||||
let zp = Zotero.getActiveZoteroPane();
|
||||
if (zp) {
|
||||
|
@ -389,7 +389,7 @@ class EditorInstance {
|
|||
let { citation, pos } = message;
|
||||
let formatted = (await this._getFormattedCitationParts(citation)).join(';');
|
||||
let html = `<span class="citation" data-citation="${encodeURIComponent(JSON.stringify(citation))}">(${formatted})</span>`;
|
||||
this._postMessage({ action: 'insertHtml', pos, html });
|
||||
this._postMessage({ action: 'insertHTML', pos, html });
|
||||
return;
|
||||
}
|
||||
case 'subscribeProvider': {
|
||||
|
@ -404,7 +404,7 @@ class EditorInstance {
|
|||
return;
|
||||
}
|
||||
case 'openCitationPopup': {
|
||||
let { nodeId, citation } = message;
|
||||
let { nodeID, citation } = message;
|
||||
if (this._readOnly) {
|
||||
return;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ class EditorInstance {
|
|||
}
|
||||
citation.citationItems = availableCitationItems;
|
||||
let libraryID = this._item.libraryID;
|
||||
this._openQuickFormatDialog(nodeId, citation, [libraryID]);
|
||||
this._openQuickFormatDialog(nodeID, citation, [libraryID]);
|
||||
return;
|
||||
}
|
||||
case 'importImages': {
|
||||
|
@ -430,11 +430,11 @@ class EditorInstance {
|
|||
return;
|
||||
}
|
||||
for (let image of images) {
|
||||
let { nodeId, src } = image;
|
||||
let { nodeID, src } = image;
|
||||
let attachmentKey = await this._importImage(src, true);
|
||||
// TODO: Inform editor about the failed to import images
|
||||
if (attachmentKey) {
|
||||
this._postMessage({ action: 'attachImportedImage', nodeId, attachmentKey });
|
||||
this._postMessage({ action: 'attachImportedImage', nodeID, attachmentKey });
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -470,7 +470,7 @@ class EditorInstance {
|
|||
}
|
||||
|
||||
async _feedSubscription(subscription) {
|
||||
let { id, type, nodeId, data } = subscription;
|
||||
let { id, type, nodeID, data } = subscription;
|
||||
if (type === 'citation') {
|
||||
let parts = await this._getFormattedCitationParts(data.citation);
|
||||
this._postMessage({ action: 'notifyProvider', id, type, data: { formattedCitation: parts.join(';') } });
|
||||
|
@ -489,7 +489,7 @@ class EditorInstance {
|
|||
// new image copy in memory
|
||||
let newAttachmentKey = await this._importImage(dataURL);
|
||||
// TODO: Inform editor about the failed to import images
|
||||
this._postMessage({ action: 'attachImportedImage', nodeId, attachmentKey: newAttachmentKey });
|
||||
this._postMessage({ action: 'attachImportedImage', nodeID, attachmentKey: newAttachmentKey });
|
||||
}
|
||||
}
|
||||
// Make sure attachment key belongs to the actual parent note,
|
||||
|
@ -771,7 +771,7 @@ class EditorInstance {
|
|||
return 'data:' + item.attachmentContentType + ';base64,' + this._arrayBufferToBase64(buf);
|
||||
}
|
||||
|
||||
async _openQuickFormatDialog(nodeId, citationData, filterLibraryIDs) {
|
||||
async _openQuickFormatDialog(nodeID, citationData, filterLibraryIDs) {
|
||||
await Zotero.Styles.init();
|
||||
let that = this;
|
||||
let win;
|
||||
|
@ -830,7 +830,7 @@ class EditorInstance {
|
|||
let formattedCitation = (await that._getFormattedCitationParts(citation)).join(';');
|
||||
|
||||
if (progressCallback || !citationData.citationItems.length) {
|
||||
that._postMessage({ action: 'setCitation', nodeId, citation, formattedCitation });
|
||||
that._postMessage({ action: 'setCitation', nodeID, citation, formattedCitation });
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -942,7 +942,7 @@ class EditorInstance {
|
|||
let jsonAnnotations = [];
|
||||
for (let annotation of annotations) {
|
||||
let jsonAnnotation = await Zotero.Annotations.toJSON(annotation);
|
||||
jsonAnnotation.itemId = attachmentItem.id;
|
||||
jsonAnnotation.itemID = attachmentItem.id;
|
||||
jsonAnnotations.push(jsonAnnotation);
|
||||
}
|
||||
let html = `<p>(${(new Date()).toLocaleString()})</p>\n`;
|
||||
|
|
|
@ -83,9 +83,9 @@ class PDFWorker {
|
|||
this._worker.addEventListener('message', async (event) => {
|
||||
let message = event.data;
|
||||
// console.log(event.data)
|
||||
if (message.responseId) {
|
||||
let { resolve, reject } = this._waitingPromises[message.responseId];
|
||||
delete this._waitingPromises[message.responseId];
|
||||
if (message.responseID) {
|
||||
let { resolve, reject } = this._waitingPromises[message.responseID];
|
||||
delete this._waitingPromises[message.responseID];
|
||||
if (message.data) {
|
||||
resolve(message.data);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ class PDFWorker {
|
|||
Zotero.debug('Failed to fetch CMap data:');
|
||||
Zotero.debug(e);
|
||||
}
|
||||
this._worker.postMessage({ responseId: event.data.id, data: respData });
|
||||
this._worker.postMessage({ responseID: event.data.id, data: respData });
|
||||
}
|
||||
});
|
||||
this._worker.addEventListener('error', (event) => {
|
||||
|
@ -380,9 +380,9 @@ class PDFRenderer {
|
|||
|
||||
let _handleMessage = async (event) => {
|
||||
let message = event.data;
|
||||
if (message.responseId) {
|
||||
let { resolve, reject } = this._waitingPromises[message.responseId];
|
||||
delete this._waitingPromises[message.responseId];
|
||||
if (message.responseID) {
|
||||
let { resolve, reject } = this._waitingPromises[message.responseID];
|
||||
delete this._waitingPromises[message.responseID];
|
||||
if (message.data) {
|
||||
resolve(message.data);
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ class ReaderInstance {
|
|||
tagsbox.item = item;
|
||||
}
|
||||
|
||||
_openAnnotationPopup(x, y, annotationId, colors, selectedColor) {
|
||||
_openAnnotationPopup(x, y, annotationID, colors, selectedColor) {
|
||||
let popup = this._window.document.createElement('menupopup');
|
||||
this._popupset.appendChild(popup);
|
||||
popup.addEventListener('popuphidden', function () {
|
||||
|
@ -205,7 +205,7 @@ class ReaderInstance {
|
|||
let data = {
|
||||
action: 'popupCmd',
|
||||
cmd: 'addToNote',
|
||||
id: annotationId
|
||||
id: annotationID
|
||||
};
|
||||
this._postMessage(data);
|
||||
});
|
||||
|
@ -223,7 +223,7 @@ class ReaderInstance {
|
|||
let data = {
|
||||
action: 'popupCmd',
|
||||
cmd: 'setAnnotationColor',
|
||||
id: annotationId,
|
||||
id: annotationID,
|
||||
color: color[1]
|
||||
};
|
||||
this._postMessage(data);
|
||||
|
@ -239,7 +239,7 @@ class ReaderInstance {
|
|||
let data = {
|
||||
action: 'popupCmd',
|
||||
cmd: 'deleteAnnotation',
|
||||
id: annotationId
|
||||
id: annotationID
|
||||
};
|
||||
this._postMessage(data);
|
||||
});
|
||||
|
@ -274,7 +274,7 @@ class ReaderInstance {
|
|||
|
||||
async _postMessage(message, transfer) {
|
||||
await this._waitForReader();
|
||||
this._iframeWindow.postMessage({ itemId: this._itemID, message }, this._iframeWindow.origin, transfer);
|
||||
this._iframeWindow.postMessage({ itemID: this._itemID, message }, this._iframeWindow.origin, transfer);
|
||||
}
|
||||
|
||||
_handleMessage = async (event) => {
|
||||
|
@ -287,7 +287,7 @@ class ReaderInstance {
|
|||
let data = JSON.parse(JSON.stringify(event.data));
|
||||
// Filter messages coming from previous reader instances,
|
||||
// except for `setAnnotation` to still allow saving it
|
||||
if (data.itemId !== this._itemID && data.message.action !== 'setAnnotation') {
|
||||
if (data.itemID !== this._itemID && data.message.action !== 'setAnnotation') {
|
||||
return;
|
||||
}
|
||||
message = data.message;
|
||||
|
@ -297,7 +297,7 @@ class ReaderInstance {
|
|||
return;
|
||||
}
|
||||
case 'setAnnotation': {
|
||||
let attachment = Zotero.Items.get(data.itemId);
|
||||
let attachment = Zotero.Items.get(data.itemID);
|
||||
let { annotation } = message;
|
||||
annotation.key = annotation.id;
|
||||
let saveOptions = {
|
||||
|
@ -353,7 +353,7 @@ class ReaderInstance {
|
|||
this._openColorPopup(x, y, colors, selectedColor);
|
||||
return;
|
||||
}
|
||||
case 'openUrl': {
|
||||
case 'openURL': {
|
||||
let { url } = message;
|
||||
let win = Services.wm.getMostRecentWindow('navigator:browser');
|
||||
if (win) {
|
||||
|
@ -685,9 +685,9 @@ class Reader {
|
|||
// Listen for the parent item, PDF attachment and its annotations updates
|
||||
for (let reader of this._readers) {
|
||||
if (event === 'delete') {
|
||||
let disappearedIds = reader.annotationItemIDs.filter(x => ids.includes(x));
|
||||
if (disappearedIds.length) {
|
||||
let keys = disappearedIds.map(id => extraData[id].key);
|
||||
let disappearedIDs = reader.annotationItemIDs.filter(x => ids.includes(x));
|
||||
if (disappearedIDs.length) {
|
||||
let keys = disappearedIDs.map(id => extraData[id].key);
|
||||
reader.unsetAnnotations(keys);
|
||||
}
|
||||
if (ids.includes(reader._itemID)) {
|
||||
|
|
|
@ -101,12 +101,12 @@ window.addEventListener('message', async (event) => {
|
|||
parent.postMessage({ action: 'renderedAnnotation', data: { annotation } }, parent.origin, [annotation.image]);
|
||||
}
|
||||
);
|
||||
parent.postMessage({ responseId: message.id, data: num }, parent.origin);
|
||||
parent.postMessage({ responseID: message.id, data: num }, parent.origin);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
parent.postMessage({
|
||||
responseId: message.id,
|
||||
responseID: message.id,
|
||||
error: errObject(e)
|
||||
}, parent.origin);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue