parent
32fc1cad9c
commit
e5558b6f3e
9 changed files with 1 additions and 180 deletions
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright © 2009 Center for History and New Media
|
||||
George Mason University, Fairfax, Virginia, USA
|
||||
http://zotero.org
|
||||
|
||||
This file is part of Zotero.
|
||||
|
||||
Zotero is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Zotero is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
var noteEditor;
|
||||
|
||||
async function onLoad() {
|
||||
noteEditor = document.getElementById('zotero-note-editor');
|
||||
noteEditor.mode = 'view';
|
||||
|
||||
// Set font size from pref
|
||||
Zotero.setFontSize(noteEditor);
|
||||
|
||||
if (window.arguments) {
|
||||
var io = window.arguments[0];
|
||||
}
|
||||
|
||||
var itemID = parseInt(io.itemID);
|
||||
|
||||
var item = await Zotero.Items.getAsync(itemID);
|
||||
|
||||
let note = await Zotero.NoteBackups.getNote(item.id);
|
||||
if (!note) {
|
||||
note = item.getNote();
|
||||
}
|
||||
|
||||
var tmpItem = new Zotero.Item('note');
|
||||
tmpItem.libraryID = item.libraryID;
|
||||
tmpItem.setNote(note);
|
||||
noteEditor.item = tmpItem;
|
||||
document.title = 'BACKUP OF: ' + item.getNoteTitle();
|
||||
|
||||
noteEditor.focus();
|
||||
}
|
||||
|
||||
addEventListener("load", function(e) { onLoad(e); }, false);
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
|
||||
|
||||
<window
|
||||
id="zotero-note-window"
|
||||
orient="vertical"
|
||||
width="400"
|
||||
height="350"
|
||||
title="&zotero.items.menu.attach.note;"
|
||||
persist="screenX screenY width height"
|
||||
windowtype="zotero:note"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script src="include.js"/>
|
||||
<script src="noteBackup.js"/>
|
||||
|
||||
<keyset>
|
||||
<key id="key_close" key="W" modifiers="accel" command="cmd_close"/>
|
||||
</keyset>
|
||||
<command id="cmd_close" oncommand="window.close();"/>
|
||||
|
||||
<oldzoteronoteeditor id="zotero-note-editor" flex="1" onerror="return;onError()"/>
|
||||
</window>
|
|
@ -108,8 +108,6 @@ class EditorInstance {
|
|||
placeholder: options.placeholder,
|
||||
dir: Zotero.dir,
|
||||
font: this._getFont(),
|
||||
hasBackup: note && !Zotero.Notes.hasSchemaVersion(note)
|
||||
|| !!await Zotero.NoteBackups.getNote(this._item.id),
|
||||
localizedStrings: {
|
||||
// Figure out a better way to pass this
|
||||
'zotero.appName': Zotero.appName,
|
||||
|
@ -477,13 +475,6 @@ class EditorInstance {
|
|||
zp.openNoteWindow(this._item.id);
|
||||
return;
|
||||
}
|
||||
case 'openBackup': {
|
||||
let zp = Zotero.getActiveZoteroPane();
|
||||
if (zp) {
|
||||
zp.openBackupNoteWindow(this._item.id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'update': {
|
||||
let { noteData, system } = message;
|
||||
if (this._readOnly) {
|
||||
|
@ -838,7 +829,6 @@ class EditorInstance {
|
|||
}
|
||||
// Update note
|
||||
if (this._item) {
|
||||
await Zotero.NoteBackups.ensureBackup(this._item);
|
||||
await Zotero.DB.executeTransaction(async () => {
|
||||
let changed = this._item.setNote(html);
|
||||
if (changed && !this._disableSaving) {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright © 2020 Corporation for Digital Scholarship
|
||||
Vienna, Virginia, USA
|
||||
http://digitalscholar.org/
|
||||
|
||||
This file is part of Zotero.
|
||||
|
||||
Zotero is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Zotero is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
Zotero.NoteBackups = {
|
||||
init: async function () {
|
||||
await Zotero.DB.queryAsync("CREATE TABLE IF NOT EXISTS noteBackups (\n itemID INTEGER PRIMARY KEY,\n note TEXT,\n FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE\n);");
|
||||
},
|
||||
|
||||
getNote: async function(itemID) {
|
||||
return Zotero.DB.valueQueryAsync("SELECT note FROM noteBackups WHERE itemID=?", [itemID]);
|
||||
},
|
||||
|
||||
ensureBackup: async function(item) {
|
||||
let note = item.note;
|
||||
if (note && !Zotero.Notes.hasSchemaVersion(note)) {
|
||||
await Zotero.DB.queryAsync("INSERT OR IGNORE INTO noteBackups VALUES (?, ?)", [item.id, item.note]);
|
||||
}
|
||||
},
|
||||
};
|
|
@ -711,7 +711,6 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
yield Zotero.Groups.init();
|
||||
yield Zotero.Relations.init();
|
||||
yield Zotero.Retractions.init();
|
||||
yield Zotero.NoteBackups.init();
|
||||
yield Zotero.Dictionaries.init();
|
||||
Zotero.Reader.init();
|
||||
|
||||
|
|
|
@ -3693,48 +3693,6 @@ var ZoteroPane = new function()
|
|||
};
|
||||
|
||||
|
||||
this.openBackupNoteWindow = function (itemID) {
|
||||
var item = Zotero.Items.get(itemID);
|
||||
var type = Zotero.Libraries.get(item.libraryID).libraryType;
|
||||
if (!this.canEdit()) {
|
||||
this.displayCannotEditLibraryMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
var name = null;
|
||||
|
||||
if (itemID) {
|
||||
let w = this.findBackupNoteWindow(itemID);
|
||||
if (w) {
|
||||
w.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a name for this window so we can focus it later
|
||||
//
|
||||
// Collection is only used on new notes, so we don't need to
|
||||
// include it in the name
|
||||
name = 'zotero-backup-note-' + itemID;
|
||||
}
|
||||
|
||||
var io = { itemID: itemID };
|
||||
window.openDialog('chrome://zotero/content/noteBackup.xul', name, 'chrome,resizable,centerscreen,dialog=false', io);
|
||||
}
|
||||
|
||||
|
||||
this.findBackupNoteWindow = function (itemID) {
|
||||
var name = 'zotero-backup-note-' + itemID;
|
||||
var wm = Services.wm;
|
||||
var e = wm.getEnumerator('zotero:note');
|
||||
while (e.hasMoreElements()) {
|
||||
var w = e.getNext();
|
||||
if (w.name == name) {
|
||||
return w;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.addAttachmentFromURI = Zotero.Promise.method(function (link, itemID) {
|
||||
if (!this.canEdit()) {
|
||||
this.displayCannotEditLibraryMessage();
|
||||
|
|
|
@ -1302,7 +1302,6 @@ noteEditor.copy = Copy
|
|||
noteEditor.paste = Paste
|
||||
noteEditor.rightToLeft = Right to Left
|
||||
noteEditor.leftToRight = Left to Right
|
||||
noteEditor.viewNoteBackup = View Note Backup
|
||||
noteEditor.updateNotice = This note was edited with a newer version of %1$S.\nPlease update %1$S to make changes.
|
||||
noteEditor.enterLink = Enter Link
|
||||
noteEditor.heading1 = Heading 1
|
||||
|
|
|
@ -108,7 +108,6 @@ const xpcomFilesLocal = [
|
|||
'locale',
|
||||
'locateManager',
|
||||
'mime',
|
||||
'noteBackups',
|
||||
'notifier',
|
||||
'openPDF',
|
||||
'reader',
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e04f5a3c094bbf1681ff1355ec832dcf9e14a5f8
|
||||
Subproject commit a3f0ea4ac9077235fa4197a51375516072496a72
|
Loading…
Reference in a new issue