zotero/resource/tinymce/note.html
Dan Stillman bd8debb2df Use entity_encoding: 'raw' in notes
This (and some other things) will help avoid changes in uploaded notes, which
cause loss of cursor position and other problems after local notes are updated
with the server version.

A side effect is that multiple spaces won't be converted to ` `, so
anything consuming note content will have to use `white-space: pre`.

(Notes in reports appear to be substituting ` ` as necessary,
though I'm not sure where that's happening.)
2017-02-02 02:01:06 -05:00

77 lines
2.2 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,
plugins: "autolink,code,contextmenu,directionality,link,lists,paste,searchreplace",
toolbar1: "bold italic underline strikethrough | subscript superscript | forecolor backcolor | blockquote link | %DIR% | removeformat",
toolbar2: "formatselect | alignleft aligncenter alignright | bullist numlist outdent indent | searchreplace",
toolbar_items_size: 'small',
menubar: false,
resize: false,
statusbar: false,
contextmenu: "link | 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];
ed.settings.directionality = dir;
// Include button for opposite direction, to function as a toggle
ed.settings.toolbar1 = ed.settings.toolbar1.replace(
"%DIR%",
dir.split("").reverse().join("")
);
},
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>