-
Notifications
You must be signed in to change notification settings - Fork 0
/
example of note.html
196 lines (179 loc) · 5.26 KB
/
example of note.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!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.min.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,
/********** START of xEDIT *********
plugin ds_fontsize added to plugins & contextmenu
fontsizeselect in toolbar1
fontsize_formats: "8px 10px 12px 14px 16px 18px"
*********/
plugins: "autolink,code,custom_plug,contextmenu,directionality,link,lists,paste,searchreplace,textcolor",
toolbar1: "bold italic underline strikethrough | subscript superscript | forecolor backcolor | removeformat | blockquote link | fontsizeselect",
toolbar2: "formatselect | alignleft aligncenter alignright | bullist numlist outdent indent | %DIR% | searchreplace",
toolbar_items_size: 'small',
menubar: false,
resize: false,
statusbar: false,
fontsize_formats: "8px 10px 12px 14px 16px 18px",
contextmenu: "cut copy paste | link | alignmentmenu | dir | code",
/********** END of xEDIT **************/
link_context_toolbar: true,
link_assume_external_targets: true,
target_list: false,
setup: function (editor) {
setLocale(editor);
// Add alignment submenu to context menu
editor.addMenuItem(
'alignmentmenu',
{
icon: 'alignleft',
text: 'Alignment',
menu: [
{
icon: 'alignleft',
text: 'Align Left',
onclick: function () {
tinyMCE.execCommand('JustifyLeft');
},
context: 'insert'
},
{
icon: 'aligncenter',
text: 'Align Center',
onclick: function () {
tinyMCE.execCommand('JustifyCenter');
},
context: 'insert'
},
{
icon: 'alignright',
text: 'Align Right',
onclick: function () {
tinyMCE.execCommand('JustifyRight');
},
context: 'insert'
},
{
icon: 'alignjustify',
text: 'Justify',
onclick: function () {
tinyMCE.execCommand('JustifyFull');
},
context: 'insert'
}
]
}
);
// Add alignment split-button menu
//
// https://codepen.io/alangill/pen/oLJAOd
//
// Not currently used, but useful if we need more toolbar space
/*editor.addButton(
'alignmentsplit', {
type: 'splitbutton',
text: '',
icon: 'alignleft',
onclick: function(e) {
tinyMCE.execCommand(this.value);
},
menu: [
{
icon: 'alignleft',
text: 'Align Left',
onclick: function() {
tinyMCE.execCommand('JustifyLeft');
this.parent().parent().icon('alignleft');
this.parent().parent().value = 'JustifyLeft';
}
},
{
icon: 'aligncenter',
text: 'Align Center',
onclick: function() {
tinyMCE.execCommand('JustifyCenter');
this.parent().parent().icon('aligncenter');
this.parent().parent().value = 'JustifyCenter';
}
},
{
icon: 'alignright',
text: 'Align Right',
onclick: function() {
tinyMCE.execCommand('JustifyRight');
this.parent().parent().icon('alignright');
this.parent().parent().value = 'JustifyRight';
}
},
{
icon: 'alignjustify',
text: 'Justify',
onclick: function() {
tinyMCE.execCommand('JustifyFull');
this.parent().parent().icon('alignjustify');
this.parent().parent().value = 'JustifyFull';
}
}
],
onPostRender: function() {
// Select the first item by default
this.value ='JustifyLeft';
}
}
);*/
// Set text direction
var dir = window.location.href.match(/dir=(ltr|rtl)/)[1];
var opDir = dir.split("").reverse().join("");
editor.settings.directionality = dir;
editor.addMenuItem('dir', {
icon: opDir,
// TODO: Show correct label based on current line
text: opDir == 'rtl' ? "Right to left" : "Left to right",
onclick: function () {
editor.execCommand('mceDirection' + opDir.toUpperCase());
},
context: 'insert',
prependToContext: true
});
},
init_instance_callback: function (editor) {
zoteroInit(editor);
['Change', 'KeyDown', 'KeyPress', 'Undo', 'Redo'].forEach(eventName =>
editor.on(eventName, event => zoteroHandleEvent(event))
);
["Cut", "Copy", "Paste"].forEach(function (command) {
let cmd = command;
editor.addCommand(command, function (ui, value) {
zoteroExecCommand(editor.getDoc(), cmd, ui, value);
});
});
["ZoteroLinkClick"].forEach(function (command) {
editor.addCommand(command, function (ui, value) {
zoteroHandleEvent({
type: command,
value
});
});
});
}
});
tinymce.execCommand("mceAddEditor", true, "tinymce");
</script>
</head>
<body>
<div id="tinymce"></div>
</body>
</html>