zotero/resource/tinymce/note.html
Dan Stillman d0b1a45c61 Restore ability to paste images in notes, for now
Allow this to continue working until we have a better solution that
keeps data URIs out of note markup and is counted against file quota.
Syncing most notes with embedded images will still result in a
note-too-long error.

Closes #1209
2017-04-16 02:40:20 -04:00

85 lines
2.5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="css/note-ui.css"/>
<script type="text/javascript" src="tinymce.js"></script>
<script type="text/javascript" src="locale.js"></script>
<script type="text/javascript">
tinymce.init({
body_id: "zotero-tinymce-note",
content_css: "css/note-content.css",
browser_spellcheck: true,
convert_urls: false,
entity_encoding: 'raw',
fix_list_elements: true,
paste_retain_style_properties: 'all',
paste_data_images: true,
plugins: "autolink,code,contextmenu,directionality,link,lists,paste,searchreplace,textcolor",
toolbar1: "bold italic underline strikethrough | subscript superscript | forecolor backcolor | blockquote link | removeformat",
toolbar2: "formatselect | alignleft aligncenter alignright | bullist numlist outdent indent | %DIR% | searchreplace",
toolbar_items_size: 'small',
menubar: false,
resize: false,
statusbar: false,
contextmenu: "link | dir | code",
link_context_toolbar: true,
link_assume_external_targets: true,
target_list: false,
setup: function (ed) {
setLocale(ed);
// Set text direction
var dir = window.location.href.match(/dir=(ltr|rtl)/)[1];
var opDir = dir.split("").reverse().join("");
ed.settings.directionality = dir;
ed.addMenuItem('dir', {
icon: opDir,
// TODO: Show correct label based on current line
text: opDir == 'rtl' ? "Right to left" : "Left to right",
onclick: function () {
ed.execCommand('mceDirection' + opDir.toUpperCase());
},
context: 'insert',
prependToContext: true
});
},
init_instance_callback: function (ed) {
zoteroInit(ed);
['Change', 'KeyDown', 'KeyPress', 'Undo', 'Redo'].forEach(eventName =>
ed.on(eventName, event => zoteroHandleEvent(event))
);
["Cut", "Copy", "Paste"].forEach(function (command) {
let cmd = command;
ed.addCommand(command, function (ui, value) {
zoteroExecCommand(ed.getDoc(), cmd, ui, value);
});
});
["ZoteroLinkClick"].forEach(function (command) {
ed.addCommand(command, function (ui, value) {
zoteroHandleEvent({
type: command,
value
});
});
});
}
});
tinymce.execCommand("mceAddEditor", true, "tinymce");
</script>
</head>
<body>
<div id="tinymce"></div>
</body>
</html>