author | ymh <ymh.work@gmail.com> |
Mon, 14 Oct 2019 18:28:13 +0200 | |
changeset 9 | 177826044cd9 |
parent 7 | cf61fcea0001 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1 |
(function () { |
9 | 2 |
var paste = (function (domGlobals) { |
3 |
'use strict'; |
|
5 | 4 |
|
9 | 5 |
var Cell = function (initial) { |
6 |
var value = initial; |
|
7 |
var get = function () { |
|
8 |
return value; |
|
9 |
}; |
|
10 |
var set = function (v) { |
|
11 |
value = v; |
|
12 |
}; |
|
13 |
var clone = function () { |
|
14 |
return Cell(get()); |
|
15 |
}; |
|
16 |
return { |
|
17 |
get: get, |
|
18 |
set: set, |
|
19 |
clone: clone |
|
20 |
}; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
}; |
9 | 22 |
|
23 |
var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); |
|
5 | 24 |
|
9 | 25 |
var hasProPlugin = function (editor) { |
26 |
if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global.get('powerpaste')) { |
|
27 |
if (typeof domGlobals.window.console !== 'undefined' && domGlobals.window.console.log) { |
|
28 |
domGlobals.window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.'); |
|
29 |
} |
|
30 |
return true; |
|
31 |
} else { |
|
32 |
return false; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
33 |
} |
9 | 34 |
}; |
35 |
var DetectProPlugin = { hasProPlugin: hasProPlugin }; |
|
5 | 36 |
|
9 | 37 |
var get = function (clipboard, quirks) { |
38 |
return { |
|
39 |
clipboard: clipboard, |
|
40 |
quirks: quirks |
|
41 |
}; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
42 |
}; |
9 | 43 |
var Api = { get: get }; |
5 | 44 |
|
9 | 45 |
var firePastePreProcess = function (editor, html, internal, isWordHtml) { |
46 |
return editor.fire('PastePreProcess', { |
|
47 |
content: html, |
|
48 |
internal: internal, |
|
49 |
wordContent: isWordHtml |
|
50 |
}); |
|
51 |
}; |
|
52 |
var firePastePostProcess = function (editor, node, internal, isWordHtml) { |
|
53 |
return editor.fire('PastePostProcess', { |
|
54 |
node: node, |
|
55 |
internal: internal, |
|
56 |
wordContent: isWordHtml |
|
57 |
}); |
|
58 |
}; |
|
59 |
var firePastePlainTextToggle = function (editor, state) { |
|
60 |
return editor.fire('PastePlainTextToggle', { state: state }); |
|
61 |
}; |
|
62 |
var firePaste = function (editor, ieFake) { |
|
63 |
return editor.fire('paste', { ieFake: ieFake }); |
|
64 |
}; |
|
65 |
var Events = { |
|
66 |
firePastePreProcess: firePastePreProcess, |
|
67 |
firePastePostProcess: firePastePostProcess, |
|
68 |
firePastePlainTextToggle: firePastePlainTextToggle, |
|
69 |
firePaste: firePaste |
|
70 |
}; |
|
5 | 71 |
|
9 | 72 |
var shouldPlainTextInform = function (editor) { |
73 |
return editor.getParam('paste_plaintext_inform', true); |
|
74 |
}; |
|
75 |
var shouldBlockDrop = function (editor) { |
|
76 |
return editor.getParam('paste_block_drop', false); |
|
77 |
}; |
|
78 |
var shouldPasteDataImages = function (editor) { |
|
79 |
return editor.getParam('paste_data_images', false); |
|
80 |
}; |
|
81 |
var shouldFilterDrop = function (editor) { |
|
82 |
return editor.getParam('paste_filter_drop', true); |
|
83 |
}; |
|
84 |
var getPreProcess = function (editor) { |
|
85 |
return editor.getParam('paste_preprocess'); |
|
86 |
}; |
|
87 |
var getPostProcess = function (editor) { |
|
88 |
return editor.getParam('paste_postprocess'); |
|
89 |
}; |
|
90 |
var getWebkitStyles = function (editor) { |
|
91 |
return editor.getParam('paste_webkit_styles'); |
|
92 |
}; |
|
93 |
var shouldRemoveWebKitStyles = function (editor) { |
|
94 |
return editor.getParam('paste_remove_styles_if_webkit', true); |
|
95 |
}; |
|
96 |
var shouldMergeFormats = function (editor) { |
|
97 |
return editor.getParam('paste_merge_formats', true); |
|
98 |
}; |
|
99 |
var isSmartPasteEnabled = function (editor) { |
|
100 |
return editor.getParam('smart_paste', true); |
|
101 |
}; |
|
102 |
var isPasteAsTextEnabled = function (editor) { |
|
103 |
return editor.getParam('paste_as_text', false); |
|
104 |
}; |
|
105 |
var getRetainStyleProps = function (editor) { |
|
106 |
return editor.getParam('paste_retain_style_properties'); |
|
107 |
}; |
|
108 |
var getWordValidElements = function (editor) { |
|
109 |
var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody'; |
|
110 |
return editor.getParam('paste_word_valid_elements', defaultValidElements); |
|
111 |
}; |
|
112 |
var shouldConvertWordFakeLists = function (editor) { |
|
113 |
return editor.getParam('paste_convert_word_fake_lists', true); |
|
114 |
}; |
|
115 |
var shouldUseDefaultFilters = function (editor) { |
|
116 |
return editor.getParam('paste_enable_default_filters', true); |
|
117 |
}; |
|
118 |
var Settings = { |
|
119 |
shouldPlainTextInform: shouldPlainTextInform, |
|
120 |
shouldBlockDrop: shouldBlockDrop, |
|
121 |
shouldPasteDataImages: shouldPasteDataImages, |
|
122 |
shouldFilterDrop: shouldFilterDrop, |
|
123 |
getPreProcess: getPreProcess, |
|
124 |
getPostProcess: getPostProcess, |
|
125 |
getWebkitStyles: getWebkitStyles, |
|
126 |
shouldRemoveWebKitStyles: shouldRemoveWebKitStyles, |
|
127 |
shouldMergeFormats: shouldMergeFormats, |
|
128 |
isSmartPasteEnabled: isSmartPasteEnabled, |
|
129 |
isPasteAsTextEnabled: isPasteAsTextEnabled, |
|
130 |
getRetainStyleProps: getRetainStyleProps, |
|
131 |
getWordValidElements: getWordValidElements, |
|
132 |
shouldConvertWordFakeLists: shouldConvertWordFakeLists, |
|
133 |
shouldUseDefaultFilters: shouldUseDefaultFilters |
|
134 |
}; |
|
5 | 135 |
|
9 | 136 |
var shouldInformUserAboutPlainText = function (editor, userIsInformedState) { |
137 |
return userIsInformedState.get() === false && Settings.shouldPlainTextInform(editor); |
|
138 |
}; |
|
139 |
var displayNotification = function (editor, message) { |
|
140 |
editor.notificationManager.open({ |
|
141 |
text: editor.translate(message), |
|
142 |
type: 'info' |
|
143 |
}); |
|
144 |
}; |
|
145 |
var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) { |
|
146 |
if (clipboard.pasteFormat.get() === 'text') { |
|
147 |
clipboard.pasteFormat.set('html'); |
|
148 |
Events.firePastePlainTextToggle(editor, false); |
|
149 |
} else { |
|
150 |
clipboard.pasteFormat.set('text'); |
|
151 |
Events.firePastePlainTextToggle(editor, true); |
|
152 |
if (shouldInformUserAboutPlainText(editor, userIsInformedState)) { |
|
153 |
displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.'); |
|
154 |
userIsInformedState.set(true); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
155 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
156 |
} |
9 | 157 |
editor.focus(); |
158 |
}; |
|
159 |
var Actions = { togglePlainTextPaste: togglePlainTextPaste }; |
|
160 |
||
161 |
var register = function (editor, clipboard, userIsInformedState) { |
|
162 |
editor.addCommand('mceTogglePlainTextPaste', function () { |
|
163 |
Actions.togglePlainTextPaste(editor, clipboard, userIsInformedState); |
|
164 |
}); |
|
165 |
editor.addCommand('mceInsertClipboardContent', function (ui, value) { |
|
166 |
if (value.content) { |
|
167 |
clipboard.pasteHtml(value.content, value.internal); |
|
168 |
} |
|
169 |
if (value.text) { |
|
170 |
clipboard.pasteText(value.text); |
|
171 |
} |
|
172 |
}); |
|
173 |
}; |
|
174 |
var Commands = { register: register }; |
|
175 |
||
176 |
var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); |
|
177 |
||
178 |
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay'); |
|
179 |
||
180 |
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools'); |
|
181 |
||
182 |
var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK'); |
|
183 |
||
184 |
var internalMimeType = 'x-tinymce/html'; |
|
185 |
var internalMark = '<!-- ' + internalMimeType + ' -->'; |
|
186 |
var mark = function (html) { |
|
187 |
return internalMark + html; |
|
188 |
}; |
|
189 |
var unmark = function (html) { |
|
190 |
return html.replace(internalMark, ''); |
|
191 |
}; |
|
192 |
var isMarked = function (html) { |
|
193 |
return html.indexOf(internalMark) !== -1; |
|
194 |
}; |
|
195 |
var InternalHtml = { |
|
196 |
mark: mark, |
|
197 |
unmark: unmark, |
|
198 |
isMarked: isMarked, |
|
199 |
internalHtmlMime: function () { |
|
200 |
return internalMimeType; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
}; |
9 | 203 |
|
204 |
var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities'); |
|
5 | 205 |
|
9 | 206 |
var isPlainText = function (text) { |
207 |
return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text); |
|
208 |
}; |
|
209 |
var toBRs = function (text) { |
|
210 |
return text.replace(/\r?\n/g, '<br>'); |
|
211 |
}; |
|
212 |
var openContainer = function (rootTag, rootAttrs) { |
|
213 |
var key; |
|
214 |
var attrs = []; |
|
215 |
var tag = '<' + rootTag; |
|
216 |
if (typeof rootAttrs === 'object') { |
|
217 |
for (key in rootAttrs) { |
|
218 |
if (rootAttrs.hasOwnProperty(key)) { |
|
219 |
attrs.push(key + '="' + global$5.encodeAllRaw(rootAttrs[key]) + '"'); |
|
220 |
} |
|
221 |
} |
|
222 |
if (attrs.length) { |
|
223 |
tag += ' ' + attrs.join(' '); |
|
224 |
} |
|
225 |
} |
|
226 |
return tag + '>'; |
|
227 |
}; |
|
228 |
var toBlockElements = function (text, rootTag, rootAttrs) { |
|
229 |
var blocks = text.split(/\n\n/); |
|
230 |
var tagOpen = openContainer(rootTag, rootAttrs); |
|
231 |
var tagClose = '</' + rootTag + '>'; |
|
232 |
var paragraphs = global$3.map(blocks, function (p) { |
|
233 |
return p.split(/\n/).join('<br />'); |
|
234 |
}); |
|
235 |
var stitch = function (p) { |
|
236 |
return tagOpen + p + tagClose; |
|
237 |
}; |
|
238 |
return paragraphs.length === 1 ? paragraphs[0] : global$3.map(paragraphs, stitch).join(''); |
|
239 |
}; |
|
240 |
var convert = function (text, rootTag, rootAttrs) { |
|
241 |
return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text); |
|
242 |
}; |
|
243 |
var Newlines = { |
|
244 |
isPlainText: isPlainText, |
|
245 |
convert: convert, |
|
246 |
toBRs: toBRs, |
|
247 |
toBlockElements: toBlockElements |
|
248 |
}; |
|
5 | 249 |
|
9 | 250 |
var global$6 = tinymce.util.Tools.resolve('tinymce.html.DomParser'); |
251 |
||
252 |
var global$7 = tinymce.util.Tools.resolve('tinymce.html.Node'); |
|
5 | 253 |
|
9 | 254 |
var global$8 = tinymce.util.Tools.resolve('tinymce.html.Schema'); |
255 |
||
256 |
var global$9 = tinymce.util.Tools.resolve('tinymce.html.Serializer'); |
|
5 | 257 |
|
9 | 258 |
function filter(content, items) { |
259 |
global$3.each(items, function (v) { |
|
260 |
if (v.constructor === RegExp) { |
|
261 |
content = content.replace(v, ''); |
|
262 |
} else { |
|
263 |
content = content.replace(v[0], v[1]); |
|
264 |
} |
|
265 |
}); |
|
266 |
return content; |
|
267 |
} |
|
268 |
function innerText(html) { |
|
269 |
var schema = global$8(); |
|
270 |
var domParser = global$6({}, schema); |
|
271 |
var text = ''; |
|
272 |
var shortEndedElements = schema.getShortEndedElements(); |
|
273 |
var ignoreElements = global$3.makeMap('script noscript style textarea video audio iframe object', ' '); |
|
274 |
var blockElements = schema.getBlockElements(); |
|
275 |
function walk(node) { |
|
276 |
var name = node.name, currentNode = node; |
|
277 |
if (name === 'br') { |
|
278 |
text += '\n'; |
|
279 |
return; |
|
280 |
} |
|
281 |
if (name === 'wbr') { |
|
282 |
return; |
|
283 |
} |
|
284 |
if (shortEndedElements[name]) { |
|
285 |
text += ' '; |
|
286 |
} |
|
287 |
if (ignoreElements[name]) { |
|
288 |
text += ' '; |
|
289 |
return; |
|
290 |
} |
|
291 |
if (node.type === 3) { |
|
292 |
text += node.value; |
|
293 |
} |
|
294 |
if (!node.shortEnded) { |
|
295 |
if (node = node.firstChild) { |
|
296 |
do { |
|
297 |
walk(node); |
|
298 |
} while (node = node.next); |
|
299 |
} |
|
300 |
} |
|
301 |
if (blockElements[name] && currentNode.next) { |
|
302 |
text += '\n'; |
|
303 |
if (name === 'p') { |
|
304 |
text += '\n'; |
|
305 |
} |
|
306 |
} |
|
307 |
} |
|
308 |
html = filter(html, [/<!\[[^\]]+\]>/g]); |
|
309 |
walk(domParser.parse(html)); |
|
310 |
return text; |
|
311 |
} |
|
312 |
function trimHtml(html) { |
|
313 |
function trimSpaces(all, s1, s2) { |
|
314 |
if (!s1 && !s2) { |
|
315 |
return ' '; |
|
316 |
} |
|
317 |
return '\xA0'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
318 |
} |
9 | 319 |
html = filter(html, [ |
320 |
/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig, |
|
321 |
/<!--StartFragment-->|<!--EndFragment-->/g, |
|
322 |
[ |
|
323 |
/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g, |
|
324 |
trimSpaces |
|
325 |
], |
|
326 |
/<br class="Apple-interchange-newline">/g, |
|
327 |
/<br>$/i |
|
328 |
]); |
|
329 |
return html; |
|
330 |
} |
|
331 |
function createIdGenerator(prefix) { |
|
332 |
var count = 0; |
|
333 |
return function () { |
|
334 |
return prefix + count++; |
|
335 |
}; |
|
336 |
} |
|
337 |
var isMsEdge = function () { |
|
338 |
return domGlobals.navigator.userAgent.indexOf(' Edge/') !== -1; |
|
339 |
}; |
|
340 |
var Utils = { |
|
341 |
filter: filter, |
|
342 |
innerText: innerText, |
|
343 |
trimHtml: trimHtml, |
|
344 |
createIdGenerator: createIdGenerator, |
|
345 |
isMsEdge: isMsEdge |
|
346 |
}; |
|
347 |
||
348 |
function isWordContent(content) { |
|
349 |
return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content); |
|
350 |
} |
|
351 |
function isNumericList(text) { |
|
352 |
var found, patterns; |
|
353 |
patterns = [ |
|
354 |
/^[IVXLMCD]{1,2}\.[ \u00a0]/, |
|
355 |
/^[ivxlmcd]{1,2}\.[ \u00a0]/, |
|
356 |
/^[a-z]{1,2}[\.\)][ \u00a0]/, |
|
357 |
/^[A-Z]{1,2}[\.\)][ \u00a0]/, |
|
358 |
/^[0-9]+\.[ \u00a0]/, |
|
359 |
/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/, |
|
360 |
/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/ |
|
361 |
]; |
|
362 |
text = text.replace(/^[\u00a0 ]+/, ''); |
|
363 |
global$3.each(patterns, function (pattern) { |
|
364 |
if (pattern.test(text)) { |
|
365 |
found = true; |
|
366 |
return false; |
|
367 |
} |
|
368 |
}); |
|
369 |
return found; |
|
370 |
} |
|
371 |
function isBulletList(text) { |
|
372 |
return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text); |
|
373 |
} |
|
374 |
function convertFakeListsToProperLists(node) { |
|
375 |
var currentListNode, prevListNode, lastLevel = 1; |
|
376 |
function getText(node) { |
|
377 |
var txt = ''; |
|
378 |
if (node.type === 3) { |
|
379 |
return node.value; |
|
380 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
381 |
if (node = node.firstChild) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
382 |
do { |
9 | 383 |
txt += getText(node); |
384 |
} while (node = node.next); |
|
385 |
} |
|
386 |
return txt; |
|
387 |
} |
|
388 |
function trimListStart(node, regExp) { |
|
389 |
if (node.type === 3) { |
|
390 |
if (regExp.test(node.value)) { |
|
391 |
node.value = node.value.replace(regExp, ''); |
|
392 |
return false; |
|
393 |
} |
|
394 |
} |
|
395 |
if (node = node.firstChild) { |
|
396 |
do { |
|
397 |
if (!trimListStart(node, regExp)) { |
|
398 |
return false; |
|
399 |
} |
|
400 |
} while (node = node.next); |
|
401 |
} |
|
402 |
return true; |
|
403 |
} |
|
404 |
function removeIgnoredNodes(node) { |
|
405 |
if (node._listIgnore) { |
|
406 |
node.remove(); |
|
407 |
return; |
|
408 |
} |
|
409 |
if (node = node.firstChild) { |
|
410 |
do { |
|
411 |
removeIgnoredNodes(node); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
412 |
} while (node = node.next); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
413 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
414 |
} |
9 | 415 |
function convertParagraphToLi(paragraphNode, listName, start) { |
416 |
var level = paragraphNode._listLevel || lastLevel; |
|
417 |
if (level !== lastLevel) { |
|
418 |
if (level < lastLevel) { |
|
419 |
if (currentListNode) { |
|
420 |
currentListNode = currentListNode.parent.parent; |
|
421 |
} |
|
422 |
} else { |
|
423 |
prevListNode = currentListNode; |
|
424 |
currentListNode = null; |
|
425 |
} |
|
426 |
} |
|
427 |
if (!currentListNode || currentListNode.name !== listName) { |
|
428 |
prevListNode = prevListNode || currentListNode; |
|
429 |
currentListNode = new global$7(listName, 1); |
|
430 |
if (start > 1) { |
|
431 |
currentListNode.attr('start', '' + start); |
|
432 |
} |
|
433 |
paragraphNode.wrap(currentListNode); |
|
434 |
} else { |
|
435 |
currentListNode.append(paragraphNode); |
|
436 |
} |
|
437 |
paragraphNode.name = 'li'; |
|
438 |
if (level > lastLevel && prevListNode) { |
|
439 |
prevListNode.lastChild.append(currentListNode); |
|
440 |
} |
|
441 |
lastLevel = level; |
|
442 |
removeIgnoredNodes(paragraphNode); |
|
443 |
trimListStart(paragraphNode, /^\u00a0+/); |
|
444 |
trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/); |
|
445 |
trimListStart(paragraphNode, /^\u00a0+/); |
|
446 |
} |
|
447 |
var elements = []; |
|
448 |
var child = node.firstChild; |
|
449 |
while (typeof child !== 'undefined' && child !== null) { |
|
450 |
elements.push(child); |
|
451 |
child = child.walk(); |
|
452 |
if (child !== null) { |
|
453 |
while (typeof child !== 'undefined' && child.parent !== node) { |
|
454 |
child = child.walk(); |
|
455 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
456 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
457 |
} |
9 | 458 |
for (var i = 0; i < elements.length; i++) { |
459 |
node = elements[i]; |
|
460 |
if (node.name === 'p' && node.firstChild) { |
|
461 |
var nodeText = getText(node); |
|
462 |
if (isBulletList(nodeText)) { |
|
463 |
convertParagraphToLi(node, 'ul'); |
|
464 |
continue; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
465 |
} |
9 | 466 |
if (isNumericList(nodeText)) { |
467 |
var matches = /([0-9]+)\./.exec(nodeText); |
|
468 |
var start = 1; |
|
469 |
if (matches) { |
|
470 |
start = parseInt(matches[1], 10); |
|
471 |
} |
|
472 |
convertParagraphToLi(node, 'ol', start); |
|
473 |
continue; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
474 |
} |
9 | 475 |
if (node._listLevel) { |
476 |
convertParagraphToLi(node, 'ul', 1); |
|
477 |
continue; |
|
478 |
} |
|
479 |
currentListNode = null; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
480 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
481 |
prevListNode = currentListNode; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
482 |
currentListNode = null; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
483 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
484 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
485 |
} |
9 | 486 |
function filterStyles(editor, validStyles, node, styleValue) { |
487 |
var outputStyles = {}, matches; |
|
488 |
var styles = editor.dom.parseStyle(styleValue); |
|
489 |
global$3.each(styles, function (value, name) { |
|
490 |
switch (name) { |
|
491 |
case 'mso-list': |
|
492 |
matches = /\w+ \w+([0-9]+)/i.exec(styleValue); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
493 |
if (matches) { |
9 | 494 |
node._listLevel = parseInt(matches[1], 10); |
495 |
} |
|
496 |
if (/Ignore/i.test(value) && node.firstChild) { |
|
497 |
node._listIgnore = true; |
|
498 |
node.firstChild._listIgnore = true; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
499 |
} |
9 | 500 |
break; |
501 |
case 'horiz-align': |
|
502 |
name = 'text-align'; |
|
503 |
break; |
|
504 |
case 'vert-align': |
|
505 |
name = 'vertical-align'; |
|
506 |
break; |
|
507 |
case 'font-color': |
|
508 |
case 'mso-foreground': |
|
509 |
name = 'color'; |
|
510 |
break; |
|
511 |
case 'mso-background': |
|
512 |
case 'mso-highlight': |
|
513 |
name = 'background'; |
|
514 |
break; |
|
515 |
case 'font-weight': |
|
516 |
case 'font-style': |
|
517 |
if (value !== 'normal') { |
|
518 |
outputStyles[name] = value; |
|
519 |
} |
|
520 |
return; |
|
521 |
case 'mso-element': |
|
522 |
if (/^(comment|comment-list)$/i.test(value)) { |
|
523 |
node.remove(); |
|
524 |
return; |
|
525 |
} |
|
526 |
break; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
527 |
} |
9 | 528 |
if (name.indexOf('mso-comment') === 0) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
529 |
node.remove(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
530 |
return; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
531 |
} |
9 | 532 |
if (name.indexOf('mso-') === 0) { |
533 |
return; |
|
534 |
} |
|
535 |
if (Settings.getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) { |
|
536 |
outputStyles[name] = value; |
|
537 |
} |
|
538 |
}); |
|
539 |
if (/(bold)/i.test(outputStyles['font-weight'])) { |
|
540 |
delete outputStyles['font-weight']; |
|
541 |
node.wrap(new global$7('b', 1)); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
542 |
} |
9 | 543 |
if (/(italic)/i.test(outputStyles['font-style'])) { |
544 |
delete outputStyles['font-style']; |
|
545 |
node.wrap(new global$7('i', 1)); |
|
546 |
} |
|
547 |
outputStyles = editor.dom.serializeStyle(outputStyles, node.name); |
|
548 |
if (outputStyles) { |
|
549 |
return outputStyles; |
|
550 |
} |
|
551 |
return null; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
552 |
} |
9 | 553 |
var filterWordContent = function (editor, content) { |
554 |
var retainStyleProperties, validStyles; |
|
555 |
retainStyleProperties = Settings.getRetainStyleProps(editor); |
|
556 |
if (retainStyleProperties) { |
|
557 |
validStyles = global$3.makeMap(retainStyleProperties.split(/[, ]/)); |
|
558 |
} |
|
559 |
content = Utils.filter(content, [ |
|
560 |
/<br class="?Apple-interchange-newline"?>/gi, |
|
561 |
/<b[^>]+id="?docs-internal-[^>]*>/gi, |
|
562 |
/<!--[\s\S]+?-->/gi, |
|
563 |
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, |
|
564 |
[ |
|
565 |
/<(\/?)s>/gi, |
|
566 |
'<$1strike>' |
|
567 |
], |
|
568 |
[ |
|
569 |
/ /gi, |
|
570 |
'\xA0' |
|
571 |
], |
|
572 |
[ |
|
573 |
/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi, |
|
574 |
function (str, spaces) { |
|
575 |
return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : ''; |
|
576 |
} |
|
577 |
] |
|
578 |
]); |
|
579 |
var validElements = Settings.getWordValidElements(editor); |
|
580 |
var schema = global$8({ |
|
581 |
valid_elements: validElements, |
|
582 |
valid_children: '-li[p]' |
|
583 |
}); |
|
584 |
global$3.each(schema.elements, function (rule) { |
|
585 |
if (!rule.attributes.class) { |
|
586 |
rule.attributes.class = {}; |
|
587 |
rule.attributesOrder.push('class'); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
588 |
} |
9 | 589 |
if (!rule.attributes.style) { |
590 |
rule.attributes.style = {}; |
|
591 |
rule.attributesOrder.push('style'); |
|
592 |
} |
|
593 |
}); |
|
594 |
var domParser = global$6({}, schema); |
|
595 |
domParser.addAttributeFilter('style', function (nodes) { |
|
596 |
var i = nodes.length, node; |
|
597 |
while (i--) { |
|
598 |
node = nodes[i]; |
|
599 |
node.attr('style', filterStyles(editor, validStyles, node, node.attr('style'))); |
|
600 |
if (node.name === 'span' && node.parent && !node.attributes.length) { |
|
601 |
node.unwrap(); |
|
602 |
} |
|
603 |
} |
|
604 |
}); |
|
605 |
domParser.addAttributeFilter('class', function (nodes) { |
|
606 |
var i = nodes.length, node, className; |
|
607 |
while (i--) { |
|
608 |
node = nodes[i]; |
|
609 |
className = node.attr('class'); |
|
610 |
if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) { |
|
611 |
node.remove(); |
|
612 |
} |
|
613 |
node.attr('class', null); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
614 |
} |
9 | 615 |
}); |
616 |
domParser.addNodeFilter('del', function (nodes) { |
|
617 |
var i = nodes.length; |
|
618 |
while (i--) { |
|
619 |
nodes[i].remove(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
620 |
} |
9 | 621 |
}); |
622 |
domParser.addNodeFilter('a', function (nodes) { |
|
623 |
var i = nodes.length, node, href, name; |
|
624 |
while (i--) { |
|
625 |
node = nodes[i]; |
|
626 |
href = node.attr('href'); |
|
627 |
name = node.attr('name'); |
|
628 |
if (href && href.indexOf('#_msocom_') !== -1) { |
|
629 |
node.remove(); |
|
630 |
continue; |
|
631 |
} |
|
632 |
if (href && href.indexOf('file://') === 0) { |
|
633 |
href = href.split('#')[1]; |
|
634 |
if (href) { |
|
635 |
href = '#' + href; |
|
636 |
} |
|
637 |
} |
|
638 |
if (!href && !name) { |
|
639 |
node.unwrap(); |
|
640 |
} else { |
|
641 |
if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) { |
|
642 |
node.unwrap(); |
|
643 |
continue; |
|
644 |
} |
|
645 |
node.attr({ |
|
646 |
href: href, |
|
647 |
name: name |
|
648 |
}); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
649 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
650 |
} |
9 | 651 |
}); |
652 |
var rootNode = domParser.parse(content); |
|
653 |
if (Settings.shouldConvertWordFakeLists(editor)) { |
|
654 |
convertFakeListsToProperLists(rootNode); |
|
655 |
} |
|
656 |
content = global$9({ validate: editor.settings.validate }, schema).serialize(rootNode); |
|
657 |
return content; |
|
658 |
}; |
|
659 |
var preProcess = function (editor, content) { |
|
660 |
return Settings.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content; |
|
661 |
}; |
|
662 |
var WordFilter = { |
|
663 |
preProcess: preProcess, |
|
664 |
isWordContent: isWordContent |
|
665 |
}; |
|
666 |
||
667 |
var processResult = function (content, cancelled) { |
|
668 |
return { |
|
669 |
content: content, |
|
670 |
cancelled: cancelled |
|
671 |
}; |
|
672 |
}; |
|
673 |
var postProcessFilter = function (editor, html, internal, isWordHtml) { |
|
674 |
var tempBody = editor.dom.create('div', { style: 'display:none' }, html); |
|
675 |
var postProcessArgs = Events.firePastePostProcess(editor, tempBody, internal, isWordHtml); |
|
676 |
return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented()); |
|
677 |
}; |
|
678 |
var filterContent = function (editor, content, internal, isWordHtml) { |
|
679 |
var preProcessArgs = Events.firePastePreProcess(editor, content, internal, isWordHtml); |
|
680 |
if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) { |
|
681 |
return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml); |
|
682 |
} else { |
|
683 |
return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented()); |
|
684 |
} |
|
685 |
}; |
|
686 |
var process = function (editor, html, internal) { |
|
687 |
var isWordHtml = WordFilter.isWordContent(html); |
|
688 |
var content = isWordHtml ? WordFilter.preProcess(editor, html) : html; |
|
689 |
return filterContent(editor, content, internal, isWordHtml); |
|
690 |
}; |
|
691 |
var ProcessFilters = { process: process }; |
|
692 |
||
693 |
var removeMeta = function (editor, html) { |
|
694 |
var body = editor.dom.create('body', {}, html); |
|
695 |
global$3.each(body.querySelectorAll('meta'), function (elm) { |
|
696 |
return elm.parentNode.removeChild(elm); |
|
697 |
}); |
|
698 |
return body.innerHTML; |
|
699 |
}; |
|
700 |
var pasteHtml = function (editor, html) { |
|
701 |
editor.insertContent(removeMeta(editor, html), { |
|
702 |
merge: Settings.shouldMergeFormats(editor), |
|
703 |
paste: true |
|
704 |
}); |
|
705 |
return true; |
|
706 |
}; |
|
707 |
var isAbsoluteUrl = function (url) { |
|
708 |
return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url); |
|
709 |
}; |
|
710 |
var isImageUrl = function (url) { |
|
711 |
return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url); |
|
712 |
}; |
|
713 |
var createImage = function (editor, url, pasteHtmlFn) { |
|
714 |
editor.undoManager.extra(function () { |
|
715 |
pasteHtmlFn(editor, url); |
|
716 |
}, function () { |
|
717 |
editor.insertContent('<img src="' + url + '">'); |
|
718 |
}); |
|
719 |
return true; |
|
720 |
}; |
|
721 |
var createLink = function (editor, url, pasteHtmlFn) { |
|
722 |
editor.undoManager.extra(function () { |
|
723 |
pasteHtmlFn(editor, url); |
|
724 |
}, function () { |
|
725 |
editor.execCommand('mceInsertLink', false, url); |
|
726 |
}); |
|
727 |
return true; |
|
728 |
}; |
|
729 |
var linkSelection = function (editor, html, pasteHtmlFn) { |
|
730 |
return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false; |
|
731 |
}; |
|
732 |
var insertImage = function (editor, html, pasteHtmlFn) { |
|
733 |
return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false; |
|
734 |
}; |
|
735 |
var smartInsertContent = function (editor, html) { |
|
736 |
global$3.each([ |
|
737 |
linkSelection, |
|
738 |
insertImage, |
|
739 |
pasteHtml |
|
740 |
], function (action) { |
|
741 |
return action(editor, html, pasteHtml) !== true; |
|
742 |
}); |
|
743 |
}; |
|
744 |
var insertContent = function (editor, html) { |
|
745 |
if (Settings.isSmartPasteEnabled(editor) === false) { |
|
746 |
pasteHtml(editor, html); |
|
747 |
} else { |
|
748 |
smartInsertContent(editor, html); |
|
749 |
} |
|
750 |
}; |
|
751 |
var SmartPaste = { |
|
752 |
isImageUrl: isImageUrl, |
|
753 |
isAbsoluteUrl: isAbsoluteUrl, |
|
754 |
insertContent: insertContent |
|
755 |
}; |
|
756 |
||
757 |
var constant = function (value) { |
|
758 |
return function () { |
|
759 |
return value; |
|
760 |
}; |
|
761 |
}; |
|
762 |
function curry(fn) { |
|
763 |
var initialArgs = []; |
|
764 |
for (var _i = 1; _i < arguments.length; _i++) { |
|
765 |
initialArgs[_i - 1] = arguments[_i]; |
|
766 |
} |
|
767 |
return function () { |
|
768 |
var restArgs = []; |
|
769 |
for (var _i = 0; _i < arguments.length; _i++) { |
|
770 |
restArgs[_i] = arguments[_i]; |
|
771 |
} |
|
772 |
var all = initialArgs.concat(restArgs); |
|
773 |
return fn.apply(null, all); |
|
774 |
}; |
|
775 |
} |
|
776 |
var never = constant(false); |
|
777 |
var always = constant(true); |
|
778 |
||
779 |
var never$1 = never; |
|
780 |
var always$1 = always; |
|
781 |
var none = function () { |
|
782 |
return NONE; |
|
783 |
}; |
|
784 |
var NONE = function () { |
|
785 |
var eq = function (o) { |
|
786 |
return o.isNone(); |
|
787 |
}; |
|
788 |
var call = function (thunk) { |
|
789 |
return thunk(); |
|
790 |
}; |
|
791 |
var id = function (n) { |
|
792 |
return n; |
|
793 |
}; |
|
794 |
var noop = function () { |
|
795 |
}; |
|
796 |
var nul = function () { |
|
797 |
return null; |
|
798 |
}; |
|
799 |
var undef = function () { |
|
800 |
return undefined; |
|
801 |
}; |
|
802 |
var me = { |
|
803 |
fold: function (n, s) { |
|
804 |
return n(); |
|
805 |
}, |
|
806 |
is: never$1, |
|
807 |
isSome: never$1, |
|
808 |
isNone: always$1, |
|
809 |
getOr: id, |
|
810 |
getOrThunk: call, |
|
811 |
getOrDie: function (msg) { |
|
812 |
throw new Error(msg || 'error: getOrDie called on none.'); |
|
813 |
}, |
|
814 |
getOrNull: nul, |
|
815 |
getOrUndefined: undef, |
|
816 |
or: id, |
|
817 |
orThunk: call, |
|
818 |
map: none, |
|
819 |
ap: none, |
|
820 |
each: noop, |
|
821 |
bind: none, |
|
822 |
flatten: none, |
|
823 |
exists: never$1, |
|
824 |
forall: always$1, |
|
825 |
filter: none, |
|
826 |
equals: eq, |
|
827 |
equals_: eq, |
|
828 |
toArray: function () { |
|
829 |
return []; |
|
830 |
}, |
|
831 |
toString: constant('none()') |
|
832 |
}; |
|
833 |
if (Object.freeze) |
|
834 |
Object.freeze(me); |
|
835 |
return me; |
|
836 |
}(); |
|
837 |
var some = function (a) { |
|
838 |
var constant_a = function () { |
|
839 |
return a; |
|
840 |
}; |
|
841 |
var self = function () { |
|
842 |
return me; |
|
843 |
}; |
|
844 |
var map = function (f) { |
|
845 |
return some(f(a)); |
|
846 |
}; |
|
847 |
var bind = function (f) { |
|
848 |
return f(a); |
|
849 |
}; |
|
850 |
var me = { |
|
851 |
fold: function (n, s) { |
|
852 |
return s(a); |
|
853 |
}, |
|
854 |
is: function (v) { |
|
855 |
return a === v; |
|
856 |
}, |
|
857 |
isSome: always$1, |
|
858 |
isNone: never$1, |
|
859 |
getOr: constant_a, |
|
860 |
getOrThunk: constant_a, |
|
861 |
getOrDie: constant_a, |
|
862 |
getOrNull: constant_a, |
|
863 |
getOrUndefined: constant_a, |
|
864 |
or: self, |
|
865 |
orThunk: self, |
|
866 |
map: map, |
|
867 |
ap: function (optfab) { |
|
868 |
return optfab.fold(none, function (fab) { |
|
869 |
return some(fab(a)); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
870 |
}); |
9 | 871 |
}, |
872 |
each: function (f) { |
|
873 |
f(a); |
|
874 |
}, |
|
875 |
bind: bind, |
|
876 |
flatten: constant_a, |
|
877 |
exists: bind, |
|
878 |
forall: bind, |
|
879 |
filter: function (f) { |
|
880 |
return f(a) ? me : NONE; |
|
881 |
}, |
|
882 |
equals: function (o) { |
|
883 |
return o.is(a); |
|
884 |
}, |
|
885 |
equals_: function (o, elementEq) { |
|
886 |
return o.fold(never$1, function (b) { |
|
887 |
return elementEq(a, b); |
|
888 |
}); |
|
889 |
}, |
|
890 |
toArray: function () { |
|
891 |
return [a]; |
|
892 |
}, |
|
893 |
toString: function () { |
|
894 |
return 'some(' + a + ')'; |
|
895 |
} |
|
896 |
}; |
|
897 |
return me; |
|
898 |
}; |
|
899 |
var from = function (value) { |
|
900 |
return value === null || value === undefined ? NONE : some(value); |
|
901 |
}; |
|
902 |
var Option = { |
|
903 |
some: some, |
|
904 |
none: none, |
|
905 |
from: from |
|
906 |
}; |
|
907 |
||
908 |
var typeOf = function (x) { |
|
909 |
if (x === null) |
|
910 |
return 'null'; |
|
911 |
var t = typeof x; |
|
912 |
if (t === 'object' && Array.prototype.isPrototypeOf(x)) |
|
913 |
return 'array'; |
|
914 |
if (t === 'object' && String.prototype.isPrototypeOf(x)) |
|
915 |
return 'string'; |
|
916 |
return t; |
|
917 |
}; |
|
918 |
var isType = function (type) { |
|
919 |
return function (value) { |
|
920 |
return typeOf(value) === type; |
|
921 |
}; |
|
922 |
}; |
|
923 |
var isFunction = isType('function'); |
|
924 |
||
925 |
var map = function (xs, f) { |
|
926 |
var len = xs.length; |
|
927 |
var r = new Array(len); |
|
928 |
for (var i = 0; i < len; i++) { |
|
929 |
var x = xs[i]; |
|
930 |
r[i] = f(x, i, xs); |
|
931 |
} |
|
932 |
return r; |
|
933 |
}; |
|
934 |
var each = function (xs, f) { |
|
935 |
for (var i = 0, len = xs.length; i < len; i++) { |
|
936 |
var x = xs[i]; |
|
937 |
f(x, i, xs); |
|
938 |
} |
|
939 |
}; |
|
940 |
var filter$1 = function (xs, pred) { |
|
941 |
var r = []; |
|
942 |
for (var i = 0, len = xs.length; i < len; i++) { |
|
943 |
var x = xs[i]; |
|
944 |
if (pred(x, i, xs)) { |
|
945 |
r.push(x); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
946 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
947 |
} |
9 | 948 |
return r; |
949 |
}; |
|
950 |
var slice = Array.prototype.slice; |
|
951 |
var from$1 = isFunction(Array.from) ? Array.from : function (x) { |
|
952 |
return slice.call(x); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
953 |
}; |
9 | 954 |
|
955 |
var nu = function (baseFn) { |
|
956 |
var data = Option.none(); |
|
957 |
var callbacks = []; |
|
958 |
var map = function (f) { |
|
959 |
return nu(function (nCallback) { |
|
960 |
get(function (data) { |
|
961 |
nCallback(f(data)); |
|
962 |
}); |
|
963 |
}); |
|
964 |
}; |
|
965 |
var get = function (nCallback) { |
|
966 |
if (isReady()) |
|
967 |
call(nCallback); |
|
968 |
else |
|
969 |
callbacks.push(nCallback); |
|
970 |
}; |
|
971 |
var set = function (x) { |
|
972 |
data = Option.some(x); |
|
973 |
run(callbacks); |
|
974 |
callbacks = []; |
|
975 |
}; |
|
976 |
var isReady = function () { |
|
977 |
return data.isSome(); |
|
978 |
}; |
|
979 |
var run = function (cbs) { |
|
980 |
each(cbs, call); |
|
981 |
}; |
|
982 |
var call = function (cb) { |
|
983 |
data.each(function (x) { |
|
984 |
domGlobals.setTimeout(function () { |
|
985 |
cb(x); |
|
986 |
}, 0); |
|
987 |
}); |
|
988 |
}; |
|
989 |
baseFn(set); |
|
990 |
return { |
|
991 |
get: get, |
|
992 |
map: map, |
|
993 |
isReady: isReady |
|
994 |
}; |
|
995 |
}; |
|
996 |
var pure = function (a) { |
|
997 |
return nu(function (callback) { |
|
998 |
callback(a); |
|
999 |
}); |
|
1000 |
}; |
|
1001 |
var LazyValue = { |
|
1002 |
nu: nu, |
|
1003 |
pure: pure |
|
1004 |
}; |
|
1005 |
||
1006 |
var bounce = function (f) { |
|
1007 |
return function () { |
|
1008 |
var args = []; |
|
1009 |
for (var _i = 0; _i < arguments.length; _i++) { |
|
1010 |
args[_i] = arguments[_i]; |
|
1011 |
} |
|
1012 |
var me = this; |
|
1013 |
domGlobals.setTimeout(function () { |
|
1014 |
f.apply(me, args); |
|
1015 |
}, 0); |
|
1016 |
}; |
|
1017 |
}; |
|
5 | 1018 |
|
9 | 1019 |
var nu$1 = function (baseFn) { |
1020 |
var get = function (callback) { |
|
1021 |
baseFn(bounce(callback)); |
|
1022 |
}; |
|
1023 |
var map = function (fab) { |
|
1024 |
return nu$1(function (callback) { |
|
1025 |
get(function (a) { |
|
1026 |
var value = fab(a); |
|
1027 |
callback(value); |
|
1028 |
}); |
|
1029 |
}); |
|
1030 |
}; |
|
1031 |
var bind = function (aFutureB) { |
|
1032 |
return nu$1(function (callback) { |
|
1033 |
get(function (a) { |
|
1034 |
aFutureB(a).get(callback); |
|
1035 |
}); |
|
1036 |
}); |
|
1037 |
}; |
|
1038 |
var anonBind = function (futureB) { |
|
1039 |
return nu$1(function (callback) { |
|
1040 |
get(function (a) { |
|
1041 |
futureB.get(callback); |
|
1042 |
}); |
|
1043 |
}); |
|
1044 |
}; |
|
1045 |
var toLazy = function () { |
|
1046 |
return LazyValue.nu(get); |
|
1047 |
}; |
|
1048 |
var toCached = function () { |
|
1049 |
var cache = null; |
|
1050 |
return nu$1(function (callback) { |
|
1051 |
if (cache === null) { |
|
1052 |
cache = toLazy(); |
|
1053 |
} |
|
1054 |
cache.get(callback); |
|
1055 |
}); |
|
1056 |
}; |
|
1057 |
return { |
|
1058 |
map: map, |
|
1059 |
bind: bind, |
|
1060 |
anonBind: anonBind, |
|
1061 |
toLazy: toLazy, |
|
1062 |
toCached: toCached, |
|
1063 |
get: get |
|
1064 |
}; |
|
1065 |
}; |
|
1066 |
var pure$1 = function (a) { |
|
1067 |
return nu$1(function (callback) { |
|
1068 |
callback(a); |
|
1069 |
}); |
|
1070 |
}; |
|
1071 |
var Future = { |
|
1072 |
nu: nu$1, |
|
1073 |
pure: pure$1 |
|
1074 |
}; |
|
5 | 1075 |
|
9 | 1076 |
var par = function (asyncValues, nu) { |
1077 |
return nu(function (callback) { |
|
1078 |
var r = []; |
|
1079 |
var count = 0; |
|
1080 |
var cb = function (i) { |
|
1081 |
return function (value) { |
|
1082 |
r[i] = value; |
|
1083 |
count++; |
|
1084 |
if (count >= asyncValues.length) { |
|
1085 |
callback(r); |
|
1086 |
} |
|
1087 |
}; |
|
1088 |
}; |
|
1089 |
if (asyncValues.length === 0) { |
|
1090 |
callback([]); |
|
1091 |
} else { |
|
1092 |
each(asyncValues, function (asyncValue, i) { |
|
1093 |
asyncValue.get(cb(i)); |
|
1094 |
}); |
|
1095 |
} |
|
1096 |
}); |
|
1097 |
}; |
|
1098 |
||
1099 |
var par$1 = function (futures) { |
|
1100 |
return par(futures, Future.nu); |
|
1101 |
}; |
|
1102 |
var mapM = function (array, fn) { |
|
1103 |
var futures = map(array, fn); |
|
1104 |
return par$1(futures); |
|
1105 |
}; |
|
1106 |
||
1107 |
var pasteHtml$1 = function (editor, html, internalFlag) { |
|
1108 |
var internal = internalFlag ? internalFlag : InternalHtml.isMarked(html); |
|
1109 |
var args = ProcessFilters.process(editor, InternalHtml.unmark(html), internal); |
|
1110 |
if (args.cancelled === false) { |
|
1111 |
SmartPaste.insertContent(editor, args.content); |
|
1112 |
} |
|
1113 |
}; |
|
1114 |
var pasteText = function (editor, text) { |
|
1115 |
text = editor.dom.encode(text).replace(/\r\n/g, '\n'); |
|
1116 |
text = Newlines.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs); |
|
1117 |
pasteHtml$1(editor, text, false); |
|
1118 |
}; |
|
1119 |
var getDataTransferItems = function (dataTransfer) { |
|
1120 |
var items = {}; |
|
1121 |
var mceInternalUrlPrefix = 'data:text/mce-internal,'; |
|
1122 |
if (dataTransfer) { |
|
1123 |
if (dataTransfer.getData) { |
|
1124 |
var legacyText = dataTransfer.getData('Text'); |
|
1125 |
if (legacyText && legacyText.length > 0) { |
|
1126 |
if (legacyText.indexOf(mceInternalUrlPrefix) === -1) { |
|
1127 |
items['text/plain'] = legacyText; |
|
1128 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1129 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1130 |
} |
9 | 1131 |
if (dataTransfer.types) { |
1132 |
for (var i = 0; i < dataTransfer.types.length; i++) { |
|
1133 |
var contentType = dataTransfer.types[i]; |
|
1134 |
try { |
|
1135 |
items[contentType] = dataTransfer.getData(contentType); |
|
1136 |
} catch (ex) { |
|
1137 |
items[contentType] = ''; |
|
1138 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1139 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1140 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1141 |
} |
9 | 1142 |
return items; |
1143 |
}; |
|
1144 |
var getClipboardContent = function (editor, clipboardEvent) { |
|
1145 |
var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer); |
|
1146 |
return Utils.isMsEdge() ? global$3.extend(content, { 'text/html': '' }) : content; |
|
1147 |
}; |
|
1148 |
var hasContentType = function (clipboardContent, mimeType) { |
|
1149 |
return mimeType in clipboardContent && clipboardContent[mimeType].length > 0; |
|
1150 |
}; |
|
1151 |
var hasHtmlOrText = function (content) { |
|
1152 |
return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain'); |
|
1153 |
}; |
|
1154 |
var getBase64FromUri = function (uri) { |
|
1155 |
var idx; |
|
1156 |
idx = uri.indexOf(','); |
|
1157 |
if (idx !== -1) { |
|
1158 |
return uri.substr(idx + 1); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1159 |
} |
9 | 1160 |
return null; |
1161 |
}; |
|
1162 |
var isValidDataUriImage = function (settings, imgElm) { |
|
1163 |
return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true; |
|
1164 |
}; |
|
1165 |
var extractFilename = function (editor, str) { |
|
1166 |
var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i); |
|
1167 |
return m ? editor.dom.encode(m[1]) : null; |
|
1168 |
}; |
|
1169 |
var uniqueId = Utils.createIdGenerator('mceclip'); |
|
1170 |
var pasteImage = function (editor, imageItem) { |
|
1171 |
var base64 = getBase64FromUri(imageItem.uri); |
|
1172 |
var id = uniqueId(); |
|
1173 |
var name = editor.settings.images_reuse_filename && imageItem.blob.name ? extractFilename(editor, imageItem.blob.name) : id; |
|
1174 |
var img = new domGlobals.Image(); |
|
1175 |
img.src = imageItem.uri; |
|
1176 |
if (isValidDataUriImage(editor.settings, img)) { |
|
1177 |
var blobCache = editor.editorUpload.blobCache; |
|
1178 |
var blobInfo = void 0, existingBlobInfo = void 0; |
|
1179 |
existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) { |
|
1180 |
return cachedBlobInfo.base64() === base64; |
|
1181 |
}); |
|
1182 |
if (!existingBlobInfo) { |
|
1183 |
blobInfo = blobCache.create(id, imageItem.blob, base64, name); |
|
1184 |
blobCache.add(blobInfo); |
|
1185 |
} else { |
|
1186 |
blobInfo = existingBlobInfo; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1187 |
} |
9 | 1188 |
pasteHtml$1(editor, '<img src="' + blobInfo.blobUri() + '">', false); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1189 |
} else { |
9 | 1190 |
pasteHtml$1(editor, '<img src="' + imageItem.uri + '">', false); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1191 |
} |
9 | 1192 |
}; |
1193 |
var isClipboardEvent = function (event) { |
|
1194 |
return event.type === 'paste'; |
|
1195 |
}; |
|
1196 |
var readBlobsAsDataUris = function (items) { |
|
1197 |
return mapM(items, function (item) { |
|
1198 |
return Future.nu(function (resolve) { |
|
1199 |
var blob = item.getAsFile ? item.getAsFile() : item; |
|
1200 |
var reader = new window.FileReader(); |
|
1201 |
reader.onload = function () { |
|
1202 |
resolve({ |
|
1203 |
blob: blob, |
|
1204 |
uri: reader.result |
|
1205 |
}); |
|
1206 |
}; |
|
1207 |
reader.readAsDataURL(blob); |
|
1208 |
}); |
|
1209 |
}); |
|
1210 |
}; |
|
1211 |
var getImagesFromDataTransfer = function (dataTransfer) { |
|
1212 |
var items = dataTransfer.items ? map(from$1(dataTransfer.items), function (item) { |
|
1213 |
return item.getAsFile(); |
|
1214 |
}) : []; |
|
1215 |
var files = dataTransfer.files ? from$1(dataTransfer.files) : []; |
|
1216 |
var images = filter$1(items.length > 0 ? items : files, function (file) { |
|
1217 |
return /^image\/(jpeg|png|gif|bmp)$/.test(file.type); |
|
1218 |
}); |
|
1219 |
return images; |
|
1220 |
}; |
|
1221 |
var pasteImageData = function (editor, e, rng) { |
|
1222 |
var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer; |
|
1223 |
if (editor.settings.paste_data_images && dataTransfer) { |
|
1224 |
var images = getImagesFromDataTransfer(dataTransfer); |
|
1225 |
if (images.length > 0) { |
|
1226 |
e.preventDefault(); |
|
1227 |
readBlobsAsDataUris(images).get(function (blobResults) { |
|
1228 |
if (rng) { |
|
1229 |
editor.selection.setRng(rng); |
|
1230 |
} |
|
1231 |
each(blobResults, function (result) { |
|
1232 |
pasteImage(editor, result); |
|
1233 |
}); |
|
1234 |
}); |
|
1235 |
return true; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1236 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1237 |
} |
9 | 1238 |
return false; |
1239 |
}; |
|
1240 |
var isBrokenAndroidClipboardEvent = function (e) { |
|
1241 |
var clipboardData = e.clipboardData; |
|
1242 |
return domGlobals.navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0; |
|
1243 |
}; |
|
1244 |
var isKeyboardPasteEvent = function (e) { |
|
1245 |
return global$4.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1246 |
}; |
9 | 1247 |
var registerEventHandlers = function (editor, pasteBin, pasteFormat) { |
1248 |
var keyboardPasteTimeStamp = 0; |
|
1249 |
var keyboardPastePlainTextState; |
|
1250 |
editor.on('keydown', function (e) { |
|
1251 |
function removePasteBinOnKeyUp(e) { |
|
1252 |
if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { |
|
1253 |
pasteBin.remove(); |
|
1254 |
} |
|
1255 |
} |
|
1256 |
if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { |
|
1257 |
keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86; |
|
1258 |
if (keyboardPastePlainTextState && global$1.webkit && domGlobals.navigator.userAgent.indexOf('Version/') !== -1) { |
|
1259 |
return; |
|
1260 |
} |
|
1261 |
e.stopImmediatePropagation(); |
|
1262 |
keyboardPasteTimeStamp = new Date().getTime(); |
|
1263 |
if (global$1.ie && keyboardPastePlainTextState) { |
|
1264 |
e.preventDefault(); |
|
1265 |
Events.firePaste(editor, true); |
|
1266 |
return; |
|
1267 |
} |
|
1268 |
pasteBin.remove(); |
|
1269 |
pasteBin.create(); |
|
1270 |
editor.once('keyup', removePasteBinOnKeyUp); |
|
1271 |
editor.once('paste', function () { |
|
1272 |
editor.off('keyup', removePasteBinOnKeyUp); |
|
1273 |
}); |
|
1274 |
} |
|
1275 |
}); |
|
1276 |
function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) { |
|
1277 |
var content, isPlainTextHtml; |
|
1278 |
if (hasContentType(clipboardContent, 'text/html')) { |
|
1279 |
content = clipboardContent['text/html']; |
|
1280 |
} else { |
|
1281 |
content = pasteBin.getHtml(); |
|
1282 |
internal = internal ? internal : InternalHtml.isMarked(content); |
|
1283 |
if (pasteBin.isDefaultContent(content)) { |
|
1284 |
plainTextMode = true; |
|
1285 |
} |
|
1286 |
} |
|
1287 |
content = Utils.trimHtml(content); |
|
1288 |
pasteBin.remove(); |
|
1289 |
isPlainTextHtml = internal === false && Newlines.isPlainText(content); |
|
1290 |
if (!content.length || isPlainTextHtml) { |
|
1291 |
plainTextMode = true; |
|
1292 |
} |
|
1293 |
if (plainTextMode) { |
|
1294 |
if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) { |
|
1295 |
content = clipboardContent['text/plain']; |
|
1296 |
} else { |
|
1297 |
content = Utils.innerText(content); |
|
1298 |
} |
|
1299 |
} |
|
1300 |
if (pasteBin.isDefaultContent(content)) { |
|
1301 |
if (!isKeyBoardPaste) { |
|
1302 |
editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.'); |
|
1303 |
} |
|
1304 |
return; |
|
1305 |
} |
|
1306 |
if (plainTextMode) { |
|
1307 |
pasteText(editor, content); |
|
1308 |
} else { |
|
1309 |
pasteHtml$1(editor, content, internal); |
|
1310 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1311 |
} |
9 | 1312 |
var getLastRng = function () { |
1313 |
return pasteBin.getLastRng() || editor.selection.getRng(); |
|
1314 |
}; |
|
1315 |
editor.on('paste', function (e) { |
|
1316 |
var clipboardTimer = new Date().getTime(); |
|
1317 |
var clipboardContent = getClipboardContent(editor, e); |
|
1318 |
var clipboardDelay = new Date().getTime() - clipboardTimer; |
|
1319 |
var isKeyBoardPaste = new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay < 1000; |
|
1320 |
var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState; |
|
1321 |
var internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime()); |
|
1322 |
keyboardPastePlainTextState = false; |
|
1323 |
if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) { |
|
1324 |
pasteBin.remove(); |
|
1325 |
return; |
|
1326 |
} |
|
1327 |
if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) { |
|
1328 |
pasteBin.remove(); |
|
1329 |
return; |
|
1330 |
} |
|
1331 |
if (!isKeyBoardPaste) { |
|
1332 |
e.preventDefault(); |
|
1333 |
} |
|
1334 |
if (global$1.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) { |
|
1335 |
pasteBin.create(); |
|
1336 |
editor.dom.bind(pasteBin.getEl(), 'paste', function (e) { |
|
1337 |
e.stopPropagation(); |
|
1338 |
}); |
|
1339 |
editor.getDoc().execCommand('Paste', false, null); |
|
1340 |
clipboardContent['text/html'] = pasteBin.getHtml(); |
|
1341 |
} |
|
1342 |
if (hasContentType(clipboardContent, 'text/html')) { |
|
1343 |
e.preventDefault(); |
|
1344 |
if (!internal) { |
|
1345 |
internal = InternalHtml.isMarked(clipboardContent['text/html']); |
|
1346 |
} |
|
1347 |
insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal); |
|
1348 |
} else { |
|
1349 |
global$2.setEditorTimeout(editor, function () { |
|
1350 |
insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal); |
|
1351 |
}, 0); |
|
1352 |
} |
|
1353 |
}); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1354 |
}; |
9 | 1355 |
var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) { |
1356 |
registerEventHandlers(editor, pasteBin, pasteFormat); |
|
1357 |
var src; |
|
1358 |
editor.parser.addNodeFilter('img', function (nodes, name, args) { |
|
1359 |
var isPasteInsert = function (args) { |
|
1360 |
return args.data && args.data.paste === true; |
|
1361 |
}; |
|
1362 |
var remove = function (node) { |
|
1363 |
if (!node.attr('data-mce-object') && src !== global$1.transparentSrc) { |
|
1364 |
node.remove(); |
|
1365 |
} |
|
1366 |
}; |
|
1367 |
var isWebKitFakeUrl = function (src) { |
|
1368 |
return src.indexOf('webkit-fake-url') === 0; |
|
1369 |
}; |
|
1370 |
var isDataUri = function (src) { |
|
1371 |
return src.indexOf('data:') === 0; |
|
1372 |
}; |
|
1373 |
if (!editor.settings.paste_data_images && isPasteInsert(args)) { |
|
1374 |
var i = nodes.length; |
|
1375 |
while (i--) { |
|
1376 |
src = nodes[i].attributes.map.src; |
|
1377 |
if (!src) { |
|
1378 |
continue; |
|
1379 |
} |
|
1380 |
if (isWebKitFakeUrl(src)) { |
|
1381 |
remove(nodes[i]); |
|
1382 |
} else if (!editor.settings.allow_html_data_urls && isDataUri(src)) { |
|
1383 |
remove(nodes[i]); |
|
1384 |
} |
|
1385 |
} |
|
1386 |
} |
|
1387 |
}); |
|
1388 |
}; |
|
5 | 1389 |
|
9 | 1390 |
var getPasteBinParent = function (editor) { |
1391 |
return global$1.ie && editor.inline ? domGlobals.document.body : editor.getBody(); |
|
1392 |
}; |
|
1393 |
var isExternalPasteBin = function (editor) { |
|
1394 |
return getPasteBinParent(editor) !== editor.getBody(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1395 |
}; |
9 | 1396 |
var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) { |
1397 |
if (isExternalPasteBin(editor)) { |
|
1398 |
editor.dom.bind(pasteBinElm, 'paste keyup', function (e) { |
|
1399 |
if (!isDefault(editor, pasteBinDefaultContent)) { |
|
1400 |
editor.fire('paste'); |
|
1401 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1402 |
}); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1403 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1404 |
}; |
9 | 1405 |
var create = function (editor, lastRngCell, pasteBinDefaultContent) { |
1406 |
var dom = editor.dom, body = editor.getBody(); |
|
1407 |
var pasteBinElm; |
|
1408 |
lastRngCell.set(editor.selection.getRng()); |
|
1409 |
pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', { |
|
1410 |
'id': 'mcepastebin', |
|
1411 |
'class': 'mce-pastebin', |
|
1412 |
'contentEditable': true, |
|
1413 |
'data-mce-bogus': 'all', |
|
1414 |
'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0' |
|
1415 |
}, pasteBinDefaultContent); |
|
1416 |
if (global$1.ie || global$1.gecko) { |
|
1417 |
dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535); |
|
1418 |
} |
|
1419 |
dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) { |
|
1420 |
e.stopPropagation(); |
|
1421 |
}); |
|
1422 |
delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent); |
|
1423 |
pasteBinElm.focus(); |
|
1424 |
editor.selection.select(pasteBinElm, true); |
|
1425 |
}; |
|
1426 |
var remove = function (editor, lastRngCell) { |
|
1427 |
if (getEl(editor)) { |
|
1428 |
var pasteBinClone = void 0; |
|
1429 |
var lastRng = lastRngCell.get(); |
|
1430 |
while (pasteBinClone = editor.dom.get('mcepastebin')) { |
|
1431 |
editor.dom.remove(pasteBinClone); |
|
1432 |
editor.dom.unbind(pasteBinClone); |
|
1433 |
} |
|
1434 |
if (lastRng) { |
|
1435 |
editor.selection.setRng(lastRng); |
|
1436 |
} |
|
1437 |
} |
|
1438 |
lastRngCell.set(null); |
|
1439 |
}; |
|
1440 |
var getEl = function (editor) { |
|
1441 |
return editor.dom.get('mcepastebin'); |
|
1442 |
}; |
|
1443 |
var getHtml = function (editor) { |
|
1444 |
var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper; |
|
1445 |
var copyAndRemove = function (toElm, fromElm) { |
|
1446 |
toElm.appendChild(fromElm); |
|
1447 |
editor.dom.remove(fromElm, true); |
|
1448 |
}; |
|
1449 |
pasteBinClones = global$3.grep(getPasteBinParent(editor).childNodes, function (elm) { |
|
1450 |
return elm.id === 'mcepastebin'; |
|
1451 |
}); |
|
1452 |
pasteBinElm = pasteBinClones.shift(); |
|
1453 |
global$3.each(pasteBinClones, function (pasteBinClone) { |
|
1454 |
copyAndRemove(pasteBinElm, pasteBinClone); |
|
1455 |
}); |
|
1456 |
dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm); |
|
1457 |
for (i = dirtyWrappers.length - 1; i >= 0; i--) { |
|
1458 |
cleanWrapper = editor.dom.create('div'); |
|
1459 |
pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]); |
|
1460 |
copyAndRemove(cleanWrapper, dirtyWrappers[i]); |
|
1461 |
} |
|
1462 |
return pasteBinElm ? pasteBinElm.innerHTML : ''; |
|
1463 |
}; |
|
1464 |
var getLastRng = function (lastRng) { |
|
1465 |
return lastRng.get(); |
|
1466 |
}; |
|
1467 |
var isDefaultContent = function (pasteBinDefaultContent, content) { |
|
1468 |
return content === pasteBinDefaultContent; |
|
1469 |
}; |
|
1470 |
var isPasteBin = function (elm) { |
|
1471 |
return elm && elm.id === 'mcepastebin'; |
|
1472 |
}; |
|
1473 |
var isDefault = function (editor, pasteBinDefaultContent) { |
|
1474 |
var pasteBinElm = getEl(editor); |
|
1475 |
return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML); |
|
1476 |
}; |
|
1477 |
var PasteBin = function (editor) { |
|
1478 |
var lastRng = Cell(null); |
|
1479 |
var pasteBinDefaultContent = '%MCEPASTEBIN%'; |
|
1480 |
return { |
|
1481 |
create: function () { |
|
1482 |
return create(editor, lastRng, pasteBinDefaultContent); |
|
1483 |
}, |
|
1484 |
remove: function () { |
|
1485 |
return remove(editor, lastRng); |
|
1486 |
}, |
|
1487 |
getEl: function () { |
|
1488 |
return getEl(editor); |
|
1489 |
}, |
|
1490 |
getHtml: function () { |
|
1491 |
return getHtml(editor); |
|
1492 |
}, |
|
1493 |
getLastRng: function () { |
|
1494 |
return getLastRng(lastRng); |
|
1495 |
}, |
|
1496 |
isDefault: function () { |
|
1497 |
return isDefault(editor, pasteBinDefaultContent); |
|
1498 |
}, |
|
1499 |
isDefaultContent: function (content) { |
|
1500 |
return isDefaultContent(pasteBinDefaultContent, content); |
|
1501 |
} |
|
1502 |
}; |
|
1503 |
}; |
|
1504 |
||
1505 |
var Clipboard = function (editor, pasteFormat) { |
|
1506 |
var pasteBin = PasteBin(editor); |
|
1507 |
editor.on('preInit', function () { |
|
1508 |
return registerEventsAndFilters(editor, pasteBin, pasteFormat); |
|
1509 |
}); |
|
1510 |
return { |
|
1511 |
pasteFormat: pasteFormat, |
|
1512 |
pasteHtml: function (html, internalFlag) { |
|
1513 |
return pasteHtml$1(editor, html, internalFlag); |
|
1514 |
}, |
|
1515 |
pasteText: function (text) { |
|
1516 |
return pasteText(editor, text); |
|
1517 |
}, |
|
1518 |
pasteImageData: function (e, rng) { |
|
1519 |
return pasteImageData(editor, e, rng); |
|
1520 |
}, |
|
1521 |
getDataTransferItems: getDataTransferItems, |
|
1522 |
hasHtmlOrText: hasHtmlOrText, |
|
1523 |
hasContentType: hasContentType |
|
1524 |
}; |
|
1525 |
}; |
|
1526 |
||
1527 |
var noop = function () { |
|
1528 |
}; |
|
1529 |
var hasWorkingClipboardApi = function (clipboardData) { |
|
1530 |
return global$1.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && Utils.isMsEdge() !== true; |
|
1531 |
}; |
|
1532 |
var setHtml5Clipboard = function (clipboardData, html, text) { |
|
1533 |
if (hasWorkingClipboardApi(clipboardData)) { |
|
1534 |
try { |
|
1535 |
clipboardData.clearData(); |
|
1536 |
clipboardData.setData('text/html', html); |
|
1537 |
clipboardData.setData('text/plain', text); |
|
1538 |
clipboardData.setData(InternalHtml.internalHtmlMime(), html); |
|
1539 |
return true; |
|
1540 |
} catch (e) { |
|
1541 |
return false; |
|
1542 |
} |
|
1543 |
} else { |
|
1544 |
return false; |
|
1545 |
} |
|
1546 |
}; |
|
1547 |
var setClipboardData = function (evt, data, fallback, done) { |
|
1548 |
if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) { |
|
1549 |
evt.preventDefault(); |
|
1550 |
done(); |
|
1551 |
} else { |
|
1552 |
fallback(data.html, done); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1553 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1554 |
}; |
9 | 1555 |
var fallback = function (editor) { |
1556 |
return function (html, done) { |
|
1557 |
var markedHtml = InternalHtml.mark(html); |
|
1558 |
var outer = editor.dom.create('div', { |
|
1559 |
'contenteditable': 'false', |
|
1560 |
'data-mce-bogus': 'all' |
|
1561 |
}); |
|
1562 |
var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml); |
|
1563 |
editor.dom.setStyles(outer, { |
|
1564 |
position: 'fixed', |
|
1565 |
top: '0', |
|
1566 |
left: '-3000px', |
|
1567 |
width: '1000px', |
|
1568 |
overflow: 'hidden' |
|
1569 |
}); |
|
1570 |
outer.appendChild(inner); |
|
1571 |
editor.dom.add(editor.getBody(), outer); |
|
1572 |
var range = editor.selection.getRng(); |
|
1573 |
inner.focus(); |
|
1574 |
var offscreenRange = editor.dom.createRng(); |
|
1575 |
offscreenRange.selectNodeContents(inner); |
|
1576 |
editor.selection.setRng(offscreenRange); |
|
1577 |
setTimeout(function () { |
|
1578 |
editor.selection.setRng(range); |
|
1579 |
outer.parentNode.removeChild(outer); |
|
1580 |
done(); |
|
1581 |
}, 0); |
|
1582 |
}; |
|
1583 |
}; |
|
1584 |
var getData = function (editor) { |
|
1585 |
return { |
|
1586 |
html: editor.selection.getContent({ contextual: true }), |
|
1587 |
text: editor.selection.getContent({ format: 'text' }) |
|
1588 |
}; |
|
1589 |
}; |
|
1590 |
var isTableSelection = function (editor) { |
|
1591 |
return !!editor.dom.getParent(editor.selection.getStart(), 'td[data-mce-selected],th[data-mce-selected]', editor.getBody()); |
|
1592 |
}; |
|
1593 |
var hasSelectedContent = function (editor) { |
|
1594 |
return !editor.selection.isCollapsed() || isTableSelection(editor); |
|
1595 |
}; |
|
1596 |
var cut = function (editor) { |
|
1597 |
return function (evt) { |
|
1598 |
if (hasSelectedContent(editor)) { |
|
1599 |
setClipboardData(evt, getData(editor), fallback(editor), function () { |
|
1600 |
setTimeout(function () { |
|
1601 |
editor.execCommand('Delete'); |
|
1602 |
}, 0); |
|
1603 |
}); |
|
1604 |
} |
|
1605 |
}; |
|
1606 |
}; |
|
1607 |
var copy = function (editor) { |
|
1608 |
return function (evt) { |
|
1609 |
if (hasSelectedContent(editor)) { |
|
1610 |
setClipboardData(evt, getData(editor), fallback(editor), noop); |
|
1611 |
} |
|
1612 |
}; |
|
1613 |
}; |
|
1614 |
var register$1 = function (editor) { |
|
1615 |
editor.on('cut', cut(editor)); |
|
1616 |
editor.on('copy', copy(editor)); |
|
1617 |
}; |
|
1618 |
var CutCopy = { register: register$1 }; |
|
5 | 1619 |
|
9 | 1620 |
var global$a = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils'); |
5 | 1621 |
|
9 | 1622 |
var getCaretRangeFromEvent = function (editor, e) { |
1623 |
return global$a.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc()); |
|
1624 |
}; |
|
1625 |
var isPlainTextFileUrl = function (content) { |
|
1626 |
var plainTextContent = content['text/plain']; |
|
1627 |
return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false; |
|
1628 |
}; |
|
1629 |
var setFocusedRange = function (editor, rng) { |
|
1630 |
editor.focus(); |
|
1631 |
editor.selection.setRng(rng); |
|
1632 |
}; |
|
1633 |
var setup = function (editor, clipboard, draggingInternallyState) { |
|
1634 |
if (Settings.shouldBlockDrop(editor)) { |
|
1635 |
editor.on('dragend dragover draggesture dragdrop drop drag', function (e) { |
|
1636 |
e.preventDefault(); |
|
1637 |
e.stopPropagation(); |
|
1638 |
}); |
|
1639 |
} |
|
1640 |
if (!Settings.shouldPasteDataImages(editor)) { |
|
1641 |
editor.on('drop', function (e) { |
|
1642 |
var dataTransfer = e.dataTransfer; |
|
1643 |
if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) { |
|
1644 |
e.preventDefault(); |
|
1645 |
} |
|
1646 |
}); |
|
1647 |
} |
|
1648 |
editor.on('drop', function (e) { |
|
1649 |
var dropContent, rng; |
|
1650 |
rng = getCaretRangeFromEvent(editor, e); |
|
1651 |
if (e.isDefaultPrevented() || draggingInternallyState.get()) { |
|
1652 |
return; |
|
1653 |
} |
|
1654 |
dropContent = clipboard.getDataTransferItems(e.dataTransfer); |
|
1655 |
var internal = clipboard.hasContentType(dropContent, InternalHtml.internalHtmlMime()); |
|
1656 |
if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) { |
|
1657 |
return; |
|
1658 |
} |
|
1659 |
if (rng && Settings.shouldFilterDrop(editor)) { |
|
1660 |
var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain']; |
|
1661 |
if (content_1) { |
|
1662 |
e.preventDefault(); |
|
1663 |
global$2.setEditorTimeout(editor, function () { |
|
1664 |
editor.undoManager.transact(function () { |
|
1665 |
if (dropContent['mce-internal']) { |
|
1666 |
editor.execCommand('Delete'); |
|
1667 |
} |
|
1668 |
setFocusedRange(editor, rng); |
|
1669 |
content_1 = Utils.trimHtml(content_1); |
|
1670 |
if (!dropContent['text/html']) { |
|
1671 |
clipboard.pasteText(content_1); |
|
1672 |
} else { |
|
1673 |
clipboard.pasteHtml(content_1, internal); |
|
1674 |
} |
|
1675 |
}); |
|
1676 |
}); |
|
1677 |
} |
|
1678 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1679 |
}); |
9 | 1680 |
editor.on('dragstart', function (e) { |
1681 |
draggingInternallyState.set(true); |
|
1682 |
}); |
|
1683 |
editor.on('dragover dragend', function (e) { |
|
1684 |
if (Settings.shouldPasteDataImages(editor) && draggingInternallyState.get() === false) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1685 |
e.preventDefault(); |
9 | 1686 |
setFocusedRange(editor, getCaretRangeFromEvent(editor, e)); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1687 |
} |
9 | 1688 |
if (e.type === 'dragend') { |
1689 |
draggingInternallyState.set(false); |
|
1690 |
} |
|
1691 |
}); |
|
1692 |
}; |
|
1693 |
var DragDrop = { setup: setup }; |
|
1694 |
||
1695 |
var setup$1 = function (editor) { |
|
1696 |
var plugin = editor.plugins.paste; |
|
1697 |
var preProcess = Settings.getPreProcess(editor); |
|
1698 |
if (preProcess) { |
|
1699 |
editor.on('PastePreProcess', function (e) { |
|
1700 |
preProcess.call(plugin, plugin, e); |
|
1701 |
}); |
|
1702 |
} |
|
1703 |
var postProcess = Settings.getPostProcess(editor); |
|
1704 |
if (postProcess) { |
|
1705 |
editor.on('PastePostProcess', function (e) { |
|
1706 |
postProcess.call(plugin, plugin, e); |
|
1707 |
}); |
|
1708 |
} |
|
1709 |
}; |
|
1710 |
var PrePostProcess = { setup: setup$1 }; |
|
1711 |
||
1712 |
function addPreProcessFilter(editor, filterFunc) { |
|
1713 |
editor.on('PastePreProcess', function (e) { |
|
1714 |
e.content = filterFunc(editor, e.content, e.internal, e.wordContent); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1715 |
}); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1716 |
} |
9 | 1717 |
function addPostProcessFilter(editor, filterFunc) { |
1718 |
editor.on('PastePostProcess', function (e) { |
|
1719 |
filterFunc(editor, e.node); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1720 |
}); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1721 |
} |
9 | 1722 |
function removeExplorerBrElementsAfterBlocks(editor, html) { |
1723 |
if (!WordFilter.isWordContent(html)) { |
|
1724 |
return html; |
|
1725 |
} |
|
1726 |
var blockElements = []; |
|
1727 |
global$3.each(editor.schema.getBlockElements(), function (block, blockName) { |
|
1728 |
blockElements.push(blockName); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1729 |
}); |
9 | 1730 |
var explorerBlocksRegExp = new RegExp('(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*', 'g'); |
1731 |
html = Utils.filter(html, [[ |
|
1732 |
explorerBlocksRegExp, |
|
1733 |
'$1' |
|
1734 |
]]); |
|
1735 |
html = Utils.filter(html, [ |
|
1736 |
[ |
|
1737 |
/<br><br>/g, |
|
1738 |
'<BR><BR>' |
|
1739 |
], |
|
1740 |
[ |
|
1741 |
/<br>/g, |
|
1742 |
' ' |
|
1743 |
], |
|
1744 |
[ |
|
1745 |
/<BR><BR>/g, |
|
1746 |
'<br>' |
|
1747 |
] |
|
1748 |
]); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1749 |
return html; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1750 |
} |
9 | 1751 |
function removeWebKitStyles(editor, content, internal, isWordHtml) { |
1752 |
if (isWordHtml || internal) { |
|
1753 |
return content; |
|
1754 |
} |
|
1755 |
var webKitStylesSetting = Settings.getWebkitStyles(editor); |
|
1756 |
var webKitStyles; |
|
1757 |
if (Settings.shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') { |
|
1758 |
return content; |
|
1759 |
} |
|
1760 |
if (webKitStylesSetting) { |
|
1761 |
webKitStyles = webKitStylesSetting.split(/[, ]/); |
|
1762 |
} |
|
1763 |
if (webKitStyles) { |
|
1764 |
var dom_1 = editor.dom, node_1 = editor.selection.getNode(); |
|
1765 |
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) { |
|
1766 |
var inputStyles = dom_1.parseStyle(dom_1.decode(value)); |
|
1767 |
var outputStyles = {}; |
|
1768 |
if (webKitStyles === 'none') { |
|
1769 |
return before + after; |
|
1770 |
} |
|
1771 |
for (var i = 0; i < webKitStyles.length; i++) { |
|
1772 |
var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true); |
|
1773 |
if (/color/.test(webKitStyles[i])) { |
|
1774 |
inputValue = dom_1.toHex(inputValue); |
|
1775 |
currentValue = dom_1.toHex(currentValue); |
|
1776 |
} |
|
1777 |
if (currentValue !== inputValue) { |
|
1778 |
outputStyles[webKitStyles[i]] = inputValue; |
|
1779 |
} |
|
1780 |
} |
|
1781 |
outputStyles = dom_1.serializeStyle(outputStyles, 'span'); |
|
1782 |
if (outputStyles) { |
|
1783 |
return before + ' style="' + outputStyles + '"' + after; |
|
1784 |
} |
|
1785 |
return before + after; |
|
1786 |
}); |
|
1787 |
} else { |
|
1788 |
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3'); |
|
1789 |
} |
|
1790 |
content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) { |
|
1791 |
return before + ' style="' + value + '"' + after; |
|
1792 |
}); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1793 |
return content; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1794 |
} |
9 | 1795 |
function removeUnderlineAndFontInAnchor(editor, root) { |
1796 |
editor.$('a', root).find('font,u').each(function (i, node) { |
|
1797 |
editor.dom.remove(node, true); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1798 |
}); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1799 |
} |
9 | 1800 |
var setup$2 = function (editor) { |
1801 |
if (global$1.webkit) { |
|
1802 |
addPreProcessFilter(editor, removeWebKitStyles); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1803 |
} |
9 | 1804 |
if (global$1.ie) { |
1805 |
addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks); |
|
1806 |
addPostProcessFilter(editor, removeUnderlineAndFontInAnchor); |
|
1807 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1808 |
}; |
9 | 1809 |
var Quirks = { setup: setup$2 }; |
5 | 1810 |
|
9 | 1811 |
var stateChange = function (editor, clipboard, e) { |
1812 |
var ctrl = e.control; |
|
1813 |
ctrl.active(clipboard.pasteFormat.get() === 'text'); |
|
1814 |
editor.on('PastePlainTextToggle', function (e) { |
|
1815 |
ctrl.active(e.state); |
|
1816 |
}); |
|
1817 |
}; |
|
1818 |
var register$2 = function (editor, clipboard) { |
|
1819 |
var postRender = curry(stateChange, editor, clipboard); |
|
1820 |
editor.addButton('pastetext', { |
|
1821 |
active: false, |
|
1822 |
icon: 'pastetext', |
|
1823 |
tooltip: 'Paste as text', |
|
1824 |
cmd: 'mceTogglePlainTextPaste', |
|
1825 |
onPostRender: postRender |
|
1826 |
}); |
|
1827 |
editor.addMenuItem('pastetext', { |
|
1828 |
text: 'Paste as text', |
|
1829 |
selectable: true, |
|
1830 |
active: clipboard.pasteFormat, |
|
1831 |
cmd: 'mceTogglePlainTextPaste', |
|
1832 |
onPostRender: postRender |
|
1833 |
}); |
|
1834 |
}; |
|
1835 |
var Buttons = { register: register$2 }; |
|
1836 |
||
1837 |
global.add('paste', function (editor) { |
|
1838 |
if (DetectProPlugin.hasProPlugin(editor) === false) { |
|
1839 |
var userIsInformedState = Cell(false); |
|
1840 |
var draggingInternallyState = Cell(false); |
|
1841 |
var pasteFormat = Cell(Settings.isPasteAsTextEnabled(editor) ? 'text' : 'html'); |
|
1842 |
var clipboard = Clipboard(editor, pasteFormat); |
|
1843 |
var quirks = Quirks.setup(editor); |
|
1844 |
Buttons.register(editor, clipboard); |
|
1845 |
Commands.register(editor, clipboard, userIsInformedState); |
|
1846 |
PrePostProcess.setup(editor); |
|
1847 |
CutCopy.register(editor); |
|
1848 |
DragDrop.setup(editor, clipboard, draggingInternallyState); |
|
1849 |
return Api.get(clipboard, quirks); |
|
1850 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1851 |
}); |
9 | 1852 |
function Plugin () { |
1853 |
} |
|
5 | 1854 |
|
9 | 1855 |
return Plugin; |
5 | 1856 |
|
9 | 1857 |
}(window)); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1858 |
})(); |