changeset 16 | a86126ab1dd4 |
parent 9 | 177826044cd9 |
15:3d4e9c994f10 | 16:a86126ab1dd4 |
---|---|
18 set: set, |
18 set: set, |
19 clone: clone |
19 clone: clone |
20 }; |
20 }; |
21 }; |
21 }; |
22 |
22 |
23 var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); |
23 var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); |
24 |
24 |
25 var hasProPlugin = function (editor) { |
25 var hasProPlugin = function (editor) { |
26 if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global.get('powerpaste')) { |
26 if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global$1.get('powerpaste')) { |
27 if (typeof domGlobals.window.console !== 'undefined' && domGlobals.window.console.log) { |
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.'); |
28 domGlobals.window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.'); |
29 } |
29 } |
30 return true; |
30 return true; |
31 } else { |
31 } else { |
171 } |
171 } |
172 }); |
172 }); |
173 }; |
173 }; |
174 var Commands = { register: register }; |
174 var Commands = { register: register }; |
175 |
175 |
176 var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); |
176 var global$2 = tinymce.util.Tools.resolve('tinymce.Env'); |
177 |
177 |
178 var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay'); |
178 var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay'); |
179 |
179 |
180 var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools'); |
180 var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools'); |
181 |
181 |
182 var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK'); |
182 var global$5 = tinymce.util.Tools.resolve('tinymce.util.VK'); |
183 |
183 |
184 var internalMimeType = 'x-tinymce/html'; |
184 var internalMimeType = 'x-tinymce/html'; |
185 var internalMark = '<!-- ' + internalMimeType + ' -->'; |
185 var internalMark = '<!-- ' + internalMimeType + ' -->'; |
186 var mark = function (html) { |
186 var mark = function (html) { |
187 return internalMark + html; |
187 return internalMark + html; |
199 internalHtmlMime: function () { |
199 internalHtmlMime: function () { |
200 return internalMimeType; |
200 return internalMimeType; |
201 } |
201 } |
202 }; |
202 }; |
203 |
203 |
204 var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities'); |
204 var global$6 = tinymce.util.Tools.resolve('tinymce.html.Entities'); |
205 |
205 |
206 var isPlainText = function (text) { |
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); |
207 return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text); |
208 }; |
208 }; |
209 var toBRs = function (text) { |
209 var toBRs = function (text) { |
214 var attrs = []; |
214 var attrs = []; |
215 var tag = '<' + rootTag; |
215 var tag = '<' + rootTag; |
216 if (typeof rootAttrs === 'object') { |
216 if (typeof rootAttrs === 'object') { |
217 for (key in rootAttrs) { |
217 for (key in rootAttrs) { |
218 if (rootAttrs.hasOwnProperty(key)) { |
218 if (rootAttrs.hasOwnProperty(key)) { |
219 attrs.push(key + '="' + global$5.encodeAllRaw(rootAttrs[key]) + '"'); |
219 attrs.push(key + '="' + global$6.encodeAllRaw(rootAttrs[key]) + '"'); |
220 } |
220 } |
221 } |
221 } |
222 if (attrs.length) { |
222 if (attrs.length) { |
223 tag += ' ' + attrs.join(' '); |
223 tag += ' ' + attrs.join(' '); |
224 } |
224 } |
227 }; |
227 }; |
228 var toBlockElements = function (text, rootTag, rootAttrs) { |
228 var toBlockElements = function (text, rootTag, rootAttrs) { |
229 var blocks = text.split(/\n\n/); |
229 var blocks = text.split(/\n\n/); |
230 var tagOpen = openContainer(rootTag, rootAttrs); |
230 var tagOpen = openContainer(rootTag, rootAttrs); |
231 var tagClose = '</' + rootTag + '>'; |
231 var tagClose = '</' + rootTag + '>'; |
232 var paragraphs = global$3.map(blocks, function (p) { |
232 var paragraphs = global$4.map(blocks, function (p) { |
233 return p.split(/\n/).join('<br />'); |
233 return p.split(/\n/).join('<br />'); |
234 }); |
234 }); |
235 var stitch = function (p) { |
235 var stitch = function (p) { |
236 return tagOpen + p + tagClose; |
236 return tagOpen + p + tagClose; |
237 }; |
237 }; |
238 return paragraphs.length === 1 ? paragraphs[0] : global$3.map(paragraphs, stitch).join(''); |
238 return paragraphs.length === 1 ? paragraphs[0] : global$4.map(paragraphs, stitch).join(''); |
239 }; |
239 }; |
240 var convert = function (text, rootTag, rootAttrs) { |
240 var convert = function (text, rootTag, rootAttrs) { |
241 return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text); |
241 return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text); |
242 }; |
242 }; |
243 var Newlines = { |
243 var Newlines = { |
245 convert: convert, |
245 convert: convert, |
246 toBRs: toBRs, |
246 toBRs: toBRs, |
247 toBlockElements: toBlockElements |
247 toBlockElements: toBlockElements |
248 }; |
248 }; |
249 |
249 |
250 var global$6 = tinymce.util.Tools.resolve('tinymce.html.DomParser'); |
250 var global$7 = tinymce.util.Tools.resolve('tinymce.html.DomParser'); |
251 |
251 |
252 var global$7 = tinymce.util.Tools.resolve('tinymce.html.Node'); |
252 var global$8 = tinymce.util.Tools.resolve('tinymce.html.Serializer'); |
253 |
253 |
254 var global$8 = tinymce.util.Tools.resolve('tinymce.html.Schema'); |
254 var global$9 = tinymce.util.Tools.resolve('tinymce.html.Node'); |
255 |
255 |
256 var global$9 = tinymce.util.Tools.resolve('tinymce.html.Serializer'); |
256 var global$a = tinymce.util.Tools.resolve('tinymce.html.Schema'); |
257 |
257 |
258 function filter(content, items) { |
258 function filter(content, items) { |
259 global$3.each(items, function (v) { |
259 global$4.each(items, function (v) { |
260 if (v.constructor === RegExp) { |
260 if (v.constructor === RegExp) { |
261 content = content.replace(v, ''); |
261 content = content.replace(v, ''); |
262 } else { |
262 } else { |
263 content = content.replace(v[0], v[1]); |
263 content = content.replace(v[0], v[1]); |
264 } |
264 } |
265 }); |
265 }); |
266 return content; |
266 return content; |
267 } |
267 } |
268 function innerText(html) { |
268 function innerText(html) { |
269 var schema = global$8(); |
269 var schema = global$a(); |
270 var domParser = global$6({}, schema); |
270 var domParser = global$7({}, schema); |
271 var text = ''; |
271 var text = ''; |
272 var shortEndedElements = schema.getShortEndedElements(); |
272 var shortEndedElements = schema.getShortEndedElements(); |
273 var ignoreElements = global$3.makeMap('script noscript style textarea video audio iframe object', ' '); |
273 var ignoreElements = global$4.makeMap('script noscript style textarea video audio iframe object', ' '); |
274 var blockElements = schema.getBlockElements(); |
274 var blockElements = schema.getBlockElements(); |
275 function walk(node) { |
275 function walk(node) { |
276 var name = node.name, currentNode = node; |
276 var name = node.name, currentNode = node; |
277 if (name === 'br') { |
277 if (name === 'br') { |
278 text += '\n'; |
278 text += '\n'; |
358 /^[0-9]+\.[ \u00a0]/, |
358 /^[0-9]+\.[ \u00a0]/, |
359 /^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \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]/ |
360 /^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/ |
361 ]; |
361 ]; |
362 text = text.replace(/^[\u00a0 ]+/, ''); |
362 text = text.replace(/^[\u00a0 ]+/, ''); |
363 global$3.each(patterns, function (pattern) { |
363 global$4.each(patterns, function (pattern) { |
364 if (pattern.test(text)) { |
364 if (pattern.test(text)) { |
365 found = true; |
365 found = true; |
366 return false; |
366 return false; |
367 } |
367 } |
368 }); |
368 }); |
424 currentListNode = null; |
424 currentListNode = null; |
425 } |
425 } |
426 } |
426 } |
427 if (!currentListNode || currentListNode.name !== listName) { |
427 if (!currentListNode || currentListNode.name !== listName) { |
428 prevListNode = prevListNode || currentListNode; |
428 prevListNode = prevListNode || currentListNode; |
429 currentListNode = new global$7(listName, 1); |
429 currentListNode = new global$9(listName, 1); |
430 if (start > 1) { |
430 if (start > 1) { |
431 currentListNode.attr('start', '' + start); |
431 currentListNode.attr('start', '' + start); |
432 } |
432 } |
433 paragraphNode.wrap(currentListNode); |
433 paragraphNode.wrap(currentListNode); |
434 } else { |
434 } else { |
484 } |
484 } |
485 } |
485 } |
486 function filterStyles(editor, validStyles, node, styleValue) { |
486 function filterStyles(editor, validStyles, node, styleValue) { |
487 var outputStyles = {}, matches; |
487 var outputStyles = {}, matches; |
488 var styles = editor.dom.parseStyle(styleValue); |
488 var styles = editor.dom.parseStyle(styleValue); |
489 global$3.each(styles, function (value, name) { |
489 global$4.each(styles, function (value, name) { |
490 switch (name) { |
490 switch (name) { |
491 case 'mso-list': |
491 case 'mso-list': |
492 matches = /\w+ \w+([0-9]+)/i.exec(styleValue); |
492 matches = /\w+ \w+([0-9]+)/i.exec(styleValue); |
493 if (matches) { |
493 if (matches) { |
494 node._listLevel = parseInt(matches[1], 10); |
494 node._listLevel = parseInt(matches[1], 10); |
536 outputStyles[name] = value; |
536 outputStyles[name] = value; |
537 } |
537 } |
538 }); |
538 }); |
539 if (/(bold)/i.test(outputStyles['font-weight'])) { |
539 if (/(bold)/i.test(outputStyles['font-weight'])) { |
540 delete outputStyles['font-weight']; |
540 delete outputStyles['font-weight']; |
541 node.wrap(new global$7('b', 1)); |
541 node.wrap(new global$9('b', 1)); |
542 } |
542 } |
543 if (/(italic)/i.test(outputStyles['font-style'])) { |
543 if (/(italic)/i.test(outputStyles['font-style'])) { |
544 delete outputStyles['font-style']; |
544 delete outputStyles['font-style']; |
545 node.wrap(new global$7('i', 1)); |
545 node.wrap(new global$9('i', 1)); |
546 } |
546 } |
547 outputStyles = editor.dom.serializeStyle(outputStyles, node.name); |
547 outputStyles = editor.dom.serializeStyle(outputStyles, node.name); |
548 if (outputStyles) { |
548 if (outputStyles) { |
549 return outputStyles; |
549 return outputStyles; |
550 } |
550 } |
552 } |
552 } |
553 var filterWordContent = function (editor, content) { |
553 var filterWordContent = function (editor, content) { |
554 var retainStyleProperties, validStyles; |
554 var retainStyleProperties, validStyles; |
555 retainStyleProperties = Settings.getRetainStyleProps(editor); |
555 retainStyleProperties = Settings.getRetainStyleProps(editor); |
556 if (retainStyleProperties) { |
556 if (retainStyleProperties) { |
557 validStyles = global$3.makeMap(retainStyleProperties.split(/[, ]/)); |
557 validStyles = global$4.makeMap(retainStyleProperties.split(/[, ]/)); |
558 } |
558 } |
559 content = Utils.filter(content, [ |
559 content = Utils.filter(content, [ |
560 /<br class="?Apple-interchange-newline"?>/gi, |
560 /<br class="?Apple-interchange-newline"?>/gi, |
561 /<b[^>]+id="?docs-internal-[^>]*>/gi, |
561 /<b[^>]+id="?docs-internal-[^>]*>/gi, |
562 /<!--[\s\S]+?-->/gi, |
562 /<!--[\s\S]+?-->/gi, |
575 return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : ''; |
575 return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : ''; |
576 } |
576 } |
577 ] |
577 ] |
578 ]); |
578 ]); |
579 var validElements = Settings.getWordValidElements(editor); |
579 var validElements = Settings.getWordValidElements(editor); |
580 var schema = global$8({ |
580 var schema = global$a({ |
581 valid_elements: validElements, |
581 valid_elements: validElements, |
582 valid_children: '-li[p]' |
582 valid_children: '-li[p]' |
583 }); |
583 }); |
584 global$3.each(schema.elements, function (rule) { |
584 global$4.each(schema.elements, function (rule) { |
585 if (!rule.attributes.class) { |
585 if (!rule.attributes.class) { |
586 rule.attributes.class = {}; |
586 rule.attributes.class = {}; |
587 rule.attributesOrder.push('class'); |
587 rule.attributesOrder.push('class'); |
588 } |
588 } |
589 if (!rule.attributes.style) { |
589 if (!rule.attributes.style) { |
590 rule.attributes.style = {}; |
590 rule.attributes.style = {}; |
591 rule.attributesOrder.push('style'); |
591 rule.attributesOrder.push('style'); |
592 } |
592 } |
593 }); |
593 }); |
594 var domParser = global$6({}, schema); |
594 var domParser = global$7({}, schema); |
595 domParser.addAttributeFilter('style', function (nodes) { |
595 domParser.addAttributeFilter('style', function (nodes) { |
596 var i = nodes.length, node; |
596 var i = nodes.length, node; |
597 while (i--) { |
597 while (i--) { |
598 node = nodes[i]; |
598 node = nodes[i]; |
599 node.attr('style', filterStyles(editor, validStyles, node, node.attr('style'))); |
599 node.attr('style', filterStyles(editor, validStyles, node, node.attr('style'))); |
651 }); |
651 }); |
652 var rootNode = domParser.parse(content); |
652 var rootNode = domParser.parse(content); |
653 if (Settings.shouldConvertWordFakeLists(editor)) { |
653 if (Settings.shouldConvertWordFakeLists(editor)) { |
654 convertFakeListsToProperLists(rootNode); |
654 convertFakeListsToProperLists(rootNode); |
655 } |
655 } |
656 content = global$9({ validate: editor.settings.validate }, schema).serialize(rootNode); |
656 content = global$8({ validate: editor.settings.validate }, schema).serialize(rootNode); |
657 return content; |
657 return content; |
658 }; |
658 }; |
659 var preProcess = function (editor, content) { |
659 var preProcess = function (editor, content) { |
660 return Settings.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content; |
660 return Settings.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content; |
661 }; |
661 }; |
662 var WordFilter = { |
662 var WordFilter = { |
663 preProcess: preProcess, |
663 preProcess: preProcess, |
664 isWordContent: isWordContent |
664 isWordContent: isWordContent |
665 }; |
665 }; |
666 |
666 |
667 var preProcess$1 = function (editor, html) { |
|
668 var parser = global$7({}, editor.schema); |
|
669 parser.addNodeFilter('meta', function (nodes) { |
|
670 global$4.each(nodes, function (node) { |
|
671 return node.remove(); |
|
672 }); |
|
673 }); |
|
674 var fragment = parser.parse(html, { |
|
675 forced_root_block: false, |
|
676 isRootContent: true |
|
677 }); |
|
678 return global$8({ validate: editor.settings.validate }, editor.schema).serialize(fragment); |
|
679 }; |
|
667 var processResult = function (content, cancelled) { |
680 var processResult = function (content, cancelled) { |
668 return { |
681 return { |
669 content: content, |
682 content: content, |
670 cancelled: cancelled |
683 cancelled: cancelled |
671 }; |
684 }; |
675 var postProcessArgs = Events.firePastePostProcess(editor, tempBody, internal, isWordHtml); |
688 var postProcessArgs = Events.firePastePostProcess(editor, tempBody, internal, isWordHtml); |
676 return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented()); |
689 return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented()); |
677 }; |
690 }; |
678 var filterContent = function (editor, content, internal, isWordHtml) { |
691 var filterContent = function (editor, content, internal, isWordHtml) { |
679 var preProcessArgs = Events.firePastePreProcess(editor, content, internal, isWordHtml); |
692 var preProcessArgs = Events.firePastePreProcess(editor, content, internal, isWordHtml); |
693 var filteredContent = preProcess$1(editor, preProcessArgs.content); |
|
680 if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) { |
694 if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) { |
681 return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml); |
695 return postProcessFilter(editor, filteredContent, internal, isWordHtml); |
682 } else { |
696 } else { |
683 return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented()); |
697 return processResult(filteredContent, preProcessArgs.isDefaultPrevented()); |
684 } |
698 } |
685 }; |
699 }; |
686 var process = function (editor, html, internal) { |
700 var process = function (editor, html, internal) { |
687 var isWordHtml = WordFilter.isWordContent(html); |
701 var isWordHtml = WordFilter.isWordContent(html); |
688 var content = isWordHtml ? WordFilter.preProcess(editor, html) : html; |
702 var content = isWordHtml ? WordFilter.preProcess(editor, html) : html; |
689 return filterContent(editor, content, internal, isWordHtml); |
703 return filterContent(editor, content, internal, isWordHtml); |
690 }; |
704 }; |
691 var ProcessFilters = { process: process }; |
705 var ProcessFilters = { process: process }; |
692 |
706 |
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) { |
707 var pasteHtml = function (editor, html) { |
701 editor.insertContent(removeMeta(editor, html), { |
708 editor.insertContent(html, { |
702 merge: Settings.shouldMergeFormats(editor), |
709 merge: Settings.shouldMergeFormats(editor), |
703 paste: true |
710 paste: true |
704 }); |
711 }); |
705 return true; |
712 return true; |
706 }; |
713 }; |
731 }; |
738 }; |
732 var insertImage = function (editor, html, pasteHtmlFn) { |
739 var insertImage = function (editor, html, pasteHtmlFn) { |
733 return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false; |
740 return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false; |
734 }; |
741 }; |
735 var smartInsertContent = function (editor, html) { |
742 var smartInsertContent = function (editor, html) { |
736 global$3.each([ |
743 global$4.each([ |
737 linkSelection, |
744 linkSelection, |
738 insertImage, |
745 insertImage, |
739 pasteHtml |
746 pasteHtml |
740 ], function (action) { |
747 ], function (action) { |
741 return action(editor, html, pasteHtml) !== true; |
748 return action(editor, html, pasteHtml) !== true; |
752 isImageUrl: isImageUrl, |
759 isImageUrl: isImageUrl, |
753 isAbsoluteUrl: isAbsoluteUrl, |
760 isAbsoluteUrl: isAbsoluteUrl, |
754 insertContent: insertContent |
761 insertContent: insertContent |
755 }; |
762 }; |
756 |
763 |
764 var noop = function () { |
|
765 }; |
|
757 var constant = function (value) { |
766 var constant = function (value) { |
758 return function () { |
767 return function () { |
759 return value; |
768 return value; |
760 }; |
769 }; |
761 }; |
770 }; |
774 }; |
783 }; |
775 } |
784 } |
776 var never = constant(false); |
785 var never = constant(false); |
777 var always = constant(true); |
786 var always = constant(true); |
778 |
787 |
779 var never$1 = never; |
|
780 var always$1 = always; |
|
781 var none = function () { |
788 var none = function () { |
782 return NONE; |
789 return NONE; |
783 }; |
790 }; |
784 var NONE = function () { |
791 var NONE = function () { |
785 var eq = function (o) { |
792 var eq = function (o) { |
788 var call = function (thunk) { |
795 var call = function (thunk) { |
789 return thunk(); |
796 return thunk(); |
790 }; |
797 }; |
791 var id = function (n) { |
798 var id = function (n) { |
792 return n; |
799 return n; |
793 }; |
|
794 var noop = function () { |
|
795 }; |
|
796 var nul = function () { |
|
797 return null; |
|
798 }; |
|
799 var undef = function () { |
|
800 return undefined; |
|
801 }; |
800 }; |
802 var me = { |
801 var me = { |
803 fold: function (n, s) { |
802 fold: function (n, s) { |
804 return n(); |
803 return n(); |
805 }, |
804 }, |
806 is: never$1, |
805 is: never, |
807 isSome: never$1, |
806 isSome: never, |
808 isNone: always$1, |
807 isNone: always, |
809 getOr: id, |
808 getOr: id, |
810 getOrThunk: call, |
809 getOrThunk: call, |
811 getOrDie: function (msg) { |
810 getOrDie: function (msg) { |
812 throw new Error(msg || 'error: getOrDie called on none.'); |
811 throw new Error(msg || 'error: getOrDie called on none.'); |
813 }, |
812 }, |
814 getOrNull: nul, |
813 getOrNull: constant(null), |
815 getOrUndefined: undef, |
814 getOrUndefined: constant(undefined), |
816 or: id, |
815 or: id, |
817 orThunk: call, |
816 orThunk: call, |
818 map: none, |
817 map: none, |
819 ap: none, |
|
820 each: noop, |
818 each: noop, |
821 bind: none, |
819 bind: none, |
822 flatten: none, |
820 exists: never, |
823 exists: never$1, |
821 forall: always, |
824 forall: always$1, |
|
825 filter: none, |
822 filter: none, |
826 equals: eq, |
823 equals: eq, |
827 equals_: eq, |
824 equals_: eq, |
828 toArray: function () { |
825 toArray: function () { |
829 return []; |
826 return []; |
830 }, |
827 }, |
831 toString: constant('none()') |
828 toString: constant('none()') |
832 }; |
829 }; |
833 if (Object.freeze) |
830 if (Object.freeze) { |
834 Object.freeze(me); |
831 Object.freeze(me); |
832 } |
|
835 return me; |
833 return me; |
836 }(); |
834 }(); |
837 var some = function (a) { |
835 var some = function (a) { |
838 var constant_a = function () { |
836 var constant_a = constant(a); |
839 return a; |
|
840 }; |
|
841 var self = function () { |
837 var self = function () { |
842 return me; |
838 return me; |
843 }; |
|
844 var map = function (f) { |
|
845 return some(f(a)); |
|
846 }; |
839 }; |
847 var bind = function (f) { |
840 var bind = function (f) { |
848 return f(a); |
841 return f(a); |
849 }; |
842 }; |
850 var me = { |
843 var me = { |
852 return s(a); |
845 return s(a); |
853 }, |
846 }, |
854 is: function (v) { |
847 is: function (v) { |
855 return a === v; |
848 return a === v; |
856 }, |
849 }, |
857 isSome: always$1, |
850 isSome: always, |
858 isNone: never$1, |
851 isNone: never, |
859 getOr: constant_a, |
852 getOr: constant_a, |
860 getOrThunk: constant_a, |
853 getOrThunk: constant_a, |
861 getOrDie: constant_a, |
854 getOrDie: constant_a, |
862 getOrNull: constant_a, |
855 getOrNull: constant_a, |
863 getOrUndefined: constant_a, |
856 getOrUndefined: constant_a, |
864 or: self, |
857 or: self, |
865 orThunk: self, |
858 orThunk: self, |
866 map: map, |
859 map: function (f) { |
867 ap: function (optfab) { |
860 return some(f(a)); |
868 return optfab.fold(none, function (fab) { |
|
869 return some(fab(a)); |
|
870 }); |
|
871 }, |
861 }, |
872 each: function (f) { |
862 each: function (f) { |
873 f(a); |
863 f(a); |
874 }, |
864 }, |
875 bind: bind, |
865 bind: bind, |
876 flatten: constant_a, |
|
877 exists: bind, |
866 exists: bind, |
878 forall: bind, |
867 forall: bind, |
879 filter: function (f) { |
868 filter: function (f) { |
880 return f(a) ? me : NONE; |
869 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 }, |
870 }, |
890 toArray: function () { |
871 toArray: function () { |
891 return [a]; |
872 return [a]; |
892 }, |
873 }, |
893 toString: function () { |
874 toString: function () { |
894 return 'some(' + a + ')'; |
875 return 'some(' + a + ')'; |
876 }, |
|
877 equals: function (o) { |
|
878 return o.is(a); |
|
879 }, |
|
880 equals_: function (o, elementEq) { |
|
881 return o.fold(never, function (b) { |
|
882 return elementEq(a, b); |
|
883 }); |
|
895 } |
884 } |
896 }; |
885 }; |
897 return me; |
886 return me; |
898 }; |
887 }; |
899 var from = function (value) { |
888 var from = function (value) { |
904 none: none, |
893 none: none, |
905 from: from |
894 from: from |
906 }; |
895 }; |
907 |
896 |
908 var typeOf = function (x) { |
897 var typeOf = function (x) { |
909 if (x === null) |
898 if (x === null) { |
910 return 'null'; |
899 return 'null'; |
900 } |
|
911 var t = typeof x; |
901 var t = typeof x; |
912 if (t === 'object' && Array.prototype.isPrototypeOf(x)) |
902 if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { |
913 return 'array'; |
903 return 'array'; |
914 if (t === 'object' && String.prototype.isPrototypeOf(x)) |
904 } |
905 if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { |
|
915 return 'string'; |
906 return 'string'; |
907 } |
|
916 return t; |
908 return t; |
917 }; |
909 }; |
918 var isType = function (type) { |
910 var isType = function (type) { |
919 return function (value) { |
911 return function (value) { |
920 return typeOf(value) === type; |
912 return typeOf(value) === type; |
921 }; |
913 }; |
922 }; |
914 }; |
923 var isFunction = isType('function'); |
915 var isFunction = isType('function'); |
924 |
916 |
917 var nativeSlice = Array.prototype.slice; |
|
925 var map = function (xs, f) { |
918 var map = function (xs, f) { |
926 var len = xs.length; |
919 var len = xs.length; |
927 var r = new Array(len); |
920 var r = new Array(len); |
928 for (var i = 0; i < len; i++) { |
921 for (var i = 0; i < len; i++) { |
929 var x = xs[i]; |
922 var x = xs[i]; |
930 r[i] = f(x, i, xs); |
923 r[i] = f(x, i); |
931 } |
924 } |
932 return r; |
925 return r; |
933 }; |
926 }; |
934 var each = function (xs, f) { |
927 var each = function (xs, f) { |
935 for (var i = 0, len = xs.length; i < len; i++) { |
928 for (var i = 0, len = xs.length; i < len; i++) { |
936 var x = xs[i]; |
929 var x = xs[i]; |
937 f(x, i, xs); |
930 f(x, i); |
938 } |
931 } |
939 }; |
932 }; |
940 var filter$1 = function (xs, pred) { |
933 var filter$1 = function (xs, pred) { |
941 var r = []; |
934 var r = []; |
942 for (var i = 0, len = xs.length; i < len; i++) { |
935 for (var i = 0, len = xs.length; i < len; i++) { |
943 var x = xs[i]; |
936 var x = xs[i]; |
944 if (pred(x, i, xs)) { |
937 if (pred(x, i)) { |
945 r.push(x); |
938 r.push(x); |
946 } |
939 } |
947 } |
940 } |
948 return r; |
941 return r; |
949 }; |
942 }; |
950 var slice = Array.prototype.slice; |
|
951 var from$1 = isFunction(Array.from) ? Array.from : function (x) { |
943 var from$1 = isFunction(Array.from) ? Array.from : function (x) { |
952 return slice.call(x); |
944 return nativeSlice.call(x); |
953 }; |
945 }; |
946 |
|
947 var exports$1 = {}, module = { exports: exports$1 }; |
|
948 (function (define, exports, module, require) { |
|
949 (function (f) { |
|
950 if (typeof exports === 'object' && typeof module !== 'undefined') { |
|
951 module.exports = f(); |
|
952 } else if (typeof define === 'function' && define.amd) { |
|
953 define([], f); |
|
954 } else { |
|
955 var g; |
|
956 if (typeof window !== 'undefined') { |
|
957 g = window; |
|
958 } else if (typeof global !== 'undefined') { |
|
959 g = global; |
|
960 } else if (typeof self !== 'undefined') { |
|
961 g = self; |
|
962 } else { |
|
963 g = this; |
|
964 } |
|
965 g.EphoxContactWrapper = f(); |
|
966 } |
|
967 }(function () { |
|
968 return function () { |
|
969 function r(e, n, t) { |
|
970 function o(i, f) { |
|
971 if (!n[i]) { |
|
972 if (!e[i]) { |
|
973 var c = 'function' == typeof require && require; |
|
974 if (!f && c) |
|
975 return c(i, !0); |
|
976 if (u) |
|
977 return u(i, !0); |
|
978 var a = new Error('Cannot find module \'' + i + '\''); |
|
979 throw a.code = 'MODULE_NOT_FOUND', a; |
|
980 } |
|
981 var p = n[i] = { exports: {} }; |
|
982 e[i][0].call(p.exports, function (r) { |
|
983 var n = e[i][1][r]; |
|
984 return o(n || r); |
|
985 }, p, p.exports, r, e, n, t); |
|
986 } |
|
987 return n[i].exports; |
|
988 } |
|
989 for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++) |
|
990 o(t[i]); |
|
991 return o; |
|
992 } |
|
993 return r; |
|
994 }()({ |
|
995 1: [ |
|
996 function (require, module, exports) { |
|
997 var process = module.exports = {}; |
|
998 var cachedSetTimeout; |
|
999 var cachedClearTimeout; |
|
1000 function defaultSetTimout() { |
|
1001 throw new Error('setTimeout has not been defined'); |
|
1002 } |
|
1003 function defaultClearTimeout() { |
|
1004 throw new Error('clearTimeout has not been defined'); |
|
1005 } |
|
1006 (function () { |
|
1007 try { |
|
1008 if (typeof setTimeout === 'function') { |
|
1009 cachedSetTimeout = setTimeout; |
|
1010 } else { |
|
1011 cachedSetTimeout = defaultSetTimout; |
|
1012 } |
|
1013 } catch (e) { |
|
1014 cachedSetTimeout = defaultSetTimout; |
|
1015 } |
|
1016 try { |
|
1017 if (typeof clearTimeout === 'function') { |
|
1018 cachedClearTimeout = clearTimeout; |
|
1019 } else { |
|
1020 cachedClearTimeout = defaultClearTimeout; |
|
1021 } |
|
1022 } catch (e) { |
|
1023 cachedClearTimeout = defaultClearTimeout; |
|
1024 } |
|
1025 }()); |
|
1026 function runTimeout(fun) { |
|
1027 if (cachedSetTimeout === setTimeout) { |
|
1028 return setTimeout(fun, 0); |
|
1029 } |
|
1030 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { |
|
1031 cachedSetTimeout = setTimeout; |
|
1032 return setTimeout(fun, 0); |
|
1033 } |
|
1034 try { |
|
1035 return cachedSetTimeout(fun, 0); |
|
1036 } catch (e) { |
|
1037 try { |
|
1038 return cachedSetTimeout.call(null, fun, 0); |
|
1039 } catch (e) { |
|
1040 return cachedSetTimeout.call(this, fun, 0); |
|
1041 } |
|
1042 } |
|
1043 } |
|
1044 function runClearTimeout(marker) { |
|
1045 if (cachedClearTimeout === clearTimeout) { |
|
1046 return clearTimeout(marker); |
|
1047 } |
|
1048 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { |
|
1049 cachedClearTimeout = clearTimeout; |
|
1050 return clearTimeout(marker); |
|
1051 } |
|
1052 try { |
|
1053 return cachedClearTimeout(marker); |
|
1054 } catch (e) { |
|
1055 try { |
|
1056 return cachedClearTimeout.call(null, marker); |
|
1057 } catch (e) { |
|
1058 return cachedClearTimeout.call(this, marker); |
|
1059 } |
|
1060 } |
|
1061 } |
|
1062 var queue = []; |
|
1063 var draining = false; |
|
1064 var currentQueue; |
|
1065 var queueIndex = -1; |
|
1066 function cleanUpNextTick() { |
|
1067 if (!draining || !currentQueue) { |
|
1068 return; |
|
1069 } |
|
1070 draining = false; |
|
1071 if (currentQueue.length) { |
|
1072 queue = currentQueue.concat(queue); |
|
1073 } else { |
|
1074 queueIndex = -1; |
|
1075 } |
|
1076 if (queue.length) { |
|
1077 drainQueue(); |
|
1078 } |
|
1079 } |
|
1080 function drainQueue() { |
|
1081 if (draining) { |
|
1082 return; |
|
1083 } |
|
1084 var timeout = runTimeout(cleanUpNextTick); |
|
1085 draining = true; |
|
1086 var len = queue.length; |
|
1087 while (len) { |
|
1088 currentQueue = queue; |
|
1089 queue = []; |
|
1090 while (++queueIndex < len) { |
|
1091 if (currentQueue) { |
|
1092 currentQueue[queueIndex].run(); |
|
1093 } |
|
1094 } |
|
1095 queueIndex = -1; |
|
1096 len = queue.length; |
|
1097 } |
|
1098 currentQueue = null; |
|
1099 draining = false; |
|
1100 runClearTimeout(timeout); |
|
1101 } |
|
1102 process.nextTick = function (fun) { |
|
1103 var args = new Array(arguments.length - 1); |
|
1104 if (arguments.length > 1) { |
|
1105 for (var i = 1; i < arguments.length; i++) { |
|
1106 args[i - 1] = arguments[i]; |
|
1107 } |
|
1108 } |
|
1109 queue.push(new Item(fun, args)); |
|
1110 if (queue.length === 1 && !draining) { |
|
1111 runTimeout(drainQueue); |
|
1112 } |
|
1113 }; |
|
1114 function Item(fun, array) { |
|
1115 this.fun = fun; |
|
1116 this.array = array; |
|
1117 } |
|
1118 Item.prototype.run = function () { |
|
1119 this.fun.apply(null, this.array); |
|
1120 }; |
|
1121 process.title = 'browser'; |
|
1122 process.browser = true; |
|
1123 process.env = {}; |
|
1124 process.argv = []; |
|
1125 process.version = ''; |
|
1126 process.versions = {}; |
|
1127 function noop() { |
|
1128 } |
|
1129 process.on = noop; |
|
1130 process.addListener = noop; |
|
1131 process.once = noop; |
|
1132 process.off = noop; |
|
1133 process.removeListener = noop; |
|
1134 process.removeAllListeners = noop; |
|
1135 process.emit = noop; |
|
1136 process.prependListener = noop; |
|
1137 process.prependOnceListener = noop; |
|
1138 process.listeners = function (name) { |
|
1139 return []; |
|
1140 }; |
|
1141 process.binding = function (name) { |
|
1142 throw new Error('process.binding is not supported'); |
|
1143 }; |
|
1144 process.cwd = function () { |
|
1145 return '/'; |
|
1146 }; |
|
1147 process.chdir = function (dir) { |
|
1148 throw new Error('process.chdir is not supported'); |
|
1149 }; |
|
1150 process.umask = function () { |
|
1151 return 0; |
|
1152 }; |
|
1153 }, |
|
1154 {} |
|
1155 ], |
|
1156 2: [ |
|
1157 function (require, module, exports) { |
|
1158 (function (setImmediate) { |
|
1159 (function (root) { |
|
1160 var setTimeoutFunc = setTimeout; |
|
1161 function noop() { |
|
1162 } |
|
1163 function bind(fn, thisArg) { |
|
1164 return function () { |
|
1165 fn.apply(thisArg, arguments); |
|
1166 }; |
|
1167 } |
|
1168 function Promise(fn) { |
|
1169 if (typeof this !== 'object') |
|
1170 throw new TypeError('Promises must be constructed via new'); |
|
1171 if (typeof fn !== 'function') |
|
1172 throw new TypeError('not a function'); |
|
1173 this._state = 0; |
|
1174 this._handled = false; |
|
1175 this._value = undefined; |
|
1176 this._deferreds = []; |
|
1177 doResolve(fn, this); |
|
1178 } |
|
1179 function handle(self, deferred) { |
|
1180 while (self._state === 3) { |
|
1181 self = self._value; |
|
1182 } |
|
1183 if (self._state === 0) { |
|
1184 self._deferreds.push(deferred); |
|
1185 return; |
|
1186 } |
|
1187 self._handled = true; |
|
1188 Promise._immediateFn(function () { |
|
1189 var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; |
|
1190 if (cb === null) { |
|
1191 (self._state === 1 ? resolve : reject)(deferred.promise, self._value); |
|
1192 return; |
|
1193 } |
|
1194 var ret; |
|
1195 try { |
|
1196 ret = cb(self._value); |
|
1197 } catch (e) { |
|
1198 reject(deferred.promise, e); |
|
1199 return; |
|
1200 } |
|
1201 resolve(deferred.promise, ret); |
|
1202 }); |
|
1203 } |
|
1204 function resolve(self, newValue) { |
|
1205 try { |
|
1206 if (newValue === self) |
|
1207 throw new TypeError('A promise cannot be resolved with itself.'); |
|
1208 if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { |
|
1209 var then = newValue.then; |
|
1210 if (newValue instanceof Promise) { |
|
1211 self._state = 3; |
|
1212 self._value = newValue; |
|
1213 finale(self); |
|
1214 return; |
|
1215 } else if (typeof then === 'function') { |
|
1216 doResolve(bind(then, newValue), self); |
|
1217 return; |
|
1218 } |
|
1219 } |
|
1220 self._state = 1; |
|
1221 self._value = newValue; |
|
1222 finale(self); |
|
1223 } catch (e) { |
|
1224 reject(self, e); |
|
1225 } |
|
1226 } |
|
1227 function reject(self, newValue) { |
|
1228 self._state = 2; |
|
1229 self._value = newValue; |
|
1230 finale(self); |
|
1231 } |
|
1232 function finale(self) { |
|
1233 if (self._state === 2 && self._deferreds.length === 0) { |
|
1234 Promise._immediateFn(function () { |
|
1235 if (!self._handled) { |
|
1236 Promise._unhandledRejectionFn(self._value); |
|
1237 } |
|
1238 }); |
|
1239 } |
|
1240 for (var i = 0, len = self._deferreds.length; i < len; i++) { |
|
1241 handle(self, self._deferreds[i]); |
|
1242 } |
|
1243 self._deferreds = null; |
|
1244 } |
|
1245 function Handler(onFulfilled, onRejected, promise) { |
|
1246 this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; |
|
1247 this.onRejected = typeof onRejected === 'function' ? onRejected : null; |
|
1248 this.promise = promise; |
|
1249 } |
|
1250 function doResolve(fn, self) { |
|
1251 var done = false; |
|
1252 try { |
|
1253 fn(function (value) { |
|
1254 if (done) |
|
1255 return; |
|
1256 done = true; |
|
1257 resolve(self, value); |
|
1258 }, function (reason) { |
|
1259 if (done) |
|
1260 return; |
|
1261 done = true; |
|
1262 reject(self, reason); |
|
1263 }); |
|
1264 } catch (ex) { |
|
1265 if (done) |
|
1266 return; |
|
1267 done = true; |
|
1268 reject(self, ex); |
|
1269 } |
|
1270 } |
|
1271 Promise.prototype['catch'] = function (onRejected) { |
|
1272 return this.then(null, onRejected); |
|
1273 }; |
|
1274 Promise.prototype.then = function (onFulfilled, onRejected) { |
|
1275 var prom = new this.constructor(noop); |
|
1276 handle(this, new Handler(onFulfilled, onRejected, prom)); |
|
1277 return prom; |
|
1278 }; |
|
1279 Promise.all = function (arr) { |
|
1280 var args = Array.prototype.slice.call(arr); |
|
1281 return new Promise(function (resolve, reject) { |
|
1282 if (args.length === 0) |
|
1283 return resolve([]); |
|
1284 var remaining = args.length; |
|
1285 function res(i, val) { |
|
1286 try { |
|
1287 if (val && (typeof val === 'object' || typeof val === 'function')) { |
|
1288 var then = val.then; |
|
1289 if (typeof then === 'function') { |
|
1290 then.call(val, function (val) { |
|
1291 res(i, val); |
|
1292 }, reject); |
|
1293 return; |
|
1294 } |
|
1295 } |
|
1296 args[i] = val; |
|
1297 if (--remaining === 0) { |
|
1298 resolve(args); |
|
1299 } |
|
1300 } catch (ex) { |
|
1301 reject(ex); |
|
1302 } |
|
1303 } |
|
1304 for (var i = 0; i < args.length; i++) { |
|
1305 res(i, args[i]); |
|
1306 } |
|
1307 }); |
|
1308 }; |
|
1309 Promise.resolve = function (value) { |
|
1310 if (value && typeof value === 'object' && value.constructor === Promise) { |
|
1311 return value; |
|
1312 } |
|
1313 return new Promise(function (resolve) { |
|
1314 resolve(value); |
|
1315 }); |
|
1316 }; |
|
1317 Promise.reject = function (value) { |
|
1318 return new Promise(function (resolve, reject) { |
|
1319 reject(value); |
|
1320 }); |
|
1321 }; |
|
1322 Promise.race = function (values) { |
|
1323 return new Promise(function (resolve, reject) { |
|
1324 for (var i = 0, len = values.length; i < len; i++) { |
|
1325 values[i].then(resolve, reject); |
|
1326 } |
|
1327 }); |
|
1328 }; |
|
1329 Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) { |
|
1330 setImmediate(fn); |
|
1331 } : function (fn) { |
|
1332 setTimeoutFunc(fn, 0); |
|
1333 }; |
|
1334 Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { |
|
1335 if (typeof console !== 'undefined' && console) { |
|
1336 console.warn('Possible Unhandled Promise Rejection:', err); |
|
1337 } |
|
1338 }; |
|
1339 Promise._setImmediateFn = function _setImmediateFn(fn) { |
|
1340 Promise._immediateFn = fn; |
|
1341 }; |
|
1342 Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { |
|
1343 Promise._unhandledRejectionFn = fn; |
|
1344 }; |
|
1345 if (typeof module !== 'undefined' && module.exports) { |
|
1346 module.exports = Promise; |
|
1347 } else if (!root.Promise) { |
|
1348 root.Promise = Promise; |
|
1349 } |
|
1350 }(this)); |
|
1351 }.call(this, require('timers').setImmediate)); |
|
1352 }, |
|
1353 { 'timers': 3 } |
|
1354 ], |
|
1355 3: [ |
|
1356 function (require, module, exports) { |
|
1357 (function (setImmediate, clearImmediate) { |
|
1358 var nextTick = require('process/browser.js').nextTick; |
|
1359 var apply = Function.prototype.apply; |
|
1360 var slice = Array.prototype.slice; |
|
1361 var immediateIds = {}; |
|
1362 var nextImmediateId = 0; |
|
1363 exports.setTimeout = function () { |
|
1364 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); |
|
1365 }; |
|
1366 exports.setInterval = function () { |
|
1367 return new Timeout(apply.call(setInterval, window, arguments), clearInterval); |
|
1368 }; |
|
1369 exports.clearTimeout = exports.clearInterval = function (timeout) { |
|
1370 timeout.close(); |
|
1371 }; |
|
1372 function Timeout(id, clearFn) { |
|
1373 this._id = id; |
|
1374 this._clearFn = clearFn; |
|
1375 } |
|
1376 Timeout.prototype.unref = Timeout.prototype.ref = function () { |
|
1377 }; |
|
1378 Timeout.prototype.close = function () { |
|
1379 this._clearFn.call(window, this._id); |
|
1380 }; |
|
1381 exports.enroll = function (item, msecs) { |
|
1382 clearTimeout(item._idleTimeoutId); |
|
1383 item._idleTimeout = msecs; |
|
1384 }; |
|
1385 exports.unenroll = function (item) { |
|
1386 clearTimeout(item._idleTimeoutId); |
|
1387 item._idleTimeout = -1; |
|
1388 }; |
|
1389 exports._unrefActive = exports.active = function (item) { |
|
1390 clearTimeout(item._idleTimeoutId); |
|
1391 var msecs = item._idleTimeout; |
|
1392 if (msecs >= 0) { |
|
1393 item._idleTimeoutId = setTimeout(function onTimeout() { |
|
1394 if (item._onTimeout) |
|
1395 item._onTimeout(); |
|
1396 }, msecs); |
|
1397 } |
|
1398 }; |
|
1399 exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) { |
|
1400 var id = nextImmediateId++; |
|
1401 var args = arguments.length < 2 ? false : slice.call(arguments, 1); |
|
1402 immediateIds[id] = true; |
|
1403 nextTick(function onNextTick() { |
|
1404 if (immediateIds[id]) { |
|
1405 if (args) { |
|
1406 fn.apply(null, args); |
|
1407 } else { |
|
1408 fn.call(null); |
|
1409 } |
|
1410 exports.clearImmediate(id); |
|
1411 } |
|
1412 }); |
|
1413 return id; |
|
1414 }; |
|
1415 exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) { |
|
1416 delete immediateIds[id]; |
|
1417 }; |
|
1418 }.call(this, require('timers').setImmediate, require('timers').clearImmediate)); |
|
1419 }, |
|
1420 { |
|
1421 'process/browser.js': 1, |
|
1422 'timers': 3 |
|
1423 } |
|
1424 ], |
|
1425 4: [ |
|
1426 function (require, module, exports) { |
|
1427 var promisePolyfill = require('promise-polyfill'); |
|
1428 var Global = function () { |
|
1429 if (typeof window !== 'undefined') { |
|
1430 return window; |
|
1431 } else { |
|
1432 return Function('return this;')(); |
|
1433 } |
|
1434 }(); |
|
1435 module.exports = { boltExport: Global.Promise || promisePolyfill }; |
|
1436 }, |
|
1437 { 'promise-polyfill': 2 } |
|
1438 ] |
|
1439 }, {}, [4])(4); |
|
1440 })); |
|
1441 }(undefined, exports$1, module, undefined)); |
|
1442 var Promise = module.exports.boltExport; |
|
954 |
1443 |
955 var nu = function (baseFn) { |
1444 var nu = function (baseFn) { |
956 var data = Option.none(); |
1445 var data = Option.none(); |
957 var callbacks = []; |
1446 var callbacks = []; |
958 var map = function (f) { |
1447 var map = function (f) { |
961 nCallback(f(data)); |
1450 nCallback(f(data)); |
962 }); |
1451 }); |
963 }); |
1452 }); |
964 }; |
1453 }; |
965 var get = function (nCallback) { |
1454 var get = function (nCallback) { |
966 if (isReady()) |
1455 if (isReady()) { |
967 call(nCallback); |
1456 call(nCallback); |
968 else |
1457 } else { |
969 callbacks.push(nCallback); |
1458 callbacks.push(nCallback); |
1459 } |
|
970 }; |
1460 }; |
971 var set = function (x) { |
1461 var set = function (x) { |
972 data = Option.some(x); |
1462 data = Option.some(x); |
973 run(callbacks); |
1463 run(callbacks); |
974 callbacks = []; |
1464 callbacks = []; |
1001 var LazyValue = { |
1491 var LazyValue = { |
1002 nu: nu, |
1492 nu: nu, |
1003 pure: pure |
1493 pure: pure |
1004 }; |
1494 }; |
1005 |
1495 |
1006 var bounce = function (f) { |
1496 var errorReporter = function (err) { |
1007 return function () { |
1497 domGlobals.setTimeout(function () { |
1008 var args = []; |
1498 throw err; |
1009 for (var _i = 0; _i < arguments.length; _i++) { |
1499 }, 0); |
1010 args[_i] = arguments[_i]; |
1500 }; |
1011 } |
1501 var make = function (run) { |
1012 var me = this; |
|
1013 domGlobals.setTimeout(function () { |
|
1014 f.apply(me, args); |
|
1015 }, 0); |
|
1016 }; |
|
1017 }; |
|
1018 |
|
1019 var nu$1 = function (baseFn) { |
|
1020 var get = function (callback) { |
1502 var get = function (callback) { |
1021 baseFn(bounce(callback)); |
1503 run().then(callback, errorReporter); |
1022 }; |
1504 }; |
1023 var map = function (fab) { |
1505 var map = function (fab) { |
1024 return nu$1(function (callback) { |
1506 return make(function () { |
1025 get(function (a) { |
1507 return run().then(fab); |
1026 var value = fab(a); |
1508 }); |
1027 callback(value); |
1509 }; |
1510 var bind = function (aFutureB) { |
|
1511 return make(function () { |
|
1512 return run().then(function (v) { |
|
1513 return aFutureB(v).toPromise(); |
|
1028 }); |
1514 }); |
1029 }); |
1515 }); |
1030 }; |
1516 }; |
1031 var bind = function (aFutureB) { |
1517 var anonBind = function (futureB) { |
1032 return nu$1(function (callback) { |
1518 return make(function () { |
1033 get(function (a) { |
1519 return run().then(function () { |
1034 aFutureB(a).get(callback); |
1520 return futureB.toPromise(); |
1035 }); |
1521 }); |
1036 }); |
1522 }); |
1037 }; |
1523 }; |
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 () { |
1524 var toLazy = function () { |
1046 return LazyValue.nu(get); |
1525 return LazyValue.nu(get); |
1047 }; |
1526 }; |
1048 var toCached = function () { |
1527 var toCached = function () { |
1049 var cache = null; |
1528 var cache = null; |
1050 return nu$1(function (callback) { |
1529 return make(function () { |
1051 if (cache === null) { |
1530 if (cache === null) { |
1052 cache = toLazy(); |
1531 cache = run(); |
1053 } |
1532 } |
1054 cache.get(callback); |
1533 return cache; |
1055 }); |
1534 }); |
1056 }; |
1535 }; |
1536 var toPromise = run; |
|
1057 return { |
1537 return { |
1058 map: map, |
1538 map: map, |
1059 bind: bind, |
1539 bind: bind, |
1060 anonBind: anonBind, |
1540 anonBind: anonBind, |
1061 toLazy: toLazy, |
1541 toLazy: toLazy, |
1062 toCached: toCached, |
1542 toCached: toCached, |
1543 toPromise: toPromise, |
|
1063 get: get |
1544 get: get |
1064 }; |
1545 }; |
1065 }; |
1546 }; |
1547 var nu$1 = function (baseFn) { |
|
1548 return make(function () { |
|
1549 return new Promise(baseFn); |
|
1550 }); |
|
1551 }; |
|
1066 var pure$1 = function (a) { |
1552 var pure$1 = function (a) { |
1067 return nu$1(function (callback) { |
1553 return make(function () { |
1068 callback(a); |
1554 return Promise.resolve(a); |
1069 }); |
1555 }); |
1070 }; |
1556 }; |
1071 var Future = { |
1557 var Future = { |
1072 nu: nu$1, |
1558 nu: nu$1, |
1073 pure: pure$1 |
1559 pure: pure$1 |
1097 }; |
1583 }; |
1098 |
1584 |
1099 var par$1 = function (futures) { |
1585 var par$1 = function (futures) { |
1100 return par(futures, Future.nu); |
1586 return par(futures, Future.nu); |
1101 }; |
1587 }; |
1102 var mapM = function (array, fn) { |
1588 var traverse = function (array, fn) { |
1103 var futures = map(array, fn); |
1589 return par$1(map(array, fn)); |
1104 return par$1(futures); |
1590 }; |
1591 var mapM = traverse; |
|
1592 |
|
1593 var value = function () { |
|
1594 var subject = Cell(Option.none()); |
|
1595 var clear = function () { |
|
1596 subject.set(Option.none()); |
|
1597 }; |
|
1598 var set = function (s) { |
|
1599 subject.set(Option.some(s)); |
|
1600 }; |
|
1601 var on = function (f) { |
|
1602 subject.get().each(f); |
|
1603 }; |
|
1604 var isSet = function () { |
|
1605 return subject.get().isSome(); |
|
1606 }; |
|
1607 return { |
|
1608 clear: clear, |
|
1609 set: set, |
|
1610 isSet: isSet, |
|
1611 on: on |
|
1612 }; |
|
1105 }; |
1613 }; |
1106 |
1614 |
1107 var pasteHtml$1 = function (editor, html, internalFlag) { |
1615 var pasteHtml$1 = function (editor, html, internalFlag) { |
1108 var internal = internalFlag ? internalFlag : InternalHtml.isMarked(html); |
1616 var internal = internalFlag ? internalFlag : InternalHtml.isMarked(html); |
1109 var args = ProcessFilters.process(editor, InternalHtml.unmark(html), internal); |
1617 var args = ProcessFilters.process(editor, InternalHtml.unmark(html), internal); |
1141 } |
1649 } |
1142 return items; |
1650 return items; |
1143 }; |
1651 }; |
1144 var getClipboardContent = function (editor, clipboardEvent) { |
1652 var getClipboardContent = function (editor, clipboardEvent) { |
1145 var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer); |
1653 var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer); |
1146 return Utils.isMsEdge() ? global$3.extend(content, { 'text/html': '' }) : content; |
1654 return Utils.isMsEdge() ? global$4.extend(content, { 'text/html': '' }) : content; |
1147 }; |
1655 }; |
1148 var hasContentType = function (clipboardContent, mimeType) { |
1656 var hasContentType = function (clipboardContent, mimeType) { |
1149 return mimeType in clipboardContent && clipboardContent[mimeType].length > 0; |
1657 return mimeType in clipboardContent && clipboardContent[mimeType].length > 0; |
1150 }; |
1658 }; |
1151 var hasHtmlOrText = function (content) { |
1659 var hasHtmlOrText = function (content) { |
1240 var isBrokenAndroidClipboardEvent = function (e) { |
1748 var isBrokenAndroidClipboardEvent = function (e) { |
1241 var clipboardData = e.clipboardData; |
1749 var clipboardData = e.clipboardData; |
1242 return domGlobals.navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0; |
1750 return domGlobals.navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0; |
1243 }; |
1751 }; |
1244 var isKeyboardPasteEvent = function (e) { |
1752 var isKeyboardPasteEvent = function (e) { |
1245 return global$4.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45; |
1753 return global$5.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45; |
1246 }; |
1754 }; |
1247 var registerEventHandlers = function (editor, pasteBin, pasteFormat) { |
1755 var registerEventHandlers = function (editor, pasteBin, pasteFormat) { |
1248 var keyboardPasteTimeStamp = 0; |
1756 var keyboardPasteEvent = value(); |
1249 var keyboardPastePlainTextState; |
1757 var keyboardPastePlainTextState; |
1250 editor.on('keydown', function (e) { |
1758 editor.on('keydown', function (e) { |
1251 function removePasteBinOnKeyUp(e) { |
1759 function removePasteBinOnKeyUp(e) { |
1252 if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { |
1760 if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { |
1253 pasteBin.remove(); |
1761 pasteBin.remove(); |
1254 } |
1762 } |
1255 } |
1763 } |
1256 if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { |
1764 if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { |
1257 keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86; |
1765 keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86; |
1258 if (keyboardPastePlainTextState && global$1.webkit && domGlobals.navigator.userAgent.indexOf('Version/') !== -1) { |
1766 if (keyboardPastePlainTextState && global$2.webkit && domGlobals.navigator.userAgent.indexOf('Version/') !== -1) { |
1259 return; |
1767 return; |
1260 } |
1768 } |
1261 e.stopImmediatePropagation(); |
1769 e.stopImmediatePropagation(); |
1262 keyboardPasteTimeStamp = new Date().getTime(); |
1770 keyboardPasteEvent.set(e); |
1263 if (global$1.ie && keyboardPastePlainTextState) { |
1771 window.setTimeout(function () { |
1772 keyboardPasteEvent.clear(); |
|
1773 }, 100); |
|
1774 if (global$2.ie && keyboardPastePlainTextState) { |
|
1264 e.preventDefault(); |
1775 e.preventDefault(); |
1265 Events.firePaste(editor, true); |
1776 Events.firePaste(editor, true); |
1266 return; |
1777 return; |
1267 } |
1778 } |
1268 pasteBin.remove(); |
1779 pasteBin.remove(); |
1311 } |
1822 } |
1312 var getLastRng = function () { |
1823 var getLastRng = function () { |
1313 return pasteBin.getLastRng() || editor.selection.getRng(); |
1824 return pasteBin.getLastRng() || editor.selection.getRng(); |
1314 }; |
1825 }; |
1315 editor.on('paste', function (e) { |
1826 editor.on('paste', function (e) { |
1316 var clipboardTimer = new Date().getTime(); |
1827 var isKeyBoardPaste = keyboardPasteEvent.isSet(); |
1317 var clipboardContent = getClipboardContent(editor, e); |
1828 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; |
1829 var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState; |
1321 var internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime()); |
1830 var internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime()); |
1322 keyboardPastePlainTextState = false; |
1831 keyboardPastePlainTextState = false; |
1323 if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) { |
1832 if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) { |
1324 pasteBin.remove(); |
1833 pasteBin.remove(); |
1329 return; |
1838 return; |
1330 } |
1839 } |
1331 if (!isKeyBoardPaste) { |
1840 if (!isKeyBoardPaste) { |
1332 e.preventDefault(); |
1841 e.preventDefault(); |
1333 } |
1842 } |
1334 if (global$1.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) { |
1843 if (global$2.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) { |
1335 pasteBin.create(); |
1844 pasteBin.create(); |
1336 editor.dom.bind(pasteBin.getEl(), 'paste', function (e) { |
1845 editor.dom.bind(pasteBin.getEl(), 'paste', function (e) { |
1337 e.stopPropagation(); |
1846 e.stopPropagation(); |
1338 }); |
1847 }); |
1339 editor.getDoc().execCommand('Paste', false, null); |
1848 editor.getDoc().execCommand('Paste', false, null); |
1344 if (!internal) { |
1853 if (!internal) { |
1345 internal = InternalHtml.isMarked(clipboardContent['text/html']); |
1854 internal = InternalHtml.isMarked(clipboardContent['text/html']); |
1346 } |
1855 } |
1347 insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal); |
1856 insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal); |
1348 } else { |
1857 } else { |
1349 global$2.setEditorTimeout(editor, function () { |
1858 global$3.setEditorTimeout(editor, function () { |
1350 insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal); |
1859 insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal); |
1351 }, 0); |
1860 }, 0); |
1352 } |
1861 } |
1353 }); |
1862 }); |
1354 }; |
1863 }; |
1358 editor.parser.addNodeFilter('img', function (nodes, name, args) { |
1867 editor.parser.addNodeFilter('img', function (nodes, name, args) { |
1359 var isPasteInsert = function (args) { |
1868 var isPasteInsert = function (args) { |
1360 return args.data && args.data.paste === true; |
1869 return args.data && args.data.paste === true; |
1361 }; |
1870 }; |
1362 var remove = function (node) { |
1871 var remove = function (node) { |
1363 if (!node.attr('data-mce-object') && src !== global$1.transparentSrc) { |
1872 if (!node.attr('data-mce-object') && src !== global$2.transparentSrc) { |
1364 node.remove(); |
1873 node.remove(); |
1365 } |
1874 } |
1366 }; |
1875 }; |
1367 var isWebKitFakeUrl = function (src) { |
1876 var isWebKitFakeUrl = function (src) { |
1368 return src.indexOf('webkit-fake-url') === 0; |
1877 return src.indexOf('webkit-fake-url') === 0; |
1386 } |
1895 } |
1387 }); |
1896 }); |
1388 }; |
1897 }; |
1389 |
1898 |
1390 var getPasteBinParent = function (editor) { |
1899 var getPasteBinParent = function (editor) { |
1391 return global$1.ie && editor.inline ? domGlobals.document.body : editor.getBody(); |
1900 return global$2.ie && editor.inline ? domGlobals.document.body : editor.getBody(); |
1392 }; |
1901 }; |
1393 var isExternalPasteBin = function (editor) { |
1902 var isExternalPasteBin = function (editor) { |
1394 return getPasteBinParent(editor) !== editor.getBody(); |
1903 return getPasteBinParent(editor) !== editor.getBody(); |
1395 }; |
1904 }; |
1396 var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) { |
1905 var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) { |
1411 'class': 'mce-pastebin', |
1920 'class': 'mce-pastebin', |
1412 'contentEditable': true, |
1921 'contentEditable': true, |
1413 'data-mce-bogus': 'all', |
1922 'data-mce-bogus': 'all', |
1414 'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0' |
1923 'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0' |
1415 }, pasteBinDefaultContent); |
1924 }, pasteBinDefaultContent); |
1416 if (global$1.ie || global$1.gecko) { |
1925 if (global$2.ie || global$2.gecko) { |
1417 dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535); |
1926 dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535); |
1418 } |
1927 } |
1419 dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) { |
1928 dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) { |
1420 e.stopPropagation(); |
1929 e.stopPropagation(); |
1421 }); |
1930 }); |
1444 var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper; |
1953 var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper; |
1445 var copyAndRemove = function (toElm, fromElm) { |
1954 var copyAndRemove = function (toElm, fromElm) { |
1446 toElm.appendChild(fromElm); |
1955 toElm.appendChild(fromElm); |
1447 editor.dom.remove(fromElm, true); |
1956 editor.dom.remove(fromElm, true); |
1448 }; |
1957 }; |
1449 pasteBinClones = global$3.grep(getPasteBinParent(editor).childNodes, function (elm) { |
1958 pasteBinClones = global$4.grep(getPasteBinParent(editor).childNodes, function (elm) { |
1450 return elm.id === 'mcepastebin'; |
1959 return elm.id === 'mcepastebin'; |
1451 }); |
1960 }); |
1452 pasteBinElm = pasteBinClones.shift(); |
1961 pasteBinElm = pasteBinClones.shift(); |
1453 global$3.each(pasteBinClones, function (pasteBinClone) { |
1962 global$4.each(pasteBinClones, function (pasteBinClone) { |
1454 copyAndRemove(pasteBinElm, pasteBinClone); |
1963 copyAndRemove(pasteBinElm, pasteBinClone); |
1455 }); |
1964 }); |
1456 dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm); |
1965 dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm); |
1457 for (i = dirtyWrappers.length - 1; i >= 0; i--) { |
1966 for (i = dirtyWrappers.length - 1; i >= 0; i--) { |
1458 cleanWrapper = editor.dom.create('div'); |
1967 cleanWrapper = editor.dom.create('div'); |
1522 hasHtmlOrText: hasHtmlOrText, |
2031 hasHtmlOrText: hasHtmlOrText, |
1523 hasContentType: hasContentType |
2032 hasContentType: hasContentType |
1524 }; |
2033 }; |
1525 }; |
2034 }; |
1526 |
2035 |
1527 var noop = function () { |
2036 var noop$1 = function () { |
1528 }; |
2037 }; |
1529 var hasWorkingClipboardApi = function (clipboardData) { |
2038 var hasWorkingClipboardApi = function (clipboardData) { |
1530 return global$1.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && Utils.isMsEdge() !== true; |
2039 return global$2.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && Utils.isMsEdge() !== true; |
1531 }; |
2040 }; |
1532 var setHtml5Clipboard = function (clipboardData, html, text) { |
2041 var setHtml5Clipboard = function (clipboardData, html, text) { |
1533 if (hasWorkingClipboardApi(clipboardData)) { |
2042 if (hasWorkingClipboardApi(clipboardData)) { |
1534 try { |
2043 try { |
1535 clipboardData.clearData(); |
2044 clipboardData.clearData(); |
1605 }; |
2114 }; |
1606 }; |
2115 }; |
1607 var copy = function (editor) { |
2116 var copy = function (editor) { |
1608 return function (evt) { |
2117 return function (evt) { |
1609 if (hasSelectedContent(editor)) { |
2118 if (hasSelectedContent(editor)) { |
1610 setClipboardData(evt, getData(editor), fallback(editor), noop); |
2119 setClipboardData(evt, getData(editor), fallback(editor), noop$1); |
1611 } |
2120 } |
1612 }; |
2121 }; |
1613 }; |
2122 }; |
1614 var register$1 = function (editor) { |
2123 var register$1 = function (editor) { |
1615 editor.on('cut', cut(editor)); |
2124 editor.on('cut', cut(editor)); |
1616 editor.on('copy', copy(editor)); |
2125 editor.on('copy', copy(editor)); |
1617 }; |
2126 }; |
1618 var CutCopy = { register: register$1 }; |
2127 var CutCopy = { register: register$1 }; |
1619 |
2128 |
1620 var global$a = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils'); |
2129 var global$b = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils'); |
1621 |
2130 |
1622 var getCaretRangeFromEvent = function (editor, e) { |
2131 var getCaretRangeFromEvent = function (editor, e) { |
1623 return global$a.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc()); |
2132 return global$b.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc()); |
1624 }; |
2133 }; |
1625 var isPlainTextFileUrl = function (content) { |
2134 var isPlainTextFileUrl = function (content) { |
1626 var plainTextContent = content['text/plain']; |
2135 var plainTextContent = content['text/plain']; |
1627 return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false; |
2136 return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false; |
1628 }; |
2137 }; |
1658 } |
2167 } |
1659 if (rng && Settings.shouldFilterDrop(editor)) { |
2168 if (rng && Settings.shouldFilterDrop(editor)) { |
1660 var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain']; |
2169 var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain']; |
1661 if (content_1) { |
2170 if (content_1) { |
1662 e.preventDefault(); |
2171 e.preventDefault(); |
1663 global$2.setEditorTimeout(editor, function () { |
2172 global$3.setEditorTimeout(editor, function () { |
1664 editor.undoManager.transact(function () { |
2173 editor.undoManager.transact(function () { |
1665 if (dropContent['mce-internal']) { |
2174 if (dropContent['mce-internal']) { |
1666 editor.execCommand('Delete'); |
2175 editor.execCommand('Delete'); |
1667 } |
2176 } |
1668 setFocusedRange(editor, rng); |
2177 setFocusedRange(editor, rng); |
1722 function removeExplorerBrElementsAfterBlocks(editor, html) { |
2231 function removeExplorerBrElementsAfterBlocks(editor, html) { |
1723 if (!WordFilter.isWordContent(html)) { |
2232 if (!WordFilter.isWordContent(html)) { |
1724 return html; |
2233 return html; |
1725 } |
2234 } |
1726 var blockElements = []; |
2235 var blockElements = []; |
1727 global$3.each(editor.schema.getBlockElements(), function (block, blockName) { |
2236 global$4.each(editor.schema.getBlockElements(), function (block, blockName) { |
1728 blockElements.push(blockName); |
2237 blockElements.push(blockName); |
1729 }); |
2238 }); |
1730 var explorerBlocksRegExp = new RegExp('(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*', 'g'); |
2239 var explorerBlocksRegExp = new RegExp('(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*', 'g'); |
1731 html = Utils.filter(html, [[ |
2240 html = Utils.filter(html, [[ |
1732 explorerBlocksRegExp, |
2241 explorerBlocksRegExp, |
1796 editor.$('a', root).find('font,u').each(function (i, node) { |
2305 editor.$('a', root).find('font,u').each(function (i, node) { |
1797 editor.dom.remove(node, true); |
2306 editor.dom.remove(node, true); |
1798 }); |
2307 }); |
1799 } |
2308 } |
1800 var setup$2 = function (editor) { |
2309 var setup$2 = function (editor) { |
1801 if (global$1.webkit) { |
2310 if (global$2.webkit) { |
1802 addPreProcessFilter(editor, removeWebKitStyles); |
2311 addPreProcessFilter(editor, removeWebKitStyles); |
1803 } |
2312 } |
1804 if (global$1.ie) { |
2313 if (global$2.ie) { |
1805 addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks); |
2314 addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks); |
1806 addPostProcessFilter(editor, removeUnderlineAndFontInAnchor); |
2315 addPostProcessFilter(editor, removeUnderlineAndFontInAnchor); |
1807 } |
2316 } |
1808 }; |
2317 }; |
1809 var Quirks = { setup: setup$2 }; |
2318 var Quirks = { setup: setup$2 }; |
1832 onPostRender: postRender |
2341 onPostRender: postRender |
1833 }); |
2342 }); |
1834 }; |
2343 }; |
1835 var Buttons = { register: register$2 }; |
2344 var Buttons = { register: register$2 }; |
1836 |
2345 |
1837 global.add('paste', function (editor) { |
2346 global$1.add('paste', function (editor) { |
1838 if (DetectProPlugin.hasProPlugin(editor) === false) { |
2347 if (DetectProPlugin.hasProPlugin(editor) === false) { |
1839 var userIsInformedState = Cell(false); |
2348 var userIsInformedState = Cell(false); |
1840 var draggingInternallyState = Cell(false); |
2349 var draggingInternallyState = Cell(false); |
1841 var pasteFormat = Cell(Settings.isPasteAsTextEnabled(editor) ? 'text' : 'html'); |
2350 var pasteFormat = Cell(Settings.isPasteAsTextEnabled(editor) ? 'text' : 'html'); |
1842 var clipboard = Clipboard(editor, pasteFormat); |
2351 var clipboard = Clipboard(editor, pasteFormat); |