From 6329acbf2807915c0e0525c800ce88252f50ae6c Mon Sep 17 00:00:00 2001 From: Oliver Pulges Date: Fri, 29 Apr 2016 16:33:45 +0300 Subject: [PATCH 1/8] Modularize commands Add AMD wrappers Rename global namespace to wysihtml --- Gruntfile.js | 89 +- dist/modules/wysihtml.command_formatCode.js | 64 + .../wysihtml.command_formatCode.min.js | 1 + dist/modules/wysihtml.command_insertImage.js | 120 + .../wysihtml.command_insertImage.min.js | 1 + dist/modules/wysihtml.commands_basic.js | 141 + dist/modules/wysihtml.commands_basic.min.js | 1 + .../wysihtml.commands_format_by_class.js | 112 + .../wysihtml.commands_format_by_class.min.js | 1 + .../wysihtml.commands_format_by_style.js | 221 ++ .../wysihtml.commands_format_by_style.min.js | 1 + dist/wysihtml-toolbar.js | 2966 +++++------------ dist/wysihtml-toolbar.min.js | 18 +- dist/wysihtml-toolbar.min.map | 2 +- dist/wysihtml.js | 2472 ++++---------- dist/wysihtml.min.js | 17 +- dist/wysihtml.min.map | 2 +- src/assert/html_equal.js | 12 +- src/browser.js | 8 +- src/commands.js | 26 +- src/commands/addTableCells.js | 12 +- src/commands/alignCenterStyle.js | 19 - src/commands/alignJustifyStyle.js | 18 - src/commands/alignLeftStyle.js | 19 - src/commands/alignRightStyle.js | 18 - src/commands/bgColorStyle.js | 53 - src/commands/bold.js | 18 - src/commands/createLink.js | 12 +- src/commands/createTable.js | 6 +- src/commands/deleteTableCells.js | 18 +- src/commands/fontSize.js | 16 - src/commands/fontSizeStyle.js | 38 - src/commands/foreColor.js | 16 - src/commands/formatBlock.js | 70 +- src/commands/formatInline.js | 56 +- src/commands/indentList.js | 8 +- src/commands/insertBlockQuote.js | 18 - src/commands/insertHTML.js | 6 +- src/commands/insertLineBreak.js | 8 +- src/commands/insertList.js | 28 +- src/commands/insertOrderedList.js | 11 - src/commands/insertUnorderedList.js | 11 - src/commands/italic.js | 18 - src/commands/mergeTableCells.js | 18 +- src/commands/outdentList.js | 10 +- src/commands/redo.js | 6 +- src/commands/removeLink.js | 10 +- src/commands/subscript.js | 17 - src/commands/superscript.js | 17 - src/commands/underline.js | 18 - src/commands/undo.js | 6 +- src/dom/auto_link.js | 22 +- src/dom/class.js | 6 +- src/dom/compare_document_position.js | 12 +- src/dom/contains.js | 4 +- src/dom/contenteditable_area.js | 10 +- src/dom/convert_to_list.js | 14 +- src/dom/copy_attributes.js | 4 +- src/dom/copy_styles.js | 6 +- src/dom/delegate.js | 8 +- src/dom/dom_node.js | 56 +- src/dom/get_as_dom.js | 6 +- src/dom/get_attribute.js | 6 +- src/dom/get_attributes.js | 8 +- src/dom/get_parent_element.js | 4 +- src/dom/get_pasted_html.js | 12 +- src/dom/get_style.js | 6 +- src/dom/get_textnodes.js | 4 +- src/dom/has_element_with_class_name.js | 10 +- src/dom/has_element_with_tag_name.js | 4 +- src/dom/insert.js | 2 +- src/dom/insert_css.js | 2 +- src/dom/is_loaded_image.js | 2 +- src/dom/line_breaks.js | 24 +- src/dom/observe.js | 4 +- src/dom/parse.js | 70 +- src/dom/query.js | 2 +- src/dom/remove_empty_text_nodes.js | 8 +- src/dom/remove_invisible_spaces.js | 6 +- src/dom/rename_element.js | 6 +- src/dom/replace_with_child_nodes.js | 4 +- src/dom/resolve_list.js | 8 +- src/dom/sandbox.js | 36 +- src/dom/set_attributes.js | 2 +- src/dom/set_styles.js | 2 +- src/dom/simulate_placeholder.js | 6 +- src/dom/table.js | 10 +- src/dom/text_content.js | 2 +- src/dom/unwrap.js | 6 +- src/editor.js | 42 +- .../command_formatCode.js} | 14 +- .../command_insertImage.js} | 43 +- src/extensions/commands_basic/bold.js | 16 + .../commands_basic/insertBlockQuote.js | 16 + .../commands_basic/insertOrderedList.js | 11 + .../commands_basic/insertUnorderedList.js | 11 + src/extensions/commands_basic/italic.js | 17 + src/extensions/commands_basic/subscript.js | 17 + src/extensions/commands_basic/superscript.js | 17 + src/extensions/commands_basic/underline.js | 17 + .../commands_format_by_class/fontSize.js | 13 + .../commands_format_by_class/foreColor.js | 13 + .../justifyCenter.js | 11 +- .../commands_format_by_class}/justifyFull.js | 11 +- .../commands_format_by_class}/justifyLeft.js | 11 +- .../commands_format_by_class}/justifyRight.js | 11 +- .../alignCenterStyle.js | 17 + .../alignJustifyStyle.js | 17 + .../alignLeftStyle.js | 17 + .../alignRightStyle.js | 17 + .../commands_format_by_style/bgColorStyle.js | 48 + .../commands_format_by_style/fontSizeStyle.js | 35 + .../foreColorStyle.js | 28 +- src/lang/array.js | 22 +- src/lang/dispatcher.js | 4 +- src/lang/object.js | 26 +- src/lang/string.js | 10 +- src/polyfills.js | 4 +- src/quirks/clean_pasted_html.js | 12 +- src/quirks/ensure_proper_clearing.js | 6 +- src/quirks/get_correct_inner_html.js | 10 +- src/quirks/redraw.js | 12 +- src/quirks/style_parser.js | 40 +- src/quirks/table_cells_selection.js | 6 +- src/selection/html_applier.js | 644 ---- src/selection/selection.js | 104 +- src/toolbar/dialog.js | 16 +- src/toolbar/dialog_bgColorStyle.js | 12 +- src/toolbar/dialog_createTable.js | 6 +- src/toolbar/dialog_fontSizeStyle.js | 12 +- src/toolbar/dialog_foreColorStyle.js | 10 +- src/toolbar/speech.js | 12 +- src/toolbar/toolbar.js | 28 +- src/undo_manager.js | 16 +- src/views/composer.js | 36 +- src/views/composer.observe.js | 62 +- src/views/composer.style.js | 12 +- src/views/sourceview.js | 8 +- src/views/synchronizer.js | 14 +- src/views/textarea.js | 14 +- src/views/view.js | 4 +- src/{wysihtml5.js => wysihtml.js} | 2 +- test/browser_test.js | 50 +- test/commands/formatBlock_test.js | 14 +- test/commands/formatInline_test.js | 10 +- test/dom/auto_link_test.js | 8 +- test/dom/compare_document_position_test.js | 8 +- test/dom/contains_test.js | 12 +- test/dom/convert_to_list_test.js | 6 +- test/dom/copy_attributes_test.js | 8 +- test/dom/copy_styles_test.js | 36 +- test/dom/delegate_test.js | 8 +- test/dom/dom_node_test.js | 38 +- test/dom/get_as_dom_test.js | 18 +- test/dom/get_parent_element_test.js | 44 +- test/dom/get_style_test.js | 16 +- test/dom/has_element_with_class_name_test.js | 12 +- test/dom/has_element_with_tag_name_test.js | 10 +- test/dom/insert_css_test.js | 18 +- test/dom/observe_test.js | 16 +- test/dom/parse_test.js | 6 +- test/dom/rename_element_test.js | 6 +- test/dom/resolve_list_test.js | 6 +- test/dom/sandbox_test.js | 26 +- test/dom/set_attributes_test.js | 4 +- test/dom/set_styles_test.js | 12 +- test/dom/table_test.js | 62 +- test/dom/unwrap_test.js | 4 +- test/editor_commands_test.js | 16 +- test/editor_contenteditablemode_test.js | 68 +- test/editor_test.js | 102 +- test/incompatible_test.js | 12 +- test/index.html | 36 +- test/lang/array_test.js | 16 +- test/lang/object_test.js | 30 +- test/lang/string_test.js | 10 +- test/quirks/clean_pasted_html_test.js | 24 +- test/undo_manager_test.js | 8 +- test/views/composer_test.js | 6 +- 179 files changed, 3614 insertions(+), 6084 deletions(-) create mode 100644 dist/modules/wysihtml.command_formatCode.js create mode 100644 dist/modules/wysihtml.command_formatCode.min.js create mode 100644 dist/modules/wysihtml.command_insertImage.js create mode 100644 dist/modules/wysihtml.command_insertImage.min.js create mode 100644 dist/modules/wysihtml.commands_basic.js create mode 100644 dist/modules/wysihtml.commands_basic.min.js create mode 100644 dist/modules/wysihtml.commands_format_by_class.js create mode 100644 dist/modules/wysihtml.commands_format_by_class.min.js create mode 100644 dist/modules/wysihtml.commands_format_by_style.js create mode 100644 dist/modules/wysihtml.commands_format_by_style.min.js delete mode 100644 src/commands/alignCenterStyle.js delete mode 100644 src/commands/alignJustifyStyle.js delete mode 100644 src/commands/alignLeftStyle.js delete mode 100644 src/commands/alignRightStyle.js delete mode 100644 src/commands/bgColorStyle.js delete mode 100644 src/commands/bold.js delete mode 100644 src/commands/fontSize.js delete mode 100644 src/commands/fontSizeStyle.js delete mode 100644 src/commands/foreColor.js delete mode 100644 src/commands/insertBlockQuote.js delete mode 100644 src/commands/insertOrderedList.js delete mode 100644 src/commands/insertUnorderedList.js delete mode 100644 src/commands/italic.js delete mode 100644 src/commands/subscript.js delete mode 100644 src/commands/superscript.js delete mode 100644 src/commands/underline.js rename src/{commands/formatCode.js => extensions/command_formatCode.js} (85%) rename src/{commands/insertImage.js => extensions/command_insertImage.js} (69%) create mode 100644 src/extensions/commands_basic/bold.js create mode 100644 src/extensions/commands_basic/insertBlockQuote.js create mode 100644 src/extensions/commands_basic/insertOrderedList.js create mode 100644 src/extensions/commands_basic/insertUnorderedList.js create mode 100644 src/extensions/commands_basic/italic.js create mode 100644 src/extensions/commands_basic/subscript.js create mode 100644 src/extensions/commands_basic/superscript.js create mode 100644 src/extensions/commands_basic/underline.js create mode 100644 src/extensions/commands_format_by_class/fontSize.js create mode 100644 src/extensions/commands_format_by_class/foreColor.js rename src/{commands => extensions/commands_format_by_class}/justifyCenter.js (53%) rename src/{commands => extensions/commands_format_by_class}/justifyFull.js (53%) rename src/{commands => extensions/commands_format_by_class}/justifyLeft.js (53%) rename src/{commands => extensions/commands_format_by_class}/justifyRight.js (53%) create mode 100644 src/extensions/commands_format_by_style/alignCenterStyle.js create mode 100644 src/extensions/commands_format_by_style/alignJustifyStyle.js create mode 100644 src/extensions/commands_format_by_style/alignLeftStyle.js create mode 100644 src/extensions/commands_format_by_style/alignRightStyle.js create mode 100644 src/extensions/commands_format_by_style/bgColorStyle.js create mode 100644 src/extensions/commands_format_by_style/fontSizeStyle.js rename src/{commands => extensions/commands_format_by_style}/foreColorStyle.js (50%) delete mode 100644 src/selection/html_applier.js rename src/{wysihtml5.js => wysihtml.js} (97%) diff --git a/Gruntfile.js b/Gruntfile.js index 7d4ce76..370e7ee 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,10 +1,34 @@ module.exports = function(grunt) { "use strict"; + + var moduleAMDHeader = "\ +(function (root, factory) {\n\ + if(typeof define === 'function' && define.amd) {\n\ + define(['wysihtml'], factory);\n\ + } else if(typeof module === 'object' && module.exports) {\n\ + module.exports = factory(require('wysihtml'));\n\ + } else {\n\ + factory(root.wysihtml);\n\ + }\n\ +})(this, function(wysihtml) {\n\n"; + + var AMDHeader = "\ +(function (root, factory) {\n\ +if(typeof define === 'function' && define.amd) {\n\ + define(factory);\n\ +} else if(typeof module === 'object' && module.exports) {\n\ + module.exports = factory();\n\ +} else {\n\ + factory();\n\ +}\n\ +})(this, function() {\n\n"; + + var AMDFooter = "\n});\n"; // List required source files that will be built into wysihtml5x.js var base = [ - "src/wysihtml5.js", + "src/wysihtml.js", "src/polyfills.js", "node_modules/rangy/lib/rangy-core.js", "node_modules/rangy/lib/rangy-textrange.js", @@ -60,37 +84,15 @@ module.exports = function(grunt) { "src/quirks/table_cells_selection.js", "src/quirks/style_parser.js", "src/selection/selection.js", - "src/selection/html_applier.js", "src/commands.js", - "src/commands/bold.js", "src/commands/createLink.js", "src/commands/removeLink.js", - "src/commands/fontSize.js", - "src/commands/fontSizeStyle.js", - "src/commands/foreColor.js", - "src/commands/foreColorStyle.js", - "src/commands/bgColorStyle.js", "src/commands/formatBlock.js", - "src/commands/formatCode.js", "src/commands/formatInline.js", - "src/commands/insertBlockQuote.js", "src/commands/insertHTML.js", - "src/commands/insertImage.js", "src/commands/insertLineBreak.js", - "src/commands/insertOrderedList.js", - "src/commands/insertUnorderedList.js", "src/commands/insertList.js", - "src/commands/italic.js", - "src/commands/justifyCenter.js", - "src/commands/justifyLeft.js", - "src/commands/justifyRight.js", - "src/commands/justifyFull.js", - "src/commands/alignRightStyle.js", - "src/commands/alignLeftStyle.js", - "src/commands/alignCenterStyle.js", - "src/commands/alignJustifyStyle.js", "src/commands/redo.js", - "src/commands/underline.js", "src/commands/undo.js", "src/commands/createTable.js", "src/commands/mergeTableCells.js", @@ -98,8 +100,6 @@ module.exports = function(grunt) { "src/commands/deleteTableCells.js", "src/commands/indentList.js", "src/commands/outdentList.js", - "src/commands/subscript.js", - "src/commands/superscript.js", "src/undo_manager.js", "src/views/view.js", "src/views/composer.js", @@ -126,6 +126,8 @@ module.exports = function(grunt) { pkg: grunt.file.readJSON('package.json'), concat: { options: { + banner: AMDHeader, + footer: AMDFooter, separator: ';', process: function(src, filepath) { return src.replace(/@VERSION/g, grunt.config.get('pkg.version')); @@ -162,7 +164,42 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-open'); + + grunt.registerTask("build-modules", "Builds all extension files", function() { + var concat = {}, + uglify = {}; + + grunt.file.expand("./src/extensions/*").forEach(function (d) { + var dir = d.split('/').pop(); + + if (!grunt.file.isDir(d)) { + var fnameArr = dir.split('.'); + fnameArr.pop(); + dir = fnameArr.join('.'); + } + + concat[dir] = { + options: { + banner: moduleAMDHeader, + footer: AMDFooter + }, + src: grunt.file.isDir(d) ? [d + '/*.js'] : [d], + dest: 'dist/modules/wysihtml.' + dir + '.js' + }; + + uglify[dir] = { + files: { + ['dist/modules/wysihtml.' + dir + '.min.js']: 'dist/modules/wysihtml.' + dir + '.js' + } + }; + + }); + grunt.config.set('concat', concat); + grunt.task.run('concat'); + grunt.config.set('uglify', uglify); + grunt.task.run('uglify'); + }); - grunt.registerTask('default', ['concat', 'uglify']); + grunt.registerTask('default', ['concat', 'uglify', 'build-modules']); grunt.registerTask('test', ['open:test']); }; diff --git a/dist/modules/wysihtml.command_formatCode.js b/dist/modules/wysihtml.command_formatCode.js new file mode 100644 index 0000000..c97d599 --- /dev/null +++ b/dist/modules/wysihtml.command_formatCode.js @@ -0,0 +1,64 @@ +(function (root, factory) { + if(typeof define === 'function' && define.amd) { + define(['wysihtml'], factory); + } else if(typeof module === 'object' && module.exports) { + module.exports = factory(require('wysihtml')); + } else { + factory(root.wysihtml); + } +})(this, function(wysihtml) { + +/* Formats block for as a
block + * Useful in conjuction for sytax highlight utility: highlight.js + * + * Usage: + * + * editorInstance.composer.commands.exec("formatCode", "language-html"); +*/ +wysihtml.commands.formatCode = (function() { + return { + exec: function(composer, command, classname) { + var pre = this.state(composer)[0], + code, range, selectedNodes; + + if (pre) { + // caret is already within a
...
+ composer.selection.executeAndRestore(function() { + code = pre.querySelector("code"); + wysihtml.dom.replaceWithChildNodes(pre); + if (code) { + wysihtml.dom.replaceWithChildNodes(code); + } + }); + } else { + // Wrap in
...
+ range = composer.selection.getRange(); + selectedNodes = range.extractContents(); + pre = composer.doc.createElement("pre"); + code = composer.doc.createElement("code"); + + if (classname) { + code.className = classname; + } + + pre.appendChild(code); + code.appendChild(selectedNodes); + range.insertNode(pre); + composer.selection.selectNode(pre); + } + }, + + state: function(composer) { + var selectedNode = composer.selection.getSelectedNode(), node; + if (selectedNode && selectedNode.nodeName && selectedNode.nodeName == "PRE"&& + selectedNode.firstChild && selectedNode.firstChild.nodeName && selectedNode.firstChild.nodeName == "CODE") { + return [selectedNode]; + } else { + node = wysihtml.dom.getParentElement(selectedNode, { query: "pre code" }); + return node ? [node.parentNode] : false; + } + } + }; +})(); + +}); diff --git a/dist/modules/wysihtml.command_formatCode.min.js b/dist/modules/wysihtml.command_formatCode.min.js new file mode 100644 index 0000000..4cdd40a --- /dev/null +++ b/dist/modules/wysihtml.command_formatCode.min.js @@ -0,0 +1 @@ +!function(a,b){"function"==typeof define&&define.amd?define(["wysihtml"],b):"object"==typeof module&&module.exports?module.exports=b(require("wysihtml")):b(a.wysihtml)}(this,function(a){a.commands.formatCode=function(){return{exec:function(b,c,d){var e,f,g,h=this.state(b)[0];h?b.selection.executeAndRestore(function(){e=h.querySelector("code"),a.dom.replaceWithChildNodes(h),e&&a.dom.replaceWithChildNodes(e)}):(f=b.selection.getRange(),g=f.extractContents(),h=b.doc.createElement("pre"),e=b.doc.createElement("code"),d&&(e.className=d),h.appendChild(e),e.appendChild(g),f.insertNode(h),b.selection.selectNode(h))},state:function(b){var c,d=b.selection.getSelectedNode();return d&&d.nodeName&&"PRE"==d.nodeName&&d.firstChild&&d.firstChild.nodeName&&"CODE"==d.firstChild.nodeName?[d]:(c=a.dom.getParentElement(d,{query:"pre code"}),c?[c.parentNode]:!1)}}}()}); \ No newline at end of file diff --git a/dist/modules/wysihtml.command_insertImage.js b/dist/modules/wysihtml.command_insertImage.js new file mode 100644 index 0000000..4aeac5a --- /dev/null +++ b/dist/modules/wysihtml.command_insertImage.js @@ -0,0 +1,120 @@ +(function (root, factory) { + if(typeof define === 'function' && define.amd) { + define(['wysihtml'], factory); + } else if(typeof module === 'object' && module.exports) { + module.exports = factory(require('wysihtml')); + } else { + factory(root.wysihtml); + } +})(this, function(wysihtml) { + +/** + * Inserts an + * If selection is already an image link, it removes it + * + * @example + * // either ... + * wysihtml.commands.insertImage.exec(composer, "insertImage", "http://www.google.de/logo.jpg"); + * // ... or ... + * wysihtml.commands.insertImage.exec(composer, "insertImage", { src: "http://www.google.de/logo.jpg", title: "foo" }); + */ +wysihtml.commands.insertImage = (function() { + var NODE_NAME = "IMG"; + return { + exec: function(composer, command, value) { + value = typeof(value) === "object" ? value : { src: value }; + + var doc = composer.doc, + image = this.state(composer), + textNode, + parent; + + // If image is selected and src ie empty, set the caret before it and delete the image + if (image && !value.src) { + composer.selection.setBefore(image); + parent = image.parentNode; + parent.removeChild(image); + + // and it's parent too if it hasn't got any other relevant child nodes + wysihtml.dom.removeEmptyTextNodes(parent); + if (parent.nodeName === "A" && !parent.firstChild) { + composer.selection.setAfter(parent); + parent.parentNode.removeChild(parent); + } + + // firefox and ie sometimes don't remove the image handles, even though the image got removed + wysihtml.quirks.redraw(composer.element); + return; + } + + // If image selected change attributes accordingly + if (image) { + for (var key in value) { + if (value.hasOwnProperty(key)) { + image.setAttribute(key === "className" ? "class" : key, value[key]); + } + } + return; + } + + // Otherwise lets create the image + image = doc.createElement(NODE_NAME); + + for (var i in value) { + image.setAttribute(i === "className" ? "class" : i, value[i]); + } + + composer.selection.insertNode(image); + if (wysihtml.browser.hasProblemsSettingCaretAfterImg()) { + textNode = doc.createTextNode(wysihtml.INVISIBLE_SPACE); + composer.selection.insertNode(textNode); + composer.selection.setAfter(textNode); + } else { + composer.selection.setAfter(image); + } + }, + + state: function(composer) { + var doc = composer.doc, + selectedNode, + text, + imagesInSelection; + + if (!wysihtml.dom.hasElementWithTagName(doc, NODE_NAME)) { + return false; + } + + selectedNode = composer.selection.getSelectedNode(); + if (!selectedNode) { + return false; + } + + if (selectedNode.nodeName === NODE_NAME) { + // This works perfectly in IE + return selectedNode; + } + + if (selectedNode.nodeType !== wysihtml.ELEMENT_NODE) { + return false; + } + + text = composer.selection.getText(); + text = wysihtml.lang.string(text).trim(); + if (text) { + return false; + } + + imagesInSelection = composer.selection.getNodes(wysihtml.ELEMENT_NODE, function(node) { + return node.nodeName === "IMG"; + }); + + if (imagesInSelection.length !== 1) { + return false; + } + + return imagesInSelection[0]; + } + }; +})(); + +}); diff --git a/dist/modules/wysihtml.command_insertImage.min.js b/dist/modules/wysihtml.command_insertImage.min.js new file mode 100644 index 0000000..2bf9fcd --- /dev/null +++ b/dist/modules/wysihtml.command_insertImage.min.js @@ -0,0 +1 @@ +!function(a,b){"function"==typeof define&&define.amd?define(["wysihtml"],b):"object"==typeof module&&module.exports?module.exports=b(require("wysihtml")):b(a.wysihtml)}(this,function(a){a.commands.insertImage=function(){var b="IMG";return{exec:function(c,d,e){e="object"==typeof e?e:{src:e};var f,g,h=c.doc,i=this.state(c);if(i&&!e.src)return c.selection.setBefore(i),g=i.parentNode,g.removeChild(i),a.dom.removeEmptyTextNodes(g),"A"!==g.nodeName||g.firstChild||(c.selection.setAfter(g),g.parentNode.removeChild(g)),void a.quirks.redraw(c.element);if(i)for(var j in e)e.hasOwnProperty(j)&&i.setAttribute("className"===j?"class":j,e[j]);else{i=h.createElement(b);for(var k in e)i.setAttribute("className"===k?"class":k,e[k]);c.selection.insertNode(i),a.browser.hasProblemsSettingCaretAfterImg()?(f=h.createTextNode(a.INVISIBLE_SPACE),c.selection.insertNode(f),c.selection.setAfter(f)):c.selection.setAfter(i)}},state:function(c){var d,e,f,g=c.doc;return a.dom.hasElementWithTagName(g,b)&&(d=c.selection.getSelectedNode())?d.nodeName===b?d:d.nodeType!==a.ELEMENT_NODE?!1:(e=c.selection.getText(),(e=a.lang.string(e).trim())?!1:(f=c.selection.getNodes(a.ELEMENT_NODE,function(a){return"IMG"===a.nodeName}),1!==f.length?!1:f[0])):!1}}}()}); \ No newline at end of file diff --git a/dist/modules/wysihtml.commands_basic.js b/dist/modules/wysihtml.commands_basic.js new file mode 100644 index 0000000..e3e1da1 --- /dev/null +++ b/dist/modules/wysihtml.commands_basic.js @@ -0,0 +1,141 @@ +(function (root, factory) { + if(typeof define === 'function' && define.amd) { + define(['wysihtml'], factory); + } else if(typeof module === 'object' && module.exports) { + module.exports = factory(require('wysihtml')); + } else { + factory(root.wysihtml); + } +})(this, function(wysihtml) { + +wysihtml.commands.bold = (function() { + var nodeOptions = { + nodeName: "B", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; +})(); + +wysihtml.commands.insertBlockQuote = (function() { + var nodeOptions = { + nodeName: "BLOCKQUOTE", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); + +wysihtml.commands.insertOrderedList = (function() { + return { + exec: function(composer, command) { + wysihtml.commands.insertList.exec(composer, command, "OL"); + }, + + state: function(composer, command) { + return wysihtml.commands.insertList.state(composer, command, "OL"); + } + }; +})(); + +wysihtml.commands.insertUnorderedList = (function() { + return { + exec: function(composer, command) { + wysihtml.commands.insertList.exec(composer, command, "UL"); + }, + + state: function(composer, command) { + return wysihtml.commands.insertList.state(composer, command, "UL"); + } + }; +})(); + +wysihtml.commands.italic = (function() { + var nodeOptions = { + nodeName: "I", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; + +})(); + +wysihtml.commands.subscript = (function() { + var nodeOptions = { + nodeName: "SUB", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; + +})(); + +wysihtml.commands.superscript = (function() { + var nodeOptions = { + nodeName: "SUP", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; + +})(); + +wysihtml.commands.underline = (function() { + var nodeOptions = { + nodeName: "U", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; + +})(); + +}); diff --git a/dist/modules/wysihtml.commands_basic.min.js b/dist/modules/wysihtml.commands_basic.min.js new file mode 100644 index 0000000..0815171 --- /dev/null +++ b/dist/modules/wysihtml.commands_basic.min.js @@ -0,0 +1 @@ +!function(a,b){"function"==typeof define&&define.amd?define(["wysihtml"],b):"object"==typeof module&&module.exports?module.exports=b(require("wysihtml")):b(a.wysihtml)}(this,function(a){a.commands.bold=function(){var b={nodeName:"B",toggle:!0};return{exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(),a.commands.insertBlockQuote=function(){var b={nodeName:"BLOCKQUOTE",toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(),a.commands.insertOrderedList=function(){return{exec:function(b,c){a.commands.insertList.exec(b,c,"OL")},state:function(b,c){return a.commands.insertList.state(b,c,"OL")}}}(),a.commands.insertUnorderedList=function(){return{exec:function(b,c){a.commands.insertList.exec(b,c,"UL")},state:function(b,c){return a.commands.insertList.state(b,c,"UL")}}}(),a.commands.italic=function(){var b={nodeName:"I",toggle:!0};return{exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(),a.commands.subscript=function(){var b={nodeName:"SUB",toggle:!0};return{exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(),a.commands.superscript=function(){var b={nodeName:"SUP",toggle:!0};return{exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(),a.commands.underline=function(){var b={nodeName:"U",toggle:!0};return{exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}()}); \ No newline at end of file diff --git a/dist/modules/wysihtml.commands_format_by_class.js b/dist/modules/wysihtml.commands_format_by_class.js new file mode 100644 index 0000000..bcff708 --- /dev/null +++ b/dist/modules/wysihtml.commands_format_by_class.js @@ -0,0 +1,112 @@ +(function (root, factory) { + if(typeof define === 'function' && define.amd) { + define(['wysihtml'], factory); + } else if(typeof module === 'object' && module.exports) { + module.exports = factory(require('wysihtml')); + } else { + factory(root.wysihtml); + } +})(this, function(wysihtml) { + +wysihtml.commands.fontSize = (function() { + var REG_EXP = /wysiwyg-font-size-[0-9a-z\-]+/g; + + return { + exec: function(composer, command, size) { + wysihtml.commands.formatInline.exec(composer, command, {className: "wysiwyg-font-size-" + size, classRegExp: REG_EXP, toggle: true}); + }, + + state: function(composer, command, size) { + return wysihtml.commands.formatInline.state(composer, command, {className: "wysiwyg-font-size-" + size}); + } + }; +})(); + +wysihtml.commands.foreColor = (function() { + var REG_EXP = /wysiwyg-color-[0-9a-z]+/g; + + return { + exec: function(composer, command, color) { + wysihtml.commands.formatInline.exec(composer, command, {className: "wysiwyg-color-" + color, classRegExp: REG_EXP, toggle: true}); + }, + + state: function(composer, command, color) { + return wysihtml.commands.formatInline.state(composer, command, {className: "wysiwyg-color-" + color}); + } + }; +})(); + +wysihtml.commands.justifyCenter = (function() { + var nodeOptions = { + className: "wysiwyg-text-align-center", + classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; + +})(); + +wysihtml.commands.justifyFull = (function() { + var nodeOptions = { + className: "wysiwyg-text-align-justify", + classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); + +wysihtml.commands.justifyLeft = (function() { + var nodeOptions = { + className: "wysiwyg-text-align-left", + classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); + +wysihtml.commands.justifyRight = (function() { + var nodeOptions = { + className: "wysiwyg-text-align-right", + classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); + +}); diff --git a/dist/modules/wysihtml.commands_format_by_class.min.js b/dist/modules/wysihtml.commands_format_by_class.min.js new file mode 100644 index 0000000..6ff8762 --- /dev/null +++ b/dist/modules/wysihtml.commands_format_by_class.min.js @@ -0,0 +1 @@ +!function(a,b){"function"==typeof define&&define.amd?define(["wysihtml"],b):"object"==typeof module&&module.exports?module.exports=b(require("wysihtml")):b(a.wysihtml)}(this,function(a){a.commands.fontSize=function(){var b=/wysiwyg-font-size-[0-9a-z\-]+/g;return{exec:function(c,d,e){a.commands.formatInline.exec(c,d,{className:"wysiwyg-font-size-"+e,classRegExp:b,toggle:!0})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{className:"wysiwyg-font-size-"+d})}}}(),a.commands.foreColor=function(){var b=/wysiwyg-color-[0-9a-z]+/g;return{exec:function(c,d,e){a.commands.formatInline.exec(c,d,{className:"wysiwyg-color-"+e,classRegExp:b,toggle:!0})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{className:"wysiwyg-color-"+d})}}}(),a.commands.justifyCenter=function(){var b={className:"wysiwyg-text-align-center",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(),a.commands.justifyFull=function(){var b={className:"wysiwyg-text-align-justify",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(),a.commands.justifyLeft=function(){var b={className:"wysiwyg-text-align-left",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(),a.commands.justifyRight=function(){var b={className:"wysiwyg-text-align-right",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}()}); \ No newline at end of file diff --git a/dist/modules/wysihtml.commands_format_by_style.js b/dist/modules/wysihtml.commands_format_by_style.js new file mode 100644 index 0000000..202647b --- /dev/null +++ b/dist/modules/wysihtml.commands_format_by_style.js @@ -0,0 +1,221 @@ +(function (root, factory) { + if(typeof define === 'function' && define.amd) { + define(['wysihtml'], factory); + } else if(typeof module === 'object' && module.exports) { + module.exports = factory(require('wysihtml')); + } else { + factory(root.wysihtml); + } +})(this, function(wysihtml) { + +wysihtml.commands.alignCenterStyle = (function() { + var nodeOptions = { + styleProperty: "textAlign", + styleValue: "center", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); + +wysihtml.commands.alignJustifyStyle = (function() { + var nodeOptions = { + styleProperty: "textAlign", + styleValue: "justify", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); + +wysihtml.commands.alignLeftStyle = (function() { + var nodeOptions = { + styleProperty: "textAlign", + styleValue: "left", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); + +wysihtml.commands.alignRightStyle = (function() { + var nodeOptions = { + styleProperty: "textAlign", + styleValue: "right", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); + +/* Sets text background color by inline styles */ +wysihtml.commands.bgColorStyle = (function() { + return { + exec: function(composer, command, color) { + var colorVals = wysihtml.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color"), + colString; + + if (colorVals) { + colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; + wysihtml.commands.formatInline.exec(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); + } + }, + + state: function(composer, command, color) { + var colorVals = color ? wysihtml.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color") : null, + colString; + + if (colorVals) { + colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; + } + + return wysihtml.commands.formatInline.state(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); + }, + + remove: function(composer, command) { + return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: 'backgroundColor'}); + }, + + stateValue: function(composer, command, props) { + var st = this.state(composer, command), + colorStr, + val = false; + + if (st && wysihtml.lang.object(st).isArray()) { + st = st[0]; + } + + if (st) { + colorStr = st.getAttribute('style'); + if (colorStr) { + val = wysihtml.quirks.styleParser.parseColor(colorStr, "background-color"); + return wysihtml.quirks.styleParser.unparseColor(val, props); + } + } + return false; + } + }; +})(); + +/* Set font size by inline style */ +wysihtml.commands.fontSizeStyle = (function() { + return { + exec: function(composer, command, size) { + size = size.size || size; + if (!(/^\s*$/).test(size)) { + wysihtml.commands.formatInline.exec(composer, command, {styleProperty: "fontSize", styleValue: size, toggle: false}); + } + }, + + state: function(composer, command, size) { + return wysihtml.commands.formatInline.state(composer, command, {styleProperty: "fontSize", styleValue: size || undefined}); + }, + + remove: function(composer, command) { + return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: "fontSize"}); + }, + + stateValue: function(composer, command) { + var styleStr, + st = this.state(composer, command); + + if (st && wysihtml.lang.object(st).isArray()) { + st = st[0]; + } + if (st) { + styleStr = st.getAttribute("style"); + if (styleStr) { + return wysihtml.quirks.styleParser.parseFontSize(styleStr); + } + } + return false; + } + }; +})(); + +/* Sets text color by inline styles */ +wysihtml.commands.foreColorStyle = (function() { + return { + exec: function(composer, command, color) { + var colorVals, colString; + + if (!color) { return; } + + colorVals = wysihtml.quirks.styleParser.parseColor("color:" + (color.color || color), "color"); + + if (colorVals) { + colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')'; + wysihtml.commands.formatInline.exec(composer, command, {styleProperty: "color", styleValue: colString}); + } + }, + + state: function(composer, command, color) { + var colorVals = color ? wysihtml.quirks.styleParser.parseColor("color:" + (color.color || color), "color") : null, + colString; + + + if (colorVals) { + colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')'; + } + + return wysihtml.commands.formatInline.state(composer, command, {styleProperty: "color", styleValue: colString}); + }, + + remove: function(composer, command) { + return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: "color"}); + }, + + stateValue: function(composer, command, props) { + var st = this.state(composer, command), + colorStr, + val = false; + + if (st && wysihtml.lang.object(st).isArray()) { + st = st[0]; + } + + if (st) { + colorStr = st.getAttribute("style"); + if (colorStr) { + val = wysihtml.quirks.styleParser.parseColor(colorStr, "color"); + return wysihtml.quirks.styleParser.unparseColor(val, props); + } + } + return false; + } + }; +})(); + +}); diff --git a/dist/modules/wysihtml.commands_format_by_style.min.js b/dist/modules/wysihtml.commands_format_by_style.min.js new file mode 100644 index 0000000..be1ce12 --- /dev/null +++ b/dist/modules/wysihtml.commands_format_by_style.min.js @@ -0,0 +1 @@ +!function(a,b){"function"==typeof define&&define.amd?define(["wysihtml"],b):"object"==typeof module&&module.exports?module.exports=b(require("wysihtml")):b(a.wysihtml)}(this,function(a){a.commands.alignCenterStyle=function(){var b={styleProperty:"textAlign",styleValue:"center",toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(),a.commands.alignJustifyStyle=function(){var b={styleProperty:"textAlign",styleValue:"justify",toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(),a.commands.alignLeftStyle=function(){var b={styleProperty:"textAlign",styleValue:"left",toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(),a.commands.alignRightStyle=function(){var b={styleProperty:"textAlign",styleValue:"right",toggle:!0};return{exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(),a.commands.bgColorStyle=function(){return{exec:function(b,c,d){var e,f=a.quirks.styleParser.parseColor("background-color:"+(d.color||d),"background-color");f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")",a.commands.formatInline.exec(b,c,{styleProperty:"backgroundColor",styleValue:e}))},state:function(b,c,d){var e,f=d?a.quirks.styleParser.parseColor("background-color:"+(d.color||d),"background-color"):null;return f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")"),a.commands.formatInline.state(b,c,{styleProperty:"backgroundColor",styleValue:e})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"backgroundColor"})},stateValue:function(b,c,d){var e,f=this.state(b,c),g=!1;return f&&a.lang.object(f).isArray()&&(f=f[0]),f&&(e=f.getAttribute("style"))?(g=a.quirks.styleParser.parseColor(e,"background-color"),a.quirks.styleParser.unparseColor(g,d)):!1}}}(),a.commands.fontSizeStyle=function(){return{exec:function(b,c,d){d=d.size||d,/^\s*$/.test(d)||a.commands.formatInline.exec(b,c,{styleProperty:"fontSize",styleValue:d,toggle:!1})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{styleProperty:"fontSize",styleValue:d||void 0})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"fontSize"})},stateValue:function(b,c){var d,e=this.state(b,c);return e&&a.lang.object(e).isArray()&&(e=e[0]),e&&(d=e.getAttribute("style"))?a.quirks.styleParser.parseFontSize(d):!1}}}(),a.commands.foreColorStyle=function(){return{exec:function(b,c,d){var e,f;d&&(e=a.quirks.styleParser.parseColor("color:"+(d.color||d),"color"),e&&(f=(1===e[3]?"rgb("+[e[0],e[1],e[2]].join(", "):"rgba("+e.join(", "))+")",a.commands.formatInline.exec(b,c,{styleProperty:"color",styleValue:f})))},state:function(b,c,d){var e,f=d?a.quirks.styleParser.parseColor("color:"+(d.color||d),"color"):null;return f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")"),a.commands.formatInline.state(b,c,{styleProperty:"color",styleValue:e})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"color"})},stateValue:function(b,c,d){var e,f=this.state(b,c),g=!1;return f&&a.lang.object(f).isArray()&&(f=f[0]),f&&(e=f.getAttribute("style"))?(g=a.quirks.styleParser.parseColor(e,"color"),a.quirks.styleParser.unparseColor(g,d)):!1}}}()}); \ No newline at end of file diff --git a/dist/wysihtml-toolbar.js b/dist/wysihtml-toolbar.js index 26bafae..8657e8d 100644 --- a/dist/wysihtml-toolbar.js +++ b/dist/wysihtml-toolbar.js @@ -1,3 +1,13 @@ +(function (root, factory) { +if(typeof define === 'function' && define.amd) { + define(factory); +} else if(typeof module === 'object' && module.exports) { + module.exports = factory(); +} else { + factory(); +} +})(this, function() { + /** * @license wysihtml v0.5.5 * https://github.com/Voog/wysihtml @@ -9,7 +19,7 @@ * Licensed under the MIT license (MIT) * */ -var wysihtml5 = { +var wysihtml = { version: "0.5.5", // namespaces @@ -38,7 +48,7 @@ var wysihtml5 = { TAB_KEY: 9, DELETE_KEY: 46 }; -;wysihtml5.polyfills = function(win, doc) { +;wysihtml.polyfills = function(win, doc) { // TODO: in future try to replace most inline compability checks with polyfills for code readability @@ -545,7 +555,7 @@ var wysihtml5 = { })(); }; -wysihtml5.polyfills(window, document); +wysihtml.polyfills(window, document); ;/** * Rangy, a cross-browser JavaScript range and selection library * https://github.com/timdown/rangy @@ -6712,7 +6722,7 @@ Base = Base.extend({ });;/** * Detect browser support for specific features */ -wysihtml5.browser = (function() { +wysihtml.browser = (function() { var userAgent = navigator.userAgent, testElement = document.createElement("div"), // Browser sniffing is unfortunately needed since some behaviors are impossible to feature detect @@ -6867,7 +6877,7 @@ wysihtml5.browser = (function() { * @param {Object} context The document object on which to check HTML5 support * * @example - * wysihtml5.browser.supportsHTML5Tags(document); + * wysihtml.browser.supportsHTML5Tags(document); */ supportsHTML5Tags: function(context) { var element = context.createElement("div"), @@ -6886,7 +6896,7 @@ wysihtml5.browser = (function() { * @return {Boolean} * * @example - * wysihtml5.browser.supportsCommand(document, "bold"); + * wysihtml.browser.supportsCommand(document, "bold"); */ supportsCommand: (function() { // Following commands are supported but contain bugs in some browsers @@ -7023,7 +7033,7 @@ wysihtml5.browser = (function() { * * @example * var input = document.createElement("input"); - * if (wysihtml5.browser.supportsSpeechApiOn(input)) { + * if (wysihtml.browser.supportsSpeechApiOn(input)) { * // ... * } */ @@ -7126,13 +7136,13 @@ wysihtml5.browser = (function() { } }; })(); -;wysihtml5.lang.array = function(arr) { +;wysihtml.lang.array = function(arr) { return { /** * Check whether a given object exists in an array * * @example - * wysihtml5.lang.array([1, 2]).contains(1); + * wysihtml.lang.array([1, 2]).contains(1); * // => true * * Can be used to match array with array. If intersection is found true is returned @@ -7140,13 +7150,13 @@ wysihtml5.browser = (function() { contains: function(needle) { if (Array.isArray(needle)) { for (var i = needle.length; i--;) { - if (wysihtml5.lang.array(arr).indexOf(needle[i]) !== -1) { + if (wysihtml.lang.array(arr).indexOf(needle[i]) !== -1) { return true; } } return false; } else { - return wysihtml5.lang.array(arr).indexOf(needle) !== -1; + return wysihtml.lang.array(arr).indexOf(needle) !== -1; } }, @@ -7155,7 +7165,7 @@ wysihtml5.browser = (function() { * If no elelemt found returns -1 * * @example - * wysihtml5.lang.array([1, 2]).indexOf(2); + * wysihtml.lang.array([1, 2]).indexOf(2); * // => 1 */ indexOf: function(needle) { @@ -7173,11 +7183,11 @@ wysihtml5.browser = (function() { * Substract one array from another * * @example - * wysihtml5.lang.array([1, 2, 3, 4]).without([3, 4]); + * wysihtml.lang.array([1, 2, 3, 4]).without([3, 4]); * // => [1, 2] */ without: function(arrayToSubstract) { - arrayToSubstract = wysihtml5.lang.array(arrayToSubstract); + arrayToSubstract = wysihtml.lang.array(arrayToSubstract); var newArr = [], i = 0, length = arr.length; @@ -7194,7 +7204,7 @@ wysihtml5.browser = (function() { * * Following will convert a Live NodeList to a proper Array * @example - * var childNodes = wysihtml5.lang.array(document.body.childNodes).get(); + * var childNodes = wysihtml.lang.array(document.body.childNodes).get(); */ get: function() { var i = 0, @@ -7211,7 +7221,7 @@ wysihtml5.browser = (function() { * optionally this can be provided as second argument * * @example - * var childNodes = wysihtml5.lang.array([1,2,3,4]).map(function (value, index, array) { + * var childNodes = wysihtml.lang.array([1,2,3,4]).map(function (value, index, array) { return value * 2; * }); * // => [2,4,6,8] @@ -7233,7 +7243,7 @@ wysihtml5.browser = (function() { /* ReturnS new array without duplicate entries * * @example - * var uniq = wysihtml5.lang.array([1,2,3,2,1,4]).unique(); + * var uniq = wysihtml.lang.array([1,2,3,2,1,4]).unique(); * // => [1,2,3,4] */ unique: function() { @@ -7242,7 +7252,7 @@ wysihtml5.browser = (function() { idx = 0; while (idx < max) { - if (!wysihtml5.lang.array(vals).contains(arr[idx])) { + if (!wysihtml.lang.array(vals).contains(arr[idx])) { vals.push(arr[idx]); } idx++; @@ -7252,8 +7262,8 @@ wysihtml5.browser = (function() { }; }; -;wysihtml5.lang.Dispatcher = Base.extend( - /** @scope wysihtml5.lang.Dialog.prototype */ { +;wysihtml.lang.Dispatcher = Base.extend( + /** @scope wysihtml.lang.Dialog.prototype */ { on: function(eventName, handler) { this.events = this.events || {}; this.events[eventName] = this.events[eventName] || []; @@ -7302,23 +7312,23 @@ wysihtml5.browser = (function() { return this.off.apply(this, arguments); } }); -;wysihtml5.lang.object = function(obj) { +;wysihtml.lang.object = function(obj) { return { /** * @example - * wysihtml5.lang.object({ foo: 1, bar: 1 }).merge({ bar: 2, baz: 3 }).get(); + * wysihtml.lang.object({ foo: 1, bar: 1 }).merge({ bar: 2, baz: 3 }).get(); * // => { foo: 1, bar: 2, baz: 3 } */ merge: function(otherObj, deep) { for (var i in otherObj) { - if (deep && wysihtml5.lang.object(otherObj[i]).isPlainObject() && (typeof obj[i] === "undefined" || wysihtml5.lang.object(obj[i]).isPlainObject())) { + if (deep && wysihtml.lang.object(otherObj[i]).isPlainObject() && (typeof obj[i] === "undefined" || wysihtml.lang.object(obj[i]).isPlainObject())) { if (typeof obj[i] === "undefined") { - obj[i] = wysihtml5.lang.object(otherObj[i]).clone(true); + obj[i] = wysihtml.lang.object(otherObj[i]).clone(true); } else { - wysihtml5.lang.object(obj[i]).merge(wysihtml5.lang.object(otherObj[i]).clone(true)); + wysihtml.lang.object(obj[i]).merge(wysihtml.lang.object(otherObj[i]).clone(true)); } } else { - obj[i] = wysihtml5.lang.object(otherObj[i]).isPlainObject() ? wysihtml5.lang.object(otherObj[i]).clone(true) : otherObj[i]; + obj[i] = wysihtml.lang.object(otherObj[i]).isPlainObject() ? wysihtml.lang.object(otherObj[i]).clone(true) : otherObj[i]; } } return this; @@ -7353,23 +7363,23 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.object({ foo: 1 }).clone(); + * wysihtml.lang.object({ foo: 1 }).clone(); * // => { foo: 1 } * - * v0.4.14 adds options for deep clone : wysihtml5.lang.object({ foo: 1 }).clone(true); + * v0.4.14 adds options for deep clone : wysihtml.lang.object({ foo: 1 }).clone(true); */ clone: function(deep) { var newObj = {}, i; - if (obj === null || !wysihtml5.lang.object(obj).isPlainObject()) { + if (obj === null || !wysihtml.lang.object(obj).isPlainObject()) { return obj; } for (i in obj) { if(obj.hasOwnProperty(i)) { if (deep) { - newObj[i] = wysihtml5.lang.object(obj[i]).clone(deep); + newObj[i] = wysihtml.lang.object(obj[i]).clone(deep); } else { newObj[i] = obj[i]; } @@ -7380,7 +7390,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.object([]).isArray(); + * wysihtml.lang.object([]).isArray(); * // => true */ isArray: function() { @@ -7389,7 +7399,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.object(function() {}).isFunction(); + * wysihtml.lang.object(function() {}).isFunction(); * // => true */ isFunction: function() { @@ -7402,7 +7412,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.object({}).isEmpty(); + * wysihtml.lang.object({}).isEmpty(); * // => true */ isEmpty: function() { @@ -7426,12 +7436,12 @@ wysihtml5.browser = (function() { '"': """, '\t':"  " }; - wysihtml5.lang.string = function(str) { + wysihtml.lang.string = function(str) { str = String(str); return { /** * @example - * wysihtml5.lang.string(" foo ").trim(); + * wysihtml.lang.string(" foo ").trim(); * // => "foo" */ trim: function() { @@ -7440,7 +7450,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.string("Hello #{name}").interpolate({ name: "Christopher" }); + * wysihtml.lang.string("Hello #{name}").interpolate({ name: "Christopher" }); * // => "Hello Christopher" */ interpolate: function(vars) { @@ -7452,7 +7462,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.string("Hello Tom").replace("Tom").with("Hans"); + * wysihtml.lang.string("Hello Tom").replace("Tom").with("Hans"); * // => "Hello Hans" */ replace: function(search) { @@ -7465,7 +7475,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.string("hello
").escapeHTML(); + * wysihtml.lang.string("hello
").escapeHTML(); * // => "hello<br>" */ escapeHTML: function(linebreaks, convertSpaces) { @@ -7489,13 +7499,13 @@ wysihtml5.browser = (function() { * * @example *
Please click here: www.google.com
- * + * */ -(function(wysihtml5) { +(function(wysihtml) { var /** * Don't auto-link urls that are contained in the following elements: */ - IGNORE_URLS_IN = wysihtml5.lang.array(["CODE", "PRE", "A", "SCRIPT", "HEAD", "TITLE", "STYLE"]), + IGNORE_URLS_IN = wysihtml.lang.array(["CODE", "PRE", "A", "SCRIPT", "HEAD", "TITLE", "STYLE"]), /** * revision 1: * /(\S+\.{1}[^\s\,\.\!]+)/g @@ -7568,7 +7578,7 @@ wysihtml5.browser = (function() { */ function _wrapMatchesInNode(textNode) { var parentNode = textNode.parentNode, - nodeValue = wysihtml5.lang.string(textNode.data).escapeHTML(), + nodeValue = wysihtml.lang.string(textNode.data).escapeHTML(), tempElement = _getTempElement(parentNode.ownerDocument); // We need to insert an empty/temporary to fix IE quirks @@ -7588,7 +7598,7 @@ wysihtml5.browser = (function() { while (node.parentNode) { node = node.parentNode; nodeName = node.nodeName; - if (node.className && wysihtml5.lang.array(node.className.split(' ')).contains(ignoreInClasses)) { + if (node.className && wysihtml.lang.array(node.className.split(' ')).contains(ignoreInClasses)) { return true; } if (IGNORE_URLS_IN.contains(nodeName)) { @@ -7605,16 +7615,16 @@ wysihtml5.browser = (function() { return; } - if (element.className && wysihtml5.lang.array(element.className.split(' ')).contains(ignoreInClasses)) { + if (element.className && wysihtml.lang.array(element.className.split(' ')).contains(ignoreInClasses)) { return; } - if (element.nodeType === wysihtml5.TEXT_NODE && element.data.match(URL_REG_EXP)) { + if (element.nodeType === wysihtml.TEXT_NODE && element.data.match(URL_REG_EXP)) { _wrapMatchesInNode(element); return; } - var childNodes = wysihtml5.lang.array(element.childNodes).get(), + var childNodes = wysihtml.lang.array(element.childNodes).get(), childNodesLength = childNodes.length, i = 0; @@ -7625,13 +7635,13 @@ wysihtml5.browser = (function() { return element; } - wysihtml5.dom.autoLink = autoLink; + wysihtml.dom.autoLink = autoLink; // Reveal url reg exp to the outside - wysihtml5.dom.autoLink.URL_REG_EXP = URL_REG_EXP; -})(wysihtml5); -;(function(wysihtml5) { - var api = wysihtml5.dom; + wysihtml.dom.autoLink.URL_REG_EXP = URL_REG_EXP; +})(wysihtml); +;(function(wysihtml) { + var api = wysihtml.dom; api.addClass = function(element, className) { var classList = element.classList; @@ -7662,12 +7672,12 @@ wysihtml5.browser = (function() { var elementClassName = element.className; return (elementClassName.length > 0 && (elementClassName == className || new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); }; -})(wysihtml5); -;wysihtml5.dom.contains = (function() { +})(wysihtml); +;wysihtml.dom.contains = (function() { var documentElement = document.documentElement; if (documentElement.contains) { return function(container, element) { - if (element.nodeType !== wysihtml5.ELEMENT_NODE) { + if (element.nodeType !== wysihtml.ELEMENT_NODE) { if (element.parentNode === container) { return true; } @@ -7698,7 +7708,7 @@ wysihtml5.browser = (function() { * * * * * @@ -7708,7 +7718,7 @@ wysihtml5.browser = (function() { *
  • 50 Cent
  • * */ -wysihtml5.dom.convertToList = (function() { +wysihtml.dom.convertToList = (function() { function _createListItem(doc, list) { var listItem = doc.createElement("li"); list.appendChild(listItem); @@ -7743,25 +7753,25 @@ wysihtml5.dom.convertToList = (function() { for (i=0; i if empty, otherwise create a new one currentListItem = currentListItem.firstChild ? _createListItem(doc, list) : currentListItem; currentListItem.appendChild(childNode); @@ -7800,10 +7810,10 @@ wysihtml5.dom.convertToList = (function() { * var textarea = document.querySelector("textarea"), * div = document.querySelector("div[contenteditable=true]"), * anotherDiv = document.querySelector("div.preview"); - * wysihtml5.dom.copyAttributes(["spellcheck", "value", "placeholder"]).from(textarea).to(div).andTo(anotherDiv); + * wysihtml.dom.copyAttributes(["spellcheck", "value", "placeholder"]).from(textarea).to(div).andTo(anotherDiv); * */ -wysihtml5.dom.copyAttributes = function(attributesToCopy) { +wysihtml.dom.copyAttributes = function(attributesToCopy) { return { from: function(elementToCopyFrom) { return { @@ -7839,7 +7849,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { * var textarea = document.querySelector("textarea"), * div = document.querySelector("div[contenteditable=true]"), * anotherDiv = document.querySelector("div.preview"); - * wysihtml5.dom.copyStyles(["overflow-y", "width", "height"]).from(textarea).to(div).andTo(anotherDiv); + * wysihtml.dom.copyStyles(["overflow-y", "width", "height"]).from(textarea).to(div).andTo(anotherDiv); * */ (function(dom) { @@ -7874,7 +7884,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { return { from: function(element) { if (shouldIgnoreBoxSizingBorderBox(element)) { - stylesToCopy = wysihtml5.lang.array(stylesToCopy).without(BOX_SIZING_PROPERTIES); + stylesToCopy = wysihtml.lang.array(stylesToCopy).without(BOX_SIZING_PROPERTIES); } var cssText = "", @@ -7895,17 +7905,17 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } }; }; -})(wysihtml5.dom); +})(wysihtml.dom); ;/** * Event Delegation * * @example - * wysihtml5.dom.delegate(document.body, "a", "click", function() { + * wysihtml.dom.delegate(document.body, "a", "click", function() { * // foo * }); */ -(function(wysihtml5) { - wysihtml5.dom.delegate = function(container, selector, eventName, handler) { +(function(wysihtml) { + wysihtml.dom.delegate = function(container, selector, eventName, handler) { var callback = function(event) { var target = event.target, element = (target.nodeType === 3) ? target.parentNode : target, // IE has .contains only seeing elements not textnodes @@ -7925,9 +7935,9 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } }; }; -})(wysihtml5); +})(wysihtml); ;// TODO: Refactor dom tree traversing here -(function(wysihtml5) { +(function(wysihtml) { // Finds parents of a node, returning the outermost node first in Array // if contain node is given parents search is stopped at the container @@ -7942,15 +7952,15 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { return nodes; } - wysihtml5.dom.domNode = function(node) { - var defaultNodeTypes = [wysihtml5.ELEMENT_NODE, wysihtml5.TEXT_NODE]; + wysihtml.dom.domNode = function(node) { + var defaultNodeTypes = [wysihtml.ELEMENT_NODE, wysihtml.TEXT_NODE]; return { is: { emptyTextNode: function(ignoreWhitespace) { var regx = ignoreWhitespace ? (/^\s*$/g) : (/^[\r\n]*$/g); - return node && node.nodeType === wysihtml5.TEXT_NODE && (regx).test(node.data); + return node && node.nodeType === wysihtml.TEXT_NODE && (regx).test(node.data); }, // Returns if node is the rangy selection bookmark element (that must not be taken into account in most situatons and is removed on selection restoring) @@ -7959,7 +7969,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { }, visible: function() { - var isVisible = !(/^\s*$/g).test(wysihtml5.dom.getTextContent(node)); + var isVisible = !(/^\s*$/g).test(wysihtml.dom.getTextContent(node)); if (!isVisible) { if (node.nodeType === 1 && node.querySelector('img, br, hr, object, embed, canvas, input, textarea')) { @@ -7978,13 +7988,13 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { // In most cases browsers should solve the cases for you when you try to insert content into those, // but IE does not and it is not nice to do so anyway. voidElement: function() { - return wysihtml5.dom.domNode(node).test({ - query: wysihtml5.VOID_ELEMENTS + return wysihtml.dom.domNode(node).test({ + query: wysihtml.VOID_ELEMENTS }); } }, - // var node = wysihtml5.dom.domNode(element).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + // var node = wysihtml.dom.domNode(element).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); prev: function(options) { var prevNode = node.previousSibling, types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes; @@ -7994,17 +8004,17 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } if ( - wysihtml5.dom.domNode(prevNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) - (!wysihtml5.lang.array(types).contains(prevNode.nodeType)) || // nodeTypes check. - (options && options.ignoreBlankTexts && wysihtml5.dom.domNode(prevNode).is.emptyTextNode(true)) // Blank text nodes bypassed if set + wysihtml.dom.domNode(prevNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) + (!wysihtml.lang.array(types).contains(prevNode.nodeType)) || // nodeTypes check. + (options && options.ignoreBlankTexts && wysihtml.dom.domNode(prevNode).is.emptyTextNode(true)) // Blank text nodes bypassed if set ) { - return wysihtml5.dom.domNode(prevNode).prev(options); + return wysihtml.dom.domNode(prevNode).prev(options); } return prevNode; }, - // var node = wysihtml5.dom.domNode(element).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + // var node = wysihtml.dom.domNode(element).next({nodeTypes: [1,3], ignoreBlankTexts: true}); next: function(options) { var nextNode = node.nextSibling, types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes; @@ -8014,11 +8024,11 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } if ( - wysihtml5.dom.domNode(nextNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) - (!wysihtml5.lang.array(types).contains(nextNode.nodeType)) || // nodeTypes check. - (options && options.ignoreBlankTexts && wysihtml5.dom.domNode(nextNode).is.emptyTextNode(true)) // blank text nodes bypassed if set + wysihtml.dom.domNode(nextNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) + (!wysihtml.lang.array(types).contains(nextNode.nodeType)) || // nodeTypes check. + (options && options.ignoreBlankTexts && wysihtml.dom.domNode(nextNode).is.emptyTextNode(true)) // blank text nodes bypassed if set ) { - return wysihtml5.dom.domNode(nextNode).next(options); + return wysihtml.dom.domNode(nextNode).next(options); } return nextNode; @@ -8027,7 +8037,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { // Finds the common acnestor container of two nodes // If container given stops search at the container // If no common ancestor found returns null - // var node = wysihtml5.dom.domNode(element).commonAncestor(node2, container); + // var node = wysihtml.dom.domNode(element).commonAncestor(node2, container); commonAncestor: function(node2, container) { var parents1 = parents(node, container), parents2 = parents(node2, container); @@ -8068,24 +8078,24 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { // Returns if element is of of options.leafClasses leaf if (options && options.leafClasses) { for (var i = options.leafClasses.length; i--;) { - if (wysihtml5.dom.hasClass(node, options.leafClasses[i])) { + if (wysihtml.dom.hasClass(node, options.leafClasses[i])) { return node; } } } - return wysihtml5.dom.domNode(lastChild).lastLeafNode(options); + return wysihtml.dom.domNode(lastChild).lastLeafNode(options); }, // Splits element at childnode and extracts the childNode out of the element context // Example: - // var node = wysihtml5.dom.domNode(node).escapeParent(parentNode); + // var node = wysihtml.dom.domNode(node).escapeParent(parentNode); escapeParent: function(element, newWrapper) { var parent, split2, nodeWrap, curNode = node; // Stop if node is not a descendant of element - if (!wysihtml5.dom.contains(element, node)) { + if (!wysihtml.dom.contains(element, node)) { throw new Error("Child is not a descendant of node."); } @@ -8140,7 +8150,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { transferContentTo: function(targetNode, removeOldWrapper) { if (node.nodeType === 1) { - if (wysihtml5.dom.domNode(targetNode).is.voidElement() || targetNode.nodeType === 3) { + if (wysihtml.dom.domNode(targetNode).is.voidElement() || targetNode.nodeType === 3) { while (node.lastChild) { targetNode.parentNode.insertBefore(node.lastChild, targetNode.nextSibling); } @@ -8153,7 +8163,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { node.parentNode.removeChild(node); } } else if (node.nodeType === 3 || node.nodeType === 8){ - if (wysihtml5.dom.domNode(targetNode).is.voidElement()) { + if (wysihtml.dom.domNode(targetNode).is.voidElement()) { targetNode.parentNode.insertBefore(node, targetNode.nextSibling); } else { targetNode.appendChild(node); @@ -8178,12 +8188,12 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } Example: - var node = wysihtml5.dom.domNode(element).test({}) + var node = wysihtml.dom.domNode(element).test({}) */ test: function(properties) { var prop; - // retuern false if properties object is not defined + // return false if properties object is not defined if (!properties) { return false; } @@ -8221,7 +8231,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { styles = (Array.isArray(properties.styleProperty)) ? properties.styleProperty : [properties.styleProperty]; for (var j = 0, maxStyleP = styles.length; j < maxStyleP; j++) { // Some old IE-s have different property name for cssFloat - prop = wysihtml5.browser.fixStyleKey(styles[j]); + prop = wysihtml.browser.fixStyleKey(styles[j]); if (node.style[prop]) { if (properties.styleValue) { // Style value as additional parameter @@ -8256,7 +8266,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } if (properties.attribute) { - var attr = wysihtml5.dom.getAttributes(node), + var attr = wysihtml.dom.getAttributes(node), attrList = [], hasOneAttribute = false; @@ -8291,7 +8301,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { }; }; -})(wysihtml5); +})(wysihtml); ;/** * Returns the given html wrapped in a div element * @@ -8302,9 +8312,9 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { * @param {Obejct} [context] Document object of the context the html belongs to * * @example - * wysihtml5.dom.getAsDom("
    foo
    "); + * wysihtml.dom.getAsDom("
    foo
    "); */ -wysihtml5.dom.getAsDom = (function() { +wysihtml.dom.getAsDom = (function() { var _innerHTMLShiv = function(html, context) { var tempElement = context.createElement("div"); @@ -8346,7 +8356,7 @@ wysihtml5.dom.getAsDom = (function() { if (typeof(html) === "object" && html.nodeType) { tempElement = context.createElement("div"); tempElement.appendChild(html); - } else if (wysihtml5.browser.supportsHTML5Tags(context)) { + } else if (wysihtml.browser.supportsHTML5Tags(context)) { tempElement = context.createElement("div"); tempElement.innerHTML = html; } else { @@ -8373,12 +8383,12 @@ wysihtml5.dom.getAsDom = (function() { * @return {null|Element} Returns the first element that matched the desiredNodeName(s) */ -wysihtml5.dom.getParentElement = (function() { +wysihtml.dom.getParentElement = (function() { return function(node, properties, levels, container) { levels = levels || 50; while (levels-- && node && node.nodeName !== "BODY" && (!container || node !== container)) { - if (wysihtml5.dom.domNode(node).test(properties)) { + if (wysihtml.dom.domNode(node).test(properties)) { return node; } node = node.parentNode; @@ -8394,10 +8404,10 @@ wysihtml5.dom.getParentElement = (function() { * @param {String} property The CSS property to retrieve ("float", "display", "text-align", ...) * * @example - * wysihtml5.dom.getStyle("display").from(document.body); + * wysihtml.dom.getStyle("display").from(document.body); * // => "block" */ -wysihtml5.dom.getStyle = (function() { +wysihtml.dom.getStyle = (function() { var stylePropertyMapping = { "float": ("styleFloat" in document.createElement("div").style) ? "styleFloat" : "cssFloat" }, @@ -8412,7 +8422,7 @@ wysihtml5.dom.getStyle = (function() { return function(property) { return { from: function(element) { - if (element.nodeType !== wysihtml5.ELEMENT_NODE) { + if (element.nodeType !== wysihtml.ELEMENT_NODE) { return; } @@ -8460,7 +8470,7 @@ wysihtml5.dom.getStyle = (function() { }; }; })(); -;wysihtml5.dom.getTextNodes = function(node, ingoreEmpty){ +;wysihtml.dom.getTextNodes = function(node, ingoreEmpty){ var all = []; for (node=node.firstChild;node;node=node.nextSibling){ if (node.nodeType == 3) { @@ -8468,7 +8478,7 @@ wysihtml5.dom.getStyle = (function() { all.push(node); } } else { - all = all.concat(wysihtml5.dom.getTextNodes(node, ingoreEmpty)); + all = all.concat(wysihtml.dom.getTextNodes(node, ingoreEmpty)); } } return all; @@ -8481,9 +8491,9 @@ wysihtml5.dom.getStyle = (function() { * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @example - * wysihtml5.dom.hasElementWithTagName(document, "IMG"); + * wysihtml.dom.hasElementWithTagName(document, "IMG"); */ -wysihtml5.dom.hasElementWithTagName = (function() { +wysihtml.dom.hasElementWithTagName = (function() { var LIVE_CACHE = {}, DOCUMENT_IDENTIFIER = 1; @@ -8509,9 +8519,9 @@ wysihtml5.dom.hasElementWithTagName = (function() { * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @example - * wysihtml5.dom.hasElementWithClassName(document, "foobar"); + * wysihtml.dom.hasElementWithClassName(document, "foobar"); */ -(function(wysihtml5) { +(function(wysihtml) { var LIVE_CACHE = {}, DOCUMENT_IDENTIFIER = 1; @@ -8519,10 +8529,10 @@ wysihtml5.dom.hasElementWithTagName = (function() { return doc._wysihtml5_identifier || (doc._wysihtml5_identifier = DOCUMENT_IDENTIFIER++); } - wysihtml5.dom.hasElementWithClassName = function(doc, className) { + wysihtml.dom.hasElementWithClassName = function(doc, className) { // getElementsByClassName is not supported by IE<9 // but is sometimes mocked via library code (which then doesn't return live node lists) - if (!wysihtml5.browser.supportsNativeGetElementsByClassName()) { + if (!wysihtml.browser.supportsNativeGetElementsByClassName()) { return !!doc.querySelector("." + className); } @@ -8534,8 +8544,8 @@ wysihtml5.dom.hasElementWithTagName = (function() { return cacheEntry.length > 0; }; -})(wysihtml5); -;wysihtml5.dom.insert = function(elementToInsert) { +})(wysihtml); +;wysihtml.dom.insert = function(elementToInsert) { return { after: function(element) { element.parentNode.insertBefore(elementToInsert, element.nextSibling); @@ -8550,7 +8560,7 @@ wysihtml5.dom.hasElementWithTagName = (function() { } }; }; -;wysihtml5.dom.insertCSS = function(rules) { +;wysihtml.dom.insertCSS = function(rules) { rules = rules.join("\n"); return { @@ -8578,8 +8588,8 @@ wysihtml5.dom.hasElementWithTagName = (function() { }; }; ;// TODO: Refactor dom tree traversing here -(function(wysihtml5) { - wysihtml5.dom.lineBreaks = function(node) { +(function(wysihtml) { + wysihtml.dom.lineBreaks = function(node) { function _isLineBreak(n) { return n.nodeName === "BR"; @@ -8594,7 +8604,7 @@ wysihtml5.dom.hasElementWithTagName = (function() { return true; } - if (wysihtml5.dom.getStyle("display").from(element) === "block") { + if (wysihtml.dom.getStyle("display").from(element) === "block") { return true; } @@ -8603,31 +8613,31 @@ wysihtml5.dom.hasElementWithTagName = (function() { return { - /* wysihtml5.dom.lineBreaks(element).add(); + /* wysihtml.dom.lineBreaks(element).add(); * * Adds line breaks before and after the given node if the previous and next siblings * aren't already causing a visual line break (block element or
    ) */ add: function(options) { var doc = node.ownerDocument, - nextSibling = wysihtml5.dom.domNode(node).next({ignoreBlankTexts: true}), - previousSibling = wysihtml5.dom.domNode(node).prev({ignoreBlankTexts: true}); + nextSibling = wysihtml.dom.domNode(node).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(node).prev({ignoreBlankTexts: true}); if (nextSibling && !_isLineBreakOrBlockElement(nextSibling)) { - wysihtml5.dom.insert(doc.createElement("br")).after(node); + wysihtml.dom.insert(doc.createElement("br")).after(node); } if (previousSibling && !_isLineBreakOrBlockElement(previousSibling)) { - wysihtml5.dom.insert(doc.createElement("br")).before(node); + wysihtml.dom.insert(doc.createElement("br")).before(node); } }, - /* wysihtml5.dom.lineBreaks(element).remove(); + /* wysihtml.dom.lineBreaks(element).remove(); * * Removes line breaks before and after the given node */ remove: function(options) { - var nextSibling = wysihtml5.dom.domNode(node).next({ignoreBlankTexts: true}), - previousSibling = wysihtml5.dom.domNode(node).prev({ignoreBlankTexts: true}); + var nextSibling = wysihtml.dom.domNode(node).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(node).prev({ignoreBlankTexts: true}); if (nextSibling && _isLineBreak(nextSibling)) { nextSibling.parentNode.removeChild(nextSibling); @@ -8638,13 +8648,13 @@ wysihtml5.dom.hasElementWithTagName = (function() { } }; }; -})(wysihtml5);;/** +})(wysihtml);;/** * Method to set dom events * * @example - * wysihtml5.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); + * wysihtml.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); */ -wysihtml5.dom.observe = function(element, eventNames, handler) { +wysihtml.dom.observe = function(element, eventNames, handler) { eventNames = typeof(eventNames) === "string" ? [eventNames] : eventNames; var handlerWrapper, @@ -8703,7 +8713,7 @@ wysihtml5.dom.observe = function(element, eventNames, handler) { * * @example * var userHTML = '

    foo

    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * tags { * p: "div", // Rename p tags to div tags * font: "span" // Rename font tags to span tags @@ -8714,11 +8724,11 @@ wysihtml5.dom.observe = function(element, eventNames, handler) { * // =>
    foo bar
    * * var userHTML = '
    I'm a table!
    '; - * wysihtml5.dom.parse(userHTML); + * wysihtml.dom.parse(userHTML); * // => 'I'm a table!' * * var userHTML = '
    foobar
    foobar
    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * tags: { * div: undefined, * br: true @@ -8727,7 +8737,7 @@ wysihtml5.dom.observe = function(element, eventNames, handler) { * // => '' * * var userHTML = '
    foo
    bar
    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * classes: { * red: 1, * green: 1 @@ -8741,7 +8751,7 @@ wysihtml5.dom.observe = function(element, eventNames, handler) { * // => '

    foo

    bar

    ' */ -wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { +wysihtml.dom.parse = function(elementOrHtml_current, config_current) { /* TODO: Currently escaped module pattern as otherwise folloowing default swill be shared among multiple editors. * Refactor whole code as this method while workind is kind of awkward too */ @@ -8771,7 +8781,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { * which later replaces the entire body content */ function parse(elementOrHtml, config) { - wysihtml5.lang.object(currentRules).merge(defaultRules).merge(config.rules).get(); + wysihtml.lang.object(currentRules).merge(defaultRules).merge(config.rules).get(); var context = config.context || elementOrHtml.ownerDocument || document, fragment = context.createDocumentFragment(), @@ -8786,7 +8796,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (isString) { - element = wysihtml5.dom.getAsDom(elementOrHtml, context); + element = wysihtml.dom.getAsDom(elementOrHtml, context); } else { element = elementOrHtml; } @@ -8808,7 +8818,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (config.unjoinNbsps) { // replace joined non-breakable spaces with unjoined - var txtnodes = wysihtml5.dom.getTextNodes(fragment); + var txtnodes = wysihtml.dom.getTextNodes(fragment); for (var n = txtnodes.length; n--;) { txtnodes[n].nodeValue = txtnodes[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi, "$1 "); } @@ -8820,7 +8830,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { // Insert new DOM tree element.appendChild(fragment); - return isString ? wysihtml5.quirks.getCorrectInnerHTML(element) : element; + return isString ? wysihtml.quirks.getCorrectInnerHTML(element) : element; } function _convert(oldNode, cleanUp, clearInternals, uneditableClass) { @@ -8835,7 +8845,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { nodeDisplay; // Passes directly elemets with uneditable class - if (uneditableClass && oldNodeType === 1 && wysihtml5.dom.hasClass(oldNode, uneditableClass)) { + if (uneditableClass && oldNodeType === 1 && wysihtml.dom.hasClass(oldNode, uneditableClass)) { return oldNode; } @@ -8859,18 +8869,18 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } } - nodeDisplay = wysihtml5.dom.getStyle("display").from(oldNode); + nodeDisplay = wysihtml.dom.getStyle("display").from(oldNode); if (nodeDisplay === '') { // Handle display style when element not in dom - nodeDisplay = wysihtml5.lang.array(blockElements).contains(oldNode.tagName) ? "block" : ""; + nodeDisplay = wysihtml.lang.array(blockElements).contains(oldNode.tagName) ? "block" : ""; } - if (wysihtml5.lang.array(["block", "flex", "table"]).contains(nodeDisplay)) { + if (wysihtml.lang.array(["block", "flex", "table"]).contains(nodeDisplay)) { fragment.appendChild(oldNode.ownerDocument.createElement("br")); } // TODO: try to minimize surplus spaces - if (wysihtml5.lang.array([ + if (wysihtml.lang.array([ "div", "pre", "p", "table", "td", "th", "ul", "ol", "li", @@ -8935,7 +8945,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { for (sel in selectorRules) { if (selectorRules.hasOwnProperty(sel)) { - if (wysihtml5.lang.object(selectorRules[sel]).isFunction()) { + if (wysihtml.lang.object(selectorRules[sel]).isFunction()) { method = selectorRules[sel]; } else if (typeof(selectorRules[sel]) === "string" && elementHandlingMethods[selectorRules[sel]]) { method = elementHandlingMethods[selectorRules[sel]]; @@ -8984,7 +8994,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { * A

    doesn't need to be closed according HTML4-5 spec, we simply replace it with a

    to preserve its content and layout */ if ("outerHTML" in oldNode) { - if (!wysihtml5.browser.autoClosesUnclosedTags() && + if (!wysihtml.browser.autoClosesUnclosedTags() && oldNode.nodeName === "P" && oldNode.outerHTML.slice(-4).toLowerCase() !== "

    ") { nodeName = "div"; @@ -9099,7 +9109,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { styleProp = nodeStyles[sp].split(':'); if (styleProp[0].replace(/\s/g, '').toLowerCase() === s) { - if (definition.styles[s] === true || definition.styles[s] === 1 || wysihtml5.lang.array(definition.styles[s]).contains(styleProp[1].replace(/\s/g, '').toLowerCase()) ) { + if (definition.styles[s] === true || definition.styles[s] === 1 || wysihtml.lang.array(definition.styles[s]).contains(styleProp[1].replace(/\s/g, '').toLowerCase()) ) { return true; } } @@ -9112,7 +9122,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (definition.attrs) { for (a in definition.attrs) { if (definition.attrs.hasOwnProperty(a)) { - attr = wysihtml5.dom.getAttribute(oldNode, a); + attr = wysihtml.dom.getAttribute(oldNode, a); if (typeof(attr) === "string") { if (attr.search(definition.attrs[a]) > -1) { return true; @@ -9156,7 +9166,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } function _checkAttribute(attributeName, attributeValue, methodName, nodeName) { - var method = wysihtml5.lang.object(methodName).isFunction() ? methodName : attributeCheckMethods[methodName], + var method = wysihtml.lang.object(methodName).isFunction() ? methodName : attributeCheckMethods[methodName], newAttributeValue; if (method) { @@ -9170,10 +9180,10 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } function _checkAttributes(oldNode, local_attributes) { - var globalAttributes = wysihtml5.lang.object(currentRules.attributes || {}).clone(), // global values for check/convert values of attributes - checkAttributes = wysihtml5.lang.object(globalAttributes).merge( wysihtml5.lang.object(local_attributes || {}).clone()).get(), + var globalAttributes = wysihtml.lang.object(currentRules.attributes || {}).clone(), // global values for check/convert values of attributes + checkAttributes = wysihtml.lang.object(globalAttributes).merge( wysihtml.lang.object(local_attributes || {}).clone()).get(), attributes = {}, - oldAttributes = wysihtml5.dom.getAttributes(oldNode), + oldAttributes = wysihtml.dom.getAttributes(oldNode), attributeName, newValue, matchingAttributes; for (attributeName in checkAttributes) { @@ -9219,11 +9229,11 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { method; if (setAttributes) { - attributes = wysihtml5.lang.object(setAttributes).clone(); + attributes = wysihtml.lang.object(setAttributes).clone(); } // check/convert values of attributes - attributes = wysihtml5.lang.object(attributes).merge(_checkAttributes(oldNode, rule.check_attributes)).get(); + attributes = wysihtml.lang.object(attributes).merge(_checkAttributes(oldNode, rule.check_attributes)).get(); if (setClass) { classes.push(setClass); @@ -9235,7 +9245,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (!method) { continue; } - newClass = method(wysihtml5.dom.getAttribute(oldNode, attributeName)); + newClass = method(wysihtml.dom.getAttribute(oldNode, attributeName)); if (typeof(newClass) === "string") { classes.push(newClass); } @@ -9249,7 +9259,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { continue; } - newStyle = method(wysihtml5.dom.getAttribute(oldNode, attributeName)); + newStyle = method(wysihtml.dom.getAttribute(oldNode, attributeName)); if (typeof(newStyle) === "string") { styles.push(newStyle); } @@ -9274,7 +9284,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (newClasses.length) { - attributes["class"] = wysihtml5.lang.array(newClasses).unique().join(" "); + attributes["class"] = wysihtml.lang.array(newClasses).unique().join(" "); } } else { @@ -9282,7 +9292,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } } else { if(classes && classes.length > 0) { - attributes["class"] = wysihtml5.lang.array(classes).unique().join(" "); + attributes["class"] = wysihtml.lang.array(classes).unique().join(" "); } } } else { @@ -9307,7 +9317,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (newClasses.length) { - attributes["class"] = wysihtml5.lang.array(newClasses).unique().join(" "); + attributes["class"] = wysihtml.lang.array(newClasses).unique().join(" "); } } @@ -9320,7 +9330,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (styles.length) { - attributes["style"] = wysihtml5.lang.array(styles).unique().join(" "); + attributes["style"] = wysihtml.lang.array(styles).unique().join(" "); } // set attributes on newNode @@ -9347,12 +9357,12 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { function _handleText(oldNode) { var nextSibling = oldNode.nextSibling; - if (nextSibling && nextSibling.nodeType === wysihtml5.TEXT_NODE) { + if (nextSibling && nextSibling.nodeType === wysihtml.TEXT_NODE) { // Concatenate text nodes - nextSibling.data = oldNode.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, "") + nextSibling.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + nextSibling.data = oldNode.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, "") + nextSibling.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); } else { - // \uFEFF = wysihtml5.INVISIBLE_SPACE (used as a hack in certain rich text editing situations) - var data = oldNode.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + // \uFEFF = wysihtml.INVISIBLE_SPACE (used as a hack in certain rich text editing situations) + var data = oldNode.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); return oldNode.ownerDocument.createTextNode(data); } } @@ -9547,7 +9557,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { var elementHandlingMethods = { unwrap: function (element) { - wysihtml5.dom.unwrap(element); + wysihtml.dom.unwrap(element); }, remove: function (element) { @@ -9562,17 +9572,17 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { * * @param {Element} node The element in which to cleanup * @example - * wysihtml5.dom.removeEmptyTextNodes(element); + * wysihtml.dom.removeEmptyTextNodes(element); */ -wysihtml5.dom.removeEmptyTextNodes = function(node) { +wysihtml.dom.removeEmptyTextNodes = function(node) { var childNode, - childNodes = wysihtml5.lang.array(node.childNodes).get(), + childNodes = wysihtml.lang.array(node.childNodes).get(), childNodesLength = childNodes.length, i = 0; for (; i * * * * @@ -9602,13 +9612,13 @@ wysihtml5.dom.removeEmptyTextNodes = function(node) { *
  • 50 Cent
  • * */ -wysihtml5.dom.renameElement = function(element, newNodeName) { +wysihtml.dom.renameElement = function(element, newNodeName) { var newElement = element.ownerDocument.createElement(newNodeName), firstChild; while (firstChild = element.firstChild) { newElement.appendChild(firstChild); } - wysihtml5.dom.copyAttributes(["align", "className"]).from(element).to(newElement); + wysihtml.dom.copyAttributes(["align", "className"]).from(element).to(newElement); if (element.parentNode) { element.parentNode.replaceChild(newElement, element); @@ -9626,10 +9636,10 @@ wysihtml5.dom.renameElement = function(element, newNodeName) { *
    * */ -wysihtml5.dom.replaceWithChildNodes = function(node) { +wysihtml.dom.replaceWithChildNodes = function(node) { if (!node.parentNode) { return; } @@ -9653,7 +9663,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { * * * * * @@ -9682,8 +9692,8 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { var doc = list.ownerDocument, fragment = doc.createDocumentFragment(), - previousSibling = wysihtml5.dom.domNode(list).prev({ignoreBlankTexts: true}), - nextSibling = wysihtml5.dom.domNode(list).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(list).prev({ignoreBlankTexts: true}), + nextSibling = wysihtml.dom.domNode(list).next({ignoreBlankTexts: true}), firstChild, lastChild, isLastChild, @@ -9735,7 +9745,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { } dom.resolveList = resolveList; -})(wysihtml5.dom); +})(wysihtml.dom); ;/** * Sandbox for executing javascript, parsing css styles and doing dom operations in a secure way * @@ -9754,11 +9764,11 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { * @param {Object} [config] Optional parameters * * @example - * new wysihtml5.dom.Sandbox(function(sandbox) { + * new wysihtml.dom.Sandbox(function(sandbox) { * sandbox.getWindow().document.body.innerHTML = ''; * }); */ -(function(wysihtml5) { +(function(wysihtml) { var /** * Default configuration */ @@ -9787,12 +9797,12 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { "write", "open", "close" ]; - wysihtml5.dom.Sandbox = Base.extend( - /** @scope wysihtml5.dom.Sandbox.prototype */ { + wysihtml.dom.Sandbox = Base.extend( + /** @scope wysihtml.dom.Sandbox.prototype */ { constructor: function(readyCallback, config) { - this.callback = readyCallback || wysihtml5.EMPTY_FUNCTION; - this.config = wysihtml5.lang.object({}).merge(config).get(); + this.callback = readyCallback || wysihtml.EMPTY_FUNCTION; + this.config = wysihtml.lang.object({}).merge(config).get(); if (!this.config.className) { this.config.className = "wysihtml5-sandbox"; } @@ -9825,7 +9835,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { }, _readyError: function() { - throw new Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet"); + throw new Error("wysihtml.Sandbox: Sandbox iframe isn't loaded yet"); }, /** @@ -9851,7 +9861,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { var that = this, iframe = doc.createElement("iframe"); iframe.className = this.config.className; - wysihtml5.dom.setAttributes({ + wysihtml.dom.setAttributes({ "security": "restricted", "allowtransparency": "true", "frameborder": 0, @@ -9862,7 +9872,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { }).on(iframe); // Setting the src like this prevents ssl warnings in IE6 - if (wysihtml5.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()) { + if (wysihtml.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()) { iframe.src = "javascript:''"; } @@ -9886,7 +9896,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { */ _onLoadIframe: function(iframe) { // don't resume when the iframe got unloaded (eg. by removing it from the dom) - if (!wysihtml5.dom.contains(doc.documentElement, iframe)) { + if (!wysihtml.dom.contains(doc.documentElement, iframe)) { return; } @@ -9911,10 +9921,10 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { // addEventListener("error") doesn't work properly in some browsers // TODO: apparently this doesn't work in IE9! iframeWindow.onerror = function(errorMessage, fileName, lineNumber) { - throw new Error("wysihtml5.Sandbox: " + errorMessage, fileName, lineNumber); + throw new Error("wysihtml.Sandbox: " + errorMessage, fileName, lineNumber); }; - if (!wysihtml5.browser.supportsSandboxedIframes()) { + if (!wysihtml.browser.supportsSandboxedIframes()) { // Unset a bunch of sensitive variables // Please note: This isn't hack safe! // It more or less just takes care of basic attacks and prevents accidental theft of sensitive information @@ -9926,7 +9936,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { this._unset(iframeWindow, windowProperties[i]); } for (i=0, length=windowProperties2.length; i' + '#{stylesheets}' + '' @@ -9981,7 +9991,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { try { object.__defineSetter__(property, function() {}); } catch(e) {} } - if (!wysihtml5.browser.crashesWhenDefineProperty(property)) { + if (!wysihtml.browser.crashesWhenDefineProperty(property)) { try { var config = { get: function() { return value; } @@ -9994,10 +10004,10 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { } } }); -})(wysihtml5); -;(function(wysihtml5) { +})(wysihtml); +;(function(wysihtml) { var doc = document; - wysihtml5.dom.ContentEditableArea = Base.extend({ + wysihtml.dom.ContentEditableArea = Base.extend({ getContentEditable: function() { return this.element; }, @@ -10011,8 +10021,8 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { }, constructor: function(readyCallback, config, contentEditable) { - this.callback = readyCallback || wysihtml5.EMPTY_FUNCTION; - this.config = wysihtml5.lang.object({}).merge(config).get(); + this.callback = readyCallback || wysihtml.EMPTY_FUNCTION; + this.config = wysihtml.lang.object({}).merge(config).get(); if (!this.config.className) { this.config.className = "wysihtml5-sandbox"; } @@ -10060,12 +10070,12 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { } }); -})(wysihtml5); +})(wysihtml); ;(function() { var mapping = { "className": "class" }; - wysihtml5.dom.setAttributes = function(attributes) { + wysihtml.dom.setAttributes = function(attributes) { return { on: function(element) { for (var i in attributes) { @@ -10075,7 +10085,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { }; }; })(); -;wysihtml5.dom.setStyles = function(styles) { +;wysihtml.dom.setStyles = function(styles) { return { on: function(element) { var style = element.style; @@ -10101,8 +10111,8 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { * - div[contentEditable] elements don't support it * - older browsers (such as IE8 and Firefox 3.6) don't support it at all * - * @param {Object} parent Instance of main wysihtml5.Editor class - * @param {Element} view Instance of wysihtml5.views.* class + * @param {Object} parent Instance of main wysihtml.Editor class + * @param {Element} view Instance of wysihtml.views.* class * @param {String} placeholderText * * @example @@ -10145,7 +10155,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { set(); }; -})(wysihtml5.dom); +})(wysihtml.dom); ;(function(dom) { var documentElement = document.documentElement; if ("textContent" in documentElement) { @@ -10173,7 +10183,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { return element.nodeValue; }; } -})(wysihtml5.dom); +})(wysihtml.dom); ;/** * Get a set of attribute from one element * @@ -10184,11 +10194,11 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { * Therefore we have to check the element's outerHTML for the attribute */ -wysihtml5.dom.getAttribute = function(node, attributeName) { - var HAS_GET_ATTRIBUTE_BUG = !wysihtml5.browser.supportsGetAttributeCorrectly(); +wysihtml.dom.getAttribute = function(node, attributeName) { + var HAS_GET_ATTRIBUTE_BUG = !wysihtml.browser.supportsGetAttributeCorrectly(); attributeName = attributeName.toLowerCase(); var nodeName = node.nodeName; - if (nodeName == "IMG" && attributeName == "src" && wysihtml5.dom.isLoadedImage(node) === true) { + if (nodeName == "IMG" && attributeName == "src" && wysihtml.dom.isLoadedImage(node) === true) { // Get 'src' attribute value via object property since this will always contain the // full absolute url (http://...) // this fixes a very annoying bug in firefox (ver 3.6 & 4) and IE 8 where images copied from the same host @@ -10215,8 +10225,8 @@ wysihtml5.dom.getAttribute = function(node, attributeName) { * Therefore we have to check the element's outerHTML for the attribute */ -wysihtml5.dom.getAttributes = function(node) { - var HAS_GET_ATTRIBUTE_BUG = !wysihtml5.browser.supportsGetAttributeCorrectly(), +wysihtml.dom.getAttributes = function(node) { + var HAS_GET_ATTRIBUTE_BUG = !wysihtml.browser.supportsGetAttributeCorrectly(), nodeName = node.nodeName, attributes = [], attr; @@ -10224,9 +10234,9 @@ wysihtml5.dom.getAttributes = function(node) { for (attr in node.attributes) { if ((node.attributes.hasOwnProperty && node.attributes.hasOwnProperty(attr)) || (!node.attributes.hasOwnProperty && Object.prototype.hasOwnProperty.call(node.attributes, attr))) { if (node.attributes[attr].specified) { - if (nodeName == "IMG" && node.attributes[attr].name.toLowerCase() == "src" && wysihtml5.dom.isLoadedImage(node) === true) { + if (nodeName == "IMG" && node.attributes[attr].name.toLowerCase() == "src" && wysihtml.dom.isLoadedImage(node) === true) { attributes['src'] = node.src; - } else if (wysihtml5.lang.array(['rowspan', 'colspan']).contains(node.attributes[attr].name.toLowerCase()) && HAS_GET_ATTRIBUTE_BUG) { + } else if (wysihtml.lang.array(['rowspan', 'colspan']).contains(node.attributes[attr].name.toLowerCase()) && HAS_GET_ATTRIBUTE_BUG) { if (node.attributes[attr].value !== 1) { attributes[node.attributes[attr].name] = node.attributes[attr].value; } @@ -10243,7 +10253,7 @@ wysihtml5.dom.getAttributes = function(node) { * FIXME: Returns undefined when unknown (Chrome, Safari) */ -wysihtml5.dom.isLoadedImage = function (node) { +wysihtml.dom.isLoadedImage = function (node) { try { return node.complete && !node.mozMatchesSelector(":-moz-broken"); } catch(e) { @@ -10252,9 +10262,9 @@ wysihtml5.dom.isLoadedImage = function (node) { } } }; -;(function(wysihtml5) { +;(function(wysihtml) { - var api = wysihtml5.dom; + var api = wysihtml.dom; var MapCell = function(cell) { this.el = cell; @@ -10383,7 +10393,7 @@ wysihtml5.dom.isLoadedImage = function (node) { var inlineTables = this.table.querySelectorAll('table'), inlineCells = (inlineTables) ? queryInList(inlineTables, 'th, td') : [], allCells = row.querySelectorAll('th, td'), - tableCells = (inlineCells.length > 0) ? wysihtml5.lang.array(allCells).without(inlineCells) : allCells; + tableCells = (inlineCells.length > 0) ? wysihtml.lang.array(allCells).without(inlineCells) : allCells; return tableCells; }, @@ -10392,7 +10402,7 @@ wysihtml5.dom.isLoadedImage = function (node) { var inlineTables = this.table.querySelectorAll('table'), inlineRows = (inlineTables) ? queryInList(inlineTables, 'tr') : [], allRows = this.table.querySelectorAll('tr'), - tableRows = (inlineRows.length > 0) ? wysihtml5.lang.array(allRows).without(inlineRows) : allRows; + tableRows = (inlineRows.length > 0) ? wysihtml.lang.array(allRows).without(inlineRows) : allRows; return tableRows; }, @@ -10981,7 +10991,7 @@ wysihtml5.dom.isLoadedImage = function (node) { doAdd = (!cell.isColspan || cell.firstCol); break; case "after": - doAdd = (!cell.isColspan || cell.lastCol || (cell.isColspan && c.el == this.cell)); + doAdd = (!cell.isColspan || cell.lastCol || (cell.isColspan && cell.el == this.cell)); break; } @@ -11127,9 +11137,9 @@ wysihtml5.dom.isLoadedImage = function (node) { } }; -})(wysihtml5); +})(wysihtml); ;// does a selector query on element or array of elements -wysihtml5.dom.query = function(elements, query) { +wysihtml.dom.query = function(elements, query) { var ret = [], q; @@ -11145,7 +11155,7 @@ wysihtml5.dom.query = function(elements, query) { } return ret; }; -;wysihtml5.dom.compareDocumentPosition = (function() { +;wysihtml.dom.compareDocumentPosition = (function() { var documentElement = document.documentElement; if (documentElement.compareDocumentPosition) { return function(container, element) { @@ -11172,10 +11182,10 @@ wysihtml5.dom.query = function(elements, query) { if( thisOwner !== otherOwner ) return 1; // Node.DOCUMENT_POSITION_DISCONNECTED; // Text nodes for attributes does not have a _parentNode. So we need to find them as attribute child. - if( container.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && container.childNodes && wysihtml5.lang.array(container.childNodes).indexOf( element ) !== -1) + if( container.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && container.childNodes && wysihtml.lang.array(container.childNodes).indexOf( element ) !== -1) return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - if( element.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && element.childNodes && wysihtml5.lang.array(element.childNodes).indexOf( container ) !== -1) + if( element.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && element.childNodes && wysihtml.lang.array(element.childNodes).indexOf( container ) !== -1) return 2 + 8; //Node.DOCUMENT_POSITION_PRECEDING + Node.DOCUMENT_POSITION_CONTAINS; var point = container; @@ -11190,11 +11200,11 @@ wysihtml5.dom.query = function(elements, query) { previous = null; while( point ) { if( point == container ) return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - var location_index = wysihtml5.lang.array(parents).indexOf( point ); + var location_index = wysihtml.lang.array(parents).indexOf( point ); if( location_index !== -1) { var smallest_common_ancestor = parents[ location_index ]; - var this_index = wysihtml5.lang.array(smallest_common_ancestor.childNodes).indexOf( parents[location_index - 1]);//smallest_common_ancestor.childNodes.toArray().indexOf( parents[location_index - 1] ); - var other_index = wysihtml5.lang.array(smallest_common_ancestor.childNodes).indexOf( previous ); //smallest_common_ancestor.childNodes.toArray().indexOf( previous ); + var this_index = wysihtml.lang.array(smallest_common_ancestor.childNodes).indexOf( parents[location_index - 1]);//smallest_common_ancestor.childNodes.toArray().indexOf( parents[location_index - 1] ); + var other_index = wysihtml.lang.array(smallest_common_ancestor.childNodes).indexOf( previous ); //smallest_common_ancestor.childNodes.toArray().indexOf( previous ); if( this_index > other_index ) { return 2; //Node.DOCUMENT_POSITION_PRECEDING; } @@ -11212,15 +11222,15 @@ wysihtml5.dom.query = function(elements, query) { ;/* Unwraps element and returns list of childNodes that the node contained. * * Example: - * var childnodes = wysihtml5.dom.unwrap(document.querySelector('.unwrap-me')); + * var childnodes = wysihtml.dom.unwrap(document.querySelector('.unwrap-me')); */ -wysihtml5.dom.unwrap = function(node) { +wysihtml.dom.unwrap = function(node) { var children = []; if (node.parentNode) { while (node.lastChild) { children.unshift(node.lastChild); - wysihtml5.dom.insert(node.lastChild).after(node); + wysihtml.dom.insert(node.lastChild).after(node); } node.parentNode.removeChild(node); } @@ -11234,20 +11244,20 @@ wysihtml5.dom.unwrap = function(node) { * Advantage is that it does not have to loose selection or modify dom to catch the data. * IE does not support though. **/ -wysihtml5.dom.getPastedHtml = function(event) { +wysihtml.dom.getPastedHtml = function(event) { var html; - if (wysihtml5.browser.supportsModernPaste() && event.clipboardData) { - if (wysihtml5.lang.array(event.clipboardData.types).contains('text/html')) { + if (wysihtml.browser.supportsModernPaste() && event.clipboardData) { + if (wysihtml.lang.array(event.clipboardData.types).contains('text/html')) { html = event.clipboardData.getData('text/html'); - } else if (wysihtml5.lang.array(event.clipboardData.types).contains('text/plain')) { - html = wysihtml5.lang.string(event.clipboardData.getData('text/plain')).escapeHTML(true, true); + } else if (wysihtml.lang.array(event.clipboardData.types).contains('text/plain')) { + html = wysihtml.lang.string(event.clipboardData.getData('text/plain')).escapeHTML(true, true); } } return html; }; /* Older temprorary contenteditable as paste source catcher method for fallbacks */ -wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) { +wysihtml.dom.getPastedHtmlWithDiv = function (composer, f) { var selBookmark = composer.selection.getBookmark(), doc = composer.element.ownerDocument, cleanerDiv = doc.createElement('DIV'), @@ -11277,10 +11287,10 @@ wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) { cleanerDiv.parentNode.removeChild(cleanerDiv); }, 0); }; -;wysihtml5.dom.removeInvisibleSpaces = function(node) { - var textNodes = wysihtml5.dom.getTextNodes(node); +;wysihtml.dom.removeInvisibleSpaces = function(node) { + var textNodes = wysihtml.dom.getTextNodes(node); for (var n = textNodes.length; n--;) { - textNodes[n].nodeValue = textNodes[n].nodeValue.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + textNodes[n].nodeValue = textNodes[n].nodeValue.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); } }; ;/** @@ -11289,17 +11299,17 @@ wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) { * * @author Christopher Blum */ -wysihtml5.quirks.cleanPastedHTML = (function() { +wysihtml.quirks.cleanPastedHTML = (function() { var styleToRegex = function (styleStr) { - var trimmedStr = wysihtml5.lang.string(styleStr).trim(), + var trimmedStr = wysihtml.lang.string(styleStr).trim(), escapedStr = trimmedStr.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); return new RegExp("^((?!^" + escapedStr + "$).)*$", "i"); }; var extendRulesWithStyleExceptions = function (rules, exceptStyles) { - var newRules = wysihtml5.lang.object(rules).clone(true), + var newRules = wysihtml.lang.object(rules).clone(true), tag, style; for (tag in newRules.tags) { @@ -11341,13 +11351,13 @@ wysihtml5.quirks.cleanPastedHTML = (function() { return function(html, options) { var exceptStyles = { - 'color': wysihtml5.dom.getStyle("color").from(options.referenceNode), - 'fontSize': wysihtml5.dom.getStyle("font-size").from(options.referenceNode) + 'color': wysihtml.dom.getStyle("color").from(options.referenceNode), + 'fontSize': wysihtml.dom.getStyle("font-size").from(options.referenceNode) }, rules = extendRulesWithStyleExceptions(pickRuleset(options.rules, html) || {}, exceptStyles), newHtml; - newHtml = wysihtml5.dom.parse(html, { + newHtml = wysihtml.dom.parse(html, { "rules": rules, "cleanUp": true, // elements, empty or without attributes, should be removed/replaced with their content "context": options.referenceNode.ownerDocument, @@ -11365,9 +11375,9 @@ wysihtml5.quirks.cleanPastedHTML = (function() { * * @param {Object} contentEditableElement The contentEditable element to observe for clearing events * @exaple - * wysihtml5.quirks.ensureProperClearing(myContentEditableElement); + * wysihtml.quirks.ensureProperClearing(myContentEditableElement); */ -wysihtml5.quirks.ensureProperClearing = (function() { +wysihtml.quirks.ensureProperClearing = (function() { var clearIfNecessary = function() { var element = this; setTimeout(function() { @@ -11380,7 +11390,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { }; return function(composer) { - wysihtml5.dom.observe(composer.element, ["cut", "keydown"], clearIfNecessary); + wysihtml.dom.observe(composer.element, ["cut", "keydown"], clearIfNecessary); }; })(); ;// See https://bugzilla.mozilla.org/show_bug.cgi?id=664398 @@ -11392,9 +11402,9 @@ wysihtml5.quirks.ensureProperClearing = (function() { // will result in: //
    // which is wrong -(function(wysihtml5) { +(function(wysihtml) { var TILDE_ESCAPED = "%7E"; - wysihtml5.quirks.getCorrectInnerHTML = function(element) { + wysihtml.quirks.getCorrectInnerHTML = function(element) { var innerHTML = element.innerHTML; if (innerHTML.indexOf(TILDE_ESCAPED) === -1) { return innerHTML; @@ -11407,26 +11417,26 @@ wysihtml5.quirks.ensureProperClearing = (function() { i; for (i=0, length=elementsWithTilde.length; i' + wysihtml5.INVISIBLE_SPACE + '', + placeholderHtml = '' + wysihtml.INVISIBLE_SPACE + '', range = this.getRange(true), caretPlaceholder, newCaretPlaceholder, @@ -12459,7 +12469,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { newRange.setStartBefore(nextSibling); newRange.setEndAfter(prevSibling); } else { - newCaretPlaceholder = this.doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + newCaretPlaceholder = this.doc.createTextNode(wysihtml.INVISIBLE_SPACE); dom.insert(newCaretPlaceholder).after(caretPlaceholder[0]); newRange.setStartBefore(newCaretPlaceholder); newRange.setEndAfter(newCaretPlaceholder); @@ -12573,7 +12583,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { // Empty elements are cleaned up from extracted content for (var i = childNodes.length; i --;) { - if (!wysihtml5.dom.domNode(childNodes[i]).is.visible()) { + if (!wysihtml.dom.domNode(childNodes[i]).is.visible()) { contentAfterRangeStart.removeChild(childNodes[i]); } } @@ -12597,8 +12607,8 @@ wysihtml5.quirks.ensureProperClearing = (function() { range.setEndAfter(element); } - if (!wysihtml5.dom.domNode(element).is.visible()) { - if (wysihtml5.dom.getTextContent(element) === '') { + if (!wysihtml.dom.domNode(element).is.visible()) { + if (wysihtml.dom.getTextContent(element) === '') { element.parentNode.removeChild(element); } else { element.parentNode.replaceChild(this.doc.createTextNode(" "), element); @@ -12657,7 +12667,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { tempElement = doc._wysihtml5ScrollIntoViewElement = doc._wysihtml5ScrollIntoViewElement || (function() { var element = doc.createElement("span"); // The element needs content in order to be able to calculate it's position properly - element.innerHTML = wysihtml5.INVISIBLE_SPACE; + element.innerHTML = wysihtml.INVISIBLE_SPACE; return element; })(), offsetTop; @@ -12677,7 +12687,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { */ selectLine: function() { var r = rangy.createRange(); - if (wysihtml5.browser.supportsSelectionModify()) { + if (wysihtml.browser.supportsSelectionModify()) { this._selectLine_W3C(); } else if (r.nativeRange && r.nativeRange.getBoundingClientRect) { // For IE Edge as it ditched the old api and did not fully implement the new one (as expected) @@ -12735,7 +12745,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { // collapses selection to current line beginning or end toLineBoundary: function (location, collapse) { collapse = (typeof collapse === 'undefined') ? false : collapse; - if (wysihtml5.browser.supportsSelectionModify()) { + if (wysihtml.browser.supportsSelectionModify()) { var selection = this.win.getSelection(); selection.modify("extend", location, "lineboundary"); @@ -12783,7 +12793,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { amount, testRect, found, that = this, isLineBreakingElement = function(el) { - return el && el.nodeType === 1 && (that.win.getComputedStyle(el).display === "block" || wysihtml5.lang.array(['BR', 'HR']).contains(el.nodeName)); + return el && el.nodeType === 1 && (that.win.getComputedStyle(el).display === "block" || wysihtml.lang.array(['BR', 'HR']).contains(el.nodeName)); }, prevNode = function(node) { var pnode = node; @@ -12819,7 +12829,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { } } if (!r.collapsed) { - r.insertNode(this.doc.createTextNode(wysihtml5.INVISIBLE_SPACE)); + r.insertNode(this.doc.createTextNode(wysihtml.INVISIBLE_SPACE)); } // Is probably just empty line as can not be expanded @@ -12948,7 +12958,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { var allUneditables = dom.query(this.contain, '.' + this.unselectableClass), deepUneditables = dom.query(allUneditables, '.' + this.unselectableClass); - return wysihtml5.lang.array(allUneditables).without(deepUneditables); + return wysihtml.lang.array(allUneditables).without(deepUneditables); }, // Returns an array of ranges that belong only to this editable @@ -13030,7 +13040,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { return !s || (s.nativeSelection && s.nativeSelection.type && (s.nativeSelection.type === "Caret" || s.nativeSelection.type === "None")); } - wysihtml5.dom.removeInvisibleSpaces(this.composer.element); + wysihtml.dom.removeInvisibleSpaces(this.composer.element); doSelect(); if (this.composer.element.firstChild && notSelected()) { @@ -13078,39 +13088,39 @@ wysihtml5.quirks.ensureProperClearing = (function() { endNode = range.endContainer; - if (parentElement.nodeType === wysihtml5.TEXT_NODE) { + if (parentElement.nodeType === wysihtml.TEXT_NODE) { parentElement = parentElement.parentNode; } - if (startNode.nodeType === wysihtml5.TEXT_NODE && !(/^\s*$/).test(startNode.data.substr(range.startOffset))) { + if (startNode.nodeType === wysihtml.TEXT_NODE && !(/^\s*$/).test(startNode.data.substr(range.startOffset))) { return false; } - if (endNode.nodeType === wysihtml5.TEXT_NODE && !(/^\s*$/).test(endNode.data.substr(range.endOffset))) { + if (endNode.nodeType === wysihtml.TEXT_NODE && !(/^\s*$/).test(endNode.data.substr(range.endOffset))) { return false; } while (startNode && startNode !== parentElement) { - if (startNode.nodeType !== wysihtml5.TEXT_NODE && !wysihtml5.dom.contains(parentElement, startNode)) { + if (startNode.nodeType !== wysihtml.TEXT_NODE && !wysihtml.dom.contains(parentElement, startNode)) { return false; } - if (wysihtml5.dom.domNode(startNode).prev({ignoreBlankTexts: true})) { + if (wysihtml.dom.domNode(startNode).prev({ignoreBlankTexts: true})) { return false; } startNode = startNode.parentNode; } while (endNode && endNode !== parentElement) { - if (endNode.nodeType !== wysihtml5.TEXT_NODE && !wysihtml5.dom.contains(parentElement, endNode)) { + if (endNode.nodeType !== wysihtml.TEXT_NODE && !wysihtml.dom.contains(parentElement, endNode)) { return false; } - if (wysihtml5.dom.domNode(endNode).next({ignoreBlankTexts: true})) { + if (wysihtml.dom.domNode(endNode).next({ignoreBlankTexts: true})) { return false; } endNode = endNode.parentNode; } - return (wysihtml5.lang.array(nodeNames).contains(parentElement.nodeName)) ? parentElement : false; + return (wysihtml.lang.array(nodeNames).contains(parentElement.nodeName)) ? parentElement : false; }, isInThisEditable: function() { @@ -13128,8 +13138,8 @@ wysihtml5.quirks.ensureProperClearing = (function() { } return anode && fnode && - (wysihtml5.dom.contains(this.composer.element, fnode) || this.composer.element === fnode) && - (wysihtml5.dom.contains(this.composer.element, anode) || this.composer.element === anode); + (wysihtml.dom.contains(this.composer.element, fnode) || this.composer.element === fnode) && + (wysihtml.dom.contains(this.composer.element, anode) || this.composer.element === anode); }, deselect: function() { @@ -13138,1141 +13148,300 @@ wysihtml5.quirks.ensureProperClearing = (function() { } }); -})(wysihtml5); +})(wysihtml); ;/** - * Inspired by the rangy CSS Applier module written by Tim Down and licensed under the MIT license. - * http://code.google.com/p/rangy/ + * Rich Text Query/Formatting Commands * - * changed in order to be able ... - * - to use custom tags - * - to detect and replace similar css classes via reg exp + * @example + * var commands = new wysihtml.Commands(editor); */ -(function(wysihtml5, rangy) { - var defaultTagName = "span"; +wysihtml.Commands = Base.extend( + /** @scope wysihtml.Commands.prototype */ { + constructor: function(editor) { + this.editor = editor; + this.composer = editor.composer; + this.doc = this.composer.doc; + }, + + /** + * Check whether the browser supports the given command + * + * @param {String} command The command string which to check (eg. "bold", "italic", "insertUnorderedList") + * @example + * commands.supports("createLink"); + */ + support: function(command) { + return wysihtml.browser.supportsCommand(this.doc, command); + }, - var REG_EXP_WHITE_SPACE = /\s+/g; + /** + * Check whether the browser supports the given command + * + * @param {String} command The command string which to execute (eg. "bold", "italic", "insertUnorderedList") + * @param {String} [value] The command value parameter, needed for some commands ("createLink", "insertImage", ...), optional for commands that don't require one ("bold", "underline", ...) + * @example + * commands.exec("insertImage", "http://a1.twimg.com/profile_images/113868655/schrei_twitter_reasonably_small.jpg"); + */ + exec: function(command, value) { + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), + method = obj && obj.exec, + result = null; - function hasClass(el, cssClass, regExp) { - if (!el.className) { - return false; + // If composer ahs placeholder unset it before command + // Do not apply on commands that are behavioral + if (this.composer.hasPlaceholderSet() && !wysihtml.lang.array(['styleWithCSS', 'enableObjectResizing', 'enableInlineTableEditing']).contains(command)) { + this.composer.element.innerHTML = ""; + this.composer.selection.selectNode(this.composer.element); } - var matchingClassNames = el.className.match(regExp) || []; - return matchingClassNames[matchingClassNames.length - 1] === cssClass; - } + this.editor.fire("beforecommand:composer"); - function hasStyleAttr(el, regExp) { - if (!el.getAttribute || !el.getAttribute('style')) { - return false; + if (method) { + args.unshift(this.composer); + result = method.apply(obj, args); + } else { + try { + // try/catch for buggy firefox + result = this.doc.execCommand(command, false, value); + } catch(e) {} } - var matchingStyles = el.getAttribute('style').match(regExp); - return (el.getAttribute('style').match(regExp)) ? true : false; - } - function addStyle(el, cssStyle, regExp) { - if (el.getAttribute('style')) { - removeStyle(el, regExp); - if (el.getAttribute('style') && !(/^\s*$/).test(el.getAttribute('style'))) { - el.setAttribute('style', cssStyle + ";" + el.getAttribute('style')); - } else { - el.setAttribute('style', cssStyle); - } + this.editor.fire("aftercommand:composer"); + return result; + }, + + remove: function(command, commandValue) { + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), + method = obj && obj.remove; + if (method) { + args.unshift(this.composer); + return method.apply(obj, args); + } + }, + + /** + * Check whether the current command is active + * If the caret is within a bold text, then calling this with command "bold" should return true + * + * @param {String} command The command string which to check (eg. "bold", "italic", "insertUnorderedList") + * @param {String} [commandValue] The command value parameter (eg. for "insertImage" the image src) + * @return {Boolean} Whether the command is active + * @example + * var isCurrentSelectionBold = commands.state("bold"); + */ + state: function(command, commandValue) { + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), + method = obj && obj.state; + if (method) { + args.unshift(this.composer); + return method.apply(obj, args); } else { - el.setAttribute('style', cssStyle); + try { + // try/catch for buggy firefox + return this.doc.queryCommandState(command); + } catch(e) { + return false; + } } - } + }, - function addClass(el, cssClass, regExp) { - if (el.className) { - removeClass(el, regExp); - el.className += " " + cssClass; + /* Get command state parsed value if command has stateValue parsing function */ + stateValue: function(command) { + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), + method = obj && obj.stateValue; + if (method) { + args.unshift(this.composer); + return method.apply(obj, args); } else { - el.className = cssClass; + return false; } } +}); +;(function(wysihtml) { - function removeClass(el, regExp) { - if (el.className) { - el.className = el.className.replace(regExp, ""); - } + var nodeOptions = { + nodeName: "A", + toggle: false + }; + + function getOptions(value) { + var options = typeof value === 'object' ? value : {'href': value}; + return wysihtml.lang.object({}).merge(nodeOptions).merge({'attribute': value}).get(); } - function removeStyle(el, regExp) { - var s, - s2 = []; - if (el.getAttribute('style')) { - s = el.getAttribute('style').split(';'); - for (var i = s.length; i--;) { - if (!s[i].match(regExp) && !(/^\s*$/).test(s[i])) { - s2.push(s[i]); - } - } - if (s2.length) { - el.setAttribute('style', s2.join(';')); - } else { - el.removeAttribute('style'); + wysihtml.commands.createLink = { + exec: function(composer, command, value) { + var opts = getOptions(value); + + if (composer.selection.isCollapsed() && !this.state(composer, command)) { + var textNode = composer.doc.createTextNode(opts.attribute.href); + composer.selection.insertNode(textNode); + composer.selection.selectNode(textNode); } + wysihtml.commands.formatInline.exec(composer, command, opts); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); } - } + }; - function getMatchingStyleRegexp(el, style) { - var regexes = [], - sSplit = style.split(';'), - elStyle = el.getAttribute('style'); +})(wysihtml); +;(function(wysihtml) { - if (elStyle) { - elStyle = elStyle.replace(/\s/gi, '').toLowerCase(); - regexes.push(new RegExp("(^|\\s|;)" + style.replace(/\s/gi, '').replace(/([\(\)])/gi, "\\$1").toLowerCase().replace(";", ";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi, "\\s?rgb\\($1,\\s?$2,\\s?$3\\)"), "gi")); + var nodeOptions = { + nodeName: "A" + }; - for (var i = sSplit.length; i-- > 0;) { - if (!(/^\s*$/).test(sSplit[i])) { - regexes.push(new RegExp("(^|\\s|;)" + sSplit[i].replace(/\s/gi, '').replace(/([\(\)])/gi, "\\$1").toLowerCase().replace(";", ";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi, "\\s?rgb\\($1,\\s?$2,\\s?$3\\)"), "gi")); - } - } - for (var j = 0, jmax = regexes.length; j < jmax; j++) { - if (elStyle.match(regexes[j])) { - return regexes[j]; - } - } + wysihtml.commands.removeLink = { + exec: function(composer, command) { + wysihtml.commands.formatInline.remove(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); } + }; - return false; +})(wysihtml); +;/* Formatblock + * Is used to insert block level elements + * It tries to solve the case that some block elements should not contain other block level elements (h1-6, p, ...) + * +*/ +(function(wysihtml) { + + var dom = wysihtml.dom, + // When the caret is within a H1 and the H4 is invoked, the H1 should turn into H4 + // instead of creating a H4 within a H1 which would result in semantically invalid html + UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre", + BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote", + INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u"; + + function correctOptionsForSimilarityCheck(options) { + return { + nodeName: options.nodeName || null, + className: (!options.classRegExp) ? options.className || null : null, + classRegExp: options.classRegExp || null, + styleProperty: options.styleProperty || null + }; } - function isMatchingAllready(node, tags, style, className) { - if (style) { - return getMatchingStyleRegexp(node, style); - } else if (className) { - return wysihtml5.dom.hasClass(node, className); + function getRangeNode(node, offset) { + if (node.nodeType === 3) { + return node; } else { - return rangy.dom.arrayContains(tags, node.tagName.toLowerCase()); + return node.childNodes[offset] || node; } } - function areMatchingAllready(nodes, tags, style, className) { - for (var i = nodes.length; i--;) { - if (!isMatchingAllready(nodes[i], tags, style, className)) { - return false; - } - } - return nodes.length ? true : false; + // Returns if node is a line break + function isBr(n) { + return n && n.nodeType === 1 && n.nodeName === "BR"; } - function removeOrChangeStyle(el, style, regExp) { - - var exactRegex = getMatchingStyleRegexp(el, style); - if (exactRegex) { - // adding same style value on property again removes style - removeStyle(el, exactRegex); - return "remove"; - } else { - // adding new style value changes value - addStyle(el, style, regExp); - return "change"; - } + // Is block level element + function isBlock(n, composer) { + return n && n.nodeType === 1 && composer.win.getComputedStyle(n).display === "block"; } - function hasSameClasses(el1, el2) { - return el1.className.replace(REG_EXP_WHITE_SPACE, " ") == el2.className.replace(REG_EXP_WHITE_SPACE, " "); + // Returns if node is the rangy selection bookmark element (that must not be taken into account in most situatons and is removed on selection restoring) + function isBookmark(n) { + return n && n.nodeType === 1 && n.classList.contains('rangySelectionBoundary'); } - function replaceWithOwnChildren(el) { - var parent = el.parentNode; - while (el.firstChild) { - parent.insertBefore(el.firstChild, el); - } - parent.removeChild(el); + // Is line breaking node + function isLineBreaking(n, composer) { + return isBr(n) || isBlock(n, composer); } - function elementsHaveSameNonClassAttributes(el1, el2) { - if (el1.attributes.length != el2.attributes.length) { - return false; - } - for (var i = 0, len = el1.attributes.length, attr1, attr2, name; i < len; ++i) { - attr1 = el1.attributes[i]; - name = attr1.name; - if (name != "class") { - attr2 = el2.attributes.getNamedItem(name); - if (attr1.specified != attr2.specified) { - return false; - } - if (attr1.specified && attr1.nodeValue !== attr2.nodeValue) { - return false; + // Removes empty block level elements + function cleanup(composer, newBlockElements) { + wysihtml.dom.removeInvisibleSpaces(composer.element); + var container = composer.element, + allElements = container.querySelectorAll(BLOCK_ELEMENTS), + noEditQuery = composer.config.classNames.uneditableContainer + ([""]).concat(BLOCK_ELEMENTS.split(',')).join(", " + composer.config.classNames.uneditableContainer + ' '), + uneditables = container.querySelectorAll(noEditQuery), + elements = wysihtml.lang.array(allElements).without(uneditables), // Lets not touch uneditable elements and their contents + nbIdx; + + for (var i = elements.length; i--;) { + if (elements[i].innerHTML.replace(/[\uFEFF]/g, '') === "" && (newBlockElements.length === 0 || elements[i] !== newBlockElements[newBlockElements.length - 1])) { + // If cleanup removes some new block elements. remove them from newblocks array too + nbIdx = wysihtml.lang.array(newBlockElements).indexOf(elements[i]); + if (nbIdx > -1) { + newBlockElements.splice(nbIdx, 1); } + elements[i].parentNode.removeChild(elements[i]); } } - return true; + + return newBlockElements; } - function isSplitPoint(node, offset) { - if (rangy.dom.isCharacterDataNode(node)) { - if (offset == 0) { - return !!node.previousSibling; - } else if (offset == node.length) { - return !!node.nextSibling; - } else { - return true; + function defaultNodeName(composer) { + return composer.config.useLineBreaks ? "DIV" : "P"; + } + + // The outermost un-nestable block element parent of from node + function findOuterBlock(node, container, allBlocks) { + var n = node, + block = null; + + while (n && container && n !== container) { + if (n.nodeType === 1 && n.matches(allBlocks ? BLOCK_ELEMENTS : UNNESTABLE_BLOCK_ELEMENTS)) { + block = n; } + n = n.parentNode; } - return offset > 0 && offset < node.childNodes.length; + return block; } - function splitNodeAt(node, descendantNode, descendantOffset, container) { - var newNode; - if (rangy.dom.isCharacterDataNode(descendantNode)) { - if (descendantOffset == 0) { - descendantOffset = rangy.dom.getNodeIndex(descendantNode); - descendantNode = descendantNode.parentNode; - } else if (descendantOffset == descendantNode.length) { - descendantOffset = rangy.dom.getNodeIndex(descendantNode) + 1; - descendantNode = descendantNode.parentNode; - } else { - newNode = rangy.dom.splitDataNode(descendantNode, descendantOffset); - } - } - if (!newNode) { - if (!container || descendantNode !== container) { + // Clone for splitting the inner inline element out of its parent inline elements context + // For example if selection is in bold and italic, clone the outer nodes and wrap these around content and return + function cloneOuterInlines(node, container) { + var n = node, + innerNode, + parentNode, + el = null, + el2; - newNode = descendantNode.cloneNode(false); - if (newNode.id) { - newNode.removeAttribute("id"); - } - var child; - while ((child = descendantNode.childNodes[descendantOffset])) { - newNode.appendChild(child); + while (n && container && n !== container) { + if (n.nodeType === 1 && n.matches(INLINE_ELEMENTS)) { + parentNode = n; + if (el === null) { + el = n.cloneNode(false); + innerNode = el; + } else { + el2 = n.cloneNode(false); + el2.appendChild(el); + el = el2; } - rangy.dom.insertAfter(newNode, descendantNode); - } + n = n.parentNode; } - return (descendantNode == node) ? newNode : splitNodeAt(node, newNode.parentNode, rangy.dom.getNodeIndex(newNode), container); - } - function Merge(firstNode) { - this.isElementMerge = (firstNode.nodeType == wysihtml5.ELEMENT_NODE); - this.firstTextNode = this.isElementMerge ? firstNode.lastChild : firstNode; - this.textNodes = [this.firstTextNode]; + return { + parent: parentNode, + outerNode: el, + innerNode: innerNode + }; } - Merge.prototype = { - doMerge: function() { - var textBits = [], textNode, parent, text; - for (var i = 0, len = this.textNodes.length; i < len; ++i) { - textNode = this.textNodes[i]; - parent = textNode.parentNode; - textBits[i] = textNode.data; - if (i) { - parent.removeChild(textNode); - if (!parent.hasChildNodes()) { - parent.parentNode.removeChild(parent); - } - } - } - this.firstTextNode.data = text = textBits.join(""); - return text; - }, - - getLength: function() { - var i = this.textNodes.length, len = 0; - while (i--) { - len += this.textNodes[i].length; - } - return len; - }, + // Formats an element according to options nodeName, className, styleProperty, styleValue + // If element is not defined, creates new element + // if opotions is null, remove format instead + function applyOptionsToElement(element, options, composer) { - toString: function() { - var textBits = []; - for (var i = 0, len = this.textNodes.length; i < len; ++i) { - textBits[i] = "'" + this.textNodes[i].data + "'"; - } - return "[Merge(" + textBits.join(",") + ")]"; - } - }; - - function HTMLApplier(tagNames, cssClass, similarClassRegExp, normalize, cssStyle, similarStyleRegExp, container) { - this.tagNames = tagNames || [defaultTagName]; - this.cssClass = cssClass || ((cssClass === false) ? false : ""); - this.similarClassRegExp = similarClassRegExp; - this.cssStyle = cssStyle || ""; - this.similarStyleRegExp = similarStyleRegExp; - this.normalize = normalize; - this.applyToAnyTagName = false; - this.container = container; - } - - HTMLApplier.prototype = { - getAncestorWithClass: function(node) { - var cssClassMatch; - while (node) { - cssClassMatch = this.cssClass ? hasClass(node, this.cssClass, this.similarClassRegExp) : (this.cssStyle !== "") ? false : true; - if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssClassMatch) { - return node; - } - node = node.parentNode; - } - return false; - }, - - // returns parents of node with given style attribute - getAncestorWithStyle: function(node) { - var cssStyleMatch; - while (node) { - cssStyleMatch = this.cssStyle ? hasStyleAttr(node, this.similarStyleRegExp) : false; - - if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssStyleMatch) { - return node; - } - node = node.parentNode; - } - return false; - }, - - getMatchingAncestor: function(node) { - var ancestor = this.getAncestorWithClass(node), - matchType = false; - - if (!ancestor) { - ancestor = this.getAncestorWithStyle(node); - if (ancestor) { - matchType = "style"; - } - } else { - if (this.cssStyle) { - matchType = "class"; - } - } - - return { - "element": ancestor, - "type": matchType - }; - }, - - // Normalizes nodes after applying a CSS class to a Range. - postApply: function(textNodes, range) { - var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1]; - - var merges = [], currentMerge; - - var rangeStartNode = firstNode, rangeEndNode = lastNode; - var rangeStartOffset = 0, rangeEndOffset = lastNode.length; - - var textNode, precedingTextNode; - - for (var i = 0, len = textNodes.length; i < len; ++i) { - textNode = textNodes[i]; - precedingTextNode = null; - if (textNode && textNode.parentNode) { - precedingTextNode = this.getAdjacentMergeableTextNode(textNode.parentNode, false); - } - if (precedingTextNode) { - if (!currentMerge) { - currentMerge = new Merge(precedingTextNode); - merges.push(currentMerge); - } - currentMerge.textNodes.push(textNode); - if (textNode === firstNode) { - rangeStartNode = currentMerge.firstTextNode; - rangeStartOffset = rangeStartNode.length; - } - if (textNode === lastNode) { - rangeEndNode = currentMerge.firstTextNode; - rangeEndOffset = currentMerge.getLength(); - } - } else { - currentMerge = null; - } - } - // Test whether the first node after the range needs merging - if(lastNode && lastNode.parentNode) { - var nextTextNode = this.getAdjacentMergeableTextNode(lastNode.parentNode, true); - if (nextTextNode) { - if (!currentMerge) { - currentMerge = new Merge(lastNode); - merges.push(currentMerge); - } - currentMerge.textNodes.push(nextTextNode); - } - } - // Do the merges - if (merges.length) { - for (i = 0, len = merges.length; i < len; ++i) { - merges[i].doMerge(); - } - // Set the range boundaries - range.setStart(rangeStartNode, rangeStartOffset); - range.setEnd(rangeEndNode, rangeEndOffset); - } - }, - - getAdjacentMergeableTextNode: function(node, forward) { - var isTextNode = (node.nodeType == wysihtml5.TEXT_NODE); - var el = isTextNode ? node.parentNode : node; - var adjacentNode; - var propName = forward ? "nextSibling" : "previousSibling"; - if (isTextNode) { - // Can merge if the node's previous/next sibling is a text node - adjacentNode = node[propName]; - if (adjacentNode && adjacentNode.nodeType == wysihtml5.TEXT_NODE) { - return adjacentNode; - } - } else { - // Compare element with its sibling - adjacentNode = el[propName]; - if (adjacentNode && this.areElementsMergeable(node, adjacentNode)) { - return adjacentNode[forward ? "firstChild" : "lastChild"]; - } - } - return null; - }, - - areElementsMergeable: function(el1, el2) { - return rangy.dom.arrayContains(this.tagNames, (el1.tagName || "").toLowerCase()) - && rangy.dom.arrayContains(this.tagNames, (el2.tagName || "").toLowerCase()) - && hasSameClasses(el1, el2) - && elementsHaveSameNonClassAttributes(el1, el2); - }, - - createContainer: function(doc) { - var el = doc.createElement(this.tagNames[0]); - if (this.cssClass) { - el.className = this.cssClass; - } - if (this.cssStyle) { - el.setAttribute('style', this.cssStyle); - } - return el; - }, - - applyToTextNode: function(textNode) { - var parent = textNode.parentNode; - if (parent.childNodes.length == 1 && rangy.dom.arrayContains(this.tagNames, parent.tagName.toLowerCase())) { - - if (this.cssClass) { - addClass(parent, this.cssClass, this.similarClassRegExp); - } - if (this.cssStyle) { - addStyle(parent, this.cssStyle, this.similarStyleRegExp); - } - } else { - var el = this.createContainer(rangy.dom.getDocument(textNode)); - textNode.parentNode.insertBefore(el, textNode); - el.appendChild(textNode); - } - }, - - isRemovable: function(el) { - return rangy.dom.arrayContains(this.tagNames, el.tagName.toLowerCase()) && - wysihtml5.lang.string(el.className).trim() === "" && - ( - !el.getAttribute('style') || - wysihtml5.lang.string(el.getAttribute('style')).trim() === "" - ); - }, - - undoToTextNode: function(textNode, range, ancestorWithClass, ancestorWithStyle) { - var styleMode = (ancestorWithClass) ? false : true, - ancestor = ancestorWithClass || ancestorWithStyle, - styleChanged = false; - if (!range.containsNode(ancestor)) { - // Split out the portion of the ancestor from which we can remove the CSS class - var ancestorRange = range.cloneRange(); - ancestorRange.selectNode(ancestor); - - if (ancestorRange.isPointInRange(range.endContainer, range.endOffset) && isSplitPoint(range.endContainer, range.endOffset)) { - splitNodeAt(ancestor, range.endContainer, range.endOffset, this.container); - range.setEndAfter(ancestor); - } - if (ancestorRange.isPointInRange(range.startContainer, range.startOffset) && isSplitPoint(range.startContainer, range.startOffset)) { - ancestor = splitNodeAt(ancestor, range.startContainer, range.startOffset, this.container); - } - } - - if (!styleMode && this.similarClassRegExp) { - removeClass(ancestor, this.similarClassRegExp); - } - - if (styleMode && this.similarStyleRegExp) { - styleChanged = (removeOrChangeStyle(ancestor, this.cssStyle, this.similarStyleRegExp) === "change"); - } - if (this.isRemovable(ancestor) && !styleChanged) { - replaceWithOwnChildren(ancestor); - } - }, - - applyToRange: function(range) { - var textNodes; - for (var ri = range.length; ri--;) { - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - - if (!textNodes.length) { - try { - var node = this.createContainer(range[ri].endContainer.ownerDocument); - range[ri].surroundContents(node); - this.selectNode(range[ri], node); - return; - } catch(e) {} - } - - range[ri].splitBoundaries(); - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (textNodes.length) { - var textNode; - - for (var i = 0, len = textNodes.length; i < len; ++i) { - textNode = textNodes[i]; - if (!this.getMatchingAncestor(textNode).element) { - this.applyToTextNode(textNode); - } - } - - range[ri].setStart(textNodes[0], 0); - textNode = textNodes[textNodes.length - 1]; - range[ri].setEnd(textNode, textNode.length); - - if (this.normalize) { - this.postApply(textNodes, range[ri]); - } - } - - } - }, - - undoToRange: function(range) { - var textNodes, textNode, ancestorWithClass, ancestorWithStyle, ancestor; - for (var ri = range.length; ri--;) { - - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (textNodes.length) { - range[ri].splitBoundaries(); - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - } else { - var doc = range[ri].endContainer.ownerDocument, - node = doc.createTextNode(wysihtml5.INVISIBLE_SPACE); - range[ri].insertNode(node); - range[ri].selectNode(node); - textNodes = [node]; - } - - for (var i = 0, len = textNodes.length; i < len; ++i) { - if (range[ri].isValid()) { - textNode = textNodes[i]; - - ancestor = this.getMatchingAncestor(textNode); - if (ancestor.type === "style") { - this.undoToTextNode(textNode, range[ri], false, ancestor.element); - } else if (ancestor.element) { - this.undoToTextNode(textNode, range[ri], ancestor.element); - } - } - } - - if (len == 1) { - this.selectNode(range[ri], textNodes[0]); - } else { - range[ri].setStart(textNodes[0], 0); - textNode = textNodes[textNodes.length - 1]; - range[ri].setEnd(textNode, textNode.length); - - if (this.normalize) { - this.postApply(textNodes, range[ri]); - } - } - - } - }, - - selectNode: function(range, node) { - var isElement = node.nodeType === wysihtml5.ELEMENT_NODE, - canHaveHTML = "canHaveHTML" in node ? node.canHaveHTML : true, - content = isElement ? node.innerHTML : node.data, - isEmpty = (content === "" || content === wysihtml5.INVISIBLE_SPACE); - - if (isEmpty && isElement && canHaveHTML) { - // Make sure that caret is visible in node by inserting a zero width no breaking space - try { node.innerHTML = wysihtml5.INVISIBLE_SPACE; } catch(e) {} - } - range.selectNodeContents(node); - if (isEmpty && isElement) { - range.collapse(false); - } else if (isEmpty) { - range.setStartAfter(node); - range.setEndAfter(node); - } - }, - - getTextSelectedByRange: function(textNode, range) { - var textRange = range.cloneRange(); - textRange.selectNodeContents(textNode); - - var intersectionRange = textRange.intersection(range); - var text = intersectionRange ? intersectionRange.toString() : ""; - textRange.detach(); - - return text; - }, - - isAppliedToRange: function(range) { - var ancestors = [], - appliedType = "full", - ancestor, styleAncestor, textNodes; - - for (var ri = range.length; ri--;) { - - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (!textNodes.length) { - ancestor = this.getMatchingAncestor(range[ri].startContainer).element; - - return (ancestor) ? { - "elements": [ancestor], - "coverage": appliedType - } : false; - } - - for (var i = 0, len = textNodes.length, selectedText; i < len; ++i) { - selectedText = this.getTextSelectedByRange(textNodes[i], range[ri]); - ancestor = this.getMatchingAncestor(textNodes[i]).element; - if (ancestor && selectedText != "") { - ancestors.push(ancestor); - - if (wysihtml5.dom.getTextNodes(ancestor, true).length === 1) { - appliedType = "full"; - } else if (appliedType === "full") { - appliedType = "inline"; - } - } else if (!ancestor) { - appliedType = "partial"; - } - } - - } - - return (ancestors.length) ? { - "elements": ancestors, - "coverage": appliedType - } : false; - }, - - toggleRange: function(range) { - var isApplied = this.isAppliedToRange(range), - parentsExactMatch; - - if (isApplied) { - if (isApplied.coverage === "full") { - this.undoToRange(range); - } else if (isApplied.coverage === "inline") { - parentsExactMatch = areMatchingAllready(isApplied.elements, this.tagNames, this.cssStyle, this.cssClass); - this.undoToRange(range); - if (!parentsExactMatch) { - this.applyToRange(range); - } - } else { - // partial - if (!areMatchingAllready(isApplied.elements, this.tagNames, this.cssStyle, this.cssClass)) { - this.undoToRange(range); - } - this.applyToRange(range); - } - } else { - this.applyToRange(range); - } - } - }; - - wysihtml5.selection.HTMLApplier = HTMLApplier; - -})(wysihtml5, rangy); -;/** - * Rich Text Query/Formatting Commands - * - * @example - * var commands = new wysihtml5.Commands(editor); - */ -wysihtml5.Commands = Base.extend( - /** @scope wysihtml5.Commands.prototype */ { - constructor: function(editor) { - this.editor = editor; - this.composer = editor.composer; - this.doc = this.composer.doc; - }, - - /** - * Check whether the browser supports the given command - * - * @param {String} command The command string which to check (eg. "bold", "italic", "insertUnorderedList") - * @example - * commands.supports("createLink"); - */ - support: function(command) { - return wysihtml5.browser.supportsCommand(this.doc, command); - }, - - /** - * Check whether the browser supports the given command - * - * @param {String} command The command string which to execute (eg. "bold", "italic", "insertUnorderedList") - * @param {String} [value] The command value parameter, needed for some commands ("createLink", "insertImage", ...), optional for commands that don't require one ("bold", "underline", ...) - * @example - * commands.exec("insertImage", "http://a1.twimg.com/profile_images/113868655/schrei_twitter_reasonably_small.jpg"); - */ - exec: function(command, value) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), - method = obj && obj.exec, - result = null; - - // If composer ahs placeholder unset it before command - // Do not apply on commands that are behavioral - if (this.composer.hasPlaceholderSet() && !wysihtml5.lang.array(['styleWithCSS', 'enableObjectResizing', 'enableInlineTableEditing']).contains(command)) { - this.composer.element.innerHTML = ""; - this.composer.selection.selectNode(this.composer.element); - } - - this.editor.fire("beforecommand:composer"); - - if (method) { - args.unshift(this.composer); - result = method.apply(obj, args); - } else { - try { - // try/catch for buggy firefox - result = this.doc.execCommand(command, false, value); - } catch(e) {} - } - - this.editor.fire("aftercommand:composer"); - return result; - }, - - remove: function(command, commandValue) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), - method = obj && obj.remove; - if (method) { - args.unshift(this.composer); - return method.apply(obj, args); - } - }, - - /** - * Check whether the current command is active - * If the caret is within a bold text, then calling this with command "bold" should return true - * - * @param {String} command The command string which to check (eg. "bold", "italic", "insertUnorderedList") - * @param {String} [commandValue] The command value parameter (eg. for "insertImage" the image src) - * @return {Boolean} Whether the command is active - * @example - * var isCurrentSelectionBold = commands.state("bold"); - */ - state: function(command, commandValue) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), - method = obj && obj.state; - if (method) { - args.unshift(this.composer); - return method.apply(obj, args); - } else { - try { - // try/catch for buggy firefox - return this.doc.queryCommandState(command); - } catch(e) { - return false; - } - } - }, - - /* Get command state parsed value if command has stateValue parsing function */ - stateValue: function(command) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), - method = obj && obj.stateValue; - if (method) { - args.unshift(this.composer); - return method.apply(obj, args); - } else { - return false; - } - } -}); -;(function(wysihtml5) { - - var nodeOptions = { - nodeName: "B", - toggle: true - }; - - wysihtml5.commands.bold = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); -;(function(wysihtml5) { - - var nodeOptions = { - nodeName: "A", - toggle: false - }; - - function getOptions(value) { - var options = typeof value === 'object' ? value : {'href': value}; - return wysihtml5.lang.object({}).merge(nodeOptions).merge({'attribute': value}).get(); - } - - wysihtml5.commands.createLink = { - exec: function(composer, command, value) { - var opts = getOptions(value); - - if (composer.selection.isCollapsed() && !this.state(composer, command)) { - var textNode = composer.doc.createTextNode(opts.attribute.href); - composer.selection.insertNode(textNode); - composer.selection.selectNode(textNode); - } - wysihtml5.commands.formatInline.exec(composer, command, opts); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - nodeName: "A" - }; - - wysihtml5.commands.removeLink = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.remove(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -})(wysihtml5); -;/** - * Set font size css class - */ -(function(wysihtml5) { - var REG_EXP = /wysiwyg-font-size-[0-9a-z\-]+/g; - - wysihtml5.commands.fontSize = { - exec: function(composer, command, size) { - wysihtml5.commands.formatInline.exec(composer, command, {className: "wysiwyg-font-size-" + size, classRegExp: REG_EXP, toggle: true}); - }, - - state: function(composer, command, size) { - return wysihtml5.commands.formatInline.state(composer, command, {className: "wysiwyg-font-size-" + size}); - } - }; -})(wysihtml5); -;/** - * Set font size by inline style - */ -(function(wysihtml5) { - - wysihtml5.commands.fontSizeStyle = { - exec: function(composer, command, size) { - size = size.size || size; - if (!(/^\s*$/).test(size)) { - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: "fontSize", styleValue: size, toggle: false}); - } - }, - - state: function(composer, command, size) { - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: "fontSize", styleValue: size || undefined}); - }, - - remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: "fontSize"}); - }, - - stateValue: function(composer, command) { - var styleStr, - st = this.state(composer, command); - - if (st && wysihtml5.lang.object(st).isArray()) { - st = st[0]; - } - if (st) { - styleStr = st.getAttribute("style"); - if (styleStr) { - return wysihtml5.quirks.styleParser.parseFontSize(styleStr); - } - } - return false; - } - }; -})(wysihtml5); -;/** - * Set color css class - */ -(function(wysihtml5) { - var REG_EXP = /wysiwyg-color-[0-9a-z]+/g; - - wysihtml5.commands.foreColor = { - exec: function(composer, command, color) { - wysihtml5.commands.formatInline.exec(composer, command, {className: "wysiwyg-color-" + color, classRegExp: REG_EXP, toggle: true}); - }, - - state: function(composer, command, color) { - return wysihtml5.commands.formatInline.state(composer, command, {className: "wysiwyg-color-" + color}); - } - }; -})(wysihtml5); -;/** - * Sets text color by inline styles - */ -(function(wysihtml5) { - - wysihtml5.commands.foreColorStyle = { - exec: function(composer, command, color) { - var colorVals, colString; - - if (!color) { return; } - - colorVals = wysihtml5.quirks.styleParser.parseColor("color:" + (color.color || color), "color"); - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')'; - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: "color", styleValue: colString}); - } - }, - - state: function(composer, command, color) { - var colorVals = color ? wysihtml5.quirks.styleParser.parseColor("color:" + (color.color || color), "color") : null, - colString; - - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')'; - } - - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: "color", styleValue: colString}); - }, - - remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: "color"}); - }, - - stateValue: function(composer, command, props) { - var st = this.state(composer, command), - colorStr, - val = false; - - if (st && wysihtml5.lang.object(st).isArray()) { - st = st[0]; - } - - if (st) { - colorStr = st.getAttribute("style"); - if (colorStr) { - val = wysihtml5.quirks.styleParser.parseColor(colorStr, "color"); - return wysihtml5.quirks.styleParser.unparseColor(val, props); - } - } - return false; - } - - }; -})(wysihtml5); -;/** - * Sets text background color by inline styles - */ -(function(wysihtml5) { - - wysihtml5.commands.bgColorStyle = { - exec: function(composer, command, color) { - var colorVals = wysihtml5.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color"), - colString; - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); - } - }, - - state: function(composer, command, color) { - var colorVals = color ? wysihtml5.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color") : null, - colString; - - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; - } - - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); - }, - - remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: 'backgroundColor'}); - }, - - stateValue: function(composer, command, props) { - var st = this.state(composer, command), - colorStr, - val = false; - - if (st && wysihtml5.lang.object(st).isArray()) { - st = st[0]; - } - - if (st) { - colorStr = st.getAttribute('style'); - if (colorStr) { - val = wysihtml5.quirks.styleParser.parseColor(colorStr, "background-color"); - return wysihtml5.quirks.styleParser.unparseColor(val, props); - } - } - return false; - } - - }; -})(wysihtml5); -;/* Formatblock - * Is used to insert block level elements - * It tries to solve the case that some block elements should not contain other block level elements (h1-6, p, ...) - * -*/ -(function(wysihtml5) { - - var dom = wysihtml5.dom, - // When the caret is within a H1 and the H4 is invoked, the H1 should turn into H4 - // instead of creating a H4 within a H1 which would result in semantically invalid html - UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre", - BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote", - INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u"; - - function correctOptionsForSimilarityCheck(options) { - return { - nodeName: options.nodeName || null, - className: (!options.classRegExp) ? options.className || null : null, - classRegExp: options.classRegExp || null, - styleProperty: options.styleProperty || null - }; - } - - function getRangeNode(node, offset) { - if (node.nodeType === 3) { - return node; - } else { - return node.childNodes[offset] || node; - } - } - - // Returns if node is a line break - function isBr(n) { - return n && n.nodeType === 1 && n.nodeName === "BR"; - } - - // Is block level element - function isBlock(n, composer) { - return n && n.nodeType === 1 && composer.win.getComputedStyle(n).display === "block"; - } - - // Returns if node is the rangy selection bookmark element (that must not be taken into account in most situatons and is removed on selection restoring) - function isBookmark(n) { - return n && n.nodeType === 1 && n.classList.contains('rangySelectionBoundary'); - } - - // Is line breaking node - function isLineBreaking(n, composer) { - return isBr(n) || isBlock(n, composer); - } - - // Removes empty block level elements - function cleanup(composer, newBlockElements) { - wysihtml5.dom.removeInvisibleSpaces(composer.element); - var container = composer.element, - allElements = container.querySelectorAll(BLOCK_ELEMENTS), - noEditQuery = composer.config.classNames.uneditableContainer + ([""]).concat(BLOCK_ELEMENTS.split(',')).join(", " + composer.config.classNames.uneditableContainer + ' '), - uneditables = container.querySelectorAll(noEditQuery), - elements = wysihtml5.lang.array(allElements).without(uneditables), // Lets not touch uneditable elements and their contents - nbIdx; - - for (var i = elements.length; i--;) { - if (elements[i].innerHTML.replace(/[\uFEFF]/g, '') === "" && (newBlockElements.length === 0 || elements[i] !== newBlockElements[newBlockElements.length - 1])) { - // If cleanup removes some new block elements. remove them from newblocks array too - nbIdx = wysihtml5.lang.array(newBlockElements).indexOf(elements[i]); - if (nbIdx > -1) { - newBlockElements.splice(nbIdx, 1); - } - elements[i].parentNode.removeChild(elements[i]); - } - } - - return newBlockElements; - } - - function defaultNodeName(composer) { - return composer.config.useLineBreaks ? "DIV" : "P"; - } - - // The outermost un-nestable block element parent of from node - function findOuterBlock(node, container, allBlocks) { - var n = node, - block = null; - - while (n && container && n !== container) { - if (n.nodeType === 1 && n.matches(allBlocks ? BLOCK_ELEMENTS : UNNESTABLE_BLOCK_ELEMENTS)) { - block = n; - } - n = n.parentNode; - } - - return block; - } - - // Clone for splitting the inner inline element out of its parent inline elements context - // For example if selection is in bold and italic, clone the outer nodes and wrap these around content and return - function cloneOuterInlines(node, container) { - var n = node, - innerNode, - parentNode, - el = null, - el2; - - while (n && container && n !== container) { - if (n.nodeType === 1 && n.matches(INLINE_ELEMENTS)) { - parentNode = n; - if (el === null) { - el = n.cloneNode(false); - innerNode = el; - } else { - el2 = n.cloneNode(false); - el2.appendChild(el); - el = el2; - } - } - n = n.parentNode; - } - - return { - parent: parentNode, - outerNode: el, - innerNode: innerNode - }; - } - - // Formats an element according to options nodeName, className, styleProperty, styleValue - // If element is not defined, creates new element - // if opotions is null, remove format instead - function applyOptionsToElement(element, options, composer) { - - if (!element) { - element = composer.doc.createElement(options.nodeName || defaultNodeName(composer)); - // Add invisible space as otherwise webkit cannot set selection or range to it correctly - element.appendChild(composer.doc.createTextNode(wysihtml5.INVISIBLE_SPACE)); + if (!element) { + element = composer.doc.createElement(options.nodeName || defaultNodeName(composer)); + // Add invisible space as otherwise webkit cannot set selection or range to it correctly + element.appendChild(composer.doc.createTextNode(wysihtml.INVISIBLE_SPACE)); } if (options.nodeName && element.nodeName !== options.nodeName) { @@ -14288,7 +13457,7 @@ wysihtml5.Commands = Base.extend( } if (options.styleProperty && typeof options.styleValue !== "undefined") { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } return element; @@ -14303,7 +13472,7 @@ wysihtml5.Commands = Base.extend( unwrapped = false; if (options.styleProperty) { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = ''; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = ''; } if (options.className) { element.classList.remove(options.className); @@ -14345,8 +13514,8 @@ wysihtml5.Commands = Base.extend( nextEl, prevEl; for (var i = blocks.length; i--;) { - nextEl = wysihtml5.dom.domNode(blocks[i]).next({nodeTypes: [1,3], ignoreBlankTexts: true}), - prevEl = wysihtml5.dom.domNode(blocks[i]).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + nextEl = wysihtml.dom.domNode(blocks[i]).next({nodeTypes: [1,3], ignoreBlankTexts: true}), + prevEl = wysihtml.dom.domNode(blocks[i]).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (nextEl && nextEl.nodeType !== 1 && nextEl.nodeName !== 'BR') { if ((blocks[i].innerHTML || blocks[i].nodeValue || '').trim() !== '') { @@ -14358,7 +13527,7 @@ wysihtml5.Commands = Base.extend( blocks[i].parentNode.insertBefore(blocks[i].ownerDocument.createElement('BR'), nextEl); } } - wysihtml5.dom.unwrap(blocks[i]); + wysihtml.dom.unwrap(blocks[i]); } } @@ -14450,7 +13619,7 @@ wysihtml5.Commands = Base.extend( // Range starts before and ends inside the node tmpRange = ranges[i].cloneRange(); - closestLI = wysihtml5.dom.domNode(lis[j]).prev({nodeTypes: [1]}); + closestLI = wysihtml.dom.domNode(lis[j]).prev({nodeTypes: [1]}); if (closestLI) { tmpRange.setEnd(closestLI, closestLI.childNodes.length); @@ -14472,7 +13641,7 @@ wysihtml5.Commands = Base.extend( newRanges.push(tmpRange); // Find next LI in list and if present set range to it, else - closestLI = wysihtml5.dom.domNode(lis[j]).next({nodeTypes: [1]}); + closestLI = wysihtml.dom.domNode(lis[j]).next({nodeTypes: [1]}); if (closestLI) { ranges[i].setStart(closestLI, 0); } else if (lis[j].closest('ul, ol')) { @@ -14493,7 +13662,7 @@ wysihtml5.Commands = Base.extend( // Return options object with nodeName set if original did not have any // Node name is set to local or global default function getOptionsWithNodename(options, defaultName, composer) { - var correctedOptions = (options) ? wysihtml5.lang.object(options).clone(true) : null; + var correctedOptions = (options) ? wysihtml.lang.object(options).clone(true) : null; if (correctedOptions) { correctedOptions.nodeName = correctedOptions.nodeName || defaultName || defaultNodeName(composer); } @@ -14515,8 +13684,8 @@ wysihtml5.Commands = Base.extend( composer.selection.splitElementAtCaret(firstOuterBlock, fragment); - next = wysihtml5.dom.domNode(last).next({nodeTypes: [1,3], ignoreBlankTexts: true}); - prev = wysihtml5.dom.domNode(first).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + next = wysihtml.dom.domNode(last).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + prev = wysihtml.dom.domNode(first).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (first && !isLineBreaking(first, composer) && prev && !isLineBreaking(prev, composer)) { first.parentNode.insertBefore(composer.doc.createElement('br'), first); @@ -14566,7 +13735,7 @@ wysihtml5.Commands = Base.extend( // Split block formating and add new block to wrap caret unwrapBlocksFromContent(content.firstChild); - children = wysihtml5.dom.unwrap(content.firstChild); + children = wysihtml.dom.unwrap(content.firstChild); // Add line break before if needed if (children.length > 0) { @@ -14597,14 +13766,14 @@ wysihtml5.Commands = Base.extend( first = false; } - blocks = wysihtml5.lang.array(fragment.childNodes).get(); + blocks = wysihtml.lang.array(fragment.childNodes).get(); injectFragmentToRange(fragment, r, composer); return blocks; } // When block node is inserted, look surrounding nodes and remove surplous linebreak tags (as block format breaks line itself) function removeSurroundingLineBreaks(prevNode, nextNode, composer) { - var prevPrev = prevNode && wysihtml5.dom.domNode(prevNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + var prevPrev = prevNode && wysihtml.dom.domNode(prevNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (isBr(nextNode)) { nextNode.parentNode.removeChild(nextNode); } @@ -14672,7 +13841,7 @@ wysihtml5.Commands = Base.extend( rangeStartContainer = r.startContainer, startNode = getRangeNode(r.startContainer, r.startOffset), endNode = getRangeNode(r.endContainer, r.endOffset), - prevNode = (r.startContainer === startNode && startNode.nodeType === 3 && !isWhitespaceBefore(startNode, r.startOffset)) ? startNode : wysihtml5.dom.domNode(startNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}), + prevNode = (r.startContainer === startNode && startNode.nodeType === 3 && !isWhitespaceBefore(startNode, r.startOffset)) ? startNode : wysihtml.dom.domNode(startNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}), nextNode = ( ( r.endContainer.nodeType === 1 && @@ -14680,23 +13849,23 @@ wysihtml5.Commands = Base.extend( ( endNode.nodeType === 1 || !isWhitespaceAfter(endNode, r.endOffset) && - !wysihtml5.dom.domNode(endNode).is.rangyBookmark() + !wysihtml.dom.domNode(endNode).is.rangyBookmark() ) ) || ( r.endContainer === endNode && endNode.nodeType === 3 && !isWhitespaceAfter(endNode, r.endOffset) ) - ) ? endNode : wysihtml5.dom.domNode(endNode).next({nodeTypes: [1,3], ignoreBlankTexts: true}), + ) ? endNode : wysihtml.dom.domNode(endNode).next({nodeTypes: [1,3], ignoreBlankTexts: true}), content = r.extractContents(), fragment = composer.doc.createDocumentFragment(), - similarOuterBlock = similarOptions ? wysihtml5.dom.getParentElement(rangeStartContainer, similarOptions, null, composer.element) : null, + similarOuterBlock = similarOptions ? wysihtml.dom.getParentElement(rangeStartContainer, similarOptions, null, composer.element) : null, splitAllBlocks = !closestBlockName || !options || (options.nodeName === "BLOCKQUOTE" && closestBlockName === "BLOCKQUOTE"), firstOuterBlock = similarOuterBlock || findOuterBlock(rangeStartContainer, composer.element, splitAllBlocks), // The outermost un-nestable block element parent of selection start wrapper, blocks, children, firstc, lastC; - if (wysihtml5.dom.domNode(nextNode).is.rangyBookmark()) { + if (wysihtml.dom.domNode(nextNode).is.rangyBookmark()) { endNode = nextNode; nextNode = endNode.nextSibling; } @@ -14746,7 +13915,7 @@ wysihtml5.Commands = Base.extend( } } - blocks = wysihtml5.lang.array(fragment.childNodes).get(); + blocks = wysihtml.lang.array(fragment.childNodes).get(); } injectFragmentToRange(fragment, r, composer, firstOuterBlock); removeSurroundingLineBreaks(prevNode, nextNode, composer); @@ -14755,7 +13924,7 @@ wysihtml5.Commands = Base.extend( // (if it contains rangy bookmark, so selection can be restored later correctly) if (blocks.length > 0 && ( - typeof blocks[blocks.length - 1].lastChild === "undefined" || wysihtml5.dom.domNode(blocks[blocks.length - 1].lastChild).is.rangyBookmark() + typeof blocks[blocks.length - 1].lastChild === "undefined" || wysihtml.dom.domNode(blocks[blocks.length - 1].lastChild).is.rangyBookmark() ) ) { blocks[blocks.length - 1].appendChild(composer.doc.createElement('br')); @@ -14765,7 +13934,7 @@ wysihtml5.Commands = Base.extend( // Find closest block level element function getParentBlockNodeName(element, composer) { - var parentNode = wysihtml5.dom.getParentElement(element, { + var parentNode = wysihtml.dom.getParentElement(element, { query: BLOCK_ELEMENTS }, null, composer.element); @@ -14780,7 +13949,7 @@ wysihtml5.Commands = Base.extend( // // If nothing found selects the current line function expandCaretToBlock(composer, insertingNodeName) { - var parent = wysihtml5.dom.getParentElement(composer.selection.getOwnRanges()[0].startContainer, { + var parent = wysihtml.dom.getParentElement(composer.selection.getOwnRanges()[0].startContainer, { query: UNNESTABLE_BLOCK_ELEMENTS + ', ' + (insertingNodeName ? insertingNodeName.toLowerCase() : 'div'), }, null, composer.element), range; @@ -14846,13 +14015,13 @@ wysihtml5.Commands = Base.extend( if (caretInfo && caretInfo.caretNode) { if ( // caret is allready breaknode - wysihtml5.dom.domNode(caretInfo.caretNode).is.lineBreak() || + wysihtml.dom.domNode(caretInfo.caretNode).is.lineBreak() || // caret is textnode - (caretInfo.caretNode.nodeType === 3 && caretInfo.textOffset === 0 && (!caretInfo.prevNode || wysihtml5.dom.domNode(caretInfo.prevNode).is.lineBreak())) || + (caretInfo.caretNode.nodeType === 3 && caretInfo.textOffset === 0 && (!caretInfo.prevNode || wysihtml.dom.domNode(caretInfo.prevNode).is.lineBreak())) || // Caret is temprorary rangy selection marker (caretInfo.caretNode.nodeType === 1 && caretInfo.caretNode.classList.contains('rangySelectionBoundary') && - (!caretInfo.prevNode || wysihtml5.dom.domNode(caretInfo.prevNode).is.lineBreak() || wysihtml5.dom.domNode(caretInfo.prevNode).is.block()) && - (!caretInfo.nextNode || wysihtml5.dom.domNode(caretInfo.nextNode).is.lineBreak() || wysihtml5.dom.domNode(caretInfo.nextNode).is.block()) + (!caretInfo.prevNode || wysihtml.dom.domNode(caretInfo.prevNode).is.lineBreak() || wysihtml.dom.domNode(caretInfo.prevNode).is.block()) && + (!caretInfo.nextNode || wysihtml.dom.domNode(caretInfo.nextNode).is.lineBreak() || wysihtml.dom.domNode(caretInfo.nextNode).is.block()) ) ) { return true; @@ -14862,7 +14031,7 @@ wysihtml5.Commands = Base.extend( return false; } - wysihtml5.commands.formatBlock = { + wysihtml.commands.formatBlock = { exec: function(composer, command, options) { options = parseOptions(options); var newBlockElements = [], @@ -14938,7 +14107,7 @@ wysihtml5.Commands = Base.extend( options = parseOptions(options); var nodes = composer.selection.filterElements((function (element) { // Finds matching elements inside selection - return wysihtml5.dom.domNode(element).test(options || { query: BLOCK_ELEMENTS }); + return wysihtml.dom.domNode(element).test(options || { query: BLOCK_ELEMENTS }); }).bind(this)), parentNodes = composer.selection.getSelectedOwnNodes(), parent; @@ -14955,67 +14124,13 @@ wysihtml5.Commands = Base.extend( } }; -})(wysihtml5); -;/* Formats block for as a
    block - * Useful in conjuction for sytax highlight utility: highlight.js - * - * Usage: - * - * editorInstance.composer.commands.exec("formatCode", "language-html"); -*/ - -(function(wysihtml5){ - wysihtml5.commands.formatCode = { - - exec: function(composer, command, classname) { - var pre = this.state(composer)[0], - code, range, selectedNodes; - - if (pre) { - // caret is already within a
    ...
    - composer.selection.executeAndRestore(function() { - code = pre.querySelector("code"); - wysihtml5.dom.replaceWithChildNodes(pre); - if (code) { - wysihtml5.dom.replaceWithChildNodes(code); - } - }); - } else { - // Wrap in
    ...
    - range = composer.selection.getRange(); - selectedNodes = range.extractContents(); - pre = composer.doc.createElement("pre"); - code = composer.doc.createElement("code"); - - if (classname) { - code.className = classname; - } - - pre.appendChild(code); - code.appendChild(selectedNodes); - range.insertNode(pre); - composer.selection.selectNode(pre); - } - }, - - state: function(composer) { - var selectedNode = composer.selection.getSelectedNode(), node; - if (selectedNode && selectedNode.nodeName && selectedNode.nodeName == "PRE"&& - selectedNode.firstChild && selectedNode.firstChild.nodeName && selectedNode.firstChild.nodeName == "CODE") { - return [selectedNode]; - } else { - node = wysihtml5.dom.getParentElement(selectedNode, { query: "pre code" }); - return node ? [node.parentNode] : false; - } - } - }; -}(wysihtml5)); +})(wysihtml); ;/** * Unifies all inline tags additions and removals * See https://github.com/Voog/wysihtml/pull/169 for specification of action */ -(function(wysihtml5) { +(function(wysihtml) { var defaultTag = "SPAN", INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u", @@ -15037,8 +14152,8 @@ wysihtml5.Commands = Base.extend( // Associative arrays in javascript are really objects and do not have length defined // Thus have to check emptyness in a different way function hasNoAttributes(element) { - var attr = wysihtml5.dom.getAttributes(element); - return wysihtml5.lang.object(attr).isEmpty(); + var attr = wysihtml.dom.getAttributes(element); + return wysihtml.lang.object(attr).isEmpty(); } // compares two nodes if they are semantically the same @@ -15057,14 +14172,14 @@ wysihtml5.Commands = Base.extend( classes1 = element1.className.trim().replace(/\s+/g, ' ').split(' '); classes2 = element2.className.trim().replace(/\s+/g, ' ').split(' '); - if (wysihtml5.lang.array(classes1).without(classes2).length > 0) { + if (wysihtml.lang.array(classes1).without(classes2).length > 0) { return false; } - attr1 = wysihtml5.dom.getAttributes(element1); - attr2 = wysihtml5.dom.getAttributes(element2); + attr1 = wysihtml.dom.getAttributes(element1); + attr2 = wysihtml.dom.getAttributes(element2); - if (attr1.length !== attr2.length || !wysihtml5.lang.object(wysihtml5.lang.object(attr1).difference(attr2)).isEmpty()) { + if (attr1.length !== attr2.length || !wysihtml.lang.object(wysihtml.lang.object(attr1).difference(attr2)).isEmpty()) { return false; } @@ -15085,7 +14200,7 @@ wysihtml5.Commands = Base.extend( } if (options.styleProperty && typeof options.styleValue !== "undefined") { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } if (options.attribute) { @@ -15119,9 +14234,9 @@ wysihtml5.Commands = Base.extend( // If attrbutes and values are the same > remove // if attributes or values function updateElementAttributes(element, newAttributes, toggle) { - var attr = wysihtml5.dom.getAttributes(element), + var attr = wysihtml.dom.getAttributes(element), fullContain = containsSameAttributes(newAttributes, attr), - attrDifference = wysihtml5.lang.object(attr).difference(newAttributes), + attrDifference = wysihtml.lang.object(attr).difference(newAttributes), a, b; if (fullContain && toggle !== false) { @@ -15132,7 +14247,7 @@ wysihtml5.Commands = Base.extend( } } else { - /*if (!wysihtml5.lang.object(attrDifference).isEmpty()) { + /*if (!wysihtml.lang.object(attrDifference).isEmpty()) { for (b in attrDifference) { if (attrDifference.hasOwnProperty(b)) { element.removeAttribute(b); @@ -15167,10 +14282,10 @@ wysihtml5.Commands = Base.extend( // change/remove style if (options.styleProperty) { - if (options.toggle !== false && element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)].trim().replace(/, /g, ",") === options.styleValue) { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = ''; + if (options.toggle !== false && element.style[wysihtml.browser.fixStyleKey(options.styleProperty)].trim().replace(/, /g, ",") === options.styleValue) { + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = ''; } else { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } } if (hasNoStyle(element)) { @@ -15190,7 +14305,7 @@ wysihtml5.Commands = Base.extend( // Handle similar semantically same elements (queryAliasMap) nodeNameQuery = options.nodeName ? queryAliasMap[options.nodeName.toLowerCase()] || options.nodeName.toLowerCase() : null; - nodeQueryMatch = nodeNameQuery ? wysihtml5.dom.domNode(element).test({ query: nodeNameQuery }) : false; + nodeQueryMatch = nodeNameQuery ? wysihtml.dom.domNode(element).test({ query: nodeNameQuery }) : false; // Unwrap element if no attributes present and node name given // or no attributes and if no nodename set but node is the default @@ -15199,7 +14314,7 @@ wysihtml5.Commands = Base.extend( ((options.toggle !== false && nodeQueryMatch) || (!options.nodeName && element.nodeName === defaultTag)) && hasNoClass(element) && hasNoStyle(element) && hasNoAttributes(element) ) { - wysihtml5.dom.unwrap(element); + wysihtml.dom.unwrap(element); } } @@ -15213,7 +14328,7 @@ wysihtml5.Commands = Base.extend( if (!selection.isCollapsed()) { textNodes = textNodes.concat(selection.getOwnNodes([3], function(node) { // Exclude empty nodes except caret node - return (!wysihtml5.dom.domNode(node).is.emptyTextNode()); + return (!wysihtml.dom.domNode(node).is.emptyTextNode()); }, splitBounds)); } @@ -15249,11 +14364,11 @@ wysihtml5.Commands = Base.extend( var o; if (options.nodeName) { var query = queryAliasMap[options.nodeName.toLowerCase()] || options.nodeName.toLowerCase(); - return wysihtml5.dom.domNode(node).test({ query: query }); + return wysihtml.dom.domNode(node).test({ query: query }); } else { - o = wysihtml5.lang.object(options).clone(); + o = wysihtml.lang.object(options).clone(); o.query = INLINE_ELEMENTS; // make sure only inline elements with styles and classes are counted - return wysihtml5.dom.domNode(node).test(o); + return wysihtml.dom.domNode(node).test(o); } } @@ -15269,7 +14384,7 @@ wysihtml5.Commands = Base.extend( try { rangy.getSelection(composer.win).addRange(range); } catch (e) {} - if (!composer.doc.activeElement || !wysihtml5.dom.contains(composer.element, composer.doc.activeElement)) { + if (!composer.doc.activeElement || !wysihtml.dom.contains(composer.element, composer.doc.activeElement)) { composer.element.focus(); d.scrollTop = oldScrollTop; d.scrollLeft = oldScrollLeft; @@ -15386,7 +14501,7 @@ wysihtml5.Commands = Base.extend( range.setStartAndEnd(anchor, offsetStart, offsetEnd); range.splitBoundaries(); txtNodes = range.getNodes([3], function(node) { - return (!wysihtml5.dom.domNode(node).is.emptyTextNode()); + return (!wysihtml.dom.domNode(node).is.emptyTextNode()); }); return { @@ -15458,7 +14573,7 @@ wysihtml5.Commands = Base.extend( if (wrapNode) { newWrapNode = wrapNode.cloneNode(false); - wysihtml5.dom.domNode(textNode).escapeParent(wrapNode, newWrapNode); + wysihtml.dom.domNode(textNode).escapeParent(wrapNode, newWrapNode); updateFormatOfElement(newWrapNode, options); } } @@ -15469,7 +14584,7 @@ wysihtml5.Commands = Base.extend( wrapNode = findSimilarTextNodeWrapper(textNode, options, container); if (wrapNode) { - wysihtml5.dom.domNode(textNode).escapeParent(wrapNode); + wysihtml.dom.domNode(textNode).escapeParent(wrapNode); } } @@ -15503,7 +14618,7 @@ wysihtml5.Commands = Base.extend( } else { // Escape caret out of format - textNode = composer.doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + textNode = composer.doc.createTextNode(wysihtml.INVISIBLE_SPACE); newNode = state.nodes[0].cloneNode(false); newNode.appendChild(textNode); composer.selection.splitElementAtCaret(state.nodes[0], newNode); @@ -15568,7 +14683,7 @@ wysihtml5.Commands = Base.extend( textOffset = selection.anchorOffset; for (i = state.nodes.length; i--;) { - wysihtml5.dom.unwrap(state.nodes[i]); + wysihtml.dom.unwrap(state.nodes[i]); } cleanupAndSetCaret(composer, textNode, textOffset, options); @@ -15616,7 +14731,7 @@ wysihtml5.Commands = Base.extend( return options; } - wysihtml5.commands.formatInline = { + wysihtml.commands.formatInline = { // Basics: // In case of plain text or inline state not set wrap all non-empty textnodes with @@ -15662,27 +14777,9 @@ wysihtml5.Commands = Base.extend( } }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - nodeName: "BLOCKQUOTE", - toggle: true - }; - - wysihtml5.commands.insertBlockQuote = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5){ - wysihtml5.commands.insertHTML = { +})(wysihtml); +;(function(wysihtml){ + wysihtml.commands.insertHTML = { exec: function(composer, command, html) { composer.selection.insertHTML(html); }, @@ -15691,120 +14788,11 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5) { - var NODE_NAME = "IMG"; - - wysihtml5.commands.insertImage = { - /** - * Inserts an - * If selection is already an image link, it removes it - * - * @example - * // either ... - * wysihtml5.commands.insertImage.exec(composer, "insertImage", "http://www.google.de/logo.jpg"); - * // ... or ... - * wysihtml5.commands.insertImage.exec(composer, "insertImage", { src: "http://www.google.de/logo.jpg", title: "foo" }); - */ - exec: function(composer, command, value) { - value = typeof(value) === "object" ? value : { src: value }; - - var doc = composer.doc, - image = this.state(composer), - textNode, - parent; - - // If image is selected and src ie empty, set the caret before it and delete the image - if (image && !value.src) { - composer.selection.setBefore(image); - parent = image.parentNode; - parent.removeChild(image); - - // and it's parent too if it hasn't got any other relevant child nodes - wysihtml5.dom.removeEmptyTextNodes(parent); - if (parent.nodeName === "A" && !parent.firstChild) { - composer.selection.setAfter(parent); - parent.parentNode.removeChild(parent); - } - - // firefox and ie sometimes don't remove the image handles, even though the image got removed - wysihtml5.quirks.redraw(composer.element); - return; - } - - // If image selected change attributes accordingly - if (image) { - for (var key in value) { - if (value.hasOwnProperty(key)) { - image.setAttribute(key === "className" ? "class" : key, value[key]); - } - } - return; - } - - // Otherwise lets create the image - image = doc.createElement(NODE_NAME); - - for (var i in value) { - image.setAttribute(i === "className" ? "class" : i, value[i]); - } - - composer.selection.insertNode(image); - if (wysihtml5.browser.hasProblemsSettingCaretAfterImg()) { - textNode = doc.createTextNode(wysihtml5.INVISIBLE_SPACE); - composer.selection.insertNode(textNode); - composer.selection.setAfter(textNode); - } else { - composer.selection.setAfter(image); - } - }, - - state: function(composer) { - var doc = composer.doc, - selectedNode, - text, - imagesInSelection; - - if (!wysihtml5.dom.hasElementWithTagName(doc, NODE_NAME)) { - return false; - } - - selectedNode = composer.selection.getSelectedNode(); - if (!selectedNode) { - return false; - } - - if (selectedNode.nodeName === NODE_NAME) { - // This works perfectly in IE - return selectedNode; - } - - if (selectedNode.nodeType !== wysihtml5.ELEMENT_NODE) { - return false; - } - - text = composer.selection.getText(); - text = wysihtml5.lang.string(text).trim(); - if (text) { - return false; - } - - imagesInSelection = composer.selection.getNodes(wysihtml5.ELEMENT_NODE, function(node) { - return node.nodeName === "IMG"; - }); - - if (imagesInSelection.length !== 1) { - return false; - } - - return imagesInSelection[0]; - } - }; -})(wysihtml5); -;(function(wysihtml5) { - var LINE_BREAK = "
    " + (wysihtml5.browser.needsSpaceAfterLineBreak() ? " " : ""); +}(wysihtml)); +;(function(wysihtml) { + var LINE_BREAK = "
    " + (wysihtml.browser.needsSpaceAfterLineBreak() ? " " : ""); - wysihtml5.commands.insertLineBreak = { + wysihtml.commands.insertLineBreak = { exec: function(composer, command) { composer.selection.insertHTML(LINE_BREAK); }, @@ -15813,30 +14801,8 @@ wysihtml5.Commands = Base.extend( return false; } }; -})(wysihtml5); -;(function(wysihtml5){ - wysihtml5.commands.insertOrderedList = { - exec: function(composer, command) { - wysihtml5.commands.insertList.exec(composer, command, "OL"); - }, - - state: function(composer, command) { - return wysihtml5.commands.insertList.state(composer, command, "OL"); - } - }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.insertUnorderedList = { - exec: function(composer, command) { - wysihtml5.commands.insertList.exec(composer, command, "UL"); - }, - - state: function(composer, command) { - return wysihtml5.commands.insertList.state(composer, command, "UL"); - } - }; -}(wysihtml5)); -;wysihtml5.commands.insertList = (function(wysihtml5) { +})(wysihtml); +;wysihtml.commands.insertList = (function(wysihtml) { var isNode = function(node, name) { if (node && node.nodeName) { @@ -15859,7 +14825,7 @@ wysihtml5.Commands = Base.extend( }; if (node) { - var parentLi = wysihtml5.dom.getParentElement(node, { query: "li" }, false, composer.element), + var parentLi = wysihtml.dom.getParentElement(node, { query: "li" }, false, composer.element), otherNodeName = (nodeName === "UL") ? "OL" : "UL"; if (isNode(node, nodeName)) { @@ -15901,15 +14867,15 @@ wysihtml5.Commands = Base.extend( otherLists = getListsInSelection(otherNodeName, composer); if (otherLists.length) { for (var l = otherLists.length; l--;) { - wysihtml5.dom.renameElement(otherLists[l], nodeName.toLowerCase()); + wysihtml.dom.renameElement(otherLists[l], nodeName.toLowerCase()); } } else { innerLists = getListsInSelection(['OL', 'UL'], composer); for (var i = innerLists.length; i--;) { - wysihtml5.dom.resolveList(innerLists[i], composer.config.useLineBreaks); + wysihtml.dom.resolveList(innerLists[i], composer.config.useLineBreaks); } if (innerLists.length === 0) { - wysihtml5.dom.resolveList(el, composer.config.useLineBreaks); + wysihtml.dom.resolveList(el, composer.config.useLineBreaks); } } }); @@ -15927,7 +14893,7 @@ wysihtml5.Commands = Base.extend( // All selection inner lists get renamed too for (var l = renameLists.length; l--;) { - wysihtml5.dom.renameElement(renameLists[l], nodeName.toLowerCase()); + wysihtml.dom.renameElement(renameLists[l], nodeName.toLowerCase()); } }); }; @@ -15961,10 +14927,10 @@ wysihtml5.Commands = Base.extend( // This space causes new lists to never break on enter var INVISIBLE_SPACE_REG_EXP = /\uFEFF/g; - tempElement.innerHTML = tempElement.innerHTML.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + tempElement.innerHTML = tempElement.innerHTML.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); if (tempElement) { isEmpty = (/^(\s|(
    ))+$/i).test(tempElement.innerHTML); - list = wysihtml5.dom.convertToList(tempElement, nodeName.toLowerCase(), composer.parent.config.classNames.uneditableContainer); + list = wysihtml.dom.convertToList(tempElement, nodeName.toLowerCase(), composer.parent.config.classNames.uneditableContainer); if (sel) { rangy.restoreSelection(sel); } @@ -15988,18 +14954,18 @@ wysihtml5.Commands = Base.extend( anode = [fnode, fnode = anode][0]; } - if (wysihtml5.dom.domNode(fnode).is.emptyTextNode(true) && fnode) { - fnode = wysihtml5.dom.domNode(fnode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + if (wysihtml.dom.domNode(fnode).is.emptyTextNode(true) && fnode) { + fnode = wysihtml.dom.domNode(fnode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); } - if (wysihtml5.dom.domNode(anode).is.emptyTextNode(true) && anode) { - anode = wysihtml5.dom.domNode(anode).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + if (wysihtml.dom.domNode(anode).is.emptyTextNode(true) && anode) { + anode = wysihtml.dom.domNode(anode).next({nodeTypes: [1,3], ignoreBlankTexts: true}); } if (anode && fnode) { if (anode === fnode) { selectedNode = anode; } else { - selectedNode = wysihtml5.dom.domNode(anode).commonAncestor(fnode, composer.element); + selectedNode = wysihtml.dom.domNode(anode).commonAncestor(fnode, composer.element); } } else { selectedNode = composer.selection.getSelectedNode(); @@ -16028,174 +14994,9 @@ wysihtml5.Commands = Base.extend( } }; -})(wysihtml5); -;(function(wysihtml5){ - - var nodeOptions = { - nodeName: "I", - toggle: true - }; - - wysihtml5.commands.italic = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); -;(function(wysihtml5) { - - var nodeOptions = { - className: "wysiwyg-text-align-center", - classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, - toggle: true - }; - - wysihtml5.commands.justifyCenter = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - className: "wysiwyg-text-align-left", - classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, - toggle: true - }; - - wysihtml5.commands.justifyLeft = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - className: "wysiwyg-text-align-right", - classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, - toggle: true - }; - - wysihtml5.commands.justifyRight = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - className: "wysiwyg-text-align-justify", - classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, - toggle: true - }; - - wysihtml5.commands.justifyFull = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "right", - toggle: true - }; - - wysihtml5.commands.alignRightStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "left", - toggle: true - }; - - wysihtml5.commands.alignLeftStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "center", - toggle: true - }; - - wysihtml5.commands.alignCenterStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "justify", - toggle: true - }; - - wysihtml5.commands.alignJustifyStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5){ - wysihtml5.commands.redo = { +})(wysihtml); +;(function(wysihtml){ + wysihtml.commands.redo = { exec: function(composer) { return composer.undoManager.redo(); }, @@ -16204,27 +15005,9 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - - var nodeOptions = { - nodeName: "U", - toggle: true - }; - - wysihtml5.commands.underline = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.undo = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.undo = { exec: function(composer) { return composer.undoManager.undo(); }, @@ -16233,9 +15016,9 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.createTable = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.createTable = { exec: function(composer, command, value) { var col, row, html; if (value && value.cols && value.rows && parseInt(value.cols, 10) > 0 && parseInt(value.rows, 10) > 0) { @@ -16263,15 +15046,15 @@ wysihtml5.Commands = Base.extend( } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.mergeTableCells = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.mergeTableCells = { exec: function(composer, command) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { if (this.state(composer, command)) { - wysihtml5.dom.table.unmergeCell(composer.tableSelection.start); + wysihtml.dom.table.unmergeCell(composer.tableSelection.start); } else { - wysihtml5.dom.table.mergeCellsBetween(composer.tableSelection.start, composer.tableSelection.end); + wysihtml.dom.table.mergeCellsBetween(composer.tableSelection.start, composer.tableSelection.end); } } }, @@ -16282,11 +15065,11 @@ wysihtml5.Commands = Base.extend( end = composer.tableSelection.end; if (start && end && start == end && (( - wysihtml5.dom.getAttribute(start, "colspan") && - parseInt(wysihtml5.dom.getAttribute(start, "colspan"), 10) > 1 + wysihtml.dom.getAttribute(start, "colspan") && + parseInt(wysihtml.dom.getAttribute(start, "colspan"), 10) > 1 ) || ( - wysihtml5.dom.getAttribute(start, "rowspan") && - parseInt(wysihtml5.dom.getAttribute(start, "rowspan"), 10) > 1 + wysihtml.dom.getAttribute(start, "rowspan") && + parseInt(wysihtml.dom.getAttribute(start, "rowspan"), 10) > 1 )) ) { return [start]; @@ -16295,18 +15078,18 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.addTableCells = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.addTableCells = { exec: function(composer, command, value) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { // switches start and end if start is bigger than end (reverse selection) - var tableSelect = wysihtml5.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end); + var tableSelect = wysihtml.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end); if (value == "before" || value == "above") { - wysihtml5.dom.table.addCells(tableSelect.start, value); + wysihtml.dom.table.addCells(tableSelect.start, value); } else if (value == "after" || value == "below") { - wysihtml5.dom.table.addCells(tableSelect.end, value); + wysihtml.dom.table.addCells(tableSelect.end, value); } setTimeout(function() { composer.tableSelection.select(tableSelect.start, tableSelect.end); @@ -16318,31 +15101,31 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.deleteTableCells = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.deleteTableCells = { exec: function(composer, command, value) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { - var tableSelect = wysihtml5.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end), - idx = wysihtml5.dom.table.indexOf(tableSelect.start), + var tableSelect = wysihtml.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end), + idx = wysihtml.dom.table.indexOf(tableSelect.start), selCell, table = composer.tableSelection.table; - wysihtml5.dom.table.removeCells(tableSelect.start, value); + wysihtml.dom.table.removeCells(tableSelect.start, value); setTimeout(function() { // move selection to next or previous if not present - selCell = wysihtml5.dom.table.findCell(table, idx); + selCell = wysihtml.dom.table.findCell(table, idx); if (!selCell){ if (value == "row") { - selCell = wysihtml5.dom.table.findCell(table, { + selCell = wysihtml.dom.table.findCell(table, { "row": idx.row - 1, "col": idx.col }); } if (value == "column") { - selCell = wysihtml5.dom.table.findCell(table, { + selCell = wysihtml.dom.table.findCell(table, { "row": idx.row, "col": idx.col - 1 }); @@ -16359,9 +15142,9 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.indentList = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.indentList = { exec: function(composer, command, value) { var listEls = composer.selection.getSelectionParentsByTag('LI'); if (listEls) { @@ -16384,7 +15167,7 @@ wysihtml5.Commands = Base.extend( liNode = liNodes[i]; listTag = (liNode.parentNode.nodeName === 'OL') ? 'OL' : 'UL'; list = liNode.ownerDocument.createElement(listTag); - prevLi = wysihtml5.dom.domNode(liNode).prev({nodeTypes: [wysihtml5.ELEMENT_NODE]}); + prevLi = wysihtml.dom.domNode(liNode).prev({nodeTypes: [wysihtml.ELEMENT_NODE]}); prevLiList = (prevLi) ? prevLi.querySelector('ul, ol') : null; if (prevLi) { @@ -16402,10 +15185,10 @@ wysihtml5.Commands = Base.extend( return found; } }; -}(wysihtml5)); -;(function(wysihtml5){ +}(wysihtml)); +;(function(wysihtml){ - wysihtml5.commands.outdentList = { + wysihtml.commands.outdentList = { exec: function(composer, command, value) { var listEls = composer.selection.getSelectionParentsByTag('LI'); if (listEls) { @@ -16433,8 +15216,8 @@ wysihtml5.Commands = Base.extend( if (listNode.tagName === 'OL' || listNode.tagName === 'UL') { found = true; - outerListNode = wysihtml5.dom.getParentElement(listNode.parentNode, { query: 'ol, ul' }, false, composer.element); - outerLiNode = wysihtml5.dom.getParentElement(listNode.parentNode, { query: 'li' }, false, composer.element); + outerListNode = wysihtml.dom.getParentElement(listNode.parentNode, { query: 'ol, ul' }, false, composer.element); + outerLiNode = wysihtml.dom.getParentElement(listNode.parentNode, { query: 'li' }, false, composer.element); if (outerListNode && outerLiNode) { @@ -16483,46 +15266,12 @@ wysihtml5.Commands = Base.extend( } }; -}(wysihtml5)); -;(function(wysihtml5){ - - var nodeOptions = { - nodeName: "SUB", - toggle: true - }; - - wysihtml5.commands.subscript = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; -}(wysihtml5)); -;(function(wysihtml5) { - - var nodeOptions = { - nodeName: "SUP", - toggle: true - }; - - wysihtml5.commands.superscript = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; -}(wysihtml5)); +}(wysihtml)); ;/** * Undo Manager for wysihtml5 * slightly inspired by http://rniwa.com/editing/undomanager.html#the-undomanager-interface */ -(function(wysihtml5) { +(function(wysihtml) { var Z_KEY = 90, Y_KEY = 89, BACKSPACE_KEY = 8, @@ -16530,9 +15279,9 @@ wysihtml5.Commands = Base.extend( MAX_HISTORY_ENTRIES = 25, DATA_ATTR_NODE = "data-wysihtml5-selection-node", DATA_ATTR_OFFSET = "data-wysihtml5-selection-offset", - UNDO_HTML = '' + wysihtml5.INVISIBLE_SPACE + '', - REDO_HTML = '' + wysihtml5.INVISIBLE_SPACE + '', - dom = wysihtml5.dom; + UNDO_HTML = '' + wysihtml.INVISIBLE_SPACE + '', + REDO_HTML = '' + wysihtml.INVISIBLE_SPACE + '', + dom = wysihtml.dom; function cleanTempElements(doc) { var tempElement; @@ -16541,8 +15290,8 @@ wysihtml5.Commands = Base.extend( } } - wysihtml5.UndoManager = wysihtml5.lang.Dispatcher.extend( - /** @scope wysihtml5.UndoManager.prototype */ { + wysihtml.UndoManager = wysihtml.lang.Dispatcher.extend( + /** @scope wysihtml.UndoManager.prototype */ { constructor: function(editor) { this.editor = editor; this.composer = editor.composer; @@ -16630,7 +15379,7 @@ wysihtml5.Commands = Base.extend( node = (range && range.startContainer) ? range.startContainer : this.element; offset = (range && range.startOffset) ? range.startOffset : 0; - if (node.nodeType === wysihtml5.ELEMENT_NODE) { + if (node.nodeType === wysihtml.ELEMENT_NODE) { element = node; } else { element = node.parentNode; @@ -16732,12 +15481,12 @@ wysihtml5.Commands = Base.extend( return parent.childNodes[index]; } }); -})(wysihtml5); +})(wysihtml); ;/** * TODO: the following methods still need unit test coverage */ -wysihtml5.views.View = Base.extend( - /** @scope wysihtml5.views.View.prototype */ { +wysihtml.views.View = Base.extend( + /** @scope wysihtml.views.View.prototype */ { constructor: function(parent, textareaElement, config) { this.parent = parent; this.element = textareaElement; @@ -16787,12 +15536,12 @@ wysihtml5.views.View = Base.extend( this.element.removeAttribute("disabled"); } }); -;(function(wysihtml5) { - var dom = wysihtml5.dom, - browser = wysihtml5.browser; +;(function(wysihtml) { + var dom = wysihtml.dom, + browser = wysihtml.browser; - wysihtml5.views.Composer = wysihtml5.views.View.extend( - /** @scope wysihtml5.views.Composer.prototype */ { + wysihtml.views.Composer = wysihtml.views.View.extend( + /** @scope wysihtml.views.Composer.prototype */ { name: "composer", constructor: function(parent, editableElement, config) { @@ -16814,7 +15563,7 @@ wysihtml5.views.View = Base.extend( }, getValue: function(parse, clearInternals) { - var value = this.isEmpty() ? "" : wysihtml5.quirks.getCorrectInnerHTML(this.element); + var value = this.isEmpty() ? "" : wysihtml.quirks.getCorrectInnerHTML(this.element); if (parse !== false) { value = this.parent.parse(value, (clearInternals === false) ? false : true); } @@ -16876,7 +15625,7 @@ wysihtml5.views.View = Base.extend( // IE 8 fires the focus event after .focus() // This is needed by our simulate_placeholder.js to work // therefore we clear it ourselves this time - if (wysihtml5.browser.doesAsyncFocus() && this.hasPlaceholderSet()) { + if (wysihtml.browser.doesAsyncFocus() && this.hasPlaceholderSet()) { this.clear(); } @@ -16996,10 +15745,10 @@ wysihtml5.views.View = Base.extend( } // Make sure our selection handler is ready - this.selection = new wysihtml5.Selection(this.parent, this.element, this.config.classNames.uneditableContainer); + this.selection = new wysihtml.Selection(this.parent, this.element, this.config.classNames.uneditableContainer); // Make sure commands dispatcher is ready - this.commands = new wysihtml5.Commands(this.parent); + this.commands = new wysihtml.Commands(this.parent); if (!this.config.noTextarea) { dom.copyAttributes([ @@ -17053,7 +15802,7 @@ wysihtml5.views.View = Base.extend( // IE sometimes leaves a single paragraph, which can't be removed by the user if (!browser.clearsContentEditableCorrectly()) { - wysihtml5.quirks.ensureProperClearing(this); + wysihtml.quirks.ensureProperClearing(this); } // Set up a sync that makes sure that textarea and editor have the same content @@ -17091,7 +15840,7 @@ wysihtml5.views.View = Base.extend( isInUneditable = false; for (var i = uneditables.length; i--;) { - if (wysihtml5.dom.contains(uneditables[i], nodeWithSelection)) { + if (wysihtml.dom.contains(uneditables[i], nodeWithSelection)) { isInUneditable = true; } } @@ -17114,7 +15863,7 @@ wysihtml5.views.View = Base.extend( // The autoLink helper method reveals a reg exp to detect correct urls urlRegExp = dom.autoLink.URL_REG_EXP, getTextContent = function(element) { - var textContent = wysihtml5.lang.string(dom.getTextContent(element)).trim(); + var textContent = wysihtml.lang.string(dom.getTextContent(element)).trim(); if (textContent.substr(0, 4) === "www.") { textContent = "http://" + textContent; } @@ -17181,13 +15930,13 @@ wysihtml5.views.View = Base.extend( } // After resizing IE sometimes forgets to remove the old resize handles - wysihtml5.quirks.redraw(element); + wysihtml.quirks.redraw(element); }); } }, _initUndoManager: function() { - this.undoManager = new wysihtml5.UndoManager(this.parent); + this.undoManager = new wysihtml.UndoManager(this.parent); }, _initLineBreaking: function() { @@ -17237,7 +15986,7 @@ wysihtml5.views.View = Base.extend( return; } - if (keyCode !== wysihtml5.ENTER_KEY && keyCode !== wysihtml5.BACKSPACE_KEY) { + if (keyCode !== wysihtml.ENTER_KEY && keyCode !== wysihtml.BACKSPACE_KEY) { return; } var blockElement = dom.getParentElement(that.selection.getSelectedNode(), { query: USE_NATIVE_LINE_BREAK_INSIDE_TAGS }, 4); @@ -17259,22 +16008,22 @@ wysihtml5.views.View = Base.extend( } } - if (keyCode === wysihtml5.ENTER_KEY && blockElement.nodeName.match(/^H[1-6]$/)) { + if (keyCode === wysihtml.ENTER_KEY && blockElement.nodeName.match(/^H[1-6]$/)) { adjust(selectedNode); } }, 0); return; } - if (that.config.useLineBreaks && keyCode === wysihtml5.ENTER_KEY && !wysihtml5.browser.insertsLineBreaksOnReturn()) { + if (that.config.useLineBreaks && keyCode === wysihtml.ENTER_KEY && !wysihtml.browser.insertsLineBreaksOnReturn()) { event.preventDefault(); that.commands.exec("insertLineBreak"); } }); } }); -})(wysihtml5); -;(function(wysihtml5) { - var dom = wysihtml5.dom, +})(wysihtml); +;(function(wysihtml) { + var dom = wysihtml.dom, doc = document, win = window, HOST_TEMPLATE = doc.createElement("div"), @@ -17318,7 +16067,7 @@ wysihtml5.views.View = Base.extend( "body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }", "body > p:first-child { margin-top: 0; }", "._wysihtml5-temp { display: none; }", - wysihtml5.browser.isGecko ? + wysihtml.browser.isGecko ? "body.placeholder { color: graytext !important; }" : "body.placeholder { color: #a9a9a9 !important; }", // Ensure that user see's broken images and can delete them @@ -17371,7 +16120,7 @@ wysihtml5.views.View = Base.extend( }; - wysihtml5.views.Composer.prototype.style = function() { + wysihtml.views.Composer.prototype.style = function() { var that = this, originalActiveElement = doc.querySelector(":focus"), textareaElement = this.textarea.element, @@ -17436,7 +16185,7 @@ wysihtml5.views.View = Base.extend( // Make sure that we don't change the display style of the iframe when copying styles oblur/onfocus // this is needed for when the change_view event is fired where the iframe is hidden and then // the blur event fires and re-displays it - var boxFormattingStyles = wysihtml5.lang.array(BOX_FORMATTING).without(["display"]); + var boxFormattingStyles = wysihtml.lang.array(BOX_FORMATTING).without(["display"]); // --------- restore focus --------- if (originalActiveElement) { @@ -17473,7 +16222,7 @@ wysihtml5.views.View = Base.extend( return this; }; -})(wysihtml5); +})(wysihtml); ;/** * Taking care of events * - Simulating 'change' event on contentEditable element @@ -17482,10 +16231,10 @@ wysihtml5.views.View = Base.extend( * - Dispatch proprietary newword:composer event * - Keyboard shortcuts */ -(function(wysihtml5) { - var dom = wysihtml5.dom, +(function(wysihtml) { + var dom = wysihtml.dom, domNode = dom.domNode, - browser = wysihtml5.browser, + browser = wysihtml.browser, /** * Map keyCodes to query commands */ @@ -17494,11 +16243,11 @@ wysihtml5.views.View = Base.extend( "73": "italic", // I "85": "underline" // U }; - + var actions = { // Adds multiple eventlisteners to target, bound to one callback - // TODO: If needed elsewhere make it part of wysihtml5.dom or sth + // TODO: If needed elsewhere make it part of wysihtml.dom or sth addListeners: function (target, events, callback) { for(var i = 0, max = events.length; i < max; i++) { target.addEventListener(events[i], callback, false); @@ -17506,7 +16255,7 @@ wysihtml5.views.View = Base.extend( }, // Removes multiple eventlisteners from target, bound to one callback - // TODO: If needed elsewhere make it part of wysihtml5.dom or sth + // TODO: If needed elsewhere make it part of wysihtml.dom or sth removeListeners: function (target, events, callback) { for(var i = 0, max = events.length; i < max; i++) { target.removeEventListener(events[i], callback, false); @@ -17518,7 +16267,7 @@ wysihtml5.views.View = Base.extend( if (composer.selection.caretIsLastInSelection()) { var sel = composer.selection.getSelection(), aNode = sel.anchorNode; - if (aNode && aNode.nodeType === 1 && (wysihtml5.dom.getParentElement(aNode, {query: 'td, th'}, false, composer.element) || force)) { + if (aNode && aNode.nodeType === 1 && (wysihtml.dom.getParentElement(aNode, {query: 'td, th'}, false, composer.element) || force)) { var nextNode = aNode.childNodes[sel.anchorOffset]; if (nextNode && nextNode.nodeType === 1 & nextNode.nodeName === "BR") { nextNode.parentNode.removeChild(nextNode); @@ -17552,9 +16301,9 @@ wysihtml5.views.View = Base.extend( var selection = composer.selection, prevNode = selection.getPreviousNode(); - if (selection.caretIsFirstInSelection(wysihtml5.browser.usesControlRanges()) && prevNode) { + if (selection.caretIsFirstInSelection(wysihtml.browser.usesControlRanges()) && prevNode) { if (prevNode.nodeType === 1 && - wysihtml5.dom.domNode(prevNode).is.block() && + wysihtml.dom.domNode(prevNode).is.block() && !domNode(prevNode).test({ query: "ol, ul, table, tr, dl" }) @@ -17568,7 +16317,7 @@ wysihtml5.views.View = Base.extend( var selNode = prevNode.lastChild, selectedNode = selection.getSelectedNode(), commonAncestorNode = domNode(prevNode).commonAncestor(selectedNode, composer.element), - curNode = wysihtml5.dom.getParentElement(selectedNode, { + curNode = wysihtml.dom.getParentElement(selectedNode, { query: "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote" }, false, commonAncestorNode || composer.element); @@ -17576,7 +16325,7 @@ wysihtml5.views.View = Base.extend( domNode(curNode).transferContentTo(prevNode, true); selection.setAfter(selNode); return true; - } else if (wysihtml5.browser.usesControlRanges()) { + } else if (wysihtml.browser.usesControlRanges()) { selectedNode = selection.getCaretNode(); domNode(selectedNode).transferContentTo(prevNode, true); selection.setAfter(selNode); @@ -17592,7 +16341,7 @@ wysihtml5.views.View = Base.extend( /* In IE when deleting with caret at the begining of LI, list gets broken into half instead of merging the LI with previous */ /* This does not match other browsers an is less intuitive from UI standpoint, thus has to be fixed */ fixDeleteInTheBeginningOfLi: function(composer) { - if (wysihtml5.browser.hasLiDeletingProblem()) { + if (wysihtml.browser.hasLiDeletingProblem()) { var selection = composer.selection.getSelection(), aNode = selection.anchorNode, listNode, prevNode, firstNode, @@ -17631,7 +16380,7 @@ wysihtml5.views.View = Base.extend( } return false; }, - + fixDeleteInTheBeginningOfControlSelection: function(composer) { var selection = composer.selection, prevNode = selection.getPreviousNode(), @@ -17666,8 +16415,8 @@ wysihtml5.views.View = Base.extend( }).bind(this); if( this.doc.execCommand && - wysihtml5.browser.supportsCommand(this.doc, "enableObjectResizing") && - wysihtml5.browser.supportsCommand(this.doc, "enableInlineTableEditing")) + wysihtml.browser.supportsCommand(this.doc, "enableObjectResizing") && + wysihtml.browser.supportsCommand(this.doc, "enableInlineTableEditing")) { if (this.sandbox.getIframe) { actions.addListeners(this.sandbox.getIframe(), ["focus", "mouseup", "mouseover"], iframeInitiator); @@ -17675,7 +16424,7 @@ wysihtml5.views.View = Base.extend( window.addEventListener('load', hideHandlers); } } - this.tableSelection = wysihtml5.quirks.tableCellsSelection(this.element, this.parent); + this.tableSelection = wysihtml.quirks.tableCellsSelection(this.element, this.parent); }, // Fixes some misbehaviours of enters in linebreaks mode (natively a bit unsupported feature) @@ -17723,7 +16472,7 @@ wysihtml5.views.View = Base.extend( composer.selection.setBefore(brNode); } - } else if (caretInfo.caretNode.nodeType === 3 && wysihtml5.browser.hasCaretBlockElementIssue() && caretInfo.textOffset === caretInfo.caretNode.data.length && !caretInfo.nextNode) { + } else if (caretInfo.caretNode.nodeType === 3 && wysihtml.browser.hasCaretBlockElementIssue() && caretInfo.textOffset === caretInfo.caretNode.data.length && !caretInfo.nextNode) { // This fixes annoying webkit issue when you press enter at the end of a block then seemingly nothing happens. // in reality one line break is generated and cursor is reported after it, but when entering something cursor jumps before the br @@ -17748,6 +16497,14 @@ wysihtml5.views.View = Base.extend( element = composer.element; if (selection.isCollapsed()) { + /** + * when the editor is empty in useLineBreaks = false mode, preserve + * the default value in it which is


    + */ + if (composer.isEmpty() && !composer.config.useLineBreaks) { + event.preventDefault(); + return; + } if (actions.handleUneditableDeletion(composer)) { event.preventDefault(); return; @@ -17764,7 +16521,7 @@ wysihtml5.views.View = Base.extend( event.preventDefault(); return; } - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { if (actions.fixDeleteInTheBeginningOfControlSelection(composer)) { event.preventDefault(); return; @@ -17858,7 +16615,7 @@ wysihtml5.views.View = Base.extend( if (this.config.copyedFromMarking) { // If supported the copied source can be based directly on selection // Very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection. - if (wysihtml5.browser.supportsModernPaste()) { + if (wysihtml.browser.supportsModernPaste()) { event.clipboardData.setData("text/html", this.config.copyedFromMarking + this.selection.getHtml()); event.clipboardData.setData("text/plain", this.selection.getPlainText()); event.preventDefault(); @@ -17869,7 +16626,7 @@ wysihtml5.views.View = Base.extend( var handleKeyUp = function(event) { var keyCode = event.keyCode; - if (keyCode === wysihtml5.SPACE_KEY || keyCode === wysihtml5.ENTER_KEY) { + if (keyCode === wysihtml.SPACE_KEY || keyCode === wysihtml.ENTER_KEY) { this.parent.fire("newword:composer"); } }; @@ -17880,15 +16637,15 @@ wysihtml5.views.View = Base.extend( var target = event.target, allImages = this.element.querySelectorAll('img'), notMyImages = this.element.querySelectorAll('.' + this.config.classNames.uneditableContainer + ' img'), - myImages = wysihtml5.lang.array(allImages).without(notMyImages); + myImages = wysihtml.lang.array(allImages).without(notMyImages); - if (target.nodeName === "IMG" && wysihtml5.lang.array(myImages).contains(target)) { + if (target.nodeName === "IMG" && wysihtml.lang.array(myImages).contains(target)) { this.selection.selectNode(target); } } // Saves mousedown position for IE controlSelect fix - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { this.selection.lastMouseDownPos = {x: event.clientX, y: event.clientY}; setTimeout(function() { delete this.selection.lastMouseDownPos; @@ -17916,7 +16673,7 @@ wysihtml5.views.View = Base.extend( if (this.config.classNames.uneditableContainer) { // If uneditables is configured, makes clicking on uneditable move caret after clicked element (so it can be deleted like text) // If uneditable needs text selection itself event.stopPropagation can be used to prevent this behaviour - var uneditable = wysihtml5.dom.getParentElement(event.target, { query: "." + this.config.classNames.uneditableContainer }, false, this.element); + var uneditable = wysihtml.dom.getParentElement(event.target, { query: "." + this.config.classNames.uneditableContainer }, false, this.element); if (uneditable) { this.selection.setAfter(uneditable); } @@ -17950,13 +16707,13 @@ wysihtml5.views.View = Base.extend( event.preventDefault(); } - if (keyCode === wysihtml5.BACKSPACE_KEY) { + if (keyCode === wysihtml.BACKSPACE_KEY) { // Delete key override for special cases handleDeleteKeyPress(event, this); } // Make sure that when pressing backspace/delete on selected images deletes the image and it's anchor - if (keyCode === wysihtml5.BACKSPACE_KEY || keyCode === wysihtml5.DELETE_KEY) { + if (keyCode === wysihtml.BACKSPACE_KEY || keyCode === wysihtml.DELETE_KEY) { target = this.selection.getSelectedNode(true); if (target && target.nodeName === "IMG") { event.preventDefault(); @@ -17967,18 +16724,18 @@ wysihtml5.views.View = Base.extend( parent.parentNode.removeChild(parent); } setTimeout((function() { - wysihtml5.quirks.redraw(this.element); + wysihtml.quirks.redraw(this.element); }).bind(this), 0); } } - if (this.config.handleTabKey && keyCode === wysihtml5.TAB_KEY) { + if (this.config.handleTabKey && keyCode === wysihtml.TAB_KEY) { // TAB key handling event.preventDefault(); handleTabKeyDown(this, this.element, event.shiftKey); } - if (keyCode === wysihtml5.ENTER_KEY) { + if (keyCode === wysihtml.ENTER_KEY) { handleEnterKeyPress(event, this); } @@ -17997,11 +16754,11 @@ wysihtml5.views.View = Base.extend( this.selection.getSelection().removeAllRanges(); }).bind(this), 0); }; - + // Testing requires actions to be accessible from out of scope - wysihtml5.views.Composer.prototype.observeActions = actions; + wysihtml.views.Composer.prototype.observeActions = actions; - wysihtml5.views.Composer.prototype.observe = function() { + wysihtml.views.Composer.prototype.observe = function() { var that = this, container = (this.sandbox.getIframe) ? this.sandbox.getIframe() : this.sandbox.getContentEditable(), element = this.element, @@ -18031,7 +16788,7 @@ wysihtml5.views.View = Base.extend( actions.addListeners(focusBlurElement, ["drop", "paste", "mouseup", "focus", "keyup"], handleUserInteraction.bind(this)); focusBlurElement.addEventListener("focus", handleFocus.bind(this), false); focusBlurElement.addEventListener("blur", handleBlur.bind(this), false); - + actions.addListeners(this.element, ["drop", "paste", "beforepaste"], handlePaste.bind(this), false); this.element.addEventListener("copy", handleCopy.bind(this), false); this.element.addEventListener("mousedown", handleMouseDown.bind(this), false); @@ -18041,7 +16798,7 @@ wysihtml5.views.View = Base.extend( this.element.addEventListener("keydown", handleKeyDown.bind(this), false); // IE controlselect madness fix - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { this.element.addEventListener('mscontrolselect', handleIEControlSelect.bind(this), false); } @@ -18050,15 +16807,15 @@ wysihtml5.views.View = Base.extend( }).bind(this), false); }; -})(wysihtml5); +})(wysihtml); ;/** * Class that takes care that the value of the composer and the textarea is always in sync */ -(function(wysihtml5) { +(function(wysihtml) { var INTERVAL = 400; - wysihtml5.views.Synchronizer = Base.extend( - /** @scope wysihtml5.views.Synchronizer.prototype */ { + wysihtml.views.Synchronizer = Base.extend( + /** @scope wysihtml.views.Synchronizer.prototype */ { constructor: function(editor, textarea, composer) { this.editor = editor; @@ -18074,7 +16831,7 @@ wysihtml5.views.View = Base.extend( * @param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the textarea */ fromComposerToTextarea: function(shouldParseHtml) { - this.textarea.setValue(wysihtml5.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml); + this.textarea.setValue(wysihtml.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml); }, /** @@ -18126,10 +16883,10 @@ wysihtml5.views.View = Base.extend( if (form) { // If the textarea is in a form make sure that after onreset and onsubmit the composer // has the correct state - wysihtml5.dom.observe(form, "submit", function() { + wysihtml.dom.observe(form, "submit", function() { that.sync(true); }); - wysihtml5.dom.observe(form, "reset", function() { + wysihtml.dom.observe(form, "reset", function() { setTimeout(function() { that.fromTextareaToComposer(); }, 0); }); } @@ -18147,11 +16904,11 @@ wysihtml5.views.View = Base.extend( this.editor.on("destroy:composer", stopInterval); } }); -})(wysihtml5); -;(function(wysihtml5) { +})(wysihtml); +;(function(wysihtml) { - wysihtml5.views.SourceView = Base.extend( - /** @scope wysihtml5.views.SourceView.prototype */ { + wysihtml.views.SourceView = Base.extend( + /** @scope wysihtml.views.SourceView.prototype */ { constructor: function(editor, composer) { this.editor = editor; @@ -18202,9 +16959,9 @@ wysihtml5.views.View = Base.extend( }); -})(wysihtml5); -;wysihtml5.views.Textarea = wysihtml5.views.View.extend( - /** @scope wysihtml5.views.Textarea.prototype */ { +})(wysihtml); +;wysihtml.views.Textarea = wysihtml.views.View.extend( + /** @scope wysihtml.views.Textarea.prototype */ { name: "textarea", constructor: function(parent, textareaElement, config) { @@ -18238,7 +16995,7 @@ wysihtml5.views.View = Base.extend( }, hasPlaceholderSet: function() { - var supportsPlaceholder = wysihtml5.browser.supportsPlaceholderAttributeOn(this.element), + var supportsPlaceholder = wysihtml.browser.supportsPlaceholderAttributeOn(this.element), placeholderText = this.element.getAttribute("placeholder") || null, value = this.element.value, isEmpty = !value; @@ -18246,7 +17003,7 @@ wysihtml5.views.View = Base.extend( }, isEmpty: function() { - return !wysihtml5.lang.string(this.element.value).trim() || this.hasPlaceholderSet(); + return !wysihtml.lang.string(this.element.value).trim() || this.hasPlaceholderSet(); }, _observe: function() { @@ -18260,15 +17017,15 @@ wysihtml5.views.View = Base.extend( * Calling focus() or blur() on an element doesn't synchronously trigger the attached focus/blur events * This is the case for focusin and focusout, so let's use them whenever possible, kkthxbai */ - events = wysihtml5.browser.supportsEvent("focusin") ? ["focusin", "focusout", "change"] : ["focus", "blur", "change"]; + events = wysihtml.browser.supportsEvent("focusin") ? ["focusin", "focusout", "change"] : ["focus", "blur", "change"]; parent.on("beforeload", function() { - wysihtml5.dom.observe(element, events, function(event) { + wysihtml.dom.observe(element, events, function(event) { var eventName = eventMapping[event.type] || event.type; parent.fire(eventName).fire(eventName + ":textarea"); }); - wysihtml5.dom.observe(element, ["paste", "drop"], function() { + wysihtml.dom.observe(element, ["paste", "drop"], function() { setTimeout(function() { parent.fire("paste").fire("paste:textarea"); }, 0); }); }); @@ -18305,7 +17062,7 @@ wysihtml5.views.View = Base.extend( * disable:composer * change_view */ -(function(wysihtml5) { +(function(wysihtml) { var undef; var defaultConfig = { @@ -18332,7 +17089,7 @@ wysihtml5.views.View = Base.extend( // Object which includes parser when the user inserts content via copy & paste. If null parserRules will be used instead pasteParserRulesets: null, // Parser method to use when the user inserts content - parser: wysihtml5.dom.parse, + parser: wysihtml.dom.parse, // By default wysihtml5 will insert a
    for line breaks, set this to false to use

    useLineBreaks: true, // Double enter (enter on blank line) exits block element in useLineBreaks mode. @@ -18367,16 +17124,16 @@ wysihtml5.views.View = Base.extend( copyedFromMarking: '' }; - wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend( - /** @scope wysihtml5.Editor.prototype */ { + wysihtml.Editor = wysihtml.lang.Dispatcher.extend( + /** @scope wysihtml.Editor.prototype */ { constructor: function(editableElement, config) { this.editableElement = typeof(editableElement) === "string" ? document.getElementById(editableElement) : editableElement; - this.config = wysihtml5.lang.object({}).merge(defaultConfig).merge(config).get(); - this._isCompatible = wysihtml5.browser.supported(); + this.config = wysihtml.lang.object({}).merge(defaultConfig).merge(config).get(); + this._isCompatible = wysihtml.browser.supported(); // merge classNames if (config && config.classNames) { - wysihtml5.lang.object(this.config.classNames).merge(config.classNames); + wysihtml.lang.object(this.config.classNames).merge(config.classNames); } if (this.editableElement.nodeName.toLowerCase() != "textarea") { @@ -18384,21 +17141,21 @@ wysihtml5.views.View = Base.extend( this.config.noTextarea = true; } if (!this.config.noTextarea) { - this.textarea = new wysihtml5.views.Textarea(this, this.editableElement, this.config); + this.textarea = new wysihtml.views.Textarea(this, this.editableElement, this.config); this.currentView = this.textarea; } // Sort out unsupported/unwanted browsers here - if (!this._isCompatible || (!this.config.supportTouchDevices && wysihtml5.browser.isTouchDevice())) { + if (!this._isCompatible || (!this.config.supportTouchDevices && wysihtml.browser.isTouchDevice())) { var that = this; setTimeout(function() { that.fire("beforeload").fire("load"); }, 0); return; } // Add class name to body, to indicate that the editor is supported - wysihtml5.dom.addClass(document.body, this.config.classNames.body); + wysihtml.dom.addClass(document.body, this.config.classNames.body); - this.composer = new wysihtml5.views.Composer(this, this.editableElement, this.config); + this.composer = new wysihtml.views.Composer(this, this.editableElement, this.config); this.currentView = this.composer; if (typeof(this.config.parser) === "function") { @@ -18410,12 +17167,15 @@ wysihtml5.views.View = Base.extend( handleBeforeLoad: function() { if (!this.config.noTextarea) { - this.synchronizer = new wysihtml5.views.Synchronizer(this, this.textarea, this.composer); + this.synchronizer = new wysihtml.views.Synchronizer(this, this.textarea, this.composer); } else { - this.sourceView = new wysihtml5.views.SourceView(this, this.composer); + this.sourceView = new wysihtml.views.SourceView(this, this.composer); } if (this.config.toolbar) { - this.toolbar = new wysihtml5.toolbar.Toolbar(this, this.config.toolbar, this.config.showToolbarAfterInit); + if (typeof wysihtml.toolbar === "undefined") { + throw Error("Toolbar not found. Make sure you're loading wysihtml-toolbar.js or wysihtml-toolbar.min.js"); + } + this.toolbar = new wysihtml.toolbar.Toolbar(this, this.config.toolbar, this.config.showToolbarAfterInit); } }, @@ -18496,7 +17256,7 @@ wysihtml5.views.View = Base.extend( "clearInternals" : clearInternals }); if (typeof(htmlOrElement) === "object") { - wysihtml5.quirks.redraw(htmlOrElement); + wysihtml.quirks.redraw(htmlOrElement); } return returnValue; }, @@ -18508,10 +17268,10 @@ wysihtml5.views.View = Base.extend( _initParser: function() { var oldHtml; - if (wysihtml5.browser.supportsModernPaste()) { + if (wysihtml.browser.supportsModernPaste()) { this.on("paste:composer", function(event) { event.preventDefault(); - oldHtml = wysihtml5.dom.getPastedHtml(event); + oldHtml = wysihtml.dom.getPastedHtml(event); if (oldHtml) { this._cleanAndPaste(oldHtml); } @@ -18522,7 +17282,7 @@ wysihtml5.views.View = Base.extend( event.preventDefault(); var scrollPos = this.composer.getScrollPos(); - wysihtml5.dom.getPastedHtmlWithDiv(this.composer, function(pastedHTML) { + wysihtml.dom.getPastedHtmlWithDiv(this.composer, function(pastedHTML) { if (pastedHTML) { this._cleanAndPaste(pastedHTML); } @@ -18534,7 +17294,7 @@ wysihtml5.views.View = Base.extend( }, _cleanAndPaste: function (oldHtml) { - var cleanHtml = wysihtml5.quirks.cleanPastedHTML(oldHtml, { + var cleanHtml = wysihtml.quirks.cleanPastedHTML(oldHtml, { "referenceNode": this.composer.element, "rules": this.config.pasteParserRulesets || [{"set": this.config.parserRules}], "uneditableClass": this.config.classNames.uneditableContainer @@ -18543,7 +17303,7 @@ wysihtml5.views.View = Base.extend( this.composer.selection.insertHTML(cleanHtml); } }); -})(wysihtml5); +})(wysihtml); ;/** * Toolbar Dialog * @@ -18565,7 +17325,7 @@ wysihtml5.views.View = Base.extend( * * * */ -(function(wysihtml5) { - var dom = wysihtml5.dom, +(function(wysihtml) { + var dom = wysihtml.dom, CLASS_NAME_OPENED = "wysihtml5-command-dialog-opened", SELECTOR_FORM_ELEMENTS = "input, select, textarea", SELECTOR_FIELDS = "[data-wysihtml5-dialog-field]", ATTRIBUTE_FIELDS = "data-wysihtml5-dialog-field"; - wysihtml5.toolbar.Dialog = wysihtml5.lang.Dispatcher.extend( - /** @scope wysihtml5.toolbar.Dialog.prototype */ { + wysihtml.toolbar.Dialog = wysihtml.lang.Dispatcher.extend( + /** @scope wysihtml.toolbar.Dialog.prototype */ { constructor: function(link, container) { this.link = link; this.container = container; @@ -18611,10 +17371,10 @@ wysihtml5.views.View = Base.extend( dom.observe(this.container, "keydown", function(event) { var keyCode = event.keyCode; - if (keyCode === wysihtml5.ENTER_KEY) { + if (keyCode === wysihtml.ENTER_KEY) { callbackWrapper(event); } - if (keyCode === wysihtml5.ESCAPE_KEY) { + if (keyCode === wysihtml.ESCAPE_KEY) { that.cancel(); } }); @@ -18738,7 +17498,7 @@ wysihtml5.views.View = Base.extend( this.fire("cancel"); } }); -})(wysihtml5); //jshint ignore:line +})(wysihtml); //jshint ignore:line ;/** * Converts speech-to-text and inserts this into the editor * As of now (2011/03/25) this only is supported in Chrome >= 11 @@ -18752,8 +17512,8 @@ wysihtml5.views.View = Base.extend( * "Accessing Google Speech API Chrome 11" * http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/ */ -(function(wysihtml5) { - var dom = wysihtml5.dom; +(function(wysihtml) { + var dom = wysihtml.dom; var linkStyles = { position: "relative" @@ -18787,9 +17547,9 @@ wysihtml5.views.View = Base.extend( "speech": "" }; - wysihtml5.toolbar.Speech = function(parent, link) { + wysihtml.toolbar.Speech = function(parent, link) { var input = document.createElement("input"); - if (!wysihtml5.browser.supportsSpeechApiOn(input)) { + if (!wysihtml.browser.supportsSpeechApiOn(input)) { link.style.display = "none"; return; } @@ -18800,7 +17560,7 @@ wysihtml5.views.View = Base.extend( var wrapper = document.createElement("div"); - wysihtml5.lang.object(wrapperStyles).merge({ + wysihtml.lang.object(wrapperStyles).merge({ width: link.offsetWidth + "px", height: link.offsetHeight + "px" }); @@ -18828,7 +17588,7 @@ wysihtml5.views.View = Base.extend( event.stopPropagation(); }); }; -})(wysihtml5); +})(wysihtml); ;/** * Toolbar * @@ -18842,18 +17602,18 @@ wysihtml5.views.View = Base.extend( * * * */ -(function(wysihtml5) { +(function(wysihtml) { var CLASS_NAME_COMMAND_DISABLED = "wysihtml5-command-disabled", CLASS_NAME_COMMANDS_DISABLED = "wysihtml5-commands-disabled", CLASS_NAME_COMMAND_ACTIVE = "wysihtml5-command-active", CLASS_NAME_ACTION_ACTIVE = "wysihtml5-action-active", - dom = wysihtml5.dom; + dom = wysihtml.dom; - wysihtml5.toolbar.Toolbar = Base.extend( - /** @scope wysihtml5.toolbar.Toolbar.prototype */ { + wysihtml.toolbar.Toolbar = Base.extend( + /** @scope wysihtml.toolbar.Toolbar.prototype */ { constructor: function(editor, container, showOnInit) { this.editor = editor; this.container = typeof(container) === "string" ? document.getElementById(container) : container; @@ -18882,12 +17642,12 @@ wysihtml5.views.View = Base.extend( length = speechInputLinks.length, i = 0; for (; i element or wrap current selection in

    * toolbar.execCommand("formatBlock", "blockquote"); */ @@ -19055,7 +17815,7 @@ wysihtml5.views.View = Base.extend( }); this._ownerDocumentClick = function(event) { - if (!wysihtml5.dom.contains(that.container, event.target) && !wysihtml5.dom.contains(that.composer.element, event.target)) { + if (!wysihtml.dom.contains(that.container, event.target) && !wysihtml.dom.contains(that.composer.element, event.target)) { that._updateLinkStates(); that._preventInstantFocus(); } @@ -19211,26 +17971,26 @@ wysihtml5.views.View = Base.extend( // to avoid showing a dialog for multiple selected elements which may have different attributes // eg. when two links with different href are selected, the state will be an array consisting of both link elements // but the dialog interface can only update one - if (!command.dialog.multiselect && wysihtml5.lang.object(state).isArray()) { + if (!command.dialog.multiselect && wysihtml.lang.object(state).isArray()) { state = state.length === 1 ? state[0] : true; } return state; } -})(wysihtml5); -;(function(wysihtml5) { - wysihtml5.toolbar.Dialog_createTable = wysihtml5.toolbar.Dialog.extend({ +})(wysihtml); +;(function(wysihtml) { + wysihtml.toolbar.Dialog_createTable = wysihtml.toolbar.Dialog.extend({ show: function(elementToChange) { this.base(elementToChange); } }); -})(wysihtml5); -;(function(wysihtml5) { +})(wysihtml); +;(function(wysihtml) { var SELECTOR_FIELDS = "[data-wysihtml5-dialog-field]", ATTRIBUTE_FIELDS = "data-wysihtml5-dialog-field"; - wysihtml5.toolbar.Dialog_foreColorStyle = wysihtml5.toolbar.Dialog.extend({ + wysihtml.toolbar.Dialog_foreColorStyle = wysihtml.toolbar.Dialog.extend({ multiselect: true, _serialize: function() { @@ -19247,12 +18007,12 @@ wysihtml5.views.View = Base.extend( _interpolate: function(avoidHiddenFields) { var field, colourMode, - styleParser = wysihtml5.quirks.styleParser, + styleParser = wysihtml.quirks.styleParser, focusedElement = document.querySelector(":focus"), fields = this.container.querySelectorAll(SELECTOR_FIELDS), length = fields.length, i = 0, - firstElement = (this.elementToChange) ? ((wysihtml5.lang.object(this.elementToChange).isArray()) ? this.elementToChange[0] : this.elementToChange) : null, + firstElement = (this.elementToChange) ? ((wysihtml.lang.object(this.elementToChange).isArray()) ? this.elementToChange[0] : this.elementToChange) : null, colourStr = (firstElement) ? firstElement.getAttribute("style") : null, colour = (colourStr) ? styleParser.parseColor(colourStr, "color") : null; @@ -19280,13 +18040,13 @@ wysihtml5.views.View = Base.extend( } }); -})(wysihtml5); -;(function(wysihtml5) { - var dom = wysihtml5.dom, +})(wysihtml); +;(function(wysihtml) { + var dom = wysihtml.dom, SELECTOR_FIELDS = "[data-wysihtml5-dialog-field]", ATTRIBUTE_FIELDS = "data-wysihtml5-dialog-field"; - wysihtml5.toolbar.Dialog_fontSizeStyle = wysihtml5.toolbar.Dialog.extend({ + wysihtml.toolbar.Dialog_fontSizeStyle = wysihtml.toolbar.Dialog.extend({ multiselect: true, _serialize: function() { @@ -19296,13 +18056,15 @@ wysihtml5.views.View = Base.extend( _interpolate: function(avoidHiddenFields) { var focusedElement = document.querySelector(":focus"), field = this.container.querySelector("[data-wysihtml5-dialog-field='size']"), - firstElement = (this.elementToChange) ? ((wysihtml5.lang.object(this.elementToChange).isArray()) ? this.elementToChange[0] : this.elementToChange) : null, + firstElement = (this.elementToChange) ? ((wysihtml.lang.object(this.elementToChange).isArray()) ? this.elementToChange[0] : this.elementToChange) : null, styleStr = (firstElement) ? firstElement.getAttribute('style') : null, - size = (styleStr) ? wysihtml5.quirks.styleParser.parseFontSize(styleStr) : null; + size = (styleStr) ? wysihtml.quirks.styleParser.parseFontSize(styleStr) : null; if (field && field !== focusedElement && size && !(/^\s*$/).test(size)) { field.value = size; } } }); -})(wysihtml5); +})(wysihtml); + +}); diff --git a/dist/wysihtml-toolbar.min.js b/dist/wysihtml-toolbar.min.js index 2bcf9ce..a5809e9 100644 --- a/dist/wysihtml-toolbar.min.js +++ b/dist/wysihtml-toolbar.min.js @@ -1,11 +1,11 @@ -/*! wysihtml - v0.5.5 (2016-01-06) */ +/*! wysihtml - v0.5.5 (2016-04-29) */ -var wysihtml5={version:"0.5.5",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",INVISIBLE_SPACE_REG_EXP:/\uFEFF/g,VOID_ELEMENTS:"area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, wbr",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,TAB_KEY:9,DELETE_KEY:46};wysihtml5.polyfills=function(a,b){function c(){try{var a=new CustomEvent("cat",{detail:{foo:"bar"}});return"cat"===a.type&&"bar"===a.detail.foo}catch(b){}return!1}String.prototype.trim||!function(){var a=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(a,"")}}(),function(){var c="addEventListener",d="removeEventListener";b[c]||(a.Element.prototype[c]=a[c]=b[c]=function(b,c,d){return(d=this).attachEvent("on"+b,function(b){var b=b||a.event;b.target=b.target||b.srcElement,b.preventDefault=b.preventDefault||function(){b.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){b.cancelBubble=!0},b.which=b.button?2===b.button?3:4===b.button?2:b.button:b.keyCode,c.call(d,b)})},a.Element.prototype[d]=a[d]=b[d]=function(a,b){return this.detachEvent("on"+a,b)})}(),Object.defineProperty&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(a.Element.prototype,"textContent")&&!Object.getOwnPropertyDescriptor(a.Element.prototype,"textContent").get&&!function(){var b=Object.getOwnPropertyDescriptor(a.Element.prototype,"innerText");Object.defineProperty(a.Element.prototype,"textContent",{get:function(){return b.get.call(this)},set:function(a){return b.set.call(this,a)}})}(),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){for(var c=this.length,d=-1,e=b>>>0;~(c-e);d=this[--c]===a?c:d);return d}),Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),function(a){a.matches=a.matches||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector||function(a){for(var b=this,c=(b.document||b.ownerDocument).querySelectorAll(a),d=0;c[d]&&c[d]!==b;)++d;return c[d]?!0:!1},a.closest=a.closest||function(a){for(var b=this;b&&!b.matches(a);)b=b.parentElement;return b}}(Element.prototype),"document"in a&&("classList"in b.createElement("_")?"DOMTokenList"in a&&!function(){"use strict";var c=b.createElement("_");if(c.classList.add("c1","c2"),!c.classList.contains("c2")){var d=function(b){var c=a.DOMTokenList.prototype[b];a.DOMTokenList.prototype[b]=function(a){var b,d=arguments.length;for(b=0;d>b;b++)a=arguments[b],c.call(this,a)}};d("add"),d("remove")}if(c.classList.toggle("c3",!1),c.classList.contains("c3")){var e=a.DOMTokenList.prototype.toggle;a.DOMTokenList.prototype.toggle=function(a,b){return 1 in arguments&&!this.contains(a)==!b?b:e.call(this,a)}}c=null}():!function(a){"use strict";if("Element"in a){var b="classList",c="prototype",d=a.Element[c],e=Object,f=String[c].trim||function(){return this.replace(/^\s+|\s+$/g,"")},g=Array[c].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},h=function(a,b){this.name=a,this.code=DOMException[a],this.message=b},i=function(a,b){if(""===b)throw new h("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(b))throw new h("INVALID_CHARACTER_ERR","String contains an invalid character");return g.call(a,b)},j=function(a){for(var b=f.call(a.getAttribute("class")||""),c=b?b.split(/\s+/):[],d=0,e=c.length;e>d;d++)this.push(c[d]);this._updateClassName=function(){a.setAttribute("class",this.toString())}},k=j[c]=[],l=function(){return new j(this)};if(h[c]=Error[c],k.item=function(a){return this[a]||null},k.contains=function(a){return a+="",-1!==i(this,a)},k.add=function(){var a,b=arguments,c=0,d=b.length,e=!1;do a=b[c]+"",-1===i(this,a)&&(this.push(a),e=!0);while(++c0?c.childNodes[d]:void 0,h=b.focusNode,i=b.focusOffset,j=h&&1===h.nodeType&&i>0?h.childNodes[i-1]:void 0,k=this.ownerDocument.createRange(),l=a.shift(),m=l?a.shift():null;for(j&&3===j.nodeType&&(h=j,i=j.nodeValue.length,j=void 0),g&&3===g.nodeType&&(c=g,d=0,g=void 0),(c===h&&d>i||c!==h&&c.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_PRECEDING&&!(c.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_CONTAINS))&&(h=[c,c=h][0],i=[d,d=i][0]);l&&m;)m.previousSibling&&m.previousSibling===l?(c===m&&(c=l,d=l.nodeValue.length+d),h===m&&(h=l,i=l.nodeValue.length+i),l.nodeValue=l.nodeValue+m.nodeValue,m.parentNode.removeChild(m),m=a.shift()):(l=m,m=a.shift());j&&(i=Array.prototype.indexOf.call(j.parentNode.childNodes,j)+1),g&&(d=Array.prototype.indexOf.call(g.parentNode.childNodes,g)),f(this)&&c&&c.parentNode&&h&&h.parentNode&&(k.setStart(c,d),k.setEnd(h,i),b.removeAllRanges(),b.addRange(k))});Node.prototype.normalize=a},h=function(){window.removeEventListener("load",h),"Node"in window&&"normalize"in Node.prototype&&d()&&g()};"complete"!==b.readyState?window.addEventListener("load",h):h();var i=c();!function(){function c(a,c){c=c||{bubbles:!1,cancelable:!1,detail:void 0};var d=b.createEvent("CustomEvent");return d.initCustomEvent(a,c.bubbles,c.cancelable,c.detail),d}!i&&"CustomEvent"in window&&(c.prototype=a.Event.prototype,a.CustomEvent=c,i=!0)}()},wysihtml5.polyfills(window,document),function(a,b){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a():b.rangy=a()}(function(){function a(a,b){var c=typeof a[b];return c==u||!(c!=t||!a[b])||"unknown"==c}function b(a,b){return!(typeof a[b]!=t||!a[b])}function c(a,b){return typeof a[b]!=v}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&A(a,z)&&C(a,y)}function f(a){return b(a,"body")?a.body:a.getElementsByTagName("body")[0]}function g(b){typeof console!=v&&a(console,"log")&&console.log(b)}function h(a,b){F&&b?alert(a):g(a)}function i(a){H.initialized=!0,H.supported=!1,h("Rangy is not supported in this environment. Reason: "+a,H.config.alertOnFail)}function j(a){h("Rangy warning: "+a,H.config.alertOnWarn)}function k(a){return a.message||a.description||String(a)}function l(){if(F&&!H.initialized){var b,c=!1,d=!1;a(document,"createRange")&&(b=document.createRange(),A(b,x)&&C(b,w)&&(c=!0));var h=f(document);if(!h||"body"!=h.nodeName.toLowerCase())return void i("No body element found");if(h&&a(h,"createTextRange")&&(b=h.createTextRange(),e(b)&&(d=!0)),!c&&!d)return void i("Neither Range nor TextRange are available");H.initialized=!0,H.features={implementsDomRange:c,implementsTextRange:d};var j,l;for(var m in E)(j=E[m])instanceof p&&j.init(j,H);for(var n=0,o=K.length;o>n;++n)try{K[n](H)}catch(q){l="Rangy init listener threw an exception. Continuing. Detail: "+k(q),g(l)}}}function m(a,b,c){c&&(a+=" in module "+c.name),H.warn("DEPRECATED: "+a+" is deprecated. Please use "+b+" instead.")}function n(a,b,c,d){a[b]=function(){return m(b,c,d),a[c].apply(a,G.toArray(arguments))}}function o(a){a=a||window,l();for(var b=0,c=L.length;c>b;++b)L[b](a)}function p(a,b,c){this.name=a,this.dependencies=b,this.initialized=!1,this.supported=!1,this.initializer=c}function q(a,b,c){var d=new p(a,b,function(b){if(!b.initialized){b.initialized=!0;try{c(H,b),b.supported=!0}catch(d){var e="Module '"+a+"' failed to load: "+k(d);g(e),d.stack&&g(d.stack)}}});return E[a]=d,d}function r(){}function s(){}var t="object",u="function",v="undefined",w=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],x=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],y=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],z=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],A=d(a),B=d(b),C=d(c),D=[].forEach?function(a,b){a.forEach(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)b(a[c],c)},E={},F=typeof window!=v&&typeof document!=v,G={isHostMethod:a,isHostObject:b,isHostProperty:c,areHostMethods:A,areHostObjects:B,areHostProperties:C,isTextRange:e,getBody:f,forEach:D},H={version:"1.3.0",initialized:!1,isBrowser:F,supported:!0,util:G,features:{},modules:E,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==v?!0:rangyAutoInitialize}};H.fail=i,H.warn=j;var I;({}).hasOwnProperty?(G.extend=I=function(a,b,c){var d,e;for(var f in b)b.hasOwnProperty(f)&&(d=a[f],e=b[f],c&&null!==d&&"object"==typeof d&&null!==e&&"object"==typeof e&&I(d,e,!0),a[f]=e);return b.hasOwnProperty("toString")&&(a.toString=b.toString),a},G.createOptions=function(a,b){var c={};return I(c,b),a&&I(c,a),c}):i("hasOwnProperty not supported"),F||i("Rangy can only run in a browser"),function(){var a;if(F){var b=document.createElement("div");b.appendChild(document.createElement("span"));var c=[].slice;try{1==c.call(b.childNodes,0)[0].nodeType&&(a=function(a){return c.call(a,0)})}catch(d){}}a||(a=function(a){for(var b=[],c=0,d=a.length;d>c;++c)b[c]=a[c];return b}),G.toArray=a}();var J;F&&(a(document,"addEventListener")?J=function(a,b,c){a.addEventListener(b,c,!1)}:a(document,"attachEvent")?J=function(a,b,c){a.attachEvent("on"+b,c)}:i("Document does not have required addEventListener or attachEvent method"),G.addListener=J);var K=[];G.deprecationNotice=m,G.createAliasForDeprecatedMethod=n,H.init=l,H.addInitListener=function(a){H.initialized?a(H):K.push(a)};var L=[];H.addShimListener=function(a){L.push(a)},F&&(H.shim=H.createMissingNativeApi=o,n(H,"createMissingNativeApi","shim")),p.prototype={init:function(){for(var a,b,c=this.dependencies||[],d=0,e=c.length;e>d;++d){if(b=c[d],a=E[b],!(a&&a instanceof p))throw new Error("required module '"+b+"' not found");if(a.init(),!a.supported)throw new Error("required module '"+b+"' not supported")}this.initializer(this)},fail:function(a){throw this.initialized=!0,this.supported=!1,new Error(a)},warn:function(a){H.warn("Module "+this.name+": "+a)},deprecationNotice:function(a,b){H.warn("DEPRECATED: "+a+" in module "+this.name+" is deprecated. Please use "+b+" instead")},createError:function(a){return new Error("Error in Rangy "+this.name+" module: "+a)}},H.createModule=function(a){var b,c;2==arguments.length?(b=arguments[1],c=[]):(b=arguments[2],c=arguments[1]);var d=q(a,c,b);H.initialized&&H.supported&&d.init()},H.createCoreModule=function(a,b,c){q(a,b,c)},H.RangePrototype=r,H.rangePrototype=new r,H.selectionPrototype=new s,H.createCoreModule("DomUtil",[],function(a,b){function c(a){var b;return typeof a.namespaceURI==F||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==b}function d(a){var b=a.parentNode;return 1==b.nodeType?b:null}function e(a){for(var b=0;a=a.previousSibling;)++b;return b}function f(a){switch(a.nodeType){case 7:case 10:return 0;case 3:case 8:return a.length;default:return a.childNodes.length}}function g(a,b){var c,d=[];for(c=a;c;c=c.parentNode)d.push(c);for(c=b;c;c=c.parentNode)if(K(d,c))return c;return null}function h(a,b,c){for(var d=c?b:b.parentNode;d;){if(d===a)return!0;d=d.parentNode}return!1}function i(a,b){return h(a,b,!0)}function j(a,b,c){for(var d,e=c?a:a.parentNode;e;){if(d=e.parentNode,d===b)return e;e=d}return null}function k(a){var b=a.nodeType;return 3==b||4==b||8==b}function l(a){if(!a)return!1;var b=a.nodeType;return 3==b||8==b}function m(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a}function n(a,b,c){var d=a.cloneNode(!1);if(d.deleteData(0,b),a.deleteData(b,a.length-b),m(d,a),c)for(var f,g=0;f=c[g++];)f.node==a&&f.offset>b?(f.node=d,f.offset-=b):f.node==a.parentNode&&f.offset>e(a)&&++f.offset;return d}function o(a){if(9==a.nodeType)return a;if(typeof a.ownerDocument!=F)return a.ownerDocument;if(typeof a.document!=F)return a.document;if(a.parentNode)return o(a.parentNode);throw b.createError("getDocument: no document found for node")}function p(a){var c=o(a);if(typeof c.defaultView!=F)return c.defaultView;if(typeof c.parentWindow!=F)return c.parentWindow;throw b.createError("Cannot get a window object for node")}function q(a){if(typeof a.contentDocument!=F)return a.contentDocument;if(typeof a.contentWindow!=F)return a.contentWindow.document;throw b.createError("getIframeDocument: No Document object found for iframe element")}function r(a){if(typeof a.contentWindow!=F)return a.contentWindow;if(typeof a.contentDocument!=F)return a.contentDocument.defaultView;throw b.createError("getIframeWindow: No Window object found for iframe element")}function s(a){return a&&G.isHostMethod(a,"setTimeout")&&G.isHostObject(a,"document")}function t(a,b,c){var d;if(a?G.isHostProperty(a,"nodeType")?d=1==a.nodeType&&"iframe"==a.tagName.toLowerCase()?q(a):o(a):s(a)&&(d=a.document):d=document,!d)throw b.createError(c+"(): Parameter must be a Window object or DOM node");return d}function u(a){for(var b;b=a.parentNode;)a=b;return a}function v(a,c,d,f){var h,i,k,l,m;if(a==d)return c===f?0:f>c?-1:1;if(h=j(d,a,!0))return c<=e(h)?-1:1;if(h=j(a,d,!0))return e(h)[index:"+e(a)+",length:"+a.childNodes.length+"]["+(a.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return a.nodeName}function y(a){for(var b,c=o(a).createDocumentFragment();b=a.firstChild;)c.appendChild(b);return c}function z(a,b,c){var d=H(a),e=a.createElement("div");e.contentEditable=""+!!c,b&&(e.innerHTML=b);var f=d.firstChild;return f?d.insertBefore(e,f):d.appendChild(e),e}function A(a){return a.parentNode.removeChild(a)}function B(a){this.root=a,this._next=a}function C(a){return new B(a)}function D(a,b){this.node=a,this.offset=b}function E(a){this.code=this[a],this.codeName=a,this.message="DOMException: "+this.codeName}var F="undefined",G=a.util,H=G.getBody;G.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method"),G.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var I=document.createElement("div");G.areHostMethods(I,["insertBefore","appendChild","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"]))||b.fail("Incomplete Element implementation"),G.isHostProperty(I,"innerHTML")||b.fail("Element is missing innerHTML property");var J=document.createTextNode("test");G.areHostMethods(J,["splitText","deleteData","insertData","appendData","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"])||!G.areHostProperties(J,["data"]))||b.fail("Incomplete Text Node implementation");var K=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},L=!1;!function(){var b=document.createElement("b");b.innerHTML="1";var c=b.firstChild;b.innerHTML="
    ",L=w(c),a.features.crashyTextNodes=L}();var M;typeof window.getComputedStyle!=F?M=function(a,b){return p(a).getComputedStyle(a,null)[b]}:typeof document.documentElement.currentStyle!=F?M=function(a,b){return a.currentStyle?a.currentStyle[b]:""}:b.fail("No means of obtaining computed style properties found"),B.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a,b,c=this._current=this._next;if(this._current)if(a=c.firstChild)this._next=a;else{for(b=null;c!==this.root&&!(b=c.nextSibling);)c=c.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}},D.prototype={equals:function(a){return!!a&&this.node===a.node&&this.offset==a.offset},inspect:function(){return"[DomPosition("+x(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},E.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},E.prototype.toString=function(){return this.message},a.dom={arrayContains:K,isHtmlNamespace:c,parentElement:d,getNodeIndex:e,getNodeLength:f,getCommonAncestor:g,isAncestorOf:h,isOrIsAncestorOf:i,getClosestAncestorIn:j,isCharacterDataNode:k,isTextOrCommentNode:l,insertAfter:m,splitDataNode:n,getDocument:o,getWindow:p,getIframeWindow:r,getIframeDocument:q,getBody:H,isWindow:s,getContentDocument:t,getRootContainer:u,comparePoints:v,isBrokenNode:w,inspectNode:x,getComputedStyleProperty:M,createTestElement:z,removeNode:A,fragmentFromNodeChildren:y,createIterator:C,DomPosition:D},a.DOMException=E}),H.createCoreModule("DomRange",["DomUtil"],function(a,b){function c(a,b){return 3!=a.nodeType&&(P(a,b.startContainer)||P(a,b.endContainer))}function d(a){return a.document||Q(a.startContainer)}function e(a){return W(a.startContainer)}function f(a){return new L(a.parentNode,O(a))}function g(a){return new L(a.parentNode,O(a)+1)}function h(a,b,c){var d=11==a.nodeType?a.firstChild:a;return N(b)?c==b.length?J.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:S(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]),d}function i(a,b,c){if(z(a),z(b),d(b)!=d(a))throw new M("WRONG_DOCUMENT_ERR");var e=R(a.startContainer,a.startOffset,b.endContainer,b.endOffset),f=R(a.endContainer,a.endOffset,b.startContainer,b.startOffset);return c?0>=e&&f>=0:0>e&&f>0}function j(a){for(var b,c,e,f=d(a.range).createDocumentFragment();c=a.next();){if(b=a.isPartiallySelectedSubtree(),c=c.cloneNode(!b),b&&(e=a.getSubtreeIterator(),c.appendChild(j(e)),e.detach()),10==c.nodeType)throw new M("HIERARCHY_REQUEST_ERR");f.appendChild(c)}return f}function k(a,b,c){var d,e;c=c||{stop:!1};for(var f,g;f=a.next();)if(a.isPartiallySelectedSubtree()){if(b(f)===!1)return void(c.stop=!0);if(g=a.getSubtreeIterator(),k(g,b,c),g.detach(),c.stop)return}else for(d=J.createIterator(f);e=d.next();)if(b(e)===!1)return void(c.stop=!0)}function l(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),l(b),b.detach()):a.remove()}function m(a){for(var b,c,e=d(a.range).createDocumentFragment();b=a.next();){if(a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),c=a.getSubtreeIterator(),b.appendChild(m(c)),c.detach()):a.remove(),10==b.nodeType)throw new M("HIERARCHY_REQUEST_ERR");e.appendChild(b)}return e}function n(a,b,c){var d,e=!(!b||!b.length),f=!!c;e&&(d=new RegExp("^("+b.join("|")+")$"));var g=[];return k(new p(a,!1),function(b){if((!e||d.test(b.nodeType))&&(!f||c(b))){var h=a.startContainer;if(b!=h||!N(h)||a.startOffset!=h.length){var i=a.endContainer;b==i&&N(i)&&0==a.endOffset||g.push(b)}}}),g}function o(a){var b="undefined"==typeof a.getName?"Range":a.getName();return"["+b+"("+J.inspectNode(a.startContainer)+":"+a.startOffset+", "+J.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function p(a,b){if(this.range=a,this.clonePartiallySelectedTextNodes=b,!a.collapsed){this.sc=a.startContainer,this.so=a.startOffset,this.ec=a.endContainer,this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&N(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==c||N(this.sc)?T(this.sc,c,!0):this.sc.childNodes[this.so],this._last=this.ec!==c||N(this.ec)?T(this.ec,c,!0):this.ec.childNodes[this.eo-1])}}function q(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){if(d=e.nodeType,V(a,d))return e;e=e.parentNode}return null}}function r(a,b){if(ea(a,b))throw new M("INVALID_NODE_TYPE_ERR")}function s(a,b){if(!V(b,a.nodeType))throw new M("INVALID_NODE_TYPE_ERR")}function t(a,b){if(0>b||b>(N(a)?a.length:a.childNodes.length))throw new M("INDEX_SIZE_ERR")}function u(a,b){if(ca(a,!0)!==ca(b,!0))throw new M("WRONG_DOCUMENT_ERR")}function v(a){if(da(a,!0))throw new M("NO_MODIFICATION_ALLOWED_ERR")}function w(a,b){if(!a)throw new M(b)}function x(a,b){return b<=(N(a)?a.length:a.childNodes.length)}function y(a){return!!a.startContainer&&!!a.endContainer&&!(X&&(J.isBrokenNode(a.startContainer)||J.isBrokenNode(a.endContainer)))&&W(a.startContainer)==W(a.endContainer)&&x(a.startContainer,a.startOffset)&&x(a.endContainer,a.endOffset)}function z(a){if(!y(a))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+a.inspect()+")")}function A(a,b){z(a);var c=a.startContainer,d=a.startOffset,e=a.endContainer,f=a.endOffset,g=c===e;N(e)&&f>0&&f0&&d=O(c)&&f++,d=0),a.setStartAndEnd(c,d,e,f)}function B(a){z(a);var b=a.commonAncestorContainer.parentNode.cloneNode(!1);return b.appendChild(a.cloneContents()),b.innerHTML}function C(a){a.START_TO_START=ka,a.START_TO_END=la,a.END_TO_END=ma,a.END_TO_START=na,a.NODE_BEFORE=oa,a.NODE_AFTER=pa,a.NODE_BEFORE_AND_AFTER=qa,a.NODE_INSIDE=ra}function D(a){C(a),C(a.prototype)}function E(a,b){return function(){z(this);var c,d,e=this.startContainer,f=this.startOffset,h=this.commonAncestorContainer,i=new p(this,!0);e!==h&&(c=T(e,h,!0),d=g(c),e=d.node,f=d.offset),k(i,v),i.reset();var j=a(i);return i.detach(),b(this,e,f,e,f),j}}function F(b,d){function e(a,b){return function(c){s(c,Z),s(W(c),$);var d=(a?f:g)(c);(b?h:i)(this,d.node,d.offset)}}function h(a,b,c){var e=a.endContainer,f=a.endOffset;(b!==a.startContainer||c!==a.startOffset)&&((W(b)!=W(e)||1==R(b,c,e,f))&&(e=b,f=c),d(a,b,c,e,f))}function i(a,b,c){var e=a.startContainer,f=a.startOffset;(b!==a.endContainer||c!==a.endOffset)&&((W(b)!=W(e)||-1==R(b,c,e,f))&&(e=b,f=c),d(a,e,f,b,c))}var j=function(){};j.prototype=a.rangePrototype,b.prototype=new j,K.extend(b.prototype,{setStart:function(a,b){r(a,!0),t(a,b),h(this,a,b)},setEnd:function(a,b){r(a,!0),t(a,b),i(this,a,b)},setStartAndEnd:function(){var a=arguments,b=a[0],c=a[1],e=b,f=c;switch(a.length){case 3:f=a[2];break;case 4:e=a[2],f=a[3]}d(this,b,c,e,f)},setBoundary:function(a,b,c){this["set"+(c?"Start":"End")](a,b)},setStartBefore:e(!0,!0),setStartAfter:e(!1,!0),setEndBefore:e(!0,!1),setEndAfter:e(!1,!1),collapse:function(a){z(this),a?d(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){r(a,!0),d(this,a,0,a,U(a))},selectNode:function(a){r(a,!1),s(a,Z);var b=f(a),c=g(a);d(this,b.node,b.offset,c.node,c.offset)},extractContents:E(m,d),deleteContents:E(l,d),canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},splitBoundaries:function(){A(this)},splitBoundariesPreservingPositions:function(a){A(this,a)},normalizeBoundaries:function(){z(this);var a,b=this.startContainer,c=this.startOffset,e=this.endContainer,f=this.endOffset,g=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(e=a,f=a.length,a.appendData(b.data),Y(b))},h=function(a){var d=a.previousSibling;if(d&&d.nodeType==a.nodeType){b=a;var g=a.length;if(c=d.length,a.insertData(0,d.data),Y(d),b==e)f+=c,e=b;else if(e==a.parentNode){var h=O(a);f==h?(e=a,f=g):f>h&&f--}}},i=!0;if(N(e))f==e.length?g(e):0==f&&(a=e.previousSibling,a&&a.nodeType==e.nodeType&&(f=a.length,b==e&&(i=!1),a.appendData(e.data),Y(e),e=a));else{if(f>0){var j=e.childNodes[f-1];j&&N(j)&&g(j)}i=!this.collapsed}if(i){if(N(b))0==c?h(b):c==b.length&&(a=b.nextSibling,a&&a.nodeType==b.nodeType&&(e==a&&(e=b,f+=b.length),b.appendData(a.data),Y(a)));else if(cx",ga=3==fa.firstChild.nodeType}catch(ha){}a.features.htmlParsingConforms=ga;var ia=ga?function(a){var b=this.startContainer,c=Q(b);if(!b)throw new M("INVALID_STATE_ERR");var d=null;return 1==b.nodeType?d=b:N(b)&&(d=J.parentElement(b)),d=null===d||"HTML"==d.nodeName&&J.isHtmlNamespace(Q(d).documentElement)&&J.isHtmlNamespace(d)?c.createElement("body"):d.cloneNode(!1),d.innerHTML=a,J.fragmentFromNodeChildren(d)}:function(a){var b=d(this),c=b.createElement("body");return c.innerHTML=a,J.fragmentFromNodeChildren(c)},ja=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ka=0,la=1,ma=2,na=3,oa=0,pa=1,qa=2,ra=3;K.extend(a.rangePrototype,{compareBoundaryPoints:function(a,b){z(this),u(this.startContainer,b.startContainer);var c,d,e,f,g=a==na||a==ka?"start":"end",h=a==la||a==ka?"start":"end";return c=this[g+"Container"],d=this[g+"Offset"],e=b[h+"Container"],f=b[h+"Offset"],R(c,d,e,f)},insertNode:function(a){if(z(this),s(a,aa),v(this.startContainer),P(a,this.startContainer))throw new M("HIERARCHY_REQUEST_ERR");var b=h(a,this.startContainer,this.startOffset);this.setStartBefore(b)},cloneContents:function(){z(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();if(this.startContainer===this.endContainer&&N(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;var c=new p(this,!0);return a=j(c),c.detach(),a},canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},surroundContents:function(a){if(s(a,ba),!this.canSurroundContents())throw new M("INVALID_STATE_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);h(a,this.startContainer,this.startOffset),a.appendChild(b),this.selectNode(a)},cloneRange:function(){z(this);for(var a,b=new I(d(this)),c=ja.length;c--;)a=ja[c],b[a]=this[a];return b},toString:function(){z(this);var a=this.startContainer;if(a===this.endContainer&&N(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],c=new p(this,!0);return k(c,function(a){(3==a.nodeType||4==a.nodeType)&&b.push(a.data)}),c.detach(),b.join("")},compareNode:function(a){z(this);var b=a.parentNode,c=O(a);if(!b)throw new M("NOT_FOUND_ERR");var d=this.comparePoint(b,c),e=this.comparePoint(b,c+1);return 0>d?e>0?qa:oa:e>0?pa:ra},comparePoint:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)<0?-1:R(a,b,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:ia,toHtml:function(){return B(this)},intersectsNode:function(a,b){if(z(this),W(a)!=e(this))return!1;var c=a.parentNode,d=O(a);if(!c)return!0;var f=R(c,d,this.endContainer,this.endOffset),g=R(c,d+1,this.startContainer,this.startOffset);return b?0>=f&&g>=0:0>f&&g>0},isPointInRange:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)>=0&&R(a,b,this.endContainer,this.endOffset)<=0},intersectsRange:function(a){return i(this,a,!1)},intersectsOrTouchesRange:function(a){return i(this,a,!0)},intersection:function(a){if(this.intersectsRange(a)){var b=R(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=R(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();return-1==b&&d.setStart(a.startContainer,a.startOffset),1==c&&d.setEnd(a.endContainer,a.endOffset),d}return null},union:function(a){if(this.intersectsOrTouchesRange(a)){var b=this.cloneRange();return-1==R(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset),1==R(a.endContainer,a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset), -b}throw new M("Ranges do not intersect")},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==ra},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,U(a))<=0},containsRange:function(a){var b=this.intersection(a);return null!==b&&a.equals(b)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);if(c.length>0){b.setStart(c[0],0);var d=c.pop();return b.setEnd(d,d.length),this.containsRange(b)}return this.containsNodeContents(a)},getNodes:function(a,b){return z(this),n(this,a,b)},getDocument:function(){return d(this)},collapseBefore:function(a){this.setEndBefore(a),this.collapse(!1)},collapseAfter:function(a){this.setStartAfter(a),this.collapse(!0)},getBookmark:function(b){var c=d(this),e=a.createRange(c);b=b||J.getBody(c),e.selectNodeContents(b);var f=this.intersection(e),g=0,h=0;return f&&(e.setEnd(f.startContainer,f.startOffset),g=e.toString().length,h=g+f.toString().length),{start:g,end:h,containerNode:b}},moveToBookmark:function(a){var b=a.containerNode,c=0;this.setStart(b,0),this.collapse(!0);for(var d,e,f,g,h=[b],i=!1,j=!1;!j&&(d=h.pop());)if(3==d.nodeType)e=c+d.length,!i&&a.start>=c&&a.start<=e&&(this.setStart(d,a.start-c),i=!0),i&&a.end>=c&&a.end<=e&&(this.setEnd(d,a.end-c),j=!0),c=e;else for(g=d.childNodes,f=g.length;f--;)h.push(g[f])},getName:function(){return"DomRange"},equals:function(a){return I.rangesEqual(this,a)},isValid:function(){return y(this)},inspect:function(){return o(this)},detach:function(){}}),F(I,H),K.extend(I,{rangeProperties:ja,RangeIterator:p,copyComparisonConstants:D,createPrototypeRange:F,inspect:o,toHtml:B,getRangeDocument:d,rangesEqual:function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset}}),a.DomRange=I}),H.createCoreModule("WrappedRange",["DomRange"],function(a,b){var c,d,e=a.dom,f=a.util,g=e.DomPosition,h=a.DomRange,i=e.getBody,j=e.getContentDocument,k=e.isCharacterDataNode;if(a.features.implementsDomRange&&!function(){function d(a){for(var b,c=m.length;c--;)b=m[c],a[b]=a.nativeRange[b];a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset}function g(a,b,c,d,e){var f=a.startContainer!==b||a.startOffset!=c,g=a.endContainer!==d||a.endOffset!=e,h=!a.equals(a.nativeRange);(f||g||h)&&(a.setEnd(d,e),a.setStart(b,c))}var k,l,m=h.rangeProperties;c=function(a){if(!a)throw b.createError("WrappedRange: Range must be specified");this.nativeRange=a,d(this)},h.createPrototypeRange(c,g),k=c.prototype,k.selectNode=function(a){this.nativeRange.selectNode(a),d(this)},k.cloneContents=function(){return this.nativeRange.cloneContents()},k.surroundContents=function(a){this.nativeRange.surroundContents(a),d(this)},k.collapse=function(a){this.nativeRange.collapse(a),d(this)},k.cloneRange=function(){return new c(this.nativeRange.cloneRange())},k.refresh=function(){d(this)},k.toString=function(){return this.nativeRange.toString()};var n=document.createTextNode("test");i(document).appendChild(n);var o=document.createRange();o.setStart(n,0),o.setEnd(n,0);try{o.setStart(n,1),k.setStart=function(a,b){this.nativeRange.setStart(a,b),d(this)},k.setEnd=function(a,b){this.nativeRange.setEnd(a,b),d(this)},l=function(a){return function(b){this.nativeRange[a](b),d(this)}}}catch(p){k.setStart=function(a,b){try{this.nativeRange.setStart(a,b)}catch(c){this.nativeRange.setEnd(a,b),this.nativeRange.setStart(a,b)}d(this)},k.setEnd=function(a,b){try{this.nativeRange.setEnd(a,b)}catch(c){this.nativeRange.setStart(a,b),this.nativeRange.setEnd(a,b)}d(this)},l=function(a,b){return function(c){try{this.nativeRange[a](c)}catch(e){this.nativeRange[b](c),this.nativeRange[a](c)}d(this)}}}k.setStartBefore=l("setStartBefore","setEndBefore"),k.setStartAfter=l("setStartAfter","setEndAfter"),k.setEndBefore=l("setEndBefore","setStartBefore"),k.setEndAfter=l("setEndAfter","setStartAfter"),k.selectNodeContents=function(a){this.setStartAndEnd(a,0,e.getNodeLength(a))},o.selectNodeContents(n),o.setEnd(n,3);var q=document.createRange();q.selectNodeContents(n),q.setEnd(n,4),q.setStart(n,2),-1==o.compareBoundaryPoints(o.START_TO_END,q)&&1==o.compareBoundaryPoints(o.END_TO_START,q)?k.compareBoundaryPoints=function(a,b){return b=b.nativeRange||b,a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&(a=b.START_TO_END),this.nativeRange.compareBoundaryPoints(a,b)}:k.compareBoundaryPoints=function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};var r=document.createElement("div");r.innerHTML="123";var s=r.firstChild,t=i(document);t.appendChild(r),o.setStart(s,1),o.setEnd(s,2),o.deleteContents(),"13"==s.data&&(k.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},k.extractContents=function(){var a=this.nativeRange.extractContents();return d(this),a}),t.removeChild(r),t=null,f.isHostMethod(o,"createContextualFragment")&&(k.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)}),i(document).removeChild(n),k.getName=function(){return"WrappedRange"},a.WrappedRange=c,a.createNativeRange=function(a){return a=j(a,b,"createNativeRange"),a.createRange()}}(),a.features.implementsTextRange){var l=function(a){var b=a.parentElement(),c=a.duplicate();c.collapse(!0);var d=c.parentElement();c=a.duplicate(),c.collapse(!1);var f=c.parentElement(),g=d==f?d:e.getCommonAncestor(d,f);return g==b?g:e.getCommonAncestor(b,g)},m=function(a){return 0==a.compareEndPoints("StartToEnd",a)},n=function(a,b,c,d,f){var h=a.duplicate();h.collapse(c);var i=h.parentElement();if(e.isOrIsAncestorOf(b,i)||(i=b),!i.canHaveHTML){var j=new g(i.parentNode,e.getNodeIndex(i));return{boundaryPosition:j,nodeInfo:{nodeIndex:j.offset,containerElement:j.node}}}var l=e.getDocument(i).createElement("span");l.parentNode&&e.removeNode(l);for(var m,n,o,p,q,r=c?"StartToStart":"StartToEnd",s=f&&f.containerElement==i?f.nodeIndex:0,t=i.childNodes.length,u=t,v=u;;){if(v==t?i.appendChild(l):i.insertBefore(l,i.childNodes[v]),h.moveToElementText(l),m=h.compareEndPoints(r,a),0==m||s==u)break;if(-1==m){if(u==s+1)break;s=v}else u=u==s+1?s:v;v=Math.floor((s+u)/2),i.removeChild(l)}if(q=l.nextSibling,-1==m&&q&&k(q)){h.setEndPoint(c?"EndToStart":"EndToEnd",a);var w;if(/[\r\n]/.test(q.data)){var x=h.duplicate(),y=x.text.replace(/\r\n/g,"\r").length;for(w=x.moveStart("character",y);-1==(m=x.compareEndPoints("StartToEnd",x));)w++,x.moveStart("character",1)}else w=h.text.length;p=new g(q,w)}else n=(d||!c)&&l.previousSibling,o=(d||c)&&l.nextSibling,p=o&&k(o)?new g(o,0):n&&k(n)?new g(n,n.data.length):new g(i,e.getNodeIndex(l));return e.removeNode(l),{boundaryPosition:p,nodeInfo:{nodeIndex:v,containerElement:i}}},o=function(a,b){var c,d,f,g,h=a.offset,j=e.getDocument(a.node),l=i(j).createTextRange(),m=k(a.node);return m?(c=a.node,d=c.parentNode):(g=a.node.childNodes,c=hb;++b)if(!C.isAncestorOf(a[0],a[b]))return!1;return!0}function m(a){var c=a.getNodes();if(!l(c))throw b.createError("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return c[0]}function n(a){return!!a&&"undefined"!=typeof a.text}function o(a,b){var c=new G(b);a._ranges=[c],h(a,c,!1),a.rangeCount=1,a.isCollapsed=c.collapsed}function p(b){if(b._ranges.length=0,"None"==b.docSelection.type)j(b);else{var c=b.docSelection.createRange();if(n(c))o(b,c);else{b.rangeCount=c.length;for(var d,e=L(c.item(0)),f=0;fh;++h)g.add(d.item(h));try{g.add(e)}catch(j){throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}g.select(),p(a)}function r(a,b,c){this.nativeSelection=a,this.docSelection=b,this._ranges=[],this.win=c,this.refresh()}function s(a){a.win=a.anchorNode=a.focusNode=a._ranges=null,a.rangeCount=a.anchorOffset=a.focusOffset=0,a.detached=!0}function t(a,b){for(var c,d,e=ba.length;e--;)if(c=ba[e],d=c.selection,"deleteAll"==b)s(d);else if(c.win==a)return"delete"==b?(ba.splice(e,1),!0):d;return"deleteAll"==b&&(ba.length=0),null}function u(a,c){for(var d,e=L(c[0].startContainer),f=M(e).createControlRange(),g=0,h=c.length;h>g;++g){d=m(c[g]);try{f.add(d)}catch(i){throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}f.select(),p(a)}function v(a,b){if(a.win.document!=L(b))throw new H("WRONG_DOCUMENT_ERR")}function w(b){return function(c,d){var e;this.rangeCount?(e=this.getRangeAt(0),e["set"+(b?"Start":"End")](c,d)):(e=a.createRange(this.win.document),e.setStartAndEnd(c,d)),this.setSingleRange(e,this.isBackward())}}function x(a){var b=[],c=new I(a.anchorNode,a.anchorOffset),d=new I(a.focusNode,a.focusOffset),e="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var f=0,g=a.rangeCount;g>f;++f)b[f]=F.inspect(a.getRangeAt(f));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}a.config.checkSelectionRanges=!0;var y,z,A="boolean",B="number",C=a.dom,D=a.util,E=D.isHostMethod,F=a.DomRange,G=a.WrappedRange,H=a.DOMException,I=C.DomPosition,J=a.features,K="Control",L=C.getDocument,M=C.getBody,N=F.rangesEqual,O=E(window,"getSelection"),P=D.isHostObject(document,"selection");J.implementsWinGetSelection=O,J.implementsDocSelection=P;var Q=P&&(!O||a.config.preferTextRange);if(Q)y=f,a.isSelectionValid=function(a){var b=d(a,"isSelectionValid").document,c=b.selection;return"None"!=c.type||L(c.createRange().parentElement())==b};else{if(!O)return b.fail("Neither document.selection or window.getSelection() detected."),!1;y=e,a.isSelectionValid=function(){return!0}}a.getNativeSelection=y;var R=y();if(!R)return b.fail("Native selection was null (possibly issue 138?)"),!1;var S=a.createNativeRange(document),T=M(document),U=D.areHostProperties(R,["anchorNode","focusNode","anchorOffset","focusOffset"]);J.selectionHasAnchorAndFocus=U;var V=E(R,"extend");J.selectionHasExtend=V;var W=typeof R.rangeCount==B;J.selectionHasRangeCount=W;var X=!1,Y=!0,Z=V?function(b,c){var d=F.getRangeDocument(c),e=a.createRange(d);e.collapseToPoint(c.endContainer,c.endOffset),b.addRange(k(e)),b.extend(c.startContainer,c.startOffset)}:null;D.areHostMethods(R,["addRange","getRangeAt","removeAllRanges"])&&typeof R.rangeCount==B&&J.implementsDomRange&&!function(){var b=window.getSelection();if(b){for(var c=b.rangeCount,d=c>1,e=[],f=g(b),h=0;c>h;++h)e[h]=b.getRangeAt(h);var i=C.createTestElement(document,"",!1),j=i.appendChild(document.createTextNode("   ")),k=document.createRange();if(k.setStart(j,1),k.collapse(!0),b.removeAllRanges(),b.addRange(k),Y=1==b.rangeCount,b.removeAllRanges(),!d){var l=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(l&&parseInt(l[1])>=36)X=!1;else{var m=k.cloneRange();k.setStart(j,0),m.setEnd(j,3),m.setStart(j,2),b.addRange(k),b.addRange(m),X=2==b.rangeCount}}for(C.removeNode(i),b.removeAllRanges(),h=0;c>h;++h)0==h&&f?Z?Z(b,e[h]):(a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),b.addRange(e[h])):b.addRange(e[h])}}(),J.selectionSupportsMultipleRanges=X,J.collapsedNonEditableSelectionsSupported=Y;var $,_=!1;T&&E(T,"createControlRange")&&($=T.createControlRange(),D.areHostProperties($,["item","add"])&&(_=!0)),J.implementsControlRange=_,z=U?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var aa;E(R,"getRangeAt")?aa=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:U&&(aa=function(b){var c=L(b.anchorNode),d=a.createRange(c);return d.setStartAndEnd(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),d.collapsed!==this.isCollapsed&&d.setStartAndEnd(b.focusNode,b.focusOffset,b.anchorNode,b.anchorOffset),d}),r.prototype=a.selectionPrototype;var ba=[],ca=function(a){if(a&&a instanceof r)return a.refresh(),a;a=d(a,"getNativeSelection");var b=t(a),c=y(a),e=P?f(a):null;return b?(b.nativeSelection=c,b.docSelection=e,b.refresh()):(b=new r(c,e,a),ba.push({win:a,selection:b})),b};a.getSelection=ca,D.createAliasForDeprecatedMethod(a,"getIframeSelection","getSelection");var da=r.prototype;if(!Q&&U&&D.areHostMethods(R,["removeAllRanges","addRange"])){da.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),j(this)};var ea=function(a,b){Z(a.nativeSelection,b),a.refresh()};W?da.addRange=function(b,d){if(_&&P&&this.docSelection.type==K)q(this,b);else if(c(d)&&V)ea(this,b);else{var e;X?e=this.rangeCount:(this.removeAllRanges(),e=0);var f=k(b).cloneRange();try{this.nativeSelection.addRange(f)}catch(g){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==e+1){if(a.config.checkSelectionRanges){var i=aa(this.nativeSelection,this.rangeCount-1);i&&!N(i,b)&&(b=new G(i))}this._ranges[this.rangeCount-1]=b,h(this,b,ha(this.nativeSelection)),this.isCollapsed=z(this)}else this.refresh()}}:da.addRange=function(a,b){c(b)&&V?ea(this,a):(this.nativeSelection.addRange(k(a)),this.refresh())},da.setRanges=function(a){if(_&&P&&a.length>1)u(this,a);else{this.removeAllRanges();for(var b=0,c=a.length;c>b;++b)this.addRange(a[b])}}}else{if(!(E(R,"empty")&&E(S,"select")&&_&&Q))return b.fail("No means of selecting a Range or TextRange was found"),!1;da.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var a;if(this.anchorNode)a=L(this.anchorNode);else if(this.docSelection.type==K){var b=this.docSelection.createRange();b.length&&(a=L(b.item(0)))}if(a){var c=M(a).createTextRange();c.select(),this.docSelection.empty()}}}catch(d){}j(this)},da.addRange=function(b){this.docSelection.type==K?q(this,b):(a.WrappedTextRange.rangeToTextRange(b).select(),this._ranges[0]=b,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,h(this,b,!1))},da.setRanges=function(a){this.removeAllRanges();var b=a.length;b>1?u(this,a):b&&this.addRange(a[0])}}da.getRangeAt=function(a){if(0>a||a>=this.rangeCount)throw new H("INDEX_SIZE_ERR");return this._ranges[a].cloneRange()};var fa;if(Q)fa=function(b){var c;a.isSelectionValid(b.win)?c=b.docSelection.createRange():(c=M(b.win.document).createTextRange(),c.collapse(!0)),b.docSelection.type==K?p(b):n(c)?o(b,c):j(b)};else if(E(R,"getRangeAt")&&typeof R.rangeCount==B)fa=function(b){if(_&&P&&b.docSelection.type==K)p(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,b.rangeCount){for(var c=0,d=b.rangeCount;d>c;++c)b._ranges[c]=new a.WrappedRange(b.nativeSelection.getRangeAt(c));h(b,b._ranges[b.rangeCount-1],ha(b.nativeSelection)),b.isCollapsed=z(b)}else j(b)};else{if(!U||typeof R.isCollapsed!=A||typeof S.collapsed!=A||!J.implementsDomRange)return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;fa=function(a){var b,c=a.nativeSelection;c.anchorNode?(b=aa(c,0),a._ranges=[b],a.rangeCount=1,i(a),a.isCollapsed=z(a)):j(a)}}da.refresh=function(a){var b=a?this._ranges.slice(0):null,c=this.anchorNode,d=this.anchorOffset;if(fa(this),a){var e=b.length;if(e!=this._ranges.length)return!0;if(this.anchorNode!=c||this.anchorOffset!=d)return!0;for(;e--;)if(!N(b[e],this._ranges[e]))return!0;return!1}};var ga=function(a,b){var c=a.getAllRanges();a.removeAllRanges();for(var d=0,e=c.length;e>d;++d)N(b,c[d])||a.addRange(c[d]);a.rangeCount||j(a)};_&&P?da.removeRange=function(a){if(this.docSelection.type==K){for(var b,c=this.docSelection.createRange(),d=m(a),e=L(c.item(0)),f=M(e).createControlRange(),g=!1,h=0,i=c.length;i>h;++h)b=c.item(h),b!==d||g?f.add(c.item(h)):g=!0;f.select(),p(this)}else ga(this,a)}:da.removeRange=function(a){ga(this,a)};var ha;!Q&&U&&J.implementsDomRange?(ha=g,da.isBackward=function(){return ha(this)}):ha=da.isBackward=function(){return!1},da.isBackwards=da.isBackward,da.toString=function(){for(var a=[],b=0,c=this.rangeCount;c>b;++b)a[b]=""+this._ranges[b];return a.join("")},da.collapse=function(b,c){v(this,b);var d=a.createRange(b);d.collapseToPoint(b,c),this.setSingleRange(d),this.isCollapsed=!0},da.collapseToStart=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)},da.collapseToEnd=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)},da.selectAllChildren=function(b){v(this,b);var c=a.createRange(b);c.selectNodeContents(b),this.setSingleRange(c)},da.deleteFromDocument=function(){if(_&&P&&this.docSelection.type==K){for(var a,b=this.docSelection.createRange();b.length;)a=b.item(0),b.remove(a),C.removeNode(a);this.refresh()}else if(this.rangeCount){var c=this.getAllRanges();if(c.length){this.removeAllRanges();for(var d=0,e=c.length;e>d;++d)c[d].deleteContents();this.addRange(c[e-1])}}},da.eachRange=function(a,b){for(var c=0,d=this._ranges.length;d>c;++c)if(a(this.getRangeAt(c)))return b},da.getAllRanges=function(){var a=[];return this.eachRange(function(b){a.push(b)}),a},da.setSingleRange=function(a,b){this.removeAllRanges(),this.addRange(a,b)},da.callMethodOnEachRange=function(a,b){var c=[];return this.eachRange(function(d){c.push(d[a].apply(d,b||[]))}),c},da.setStart=w(!0),da.setEnd=w(!1),a.rangePrototype.select=function(a){ca(this.getDocument()).setSingleRange(this,a)},da.changeEachRange=function(a){var b=[],c=this.isBackward();this.eachRange(function(c){a(c),b.push(c)}),this.removeAllRanges(),c&&1==b.length?this.addRange(b[0],"backward"):this.setRanges(b)},da.containsNode=function(a,b){return this.eachRange(function(c){return c.containsNode(a,b)},!0)||!1},da.getBookmark=function(a){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[a])}},da.moveToBookmark=function(b){for(var c,d,e=[],f=0;c=b.rangeBookmarks[f++];)d=a.createRange(this.win),d.moveToBookmark(c),e.push(d);b.backward?this.setSingleRange(e[0],"backward"):this.setRanges(e)},da.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},da.restoreRanges=function(a){this.removeAllRanges();for(var b,c=0;b=a.ranges[c];++c)this.addRange(b,a.backward&&0==c)},da.toHtml=function(){var a=[];return this.eachRange(function(b){a.push(F.toHtml(b))}),a.join("")},J.implementsTextRange&&(da.getNativeTextRange=function(){var c;if(c=this.docSelection){var d=c.createRange();if(n(d))return d;throw b.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return a.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw b.createError("getNativeTextRange: selection contains no range")}),da.getName=function(){return"WrappedSelection"},da.inspect=function(){return x(this)},da.detach=function(){t(this.win,"delete"),s(this)},r.detachAll=function(){t(null,"deleteAll")},r.inspect=x,r.isDirectionBackward=c,a.Selection=r,a.selectionPrototype=da,a.addShimListener(function(a){"undefined"==typeof a.getSelection&&(a.getSelection=function(){return ca(a)}),a=null})});var M=!1,N=function(a){M||(M=!0,!H.initialized&&H.config.autoInitialize&&l())};return F&&("complete"==document.readyState?N():(a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",N,!1),J(window,"load",N))),H},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("TextRange",["WrappedSelection"],function(a,b){function c(a,b){function c(a,b,c){h.push({start:a,end:b,isWord:c})}for(var d,e,f,g=a.join(""),h=[],i=0;d=b.wordRegex.exec(g);){if(e=d.index,f=e+d[0].length,e>i&&c(i,e,!1),b.includeTrailingSpace)for(;$.test(a[f]);)++f;c(e,f,!0),i=f}return ie;++e)c[e].token=d;return d}function e(a,b,c){for(var e,f=c(a,b),g=[],h=0;e=f[h++];)g.push(d(a,e));return g}function f(a){var b=a||"",c="string"==typeof b?b.split(""):b;return c.sort(function(a,b){return a.charCodeAt(0)-b.charCodeAt(0)}),c.join("").replace(/(.)\1+/g,"$1")}function g(a){var b,c;return a?(b=a.language||_,c={},U(c,ia[b]||ia[_]),U(c,a),c):ia[_]}function h(a,b){var c=V(a,b);return b.hasOwnProperty("wordOptions")&&(c.wordOptions=g(c.wordOptions)),b.hasOwnProperty("characterOptions")&&(c.characterOptions=V(c.characterOptions,ga)),c}function i(a,b){var c=na(a,"display",b),d=a.tagName.toLowerCase();return"block"==c&&fa&&oa.hasOwnProperty(d)?oa[d]:c}function j(a){for(var b=o(a),c=0,d=b.length;d>c;++c)if(1==b[c].nodeType&&"none"==i(b[c]))return!0;return!1}function k(a){var b;return 3==a.nodeType&&(b=a.parentNode)&&"hidden"==na(b,"visibility")}function l(a){return a&&(1==a.nodeType&&!/^(inline(-block|-table)?|none)$/.test(i(a))||9==a.nodeType||11==a.nodeType)}function m(a){return S.isCharacterDataNode(a)||!/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i.test(a.nodeName)}function n(a){for(var b=[];a.parentNode;)b.unshift(a.parentNode),a=a.parentNode;return b}function o(a){return n(a).concat([a])}function p(a){for(;a&&!a.nextSibling;)a=a.parentNode;return a?a.nextSibling:null}function q(a,b){return!b&&a.hasChildNodes()?a.firstChild:p(a)}function r(a){var b=a.previousSibling;if(b){for(a=b;a.hasChildNodes();)a=a.lastChild;return a}var c=a.parentNode;return c&&1==c.nodeType?c:null}function s(a){if(!a||3!=a.nodeType)return!1;var b=a.data;if(""===b)return!0;var c=a.parentNode;if(!c||1!=c.nodeType)return!1;var d=na(a.parentNode,"whiteSpace");return/^[\t\n\r ]+$/.test(b)&&/^(normal|nowrap)$/.test(d)||/^[\t\r ]+$/.test(b)&&"pre-line"==d}function t(a){if(""===a.data)return!0;if(!s(a))return!1;var b=a.parentNode;return b?j(a)?!0:!1:!0}function u(a){var b=a.nodeType;return 7==b||8==b||j(a)||/^(script|style)$/i.test(a.nodeName)||k(a)||t(a)}function v(a,b){var c=a.nodeType;return 7==c||8==c||1==c&&"none"==i(a,b)}function w(){this.store={}}function x(a,b,c){return function(d){var e=this.cache;if(e.hasOwnProperty(a))return pa++,e[a];qa++;var f=b.call(this,c?this[c]:this,d);return e[a]=f,f}}function y(a,b){this.node=a,this.session=b,this.cache=new w,this.positions=new w}function z(a,b){this.offset=b,this.nodeWrapper=a,this.node=a.node,this.session=a.session,this.cache=new w}function A(){return"[Position("+S.inspectNode(this.node)+":"+this.offset+")]"}function B(){return D(),Da=new Ea}function C(){return Da||B()}function D(){Da&&Da.detach(),Da=null}function E(a,c,d,e){function f(){var a=null;return c?(a=h,i||(h=h.previousVisible(),i=!h||d&&h.equals(d))):i||(a=h=h.nextVisible(),i=!h||d&&h.equals(d)),i&&(h=null),a}d&&(c?u(d.node)&&(d=a.previousVisible()):u(d.node)&&(d=d.nextVisible()));var g,h=a,i=!1,j=!1;return{next:function(){if(j)return j=!1,g;for(var a,b;a=f();)if(b=a.getCharacter(e))return g=a,a;return null},rewind:function(){if(!g)throw b.createError("createCharacterIterator: cannot rewind. Only one position can be rewound.");j=!0},dispose:function(){a=d=null}}}function F(a,b,c){function d(a){for(var b,c,d=[],e=a?f:g,h=!1,i=!1;b=e.next();){if(c=b.character,Z.test(c))i&&(i=!1,h=!0);else{if(h){e.rewind();break}i=!0}d.push(b)}return d}var f=E(a,!1,null,b),g=E(a,!0,null,b),h=c.tokenizer,i=d(!0),j=d(!1).reverse(),k=e(j.concat(i),c,h),l=i.length?k.slice(Fa(k,i[0].token)):[],m=j.length?k.slice(0,Fa(k,j.pop().token)+1):[];return{nextEndToken:function(){for(var a,b;1==l.length&&!(a=l[0]).isWord&&(b=d(!0)).length>0;)l=e(a.chars.concat(b),c,h);return l.shift()},previousStartToken:function(){for(var a,b;1==m.length&&!(a=m[0]).isWord&&(b=d(!1)).length>0;)m=e(b.reverse().concat(a.chars),c,h);return m.pop()},dispose:function(){f.dispose(),g.dispose(),l=m=null}}}function G(a,b,c,d,e){var f,g,h,i,j=0,k=a,l=Math.abs(c);if(0!==c){var m=0>c;switch(b){case Q:for(g=E(a,m,null,d);(f=g.next())&&l>j;)++j,k=f;h=f,g.dispose();break;case R:for(var n=F(a,d,e),o=m?n.previousStartToken:n.nextEndToken;(i=o())&&l>j;)i.isWord&&(++j,k=m?i.chars[0]:i.chars[i.chars.length-1]);break;default:throw new Error("movePositionBy: unit '"+b+"' not implemented")}m?(k=k.previousVisible(),j=-j):k&&k.isLeadingSpace&&!k.isTrailingSpace&&(b==R&&(g=E(a,!1,null,d),h=g.next(),g.dispose()),h&&(k=h.previousVisible()))}return{position:k,unitsMoved:j}}function H(a,b,c,d){var e=a.getRangeBoundaryPosition(b,!0),f=a.getRangeBoundaryPosition(b,!1),g=d?f:e,h=d?e:f;return E(g,!!d,h,c)}function I(a,b,c){for(var d,e=[],f=H(a,b,c);d=f.next();)e.push(d);return f.dispose(),e}function J(b,c,d){var e=a.createRange(b.node);return e.setStartAndEnd(b.node,b.offset,c.node,c.offset),!e.expand("word",{wordOptions:d})}function K(a,b,c,d,e){function f(a,b){var c=p[a].previousVisible(),d=p[b-1],f=!e.wholeWordsOnly||J(c,d,e.wordOptions);return{startPos:c,endPos:d,valid:f}}for(var g,h,i,j,k,l,m=aa(e.direction),n=E(a,m,a.session.getRangeBoundaryPosition(d,m),e.characterOptions),o="",p=[],q=null;g=n.next();)if(h=g.character,c||e.caseSensitive||(h=h.toLowerCase()),m?(p.unshift(g),o=h+o):(p.push(g),o+=h),c){if(k=b.exec(o))if(i=k.index,j=i+k[0].length,l){if(!m&&j0){q=f(i,j);break}}else l=!0}else if(-1!=(i=o.indexOf(b))){q=f(i,i+b.length);break}return l&&(q=f(i,j)),n.dispose(),q}function L(a){return function(){var b=!!Da,c=C(),d=[c].concat(T.toArray(arguments)),e=a.apply(this,d);return b||D(),e}}function M(a,b){return L(function(c,d,e,f){typeof e==P&&(e=d,d=Q),f=h(f,ka);var g=a;b&&(g=e>=0,this.collapse(!g));var i=G(c.getRangeBoundaryPosition(this,g),d,e,f.characterOptions,f.wordOptions),j=i.position;return this[g?"setStart":"setEnd"](j.node,j.offset),i.unitsMoved})}function N(a){return L(function(b,c){c=V(c,ga);for(var d,e=H(b,this,c,!a),f=0;(d=e.next())&&Z.test(d.character);)++f;e.dispose();var g=f>0;return g&&this[a?"moveStart":"moveEnd"]("character",a?f:-f,{characterOptions:c}),g})}function O(a){return L(function(b,c){var d=!1;return this.changeEachRange(function(b){d=b[a](c)||d}),d})}var P="undefined",Q="character",R="word",S=a.dom,T=a.util,U=T.extend,V=T.createOptions,W=S.getBody,X=/^[ \t\f\r\n]+$/,Y=/^[ \t\f\r]+$/,Z=/^[\t-\r \u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/,$=/^[\t \u00A0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000]+$/,_="en",aa=a.Selection.isDirectionBackward,ba=!1,ca=!1,da=!1,ea=!0;!function(){var b=S.createTestElement(document,"

    1

    ",!0),c=b.firstChild,d=a.getSelection();d.collapse(c.lastChild,2),d.setStart(c.firstChild,0),ba=1==(""+d).length,b.innerHTML="1
    ",d.collapse(b,2),d.setStart(b.firstChild,0),ca=1==(""+d).length,b.innerHTML="1

    1

    ",d.collapse(b,2),d.setStart(b.firstChild,0),da=1==(""+d).length,S.removeNode(b),d.removeAllRanges()}();var fa,ga={includeBlockContentTrailingSpace:!0,includeSpaceBeforeBr:!0,includeSpaceBeforeBlock:!0,includePreLineTrailingSpace:!0,ignoreCharacters:""},ha={includeBlockContentTrailingSpace:!ea,includeSpaceBeforeBr:!ca,includeSpaceBeforeBlock:!da,includePreLineTrailingSpace:!0},ia={en:{wordRegex:/[a-z0-9]+('[a-z0-9]+)*/gi,includeTrailingSpace:!1,tokenizer:c}},ja={caseSensitive:!1,withinRange:null,wholeWordsOnly:!1,wrap:!1,direction:"forward",wordOptions:null,characterOptions:null},ka={wordOptions:null,characterOptions:null},la={wordOptions:null,characterOptions:null,trim:!1,trimStart:!0,trimEnd:!0},ma={wordOptions:null,characterOptions:null,direction:"forward"},na=S.getComputedStyleProperty;!function(){var a=document.createElement("table"),b=W(document);b.appendChild(a),fa="block"==na(a,"display"),b.removeChild(a)}();var oa={table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell"};w.prototype={get:function(a){return this.store.hasOwnProperty(a)?this.store[a]:null},set:function(a,b){return this.store[a]=b}};var pa=0,qa=0,ra={getPosition:function(a){var b=this.positions;return b.get(a)||b.set(a,new z(this,a))},toString:function(){return"[NodeWrapper("+S.inspectNode(this.node)+")]"}};y.prototype=ra;var sa="EMPTY",ta="NON_SPACE",ua="UNCOLLAPSIBLE_SPACE",va="COLLAPSIBLE_SPACE",wa="TRAILING_SPACE_BEFORE_BLOCK",xa="TRAILING_SPACE_IN_BLOCK",ya="TRAILING_SPACE_BEFORE_BR",za="PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK",Aa="TRAILING_LINE_BREAK_AFTER_BR",Ba="INCLUDED_TRAILING_LINE_BREAK_AFTER_BR";U(ra,{isCharacterDataNode:x("isCharacterDataNode",S.isCharacterDataNode,"node"),getNodeIndex:x("nodeIndex",S.getNodeIndex,"node"),getLength:x("nodeLength",S.getNodeLength,"node"),containsPositions:x("containsPositions",m,"node"),isWhitespace:x("isWhitespace",s,"node"), -isCollapsedWhitespace:x("isCollapsedWhitespace",t,"node"),getComputedDisplay:x("computedDisplay",i,"node"),isCollapsed:x("collapsed",u,"node"),isIgnored:x("ignored",v,"node"),next:x("nextPos",q,"node"),previous:x("previous",r,"node"),getTextNodeInfo:x("textNodeInfo",function(a){var b=null,c=!1,d=na(a.parentNode,"whiteSpace"),e="pre-line"==d;return e?(b=Y,c=!0):("normal"==d||"nowrap"==d)&&(b=X,c=!0),{node:a,text:a.data,spaceRegex:b,collapseSpaces:c,preLine:e}},"node"),hasInnerText:x("hasInnerText",function(a,b){for(var c=this.session,d=c.getPosition(a.parentNode,this.getNodeIndex()+1),e=c.getPosition(a,0),f=b?d:e,g=b?e:d;f!==g;){if(f.prepopulateChar(),f.isDefinitelyNonEmpty())return!0;f=b?f.previousVisible():f.nextVisible()}return!1},"node"),isRenderedBlock:x("isRenderedBlock",function(a){for(var b=a.getElementsByTagName("br"),c=0,d=b.length;d>c;++c)if(!u(b[c]))return!0;return this.hasInnerText()},"node"),getTrailingSpace:x("trailingSpace",function(a){if("br"==a.tagName.toLowerCase())return"";switch(this.getComputedDisplay()){case"inline":for(var b=a.lastChild;b;){if(!v(b))return 1==b.nodeType?this.session.getNodeWrapper(b).getTrailingSpace():"";b=b.previousSibling}break;case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":break;case"table-cell":return" ";default:return this.isRenderedBlock(!0)?"\n":""}return""},"node"),getLeadingSpace:x("leadingSpace",function(a){switch(this.getComputedDisplay()){case"inline":case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":case"table-cell":break;default:return this.isRenderedBlock(!1)?"\n":""}return""},"node")});var Ca={character:"",characterType:sa,isBr:!1,prepopulateChar:function(){var a=this;if(!a.prepopulatedChar){var b=a.node,c=a.offset,d="",e=sa,f=!1;if(c>0)if(3==b.nodeType){var g=b.data,h=g.charAt(c-1),i=a.nodeWrapper.getTextNodeInfo(),j=i.spaceRegex;i.collapseSpaces?j.test(h)?c>1&&j.test(g.charAt(c-2))||(i.preLine&&"\n"===g.charAt(c)?(d=" ",e=za):(d=" ",e=va)):(d=h,e=ta,f=!0):(d=h,e=ua,f=!0)}else{var k=b.childNodes[c-1];if(k&&1==k.nodeType&&!u(k)&&("br"==k.tagName.toLowerCase()?(d="\n",a.isBr=!0,e=va,f=!1):a.checkForTrailingSpace=!0),!d){var l=b.childNodes[c];l&&1==l.nodeType&&!u(l)&&(a.checkForLeadingSpace=!0)}}a.prepopulatedChar=!0,a.character=d,a.characterType=e,a.isCharInvariant=f}},isDefinitelyNonEmpty:function(){var a=this.characterType;return a==ta||a==ua},resolveLeadingAndTrailingSpaces:function(){if(this.prepopulatedChar||this.prepopulateChar(),this.checkForTrailingSpace){var a=this.session.getNodeWrapper(this.node.childNodes[this.offset-1]).getTrailingSpace();a&&(this.isTrailingSpace=!0,this.character=a,this.characterType=va),this.checkForTrailingSpace=!1}if(this.checkForLeadingSpace){var b=this.session.getNodeWrapper(this.node.childNodes[this.offset]).getLeadingSpace();b&&(this.isLeadingSpace=!0,this.character=b,this.characterType=va),this.checkForLeadingSpace=!1}},getPrecedingUncollapsedPosition:function(a){for(var b,c=this;c=c.previousVisible();)if(b=c.getCharacter(a),""!==b)return c;return null},getCharacter:function(a){function b(){return n||(k=o.getPrecedingUncollapsedPosition(a),n=!0),k}this.resolveLeadingAndTrailingSpaces();var c,d=this.character,e=f(a.ignoreCharacters),g=""!==d&&e.indexOf(d)>-1;if(this.isCharInvariant)return c=g?"":d;var h=["character",a.includeSpaceBeforeBr,a.includeBlockContentTrailingSpace,a.includePreLineTrailingSpace,e].join("_"),i=this.cache.get(h);if(null!==i)return i;var j,k,l="",m=this.characterType==va,n=!1,o=this;return m&&(this.type==Ba?l="\n":" "==d&&(!b()||k.isTrailingSpace||"\n"==k.character||" "==k.character&&k.characterType==va)||("\n"==d&&this.isLeadingSpace?b()&&"\n"!=k.character&&(l="\n"):(j=this.nextUncollapsed(),j&&(j.isBr?this.type=ya:j.isTrailingSpace&&"\n"==j.character?this.type=xa:j.isLeadingSpace&&"\n"==j.character&&(this.type=wa),"\n"==j.character?(this.type!=ya||a.includeSpaceBeforeBr)&&(this.type!=wa||a.includeSpaceBeforeBlock)&&(this.type==xa&&j.isTrailingSpace&&!a.includeBlockContentTrailingSpace||(this.type!=za||j.type!=ta||a.includePreLineTrailingSpace)&&("\n"==d?j.isTrailingSpace?this.isTrailingSpace||this.isBr&&(j.type=Aa,b()&&k.isLeadingSpace&&!k.isTrailingSpace&&"\n"==k.character?j.character="":j.type=Ba):l="\n":" "==d&&(l=" "))):l=d)))),e.indexOf(l)>-1&&(l=""),this.cache.set(h,l),l},equals:function(a){return!!a&&this.node===a.node&&this.offset===a.offset},inspect:A,toString:function(){return this.character}};z.prototype=Ca,U(Ca,{next:x("nextPos",function(a){var b=a.nodeWrapper,c=a.node,d=a.offset,e=b.session;if(!c)return null;var f,g,h;return d==b.getLength()?(f=c.parentNode,g=f?b.getNodeIndex()+1:0):b.isCharacterDataNode()?(f=c,g=d+1):(h=c.childNodes[d],e.getNodeWrapper(h).containsPositions()?(f=h,g=0):(f=c,g=d+1)),f?e.getPosition(f,g):null}),previous:x("previous",function(a){var b,c,d,e=a.nodeWrapper,f=a.node,g=a.offset,h=e.session;return 0==g?(b=f.parentNode,c=b?e.getNodeIndex():0):e.isCharacterDataNode()?(b=f,c=g-1):(d=f.childNodes[g-1],h.getNodeWrapper(d).containsPositions()?(b=d,c=S.getNodeLength(d)):(b=f,c=g-1)),b?h.getPosition(b,c):null}),nextVisible:x("nextVisible",function(a){var b=a.next();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex()+1)),e}),nextUncollapsed:x("nextUncollapsed",function(a){for(var b=a;b=b.nextVisible();)if(b.resolveLeadingAndTrailingSpaces(),""!==b.character)return b;return null}),previousVisible:x("previousVisible",function(a){var b=a.previous();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex())),e})});var Da=null,Ea=function(){function a(a){var b=new w;return{get:function(c){var d=b.get(c[a]);if(d)for(var e,f=0;e=d[f++];)if(e.node===c)return e;return null},set:function(c){var d=c.node[a],e=b.get(d)||b.set(d,[]);e.push(c)}}}function b(){this.initCaches()}var c=T.isHostProperty(document.documentElement,"uniqueID");return b.prototype={initCaches:function(){this.elementCache=c?function(){var a=new w;return{get:function(b){return a.get(b.uniqueID)},set:function(b){a.set(b.node.uniqueID,b)}}}():a("tagName"),this.textNodeCache=a("data"),this.otherNodeCache=a("nodeName")},getNodeWrapper:function(a){var b;switch(a.nodeType){case 1:b=this.elementCache;break;case 3:b=this.textNodeCache;break;default:b=this.otherNodeCache}var c=b.get(a);return c||(c=new y(a,this),b.set(c)),c},getPosition:function(a,b){return this.getNodeWrapper(a).getPosition(b)},getRangeBoundaryPosition:function(a,b){var c=b?"start":"end";return this.getPosition(a[c+"Container"],a[c+"Offset"])},detach:function(){this.elementCache=this.textNodeCache=this.otherNodeCache=null}},b}();U(S,{nextNode:q,previousNode:r});var Fa=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)if(a[c]===b)return c;return-1};U(a.rangePrototype,{moveStart:M(!0,!1),moveEnd:M(!1,!1),move:M(!0,!0),trimStart:N(!0),trimEnd:N(!1),trim:L(function(a,b){var c=this.trimStart(b),d=this.trimEnd(b);return c||d}),expand:L(function(a,b,c){var d=!1;c=h(c,la);var e=c.characterOptions;if(b||(b=Q),b==R){var f,g,i=c.wordOptions,j=a.getRangeBoundaryPosition(this,!0),k=a.getRangeBoundaryPosition(this,!1),l=F(j,e,i),m=l.nextEndToken(),n=m.chars[0].previousVisible();if(this.collapsed)f=m;else{var o=F(k,e,i);f=o.previousStartToken()}return g=f.chars[f.chars.length-1],n.equals(j)||(this.setStart(n.node,n.offset),d=!0),g&&!g.equals(k)&&(this.setEnd(g.node,g.offset),d=!0),c.trim&&(c.trimStart&&(d=this.trimStart(e)||d),c.trimEnd&&(d=this.trimEnd(e)||d)),d}return this.moveEnd(Q,1,c)}),text:L(function(a,b){return this.collapsed?"":I(a,this,V(b,ga)).join("")}),selectCharacters:L(function(a,b,c,d,e){var f={characterOptions:e};b||(b=W(this.getDocument())),this.selectNodeContents(b),this.collapse(!0),this.moveStart("character",c,f),this.collapse(!0),this.moveEnd("character",d-c,f)}),toCharacterRange:L(function(a,b,c){b||(b=W(this.getDocument()));var d,e,f=b.parentNode,g=S.getNodeIndex(b),h=-1==S.comparePoints(this.startContainer,this.endContainer,f,g),i=this.cloneRange();return h?(i.setStartAndEnd(this.startContainer,this.startOffset,f,g),d=-i.text(c).length):(i.setStartAndEnd(f,g,this.startContainer,this.startOffset),d=i.text(c).length),e=d+this.text(c).length,{start:d,end:e}}),findText:L(function(b,c,d){d=h(d,ja),d.wholeWordsOnly&&(d.wordOptions.includeTrailingSpace=!1);var e=aa(d.direction),f=d.withinRange;f||(f=a.createRange(),f.selectNodeContents(this.getDocument()));var g=c,i=!1;"string"==typeof g?d.caseSensitive||(g=g.toLowerCase()):i=!0;var j=b.getRangeBoundaryPosition(this,!e),k=f.comparePoint(j.node,j.offset);-1===k?j=b.getRangeBoundaryPosition(f,!0):1===k&&(j=b.getRangeBoundaryPosition(f,!1));for(var l,m=j,n=!1;;)if(l=K(m,g,i,f,d)){if(l.valid)return this.setStartAndEnd(l.startPos.node,l.startPos.offset,l.endPos.node,l.endPos.offset),!0;m=e?l.startPos:l.endPos}else{if(!d.wrap||n)return!1;f=f.cloneRange(),m=b.getRangeBoundaryPosition(f,!e),f.setBoundary(j.node,j.offset,e),n=!0}}),pasteHtml:function(a){if(this.deleteContents(),a){var b=this.createContextualFragment(a),c=b.lastChild;this.insertNode(b),this.collapseAfter(c)}}}),U(a.selectionPrototype,{expand:L(function(a,b,c){this.changeEachRange(function(a){a.expand(b,c)})}),move:L(function(a,b,c,d){var e=0;if(this.focusNode){this.collapse(this.focusNode,this.focusOffset);var f=this.getRangeAt(0);d||(d={}),d.characterOptions=V(d.characterOptions,ha),e=f.move(b,c,d),this.setSingleRange(f)}return e}),trimStart:O("trimStart"),trimEnd:O("trimEnd"),trim:O("trim"),selectCharacters:L(function(b,c,d,e,f,g){var h=a.createRange(c);h.selectCharacters(c,d,e,g),this.setSingleRange(h,f)}),saveCharacterRanges:L(function(a,b,c){for(var d=this.getAllRanges(),e=d.length,f=[],g=1==e&&this.isBackward(),h=0,i=d.length;i>h;++h)f[h]={characterRange:d[h].toCharacterRange(b,c),backward:g,characterOptions:c};return f}),restoreCharacterRanges:L(function(b,c,d){this.removeAllRanges();for(var e,f,g,h=0,i=d.length;i>h;++h)f=d[h],g=f.characterRange,e=a.createRange(c),e.selectCharacters(c,g.start,g.end,f.characterOptions),this.addRange(e,f.backward)}),text:L(function(a,b){for(var c=[],d=0,e=this.rangeCount;e>d;++d)c[d]=this.getRangeAt(d).text(b);return c.join("")})}),a.innerText=function(b,c){var d=a.createRange(b);d.selectNodeContents(b);var e=d.text(c);return e},a.createWordIterator=function(a,b,c){var d=C();c=h(c,ma);var e=d.getPosition(a,b),f=F(e,c.characterOptions,c.wordOptions),g=aa(c.direction);return{next:function(){return g?f.previousStartToken():f.nextEndToken()},dispose:function(){f.dispose(),this.next=function(){}}}},a.noMutation=function(a){var b=C();a(b),D()},a.noMutation.createEntryPointFunction=L,a.textRange={isBlockNode:l,isCollapsedWhitespaceNode:t,createPosition:L(function(a,b,c){return a.getPosition(b,c)})}}),a},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("SaveRestore",["WrappedRange"],function(a,b){function c(a,b){return(b||document).getElementById(a)}function d(a,b){var c,d="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),e=o.getDocument(a.startContainer),f=a.cloneRange();return f.collapse(b),c=e.createElement("span"),c.id=d,c.style.lineHeight="0",c.style.display="none",c.className="rangySelectionBoundary",c.appendChild(e.createTextNode(r)),f.insertNode(c),c}function e(a,d,e,f){var g=c(e,a);g?(d[f?"setStartBefore":"setEndBefore"](g),p(g)):b.warn("Marker element has been removed. Cannot restore selection.")}function f(a,b){return b.compareBoundaryPoints(a.START_TO_START,a)}function g(b,c){var e,f,g=a.DomRange.getRangeDocument(b),h=b.toString(),i=q(c);return b.collapsed?(f=d(b,!1),{document:g,markerId:f.id,collapsed:!0}):(f=d(b,!1),e=d(b,!0),{document:g,startMarkerId:e.id,endMarkerId:f.id,collapsed:!1,backward:i,toString:function(){return"original text: '"+h+"', new text: '"+b.toString()+"'"}})}function h(d,f){var g=d.document;"undefined"==typeof f&&(f=!0);var h=a.createRange(g);if(d.collapsed){var i=c(d.markerId,g);if(i){i.style.display="inline";var j=i.previousSibling;j&&3==j.nodeType?(p(i),h.collapseToPoint(j,j.length)):(h.collapseBefore(i),p(i))}else b.warn("Marker element has been removed. Cannot restore selection.")}else e(g,h,d.startMarkerId,!0),e(g,h,d.endMarkerId,!1);return f&&h.normalizeBoundaries(),h}function i(b,d){var e,h,i=[],j=q(d);b=b.slice(0),b.sort(f);for(var k=0,l=b.length;l>k;++k)i[k]=g(b[k],j);for(k=l-1;k>=0;--k)e=b[k],h=a.DomRange.getRangeDocument(e),e.collapsed?e.collapseAfter(c(i[k].markerId,h)):(e.setEndBefore(c(i[k].endMarkerId,h)),e.setStartAfter(c(i[k].startMarkerId,h)));return i}function j(c){if(!a.isSelectionValid(c))return b.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var d=a.getSelection(c),e=d.getAllRanges(),f=1==e.length&&d.isBackward(),g=i(e,f);return f?d.setSingleRange(e[0],f):d.setRanges(e),{win:c,rangeInfos:g,restored:!1}}function k(a){for(var b=[],c=a.length,d=c-1;d>=0;d--)b[d]=h(a[d],!0);return b}function l(b,c){if(!b.restored){var d=b.rangeInfos,e=a.getSelection(b.win),f=k(d),g=d.length;1==g&&c&&a.features.selectionHasExtend&&d[0].backward?(e.removeAllRanges(),e.addRange(f[0],!0)):e.setRanges(f),b.restored=!0}}function m(a,b){var d=c(b,a);d&&p(d)}function n(a){for(var b,c=a.rangeInfos,d=0,e=c.length;e>d;++d)b=c[d],b.collapsed?m(a.doc,b.markerId):(m(a.doc,b.startMarkerId),m(a.doc,b.endMarkerId))}var o=a.dom,p=o.removeNode,q=a.Selection.isDirectionBackward,r="\ufeff";a.util.extend(a,{saveRange:g,restoreRange:h,saveRanges:i,restoreRanges:k,saveSelection:j,restoreSelection:l,removeMarkerElement:m,removeMarkers:n})}),a},this);var Base=function(){};Base.extend=function(a,b){var c=Base.prototype.extend;Base._prototyping=!0;var d=new this;c.call(d,a),d.base=function(){},delete Base._prototyping;var e=d.constructor,f=d.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==f)this._constructing=!0,e.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||c).call(arguments[0],d)};return f.ancestor=this,f.extend=this.extend,f.forEach=this.forEach,f.implement=this.implement,f.prototype=d,f.toString=this.toString,f.valueOf=function(a){return"object"==a?f:e.valueOf()},c.call(f,b),"function"==typeof f.init&&f.init(),f},Base.prototype={extend:function(a,b){if(arguments.length>1){var c=this[a];if(c&&"function"==typeof b&&(!c.valueOf||c.valueOf()!=b.valueOf())&&/\bbase\b/.test(b)){var d=b.valueOf();b=function(){var a=this.base||Base.prototype.base;this.base=c;var b=d.apply(this,arguments);return this.base=a,b},b.valueOf=function(a){return"object"==a?b:d},b.toString=Base.toString}this[a]=b}else if(a){var e=Base.prototype.extend;Base._prototyping||"function"==typeof this||(e=this.extend||e);for(var f={toSource:null},g=["constructor","toString","valueOf"],h=Base._prototyping?0:1;i=g[h++];)a[i]!=f[i]&&e.call(this,i,a[i]);for(var i in a)f[i]||e.call(this,i,a[i])}return this}},Base=Base.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(a,b,c){for(var d in a)void 0===this.prototype[d]&&b.call(c,a[d],d,a)},implement:function(){for(var a=0;a-1?c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"):/Edge\/(\d+)./i.test(navigator.userAgent)&&(c=/Edge\/(\d+)./i)),c&&null!=c.exec(navigator.userAgent)&&(d=parseFloat(RegExp.$1)),-1===d?!1:a?b?"<"===b?d>a:">"===b?a>d:"<="===b?d>=a:">="===b?a>=d:void 0:a===d:!0}var d=navigator.userAgent,e=document.createElement("div"),f=-1!==d.indexOf("Gecko")&&-1===d.indexOf("KHTML")&&!c(),g=-1!==d.indexOf("AppleWebKit/")&&!c(),h=-1!==d.indexOf("Chrome/")&&!c(),i=-1!==d.indexOf("Opera/")&&!c();return{USER_AGENT:d,supported:function(){var c=this.USER_AGENT.toLowerCase(),d="contentEditable"in e,f=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,g=document.querySelector&&document.querySelectorAll,h=this.isIos()&&a(c)<5||this.isAndroid()&&b(c)<4||-1!==c.indexOf("opera mobi")||-1!==c.indexOf("hpwos/");return d&&f&&g&&!h},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){return/ipad|iphone|ipod/i.test(this.USER_AGENT)},isAndroid:function(){return-1!==this.USER_AGENT.indexOf("Android")},supportsSandboxedIframes:function(){return c()},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return c(12,">")},hasCurrentStyleProperty:function(){return"currentStyle"in e},insertsLineBreaksOnReturn:function(){return f},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){return"on"+a in e||function(){return e.setAttribute("on"+a,"return;"),"function"==typeof e["on"+a]}()},supportsEventsInIframeCorrectly:function(){return!i},supportsHTML5Tags:function(a){var b=a.createElement("div"),c="
    foo
    ";return b.innerHTML=c,b.innerHTML.toLowerCase()===c},supportsCommand:function(){var a={formatBlock:c(10,"<="),insertUnorderedList:c(),insertOrderedList:c()},b={insertHTML:f};return function(c,d){var e=a[d];if(!e){try{return c.queryCommandSupported(d)}catch(f){}try{return c.queryCommandEnabled(d)}catch(g){return!!b[d]}}return!1}}(),doesAutoLinkingInContentEditable:function(){return c()},canDisableAutoLinking:function(){return this.supportsCommand(document,"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return f||i||g},supportsGetAttributeCorrectly:function(){var a=document.createElement("td");return"1"!=a.getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return f||c()||i},autoScrollsToCaret:function(){return!g},autoClosesUnclosedTags:function(){var a,b,c=e.cloneNode(!1);return c.innerHTML="

    ",b=c.innerHTML.toLowerCase(),a="

    "===b||"

    "===b,this.autoClosesUnclosedTags=function(){return a},a},supportsNativeGetElementsByClassName:function(){return-1!==String(document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},needsSpaceAfterLineBreak:function(){return i},supportsSpeechApiOn:function(a){var b=d.match(/Chrome\/(\d+)/)||[void 0,0];return b[1]>=11&&("onwebkitspeechchange"in a||"speech"in a)},crashesWhenDefineProperty:function(a){return c(9)&&("XMLHttpRequest"===a||"XDomainRequest"===a)},doesAsyncFocus:function(){return c(12,">")},hasProblemsSettingCaretAfterImg:function(){return c()},hasLiDeletingProblem:function(){return c()},hasUndoInContextMenu:function(){return f||h||i},hasInsertNodeIssue:function(){return i},hasIframeFocusIssue:function(){return c()},createsNestedInvalidMarkupAfterPaste:function(){return g},hasCaretBlockElementIssue:function(){return g},supportsMutationEvents:function(){return"MutationEvent"in window},supportsModernPaste:function(){return!c()},fixStyleKey:function(a){return"cssFloat"===a?"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat":a},usesControlRanges:function(){return document.body&&"createControlRange"in document.body}}}(),wysihtml5.lang.array=function(a){return{contains:function(b){if(Array.isArray(b)){for(var c=b.length;c--;)if(-1!==wysihtml5.lang.array(a).indexOf(b[c]))return!0;return!1}return-1!==wysihtml5.lang.array(a).indexOf(b)},indexOf:function(b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},without:function(b){b=wysihtml5.lang.array(b);for(var c=[],d=0,e=a.length;e>d;d++)b.contains(a[d])||c.push(a[d]);return c},get:function(){for(var b=0,c=a.length,d=[];c>b;b++)d.push(a[b]);return d},map:function(b,c){if(Array.prototype.map)return a.map(b,c);for(var d=a.length>>>0,e=new Array(d),f=0;d>f;f++)e[f]=b.call(c,a[f],f,a);return e},unique:function(){for(var b=[],c=a.length,d=0;c>d;)wysihtml5.lang.array(b).contains(a[d])||b.push(a[d]),d++;return b}}},wysihtml5.lang.Dispatcher=Base.extend({on:function(a,b){return this.events=this.events||{},this.events[a]=this.events[a]||[],this.events[a].push(b),this},off:function(a,b){this.events=this.events||{};var c,d,e=0;if(a){for(c=this.events[a]||[],d=[];e\t"]/g,d={"&":"&","<":"<",">":">",'"':"""," ":"  "};wysihtml5.lang.string=function(e){return e=String(e),{trim:function(){return e.replace(a,"").replace(b,"")},interpolate:function(a){for(var b in a)e=this.replace("#{"+b+"}").by(a[b]);return e},replace:function(a){return{by:function(b){return e.split(a).join(b)}}},escapeHTML:function(a,b){var f=e.replace(c,function(a){return d[a]});return a&&(f=f.replace(/(?:\r\n|\r|\n)/g,"
    ")),b&&(f=f.replace(/ /gi,"  ")),f}}}}(),function(a){function b(a,b){return f(a,b)?a:(a===a.ownerDocument.documentElement&&(a=a.ownerDocument.body),g(a,b))}function c(a){return a.replace(i,function(a,b){var c=(b.match(j)||[])[1]||"",d=l[c];b=b.replace(j,""),b.split(d).length>b.split(c).length&&(b+=c,c="");var e=b,f=b;return b.length>k&&(f=f.substr(0,k)+"..."),"www."===e.substr(0,4)&&(e="http://"+e),'
    '+f+""+c})}function d(a){var b=a._wysihtml5_tempElement;return b||(b=a._wysihtml5_tempElement=a.createElement("div")),b}function e(b){var e=b.parentNode,f=a.lang.string(b.data).escapeHTML(),g=d(e.ownerDocument);for(g.innerHTML=""+c(f),g.removeChild(g.firstChild);g.firstChild;)e.insertBefore(g.firstChild,b);e.removeChild(b)}function f(b,c){for(var d;b.parentNode;){if(b=b.parentNode,d=b.nodeName,b.className&&a.lang.array(b.className.split(" ")).contains(c))return!0;if(h.contains(d))return!0;if("body"===d)return!1}return!1}function g(b,c){if(!(h.contains(b.nodeName)||b.className&&a.lang.array(b.className.split(" ")).contains(c))){if(b.nodeType===a.TEXT_NODE&&b.data.match(i))return void e(b);for(var d=a.lang.array(b.childNodes).get(),f=d.length,j=0;f>j;j++)g(d[j],c);return b}}var h=a.lang.array(["CODE","PRE","A","SCRIPT","HEAD","TITLE","STYLE"]),i=/((https?:\/\/|www\.)[^\s<]{3,})/gi,j=/([^\w\/\-](,?))$/i,k=100,l={")":"(","]":"[","}":"{"};a.dom.autoLink=b,a.dom.autoLink.URL_REG_EXP=i}(wysihtml5),function(a){var b=a.dom;b.addClass=function(a,c){var d=a.classList;return d?d.add(c):void(b.hasClass(a,c)||(a.className+=" "+c))},b.removeClass=function(a,b){var c=a.classList;return c?c.remove(b):void(a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," "))},b.hasClass=function(a,b){var c=a.classList;if(c)return c.contains(b);var d=a.className;return d.length>0&&(d==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(d))}}(wysihtml5),wysihtml5.dom.contains=function(){var a=document.documentElement;return a.contains?function(a,b){if(b.nodeType!==wysihtml5.ELEMENT_NODE){if(b.parentNode===a)return!0;b=b.parentNode}return a!==b&&a.contains(b)}:a.compareDocumentPosition?function(a,b){return!!(16&a.compareDocumentPosition(b))}:void 0}(),wysihtml5.dom.convertToList=function(){function a(a,b){var c=a.createElement("li");return b.appendChild(c),c}function b(a,b){return a.createElement(b)}function c(c,d,e){if("UL"===c.nodeName||"OL"===c.nodeName||"MENU"===c.nodeName)return c;var f,g,h,i,j,k,l,m,n,o=c.ownerDocument,p=b(o,d),q=c.querySelectorAll("br"),r=q.length;for(n=0;r>n;n++)for(i=q[n];(j=i.parentNode)&&j!==c&&j.lastChild===i;){if("block"===wysihtml5.dom.getStyle("display").from(j)){j.removeChild(i);break}wysihtml5.dom.insert(i).after(i.parentNode)}for(f=wysihtml5.lang.array(c.childNodes).get(),g=f.length,n=0;g>n;n++)m=m||a(o,p),h=f[n],k="block"===wysihtml5.dom.getStyle("display").from(h),l="BR"===h.nodeName,!k||e&&wysihtml5.dom.hasClass(h,e)?l?m=m.firstChild?null:m:m.appendChild(h):(m=m.firstChild?a(o,p):m,m.appendChild(h),m=null);return 0===f.length&&a(o,p),c.parentNode.replaceChild(p,c),p}return c}(),wysihtml5.dom.copyAttributes=function(a){return{from:function(b){return{to:function(c){for(var d,e=0,f=a.length;f>e;e++)d=a[e],"undefined"!=typeof b[d]&&""!==b[d]&&(c[d]=b[d]);return{andTo:arguments.callee}}}}}},function(a){var b=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],c=function(b){return d(b)?parseInt(a.getStyle("width").from(b),10)d;d++)if("border-box"===a.getStyle(b[d]).from(c))return b[d]};a.copyStyles=function(d){return{from:function(e){c(e)&&(d=wysihtml5.lang.array(d).without(b));for(var f,g="",h=d.length,i=0;h>i;i++)f=d[i],g+=f+":"+a.getStyle(f).from(e)+";";return{to:function(b){return a.setStyles(g).on(b),{andTo:arguments.callee}}}}}}}(wysihtml5.dom),function(a){a.dom.delegate=function(a,b,c,d){var e=function(c){for(var e=c.target,f=3===e.nodeType?e.parentNode:e,g=a.querySelectorAll(b),h=0,i=g.length;i>h;h++)g[h].contains(f)&&d.call(g[h],c)};return a.addEventListener(c,e,!1),{stop:function(){a.removeEventListener(c,e,!1)}}}}(wysihtml5),function(a){function b(a,b){for(var c=[a],d=a;b&&d&&d!==b||!b&&d;)c.unshift(d),d=d.parentNode;return c}a.dom.domNode=function(c){var d=[a.ELEMENT_NODE,a.TEXT_NODE];return{is:{emptyTextNode:function(b){var d=b?/^\s*$/g:/^[\r\n]*$/g;return c&&c.nodeType===a.TEXT_NODE&&d.test(c.data)},rangyBookmark:function(){return c&&1===c.nodeType&&c.classList.contains("rangySelectionBoundary")},visible:function(){var b=!/^\s*$/g.test(a.dom.getTextContent(c));return b||1===c.nodeType&&c.querySelector("img, br, hr, object, embed, canvas, input, textarea")&&(b=!0),b},lineBreak:function(){return c&&1===c.nodeType&&"BR"===c.nodeName},block:function(){return c&&1===c.nodeType&&"block"===c.ownerDocument.defaultView.getComputedStyle(c).display},voidElement:function(){return a.dom.domNode(c).test({query:a.VOID_ELEMENTS})}},prev:function(b){var e=c.previousSibling,f=b&&b.nodeTypes?b.nodeTypes:d;return e?a.dom.domNode(e).is.rangyBookmark()||!a.lang.array(f).contains(e.nodeType)||b&&b.ignoreBlankTexts&&a.dom.domNode(e).is.emptyTextNode(!0)?a.dom.domNode(e).prev(b):e:null},next:function(b){var e=c.nextSibling,f=b&&b.nodeTypes?b.nodeTypes:d;return e?a.dom.domNode(e).is.rangyBookmark()||!a.lang.array(f).contains(e.nodeType)||b&&b.ignoreBlankTexts&&a.dom.domNode(e).is.emptyTextNode(!0)?a.dom.domNode(e).next(b):e:null},commonAncestor:function(a,d){var e=b(c,d),f=b(a,d);if(e[0]!=f[0])return null;for(var g=0;g0)for(var f=!1,g=Array.isArray(b.styleProperty)?b.styleProperty:[b.styleProperty],h=0,i=g.length;i>h;h++){if(d=a.browser.fixStyleKey(g[h]),c.style[d]){if(!b.styleValue){f=!0;break}if(b.styleValue instanceof RegExp){if(c.style[d].trim().match(b.styleValue).length>0){f=!0;break}}else if(Array.isArray(b.styleValue)){if(b.styleValue.indexOf(c.style[d].trim())){f=!0;break}}else if(b.styleValue===c.style[d].trim().replace(/, /g,",")){f=!0;break}}if(!f)return!1}if(b.attribute){var j=a.dom.getAttributes(c),k=[],l=!1;Array.isArray(b.attribute)?k=b.attribute:k[b.attribute]=b.attributeValue;for(var m in k)if(k.hasOwnProperty(m))if("undefined"==typeof k[m]){if("undefined"!=typeof j[m]){l=!0;break}}else if(j[m]===k[m]){l=!0;break}if(!l)return!1}return!0}}}}(wysihtml5),wysihtml5.dom.getAsDom=function(){var a=function(a,b){var c=b.createElement("div");c.style.display="none",b.body.appendChild(c);try{c.innerHTML=a}catch(d){}return b.body.removeChild(c),c},b=function(a){if(!a._wysihtml5_supportsHTML5Tags){for(var b=0,d=c.length;d>b;b++)a.createElement(c[b]);a._wysihtml5_supportsHTML5Tags=!0}},c=["abbr","article","aside","audio","bdi","canvas","command","datalist","details","figcaption","figure","footer","header","hgroup","keygen","mark","meter","nav","output","progress","rp","rt","ruby","svg","section","source","summary","time","track","video","wbr"];return function(c,d){d=d||document;var e;return"object"==typeof c&&c.nodeType?(e=d.createElement("div"),e.appendChild(c)):wysihtml5.browser.supportsHTML5Tags(d)?(e=d.createElement("div"),e.innerHTML=c):(b(d),e=a(c,d)),e}}(),wysihtml5.dom.getParentElement=function(){return function(a,b,c,d){ -for(c=c||50;c--&&a&&"BODY"!==a.nodeName&&(!d||a!==d);){if(wysihtml5.dom.domNode(a).test(b))return a;a=a.parentNode}return null}}(),wysihtml5.dom.getStyle=function(){function a(a){return a.replace(c,function(a){return a.charAt(1).toUpperCase()})}var b={"float":"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat"},c=/\-[a-z]/g;return function(c){return{from:function(d){if(d.nodeType===wysihtml5.ELEMENT_NODE){var e=d.ownerDocument,f=b[c]||a(c),g=d.style,h=d.currentStyle,i=g[f];if(i)return i;if(h)try{return h[f]}catch(j){}var k,l,m=e.defaultView||e.parentWindow,n=("height"===c||"width"===c)&&"TEXTAREA"===d.nodeName;return m.getComputedStyle?(n&&(k=g.overflow,g.overflow="hidden"),l=m.getComputedStyle(d,null).getPropertyValue(c),n&&(g.overflow=k||""),l):void 0}}}}}(),wysihtml5.dom.getTextNodes=function(a,b){var c=[];for(a=a.firstChild;a;a=a.nextSibling)3==a.nodeType?b&&/^\s*$/.test(a.innerText||a.textContent)||c.push(a):c=c.concat(wysihtml5.dom.getTextNodes(a,b));return c},wysihtml5.dom.hasElementWithTagName=function(){function a(a){return a._wysihtml5_identifier||(a._wysihtml5_identifier=c++)}var b={},c=1;return function(c,d){var e=a(c)+":"+d,f=b[e];return f||(f=b[e]=c.getElementsByTagName(d)),f.length>0}}(),function(a){function b(a){return a._wysihtml5_identifier||(a._wysihtml5_identifier=d++)}var c={},d=1;a.dom.hasElementWithClassName=function(d,e){if(!a.browser.supportsNativeGetElementsByClassName())return!!d.querySelector("."+e);var f=b(d)+":"+e,g=c[f];return g||(g=c[f]=d.getElementsByClassName(e)),g.length>0}}(wysihtml5),wysihtml5.dom.insert=function(a){return{after:function(b){b.parentNode.insertBefore(a,b.nextSibling)},before:function(b){b.parentNode.insertBefore(a,b)},into:function(b){b.appendChild(a)}}},wysihtml5.dom.insertCSS=function(a){return a=a.join("\n"),{into:function(b){var c=b.createElement("style");c.type="text/css",c.styleSheet?c.styleSheet.cssText=a:c.appendChild(b.createTextNode(a));var d=b.querySelector("head link");if(d)return void d.parentNode.insertBefore(c,d);var e=b.querySelector("head");e&&e.appendChild(c)}}},function(a){a.dom.lineBreaks=function(b){function c(a){return"BR"===a.nodeName}function d(b){return c(b)?!0:"block"===a.dom.getStyle("display").from(b)?!0:!1}return{add:function(c){var e=b.ownerDocument,f=a.dom.domNode(b).next({ignoreBlankTexts:!0}),g=a.dom.domNode(b).prev({ignoreBlankTexts:!0});f&&!d(f)&&a.dom.insert(e.createElement("br")).after(b),g&&!d(g)&&a.dom.insert(e.createElement("br")).before(b)},remove:function(d){var e=a.dom.domNode(b).next({ignoreBlankTexts:!0}),f=a.dom.domNode(b).prev({ignoreBlankTexts:!0});e&&c(e)&&e.parentNode.removeChild(e),f&&c(f)&&f.parentNode.removeChild(f)}}}}(wysihtml5),wysihtml5.dom.observe=function(a,b,c){b="string"==typeof b?[b]:b;for(var d,e,f=0,g=b.length;g>f;f++)e=b[f],a.addEventListener?a.addEventListener(e,c,!1):(d=function(b){"target"in b||(b.target=b.srcElement),b.preventDefault=b.preventDefault||function(){this.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){this.cancelBubble=!0},c.call(a,b)},a.attachEvent("on"+e,d));return{stop:function(){for(var e,f=0,g=b.length;g>f;f++)e=b[f],a.removeEventListener?a.removeEventListener(e,c,!1):a.detachEvent("on"+e,d)}}},wysihtml5.dom.parse=function(a,b){function c(a,b){wysihtml5.lang.object(t).merge(s).merge(b.rules).get();var c,f,g,h=b.context||a.ownerDocument||document,i=h.createDocumentFragment(),j="string"==typeof a,k=!1;for(b.clearInternals===!0&&(k=!0),c=j?wysihtml5.dom.getAsDom(a,h):a,t.selectors&&e(c,t.selectors);c.firstChild;)g=c.firstChild,f=d(g,b.cleanUp,k,b.uneditableClass),f&&i.appendChild(f),g!==f&&c.removeChild(g);if(b.unjoinNbsps)for(var l=wysihtml5.dom.getTextNodes(i),m=l.length;m--;)l[m].nodeValue=l[m].nodeValue.replace(/([\S\u00A0])\u00A0/gi,"$1 ");return c.innerHTML="",c.appendChild(i),j?wysihtml5.quirks.getCorrectInnerHTML(c):c}function d(a,b,c,e){var f,g,h,i,j=a.nodeType,k=a.childNodes,l=k.length,m=p[j],n=0;if(e&&1===j&&wysihtml5.dom.hasClass(a,e))return a;if(g=m&&m(a,c),!g){if(g===!1){for(f=a.ownerDocument.createDocumentFragment(),n=l;n--;)k[n]&&(h=d(k[n],b,c,e),h&&(k[n]===h&&n--,f.insertBefore(h,f.firstChild)));return i=wysihtml5.dom.getStyle("display").from(a),""===i&&(i=wysihtml5.lang.array(u).contains(a.tagName)?"block":""),wysihtml5.lang.array(["block","flex","table"]).contains(i)&&f.appendChild(a.ownerDocument.createElement("br")),wysihtml5.lang.array(["div","pre","p","table","td","th","ul","ol","li","dd","dl","footer","header","section","h1","h2","h3","h4","h5","h6"]).contains(a.nodeName.toLowerCase())&&a.parentNode.lastChild!==a&&(a.nextSibling&&3===a.nextSibling.nodeType&&/^\s/.test(a.nextSibling.nodeValue)||f.appendChild(a.ownerDocument.createTextNode(" "))),f.normalize&&f.normalize(),f}return null}for(n=0;l>n;n++)k[n]&&(h=d(k[n],b,c,e),h&&(k[n]===h&&n--,g.appendChild(h)));if(b&&g.nodeName.toLowerCase()===q&&(!g.childNodes.length||/^\s*$/gi.test(g.innerHTML)&&(c||"_wysihtml5-temp-placeholder"!==a.className&&"rangySelectionBoundary"!==a.className)||!g.attributes.length)){for(f=g.ownerDocument.createDocumentFragment();g.firstChild;)f.appendChild(g.firstChild);return f.normalize&&f.normalize(),f}return g.normalize&&g.normalize(),g}function e(a,b){var c,d,e;for(c in b)if(b.hasOwnProperty(c)){wysihtml5.lang.object(b[c]).isFunction()?d=b[c]:"string"==typeof b[c]&&z[b[c]]&&(d=z[b[c]]),e=a.querySelectorAll(c);for(var f=e.length;f--;)d(e[f])}}function f(a,b){var c,d,e,f=t.tags,h=a.nodeName.toLowerCase(),j=a.scopeName;if(a._wysihtml5)return null;if(a._wysihtml5=1,"wysihtml5-temp"===a.className)return null;if(j&&"HTML"!=j&&(h=j+":"+h),"outerHTML"in a&&(wysihtml5.browser.autoClosesUnclosedTags()||"P"!==a.nodeName||"

    "===a.outerHTML.slice(-4).toLowerCase()||(h="div")),h in f){if(c=f[h],!c||c.remove)return null;if(c.unwrap)return!1;c="string"==typeof c?{rename_tag:c}:c}else{if(!a.firstChild)return null;c={rename_tag:q}}if(c.one_of_type&&!g(a,t,c.one_of_type,b)){if(!c.remove_action)return null;if("unwrap"===c.remove_action)return!1;if("rename"!==c.remove_action)return null;e=c.remove_action_rename_to||q}return d=a.ownerDocument.createElement(e||c.rename_tag||h),m(a,d,c,b),i(a,d,c),a=null,d.normalize&&d.normalize(),d}function g(a,b,c,d){var e,f;if("SPAN"===a.nodeName&&!d&&("_wysihtml5-temp-placeholder"===a.className||"rangySelectionBoundary"===a.className))return!0;for(f in c)if(c.hasOwnProperty(f)&&b.type_definitions&&b.type_definitions[f]&&(e=b.type_definitions[f],h(a,e)))return!0;return!1}function h(a,b){var c,d,e,f,g,h=a.getAttribute("class"),i=a.getAttribute("style");if(b.methods)for(var j in b.methods)if(b.methods.hasOwnProperty(j)&&y[j]&&y[j](a))return!0;if(h&&b.classes){h=h.replace(/^\s+/g,"").replace(/\s+$/g,"").split(r),c=h.length;for(var k=0;c>k;k++)if(b.classes[h[k]])return!0}if(i&&b.styles){i=i.split(";");for(d in b.styles)if(b.styles.hasOwnProperty(d))for(var l=i.length;l--;)if(g=i[l].split(":"),g[0].replace(/\s/g,"").toLowerCase()===d&&(b.styles[d]===!0||1===b.styles[d]||wysihtml5.lang.array(b.styles[d]).contains(g[1].replace(/\s/g,"").toLowerCase())))return!0}if(b.attrs)for(e in b.attrs)if(b.attrs.hasOwnProperty(e)&&(f=wysihtml5.dom.getAttribute(a,e),"string"==typeof f&&f.search(b.attrs[e])>-1))return!0;return!1}function i(a,b,c){var d,e;if(c&&c.keep_styles)for(d in c.keep_styles)if(c.keep_styles.hasOwnProperty(d)){if(e="float"===d?a.style.styleFloat||a.style.cssFloat:a.style[d],c.keep_styles[d]instanceof RegExp&&!c.keep_styles[d].test(e))continue;"float"===d?b.style[a.style.styleFloat?"styleFloat":"cssFloat"]=e:a.style[d]&&(b.style[d]=e)}}function j(a,b){var c=[];for(var d in b)b.hasOwnProperty(d)&&0===d.indexOf(a)&&c.push(d);return c}function k(a,b,c,d){var e,f=wysihtml5.lang.object(c).isFunction()?c:v[c];return f&&(e=f(b,d),"string"==typeof e)?e:!1}function l(a,b){var c,d,e,f=wysihtml5.lang.object(t.attributes||{}).clone(),g=wysihtml5.lang.object(f).merge(wysihtml5.lang.object(b||{}).clone()).get(),h={},i=wysihtml5.dom.getAttributes(a);for(c in g)if(/\*$/.test(c)){e=j(c.slice(0,-1),i);for(var l=0,m=e.length;m>l;l++)d=k(e[l],i[e[l]],g[c],a.nodeName),d!==!1&&(h[e[l]]=d)}else d=k(c,i[c],g[c],a.nodeName),d!==!1&&(h[c]=d);return h}function m(a,b,c,d){var e,f,g,h,i,j={},k=c.set_class,m=c.add_class,n=c.add_style,o=c.set_attributes,p=t.classes,q=0,s=[],u=[],v=[],y=[];if(o&&(j=wysihtml5.lang.object(o).clone()),j=wysihtml5.lang.object(j).merge(l(a,c.check_attributes)).get(),k&&s.push(k),m)for(h in m)i=x[m[h]],i&&(g=i(wysihtml5.dom.getAttribute(a,h)),"string"==typeof g&&s.push(g));if(n)for(h in n)i=w[n[h]],i&&(newStyle=i(wysihtml5.dom.getAttribute(a,h)),"string"==typeof newStyle&&u.push(newStyle));if("string"==typeof p&&"any"===p)if(a.getAttribute("class"))if(t.classes_blacklist){for(y=a.getAttribute("class"),y&&(s=s.concat(y.split(r))),e=s.length;e>q;q++)f=s[q],t.classes_blacklist[f]||v.push(f);v.length&&(j["class"]=wysihtml5.lang.array(v).unique().join(" "))}else j["class"]=a.getAttribute("class");else s&&s.length>0&&(j["class"]=wysihtml5.lang.array(s).unique().join(" "));else{for(d||(p["_wysihtml5-temp-placeholder"]=1,p._rangySelectionBoundary=1,p["wysiwyg-tmp-selected-cell"]=1),y=a.getAttribute("class"),y&&(s=s.concat(y.split(r))),e=s.length;e>q;q++)f=s[q],p[f]&&v.push(f);v.length&&(j["class"]=wysihtml5.lang.array(v).unique().join(" "))}j["class"]&&d&&(j["class"]=j["class"].replace("wysiwyg-tmp-selected-cell",""),/^\s*$/g.test(j["class"])&&delete j["class"]),u.length&&(j.style=wysihtml5.lang.array(u).unique().join(" "));for(h in j)try{b.setAttribute(h,j[h])}catch(z){}j.src&&("undefined"!=typeof j.width&&b.setAttribute("width",j.width),"undefined"!=typeof j.height&&b.setAttribute("height",j.height))}function n(a){var b=a.nextSibling;if(!b||b.nodeType!==wysihtml5.TEXT_NODE){var c=a.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP,"");return a.ownerDocument.createTextNode(c)}b.data=a.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP,"")+b.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP,"")}function o(a){return t.comments?a.ownerDocument.createComment(a.nodeValue):void 0}var p={1:f,3:n,8:o},q="span",r=/\s+/,s={tags:{},classes:{}},t={},u=["ADDRESS","BLOCKQUOTE","CENTER","DIR","DIV","DL","FIELDSET","FORM","H1","H2","H3","H4","H5","H6","ISINDEX","MENU","NOFRAMES","NOSCRIPT","OL","P","PRE","TABLE","UL"],v={url:function(){var a=/^https?:\/\//i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),src:function(){var a=/^(\/|https?:\/\/)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),href:function(){var a=/^(#|\/|https?:\/\/|mailto:|tel:)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),alt:function(){var a=/[^ a-z0-9_\-]/gi;return function(b,c){return b?b.replace(a,""):"IMG"===c?"":null}}(),numbers:function(){var a=/\D/g;return function(b){return b=(b||"").replace(a,""),b||null}}(),dimension:function(){var a=/\D*(\d+)(\.\d+)?\s?(%)?\D*/;return function(b){return b=(b||"").replace(a,"$1$2$3"),b||null}}(),any:function(){return function(a){return a?a:null}}()},w={align_text:function(){var a={left:"text-align: left;",right:"text-align: right;",center:"text-align: center;"};return function(b){return a[String(b).toLowerCase()]}}()},x={align_img:function(){var a={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(b){return a[String(b).toLowerCase()]}}(),align_text:function(){var a={left:"wysiwyg-text-align-left",right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(b){return a[String(b).toLowerCase()]}}(),clear_br:function(){var a={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(b){return a[String(b).toLowerCase()]}}(),size_font:function(){var a={1:"wysiwyg-font-size-xx-small",2:"wysiwyg-font-size-small",3:"wysiwyg-font-size-medium",4:"wysiwyg-font-size-large",5:"wysiwyg-font-size-x-large",6:"wysiwyg-font-size-xx-large",7:"wysiwyg-font-size-xx-large","-":"wysiwyg-font-size-smaller","+":"wysiwyg-font-size-larger"};return function(b){return a[String(b).charAt(0)]}}()},y={has_visible_contet:function(){var a,b=["img","video","picture","br","script","noscript","style","table","iframe","object","embed","audio","svg","input","button","select","textarea","canvas"];return function(c){if(a=(c.innerText||c.textContent).replace(/\s/g,""),a&&a.length>0)return!0;for(var d=b.length;d--;)if(c.querySelector(b[d]))return!0;return c.offsetWidth&&c.offsetWidth>0&&c.offsetHeight&&c.offsetHeight>0?!0:!1}}()},z={unwrap:function(a){wysihtml5.dom.unwrap(a)},remove:function(a){a.parentNode.removeChild(a)}};return c(a,b)},wysihtml5.dom.removeEmptyTextNodes=function(a){for(var b,c=wysihtml5.lang.array(a.childNodes).get(),d=c.length,e=0;d>e;e++)b=c[e],b.nodeType===wysihtml5.TEXT_NODE&&/^[\n\r]*$/.test(b.data)&&b.parentNode.removeChild(b)},wysihtml5.dom.renameElement=function(a,b){for(var c,d=a.ownerDocument.createElement(b);c=a.firstChild;)d.appendChild(c);return wysihtml5.dom.copyAttributes(["align","className"]).from(a).to(d),a.parentNode&&a.parentNode.replaceChild(d,a),d},wysihtml5.dom.replaceWithChildNodes=function(a){if(a.parentNode){for(;a.firstChild;)a.parentNode.insertBefore(a.firstChild,a);a.parentNode.removeChild(a)}},function(a){function b(b){return"block"===a.getStyle("display").from(b)}function c(a){return"BR"===a.nodeName}function d(a){var b=a.ownerDocument.createElement("br");a.appendChild(b)}function e(a,e){if(a.nodeName.match(/^(MENU|UL|OL)$/)){var f,g,h,i,j,k,l,m=a.ownerDocument,n=m.createDocumentFragment(),o=wysihtml5.dom.domNode(a).prev({ignoreBlankTexts:!0}),p=wysihtml5.dom.domNode(a).next({ignoreBlankTexts:!0}),q=a.lastElementChild||a.lastChild;if(e)for(!o||b(o)||c(o)||d(n);k=a.firstElementChild||a.firstChild;){for(g=k.lastChild,l=k===q;f=k.firstChild;)h=f===g,i=(!l||p&&!b(p))&&h&&!b(f)&&!c(f),n.appendChild(f),i&&d(n);k.parentNode.removeChild(k)}else for(;k=a.firstElementChild||a.firstChild;){if(k.querySelector&&k.querySelector("div, p, ul, ol, menu, blockquote, h1, h2, h3, h4, h5, h6"))for(;f=k.firstChild;)n.appendChild(f);else{for(j=m.createElement("p");f=k.firstChild;)j.appendChild(f);n.appendChild(j)}k.parentNode.removeChild(k)}a.parentNode.replaceChild(n,a)}}a.resolveList=e}(wysihtml5.dom),function(a){var b=document,c=["parent","top","opener","frameElement","frames","localStorage","globalStorage","sessionStorage","indexedDB"],d=["open","close","openDialog","showModalDialog","alert","confirm","prompt","openDatabase","postMessage","XMLHttpRequest","XDomainRequest"],e=["referrer","write","open","close"];a.dom.Sandbox=Base.extend({constructor:function(b,c){this.callback=b||a.EMPTY_FUNCTION,this.config=a.lang.object({}).merge(c).get(),this.config.className||(this.config.className="wysihtml5-sandbox"),this.editableArea=this._createIframe()},insertInto:function(a){"string"==typeof a&&(a=b.getElementById(a)),a.appendChild(this.editableArea)},getIframe:function(){return this.editableArea},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var a=this.getIframe();a.parentNode.removeChild(a)},_readyError:function(){throw new Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet")},_createIframe:function(){var c=this,d=b.createElement("iframe");return d.className=this.config.className,a.dom.setAttributes({security:"restricted",allowtransparency:"true",frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(d),a.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()&&(d.src="javascript:''"),d.onload=function(){d.onreadystatechange=d.onload=null,c._onLoadIframe(d)},d.onreadystatechange=function(){/loaded|complete/.test(d.readyState)&&(d.onreadystatechange=d.onload=null,c._onLoadIframe(d))},d},_onLoadIframe:function(f){if(a.dom.contains(b.documentElement,f)){var g=this,h=f.contentWindow,i=f.contentWindow.document,j=b.characterSet||b.charset||"utf-8",k=this._getHtml({charset:j,stylesheets:this.config.stylesheets});if(i.open("text/html","replace"),i.write(k),i.close(),this.getWindow=function(){return f.contentWindow},this.getDocument=function(){return f.contentWindow.document},h.onerror=function(a,b,c){throw new Error("wysihtml5.Sandbox: "+a,b,c)},!a.browser.supportsSandboxedIframes()){var l,m;for(l=0,m=c.length;m>l;l++)this._unset(h,c[l]);for(l=0,m=d.length;m>l;l++)this._unset(h,d[l],a.EMPTY_FUNCTION);for(l=0,m=e.length;m>l;l++)this._unset(i,e[l]);this._unset(i,"cookie","",!0)}a.polyfills&&a.polyfills(h,i),this.loaded=!0,setTimeout(function(){g.callback(g)},0)}},_getHtml:function(b){var c,d=b.stylesheets,e="",f=0;if(d="string"==typeof d?[d]:d)for(c=d.length;c>f;f++)e+='';return b.stylesheets=e,a.lang.string('#{stylesheets}').interpolate(b)},_unset:function(b,c,d,e){try{b[c]=d}catch(f){}try{b.__defineGetter__(c,function(){return d})}catch(f){}if(e)try{b.__defineSetter__(c,function(){})}catch(f){}if(!a.browser.crashesWhenDefineProperty(c))try{var g={get:function(){return d}};e&&(g.set=function(){}),Object.defineProperty(b,c,g)}catch(f){}}})}(wysihtml5),function(a){var b=document;a.dom.ContentEditableArea=Base.extend({getContentEditable:function(){return this.element},getWindow:function(){return this.element.ownerDocument.defaultView||this.element.ownerDocument.parentWindow},getDocument:function(){return this.element.ownerDocument},constructor:function(b,c,d){this.callback=b||a.EMPTY_FUNCTION,this.config=a.lang.object({}).merge(c).get(),this.config.className||(this.config.className="wysihtml5-sandbox"),d?this.element=this._bindElement(d):this.element=this._createElement()},destroy:function(){},_createElement:function(){var a=b.createElement("div");return a.className=this.config.className,this._loadElement(a),a},_bindElement:function(a){return a.className=a.className?a.className+" wysihtml5-sandbox":"wysihtml5-sandbox",this._loadElement(a,!0),a},_loadElement:function(a,b){var c=this;if(!b){var d=this._getHtml();a.innerHTML=d}this.loaded=!0,setTimeout(function(){c.callback(c)},0)},_getHtml:function(a){return""}})}(wysihtml5),function(){var a={className:"class"};wysihtml5.dom.setAttributes=function(b){return{on:function(c){for(var d in b)c.setAttribute(a[d]||d,b[d])}}}}(),wysihtml5.dom.setStyles=function(a){return{on:function(b){var c=b.style;if("string"==typeof a)return void(c.cssText+=";"+a);for(var d in a)"float"===d?(c.cssFloat=a[d],c.styleFloat=a[d]):c[d]=a[d]}}},function(a){a.simulatePlaceholder=function(b,c,d,e){var f=e||"wysihtml5-placeholder",g=function(){var b=c.element.offsetWidth>0&&c.element.offsetHeight>0;c.hasPlaceholderSet()&&(c.clear(),c.element.focus(),b&&setTimeout(function(){var a=c.selection.getSelection();a.focusNode&&a.anchorNode||c.selection.selectNode(c.element.firstChild||c.element)},0)),c.placeholderSet=!1,a.removeClass(c.element,f)},h=function(){c.isEmpty()&&!c.placeholderSet&&(c.placeholderSet=!0,c.setValue(d,!1),a.addClass(c.element,f))};b.on("set_placeholder",h).on("unset_placeholder",g).on("focus:composer",g).on("paste:composer",g).on("blur:composer",h),h()}}(wysihtml5.dom),function(a){var b=document.documentElement;"textContent"in b?(a.setTextContent=function(a,b){a.textContent=b},a.getTextContent=function(a){return a.textContent}):"innerText"in b?(a.setTextContent=function(a,b){a.innerText=b},a.getTextContent=function(a){return a.innerText}):(a.setTextContent=function(a,b){a.nodeValue=b},a.getTextContent=function(a){return a.nodeValue})}(wysihtml5.dom),wysihtml5.dom.getAttribute=function(a,b){var c=!wysihtml5.browser.supportsGetAttributeCorrectly();b=b.toLowerCase();var d=a.nodeName;if("IMG"==d&&"src"==b&&wysihtml5.dom.isLoadedImage(a)===!0)return a.src;if(c&&"outerHTML"in a){var e=a.outerHTML.toLowerCase(),f=-1!=e.indexOf(" "+b+"=");return f?a.getAttribute(b):null}return a.getAttribute(b)},wysihtml5.dom.getAttributes=function(a){var b,c=!wysihtml5.browser.supportsGetAttributeCorrectly(),d=a.nodeName,e=[];for(b in a.attributes)(a.attributes.hasOwnProperty&&a.attributes.hasOwnProperty(b)||!a.attributes.hasOwnProperty&&Object.prototype.hasOwnProperty.call(a.attributes,b))&&a.attributes[b].specified&&("IMG"==d&&"src"==a.attributes[b].name.toLowerCase()&&wysihtml5.dom.isLoadedImage(a)===!0?e.src=a.src:wysihtml5.lang.array(["rowspan","colspan"]).contains(a.attributes[b].name.toLowerCase())&&c?1!==a.attributes[b].value&&(e[a.attributes[b].name]=a.attributes[b].value):e[a.attributes[b].name]=a.attributes[b].value);return e},wysihtml5.dom.isLoadedImage=function(a){try{return a.complete&&!a.mozMatchesSelector(":-moz-broken")}catch(b){if(a.complete&&"complete"===a.readyState)return!0}},function(a){function b(a,b){for(var c,d=[],e=0,f=a.length;f>e;e++)if(c=a[e].querySelectorAll(b))for(var g=c.length;g--;d.unshift(c[g]));return d}function d(a){a.parentNode.removeChild(a)}function e(a,b){a.parentNode.insertBefore(b,a.nextSibling)}function f(a,b){for(var c=a.nextSibling;1!=c.nodeType;)if(c=c.nextSibling,!b||b==c.tagName.toLowerCase())return c;return null}var g=a.dom,h=function(a){this.el=a,this.isColspan=!1,this.isRowspan=!1,this.firstCol=!0,this.lastCol=!0,this.firstRow=!0,this.lastRow=!0,this.isReal=!0,this.spanCollection=[],this.modified=!1},i=function(a,b){a?(this.cell=a,this.table=g.getParentElement(a,{query:"table"})):b&&(this.table=b,this.cell=this.table.querySelectorAll("th, td")[0])};i.prototype={addSpannedCellToMap:function(a,b,c,d,e,f){for(var g=[],i=c+(f?parseInt(f,10)-1:0),j=d+(e?parseInt(e,10)-1:0),k=c;i>=k;k++){"undefined"==typeof b[k]&&(b[k]=[]);for(var l=d;j>=l;l++)b[k][l]=new h(a),b[k][l].isColspan=e&&parseInt(e,10)>1,b[k][l].isRowspan=f&&parseInt(f,10)>1,b[k][l].firstCol=l==d,b[k][l].lastCol=l==j,b[k][l].firstRow=k==c,b[k][l].lastRow=k==i,b[k][l].isReal=l==d&&k==c,b[k][l].spanCollection=g,g.push(b[k][l])}},setCellAsModified:function(a){if(a.modified=!0,a.spanCollection.length>0)for(var b=0,c=a.spanCollection.length;c>b;b++)a.spanCollection[b].modified=!0},setTableMap:function(){var a,b,c,d,e,f,i,j,k=[],l=this.getTableRows();for(a=0;a0?a.lang.array(f).without(e):f;return g},getTableRows:function(){var c=this.table.querySelectorAll("table"),d=c?b(c,"tr"):[],e=this.table.querySelectorAll("tr"),f=d.length>0?a.lang.array(e).without(d):e;return f},getMapIndex:function(a){for(var b=this.map.length,c=this.map&&this.map[0]?this.map[0].length:0,d=0;b>d;d++)for(var e=0;c>e;e++)if(this.map[d][e].el===a)return{row:d,col:e};return!1},getElementAtIndex:function(a){return this.setTableMap(),this.map[a.row]&&this.map[a.row][a.col]&&this.map[a.row][a.col].el?this.map[a.row][a.col].el:null},getMapElsTo:function(a){var b=[];if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(a),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var c=this.idx_start;this.idx_start=this.idx_end,this.idx_end=c}if(this.idx_start.col>this.idx_end.col){var d=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=d}if(null!=this.idx_start&&null!=this.idx_end)for(var e=this.idx_start.row,f=this.idx_end.row;f>=e;e++)for(var g=this.idx_start.col,h=this.idx_end.col;h>=g;g++)b.push(this.map[e][g].el);return b},orderSelectionEnds:function(a){if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(a),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var b=this.idx_start;this.idx_start=this.idx_end,this.idx_end=b}if(this.idx_start.col>this.idx_end.col){var c=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=c}return{start:this.map[this.idx_start.row][this.idx_start.col].el,end:this.map[this.idx_end.row][this.idx_end.col].el}},createCells:function(a,b,c){for(var d,e=this.table.ownerDocument,f=e.createDocumentFragment(),g=0;b>g;g++){if(d=e.createElement(a),c)for(var h in c)c.hasOwnProperty(h)&&d.setAttribute(h,c[h]);d.appendChild(document.createTextNode(" ")),f.appendChild(d)}return f},correctColIndexForUnreals:function(a,b){for(var c=this.map[b],d=-1,e=0;a>e;e++)c[e].isReal&&d++;return d},getLastNewCellOnRow:function(a,b){for(var c,d,e=this.getRowCells(a),f=0,g=e.length;g>f;f++)if(c=e[f],d=this.getMapIndex(c),d===!1||"undefined"!=typeof b&&d.row!=b)return c;return null},removeEmptyTable:function(){var a=this.table.querySelectorAll("td, th");return a&&0!=a.length?!1:(d(this.table),!0)},splitRowToCells:function(a){if(a.isColspan){var b=parseInt(g.getAttribute(a.el,"colspan")||1,10),c=a.el.tagName.toLowerCase();if(b>1){var d=this.createCells(c,b-1);e(a.el,d)}a.el.removeAttribute("colspan")}},getRealRowEl:function(a,b){var c=null,d=null;b=b||this.idx;for(var e=0,f=this.map[b.row].length;f>e;e++)if(d=this.map[b.row][e],d.isReal&&(c=g.getParentElement(d.el,{query:"tr"})))return c;return null===c&&a&&(c=g.getParentElement(this.map[b.row][b.col].el,{query:"tr"})||null),c},injectRowAt:function(a,b,c,d,f){var h=this.getRealRowEl(!1,{row:a,col:b}),i=this.createCells(d,c);if(h){var j=this.correctColIndexForUnreals(b,a);j>=0?e(this.getRowCells(h)[j],i):h.insertBefore(i,h.firstChild)}else{var k=this.table.ownerDocument.createElement("tr");k.appendChild(i),e(g.getParentElement(f.el,{query:"tr"}),k)}},canMerge:function(a){if(this.to=a,this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(this.to),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var b=this.idx_start;this.idx_start=this.idx_end,this.idx_end=b}if(this.idx_start.col>this.idx_end.col){var c=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=c}for(var d=this.idx_start.row,e=this.idx_end.row;e>=d;d++)for(var f=this.idx_start.col,g=this.idx_end.col;g>=f;f++)if(this.map[d][f].isColspan||this.map[d][f].isRowspan)return!1;return!0},decreaseCellSpan:function(a,b){var c=parseInt(g.getAttribute(a.el,b),10)-1;c>=1?a.el.setAttribute(b,c):(a.el.removeAttribute(b),"colspan"==b&&(a.isColspan=!1),"rowspan"==b&&(a.isRowspan=!1),a.firstCol=!0,a.lastCol=!0,a.firstRow=!0,a.lastRow=!0,a.isReal=!0)},removeSurplusLines:function(){var a,b,c,e,f,h,i;if(this.setTableMap(),this.map){for(c=0,e=this.map.length;e>c;c++){for(a=this.map[c],i=!0,f=0,h=a.length;h>f;f++)if(b=a[f],!(g.getAttribute(b.el,"rowspan")&&parseInt(g.getAttribute(b.el,"rowspan"),10)>1&&b.firstRow!==!0)){i=!1;break}if(i)for(f=0;h>f;f++)this.decreaseCellSpan(a[f],"rowspan")}var j=this.getTableRows();for(c=0,e=j.length;e>c;c++)a=j[c],0==a.childNodes.length&&/^\s*$/.test(a.textContent||a.innerText)&&d(a)}},fillMissingCells:function(){var a=0,b=0,c=null;if(this.setTableMap(),this.map){a=this.map.length;for(var d=0;a>d;d++)this.map[d].length>b&&(b=this.map[d].length);for(var f=0;a>f;f++)for(var g=0;b>g;g++)this.map[f]&&!this.map[f][g]&&g>0&&(this.map[f][g]=new h(this.createCells("td",1)),c=this.map[f][g-1],c&&c.el&&c.el.parent&&e(this.map[f][g-1].el,this.map[f][g].el))}},rectify:function(){return this.removeEmptyTable()?!1:(this.removeSurplusLines(),this.fillMissingCells(),!0)},unmerge:function(){if(this.rectify()&&(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx)){var a=this.map[this.idx.row][this.idx.col],b=g.getAttribute(a.el,"colspan")?parseInt(g.getAttribute(a.el,"colspan"),10):1,c=a.el.tagName.toLowerCase();if(a.isRowspan){var d=parseInt(g.getAttribute(a.el,"rowspan"),10);if(d>1)for(var e=1,f=d-1;f>=e;e++)this.injectRowAt(this.idx.row+e,this.idx.col,b,c,a);a.el.removeAttribute("rowspan")}this.splitRowToCells(a)}},merge:function(a){if(this.rectify())if(this.canMerge(a)){for(var b=this.idx_end.row-this.idx_start.row+1,c=this.idx_end.col-this.idx_start.col+1,e=this.idx_start.row,f=this.idx_end.row;f>=e;e++)for(var g=this.idx_start.col,h=this.idx_end.col;h>=g;g++)e==this.idx_start.row&&g==this.idx_start.col?(b>1&&this.map[e][g].el.setAttribute("rowspan",b),c>1&&this.map[e][g].el.setAttribute("colspan",c)):(/^\s*\s*$/.test(this.map[e][g].el.innerHTML.toLowerCase())||(this.map[this.idx_start.row][this.idx_start.col].el.innerHTML+=" "+this.map[e][g].el.innerHTML),d(this.map[e][g].el));this.rectify()}else window.console&&console.log("Do not know how to merge allready merged cells.")},collapseCellToNextRow:function(a){var b=this.getMapIndex(a.el),c=b.row+1,d={row:c,col:b.col};if(c=0)e(this.getRowCells(f)[h],a.el);else{var i=this.getLastNewCellOnRow(f,c);null!==i?e(i,a.el):f.insertBefore(a.el,f.firstChild)}parseInt(g.getAttribute(a.el,"rowspan"),10)>2?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)-1):a.el.removeAttribute("rowspan")}}},removeRowCell:function(a){a.isReal?a.isRowspan?this.collapseCellToNextRow(a):d(a.el):parseInt(g.getAttribute(a.el,"rowspan"),10)>2?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)-1):a.el.removeAttribute("rowspan")},getRowElementsByCell:function(){var a=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=this.map[this.idx.row],c=0,d=b.length;d>c;c++)b[c].isReal&&a.push(b[c].el);return a},getColumnElementsByCell:function(){var a=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=0,c=this.map.length;c>b;b++)this.map[b][this.idx.col]&&this.map[b][this.idx.col].isReal&&a.push(this.map[b][this.idx.col].el);return a},removeRow:function(){var a=g.getParentElement(this.cell,{query:"tr"});if(a){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=this.map[this.idx.row],c=0,e=b.length;e>c;c++)b[c].modified||(this.setCellAsModified(b[c]),this.removeRowCell(b[c]));d(a)}},removeColCell:function(a){a.isColspan?parseInt(g.getAttribute(a.el,"colspan"),10)>2?a.el.setAttribute("colspan",parseInt(g.getAttribute(a.el,"colspan"),10)-1):a.el.removeAttribute("colspan"):a.isReal&&d(a.el)},removeColumn:function(){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var a=0,b=this.map.length;b>a;a++)this.map[a][this.idx.col].modified||(this.setCellAsModified(this.map[a][this.idx.col]),this.removeColCell(this.map[a][this.idx.col]))},remove:function(a){if(this.rectify()){switch(a){case"row":this.removeRow();break;case"column":this.removeColumn()}this.rectify()}},addRow:function(a){var b=this.table.ownerDocument;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"below"==a&&g.getAttribute(this.cell,"rowspan")&&(this.idx.row=this.idx.row+parseInt(g.getAttribute(this.cell,"rowspan"),10)-1),this.idx!==!1){for(var c=this.map[this.idx.row],d=b.createElement("tr"),f=0,h=c.length;h>f;f++)c[f].modified||(this.setCellAsModified(c[f]),this.addRowCell(c[f],d,a));switch(a){case"below":e(this.getRealRowEl(!0),d);break;case"above":var i=g.getParentElement(this.map[this.idx.row][this.idx.col].el,{query:"tr"});i&&i.parentNode.insertBefore(d,i)}}},addRowCell:function(a,b,d){var e=a.isColspan?{colspan:g.getAttribute(a.el,"colspan")}:null;a.isReal?"above"!=d&&a.isRowspan?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)+1):b.appendChild(this.createCells("td",1,e)):"above"!=d&&a.isRowspan&&a.lastRow?b.appendChild(this.createCells("td",1,e)):c.isRowspan&&a.el.attr("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)+1)},add:function(a){this.rectify()&&(("below"==a||"above"==a)&&this.addRow(a),("before"==a||"after"==a)&&this.addColumn(a))},addColCell:function(a,b,d){ -var f,h=a.el.tagName.toLowerCase();switch(d){case"before":f=!a.isColspan||a.firstCol;break;case"after":f=!a.isColspan||a.lastCol||a.isColspan&&c.el==this.cell}if(f){switch(d){case"before":a.el.parentNode.insertBefore(this.createCells(h,1),a.el);break;case"after":e(a.el,this.createCells(h,1))}a.isRowspan&&this.handleCellAddWithRowspan(a,b+1,d)}else a.el.setAttribute("colspan",parseInt(g.getAttribute(a.el,"colspan"),10)+1)},addColumn:function(a){var b,c;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"after"==a&&g.getAttribute(this.cell,"colspan")&&(this.idx.col=this.idx.col+parseInt(g.getAttribute(this.cell,"colspan"),10)-1),this.idx!==!1)for(var d=0,e=this.map.length;e>d;d++)b=this.map[d],b[this.idx.col]&&(c=b[this.idx.col],c.modified||(this.setCellAsModified(c),this.addColCell(c,d,a)))},handleCellAddWithRowspan:function(a,b,c){for(var d,h,i,j=parseInt(g.getAttribute(this.cell,"rowspan"),10)-1,k=g.getParentElement(a.el,{query:"tr"}),l=a.el.tagName.toLowerCase(),m=this.table.ownerDocument,n=0;j>n;n++)if(d=this.correctColIndexForUnreals(this.idx.col,b+n),k=f(k,"tr"))if(d>0)switch(c){case"before":h=this.getRowCells(k),d>0&&this.map[b+n][this.idx.col].el!=h[d]&&d==h.length-1?e(h[d],this.createCells(l,1)):h[d].parentNode.insertBefore(this.createCells(l,1),h[d]);break;case"after":e(this.getRowCells(k)[d],this.createCells(l,1))}else k.insertBefore(this.createCells(l,1),k.firstChild);else i=m.createElement("tr"),i.appendChild(this.createCells(l,1)),this.table.appendChild(i)}},g.table={getCellsBetween:function(a,b){var c=new i(a);return c.getMapElsTo(b)},addCells:function(a,b){var c=new i(a);c.add(b)},removeCells:function(a,b){var c=new i(a);c.remove(b)},mergeCellsBetween:function(a,b){var c=new i(a);c.merge(b)},unmergeCell:function(a){var b=new i(a);b.unmerge()},orderSelectionEnds:function(a,b){var c=new i(a);return c.orderSelectionEnds(b)},indexOf:function(a){var b=new i(a);return b.setTableMap(),b.getMapIndex(a)},findCell:function(a,b){var c=new i(null,a);return c.getElementAtIndex(b)},findRowByCell:function(a){var b=new i(a);return b.getRowElementsByCell()},findColumnByCell:function(a){var b=new i(a);return b.getColumnElementsByCell()},canMerge:function(a,b){var c=new i(a);return c.canMerge(b)}}}(wysihtml5),wysihtml5.dom.query=function(a,b){var c,d=[];a.nodeType&&(a=[a]);for(var e=0,f=a.length;f>e;e++)if(c=a[e].querySelectorAll(b))for(var g=c.length;g--;d.unshift(c[g]));return d},wysihtml5.dom.compareDocumentPosition=function(){var a=document.documentElement;return a.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)}:function(a,b){var c,d;if(c=9===a.nodeType?a:a.ownerDocument,d=9===b.nodeType?b:b.ownerDocument,a===b)return 0;if(a===b.ownerDocument)return 20;if(a.ownerDocument===b)return 10;if(c!==d)return 1;if(2===a.nodeType&&a.childNodes&&-1!==wysihtml5.lang.array(a.childNodes).indexOf(b))return 20;if(2===b.nodeType&&b.childNodes&&-1!==wysihtml5.lang.array(b.childNodes).indexOf(a))return 10;for(var e=a,f=[],g=null;e;){if(e==b)return 10;f.push(e),e=e.parentNode}for(e=b,g=null;e;){if(e==a)return 20;var h=wysihtml5.lang.array(f).indexOf(e);if(-1!==h){var i=f[h],j=wysihtml5.lang.array(i.childNodes).indexOf(f[h-1]),k=wysihtml5.lang.array(i.childNodes).indexOf(g);return j>k?2:4}g=e,e=e.parentNode}return 1}}(),wysihtml5.dom.unwrap=function(a){var b=[];if(a.parentNode){for(;a.lastChild;)b.unshift(a.lastChild),wysihtml5.dom.insert(a.lastChild).after(a);a.parentNode.removeChild(a)}return b},wysihtml5.dom.getPastedHtml=function(a){var b;return wysihtml5.browser.supportsModernPaste()&&a.clipboardData&&(wysihtml5.lang.array(a.clipboardData.types).contains("text/html")?b=a.clipboardData.getData("text/html"):wysihtml5.lang.array(a.clipboardData.types).contains("text/plain")&&(b=wysihtml5.lang.string(a.clipboardData.getData("text/plain")).escapeHTML(!0,!0))),b},wysihtml5.dom.getPastedHtmlWithDiv=function(a,b){var c=a.selection.getBookmark(),d=a.element.ownerDocument,e=d.createElement("DIV"),f=a.getScrollPos();d.body.appendChild(e),e.style.width="1px",e.style.height="1px",e.style.overflow="hidden",e.style.position="absolute",e.style.top=f.y+"px",e.style.left=f.x+"px",e.setAttribute("contenteditable","true"),e.focus(),setTimeout(function(){var d;a.selection.setBookmark(c),d=e.innerHTML,d&&/^$/i.test(d.trim())&&(d=!1),b(d),e.parentNode.removeChild(e)},0)},wysihtml5.dom.removeInvisibleSpaces=function(a){for(var b=wysihtml5.dom.getTextNodes(a),c=b.length;c--;)b[c].nodeValue=b[c].nodeValue.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP,"")},wysihtml5.quirks.cleanPastedHTML=function(){var a=function(a){var b=wysihtml5.lang.string(a).trim(),c=b.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");return new RegExp("^((?!^"+c+"$).)*$","i")},b=function(b,c){var d,e,f=wysihtml5.lang.object(b).clone(!0);for(d in f.tags)if(f.tags.hasOwnProperty(d)&&f.tags[d].keep_styles)for(e in f.tags[d].keep_styles)f.tags[d].keep_styles.hasOwnProperty(e)&&c[e]&&(f.tags[d].keep_styles[e]=a(c[e]));return f},c=function(a,b){var c;if(!a)return null;for(var d=0,e=a.length;e>d;d++)if(a[d].condition||(c=a[d].set),a[d].condition&&a[d].condition.test(b))return a[d].set;return c};return function(a,d){var e,f={color:wysihtml5.dom.getStyle("color").from(d.referenceNode),fontSize:wysihtml5.dom.getStyle("font-size").from(d.referenceNode)},g=b(c(d.rules,a)||{},f);return e=wysihtml5.dom.parse(a,{rules:g,cleanUp:!0,context:d.referenceNode.ownerDocument,uneditableClass:d.uneditableClass,clearInternals:!0,unjoinNbsps:!0})}}(),wysihtml5.quirks.ensureProperClearing=function(){var a=function(){var a=this;setTimeout(function(){var b=a.innerHTML.toLowerCase();("

     

    "==b||"

     

     

    "==b)&&(a.innerHTML="")},0)};return function(b){wysihtml5.dom.observe(b.element,["cut","keydown"],a)}}(),function(a){var b="%7E";a.quirks.getCorrectInnerHTML=function(c){var d=c.innerHTML;if(-1===d.indexOf(b))return d;var e,f,g,h,i=c.querySelectorAll("[href*='~'], [src*='~']");for(h=0,g=i.length;g>h;h++)e=i[h].href||i[h].src,f=a.lang.string(e).replace("~").by(b),d=a.lang.string(d).replace(f).by(e);return d}}(wysihtml5),function(a){var b="wysihtml5-quirks-redraw";a.quirks.redraw=function(c){a.dom.addClass(c,b),a.dom.removeClass(c,b);try{var d=c.ownerDocument;d.execCommand("italic",!1,null),d.execCommand("italic",!1,null)}catch(e){}}}(wysihtml5),wysihtml5.quirks.tableCellsSelection=function(a,b){function c(){return a.addEventListener("mousedown",n),l}function d(c){l.start=c,l.end=c,l.cells=[c],l.table=k.getParentElement(l.start,{query:"table"},!1,a),l.table&&(e(),k.addClass(c,m),a.addEventListener("mousemove",g),a.addEventListener("mouseup",h),b.fire("tableselectstart").fire("tableselectstart:composer"))}function e(){if(a){var b=a.querySelectorAll("."+m);if(b.length>0)for(var c=0;c1&&b.composer.selection.deselect(),f(l.cells),l.end!==d&&b.fire("tableselectchange").fire("tableselectchange:composer")))}function h(c){a.removeEventListener("mousemove",g),a.removeEventListener("mouseup",h),b.fire("tableselect").fire("tableselect:composer"),setTimeout(function(){i()},0)}function i(){a.ownerDocument.addEventListener("click",o)}function j(c,d){l.start=c,l.end=d,l.table=k.getParentElement(l.start,{query:"table"},!1,a),selectedCells=k.table.getCellsBetween(l.start,l.end),f(selectedCells),i(),b.fire("tableselect").fire("tableselect:composer")}var k=wysihtml5.dom,l={table:null,start:null,end:null,cells:null,select:j},m="wysiwyg-tmp-selected-cell",n=function(b){var c=wysihtml5.dom.getParentElement(b.target,{query:"td, th"},!1,a);c&&d(c)},o=function(c){a.ownerDocument.removeEventListener("click",o),k.getParentElement(c.target,{query:"table"},!1,a)!=l.table&&(e(),l.table=null,l.start=null,l.end=null,b.fire("tableunselect").fire("tableunselect:composer"))};return c()},function(a){function b(a){var b,c;for(b in d)if(d.hasOwnProperty(b)&&(c=d[b],c.regex.test(a)))return c}function c(a){var c=b(a);return c?c.name:void 0}var d={rgba:{regex:/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]+)\s*\)/i,name:"rgba"},rgb:{regex:/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i,name:"rgb"},hex6:{regex:/^#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])/i,name:"hex",radix:16},hex3:{regex:/^#([0-9a-f])([0-9a-f])([0-9a-f])/i,name:"hex",radix:16}},e=function(a){return new RegExp("(^|\\s|;)"+a+"\\s*:\\s*[^;$]+","gi")};a.quirks.styleParser={getColorParseMethod:b,getColorFormat:c,parseColor:function(c,f){var g,h,i,j,k,l=c;if(f){if(g=e(f),!(h=c.match(g)))return!1;h=h.pop().split(":")[1],l=a.lang.string(h).trim()}return(i=b(l))&&(j=l.match(i.regex))?(k=i.radix||10,i===d.hex3?(j.shift(),j.push(1),a.lang.array(j).map(function(a,b){return 3>b?parseInt(a,k)*k+parseInt(a,k):parseFloat(a)})):(j.shift(),j[3]||j.push(1),a.lang.array(j).map(function(a,b){return 3>b?parseInt(a,k):parseFloat(a)}))):!1},unparseColor:function(a,b){var c=16;return"hex"===b?(a[0].toString(c)+a[1].toString(c)+a[2].toString(c)).toUpperCase():"hash"===b?"#"+(a[0].toString(c)+a[1].toString(c)+a[2].toString(c)).toUpperCase():"rgb"===b?"rgb("+a[0]+","+a[1]+","+a[2]+")":"rgba"===b?"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")":"csv"===b?a[0]+","+a[1]+","+a[2]+","+a[3]:a[3]&&1!==a[3]?"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")":"rgb("+a[0]+","+a[1]+","+a[2]+")"},parseFontSize:function(b){var c=b.match(e("font-size"));return c?a.lang.string(c[c.length-1].split(":")[1]).trim():!1}}}(wysihtml5),function(a){function b(a){var b=0;if(a.parentNode)do b+=a.offsetTop||0,a=a.offsetParent;while(a);return b}function c(a,b){for(var c=0;b!==a;)if(c++,b=b.parentNode,!b)throw new Error("not a descendant of ancestor!");return c}function d(a,b){return 3===a.nodeType?a:a.childNodes[b]||a}function e(b){var c=document.createElement("span"),d=function(a){b.removeEventListener("mouseup",d),b.removeEventListener("keydown",d),b.removeEventListener("touchstart",d),b.removeEventListener("focus",d),b.removeEventListener("blur",d),b.removeEventListener("paste",e),b.removeEventListener("drop",e),b.removeEventListener("beforepaste",e),c&&c.parentNode&&c.parentNode.removeChild(c)},e=function(a){c&&c.parentNode&&setTimeout(d,0)};return c.appendChild(b.ownerDocument.createTextNode(a.INVISIBLE_SPACE)),c.className="_wysihtml5-temp-caret-fix",c.style.display="block",c.style.minWidth="1px",c.style.height="0px",b.addEventListener("mouseup",d),b.addEventListener("keydown",d),b.addEventListener("touchstart",d),b.addEventListener("focus",d),b.addEventListener("blur",d),b.addEventListener("paste",e),b.addEventListener("drop",e),b.addEventListener("beforepaste",e),c}function f(a){if(!a.canSurroundContents())for(var b=a.commonAncestorContainer,d=c(b,a.startContainer),e=c(b,a.endContainer);!a.canSurroundContents();)d>e?(a.setStartBefore(a.startContainer),d=c(b,a.startContainer)):(a.setEndAfter(a.endContainer),e=c(b,a.endContainer))}var g=a.dom;a.Selection=Base.extend({constructor:function(a,b,c){rangy.init(),this.editor=a,this.composer=a.composer,this.doc=this.composer.doc,this.win=this.composer.win,this.contain=b,this.unselectableClass=c||!1},getBookmark:function(){var a=this.getRange();return a&&a.cloneRange()},setBookmark:function(a){a&&this.setSelection(a)},setBefore:function(a){var b=rangy.createRange(this.doc);return b.setStartBefore(a),b.setEndBefore(a),this.setSelection(b)},createTemporaryCaretSpaceAfter:function(b){var c=this.doc.createElement("span"),d=this.doc.createTextNode(a.INVISIBLE_SPACE),e=function(b){var d;this.contain.removeEventListener("mouseup",e),this.contain.removeEventListener("keydown",g),this.contain.removeEventListener("touchstart",e),this.contain.removeEventListener("focus",e),this.contain.removeEventListener("blur",e),this.contain.removeEventListener("paste",f),this.contain.removeEventListener("drop",f),this.contain.removeEventListener("beforepaste",f),c&&c.parentNode&&(c.innerHTML=c.innerHTML.replace(a.INVISIBLE_SPACE_REG_EXP,""),/[^\s]+/.test(c.innerHTML)?(d=c.lastChild,a.dom.unwrap(c),this.setAfter(d)):c.parentNode.removeChild(c))}.bind(this),f=function(a){c&&c.parentNode&&setTimeout(e,0)},g=function(a){8===a.which||91===a.which||17===a.which||86===a.which&&(a.ctrlKey||a.metaKey)||e()};return c.className="_wysihtml5-temp-caret-fix",c.style.position="absolute",c.style.display="block",c.style.minWidth="1px",c.style.zIndex="99999",c.appendChild(d),b.parentNode.insertBefore(c,b.nextSibling),this.setBefore(d),this.contain.addEventListener("mouseup",e),this.contain.addEventListener("keydown",g),this.contain.addEventListener("touchstart",e),this.contain.addEventListener("focus",e),this.contain.addEventListener("blur",e),this.contain.addEventListener("paste",f),this.contain.addEventListener("drop",f),this.contain.addEventListener("beforepaste",f),c},setAfter:function(b,c,d){var e,f=this.win,g=rangy.createRange(this.doc),h=function(){var d=b.parentNode,g=d?d.childNodes[d.childNodes.length-1]:null;if(!e||g===b&&1===b.nodeType&&"block"===f.getComputedStyle(b).display)if(c){var h=this.doc.createTextNode(a.INVISIBLE_SPACE);b.parentNode.insertBefore(h,b.nextSibling),this.selectNode(h),setTimeout(function(){h&&h.parentNode&&h.parentNode.removeChild(h)},0)}else this.createTemporaryCaretSpaceAfter(b)}.bind(this);if(g.setStartAfter(b),g.setEndAfter(b),document.activeElement&&document.activeElement===this.composer.element)e=this.setSelection(g),h(),d&&d(e);else{var i=this.composer.getScrollPos();this.composer.element.focus(),this.composer.setScrollPos(i),setTimeout(function(){e=this.setSelection(g),h(),d&&d(e)}.bind(this),0)}},selectNode:function(b,c){var d=rangy.createRange(this.doc),e=b.nodeType===a.ELEMENT_NODE,f="canHaveHTML"in b?b.canHaveHTML:"IMG"!==b.nodeName,h=e?b.innerHTML:b.data,i=""===h||h===a.INVISIBLE_SPACE,j=g.getStyle("display").from(b),k="block"===j||"list-item"===j;if(i&&e&&f&&!c)try{b.innerHTML=a.INVISIBLE_SPACE}catch(l){}f?d.selectNodeContents(b):d.selectNode(b),f&&i&&e?d.collapse(k):f&&i&&(d.setStartAfter(b),d.setEndAfter(b)),this.setSelection(d)},getSelectedNode:function(a){var b,c;return a&&this.doc.selection&&"Control"===this.doc.selection.type&&(c=this.doc.selection.createRange(),c&&c.length)?c.item(0):(b=this.getSelection(this.doc),b.focusNode===b.anchorNode?b.focusNode:(c=this.getRange(this.doc),c?c.commonAncestorContainer:this.doc.body))},fixSelBorders:function(){var a=this.getRange();f(a),this.setSelection(a)},getSelectedOwnNodes:function(a){for(var b=this.getOwnRanges(),c=[],d=0,e=b.length;e>d;d++)c.push(b[d].commonAncestorContainer||this.doc.body);return c},findNodesInSelection:function(b){for(var c,d=this.getOwnRanges(),e=[],f=0,g=d.length;g>f;f++)c=d[f].getNodes([1],function(c){return a.lang.array(b).contains(c.nodeName)}),e=e.concat(c);return e},filterElements:function(a){for(var b,c=this.getOwnRanges(),d=[],e=0,f=c.length;f>e;e++)b=c[e].getNodes([1],function(b){return a(b,c[e])}),d=d.concat(b);return d},containsUneditable:function(){for(var a=this.getOwnUneditables(),b=this.getSelection(),c=0,d=a.length;d>c;c++)if(b.containsNode(a[c]))return!0;return!1},deleteContents:function(){var a=this.getRange();this.deleteRangeContents(a),this.setSelection(a)},deleteRangeContents:function(b){var c,d,e,f;if(this.unselectableClass){(c=a.dom.getParentElement(b.startContainer,{query:"."+this.unselectableClass},!1,this.contain))&&b.setStartBefore(c),(d=a.dom.getParentElement(b.endContainer,{query:"."+this.unselectableClass},!1,this.contain))&&b.setEndAfter(d),e=b.getNodes([1],function(b){return a.dom.hasClass(b,this.unselectableClass)}.bind(this));for(var g=e.length;g--;)try{f=new CustomEvent("wysihtml5:uneditable:delete"),e[g].dispatchEvent(f)}catch(h){}}b.deleteContents()},getCaretNode:function(){var a=this.getSelection();return a&&a.anchorNode?d(a.anchorNode,a.anchorOffset):null},getPreviousNode:function(b,c){var e;if(!b){var f=this.getSelection();b=f&&f.anchorNode?d(f.anchorNode,f.anchorOffset):null}if(b===this.contain)return!1;var g,h=b.previousSibling;return h===this.contain?!1:(h&&3!==h.nodeType&&1!==h.nodeType?h=this.getPreviousNode(h,c):h&&3===h.nodeType&&/^\s*$/.test(h.textContent)?h=this.getPreviousNode(h,c):c&&h&&1===h.nodeType?(e=a.dom.getStyle("display").from(h),a.lang.array(["BR","HR","IMG"]).contains(h.nodeName)||a.lang.array(["block","inline-block","flex","list-item","table"]).contains(e)||!/^[\s]*$/.test(h.innerHTML)||(h=this.getPreviousNode(h,c))):h||b===this.contain||(g=b.parentNode,g!==this.contain&&(h=this.getPreviousNode(g,c))),h!==this.contain?h:!1)},getNodesNearCaret:function(){if(!this.isCollapsed())throw"Selection must be caret when using selection.getNodesNearCaret()";var a,b,c,d,e=this.getOwnRanges();return e&&e.length>0?(1===e[0].startContainer.nodeType?(a=e[0].startContainer.childNodes[e[0].startOffset-1],a||0!==e[0].startOffset?a&&(b=a.previousSibling,c=a.nextSibling):c=e[0].startContainer.childNodes[0]):(0===e[0].startOffset&&e[0].startContainer.previousSibling?(a=e[0].startContainer.previousSibling,3===a.nodeType&&(d=a.data.length)):(a=e[0].startContainer,d=e[0].startOffset),b=a.previousSibling,c=a.nextSibling),{caretNode:a,prevNode:b,nextNode:c,textOffset:d}):null},getSelectionParentsByTag:function(b){for(var c,d=this.getSelectedOwnNodes(),e=[],f=0,g=d.length;g>f;f++)c=d[f].nodeName&&"LI"===d[f].nodeName?d[f]:a.dom.getParentElement(d[f],{query:"li"},!1,this.contain),c&&e.push(c);return e.length?e:null},getRangeToNodeEnd:function(){if(this.isCollapsed()){var a=this.getRange(),b=a.startContainer,c=a.startOffset,d=rangy.createRange(this.doc);return d.selectNodeContents(b),d.setStart(b,c),d}},caretIsLastInSelection:function(){var a=(rangy.createRange(this.doc),this.getSelection(),this.getRangeToNodeEnd().cloneContents()),b=a.textContent;return/^\s*$/.test(b)},caretIsFirstInSelection:function(b){var c=rangy.createRange(this.doc),e=this.getSelection(),f=this.getRange(),g=d(f.startContainer,f.startOffset);if(g){if(g.nodeType===a.TEXT_NODE){if(!g.parentNode)return!1;if(!this.isCollapsed()||g.parentNode.firstChild!==g&&!a.dom.domNode(g.previousSibling).is.block())return!1;var h=this.win.getComputedStyle(g.parentNode).whiteSpace;return"pre"===h||"pre-wrap"===h?0===f.startOffset:/^\s*$/.test(g.data.substr(0,f.startOffset))}return b&&a.dom.domNode(g).is.lineBreak()?!0:(c.selectNodeContents(this.getRange().commonAncestorContainer),c.collapse(!0),this.isCollapsed()&&(c.startContainer===e.anchorNode||c.endContainer===e.anchorNode)&&c.startOffset===e.anchorOffset)}},caretIsInTheBeginnig:function(b){var c=this.getSelection(),d=c.anchorNode,e=c.anchorOffset;return b&&d?0===e&&(d.nodeName&&d.nodeName===b.toUpperCase()||a.dom.getParentElement(d.parentNode,{query:b},1)):d?0===e&&!this.getPreviousNode(d,!0):void 0},getBeforeSelection:function(b){var c,d,e=this.getSelection(),f=e.isBackwards()?e.focusNode:e.anchorNode,g=e.isBackwards()?e.focusOffset:e.anchorOffset,h=this.createRange();if(f&&3===f.nodeType&&/^\s*$/.test(f.data.slice(0,g))&&(g=0),d=a.dom.getParentElement(f,{query:"._wysihtml5-temp-caret-fix"},1),d&&(f=d.parentNode,g=Array.prototype.indexOf.call(f.childNodes,d)),f){if(g>0)return 3===f.nodeType?(h.setStart(f,0),h.setEnd(f,g),{type:"text",range:h,offset:g,node:f}):(h.setStartBefore(f.childNodes[0]),c=f.childNodes[g-1],h.setEndAfter(c),{type:"element",range:h,offset:g,node:c});if(h.setStartAndEnd(f,0),b){var i=this.getPreviousNode(f,!0),j=null;if(i&&(j=1===i.nodeType&&a.dom.hasClass(i,this.unselectableClass)?i:a.dom.domNode(i).lastLeafNode()),j)return{type:"leafnode",range:h,offset:g,node:j}}return{type:"none",range:h,offset:g,node:f}}return null},executeAndRestoreRangy:function(a,b){var c=rangy.saveSelection(this.win);if(c)try{a()}catch(d){setTimeout(function(){throw d},0)}else a();rangy.restoreSelection(c)},executeAndRestore:function(b,c){var d,e,f,h,i,j,k,l,m=this.doc.body,n=c&&m.scrollTop,o=c&&m.scrollLeft,p="_wysihtml5-temp-placeholder",q=''+a.INVISIBLE_SPACE+"",r=this.getRange(!0);if(!r)return void b(m,m);r.collapsed||(k=r.cloneRange(),j=k.createContextualFragment(q),k.collapse(!1),k.insertNode(j),k.detach()),i=r.createContextualFragment(q),r.insertNode(i),j&&(d=this.contain.querySelectorAll("."+p),r.setStartBefore(d[0]),r.setEndAfter(d[d.length-1])),this.setSelection(r);try{b(r.startContainer,r.endContainer)}catch(s){setTimeout(function(){throw s},0)}if(d=this.contain.querySelectorAll("."+p),d&&d.length){l=rangy.createRange(this.doc),f=d[0].nextSibling,d.length>1&&(h=d[d.length-1].previousSibling),h&&f?(l.setStartBefore(f),l.setEndAfter(h)):(e=this.doc.createTextNode(a.INVISIBLE_SPACE),g.insert(e).after(d[0]),l.setStartBefore(e),l.setEndAfter(e)),this.setSelection(l);for(var t=d.length;t--;)d[t].parentNode.removeChild(d[t])}else this.contain.focus();c&&(m.scrollTop=n,m.scrollLeft=o);try{d.parentNode.removeChild(d)}catch(u){}},set:function(a,b){var c=rangy.createRange(this.doc);c.setStart(a,b||0),this.setSelection(c)},insertHTML:function(a){var b,c,d=this.getRange(),e=this.doc.createElement("DIV"),f=this.doc.createDocumentFragment();if(d){for(d.deleteContents(),e.innerHTML=a,b=e.lastChild;e.firstChild;)f.appendChild(e.firstChild);for(d.insertNode(f),c=this.contain.lastChild;c&&3===c.nodeType&&c.previousSibling&&/^\s*$/.test(c.data);)c=c.previousSibling;b&&(c&&b===c&&1===b.nodeType&&this.contain.appendChild(this.doc.createElement("br")),this.setAfter(b))}},insertNode:function(a){var b=this.getRange();b&&b.insertNode(a)},canAppendChild:function(a){var b,c,d=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],e=this.getRange();return b=a||e.startContainer,b&&(c=(b.tagName||b.nodeName).toLowerCase()),-1===d.indexOf(c)},splitElementAtCaret:function(b,c){var d,e,f,g,h,i=this.getSelection();if(i.rangeCount>0){d=i.getRangeAt(0).cloneRange(),d.setEndAfter(b),e=d.extractContents(),h=e.childNodes;for(var j=h.length;j--;)a.dom.domNode(h[j]).is.visible()||e.removeChild(h[j]);b.parentNode.insertBefore(e,b.nextSibling),c?(f=c.firstChild||c,g=c.lastChild||c,b.parentNode.insertBefore(c,b.nextSibling),f&&g&&(d.setStartBefore(f),d.setEndAfter(g),this.setSelection(d))):(d.setStartAfter(b),d.setEndAfter(b)),a.dom.domNode(b).is.visible()||(""===a.dom.getTextContent(b)?b.parentNode.removeChild(b):b.parentNode.replaceChild(this.doc.createTextNode(" "),b))}},surround:function(a){var b,c=this.getOwnRanges(),d=[];if(0==c.length)return d;for(var e=c.length;e--;){b=this.doc.createElement(a.nodeName),d.push(b),a.className&&(b.className=a.className),a.cssStyle&&b.setAttribute("style",a.cssStyle);try{c[e].surroundContents(b),this.selectNode(b)}catch(f){b.appendChild(c[e].extractContents()),c[e].insertNode(b)}}return d},scrollIntoView:function(){var c,d=this.doc,e=5,f=d.documentElement.scrollHeight>d.documentElement.offsetHeight,g=d._wysihtml5ScrollIntoViewElement=d._wysihtml5ScrollIntoViewElement||function(){var b=d.createElement("span");return b.innerHTML=a.INVISIBLE_SPACE,b}();f&&(this.insertNode(g),c=b(g),g.parentNode.removeChild(g),c>=d.body.scrollTop+d.documentElement.offsetHeight-e&&(d.body.scrollTop=c))},selectLine:function(){var b=rangy.createRange();a.browser.supportsSelectionModify()?this._selectLine_W3C():b.nativeRange&&b.nativeRange.getBoundingClientRect&&this._selectLineUniversal()},includeRangyRangeHelpers:function(){var a=this.getSelection(),b=a.getRangeAt(0),c=function(a){return a&&1===a.nodeType&&a.classList.contains("rangySelectionBoundary")},d=function(a){return 1===a.nodeType?a.childNodes&&a.childNodes.length||0:a.data&&a.data.length||0},e=1===a.anchorNode.nodeType?a.anchorNode.childNodes[a.anchorOffset]:a.anchorNode,f=1===a.focusNode.nodeType?a.focusNode.childNodes[a.focusOffset]:a.focusNode;f&&a.focusOffset===d(f)&&f.nextSibling&&c(f.nextSibling)&&b.setEndAfter(f.nextSibling),e&&0===a.anchorOffset&&e.previousSibling&&c(e.previousSibling)&&b.setStartBefore(e.previousSibling),b.select()},_selectLine_W3C:function(){var a=this.win.getSelection(),b=[a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset];a.modify("move","left","lineboundary"),a.modify("extend","right","lineboundary"),a.anchorNode===b[0]&&a.anchorOffset===b[1]&&a.focusNode===b[2]&&a.focusOffset===b[3]?this._selectLineUniversal():this.includeRangyRangeHelpers()},toLineBoundary:function(b,c){if(c="undefined"==typeof c?!1:c,a.browser.supportsSelectionModify()){var d=this.win.getSelection();d.modify("extend",b,"lineboundary"),c&&("left"===b?d.collapseToStart():"right"===b&&d.collapseToEnd())}},getRangeRect:function(a){var b,c=(this.doc.createTextNode("i"),this.doc.createTextNode("i"));return a.collapsed?(a.insertNode(c),a.selectNode(c),b=a.nativeRange.getBoundingClientRect(),a.deleteContents()):b=a.nativeRange.getBoundingClientRect(),b},_selectLineUniversal:function(){var b,c,d,e,f,g,h=this.getSelection(),i=h.getRangeAt(0),j=0,k=this,l=function(b){return b&&1===b.nodeType&&("block"===k.win.getComputedStyle(b).display||a.lang.array(["BR","HR"]).contains(b.nodeName))},m=function(a){var b=a;if(b)for(;b&&(1===b.nodeType&&b.classList.contains("rangySelectionBoundary")||3===b.nodeType&&/^\s*$/.test(b.data));)b=b.previousSibling;return b};c=i.cloneRange(),d=i.cloneRange(),i.collapsed&&(3===i.startContainer.nodeType&&i.startOffset0?i.moveEnd("character",1):i.startOffset>0&&(3===i.startContainer.nodeType||1===i.startContainer.nodeType&&!l(m(i.startContainer.childNodes[i.startOffset-1])))&&i.moveStart("character",-1)),i.collapsed||i.insertNode(this.doc.createTextNode(a.INVISIBLE_SPACE)),b=i.nativeRange.getBoundingClientRect();do e=i.moveStart("character",-1),f=i.nativeRange.getBoundingClientRect(),f&&Math.floor(f.top)===Math.floor(b.top)||(i.moveStart("character",1),g=!0),j++;while(0!==e&&!g&&2e3>j);if(j=0,g=!1,b=i.nativeRange.getBoundingClientRect(),i.endContainer!==this.contain||this.contain.lastChild&&this.contain.childNodes[i.endOffset]!==this.contain.lastChild)do e=i.moveEnd("character",1),f=i.nativeRange.getBoundingClientRect(),f&&Math.floor(f.bottom)===Math.floor(b.bottom)||(i.moveEnd("character",-1),i.endContainer&&1===i.endContainer.nodeType&&i.endContainer.childNodes[i.endOffset]&&1===i.endContainer.childNodes[i.endOffset].nodeType&&"BR"===i.endContainer.childNodes[i.endOffset].nodeName&&i.endContainer.childNodes[i.endOffset].previousSibling&&(1===i.endContainer.childNodes[i.endOffset].previousSibling.nodeType?i.setEnd(i.endContainer.childNodes[i.endOffset].previousSibling,i.endContainer.childNodes[i.endOffset].previousSibling.childNodes.length):3===i.endContainer.childNodes[i.endOffset].previousSibling.nodeType&&i.setEnd(i.endContainer.childNodes[i.endOffset].previousSibling,i.endContainer.childNodes[i.endOffset].previousSibling.data.length)),g=!0),j++;while(0!==e&&!g&&2e3>j);i.select(),this.includeRangyRangeHelpers()},getText:function(){var a=this.getSelection();return a?a.toString():""},getNodes:function(a,b){var c=this.getRange();return c?c.getNodes(Array.isArray(a)?a:[a],b):[]},getOwnNodes:function(a,b,c){for(var d=this.getOwnRanges(),e=[],f=0,g=d.length;g>f;f++)d[f]&&(c&&d[f].splitBoundaries(),e=e.concat(d[f].getNodes(Array.isArray(a)?a:[a],b)));return e},fixRangeOverflow:function(a){if(this.contain&&this.contain.firstChild&&a){var b=a.compareNode(this.contain);if(2!==b)1===b&&a.setStartBefore(this.contain.firstChild),0===b&&a.setEndAfter(this.contain.lastChild),3===b&&(a.setStartBefore(this.contain.firstChild),a.setEndAfter(this.contain.lastChild));else if(this._detectInlineRangeProblems(a)){var c=a.endContainer.previousElementSibling;c&&a.setEnd(c,this._endOffsetForNode(c))}}},_endOffsetForNode:function(a){var b=document.createRange();return b.selectNodeContents(a),b.endOffset},_detectInlineRangeProblems:function(a){var b=g.compareDocumentPosition(a.startContainer,a.endContainer);return 0==a.endOffset&&4&b},getRange:function(a){var b=this.getSelection(),c=b&&b.rangeCount&&b.getRangeAt(0);return a!==!0&&this.fixRangeOverflow(c),c},getOwnUneditables:function(){var b=g.query(this.contain,"."+this.unselectableClass),c=g.query(b,"."+this.unselectableClass);return a.lang.array(b).without(c)},getOwnRanges:function(){var a,b=[],c=this.getRange();if(c&&b.push(c),this.unselectableClass&&this.contain&&c){var d,e=this.getOwnUneditables();if(e.length>0)for(var f=0,g=e.length;g>f;f++){a=[];for(var h=0,i=b.length;i>h;h++){if(b[h])switch(b[h].compareNode(e[f])){case 2:break;case 3:d=b[h].cloneRange(),d.setEndBefore(e[f]),a.push(d),d=b[h].cloneRange(),d.setStartAfter(e[f]),a.push(d);break;default:a.push(b[h])}b=a}}}return b},getSelection:function(){return rangy.getSelection(this.win)},setSelection:function(a){var b=rangy.getSelection(this.win);return b.setSingleRange(a),b&&b.anchorNode&&b.focusNode?b:null},selectAll:function(){var b,c=this.createRange(),d=this.composer,f=this,g=e(this.composer.element),h=e(this.composer.element),i=function(){c.setStart(d.element,0),c.setEnd(d.element,d.element.childNodes.length),b=f.setSelection(c)},j=function(){return!b||b.nativeSelection&&b.nativeSelection.type&&("Caret"===b.nativeSelection.type||"None"===b.nativeSelection.type)};a.dom.removeInvisibleSpaces(this.composer.element),i(),this.composer.element.firstChild&&j()&&(this.composer.element.appendChild(g),i(),j()&&(g.parentNode.removeChild(g),this.composer.element.insertBefore(h,this.composer.element.firstChild),i(),j()&&(this.composer.element.appendChild(g),i())))},createRange:function(){return rangy.createRange(this.doc)},isCollapsed:function(){return this.getSelection().isCollapsed},getHtml:function(){return this.getSelection().toHtml()},getPlainText:function(){return this.getSelection().toString()},isEndToEndInNode:function(b){var c=this.getRange(),d=c.commonAncestorContainer,e=c.startContainer,f=c.endContainer;if(d.nodeType===a.TEXT_NODE&&(d=d.parentNode),e.nodeType===a.TEXT_NODE&&!/^\s*$/.test(e.data.substr(c.startOffset)))return!1;if(f.nodeType===a.TEXT_NODE&&!/^\s*$/.test(f.data.substr(c.endOffset)))return!1;for(;e&&e!==d;){if(e.nodeType!==a.TEXT_NODE&&!a.dom.contains(d,e))return!1;if(a.dom.domNode(e).prev({ignoreBlankTexts:!0}))return!1;e=e.parentNode}for(;f&&f!==d;){if(f.nodeType!==a.TEXT_NODE&&!a.dom.contains(d,f))return!1;if(a.dom.domNode(f).next({ignoreBlankTexts:!0}))return!1;f=f.parentNode}return a.lang.array(b).contains(d.nodeName)?d:!1},isInThisEditable:function(){var b=this.getSelection(),c=b.focusNode,d=b.anchorNode;return c&&1!==c.nodeType&&(c=c.parentNode),d&&1!==d.nodeType&&(d=d.parentNode),d&&c&&(a.dom.contains(this.composer.element,c)||this.composer.element===c)&&(a.dom.contains(this.composer.element,d)||this.composer.element===d)},deselect:function(){var a=this.getSelection();a&&a.removeAllRanges()}})}(wysihtml5),function(a,b){function c(a,b,c){if(!a.className)return!1;var d=a.className.match(c)||[];return d[d.length-1]===b}function d(a,b){if(!a.getAttribute||!a.getAttribute("style"))return!1;a.getAttribute("style").match(b);return a.getAttribute("style").match(b)?!0:!1}function e(a,b,c){a.getAttribute("style")?(h(a,c),a.getAttribute("style")&&!/^\s*$/.test(a.getAttribute("style"))?a.setAttribute("style",b+";"+a.getAttribute("style")):a.setAttribute("style",b)):a.setAttribute("style",b)}function f(a,b,c){a.className?(g(a,c),a.className+=" "+b):a.className=b}function g(a,b){a.className&&(a.className=a.className.replace(b,""))}function h(a,b){var c,d=[];if(a.getAttribute("style")){c=a.getAttribute("style").split(";");for(var e=c.length;e--;)c[e].match(b)||/^\s*$/.test(c[e])||d.push(c[e]);d.length?a.setAttribute("style",d.join(";")):a.removeAttribute("style")}}function i(a,b){var c=[],d=b.split(";"),e=a.getAttribute("style");if(e){e=e.replace(/\s/gi,"").toLowerCase(), -c.push(new RegExp("(^|\\s|;)"+b.replace(/\s/gi,"").replace(/([\(\)])/gi,"\\$1").toLowerCase().replace(";",";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi,"\\s?rgb\\($1,\\s?$2,\\s?$3\\)"),"gi"));for(var f=d.length;f-->0;)/^\s*$/.test(d[f])||c.push(new RegExp("(^|\\s|;)"+d[f].replace(/\s/gi,"").replace(/([\(\)])/gi,"\\$1").toLowerCase().replace(";",";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi,"\\s?rgb\\($1,\\s?$2,\\s?$3\\)"),"gi"));for(var g=0,h=c.length;h>g;g++)if(e.match(c[g]))return c[g]}return!1}function j(c,d,e,f){return e?i(c,e):f?a.dom.hasClass(c,f):b.dom.arrayContains(d,c.tagName.toLowerCase())}function k(a,b,c,d){for(var e=a.length;e--;)if(!j(a[e],b,c,d))return!1;return a.length?!0:!1}function l(a,b,c){var d=i(a,b);return d?(h(a,d),"remove"):(e(a,b,c),"change")}function m(a,b){return a.className.replace(u," ")==b.className.replace(u," ")}function n(a){for(var b=a.parentNode;a.firstChild;)b.insertBefore(a.firstChild,a);b.removeChild(a)}function o(a,b){if(a.attributes.length!=b.attributes.length)return!1;for(var c,d,e,f=0,g=a.attributes.length;g>f;++f)if(c=a.attributes[f],e=c.name,"class"!=e){if(d=b.attributes.getNamedItem(e),c.specified!=d.specified)return!1;if(c.specified&&c.nodeValue!==d.nodeValue)return!1}return!0}function p(a,c){return b.dom.isCharacterDataNode(a)?0==c?!!a.previousSibling:c==a.length?!!a.nextSibling:!0:c>0&&ce;++e)a=this.textNodes[e],b=a.parentNode,d[e]=a.data,e&&(b.removeChild(a),b.hasChildNodes()||b.parentNode.removeChild(b));return this.firstTextNode.data=c=d.join(""),c},getLength:function(){for(var a=this.textNodes.length,b=0;a--;)b+=this.textNodes[a].length;return b},toString:function(){for(var a=[],b=0,c=this.textNodes.length;c>b;++b)a[b]="'"+this.textNodes[b].data+"'";return"[Merge("+a.join(",")+")]"}},s.prototype={getAncestorWithClass:function(d){for(var e;d;){if(e=this.cssClass?c(d,this.cssClass,this.similarClassRegExp):""!==this.cssStyle?!1:!0,d.nodeType==a.ELEMENT_NODE&&"false"!=d.getAttribute("contenteditable")&&b.dom.arrayContains(this.tagNames,d.tagName.toLowerCase())&&e)return d;d=d.parentNode}return!1},getAncestorWithStyle:function(c){for(var e;c;){if(e=this.cssStyle?d(c,this.similarStyleRegExp):!1,c.nodeType==a.ELEMENT_NODE&&"false"!=c.getAttribute("contenteditable")&&b.dom.arrayContains(this.tagNames,c.tagName.toLowerCase())&&e)return c;c=c.parentNode}return!1},getMatchingAncestor:function(a){var b=this.getAncestorWithClass(a),c=!1;return b?this.cssStyle&&(c="class"):(b=this.getAncestorWithStyle(a),b&&(c="style")),{element:b,type:c}},postApply:function(a,b){for(var c,d,e,f=a[0],g=a[a.length-1],h=[],i=f,j=g,k=0,l=g.length,m=0,n=a.length;n>m;++m)d=a[m],e=null,d&&d.parentNode&&(e=this.getAdjacentMergeableTextNode(d.parentNode,!1)),e?(c||(c=new r(e),h.push(c)),c.textNodes.push(d),d===f&&(i=c.firstTextNode,k=i.length),d===g&&(j=c.firstTextNode,l=c.getLength())):c=null;if(g&&g.parentNode){var o=this.getAdjacentMergeableTextNode(g.parentNode,!0);o&&(c||(c=new r(g),h.push(c)),c.textNodes.push(o))}if(h.length){for(m=0,n=h.length;n>m;++m)h[m].doMerge();b.setStart(i,k),b.setEnd(j,l)}},getAdjacentMergeableTextNode:function(b,c){var d,e=b.nodeType==a.TEXT_NODE,f=e?b.parentNode:b,g=c?"nextSibling":"previousSibling";if(e){if(d=b[g],d&&d.nodeType==a.TEXT_NODE)return d}else if(d=f[g],d&&this.areElementsMergeable(b,d))return d[c?"firstChild":"lastChild"];return null},areElementsMergeable:function(a,c){return b.dom.arrayContains(this.tagNames,(a.tagName||"").toLowerCase())&&b.dom.arrayContains(this.tagNames,(c.tagName||"").toLowerCase())&&m(a,c)&&o(a,c)},createContainer:function(a){var b=a.createElement(this.tagNames[0]);return this.cssClass&&(b.className=this.cssClass),this.cssStyle&&b.setAttribute("style",this.cssStyle),b},applyToTextNode:function(a){var c=a.parentNode;if(1==c.childNodes.length&&b.dom.arrayContains(this.tagNames,c.tagName.toLowerCase()))this.cssClass&&f(c,this.cssClass,this.similarClassRegExp),this.cssStyle&&e(c,this.cssStyle,this.similarStyleRegExp);else{var d=this.createContainer(b.dom.getDocument(a));a.parentNode.insertBefore(d,a),d.appendChild(a)}},isRemovable:function(c){return b.dom.arrayContains(this.tagNames,c.tagName.toLowerCase())&&""===a.lang.string(c.className).trim()&&(!c.getAttribute("style")||""===a.lang.string(c.getAttribute("style")).trim())},undoToTextNode:function(a,b,c,d){var e=c?!1:!0,f=c||d,h=!1;if(!b.containsNode(f)){var i=b.cloneRange();i.selectNode(f),i.isPointInRange(b.endContainer,b.endOffset)&&p(b.endContainer,b.endOffset)&&(q(f,b.endContainer,b.endOffset,this.container),b.setEndAfter(f)),i.isPointInRange(b.startContainer,b.startOffset)&&p(b.startContainer,b.startOffset)&&(f=q(f,b.startContainer,b.startOffset,this.container))}!e&&this.similarClassRegExp&&g(f,this.similarClassRegExp),e&&this.similarStyleRegExp&&(h="change"===l(f,this.cssStyle,this.similarStyleRegExp)),this.isRemovable(f)&&!h&&n(f)},applyToRange:function(b){for(var c,d=b.length;d--;){if(c=b[d].getNodes([a.TEXT_NODE]),!c.length)try{var e=this.createContainer(b[d].endContainer.ownerDocument);return b[d].surroundContents(e),void this.selectNode(b[d],e)}catch(f){}if(b[d].splitBoundaries(),c=b[d].getNodes([a.TEXT_NODE]),c.length){for(var g,h=0,i=c.length;i>h;++h)g=c[h],this.getMatchingAncestor(g).element||this.applyToTextNode(g);b[d].setStart(c[0],0),g=c[c.length-1],b[d].setEnd(g,g.length),this.normalize&&this.postApply(c,b[d])}}},undoToRange:function(b){for(var c,d,e,f=b.length;f--;){if(c=b[f].getNodes([a.TEXT_NODE]),c.length)b[f].splitBoundaries(),c=b[f].getNodes([a.TEXT_NODE]);else{var g=b[f].endContainer.ownerDocument,h=g.createTextNode(a.INVISIBLE_SPACE);b[f].insertNode(h),b[f].selectNode(h),c=[h]}for(var i=0,j=c.length;j>i;++i)b[f].isValid()&&(d=c[i],e=this.getMatchingAncestor(d),"style"===e.type?this.undoToTextNode(d,b[f],!1,e.element):e.element&&this.undoToTextNode(d,b[f],e.element));1==j?this.selectNode(b[f],c[0]):(b[f].setStart(c[0],0),d=c[c.length-1],b[f].setEnd(d,d.length),this.normalize&&this.postApply(c,b[f]))}},selectNode:function(b,c){var d=c.nodeType===a.ELEMENT_NODE,e="canHaveHTML"in c?c.canHaveHTML:!0,f=d?c.innerHTML:c.data,g=""===f||f===a.INVISIBLE_SPACE;if(g&&d&&e)try{c.innerHTML=a.INVISIBLE_SPACE}catch(h){}b.selectNodeContents(c),g&&d?b.collapse(!1):g&&(b.setStartAfter(c),b.setEndAfter(c))},getTextSelectedByRange:function(a,b){var c=b.cloneRange();c.selectNodeContents(a);var d=c.intersection(b),e=d?d.toString():"";return c.detach(),e},isAppliedToRange:function(b){for(var c,d,e=[],f="full",g=b.length;g--;){if(d=b[g].getNodes([a.TEXT_NODE]),!d.length)return c=this.getMatchingAncestor(b[g].startContainer).element,c?{elements:[c],coverage:f}:!1;for(var h,i=0,j=d.length;j>i;++i)h=this.getTextSelectedByRange(d[i],b[g]),c=this.getMatchingAncestor(d[i]).element,c&&""!=h?(e.push(c),1===a.dom.getTextNodes(c,!0).length?f="full":"full"===f&&(f="inline")):c||(f="partial")}return e.length?{elements:e,coverage:f}:!1},toggleRange:function(a){var b,c=this.isAppliedToRange(a);c?"full"===c.coverage?this.undoToRange(a):"inline"===c.coverage?(b=k(c.elements,this.tagNames,this.cssStyle,this.cssClass),this.undoToRange(a),b||this.applyToRange(a)):(k(c.elements,this.tagNames,this.cssStyle,this.cssClass)||this.undoToRange(a),this.applyToRange(a)):this.applyToRange(a)}},a.selection.HTMLApplier=s}(wysihtml5,rangy),wysihtml5.Commands=Base.extend({constructor:function(a){this.editor=a,this.composer=a.composer,this.doc=this.composer.doc},support:function(a){return wysihtml5.browser.supportsCommand(this.doc,a)},exec:function(a,b){var c=wysihtml5.commands[a],d=wysihtml5.lang.array(arguments).get(),e=c&&c.exec,f=null;if(this.composer.hasPlaceholderSet()&&!wysihtml5.lang.array(["styleWithCSS","enableObjectResizing","enableInlineTableEditing"]).contains(a)&&(this.composer.element.innerHTML="",this.composer.selection.selectNode(this.composer.element)),this.editor.fire("beforecommand:composer"),e)d.unshift(this.composer),f=e.apply(c,d);else try{f=this.doc.execCommand(a,!1,b)}catch(g){}return this.editor.fire("aftercommand:composer"),f},remove:function(a,b){var c=wysihtml5.commands[a],d=wysihtml5.lang.array(arguments).get(),e=c&&c.remove;return e?(d.unshift(this.composer),e.apply(c,d)):void 0},state:function(a,b){var c=wysihtml5.commands[a],d=wysihtml5.lang.array(arguments).get(),e=c&&c.state;if(e)return d.unshift(this.composer),e.apply(c,d);try{return this.doc.queryCommandState(a)}catch(f){return!1}},stateValue:function(a){var b=wysihtml5.commands[a],c=wysihtml5.lang.array(arguments).get(),d=b&&b.stateValue;return d?(c.unshift(this.composer),d.apply(b,c)):!1}}),function(a){var b={nodeName:"B",toggle:!0};a.commands.bold={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){function b(b){return a.lang.object({}).merge(c).merge({attribute:b}).get()}var c={nodeName:"A",toggle:!1};a.commands.createLink={exec:function(c,d,e){var f=b(e);if(c.selection.isCollapsed()&&!this.state(c,d)){var g=c.doc.createTextNode(f.attribute.href);c.selection.insertNode(g),c.selection.selectNode(g)}a.commands.formatInline.exec(c,d,f)},state:function(b,d){return a.commands.formatInline.state(b,d,c)}}}(wysihtml5),function(a){var b={nodeName:"A"};a.commands.removeLink={exec:function(c,d){a.commands.formatInline.remove(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){var b=/wysiwyg-font-size-[0-9a-z\-]+/g;a.commands.fontSize={exec:function(c,d,e){a.commands.formatInline.exec(c,d,{className:"wysiwyg-font-size-"+e,classRegExp:b,toggle:!0})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{className:"wysiwyg-font-size-"+d})}}}(wysihtml5),function(a){a.commands.fontSizeStyle={exec:function(b,c,d){d=d.size||d,/^\s*$/.test(d)||a.commands.formatInline.exec(b,c,{styleProperty:"fontSize",styleValue:d,toggle:!1})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{styleProperty:"fontSize",styleValue:d||void 0})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"fontSize"})},stateValue:function(b,c){var d,e=this.state(b,c);return e&&a.lang.object(e).isArray()&&(e=e[0]),e&&(d=e.getAttribute("style"))?a.quirks.styleParser.parseFontSize(d):!1}}}(wysihtml5),function(a){var b=/wysiwyg-color-[0-9a-z]+/g;a.commands.foreColor={exec:function(c,d,e){a.commands.formatInline.exec(c,d,{className:"wysiwyg-color-"+e,classRegExp:b,toggle:!0})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{className:"wysiwyg-color-"+d})}}}(wysihtml5),function(a){a.commands.foreColorStyle={exec:function(b,c,d){var e,f;d&&(e=a.quirks.styleParser.parseColor("color:"+(d.color||d),"color"),e&&(f=(1===e[3]?"rgb("+[e[0],e[1],e[2]].join(", "):"rgba("+e.join(", "))+")",a.commands.formatInline.exec(b,c,{styleProperty:"color",styleValue:f})))},state:function(b,c,d){var e,f=d?a.quirks.styleParser.parseColor("color:"+(d.color||d),"color"):null;return f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")"),a.commands.formatInline.state(b,c,{styleProperty:"color",styleValue:e})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"color"})},stateValue:function(b,c,d){var e,f=this.state(b,c),g=!1;return f&&a.lang.object(f).isArray()&&(f=f[0]),f&&(e=f.getAttribute("style"))?(g=a.quirks.styleParser.parseColor(e,"color"),a.quirks.styleParser.unparseColor(g,d)):!1}}}(wysihtml5),function(a){a.commands.bgColorStyle={exec:function(b,c,d){var e,f=a.quirks.styleParser.parseColor("background-color:"+(d.color||d),"background-color");f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")",a.commands.formatInline.exec(b,c,{styleProperty:"backgroundColor",styleValue:e}))},state:function(b,c,d){var e,f=d?a.quirks.styleParser.parseColor("background-color:"+(d.color||d),"background-color"):null;return f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")"),a.commands.formatInline.state(b,c,{styleProperty:"backgroundColor",styleValue:e})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"backgroundColor"})},stateValue:function(b,c,d){var e,f=this.state(b,c),g=!1;return f&&a.lang.object(f).isArray()&&(f=f[0]),f&&(e=f.getAttribute("style"))?(g=a.quirks.styleParser.parseColor(e,"background-color"),a.quirks.styleParser.unparseColor(g,d)):!1}}}(wysihtml5),function(a){function b(a){return{nodeName:a.nodeName||null,className:a.classRegExp?null:a.className||null,classRegExp:a.classRegExp||null,styleProperty:a.styleProperty||null}}function c(a,b){return 3===a.nodeType?a:a.childNodes[b]||a}function d(a){return a&&1===a.nodeType&&"BR"===a.nodeName}function e(a,b){return a&&1===a.nodeType&&"block"===b.win.getComputedStyle(a).display}function f(a){return a&&1===a.nodeType&&a.classList.contains("rangySelectionBoundary")}function g(a,b){return d(a)||e(a,b)}function h(b,c){a.dom.removeInvisibleSpaces(b.element);for(var d,e=b.element,f=e.querySelectorAll(E),g=b.config.classNames.uneditableContainer+[""].concat(E.split(",")).join(", "+b.config.classNames.uneditableContainer+" "),h=e.querySelectorAll(g),i=a.lang.array(f).without(h),j=i.length;j--;)""!==i[j].innerHTML.replace(/[\uFEFF]/g,"")||0!==c.length&&i[j]===c[c.length-1]||(d=a.lang.array(c).indexOf(i[j]),d>-1&&c.splice(d,1),i[j].parentNode.removeChild(i[j]));return c}function i(a){return a.config.useLineBreaks?"DIV":"P"}function j(a,b,c){for(var d=a,e=null;d&&b&&d!==b;)1===d.nodeType&&d.matches(c?E:D)&&(e=d),d=d.parentNode;return e}function k(a,b){for(var c,d,e,f=a,g=null;f&&b&&f!==b;)1===f.nodeType&&f.matches(F)&&(d=f,null===g?(g=f.cloneNode(!1),c=g):(e=f.cloneNode(!1),e.appendChild(g),g=e)),f=f.parentNode;return{parent:d,outerNode:g,innerNode:c}}function l(b,c,d){return b||(b=d.doc.createElement(c.nodeName||i(d)),b.appendChild(d.doc.createTextNode(a.INVISIBLE_SPACE))),c.nodeName&&b.nodeName!==c.nodeName&&(b=C.renameElement(b,c.nodeName)),c.classRegExp&&(b.className=b.className.replace(c.classRegExp,"")),c.className&&b.classList.add(c.className),c.styleProperty&&"undefined"!=typeof c.styleValue&&(b.style[a.browser.fixStyleKey(c.styleProperty)]=c.styleValue),b}function m(b,c,d){var e,f=b.previousSibling,g=b.nextSibling,h=!1;c.styleProperty&&(b.style[a.browser.fixStyleKey(c.styleProperty)]=""),c.className&&b.classList.remove(c.className),c.classRegExp&&(b.className=b.className.replace(c.classRegExp,"")),null!==b.getAttribute("class")&&""===b.getAttribute("class").trim()&&b.removeAttribute("class"),c.nodeName&&b.nodeName.toLowerCase()===c.nodeName.toLowerCase()&&(e=b.getAttribute("style"),e&&""!==e.trim()?b=C.renameElement(b,i(d)):(C.unwrap(b),h=!0)),null!==b.getAttribute("style")&&""===b.getAttribute("style").trim()&&b.removeAttribute("style"),h&&u(f,g,d)}function n(b){for(var c,d,e=b.querySelectorAll(E)||[],f=e.length;f--;)c=a.dom.domNode(e[f]).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),d=a.dom.domNode(e[f]).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),c&&1!==c.nodeType&&"BR"!==c.nodeName&&""!==(e[f].innerHTML||e[f].nodeValue||"").trim()&&e[f].parentNode.insertBefore(e[f].ownerDocument.createElement("BR"),c),c&&1!==c.nodeType&&"BR"!==c.nodeName&&""!==(e[f].innerHTML||e[f].nodeValue||"").trim()&&e[f].parentNode.insertBefore(e[f].ownerDocument.createElement("BR"),c),a.dom.unwrap(e[f])}function o(a,b){var c,d=a.startContainer,e=a.endContainer;return d&&1===d.nodeType&&d===e?void(d.firstChild===d.lastChild&&1===a.endOffset&&d!==b.element&&"LI"!==d.nodeName&&"TD"!==d.nodeName&&(a.setStartBefore(d),a.setEndAfter(e))):d&&1===d.nodeType&&3===e.nodeType?void(d.firstChild===e&&a.endOffset===e.data.length&&d!==b.element&&"LI"!==d.nodeName&&"TD"!==d.nodeName&&a.setEndAfter(d)):e&&1===e.nodeType&&3===d.nodeType?void(e.firstChild===d&&0===a.startOffset&&e!==b.element&&"LI"!==e.nodeName&&"TD"!==e.nodeName&&a.setStartBefore(e)):d&&3===d.nodeType&&d===e&&1===d.parentNode.childNodes.length?void(a.endOffset==e.data.length&&0===a.startOffset&&(c=d.parentNode,c!==b.element&&"LI"!==c.nodeName&&"TD"!==c.nodeName&&(a.setStartBefore(c),a.setEndAfter(c)))):void 0}function p(b){for(var c,d,e,f,g,h,i=[],j=0,k=b.length;k>j;j++)if(1===b[j].startContainer.nodeType&&b[j].startContainer.matches("ul, ol")&&b[j].setStart(b[j].startContainer.childNodes[b[j].startOffset],0),1===b[j].endContainer.nodeType&&b[j].endContainer.matches("ul, ol")&&(h=b[j].endContainer.childNodes[Math.max(b[j].endOffset-1,0)],h.childNodes&&b[j].setEnd(h,h.childNodes.length)),c=b[j].getNodes([1],function(a){return"LI"===a.nodeName}),c.length>0){for(d=0,e=c.length;e>d;d++)g=b[j].compareNode(c[d]),(g===b[j].NODE_AFTER||g===b[j].NODE_INSIDE)&&(f=b[j].cloneRange(),h=a.dom.domNode(c[d]).prev({nodeTypes:[1]}),h?f.setEnd(h,h.childNodes.length):c[d].closest("ul, ol")?f.setEndBefore(c[d].closest("ul, ol")):f.setEndBefore(c[d]),i.push(f),b[j].setStart(c[d],0)),(g===b[j].NODE_BEFORE||g===b[j].NODE_INSIDE)&&(f=b[j].cloneRange(),f.setEnd(c[d],c[d].childNodes.length),i.push(f),h=a.dom.domNode(c[d]).next({nodeTypes:[1]}),h?b[j].setStart(h,0):c[d].closest("ul, ol")?b[j].setStartAfter(c[d].closest("ul, ol")):b[j].setStartAfter(c[d]));i.push(b[j])}else i.push(b[j]);return i}function q(b,c,d){var e=b?a.lang.object(b).clone(!0):null;return e&&(e.nodeName=e.nodeName||c||i(d)),e}function r(b,c,d,e){var f,h,i,l,m,n=c.startContainer,e=e||j(n,d.element,!0);if(e)h=b.firstChild,i=b.lastChild,d.selection.splitElementAtCaret(e,b),m=a.dom.domNode(i).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),l=a.dom.domNode(h).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),h&&!g(h,d)&&l&&!g(l,d)&&h.parentNode.insertBefore(d.doc.createElement("br"),h),i&&!g(i,d)&&m&&!g(m,d)&&m.parentNode.insertBefore(d.doc.createElement("br"),m);else if(f=k(n,d.element),f.outerNode&&f.innerNode&&f.parent){if(1===b.childNodes.length){for(;b.firstChild.firstChild;)f.innerNode.appendChild(b.firstChild.firstChild);b.firstChild.appendChild(f.outerNode)}d.selection.splitElementAtCaret(f.parent,b)}else{var o=b.firstChild,p=b.lastChild;c.insertNode(b),c.setStartBefore(o),c.setEndAfter(p)}}function s(b,d,e){for(var f,h,i=b.cloneRange(),j=c(i.startContainer,i.startOffset).previousSibling,k=c(i.endContainer,i.endOffset).nextSibling,l=i.extractContents(),m=e.doc.createDocumentFragment(),o=!0;l.firstChild;){if(1===l.firstChild.nodeType&&l.firstChild.matches(E)){n(l.firstChild),f=a.dom.unwrap(l.firstChild),f.length>0&&(m.lastChild&&(1!==m.lastChild.nodeType||!g(m.lastChild,e))||!m.lastChild&&j&&(1!==j.nodeType||g(j,e)))&&m.appendChild(e.doc.createElement("BR"));for(var p=0,q=f.length;q>p;p++)m.appendChild(f[p]);f.length>0&&(1===m.lastChild.nodeType&&g(m.lastChild,e)||(k||m.lastChild!==l.lastChild)&&m.appendChild(e.doc.createElement("BR")))}else m.appendChild(l.firstChild);o=!1}return h=a.lang.array(m.childNodes).get(),r(m,i,e),h}function t(b,c,e){var f=b&&a.dom.domNode(b).prev({nodeTypes:[1,3],ignoreBlankTexts:!0});d(c)&&c.parentNode.removeChild(c),!d(b)||f&&1===f.nodeType&&"block"===e.win.getComputedStyle(f).display||b.parentNode.removeChild(b)}function u(a,b,c){var e;a&&f(a)&&(a=a.previousSibling),b&&f(b)&&(b=b.nextSibling),e=a&&a.previousSibling,a&&(1!==a.nodeType||"block"!==c.win.getComputedStyle(a).display&&!d(a))&&a.parentNode&&a.parentNode.insertBefore(c.doc.createElement("br"),a.nextSibling),b&&(1!==b.nodeType||"block"!==c.win.getComputedStyle(b).display)&&b.parentNode&&b.parentNode.insertBefore(c.doc.createElement("br"),b)}function v(d,e,f,g){var h,i,k=e?b(e):null,m=d.cloneRange(),o=m.startContainer,p=c(m.startContainer,m.startOffset),s=c(m.endContainer,m.endOffset),u=m.startContainer!==p||3!==p.nodeType||G(p,m.startOffset)?a.dom.domNode(p).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}):p,v=1===m.endContainer.nodeType&&m.endContainer.childNodes[m.endOffset]===s&&(1===s.nodeType||!H(s,m.endOffset)&&!a.dom.domNode(s).is.rangyBookmark())||m.endContainer===s&&3===s.nodeType&&!H(s,m.endOffset)?s:a.dom.domNode(s).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),w=m.extractContents(),x=g.doc.createDocumentFragment(),y=k?a.dom.getParentElement(o,k,null,g.element):null,z=!f||!e||"BLOCKQUOTE"===e.nodeName&&"BLOCKQUOTE"===f,A=y||j(o,g.element,z);if(a.dom.domNode(v).is.rangyBookmark()&&(s=v,v=s.nextSibling),I(w),e&&"BLOCKQUOTE"===e.nodeName){var B=l(null,e,g);B.appendChild(w),x.appendChild(B),i=[B]}else{if(w.firstChild)for(;w.firstChild;)if(1==w.firstChild.nodeType&&w.firstChild.matches(E))l(w.firstChild,e,g),w.firstChild.matches(D)&&n(w.firstChild),x.appendChild(w.firstChild);else{for(h=l(null,q(e,f,g),g);w.firstChild&&(1!==w.firstChild.nodeType||!w.firstChild.matches(E));)1==w.firstChild.nodeType&&h.matches(D)&&n(w.firstChild),h.appendChild(w.firstChild);x.appendChild(h)}else x.appendChild(l(null,e,g));i=a.lang.array(x.childNodes).get()}return r(x,m,g,A),t(u,v,g),i.length>0&&("undefined"==typeof i[i.length-1].lastChild||a.dom.domNode(i[i.length-1].lastChild).is.rangyBookmark())&&i[i.length-1].appendChild(g.doc.createElement("br")),i}function w(b,c){var d=a.dom.getParentElement(b,{query:E},null,c.element);return d?d.nodeName:null}function x(b,c){var d,e=a.dom.getParentElement(b.selection.getOwnRanges()[0].startContainer,{query:D+", "+(c?c.toLowerCase():"div")},null,b.element);e?(d=b.selection.createRange(),d.selectNode(e),b.selection.setSelection(d)):b.isEmpty()||b.selection.selectLine()}function y(a,b){var c=b.selection.createRange(),d=a[a.length-1],e=1===d.nodeType&&d.childNodes?0|d.childNodes.length:d.length||0;c.setStart(a[0],0),c.setEnd(d,e),c.select()}function z(a,b,c){var d,e=b.selection.getOwnRanges(),f=[];e=p(e);for(var g=e.length;g--;)o(e[g],b),d=w(e[g].startContainer,b),f="remove"===a?f.concat(s(e[g],d,b)):f.concat(v(e[g],c,d,b));return f}function A(a){return"string"==typeof a&&(a={nodeName:a.toUpperCase()}),a}function B(b){var c;return b.selection.isCollapsed()&&(c=b.selection.getNodesNearCaret(),c&&c.caretNode&&(a.dom.domNode(c.caretNode).is.lineBreak()||3===c.caretNode.nodeType&&0===c.textOffset&&(!c.prevNode||a.dom.domNode(c.prevNode).is.lineBreak())||1===c.caretNode.nodeType&&c.caretNode.classList.contains("rangySelectionBoundary")&&(!c.prevNode||a.dom.domNode(c.prevNode).is.lineBreak()||a.dom.domNode(c.prevNode).is.block())&&(!c.nextNode||a.dom.domNode(c.nextNode).is.lineBreak()||a.dom.domNode(c.nextNode).is.block())))?!0:!1}var C=a.dom,D="h1, h2, h3, h4, h5, h6, p, pre",E="h1, h2, h3, h4, h5, h6, p, pre, div, blockquote",F="b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",G=function(a,b){var c=a.data?a.data.slice(0,b):"";return/^\s*$/.test(c)},H=function(a,b){var c=a.data?a.data.slice(b):"";return/^\s*$/.test(c)},I=function(a){if(a){for(;a.firstChild&&3===a.firstChild.nodeType&&/^\s*$/.test(a.firstChild.data)&&a.lastChild!==a.firstChild;)a.removeChild(a.firstChild);for(;a.lastChild&&3===a.lastChild.nodeType&&/^\s*$/.test(a.lastChild.data)&&a.lastChild!==a.firstChild;)a.removeChild(a.lastChild);a.firstChild&&1===a.firstChild.nodeType&&"BR"===a.firstChild.nodeName&&a.lastChild!==a.firstChild&&a.removeChild(a.firstChild),a.lastChild&&1===a.lastChild.nodeType&&"BR"===a.lastChild.nodeName&&a.lastChild!==a.firstChild&&a.removeChild(a.lastChild)}};a.commands.formatBlock={exec:function(a,b,c){c=A(c);var d,e,f=[];if(c&&c.toggle&&(e=this.state(a,b,c)),e){d=rangy.saveSelection(a.win);for(var g=0,i=e.length;i>g;g++)m(e[g],c,a)}else a.selection.isCollapsed()&&(d=rangy.saveSelection(a.win),B(a)?a.selection.selectLine():x(a,c&&c.nodeName?c.nodeName.toUpperCase():void 0)),f=c?z("apply",a,c):z("remove",a);f=h(a,f),d?rangy.restoreSelection(d):y(f,a)},remove:function(a,b,c){c=A(c);var d,e;a.selection.isCollapsed()&&(e=rangy.saveSelection(a.win),x(a,c&&c.nodeName?c.nodeName.toUpperCase():void 0)),d=z("remove",a),d=h(a,d),e?rangy.restoreSelection(e):y(d,a)},state:function(b,c,d){d=A(d);for(var e,f=b.selection.filterElements(function(b){return a.dom.domNode(b).test(d||{query:E})}.bind(this)),g=b.selection.getSelectedOwnNodes(),h=0,i=g.length;i>h;h++)e=C.getParentElement(g[h],d||{query:E},null,b.element),e&&-1===f.indexOf(e)&&f.push(e);return 0===f.length?!1:f}}}(wysihtml5),function(a){a.commands.formatCode={exec:function(b,c,d){var e,f,g,h=this.state(b)[0];h?b.selection.executeAndRestore(function(){e=h.querySelector("code"),a.dom.replaceWithChildNodes(h),e&&a.dom.replaceWithChildNodes(e)}):(f=b.selection.getRange(),g=f.extractContents(),h=b.doc.createElement("pre"),e=b.doc.createElement("code"),d&&(e.className=d),h.appendChild(e),e.appendChild(g),f.insertNode(h),b.selection.selectNode(h))},state:function(b){var c,d=b.selection.getSelectedNode();return d&&d.nodeName&&"PRE"==d.nodeName&&d.firstChild&&d.firstChild.nodeName&&"CODE"==d.firstChild.nodeName?[d]:(c=a.dom.getParentElement(d,{query:"pre code"}),c?[c.parentNode]:!1)}}}(wysihtml5),function(a){function b(a){return/^\s*$/.test(a.className)}function c(a){return!a.getAttribute("style")||/^\s*$/.test(a.getAttribute("style"))}function d(b){var c=a.dom.getAttributes(b);return a.lang.object(c).isEmpty()}function e(b,c){var d,e,f,g;return 1!==b.nodeType||1!==c.nodeType?!1:b.nodeName!==c.nodeName?!1:(d=b.className.trim().replace(/\s+/g," ").split(" "),e=c.className.trim().replace(/\s+/g," ").split(" "),a.lang.array(d).without(e).length>0?!1:(f=a.dom.getAttributes(b),g=a.dom.getAttributes(c),f.length===g.length&&a.lang.object(a.lang.object(f).difference(g)).isEmpty()?!0:!1))}function f(b,c){var d=c&&c.nodeName||F,e=b.ownerDocument.createElement(d);if(c.classRegExp&&(e.className=e.className.replace(c.classRegExp,"")),c.className&&e.classList.add(c.className),c.styleProperty&&"undefined"!=typeof c.styleValue&&(e.style[a.browser.fixStyleKey(c.styleProperty)]=c.styleValue),c.attribute)if("object"==typeof c.attribute)for(var f in c.attribute)c.attribute.hasOwnProperty(f)&&e.setAttribute(f,c.attribute[f]);else"undefined"!=typeof c.attributeValue&&e.setAttribute(c.attribute,c.attributeValue);return e}function g(a,b){for(var c in a)if(a.hasOwnProperty(c)&&(void 0===typeof b[c]||b[c]!==a[c]))return!1;return!0}function h(b,c,d){var e,f=a.dom.getAttributes(b),h=g(c,f);a.lang.object(f).difference(c);if(h&&d!==!1)for(e in c)c.hasOwnProperty(e)&&b.removeAttribute(e);else for(e in c)c.hasOwnProperty(e)&&b.setAttribute(e,c[e])}function i(e,f){var g,i,j;f.className&&(f.toggle!==!1&&e.classList.contains(f.className)?e.classList.remove(f.className):(f.classRegExp&&(e.className=e.className.replace(f.classRegExp,"")),e.classList.add(f.className)),b(e)&&e.removeAttribute("class")),f.styleProperty&&(f.toggle!==!1&&e.style[a.browser.fixStyleKey(f.styleProperty)].trim().replace(/, /g,",")===f.styleValue?e.style[a.browser.fixStyleKey(f.styleProperty)]="":e.style[a.browser.fixStyleKey(f.styleProperty)]=f.styleValue),c(e)&&e.removeAttribute("style"),f.attribute&&("object"==typeof f.attribute?g=f.attribute:(g={},g[f.attribute]=f.attributeValue||""),h(e,g,f.toggle)),i=f.nodeName?H[f.nodeName.toLowerCase()]||f.nodeName.toLowerCase():null,j=i?a.dom.domNode(e).test({query:i}):!1,(!f.nodeName||f.nodeName===F||j)&&(f.toggle!==!1&&j||!f.nodeName&&e.nodeName===F)&&b(e)&&c(e)&&d(e)&&a.dom.unwrap(e)}function j(b,c){var d=[];return b.isCollapsed()||(d=d.concat(b.getOwnNodes([3],function(b){return!a.dom.domNode(b).is.emptyTextNode()},c))),d}function k(a,b,c,d){var e=a,f=d?b:l(b);do{if(1===e.nodeType&&m(e,f))return e;e=e.parentNode}while(e&&e!==c);return null}function l(a){return{nodeName:a.nodeName||null,className:a.classRegExp?null:a.className||null,classRegExp:a.classRegExp||null,styleProperty:a.styleProperty||null}}function m(b,c){var d;if(c.nodeName){var e=H[c.nodeName.toLowerCase()]||c.nodeName.toLowerCase();return a.dom.domNode(b).test({query:e})}return d=a.lang.object(c).clone(),d.query=G,a.dom.domNode(b).test(d)}function n(b,c){var d=document.documentElement||document.body,e=d.scrollTop,f=d.scrollLeft;rangy.getSelection(b.win);rangy.getSelection(b.win).removeAllRanges();try{rangy.getSelection(b.win).addRange(c)}catch(g){}b.doc.activeElement&&a.dom.contains(b.element,b.doc.activeElement)||(b.element.focus(),d.scrollTop=e,d.scrollLeft=f,rangy.getSelection(b.win).addRange(c))}function o(a,b){var c=rangy.createRange(b.doc),d=a[a.length-1];a[0]&&d&&(c.setStart(a[0],0),c.setEnd(d,d.length),n(b,c))}function p(a,b,c,d){var e=rangy.createRange(a.doc);b&&(e.setStart(b,c),e.setEnd(b,"undefined"!=typeof d?d:c),n(a,e))}function q(a,b,c){var d,e,f,g=j(a.selection),h=[],i=!1;if(a.selection.isInThisEditable()){if(0===g.length&&a.selection.isCollapsed()){if(f=a.selection.getSelection().anchorNode,!f)return{nodes:[],partial:!1};3===f.nodeType&&(g=[f])}g.length||(e=a.selection.getOwnRanges()[0],e&&(g=[e.endContainer]));for(var l=0,m=g.length;m>l;l++)d=k(g[l],b,a.element,c),d?h.push(d):i=!0}return{nodes:h,partial:i}}function r(a){var b,c,d,e;return a&&(b=a.anchorNode,c=a.anchorOffset,b&&3===b.nodeType&&c>0&&c0&&/\w/.test(c.data[g-1]);)g--;for(;h0&&o(b,a),u(q(a,c).nodes),b.length>0&&o(b,a)}function w(a,b,c,d){p(a,b,c),u(q(a,d).nodes),p(a,b,c)}function x(a,b){var c=f(a,b);a.parentNode.insertBefore(c,a),c.appendChild(a)}function y(b,c,d){var e,f=c.element,g=k(b,d,f);g&&(e=g.cloneNode(!1),a.dom.domNode(b).escapeParent(g,e),i(e,d))}function z(b,c,d){var e=c.element,f=k(b,d,e);f&&a.dom.domNode(b).escapeParent(f)}function A(a,b,c){var d=f(a.endContainer,c);a.surroundContents(d),b.selection.selectNode(d)}function B(b,c,d,e){var f,g,h,j,l=q(b,e,!0),m=b.selection.getSelection();if(c.length){if(l.partial||e.toggle===!1)for(j=c.length;j--;)k(c[j],e,b.element)&&y(c[j],b,e),k(c[j],e,b.element)||x(c[j],e);else for(j=c.length;j--;)y(c[j],b,e);v(b,c,e)}else if(e.toggle!==!1)if(r(m))f=s(m),g=f.textNode,y(f.textNode,b,e),w(b,f.textNode,f.wordOffset,e);else{g=b.doc.createTextNode(a.INVISIBLE_SPACE),h=d.nodes[0].cloneNode(!1),h.appendChild(g),b.selection.splitElementAtCaret(d.nodes[0],h),i(h,e),v(b,[g],e);var n=b.selection.getSelection();if(n.anchorNode&&n.focusNode)try{n.collapseToEnd()}catch(o){}}else for(j=d.nodes.length;j--;)i(d.nodes[j],e)}function C(b,c,d,e){var f,g,h,i=b.selection.getSelection();if(c.length){for(h=c.length;h--;)z(c[h],b,e);v(b,c,e)}else{for(f=i.anchorNode,g=i.anchorOffset,h=d.nodes.length;h--;)a.dom.unwrap(d.nodes[h]);w(b,f,g,e)}}function D(a,b,c){var d,e,f=a.selection.getSelection();if(b.length){for(e=b.length;e--;)x(b[e],c);v(a,b,c)}else if(r(f))d=s(f),x(d.textNode,c),w(a,d.textNode,d.wordOffset,c);else{var g=a.selection.getOwnRanges()[0];g&&A(g,a,c)}}function E(a){ -return a="string"==typeof a?{nodeName:a}:a,a.nodeName&&(a.nodeName=a.nodeName.toUpperCase()),a}var F="SPAN",G="b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",H={b:"b, strong",strong:"b, strong",em:"em, i",i:"em, i"};a.commands.formatInline={exec:function(a,b,c){c=E(c),a.element.normalize();var d=j(a.selection,!0),e=q(a,c);e.nodes.length>0?B(a,d,e,c):D(a,d,c),a.element.normalize()},remove:function(a,b,c){c=E(c),a.element.normalize();var d=j(a.selection,!0),e=q(a,c);e.nodes.length>0&&C(a,d,e,c),a.element.normalize()},state:function(a,b,c){c=E(c);var d=q(a,c,!0).nodes;return 0===d.length?!1:d}}}(wysihtml5),function(a){var b={nodeName:"BLOCKQUOTE",toggle:!0};a.commands.insertBlockQuote={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){a.commands.insertHTML={exec:function(a,b,c){a.selection.insertHTML(c)},state:function(){return!1}}}(wysihtml5),function(a){var b="IMG";a.commands.insertImage={exec:function(c,d,e){e="object"==typeof e?e:{src:e};var f,g,h=c.doc,i=this.state(c);if(i&&!e.src)return c.selection.setBefore(i),g=i.parentNode,g.removeChild(i),a.dom.removeEmptyTextNodes(g),"A"!==g.nodeName||g.firstChild||(c.selection.setAfter(g),g.parentNode.removeChild(g)),void a.quirks.redraw(c.element);if(i)for(var j in e)e.hasOwnProperty(j)&&i.setAttribute("className"===j?"class":j,e[j]);else{i=h.createElement(b);for(var k in e)i.setAttribute("className"===k?"class":k,e[k]);c.selection.insertNode(i),a.browser.hasProblemsSettingCaretAfterImg()?(f=h.createTextNode(a.INVISIBLE_SPACE),c.selection.insertNode(f),c.selection.setAfter(f)):c.selection.setAfter(i)}},state:function(c){var d,e,f,g=c.doc;return a.dom.hasElementWithTagName(g,b)&&(d=c.selection.getSelectedNode())?d.nodeName===b?d:d.nodeType!==a.ELEMENT_NODE?!1:(e=c.selection.getText(),(e=a.lang.string(e).trim())?!1:(f=c.selection.getNodes(a.ELEMENT_NODE,function(a){return"IMG"===a.nodeName}),1!==f.length?!1:f[0])):!1}}}(wysihtml5),function(a){var b="
    "+(a.browser.needsSpaceAfterLineBreak()?" ":"");a.commands.insertLineBreak={exec:function(a,c){a.selection.insertHTML(b)},state:function(){return!1}}}(wysihtml5),function(a){a.commands.insertOrderedList={exec:function(b,c){a.commands.insertList.exec(b,c,"OL")},state:function(b,c){return a.commands.insertList.state(b,c,"OL")}}}(wysihtml5),function(a){a.commands.insertUnorderedList={exec:function(b,c){a.commands.insertList.exec(b,c,"UL")},state:function(b,c){return a.commands.insertList.state(b,c,"UL")}}}(wysihtml5),wysihtml5.commands.insertList=function(a){var b=function(a,b){if(a&&a.nodeName){"string"==typeof b&&(b=[b]);for(var c=b.length;c--;)if(a.nodeName===b[c])return!0}return!1},c=function(c,d,e){var f={el:null,other:!1};if(c){var g=a.dom.getParentElement(c,{query:"li"},!1,e.element),h="UL"===d?"OL":"UL";b(c,d)?f.el=c:b(c,h)?f={el:c,other:!0}:g&&(b(g.parentNode,d)?f.el=g.parentNode:b(g.parentNode,h)&&(f={el:g.parentNode,other:!0}))}return f.el&&!e.element.contains(f.el)&&(f.el=null),f},d=function(b,c,d){var e,g,h="UL"===c?"OL":"UL";d.selection.executeAndRestoreRangy(function(){if(e=f(h,d),e.length)for(var i=e.length;i--;)a.dom.renameElement(e[i],c.toLowerCase());else{g=f(["OL","UL"],d);for(var j=g.length;j--;)a.dom.resolveList(g[j],d.config.useLineBreaks);0===g.length&&a.dom.resolveList(b,d.config.useLineBreaks)}})},e=function(b,c,d){var e="UL"===c?"OL":"UL";d.selection.executeAndRestoreRangy(function(){for(var g=[b].concat(f(e,d)),h=g.length;h--;)a.dom.renameElement(g[h],c.toLowerCase())})},f=function(a,c){for(var d=c.selection.getOwnRanges(),e=[],f=d.length;f--;)e=e.concat(d[f].getNodes([1],function(c){return b(c,a)}));return e},g=function(b,c){var d,e,f=rangy.saveSelection(c.win),g="_wysihtml5-temp-"+(new Date).getTime();c.commands.exec("formatBlock",{nodeName:"div",className:g});var h=c.element.querySelector("."+g);h.innerHTML=h.innerHTML.replace(a.INVISIBLE_SPACE_REG_EXP,""),h&&(d=/^(\s|(
    ))+$/i.test(h.innerHTML),e=a.dom.convertToList(h,b.toLowerCase(),c.parent.config.classNames.uneditableContainer),f&&rangy.restoreSelection(f),d&&c.selection.selectNode(e.querySelector("li"),!0))};return{exec:function(b,f,h){var i,j,k=b.doc,l="OL"===h?"insertOrderedList":"insertUnorderedList",m=b.selection.getSelection(),n=1===m.anchorNode.nodeType&&m.anchorNode.firstChild?m.anchorNode.childNodes[m.anchorOffset]:m.anchorNode,o=1===m.focusNode.nodeType&&m.focusNode.firstChild?m.focusNode.childNodes[m.focusOffset]||m.focusNode.lastChild:m.focusNode;m.isBackwards()&&(n=[o,o=n][0]),a.dom.domNode(o).is.emptyTextNode(!0)&&o&&(o=a.dom.domNode(o).prev({nodeTypes:[1,3],ignoreBlankTexts:!0})),a.dom.domNode(n).is.emptyTextNode(!0)&&n&&(n=a.dom.domNode(n).next({nodeTypes:[1,3],ignoreBlankTexts:!0})),i=n&&o?n===o?n:a.dom.domNode(n).commonAncestor(o,b.element):b.selection.getSelectedNode(),j=c(i,h,b),j.el?j.other?e(j.el,h,b):d(j.el,h,b):b.commands.support(l)?k.execCommand(l,!1,null):g(h,b)},state:function(a,b,d){var e=a.selection.getSelectedNode(),f=c(e,d,a);return f.el&&!f.other?f.el:!1}}}(wysihtml5),function(a){var b={nodeName:"I",toggle:!0};a.commands.italic={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){var b={className:"wysiwyg-text-align-center",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};a.commands.justifyCenter={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={className:"wysiwyg-text-align-left",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};a.commands.justifyLeft={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={className:"wysiwyg-text-align-right",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};a.commands.justifyRight={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={className:"wysiwyg-text-align-justify",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};a.commands.justifyFull={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={styleProperty:"textAlign",styleValue:"right",toggle:!0};a.commands.alignRightStyle={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={styleProperty:"textAlign",styleValue:"left",toggle:!0};a.commands.alignLeftStyle={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={styleProperty:"textAlign",styleValue:"center",toggle:!0};a.commands.alignCenterStyle={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={styleProperty:"textAlign",styleValue:"justify",toggle:!0};a.commands.alignJustifyStyle={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){a.commands.redo={exec:function(a){return a.undoManager.redo()},state:function(a){return!1}}}(wysihtml5),function(a){var b={nodeName:"U",toggle:!0};a.commands.underline={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){a.commands.undo={exec:function(a){return a.undoManager.undo()},state:function(a){return!1}}}(wysihtml5),function(a){a.commands.createTable={exec:function(a,b,c){var d,e,f;if(c&&c.cols&&c.rows&&parseInt(c.cols,10)>0&&parseInt(c.rows,10)>0){for(f=c.tableStyle?'':"
    ",f+="",e=0;e",d=0;d
    ";f+=""}f+="
    ",a.commands.exec("insertHTML",f)}},state:function(a,b){return!1}}}(wysihtml5),function(a){a.commands.mergeTableCells={exec:function(b,c){b.tableSelection&&b.tableSelection.start&&b.tableSelection.end&&(this.state(b,c)?a.dom.table.unmergeCell(b.tableSelection.start):a.dom.table.mergeCellsBetween(b.tableSelection.start,b.tableSelection.end))},state:function(b,c){if(b.tableSelection){var d=b.tableSelection.start,e=b.tableSelection.end;if(d&&e&&d==e&&(a.dom.getAttribute(d,"colspan")&&parseInt(a.dom.getAttribute(d,"colspan"),10)>1||a.dom.getAttribute(d,"rowspan")&&parseInt(a.dom.getAttribute(d,"rowspan"),10)>1))return[d]}return!1}}}(wysihtml5),function(a){a.commands.addTableCells={exec:function(b,c,d){if(b.tableSelection&&b.tableSelection.start&&b.tableSelection.end){var e=a.dom.table.orderSelectionEnds(b.tableSelection.start,b.tableSelection.end);"before"==d||"above"==d?a.dom.table.addCells(e.start,d):("after"==d||"below"==d)&&a.dom.table.addCells(e.end,d),setTimeout(function(){b.tableSelection.select(e.start,e.end)},0)}},state:function(a,b){return!1}}}(wysihtml5),function(a){a.commands.deleteTableCells={exec:function(b,c,d){if(b.tableSelection&&b.tableSelection.start&&b.tableSelection.end){var e,f=a.dom.table.orderSelectionEnds(b.tableSelection.start,b.tableSelection.end),g=a.dom.table.indexOf(f.start),h=b.tableSelection.table;a.dom.table.removeCells(f.start,d),setTimeout(function(){e=a.dom.table.findCell(h,g),e||("row"==d&&(e=a.dom.table.findCell(h,{row:g.row-1,col:g.col})),"column"==d&&(e=a.dom.table.findCell(h,{row:g.row,col:g.col-1}))),e&&b.tableSelection.select(e,e)},0)}},state:function(a,b){return!1}}}(wysihtml5),function(a){a.commands.indentList={exec:function(a,b,c){var d=a.selection.getSelectionParentsByTag("LI");return d?this.tryToPushLiLevel(d,a.selection):!1},state:function(a,b){return!1},tryToPushLiLevel:function(b,c){var d,e,f,g,h,i=!1;return c.executeAndRestoreRangy(function(){for(var c=b.length;c--;)g=b[c],d="OL"===g.parentNode.nodeName?"OL":"UL",e=g.ownerDocument.createElement(d),f=a.dom.domNode(g).prev({nodeTypes:[a.ELEMENT_NODE]}),h=f?f.querySelector("ul, ol"):null,f&&(h?h.appendChild(g):(e.appendChild(g),f.appendChild(e)),i=!0)}),i}}}(wysihtml5),function(a){a.commands.outdentList={exec:function(a,b,c){var d=a.selection.getSelectionParentsByTag("LI");return d?this.tryToPullLiLevel(d,a):!1},state:function(a,b){return!1},tryToPullLiLevel:function(b,c){var d,e,f,g,h,i=!1,j=this;return c.selection.executeAndRestoreRangy(function(){for(var k=b.length;k--;)if(g=b[k],g.parentNode&&(d=g.parentNode,"OL"===d.tagName||"UL"===d.tagName)){if(i=!0,e=a.dom.getParentElement(d.parentNode,{query:"ol, ul"},!1,c.element),f=a.dom.getParentElement(d.parentNode,{query:"li"},!1,c.element),e&&f)g.nextSibling&&(h=j.getAfterList(d,g),g.appendChild(h)),e.insertBefore(g,f.nextSibling);else{g.nextSibling&&(h=j.getAfterList(d,g),g.appendChild(h));for(var l=g.childNodes.length;l--;)d.parentNode.insertBefore(g.childNodes[l],d.nextSibling);d.parentNode.insertBefore(document.createElement("br"),d.nextSibling),g.parentNode.removeChild(g)}0===d.childNodes.length&&d.parentNode.removeChild(d)}}),i},getAfterList:function(a,b){for(var c=a.nodeName,d=document.createElement(c);b.nextSibling;)d.appendChild(b.nextSibling);return d}}}(wysihtml5),function(a){var b={nodeName:"SUB",toggle:!0};a.commands.subscript={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){var b={nodeName:"SUP",toggle:!0};a.commands.superscript={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){var b=90,c=89,d=8,e=46,f=25,g="data-wysihtml5-selection-node",h="data-wysihtml5-selection-offset",i=(''+a.INVISIBLE_SPACE+"",''+a.INVISIBLE_SPACE+"",a.dom);a.UndoManager=a.lang.Dispatcher.extend({constructor:function(a){this.editor=a,this.composer=a.composer,this.element=this.composer.element,this.position=0,this.historyStr=[],this.historyDom=[],this.transact(),this._observe()},_observe:function(){var a,f=this;this.composer.sandbox.getDocument();i.observe(this.element,"keydown",function(a){if(!a.altKey&&(a.ctrlKey||a.metaKey)){var d=a.keyCode,e=d===b&&!a.shiftKey,g=d===b&&a.shiftKey||d===c;e?(f.undo(),a.preventDefault()):g&&(f.redo(),a.preventDefault())}}),i.observe(this.element,"keydown",function(b){var c=b.keyCode;c!==a&&(a=c,(c===d||c===e)&&f.transact())}),this.editor.on("newword:composer",function(){f.transact()}).on("beforecommand:composer",function(){f.transact()})},transact:function(){var b,c,d,e,i,j=this.historyStr[this.position-1],k=this.composer.getValue(!1,!1),l=this.element.offsetWidth>0&&this.element.offsetHeight>0;if(k!==j){var m=this.historyStr.length=this.historyDom.length=this.position;m>f&&(this.historyStr.shift(),this.historyDom.shift(),this.position--),this.position++,l&&(b=this.composer.selection.getRange(),c=b&&b.startContainer?b.startContainer:this.element,d=b&&b.startOffset?b.startOffset:0,c.nodeType===a.ELEMENT_NODE?e=c:(e=c.parentNode,i=this.getChildNodeIndex(e,c)),e.setAttribute(h,d),"undefined"!=typeof i&&e.setAttribute(g,i));var n=this.element.cloneNode(!!k);this.historyDom.push(n),this.historyStr.push(k),e&&(e.removeAttribute(h),e.removeAttribute(g))}},undo:function(){this.transact(),this.undoPossible()&&(this.set(this.historyDom[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.redoPossible()&&(this.set(this.historyDom[++this.position-1]),this.editor.fire("redo:composer"))},undoPossible:function(){return this.position>1},redoPossible:function(){return this.positionb;b++)this.element.appendChild(c[b].cloneNode(!0));var e,f,i;a.hasAttribute(h)?(e=a.getAttribute(h),i=a.getAttribute(g),f=this.element):(f=this.element.querySelector("["+h+"]")||this.element,e=f.getAttribute(h),i=f.getAttribute(g),f.removeAttribute(h),f.removeAttribute(g)),null!==i&&(f=this.getChildNodeByIndex(f,+i)),this.composer.selection.set(f,e)},getChildNodeIndex:function(a,b){for(var c=0,d=a.childNodes,e=d.length;e>c;c++)if(d[c]===b)return c},getChildNodeByIndex:function(a,b){return a.childNodes[b]}})}(wysihtml5),wysihtml5.views.View=Base.extend({constructor:function(a,b,c){this.parent=a,this.element=b,this.config=c,this.config.noTextarea||this._observeViewChange()},_observeViewChange:function(){var a=this;this.parent.on("beforeload",function(){a.parent.on("change_view",function(b){b===a.name?(a.parent.currentView=a,a.show(),setTimeout(function(){a.focus()},0)):a.hide()})})},focus:function(){if(!this.element||!this.element.ownerDocument||this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element&&this.element.focus()}catch(a){}},hide:function(){this.element.style.display="none"},show:function(){this.element.style.display=""},disable:function(){this.element.setAttribute("disabled","disabled")},enable:function(){this.element.removeAttribute("disabled")}}),function(a){var b=a.dom,c=a.browser;a.views.Composer=a.views.View.extend({name:"composer",constructor:function(a,b,c){this.base(a,b,c),this.config.noTextarea?this.editableArea=b:this.textarea=this.parent.textarea,this.config.contentEditableMode?this._initContentEditableArea():this._initSandbox()},clear:function(){this.element.innerHTML=c.displaysCaretInEmptyContentEditableCorrectly()?"":"
    "},getValue:function(b,c){var d=this.isEmpty()?"":a.quirks.getCorrectInnerHTML(this.element);return b!==!1&&(d=this.parent.parse(d,c===!1?!1:!0)),d},setValue:function(a,b){b!==!1&&(a=this.parent.parse(a));try{this.element.innerHTML=a}catch(c){this.element.innerText=a}},cleanUp:function(a){var b;this.selection&&this.selection.isInThisEditable()&&(b=rangy.saveSelection(this.win)),this.parent.parse(this.element,void 0,a),b&&rangy.restoreSelection(b)},show:function(){this.editableArea.style.display=this._displayStyle||"",this.config.noTextarea||this.textarea.element.disabled||(this.disable(),this.enable())},hide:function(){this._displayStyle=b.getStyle("display").from(this.editableArea),"none"===this._displayStyle&&(this._displayStyle=null),this.editableArea.style.display="none"},disable:function(){this.parent.fire("disable:composer"),this.element.removeAttribute("contentEditable")},enable:function(){this.parent.fire("enable:composer"),this.element.setAttribute("contentEditable","true")},focus:function(b){a.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear(),this.base();var c=this.element.lastChild;b&&c&&this.selection&&("BR"===c.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getScrollPos:function(){if(this.doc&&this.win){var a={};return"undefined"!=typeof this.win.pageYOffset?a.y=this.win.pageYOffset:a.y=(this.doc.documentElement||this.doc.body.parentNode||this.doc.body).scrollTop,"undefined"!=typeof this.win.pageXOffset?a.x=this.win.pageXOffset:a.x=(this.doc.documentElement||this.doc.body.parentNode||this.doc.body).scrollLeft,a}},setScrollPos:function(a){a&&"undefined"!=typeof a.x&&"undefined"!=typeof a.y&&this.win.scrollTo(a.x,a.y)},getTextContent:function(){return b.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==(this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder"))&&this.placeholderSet},isEmpty:function(){var a=this.element.innerHTML.toLowerCase();return/^(\s|
    |<\/br>|

    |<\/p>)*$/i.test(a)||""===a||"
    "===a||"

    "===a||"


    "===a||this.hasPlaceholderSet()},_initContentEditableArea:function(){var a=this;this.config.noTextarea?this.sandbox=new b.ContentEditableArea(function(){a._create()},{className:this.config.classNames.sandbox},this.editableArea):(this.sandbox=new b.ContentEditableArea(function(){a._create()},{className:this.config.classNames.sandbox}),this.editableArea=this.sandbox.getContentEditable(),b.insert(this.editableArea).after(this.textarea.element),this._createWysiwygFormField())},_initSandbox:function(){var a=this;this.sandbox=new b.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets,className:this.config.classNames.sandbox}),this.editableArea=this.sandbox.getIframe();var c=this.textarea.element;b.insert(this.editableArea).after(c),this._createWysiwygFormField()},_createWysiwygFormField:function(){if(this.textarea.element.form){var a=document.createElement("input");a.type="hidden",a.name="_wysihtml5_mode",a.value=1,b.insert(a).after(this.textarea.element)}},_create:function(){var d=this;this.doc=this.sandbox.getDocument(),this.win=this.sandbox.getWindow(),this.element=this.config.contentEditableMode?this.sandbox.getContentEditable():this.doc.body,this.config.noTextarea?this.cleanUp():(this.textarea=this.parent.textarea,this.element.innerHTML=this.textarea.getValue(!0,!1)),this.selection=new a.Selection(this.parent,this.element,this.config.classNames.uneditableContainer),this.commands=new a.Commands(this.parent),this.config.noTextarea||b.copyAttributes(["className","spellcheck","title","lang","dir","accessKey"]).from(this.textarea.element).to(this.element),this._initAutoLinking(),b.addClass(this.element,this.config.classNames.composer),this.config.style&&!this.config.contentEditableMode&&this.style(),this.observe();var e=this.config.name;e&&(b.addClass(this.element,e),this.config.contentEditableMode||b.addClass(this.editableArea,e)),this.enable(),!this.config.noTextarea&&this.textarea.element.disabled&&this.disable();var f="string"==typeof this.config.placeholder?this.config.placeholder:this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder");f&&b.simulatePlaceholder(this.parent,this,f,this.config.classNames.placeholder),this.commands.exec("styleWithCSS",!1),this._initObjectResizing(),this._initUndoManager(),this._initLineBreaking(),this.config.noTextarea||!this.textarea.element.hasAttribute("autofocus")&&document.querySelector(":focus")!=this.textarea.element||c.isIos()||setTimeout(function(){d.focus(!0)},100),c.clearsContentEditableCorrectly()||a.quirks.ensureProperClearing(this),this.initSync&&this.config.sync&&this.initSync(),this.config.noTextarea||this.textarea.hide(),this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var d=this,e=c.canDisableAutoLinking(),f=c.doesAutoLinkingInContentEditable();if(e&&this.commands.exec("AutoUrlDetect",!1,!1),this.config.autoLink){(!f||f&&e)&&(this.parent.on("newword:composer",function(){if(b.getTextContent(d.element).match(b.autoLink.URL_REG_EXP)){for(var c=d.selection.getSelectedNode(),e=d.element.querySelectorAll("."+d.config.classNames.uneditableContainer),f=!1,g=e.length;g--;)a.dom.contains(e[g],c)&&(f=!0);f||b.autoLink(c,[d.config.classNames.uneditableContainer])}}),b.observe(this.element,"blur",function(){b.autoLink(d.element,[d.config.classNames.uneditableContainer])}));var g=this.sandbox.getDocument().getElementsByTagName("a"),h=b.autoLink.URL_REG_EXP,i=function(c){var d=a.lang.string(b.getTextContent(c)).trim();return"www."===d.substr(0,4)&&(d="http://"+d),d};b.observe(this.element,"keydown",function(a){if(g.length){var c,e=d.selection.getSelectedNode(a.target.ownerDocument),f=b.getParentElement(e,{query:"a"},4);f&&(c=i(f),setTimeout(function(){var a=i(f);a!==c&&a.match(h)&&f.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){if(this.commands.exec("enableObjectResizing",!0),c.supportsEvent("resizeend")){var d=["width","height"],e=d.length,f=this.element;b.observe(f,"resizeend",function(b){var c,g=b.target||b.srcElement,h=g.style,i=0;if("IMG"===g.nodeName){for(;e>i;i++)c=d[i],h[c]&&(g.setAttribute(c,parseInt(h[c],10)),h[c]="");a.quirks.redraw(f)}})}},_initUndoManager:function(){this.undoManager=new a.UndoManager(this.parent)},_initLineBreaking:function(){function d(a){var c=b.getParentElement(a,{query:"p, div"},2);c&&b.contains(e.element,c)&&e.selection.executeAndRestoreRangy(function(){e.config.useLineBreaks?((!c.firstChild||c.firstChild===c.lastChild&&1===c.firstChild.nodeType&&c.firstChild.classList.contains("rangySelectionBoundary"))&&c.appendChild(e.doc.createElement("br")),b.replaceWithChildNodes(c)):"P"!==c.nodeName&&b.renameElement(c,"p")})}var e=this,f="li, p, h1, h2, h3, h4, h5, h6",g="ul, ol, menu";this.config.useLineBreaks||b.observe(this.element,["focus"],function(){e.isEmpty()&&setTimeout(function(){var a=e.doc.createElement("P");e.element.innerHTML="",e.element.appendChild(a),c.displaysCaretInEmptyContentEditableCorrectly()?e.selection.selectNode(a,!0):(a.innerHTML="
    ",e.selection.setBefore(a.firstChild))},0)}),b.observe(this.element,"keydown",function(c){var h=c.keyCode;if(!(c.shiftKey||c.ctrlKey||c.defaultPrevented||h!==a.ENTER_KEY&&h!==a.BACKSPACE_KEY)){var i=b.getParentElement(e.selection.getSelectedNode(),{query:f},4);return i?void setTimeout(function(){var c,f=e.selection.getSelectedNode();if("LI"===i.nodeName){if(!f)return;c=b.getParentElement(f,{query:g},2),c||d(f)}h===a.ENTER_KEY&&i.nodeName.match(/^H[1-6]$/)&&d(f)},0):void(e.config.useLineBreaks&&h===a.ENTER_KEY&&!a.browser.insertsLineBreaksOnReturn()&&(c.preventDefault(),e.commands.exec("insertLineBreak")))}})}})}(wysihtml5),function(a){var b=a.dom,c=document,d=window,e=c.createElement("div"),f=["background-color","color","cursor","font-family","font-size","font-style","font-variant","font-weight","line-height","letter-spacing","text-align","text-decoration","text-indent","text-rendering","word-break","word-wrap","word-spacing"],g=["background-color","border-collapse","border-bottom-color","border-bottom-style","border-bottom-width","border-left-color","border-left-style","border-left-width","border-right-color","border-right-style","border-right-width","border-top-color","border-top-style","border-top-width","clear","display","float","margin-bottom","margin-left","margin-right","margin-top","outline-color","outline-offset","outline-width","outline-style","padding-left","padding-right","padding-top","padding-bottom","position","top","left","right","bottom","z-index","vertical-align","text-align","-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing","-webkit-box-shadow","-moz-box-shadow","-ms-box-shadow","box-shadow","-webkit-border-top-right-radius","-moz-border-radius-topright","border-top-right-radius","-webkit-border-bottom-right-radius","-moz-border-radius-bottomright","border-bottom-right-radius","-webkit-border-bottom-left-radius","-moz-border-radius-bottomleft","border-bottom-left-radius","-webkit-border-top-left-radius","-moz-border-radius-topleft","border-top-left-radius","width","height"],h=["html { height: 100%; }","body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }","body > p:first-child { margin-top: 0; }","._wysihtml5-temp { display: none; }",a.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],i=function(a){if(a.setActive)try{a.setActive()}catch(e){}else{var f=a.style,g=c.documentElement.scrollTop||c.body.scrollTop,h=c.documentElement.scrollLeft||c.body.scrollLeft,i={position:f.position,top:f.top,left:f.left,WebkitUserSelect:f.WebkitUserSelect};b.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(a),a.focus(),b.setStyles(i).on(a),d.scrollTo&&d.scrollTo(h,g)}};a.views.Composer.prototype.style=function(){var d,j=this,k=c.querySelector(":focus"),l=this.textarea.element,m=l.hasAttribute("placeholder"),n=m&&l.getAttribute("placeholder"),o=l.style.display,p=l.disabled;this.focusStylesHost=e.cloneNode(!1),this.blurStylesHost=e.cloneNode(!1),this.disabledStylesHost=e.cloneNode(!1),m&&l.removeAttribute("placeholder"),l===k&&l.blur(),l.disabled=!1,l.style.display=d="none",(l.getAttribute("rows")&&"auto"===b.getStyle("height").from(l)||l.getAttribute("cols")&&"auto"===b.getStyle("width").from(l))&&(l.style.display=d=o),b.copyStyles(g).from(l).to(this.editableArea).andTo(this.blurStylesHost),b.copyStyles(f).from(l).to(this.element).andTo(this.blurStylesHost),b.insertCSS(h).into(this.element.ownerDocument),l.disabled=!0,b.copyStyles(g).from(l).to(this.disabledStylesHost),b.copyStyles(f).from(l).to(this.disabledStylesHost),l.disabled=p,l.style.display=o,i(l),l.style.display=d,b.copyStyles(g).from(l).to(this.focusStylesHost),b.copyStyles(f).from(l).to(this.focusStylesHost),l.style.display=o,b.copyStyles(["display"]).from(l).to(this.editableArea);var q=a.lang.array(g).without(["display"]);return k?k.focus():l.blur(),m&&l.setAttribute("placeholder",n),this.parent.on("focus:composer",function(){b.copyStyles(q).from(j.focusStylesHost).to(j.editableArea),b.copyStyles(f).from(j.focusStylesHost).to(j.element)}),this.parent.on("blur:composer",function(){b.copyStyles(q).from(j.blurStylesHost).to(j.editableArea),b.copyStyles(f).from(j.blurStylesHost).to(j.element)}),this.parent.observe("disable:composer",function(){b.copyStyles(q).from(j.disabledStylesHost).to(j.editableArea),b.copyStyles(f).from(j.disabledStylesHost).to(j.element)}),this.parent.observe("enable:composer",function(){b.copyStyles(q).from(j.blurStylesHost).to(j.editableArea),b.copyStyles(f).from(j.blurStylesHost).to(j.element)}),this}}(wysihtml5),function(a){var b=a.dom,c=b.domNode,d=a.browser,e={66:"bold",73:"italic",85:"underline"},f={addListeners:function(a,b,c){for(var d=0,e=b.length;e>d;d++)a.addEventListener(b[d],c,!1)},removeListeners:function(a,b,c){for(var d=0,e=b.length;e>d;d++)a.removeEventListener(b[d],c,!1)},fixLastBrDeletionInTable:function(b,c){if(b.selection.caretIsLastInSelection()){var d=b.selection.getSelection(),e=d.anchorNode;if(e&&1===e.nodeType&&(a.dom.getParentElement(e,{query:"td, th"},!1,b.element)||c)){var f=e.childNodes[d.anchorOffset];if(f&&1===f.nodeType&"BR"===f.nodeName)return f.parentNode.removeChild(f),!0}}return!1},handleUneditableDeletion:function(a){var b=a.selection.getBeforeSelection(!0);if(b&&("element"===b.type||"leafnode"===b.type)&&1===b.node.nodeType&&b.node.classList.contains(a.config.classNames.uneditableContainer)){if(f.fixLastBrDeletionInTable(a,!0))return!0;try{var c=new CustomEvent("wysihtml5:uneditable:delete",{bubbles:!0,cancelable:!1});b.node.dispatchEvent(c)}catch(d){}return b.node.parentNode.removeChild(b.node),!0}return!1},fixDeleteInTheBeginningOfBlock:function(b){var d=b.selection,e=d.getPreviousNode();if(d.caretIsFirstInSelection(a.browser.usesControlRanges())&&e&&1===e.nodeType&&a.dom.domNode(e).is.block()&&!c(e).test({query:"ol, ul, table, tr, dl"})){if(/^\s*$/.test(e.textContent||e.innerText))return e.parentNode.removeChild(e),!0;if(e.lastChild){var f=e.lastChild,g=d.getSelectedNode(),h=c(e).commonAncestor(g,b.element),i=a.dom.getParentElement(g,{query:"h1, h2, h3, h4, h5, h6, p, pre, div, blockquote"},!1,h||b.element);if(i)return c(i).transferContentTo(e,!0),d.setAfter(f),!0;if(a.browser.usesControlRanges())return g=d.getCaretNode(),c(g).transferContentTo(e,!0),d.setAfter(f),!0}}return!1},fixDeleteInTheBeginningOfLi:function(b){if(a.browser.hasLiDeletingProblem()){var d,e,f=b.selection.getSelection(),g=f.anchorNode,h=b.selection.caretIsFirstInSelection();if(3===g.nodeType&&0===f.anchorOffset&&g===g.parentNode.firstChild&&(g=g.parentNode,h=!0),h&&g&&1===g.nodeType&&"LI"===g.nodeName&&(d=c(g).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),d||!g.parentNode||"UL"!==g.parentNode.nodeName&&"OL"!==g.parentNode.nodeName||(d=c(g.parentNode).prev({nodeTypes:[1,3],ignoreBlankTexts:!0})),d))return e=g.firstChild,c(g).transferContentTo(d,!0),e?b.selection.setBefore(e):d&&(1===d.nodeType?d.lastChild?b.selection.setAfter(d.lastChild):b.selection.selectNode(d):b.selection.setAfter(d)),!0}return!1},fixDeleteInTheBeginningOfControlSelection:function(a){var b,d=a.selection,e=d.getPreviousNode(),f=d.getSelectedNode();return d.caretIsFirstInSelection()?(3===f.nodeType&&(f=f.parentNode),b=f.firstChild,c(f).transferContentTo(e,!0),b&&a.selection.setBefore(b),!0):!1},initTableHandling:function(){var b=function(){window.removeEventListener("load",b),this.doc.execCommand("enableObjectResizing",!1,"false"),this.doc.execCommand("enableInlineTableEditing",!1,"false")}.bind(this),c=function(){b.call(this),f.removeListeners(this.sandbox.getIframe(),["focus","mouseup","mouseover"],c)}.bind(this);this.doc.execCommand&&a.browser.supportsCommand(this.doc,"enableObjectResizing")&&a.browser.supportsCommand(this.doc,"enableInlineTableEditing")&&(this.sandbox.getIframe?f.addListeners(this.sandbox.getIframe(),["focus","mouseup","mouseover"],c):window.addEventListener("load",b)),this.tableSelection=a.quirks.tableCellsSelection(this.element,this.parent)},doLineBreaksModeEnterWithCaret:function(d){var e,f,g="p, pre, div, blockquote",h=!1;if(e=d.selection.getNodesNearCaret(),e&&((e.caretNode||e.nextNode)&&(f=b.getParentElement(e.caretNode||e.nextNode,{query:g},2),f===d.element&&(f=void 0)),f&&e.caretNode))if(c(e.caretNode).is.lineBreak()){if(d.config.doubleLineBreakEscapesBlock){h=!0,e.caretNode.parentNode.removeChild(e.caretNode),c(e.nextNode).is.lineBreak()&&e.nextNode.parentNode.removeChild(e.nextNode);var i=d.doc.createElement("br");c(e.nextNode).is.lineBreak()&&e.nextNode===f.lastChild?f.parentNode.insertBefore(i,f.nextSibling):d.selection.splitElementAtCaret(f,i),e.nextNode&&3===e.nextNode.nodeType&&(e.nextNode.data=e.nextNode.data.replace(/^ *[\r\n]+/,"")), -d.selection.setBefore(i)}}else if(3===e.caretNode.nodeType&&a.browser.hasCaretBlockElementIssue()&&e.textOffset===e.caretNode.data.length&&!e.nextNode){h=!0;var j=d.doc.createElement("br"),k=d.doc.createElement("br"),l=d.doc.createDocumentFragment();l.appendChild(j),l.appendChild(k),d.selection.insertNode(l),d.selection.setBefore(k)}return h}},g=function(b,c){var d=c.selection;c.element;if(d.isCollapsed()){if(f.handleUneditableDeletion(c))return void b.preventDefault();if(f.fixDeleteInTheBeginningOfLi(c))return void b.preventDefault();if(f.fixDeleteInTheBeginningOfBlock(c))return void b.preventDefault();if(f.fixLastBrDeletionInTable(c))return void b.preventDefault();if(a.browser.usesControlRanges()&&f.fixDeleteInTheBeginningOfControlSelection(c))return void b.preventDefault()}else d.containsUneditable()&&(b.preventDefault(),d.deleteContents())},h=function(a,b){if(b.config.useLineBreaks&&!a.shiftKey&&!a.ctrlKey){b.selection.isCollapsed()&&f.doLineBreaksModeEnterWithCaret(b)&&a.preventDefault()}},i=function(a,b,c){if(a.selection.isCollapsed()){if(a.selection.caretIsInTheBeginnig("li"))if(c){if(a.commands.exec("outdentList"))return}else if(a.commands.exec("indentList"))return}else a.selection.deleteContents();a.commands.exec("insertHTML"," ")},j=function(a){this.domNodeRemovedInterval&&clearInterval(domNodeRemovedInterval),this.parent.fire("destroy:composer")},k=function(a){this.parent.fire("beforeinteraction",a).fire("beforeinteraction:composer",a),setTimeout(function(){this.parent.fire("interaction",a).fire("interaction:composer",a)}.bind(this),0)},l=function(a){this.parent.fire("focus",a).fire("focus:composer",a),setTimeout(function(){this.focusState=this.getValue(!1,!1)}.bind(this),0)},m=function(a){if(this.focusState!==this.getValue(!1,!1)){var b=a;"function"==typeof Object.create&&(b=Object.create(a,{type:{value:"change"}})),this.parent.fire("change",b).fire("change:composer",b)}this.parent.fire("blur",a).fire("blur:composer",a)},n=function(a){this.parent.fire(a.type,a).fire(a.type+":composer",a),"paste"===a.type&&setTimeout(function(){this.parent.fire("newword:composer")}.bind(this),0)},o=function(b){this.config.copyedFromMarking&&(a.browser.supportsModernPaste()&&(b.clipboardData.setData("text/html",this.config.copyedFromMarking+this.selection.getHtml()),b.clipboardData.setData("text/plain",this.selection.getPlainText()),b.preventDefault()),this.parent.fire(b.type,b).fire(b.type+":composer",b))},p=function(b){var c=b.keyCode;(c===a.SPACE_KEY||c===a.ENTER_KEY)&&this.parent.fire("newword:composer")},q=function(b){if(!d.canSelectImagesInContentEditable()){var c=b.target,e=this.element.querySelectorAll("img"),f=this.element.querySelectorAll("."+this.config.classNames.uneditableContainer+" img"),g=a.lang.array(e).without(f);"IMG"===c.nodeName&&a.lang.array(g).contains(c)&&this.selection.selectNode(c)}a.browser.usesControlRanges()&&(this.selection.lastMouseDownPos={x:b.clientX,y:b.clientY},setTimeout(function(){delete this.selection.lastMouseDownPos}.bind(this),0))},r=function(a){var b=(a.target,this.selection.lastMouseDownPos);if(b){var c=document.body.createTextRange();setTimeout(function(){try{c.moveToPoint(b.x,b.y),c.select()}catch(a){}}.bind(this),0)}},s=function(b){if(this.config.classNames.uneditableContainer){var c=a.dom.getParentElement(b.target,{query:"."+this.config.classNames.uneditableContainer},!1,this.element);c&&this.selection.setAfter(c)}},t=function(a){d.canSelectImagesInContentEditable()||setTimeout(function(){this.selection.getSelection().removeAllRanges()}.bind(this),0)},u=function(b){var c,d,f=b.keyCode,j=e[f];return!b.ctrlKey&&!b.metaKey||b.altKey||65!==f?((b.ctrlKey||b.metaKey)&&!b.altKey&&j&&(this.commands.exec(j),b.preventDefault()),f===a.BACKSPACE_KEY&&g(b,this),(f===a.BACKSPACE_KEY||f===a.DELETE_KEY)&&(c=this.selection.getSelectedNode(!0),c&&"IMG"===c.nodeName&&(b.preventDefault(),d=c.parentNode,d.removeChild(c),"A"!==d.nodeName||d.firstChild||d.parentNode.removeChild(d),setTimeout(function(){a.quirks.redraw(this.element)}.bind(this),0))),this.config.handleTabKey&&f===a.TAB_KEY&&(b.preventDefault(),i(this,this.element,b.shiftKey)),void(f===a.ENTER_KEY&&h(b,this))):(this.selection.selectAll(),void b.preventDefault())};a.views.Composer.prototype.observeActions=f,a.views.Composer.prototype.observe=function(){var c=this.sandbox.getIframe?this.sandbox.getIframe():this.sandbox.getContentEditable(),e=(this.element,d.supportsEventsInIframeCorrectly()||this.sandbox.getContentEditable?this.element:this.sandbox.getWindow());this.focusState=this.getValue(!1,!1),c.addEventListener(["DOMNodeRemoved"],j.bind(this),!1),d.supportsMutationEvents()||(this.domNodeRemovedInterval=setInterval(function(){b.contains(document.documentElement,c)||j.call(this)},250)),this.config.handleTables&&f.initTableHandling.call(this),f.addListeners(e,["drop","paste","mouseup","focus","keyup"],k.bind(this)),e.addEventListener("focus",l.bind(this),!1),e.addEventListener("blur",m.bind(this),!1),f.addListeners(this.element,["drop","paste","beforepaste"],n.bind(this),!1),this.element.addEventListener("copy",o.bind(this),!1),this.element.addEventListener("mousedown",q.bind(this),!1),this.element.addEventListener("click",s.bind(this),!1),this.element.addEventListener("drop",t.bind(this),!1),this.element.addEventListener("keyup",p.bind(this),!1),this.element.addEventListener("keydown",u.bind(this),!1),a.browser.usesControlRanges()&&this.element.addEventListener("mscontrolselect",r.bind(this),!1),this.element.addEventListener("dragenter",function(){this.parent.fire("unset_placeholder")}.bind(this),!1)}}(wysihtml5),function(a){var b=400;a.views.Synchronizer=Base.extend({constructor:function(a,b,c){this.editor=a,this.textarea=b,this.composer=c,this._observe()},fromComposerToTextarea:function(b){this.textarea.setValue(a.lang.string(this.composer.getValue(!1,!1)).trim(),b)},fromTextareaToComposer:function(a){var b=this.textarea.getValue(!1,!1);b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(a){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(a):this.fromComposerToTextarea(a)},_observe:function(){var c,d=this,e=this.textarea.element.form,f=function(){c=setInterval(function(){d.fromComposerToTextarea()},b)},g=function(){clearInterval(c),c=null};f(),e&&(a.dom.observe(e,"submit",function(){d.sync(!0)}),a.dom.observe(e,"reset",function(){setTimeout(function(){d.fromTextareaToComposer()},0)})),this.editor.on("change_view",function(a){"composer"!==a||c?"textarea"===a&&(d.fromComposerToTextarea(!0),g()):(d.fromTextareaToComposer(!0),f())}),this.editor.on("destroy:composer",g)}})}(wysihtml5),function(a){a.views.SourceView=Base.extend({constructor:function(a,b){this.editor=a,this.composer=b,this._observe()},switchToTextarea:function(a){var b=this.composer.win.getComputedStyle(this.composer.element),c=parseFloat(b.width),d=Math.max(parseFloat(b.height),100);this.textarea||(this.textarea=this.composer.doc.createElement("textarea"),this.textarea.className="wysihtml5-source-view"),this.textarea.style.width=c+"px",this.textarea.style.height=d+"px",this.textarea.value=this.editor.getValue(a,!0),this.composer.element.parentNode.insertBefore(this.textarea,this.composer.element),this.editor.currentView="source",this.composer.element.style.display="none"},switchToComposer:function(a){var b=this.textarea.value;b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder")),this.textarea.parentNode.removeChild(this.textarea),this.editor.currentView=this.composer,this.composer.element.style.display=""},_observe:function(){this.editor.on("change_view",function(a){"composer"===a?this.switchToComposer(!0):"textarea"===a&&this.switchToTextarea(!0)}.bind(this))}})}(wysihtml5),wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(a,b,c){this.base(a,b,c),this._observe()},clear:function(){this.element.value=""},getValue:function(a){var b=this.isEmpty()?"":this.element.value;return a!==!1&&(b=this.parent.parse(b)),b},setValue:function(a,b){b!==!1&&(a=this.parent.parse(a)),this.element.value=a},cleanUp:function(a){var b=this.parent.parse(this.element.value,void 0,a);this.element.value=b},hasPlaceholderSet:function(){var a=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),b=this.element.getAttribute("placeholder")||null,c=this.element.value,d=!c;return a&&d||c===b},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var a=this.element,b=this.parent,c={focusin:"focus",focusout:"blur"},d=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];b.on("beforeload",function(){wysihtml5.dom.observe(a,d,function(a){var d=c[a.type]||a.type;b.fire(d).fire(d+":textarea")}),wysihtml5.dom.observe(a,["paste","drop"],function(){setTimeout(function(){b.fire("paste").fire("paste:textarea")},0)})})}}),function(a){var b,c={name:b,style:!0,toolbar:b,showToolbarAfterInit:!0,showToolbarDialogsOnSelection:!0,autoLink:!0,handleTables:!0,handleTabKey:!0,parserRules:{tags:{br:{},span:{},div:{},p:{},b:{},i:{},u:{}},classes:{}},pasteParserRulesets:null,parser:a.dom.parse,useLineBreaks:!0,doubleLineBreakEscapesBlock:!0,stylesheets:[],placeholderText:b,supportTouchDevices:!0,cleanUp:!0,contentEditableMode:!1,classNames:{composer:"wysihtml5-editor",body:"wysihtml5-supported",sandbox:"wysihtml5-sandbox",placeholder:"wysihtml5-placeholder",uneditableContainer:"wysihtml5-uneditable-container"},copyedFromMarking:''};a.Editor=a.lang.Dispatcher.extend({constructor:function(b,d){if(this.editableElement="string"==typeof b?document.getElementById(b):b,this.config=a.lang.object({}).merge(c).merge(d).get(),this._isCompatible=a.browser.supported(),d&&d.classNames&&a.lang.object(this.config.classNames).merge(d.classNames),"textarea"!=this.editableElement.nodeName.toLowerCase()&&(this.config.contentEditableMode=!0,this.config.noTextarea=!0),this.config.noTextarea||(this.textarea=new a.views.Textarea(this,this.editableElement,this.config),this.currentView=this.textarea),!this._isCompatible||!this.config.supportTouchDevices&&a.browser.isTouchDevice()){var e=this;return void setTimeout(function(){e.fire("beforeload").fire("load")},0)}a.dom.addClass(document.body,this.config.classNames.body),this.composer=new a.views.Composer(this,this.editableElement,this.config),this.currentView=this.composer,"function"==typeof this.config.parser&&this._initParser(),this.on("beforeload",this.handleBeforeLoad)},handleBeforeLoad:function(){this.config.noTextarea?this.sourceView=new a.views.SourceView(this,this.composer):this.synchronizer=new a.views.Synchronizer(this,this.textarea,this.composer),this.config.toolbar&&(this.toolbar=new a.toolbar.Toolbar(this,this.config.toolbar,this.config.showToolbarAfterInit))},isCompatible:function(){return this._isCompatible},clear:function(){return this.currentView.clear(),this},getValue:function(a,b){return this.currentView.getValue(a,b)},setValue:function(a,b){return this.fire("unset_placeholder"),a?(this.currentView.setValue(a,b),this):this.clear()},cleanUp:function(a){this.currentView.cleanUp(a)},focus:function(a){return this.currentView.focus(a),this},disable:function(){return this.currentView.disable(),this},enable:function(){return this.currentView.enable(),this},isEmpty:function(){return this.currentView.isEmpty()},hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},destroy:function(){this.composer&&this.composer.sandbox&&this.composer.sandbox.destroy(),this.toolbar&&this.toolbar.destroy(),this.off()},parse:function(b,c,d){var e=this.config.contentEditableMode?document:this.composer?this.composer.sandbox.getDocument():null,f=this.config.parser(b,{rules:d||this.config.parserRules,cleanUp:this.config.cleanUp,context:e,uneditableClass:this.config.classNames.uneditableContainer,clearInternals:c});return"object"==typeof b&&a.quirks.redraw(b),f},_initParser:function(){var b;a.browser.supportsModernPaste()?this.on("paste:composer",function(c){c.preventDefault(),b=a.dom.getPastedHtml(c),b&&this._cleanAndPaste(b)}.bind(this)):this.on("beforepaste:composer",function(b){b.preventDefault();var c=this.composer.getScrollPos();a.dom.getPastedHtmlWithDiv(this.composer,function(a){a&&this._cleanAndPaste(a),this.composer.setScrollPos(c)}.bind(this))}.bind(this))},_cleanAndPaste:function(b){var c=a.quirks.cleanPastedHTML(b,{referenceNode:this.composer.element,rules:this.config.pasteParserRulesets||[{set:this.config.parserRules}],uneditableClass:this.config.classNames.uneditableContainer});this.composer.selection.deleteContents(),this.composer.selection.insertHTML(c)}})}(wysihtml5),function(a){var b=a.dom,c="wysihtml5-command-dialog-opened",d="input, select, textarea",e="[data-wysihtml5-dialog-field]",f="data-wysihtml5-dialog-field";a.toolbar.Dialog=a.lang.Dispatcher.extend({constructor:function(a,b){this.link=a,this.container=b},_observe:function(){if(!this._observed){var d=this,e=function(a){var b=d._serialize();d.fire("save",b),d.hide(),a.preventDefault(),a.stopPropagation()};b.observe(d.link,"click",function(){b.hasClass(d.link,c)&&setTimeout(function(){d.hide()},0)}),b.observe(this.container,"keydown",function(b){var c=b.keyCode;c===a.ENTER_KEY&&e(b),c===a.ESCAPE_KEY&&d.cancel()}),b.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",e),b.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(a){d.cancel(),a.preventDefault(),a.stopPropagation()}),this._observed=!0}},_serialize:function(){for(var a={},b=this.container.querySelectorAll(e),c=b.length,d=0;c>d;d++)a[b[d].getAttribute(f)]=b[d].value;return a},_interpolate:function(a){for(var b,c,d,g=document.querySelector(":focus"),h=this.container.querySelectorAll(e),i=h.length,j=0;i>j;j++)b=h[j],b!==g&&(a&&"hidden"===b.type||(c=b.getAttribute(f),d=this.elementToChange&&"boolean"!=typeof this.elementToChange?this.elementToChange.getAttribute(c)||"":b.defaultValue,b.value=d))},update:function(a){this.elementToChange=a?a:this.elementToChange,this._interpolate()},show:function(a){var e=this.container.querySelector(d);if(this._observe(),this.update(a),b.addClass(this.link,c),this.container.style.display="",this.isOpen=!0,this.fire("show"),e&&!a)try{e.focus()}catch(f){}},_hide:function(a){this.elementToChange=null,b.removeClass(this.link,c),this.container.style.display="none",this.isOpen=!1},hide:function(){this._hide(),this.fire("hide")},cancel:function(){this._hide(),this.fire("cancel")}})}(wysihtml5),function(a){var b=a.dom,c={position:"relative"},d={left:0,margin:0,opacity:0,overflow:"hidden",padding:0,position:"absolute",top:0,zIndex:1},e={cursor:"inherit",fontSize:"50px",height:"50px",marginTop:"-25px",outline:0,padding:0,position:"absolute",right:"-4px",top:"50%"},f={"x-webkit-speech":"",speech:""};a.toolbar.Speech=function(g,h){var i=document.createElement("input");if(!a.browser.supportsSpeechApiOn(i))return void(h.style.display="none");var j=g.editor.textarea.element.getAttribute("lang");j&&(f.lang=j);var k=document.createElement("div");a.lang.object(d).merge({width:h.offsetWidth+"px",height:h.offsetHeight+"px"}),b.insert(i).into(k),b.insert(k).into(h),b.setStyles(e).on(i),b.setAttributes(f).on(i),b.setStyles(d).on(k),b.setStyles(c).on(h);var l="onwebkitspeechchange"in i?"webkitspeechchange":"speechchange";b.observe(i,l,function(){g.execCommand("insertText",i.value),i.value=""}),b.observe(i,"click",function(a){b.hasClass(h,"wysihtml5-command-disabled")&&a.preventDefault(),a.stopPropagation()})}}(wysihtml5),function(a){function b(b,c){var d=b.commands.state(c.name,c.value);return!c.dialog.multiselect&&a.lang.object(d).isArray()&&(d=1===d.length?d[0]:!0),d}var c="wysihtml5-command-disabled",d="wysihtml5-commands-disabled",e="wysihtml5-command-active",f="wysihtml5-action-active",g=a.dom;a.toolbar.Toolbar=Base.extend({constructor:function(b,g,h){this.editor=b,this.container="string"==typeof g?document.getElementById(g):g,this.composer=b.composer,this._getLinks("command"),this._getLinks("action"),this._observe(),h&&this.show(),null!=b.config.classNameCommandDisabled&&(c=b.config.classNameCommandDisabled),null!=b.config.classNameCommandsDisabled&&(d=b.config.classNameCommandsDisabled),null!=b.config.classNameCommandActive&&(e=b.config.classNameCommandActive),null!=b.config.classNameActionActive&&(f=b.config.classNameActionActive);for(var i=this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"),j=i.length,k=0;j>k;k++)new a.toolbar.Speech(this,i[k])},_getLinks:function(b){for(var c,d,e,f,g,h,i=this[b+"Links"]=a.lang.array(this.container.querySelectorAll("[data-wysihtml5-"+b+"]")).get(),j=i.length,k=0,l=this[b+"Mapping"]={};j>k;k++)c=i[k],e=c.getAttribute("data-wysihtml5-"+b),f=c.getAttribute("data-wysihtml5-"+b+"-value"),h=c.getAttribute("data-wysihtml5-"+b+"-blank-value"),d=this.container.querySelector("[data-wysihtml5-"+b+"-group='"+e+"']"),g=this._getDialog(c,e),l[e+":"+f]={link:c,group:d,name:e,value:f,tracksBlankValue:h,dialog:g,state:!1}},_getDialog:function(b,c){var d,e,f=this,g=this.container.querySelector("[data-wysihtml5-dialog='"+c+"']");return g&&(d=a.toolbar["Dialog_"+c]?new a.toolbar["Dialog_"+c](b,g):new a.toolbar.Dialog(b,g),d.on("show",function(){e=f.composer.selection.getBookmark(),f.editor.fire("show:dialog",{command:c,dialogContainer:g,commandLink:b})}),d.on("save",function(a){e&&f.composer.selection.setBookmark(e),f._execCommand(c,a),f.editor.fire("save:dialog",{command:c,dialogContainer:g,commandLink:b}),f._hideAllDialogs(),f._preventInstantFocus(),e=void 0}),d.on("cancel",function(){e&&f.composer.selection.setBookmark(e),f.editor.fire("cancel:dialog",{command:c,dialogContainer:g,commandLink:b}),e=void 0,f._preventInstantFocus()}),d.on("hide",function(){f.editor.fire("hide:dialog",{command:c,dialogContainer:g,commandLink:b}),e=void 0})),d},execCommand:function(a,b){this.commandsDisabled||this._execCommand(a,b)},_execCommand:function(a,b){this.editor.focus(!1),this.composer.commands.exec(a,b),this._updateLinkStates()},execAction:function(a){var b=this.editor;"change_view"===a&&(b.currentView===b.textarea||"source"===b.currentView?b.fire("change_view","composer"):b.fire("change_view","textarea")),"showSource"==a&&b.fire("showSource")},_observe:function(){for(var c=this,e=this.editor,f=this.container,h=this.commandLinks.concat(this.actionLinks),i=h.length,j=0;i>j;j++)"A"===h[j].nodeName?g.setAttributes({href:"javascript:;",unselectable:"on"}).on(h[j]):g.setAttributes({unselectable:"on"}).on(h[j]);g.delegate(f,"[data-wysihtml5-command], [data-wysihtml5-action]","mousedown",function(a){a.preventDefault()}),g.delegate(f,"[data-wysihtml5-command]","click",function(a){var d,e=this,f=e.getAttribute("data-wysihtml5-command"),g=e.getAttribute("data-wysihtml5-command-value"),h=c.commandMapping[f+":"+g];g||!h.dialog?c.execCommand(f,g):(d=b(c.composer,h),h.dialog.show(d)),a.preventDefault()}),g.delegate(f,"[data-wysihtml5-action]","click",function(a){var b=this.getAttribute("data-wysihtml5-action");c.execAction(b),a.preventDefault()}),e.on("interaction:composer",function(a){c.preventFocus||c._updateLinkStates()}),this._ownerDocumentClick=function(b){a.dom.contains(c.container,b.target)||a.dom.contains(c.composer.element,b.target)||(c._updateLinkStates(),c._preventInstantFocus())},this.container.ownerDocument.addEventListener("click",this._ownerDocumentClick,!1),this.editor.on("destroy:composer",this.destroy.bind(this)),this.editor.config.handleTables&&(e.on("tableselect:composer",function(){c.container.querySelectorAll('[data-wysihtml5-hiddentools="table"]')[0].style.display=""}),e.on("tableunselect:composer",function(){c.container.querySelectorAll('[data-wysihtml5-hiddentools="table"]')[0].style.display="none"})),e.on("change_view",function(a){setTimeout(function(){c.commandsDisabled="composer"!==a,c._updateLinkStates(),c.commandsDisabled?g.addClass(f,d):g.removeClass(f,d)},0)})},destroy:function(){this.container.ownerDocument.removeEventListener("click",this._ownerDocumentClick,!1)},_hideAllDialogs:function(){var a=this.commandMapping;for(var b in a)a[b].dialog&&a[b].dialog.hide()},_preventInstantFocus:function(){this.preventFocus=!0,setTimeout(function(){this.preventFocus=!1}.bind(this),0)},_updateLinkStates:function(){var a,d,h,i,j,k=this.commandMapping,l=this.composer,m=this.actionMapping;for(a in k)i=k[a],this.commandsDisabled?(d=!1,g.removeClass(i.link,e),i.group&&g.removeClass(i.group,e),i.dialog&&i.dialog.hide()):(d=this.composer.commands.state(i.name,i.value),g.removeClass(i.link,c),i.group&&g.removeClass(i.group,c)),(i.state!==d||i.tracksBlankValue)&&(i.state=d,d?i.tracksBlankValue?g.removeClass(i.link,e):(g.addClass(i.link,e),i.group&&g.addClass(i.group,e),!i.dialog||"undefined"!=typeof i.value&&null!==i.value||(d&&"object"==typeof d?(d=b(l,i),i.state=d,j=i.dialog.container.dataset?i.dialog.container.dataset.showdialogonselection:!1,l.config.showToolbarDialogsOnSelection||j?i.dialog.show(d):i.dialog.update(d)):i.dialog.hide())):i.tracksBlankValue?g.addClass(i.link,e):(g.removeClass(i.link,e),i.group&&g.removeClass(i.group,e),i.dialog&&!i.value&&i.dialog.hide()));for(a in m)h=m[a],"change_view"===h.name&&(h.state=this.editor.currentView===this.editor.textarea||"source"===this.editor.currentView,h.state?g.addClass(h.link,f):g.removeClass(h.link,f))},show:function(){this.container.style.display=""},hide:function(){this.container.style.display="none"}})}(wysihtml5),function(a){a.toolbar.Dialog_createTable=a.toolbar.Dialog.extend({show:function(a){this.base(a)}})}(wysihtml5),function(a){var b="[data-wysihtml5-dialog-field]",c="data-wysihtml5-dialog-field";a.toolbar.Dialog_foreColorStyle=a.toolbar.Dialog.extend({multiselect:!0,_serialize:function(){for(var a={},d=this.container.querySelectorAll(b),e=d.length,f=0;e>f;f++)a[d[f].getAttribute(c)]=d[f].value;return a},_interpolate:function(d){for(var e,f,g=a.quirks.styleParser,h=document.querySelector(":focus"),i=this.container.querySelectorAll(b),j=i.length,k=0,l=this.elementToChange?a.lang.object(this.elementToChange).isArray()?this.elementToChange[0]:this.elementToChange:null,m=l?l.getAttribute("style"):null,n=m?g.parseColor(m,"color"):null;j>k;k++)e=i[k],e!==h&&(d&&"hidden"===e.type||"color"===e.getAttribute(c)&&(f=(e.dataset.colormode||"rgb").toLowerCase(),f="hex"===f?"hash":f,n?e.value=g.unparseColor(n,f):e.value=g.unparseColor([0,0,0],f)))}})}(wysihtml5),function(a){a.dom;a.toolbar.Dialog_fontSizeStyle=a.toolbar.Dialog.extend({multiselect:!0,_serialize:function(){return{size:this.container.querySelector('[data-wysihtml5-dialog-field="size"]').value}},_interpolate:function(b){var c=document.querySelector(":focus"),d=this.container.querySelector("[data-wysihtml5-dialog-field='size']"),e=this.elementToChange?a.lang.object(this.elementToChange).isArray()?this.elementToChange[0]:this.elementToChange:null,f=e?e.getAttribute("style"):null,g=f?a.quirks.styleParser.parseFontSize(f):null;d&&d!==c&&g&&!/^\s*$/.test(g)&&(d.value=g)}})}(wysihtml5); +!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof module&&module.exports?module.exports=b():b()}(this,function(){var a={version:"0.5.5",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",INVISIBLE_SPACE_REG_EXP:/\uFEFF/g,VOID_ELEMENTS:"area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, wbr",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,TAB_KEY:9,DELETE_KEY:46};a.polyfills=function(a,b){function c(){try{var a=new CustomEvent("cat",{detail:{foo:"bar"}});return"cat"===a.type&&"bar"===a.detail.foo}catch(b){}return!1}String.prototype.trim||!function(){var a=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(a,"")}}(),function(){var c="addEventListener",d="removeEventListener";b[c]||(a.Element.prototype[c]=a[c]=b[c]=function(b,c,d){return(d=this).attachEvent("on"+b,function(b){var b=b||a.event;b.target=b.target||b.srcElement,b.preventDefault=b.preventDefault||function(){b.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){b.cancelBubble=!0},b.which=b.button?2===b.button?3:4===b.button?2:b.button:b.keyCode,c.call(d,b)})},a.Element.prototype[d]=a[d]=b[d]=function(a,b){return this.detachEvent("on"+a,b)})}(),Object.defineProperty&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(a.Element.prototype,"textContent")&&!Object.getOwnPropertyDescriptor(a.Element.prototype,"textContent").get&&!function(){var b=Object.getOwnPropertyDescriptor(a.Element.prototype,"innerText");Object.defineProperty(a.Element.prototype,"textContent",{get:function(){return b.get.call(this)},set:function(a){return b.set.call(this,a)}})}(),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){for(var c=this.length,d=-1,e=b>>>0;~(c-e);d=this[--c]===a?c:d);return d}),Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),function(a){a.matches=a.matches||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector||function(a){for(var b=this,c=(b.document||b.ownerDocument).querySelectorAll(a),d=0;c[d]&&c[d]!==b;)++d;return c[d]?!0:!1},a.closest=a.closest||function(a){for(var b=this;b&&!b.matches(a);)b=b.parentElement;return b}}(Element.prototype),"document"in a&&("classList"in b.createElement("_")?"DOMTokenList"in a&&!function(){"use strict";var c=b.createElement("_");if(c.classList.add("c1","c2"),!c.classList.contains("c2")){var d=function(b){var c=a.DOMTokenList.prototype[b];a.DOMTokenList.prototype[b]=function(a){var b,d=arguments.length;for(b=0;d>b;b++)a=arguments[b],c.call(this,a)}};d("add"),d("remove")}if(c.classList.toggle("c3",!1),c.classList.contains("c3")){var e=a.DOMTokenList.prototype.toggle;a.DOMTokenList.prototype.toggle=function(a,b){return 1 in arguments&&!this.contains(a)==!b?b:e.call(this,a)}}c=null}():!function(a){"use strict";if("Element"in a){var b="classList",c="prototype",d=a.Element[c],e=Object,f=String[c].trim||function(){return this.replace(/^\s+|\s+$/g,"")},g=Array[c].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},h=function(a,b){this.name=a,this.code=DOMException[a],this.message=b},i=function(a,b){if(""===b)throw new h("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(b))throw new h("INVALID_CHARACTER_ERR","String contains an invalid character");return g.call(a,b)},j=function(a){for(var b=f.call(a.getAttribute("class")||""),c=b?b.split(/\s+/):[],d=0,e=c.length;e>d;d++)this.push(c[d]);this._updateClassName=function(){a.setAttribute("class",this.toString())}},k=j[c]=[],l=function(){return new j(this)};if(h[c]=Error[c],k.item=function(a){return this[a]||null},k.contains=function(a){return a+="",-1!==i(this,a)},k.add=function(){var a,b=arguments,c=0,d=b.length,e=!1;do a=b[c]+"",-1===i(this,a)&&(this.push(a),e=!0);while(++c0?c.childNodes[d]:void 0,h=b.focusNode,i=b.focusOffset,j=h&&1===h.nodeType&&i>0?h.childNodes[i-1]:void 0,k=this.ownerDocument.createRange(),l=a.shift(),m=l?a.shift():null;for(j&&3===j.nodeType&&(h=j,i=j.nodeValue.length,j=void 0),g&&3===g.nodeType&&(c=g,d=0,g=void 0),(c===h&&d>i||c!==h&&c.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_PRECEDING&&!(c.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_CONTAINS))&&(h=[c,c=h][0],i=[d,d=i][0]);l&&m;)m.previousSibling&&m.previousSibling===l?(c===m&&(c=l,d=l.nodeValue.length+d),h===m&&(h=l,i=l.nodeValue.length+i),l.nodeValue=l.nodeValue+m.nodeValue,m.parentNode.removeChild(m),m=a.shift()):(l=m,m=a.shift());j&&(i=Array.prototype.indexOf.call(j.parentNode.childNodes,j)+1),g&&(d=Array.prototype.indexOf.call(g.parentNode.childNodes,g)),f(this)&&c&&c.parentNode&&h&&h.parentNode&&(k.setStart(c,d),k.setEnd(h,i),b.removeAllRanges(),b.addRange(k))});Node.prototype.normalize=a},h=function(){window.removeEventListener("load",h),"Node"in window&&"normalize"in Node.prototype&&d()&&g()};"complete"!==b.readyState?window.addEventListener("load",h):h();var i=c();!function(){function c(a,c){c=c||{bubbles:!1,cancelable:!1,detail:void 0};var d=b.createEvent("CustomEvent");return d.initCustomEvent(a,c.bubbles,c.cancelable,c.detail),d}!i&&"CustomEvent"in window&&(c.prototype=a.Event.prototype,a.CustomEvent=c,i=!0)}()},a.polyfills(window,document),function(a,b){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a():b.rangy=a()}(function(){function a(a,b){var c=typeof a[b];return c==u||!(c!=t||!a[b])||"unknown"==c}function b(a,b){return!(typeof a[b]!=t||!a[b])}function c(a,b){return typeof a[b]!=v}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&A(a,z)&&C(a,y)}function f(a){return b(a,"body")?a.body:a.getElementsByTagName("body")[0]}function g(b){typeof console!=v&&a(console,"log")&&console.log(b)}function h(a,b){F&&b?alert(a):g(a)}function i(a){H.initialized=!0,H.supported=!1,h("Rangy is not supported in this environment. Reason: "+a,H.config.alertOnFail)}function j(a){h("Rangy warning: "+a,H.config.alertOnWarn)}function k(a){return a.message||a.description||String(a)}function l(){if(F&&!H.initialized){var b,c=!1,d=!1;a(document,"createRange")&&(b=document.createRange(),A(b,x)&&C(b,w)&&(c=!0));var h=f(document);if(!h||"body"!=h.nodeName.toLowerCase())return void i("No body element found");if(h&&a(h,"createTextRange")&&(b=h.createTextRange(),e(b)&&(d=!0)),!c&&!d)return void i("Neither Range nor TextRange are available");H.initialized=!0,H.features={implementsDomRange:c,implementsTextRange:d};var j,l;for(var m in E)(j=E[m])instanceof p&&j.init(j,H);for(var n=0,o=K.length;o>n;++n)try{K[n](H)}catch(q){l="Rangy init listener threw an exception. Continuing. Detail: "+k(q),g(l)}}}function m(a,b,c){c&&(a+=" in module "+c.name),H.warn("DEPRECATED: "+a+" is deprecated. Please use "+b+" instead.")}function n(a,b,c,d){a[b]=function(){return m(b,c,d),a[c].apply(a,G.toArray(arguments))}}function o(a){a=a||window,l();for(var b=0,c=L.length;c>b;++b)L[b](a)}function p(a,b,c){this.name=a,this.dependencies=b,this.initialized=!1,this.supported=!1,this.initializer=c}function q(a,b,c){var d=new p(a,b,function(b){if(!b.initialized){b.initialized=!0;try{c(H,b),b.supported=!0}catch(d){var e="Module '"+a+"' failed to load: "+k(d);g(e),d.stack&&g(d.stack)}}});return E[a]=d,d}function r(){}function s(){}var t="object",u="function",v="undefined",w=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],x=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],y=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],z=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],A=d(a),B=d(b),C=d(c),D=[].forEach?function(a,b){a.forEach(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)b(a[c],c)},E={},F=typeof window!=v&&typeof document!=v,G={isHostMethod:a,isHostObject:b,isHostProperty:c,areHostMethods:A,areHostObjects:B,areHostProperties:C,isTextRange:e,getBody:f,forEach:D},H={version:"1.3.0",initialized:!1,isBrowser:F,supported:!0,util:G,features:{},modules:E,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==v?!0:rangyAutoInitialize}};H.fail=i,H.warn=j;var I;({}).hasOwnProperty?(G.extend=I=function(a,b,c){var d,e;for(var f in b)b.hasOwnProperty(f)&&(d=a[f],e=b[f],c&&null!==d&&"object"==typeof d&&null!==e&&"object"==typeof e&&I(d,e,!0),a[f]=e);return b.hasOwnProperty("toString")&&(a.toString=b.toString),a},G.createOptions=function(a,b){var c={};return I(c,b),a&&I(c,a),c}):i("hasOwnProperty not supported"),F||i("Rangy can only run in a browser"),function(){var a;if(F){var b=document.createElement("div");b.appendChild(document.createElement("span"));var c=[].slice;try{1==c.call(b.childNodes,0)[0].nodeType&&(a=function(a){return c.call(a,0)})}catch(d){}}a||(a=function(a){for(var b=[],c=0,d=a.length;d>c;++c)b[c]=a[c];return b}),G.toArray=a}();var J;F&&(a(document,"addEventListener")?J=function(a,b,c){a.addEventListener(b,c,!1)}:a(document,"attachEvent")?J=function(a,b,c){a.attachEvent("on"+b,c)}:i("Document does not have required addEventListener or attachEvent method"),G.addListener=J);var K=[];G.deprecationNotice=m,G.createAliasForDeprecatedMethod=n,H.init=l,H.addInitListener=function(a){H.initialized?a(H):K.push(a)};var L=[];H.addShimListener=function(a){L.push(a)},F&&(H.shim=H.createMissingNativeApi=o,n(H,"createMissingNativeApi","shim")),p.prototype={init:function(){for(var a,b,c=this.dependencies||[],d=0,e=c.length;e>d;++d){if(b=c[d],a=E[b],!(a&&a instanceof p))throw new Error("required module '"+b+"' not found");if(a.init(),!a.supported)throw new Error("required module '"+b+"' not supported")}this.initializer(this)},fail:function(a){throw this.initialized=!0,this.supported=!1,new Error(a)},warn:function(a){H.warn("Module "+this.name+": "+a)},deprecationNotice:function(a,b){H.warn("DEPRECATED: "+a+" in module "+this.name+" is deprecated. Please use "+b+" instead")},createError:function(a){return new Error("Error in Rangy "+this.name+" module: "+a)}},H.createModule=function(a){var b,c;2==arguments.length?(b=arguments[1],c=[]):(b=arguments[2],c=arguments[1]);var d=q(a,c,b);H.initialized&&H.supported&&d.init()},H.createCoreModule=function(a,b,c){q(a,b,c)},H.RangePrototype=r,H.rangePrototype=new r,H.selectionPrototype=new s,H.createCoreModule("DomUtil",[],function(a,b){function c(a){var b;return typeof a.namespaceURI==F||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==b}function d(a){var b=a.parentNode;return 1==b.nodeType?b:null}function e(a){for(var b=0;a=a.previousSibling;)++b;return b}function f(a){switch(a.nodeType){case 7:case 10:return 0;case 3:case 8:return a.length;default:return a.childNodes.length}}function g(a,b){var c,d=[];for(c=a;c;c=c.parentNode)d.push(c);for(c=b;c;c=c.parentNode)if(K(d,c))return c;return null}function h(a,b,c){for(var d=c?b:b.parentNode;d;){if(d===a)return!0;d=d.parentNode}return!1}function i(a,b){return h(a,b,!0)}function j(a,b,c){for(var d,e=c?a:a.parentNode;e;){if(d=e.parentNode,d===b)return e;e=d}return null}function k(a){var b=a.nodeType;return 3==b||4==b||8==b}function l(a){if(!a)return!1;var b=a.nodeType;return 3==b||8==b}function m(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a}function n(a,b,c){var d=a.cloneNode(!1);if(d.deleteData(0,b),a.deleteData(b,a.length-b),m(d,a),c)for(var f,g=0;f=c[g++];)f.node==a&&f.offset>b?(f.node=d,f.offset-=b):f.node==a.parentNode&&f.offset>e(a)&&++f.offset;return d}function o(a){if(9==a.nodeType)return a;if(typeof a.ownerDocument!=F)return a.ownerDocument;if(typeof a.document!=F)return a.document;if(a.parentNode)return o(a.parentNode);throw b.createError("getDocument: no document found for node")}function p(a){var c=o(a);if(typeof c.defaultView!=F)return c.defaultView;if(typeof c.parentWindow!=F)return c.parentWindow;throw b.createError("Cannot get a window object for node")}function q(a){if(typeof a.contentDocument!=F)return a.contentDocument;if(typeof a.contentWindow!=F)return a.contentWindow.document;throw b.createError("getIframeDocument: No Document object found for iframe element")}function r(a){if(typeof a.contentWindow!=F)return a.contentWindow;if(typeof a.contentDocument!=F)return a.contentDocument.defaultView;throw b.createError("getIframeWindow: No Window object found for iframe element")}function s(a){return a&&G.isHostMethod(a,"setTimeout")&&G.isHostObject(a,"document")}function t(a,b,c){var d;if(a?G.isHostProperty(a,"nodeType")?d=1==a.nodeType&&"iframe"==a.tagName.toLowerCase()?q(a):o(a):s(a)&&(d=a.document):d=document,!d)throw b.createError(c+"(): Parameter must be a Window object or DOM node");return d}function u(a){for(var b;b=a.parentNode;)a=b;return a}function v(a,c,d,f){var h,i,k,l,m;if(a==d)return c===f?0:f>c?-1:1;if(h=j(d,a,!0))return c<=e(h)?-1:1;if(h=j(a,d,!0))return e(h)[index:"+e(a)+",length:"+a.childNodes.length+"]["+(a.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return a.nodeName}function y(a){for(var b,c=o(a).createDocumentFragment();b=a.firstChild;)c.appendChild(b);return c}function z(a,b,c){var d=H(a),e=a.createElement("div");e.contentEditable=""+!!c,b&&(e.innerHTML=b);var f=d.firstChild;return f?d.insertBefore(e,f):d.appendChild(e),e}function A(a){return a.parentNode.removeChild(a)}function B(a){this.root=a,this._next=a}function C(a){return new B(a)}function D(a,b){this.node=a,this.offset=b}function E(a){this.code=this[a],this.codeName=a,this.message="DOMException: "+this.codeName}var F="undefined",G=a.util,H=G.getBody;G.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method"),G.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var I=document.createElement("div");G.areHostMethods(I,["insertBefore","appendChild","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"]))||b.fail("Incomplete Element implementation"),G.isHostProperty(I,"innerHTML")||b.fail("Element is missing innerHTML property");var J=document.createTextNode("test");G.areHostMethods(J,["splitText","deleteData","insertData","appendData","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"])||!G.areHostProperties(J,["data"]))||b.fail("Incomplete Text Node implementation");var K=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},L=!1;!function(){var b=document.createElement("b");b.innerHTML="1";var c=b.firstChild;b.innerHTML="
    ",L=w(c),a.features.crashyTextNodes=L}();var M;typeof window.getComputedStyle!=F?M=function(a,b){return p(a).getComputedStyle(a,null)[b]}:typeof document.documentElement.currentStyle!=F?M=function(a,b){return a.currentStyle?a.currentStyle[b]:""}:b.fail("No means of obtaining computed style properties found"),B.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a,b,c=this._current=this._next;if(this._current)if(a=c.firstChild)this._next=a;else{for(b=null;c!==this.root&&!(b=c.nextSibling);)c=c.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}},D.prototype={equals:function(a){return!!a&&this.node===a.node&&this.offset==a.offset},inspect:function(){return"[DomPosition("+x(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},E.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},E.prototype.toString=function(){return this.message},a.dom={arrayContains:K,isHtmlNamespace:c,parentElement:d,getNodeIndex:e,getNodeLength:f,getCommonAncestor:g,isAncestorOf:h,isOrIsAncestorOf:i,getClosestAncestorIn:j,isCharacterDataNode:k,isTextOrCommentNode:l,insertAfter:m,splitDataNode:n,getDocument:o,getWindow:p,getIframeWindow:r,getIframeDocument:q,getBody:H,isWindow:s,getContentDocument:t,getRootContainer:u,comparePoints:v,isBrokenNode:w,inspectNode:x,getComputedStyleProperty:M,createTestElement:z,removeNode:A,fragmentFromNodeChildren:y,createIterator:C,DomPosition:D},a.DOMException=E}),H.createCoreModule("DomRange",["DomUtil"],function(a,b){function c(a,b){return 3!=a.nodeType&&(P(a,b.startContainer)||P(a,b.endContainer))}function d(a){return a.document||Q(a.startContainer)}function e(a){return W(a.startContainer)}function f(a){return new L(a.parentNode,O(a))}function g(a){return new L(a.parentNode,O(a)+1)}function h(a,b,c){var d=11==a.nodeType?a.firstChild:a;return N(b)?c==b.length?J.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:S(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]),d}function i(a,b,c){if(z(a),z(b),d(b)!=d(a))throw new M("WRONG_DOCUMENT_ERR");var e=R(a.startContainer,a.startOffset,b.endContainer,b.endOffset),f=R(a.endContainer,a.endOffset,b.startContainer,b.startOffset);return c?0>=e&&f>=0:0>e&&f>0}function j(a){for(var b,c,e,f=d(a.range).createDocumentFragment();c=a.next();){if(b=a.isPartiallySelectedSubtree(),c=c.cloneNode(!b),b&&(e=a.getSubtreeIterator(),c.appendChild(j(e)),e.detach()),10==c.nodeType)throw new M("HIERARCHY_REQUEST_ERR");f.appendChild(c)}return f}function k(a,b,c){var d,e;c=c||{stop:!1};for(var f,g;f=a.next();)if(a.isPartiallySelectedSubtree()){if(b(f)===!1)return void(c.stop=!0);if(g=a.getSubtreeIterator(),k(g,b,c),g.detach(),c.stop)return}else for(d=J.createIterator(f);e=d.next();)if(b(e)===!1)return void(c.stop=!0)}function l(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),l(b),b.detach()):a.remove()}function m(a){for(var b,c,e=d(a.range).createDocumentFragment();b=a.next();){if(a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),c=a.getSubtreeIterator(),b.appendChild(m(c)),c.detach()):a.remove(),10==b.nodeType)throw new M("HIERARCHY_REQUEST_ERR");e.appendChild(b)}return e}function n(a,b,c){var d,e=!(!b||!b.length),f=!!c;e&&(d=new RegExp("^("+b.join("|")+")$"));var g=[];return k(new p(a,!1),function(b){if((!e||d.test(b.nodeType))&&(!f||c(b))){var h=a.startContainer;if(b!=h||!N(h)||a.startOffset!=h.length){var i=a.endContainer;b==i&&N(i)&&0==a.endOffset||g.push(b)}}}),g}function o(a){var b="undefined"==typeof a.getName?"Range":a.getName();return"["+b+"("+J.inspectNode(a.startContainer)+":"+a.startOffset+", "+J.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function p(a,b){if(this.range=a,this.clonePartiallySelectedTextNodes=b,!a.collapsed){this.sc=a.startContainer,this.so=a.startOffset,this.ec=a.endContainer,this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&N(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==c||N(this.sc)?T(this.sc,c,!0):this.sc.childNodes[this.so],this._last=this.ec!==c||N(this.ec)?T(this.ec,c,!0):this.ec.childNodes[this.eo-1])}}function q(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){if(d=e.nodeType,V(a,d))return e;e=e.parentNode}return null}}function r(a,b){if(ea(a,b))throw new M("INVALID_NODE_TYPE_ERR")}function s(a,b){if(!V(b,a.nodeType))throw new M("INVALID_NODE_TYPE_ERR")}function t(a,b){if(0>b||b>(N(a)?a.length:a.childNodes.length))throw new M("INDEX_SIZE_ERR")}function u(a,b){if(ca(a,!0)!==ca(b,!0))throw new M("WRONG_DOCUMENT_ERR")}function v(a){if(da(a,!0))throw new M("NO_MODIFICATION_ALLOWED_ERR")}function w(a,b){if(!a)throw new M(b)}function x(a,b){return b<=(N(a)?a.length:a.childNodes.length)}function y(a){return!!a.startContainer&&!!a.endContainer&&!(X&&(J.isBrokenNode(a.startContainer)||J.isBrokenNode(a.endContainer)))&&W(a.startContainer)==W(a.endContainer)&&x(a.startContainer,a.startOffset)&&x(a.endContainer,a.endOffset)}function z(a){if(!y(a))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+a.inspect()+")")}function A(a,b){z(a);var c=a.startContainer,d=a.startOffset,e=a.endContainer,f=a.endOffset,g=c===e;N(e)&&f>0&&f0&&d=O(c)&&f++,d=0),a.setStartAndEnd(c,d,e,f)}function B(a){z(a);var b=a.commonAncestorContainer.parentNode.cloneNode(!1);return b.appendChild(a.cloneContents()),b.innerHTML}function C(a){a.START_TO_START=ka,a.START_TO_END=la,a.END_TO_END=ma,a.END_TO_START=na,a.NODE_BEFORE=oa,a.NODE_AFTER=pa,a.NODE_BEFORE_AND_AFTER=qa,a.NODE_INSIDE=ra}function D(a){C(a),C(a.prototype)}function E(a,b){return function(){z(this);var c,d,e=this.startContainer,f=this.startOffset,h=this.commonAncestorContainer,i=new p(this,!0);e!==h&&(c=T(e,h,!0),d=g(c),e=d.node,f=d.offset),k(i,v),i.reset();var j=a(i);return i.detach(),b(this,e,f,e,f),j}}function F(b,d){function e(a,b){return function(c){s(c,Z),s(W(c),$);var d=(a?f:g)(c);(b?h:i)(this,d.node,d.offset)}}function h(a,b,c){var e=a.endContainer,f=a.endOffset;(b!==a.startContainer||c!==a.startOffset)&&((W(b)!=W(e)||1==R(b,c,e,f))&&(e=b,f=c),d(a,b,c,e,f))}function i(a,b,c){var e=a.startContainer,f=a.startOffset;(b!==a.endContainer||c!==a.endOffset)&&((W(b)!=W(e)||-1==R(b,c,e,f))&&(e=b,f=c),d(a,e,f,b,c))}var j=function(){};j.prototype=a.rangePrototype,b.prototype=new j,K.extend(b.prototype,{setStart:function(a,b){r(a,!0),t(a,b),h(this,a,b)},setEnd:function(a,b){r(a,!0),t(a,b),i(this,a,b)},setStartAndEnd:function(){var a=arguments,b=a[0],c=a[1],e=b,f=c;switch(a.length){case 3:f=a[2];break;case 4:e=a[2],f=a[3]}d(this,b,c,e,f)},setBoundary:function(a,b,c){this["set"+(c?"Start":"End")](a,b)},setStartBefore:e(!0,!0),setStartAfter:e(!1,!0),setEndBefore:e(!0,!1),setEndAfter:e(!1,!1),collapse:function(a){z(this),a?d(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){r(a,!0),d(this,a,0,a,U(a))},selectNode:function(a){r(a,!1),s(a,Z);var b=f(a),c=g(a);d(this,b.node,b.offset,c.node,c.offset)},extractContents:E(m,d),deleteContents:E(l,d),canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},splitBoundaries:function(){A(this)},splitBoundariesPreservingPositions:function(a){A(this,a)},normalizeBoundaries:function(){z(this);var a,b=this.startContainer,c=this.startOffset,e=this.endContainer,f=this.endOffset,g=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(e=a,f=a.length,a.appendData(b.data),Y(b))},h=function(a){var d=a.previousSibling;if(d&&d.nodeType==a.nodeType){b=a;var g=a.length;if(c=d.length,a.insertData(0,d.data),Y(d),b==e)f+=c,e=b;else if(e==a.parentNode){var h=O(a);f==h?(e=a,f=g):f>h&&f--}}},i=!0;if(N(e))f==e.length?g(e):0==f&&(a=e.previousSibling,a&&a.nodeType==e.nodeType&&(f=a.length,b==e&&(i=!1),a.appendData(e.data),Y(e),e=a));else{if(f>0){var j=e.childNodes[f-1];j&&N(j)&&g(j)}i=!this.collapsed}if(i){if(N(b))0==c?h(b):c==b.length&&(a=b.nextSibling,a&&a.nodeType==b.nodeType&&(e==a&&(e=b,f+=b.length),b.appendData(a.data),Y(a)));else if(cx",ga=3==fa.firstChild.nodeType}catch(ha){}a.features.htmlParsingConforms=ga;var ia=ga?function(a){var b=this.startContainer,c=Q(b);if(!b)throw new M("INVALID_STATE_ERR");var d=null;return 1==b.nodeType?d=b:N(b)&&(d=J.parentElement(b)),d=null===d||"HTML"==d.nodeName&&J.isHtmlNamespace(Q(d).documentElement)&&J.isHtmlNamespace(d)?c.createElement("body"):d.cloneNode(!1),d.innerHTML=a,J.fragmentFromNodeChildren(d)}:function(a){var b=d(this),c=b.createElement("body");return c.innerHTML=a,J.fragmentFromNodeChildren(c)},ja=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ka=0,la=1,ma=2,na=3,oa=0,pa=1,qa=2,ra=3;K.extend(a.rangePrototype,{compareBoundaryPoints:function(a,b){z(this),u(this.startContainer,b.startContainer);var c,d,e,f,g=a==na||a==ka?"start":"end",h=a==la||a==ka?"start":"end";return c=this[g+"Container"],d=this[g+"Offset"],e=b[h+"Container"],f=b[h+"Offset"],R(c,d,e,f)},insertNode:function(a){if(z(this),s(a,aa),v(this.startContainer),P(a,this.startContainer))throw new M("HIERARCHY_REQUEST_ERR");var b=h(a,this.startContainer,this.startOffset);this.setStartBefore(b)},cloneContents:function(){z(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();if(this.startContainer===this.endContainer&&N(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;var c=new p(this,!0);return a=j(c),c.detach(),a},canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},surroundContents:function(a){if(s(a,ba),!this.canSurroundContents())throw new M("INVALID_STATE_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);h(a,this.startContainer,this.startOffset),a.appendChild(b),this.selectNode(a)},cloneRange:function(){z(this);for(var a,b=new I(d(this)),c=ja.length;c--;)a=ja[c],b[a]=this[a];return b},toString:function(){z(this);var a=this.startContainer;if(a===this.endContainer&&N(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],c=new p(this,!0);return k(c,function(a){(3==a.nodeType||4==a.nodeType)&&b.push(a.data)}),c.detach(),b.join("")},compareNode:function(a){z(this);var b=a.parentNode,c=O(a);if(!b)throw new M("NOT_FOUND_ERR");var d=this.comparePoint(b,c),e=this.comparePoint(b,c+1);return 0>d?e>0?qa:oa:e>0?pa:ra},comparePoint:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)<0?-1:R(a,b,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:ia,toHtml:function(){return B(this)},intersectsNode:function(a,b){if(z(this),W(a)!=e(this))return!1;var c=a.parentNode,d=O(a);if(!c)return!0;var f=R(c,d,this.endContainer,this.endOffset),g=R(c,d+1,this.startContainer,this.startOffset);return b?0>=f&&g>=0:0>f&&g>0},isPointInRange:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)>=0&&R(a,b,this.endContainer,this.endOffset)<=0},intersectsRange:function(a){return i(this,a,!1)},intersectsOrTouchesRange:function(a){return i(this,a,!0)},intersection:function(a){if(this.intersectsRange(a)){var b=R(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=R(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();return-1==b&&d.setStart(a.startContainer,a.startOffset),1==c&&d.setEnd(a.endContainer,a.endOffset),d}return null},union:function(a){if(this.intersectsOrTouchesRange(a)){var b=this.cloneRange();return-1==R(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset), +1==R(a.endContainer,a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset),b}throw new M("Ranges do not intersect")},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==ra},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,U(a))<=0},containsRange:function(a){var b=this.intersection(a);return null!==b&&a.equals(b)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);if(c.length>0){b.setStart(c[0],0);var d=c.pop();return b.setEnd(d,d.length),this.containsRange(b)}return this.containsNodeContents(a)},getNodes:function(a,b){return z(this),n(this,a,b)},getDocument:function(){return d(this)},collapseBefore:function(a){this.setEndBefore(a),this.collapse(!1)},collapseAfter:function(a){this.setStartAfter(a),this.collapse(!0)},getBookmark:function(b){var c=d(this),e=a.createRange(c);b=b||J.getBody(c),e.selectNodeContents(b);var f=this.intersection(e),g=0,h=0;return f&&(e.setEnd(f.startContainer,f.startOffset),g=e.toString().length,h=g+f.toString().length),{start:g,end:h,containerNode:b}},moveToBookmark:function(a){var b=a.containerNode,c=0;this.setStart(b,0),this.collapse(!0);for(var d,e,f,g,h=[b],i=!1,j=!1;!j&&(d=h.pop());)if(3==d.nodeType)e=c+d.length,!i&&a.start>=c&&a.start<=e&&(this.setStart(d,a.start-c),i=!0),i&&a.end>=c&&a.end<=e&&(this.setEnd(d,a.end-c),j=!0),c=e;else for(g=d.childNodes,f=g.length;f--;)h.push(g[f])},getName:function(){return"DomRange"},equals:function(a){return I.rangesEqual(this,a)},isValid:function(){return y(this)},inspect:function(){return o(this)},detach:function(){}}),F(I,H),K.extend(I,{rangeProperties:ja,RangeIterator:p,copyComparisonConstants:D,createPrototypeRange:F,inspect:o,toHtml:B,getRangeDocument:d,rangesEqual:function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset}}),a.DomRange=I}),H.createCoreModule("WrappedRange",["DomRange"],function(a,b){var c,d,e=a.dom,f=a.util,g=e.DomPosition,h=a.DomRange,i=e.getBody,j=e.getContentDocument,k=e.isCharacterDataNode;if(a.features.implementsDomRange&&!function(){function d(a){for(var b,c=m.length;c--;)b=m[c],a[b]=a.nativeRange[b];a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset}function g(a,b,c,d,e){var f=a.startContainer!==b||a.startOffset!=c,g=a.endContainer!==d||a.endOffset!=e,h=!a.equals(a.nativeRange);(f||g||h)&&(a.setEnd(d,e),a.setStart(b,c))}var k,l,m=h.rangeProperties;c=function(a){if(!a)throw b.createError("WrappedRange: Range must be specified");this.nativeRange=a,d(this)},h.createPrototypeRange(c,g),k=c.prototype,k.selectNode=function(a){this.nativeRange.selectNode(a),d(this)},k.cloneContents=function(){return this.nativeRange.cloneContents()},k.surroundContents=function(a){this.nativeRange.surroundContents(a),d(this)},k.collapse=function(a){this.nativeRange.collapse(a),d(this)},k.cloneRange=function(){return new c(this.nativeRange.cloneRange())},k.refresh=function(){d(this)},k.toString=function(){return this.nativeRange.toString()};var n=document.createTextNode("test");i(document).appendChild(n);var o=document.createRange();o.setStart(n,0),o.setEnd(n,0);try{o.setStart(n,1),k.setStart=function(a,b){this.nativeRange.setStart(a,b),d(this)},k.setEnd=function(a,b){this.nativeRange.setEnd(a,b),d(this)},l=function(a){return function(b){this.nativeRange[a](b),d(this)}}}catch(p){k.setStart=function(a,b){try{this.nativeRange.setStart(a,b)}catch(c){this.nativeRange.setEnd(a,b),this.nativeRange.setStart(a,b)}d(this)},k.setEnd=function(a,b){try{this.nativeRange.setEnd(a,b)}catch(c){this.nativeRange.setStart(a,b),this.nativeRange.setEnd(a,b)}d(this)},l=function(a,b){return function(c){try{this.nativeRange[a](c)}catch(e){this.nativeRange[b](c),this.nativeRange[a](c)}d(this)}}}k.setStartBefore=l("setStartBefore","setEndBefore"),k.setStartAfter=l("setStartAfter","setEndAfter"),k.setEndBefore=l("setEndBefore","setStartBefore"),k.setEndAfter=l("setEndAfter","setStartAfter"),k.selectNodeContents=function(a){this.setStartAndEnd(a,0,e.getNodeLength(a))},o.selectNodeContents(n),o.setEnd(n,3);var q=document.createRange();q.selectNodeContents(n),q.setEnd(n,4),q.setStart(n,2),-1==o.compareBoundaryPoints(o.START_TO_END,q)&&1==o.compareBoundaryPoints(o.END_TO_START,q)?k.compareBoundaryPoints=function(a,b){return b=b.nativeRange||b,a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&(a=b.START_TO_END),this.nativeRange.compareBoundaryPoints(a,b)}:k.compareBoundaryPoints=function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};var r=document.createElement("div");r.innerHTML="123";var s=r.firstChild,t=i(document);t.appendChild(r),o.setStart(s,1),o.setEnd(s,2),o.deleteContents(),"13"==s.data&&(k.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},k.extractContents=function(){var a=this.nativeRange.extractContents();return d(this),a}),t.removeChild(r),t=null,f.isHostMethod(o,"createContextualFragment")&&(k.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)}),i(document).removeChild(n),k.getName=function(){return"WrappedRange"},a.WrappedRange=c,a.createNativeRange=function(a){return a=j(a,b,"createNativeRange"),a.createRange()}}(),a.features.implementsTextRange){var l=function(a){var b=a.parentElement(),c=a.duplicate();c.collapse(!0);var d=c.parentElement();c=a.duplicate(),c.collapse(!1);var f=c.parentElement(),g=d==f?d:e.getCommonAncestor(d,f);return g==b?g:e.getCommonAncestor(b,g)},m=function(a){return 0==a.compareEndPoints("StartToEnd",a)},n=function(a,b,c,d,f){var h=a.duplicate();h.collapse(c);var i=h.parentElement();if(e.isOrIsAncestorOf(b,i)||(i=b),!i.canHaveHTML){var j=new g(i.parentNode,e.getNodeIndex(i));return{boundaryPosition:j,nodeInfo:{nodeIndex:j.offset,containerElement:j.node}}}var l=e.getDocument(i).createElement("span");l.parentNode&&e.removeNode(l);for(var m,n,o,p,q,r=c?"StartToStart":"StartToEnd",s=f&&f.containerElement==i?f.nodeIndex:0,t=i.childNodes.length,u=t,v=u;;){if(v==t?i.appendChild(l):i.insertBefore(l,i.childNodes[v]),h.moveToElementText(l),m=h.compareEndPoints(r,a),0==m||s==u)break;if(-1==m){if(u==s+1)break;s=v}else u=u==s+1?s:v;v=Math.floor((s+u)/2),i.removeChild(l)}if(q=l.nextSibling,-1==m&&q&&k(q)){h.setEndPoint(c?"EndToStart":"EndToEnd",a);var w;if(/[\r\n]/.test(q.data)){var x=h.duplicate(),y=x.text.replace(/\r\n/g,"\r").length;for(w=x.moveStart("character",y);-1==(m=x.compareEndPoints("StartToEnd",x));)w++,x.moveStart("character",1)}else w=h.text.length;p=new g(q,w)}else n=(d||!c)&&l.previousSibling,o=(d||c)&&l.nextSibling,p=o&&k(o)?new g(o,0):n&&k(n)?new g(n,n.data.length):new g(i,e.getNodeIndex(l));return e.removeNode(l),{boundaryPosition:p,nodeInfo:{nodeIndex:v,containerElement:i}}},o=function(a,b){var c,d,f,g,h=a.offset,j=e.getDocument(a.node),l=i(j).createTextRange(),m=k(a.node);return m?(c=a.node,d=c.parentNode):(g=a.node.childNodes,c=hb;++b)if(!C.isAncestorOf(a[0],a[b]))return!1;return!0}function m(a){var c=a.getNodes();if(!l(c))throw b.createError("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return c[0]}function n(a){return!!a&&"undefined"!=typeof a.text}function o(a,b){var c=new G(b);a._ranges=[c],h(a,c,!1),a.rangeCount=1,a.isCollapsed=c.collapsed}function p(b){if(b._ranges.length=0,"None"==b.docSelection.type)j(b);else{var c=b.docSelection.createRange();if(n(c))o(b,c);else{b.rangeCount=c.length;for(var d,e=L(c.item(0)),f=0;fh;++h)g.add(d.item(h));try{g.add(e)}catch(j){throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}g.select(),p(a)}function r(a,b,c){this.nativeSelection=a,this.docSelection=b,this._ranges=[],this.win=c,this.refresh()}function s(a){a.win=a.anchorNode=a.focusNode=a._ranges=null,a.rangeCount=a.anchorOffset=a.focusOffset=0,a.detached=!0}function t(a,b){for(var c,d,e=ba.length;e--;)if(c=ba[e],d=c.selection,"deleteAll"==b)s(d);else if(c.win==a)return"delete"==b?(ba.splice(e,1),!0):d;return"deleteAll"==b&&(ba.length=0),null}function u(a,c){for(var d,e=L(c[0].startContainer),f=M(e).createControlRange(),g=0,h=c.length;h>g;++g){d=m(c[g]);try{f.add(d)}catch(i){throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}f.select(),p(a)}function v(a,b){if(a.win.document!=L(b))throw new H("WRONG_DOCUMENT_ERR")}function w(b){return function(c,d){var e;this.rangeCount?(e=this.getRangeAt(0),e["set"+(b?"Start":"End")](c,d)):(e=a.createRange(this.win.document),e.setStartAndEnd(c,d)),this.setSingleRange(e,this.isBackward())}}function x(a){var b=[],c=new I(a.anchorNode,a.anchorOffset),d=new I(a.focusNode,a.focusOffset),e="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var f=0,g=a.rangeCount;g>f;++f)b[f]=F.inspect(a.getRangeAt(f));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}a.config.checkSelectionRanges=!0;var y,z,A="boolean",B="number",C=a.dom,D=a.util,E=D.isHostMethod,F=a.DomRange,G=a.WrappedRange,H=a.DOMException,I=C.DomPosition,J=a.features,K="Control",L=C.getDocument,M=C.getBody,N=F.rangesEqual,O=E(window,"getSelection"),P=D.isHostObject(document,"selection");J.implementsWinGetSelection=O,J.implementsDocSelection=P;var Q=P&&(!O||a.config.preferTextRange);if(Q)y=f,a.isSelectionValid=function(a){var b=d(a,"isSelectionValid").document,c=b.selection;return"None"!=c.type||L(c.createRange().parentElement())==b};else{if(!O)return b.fail("Neither document.selection or window.getSelection() detected."),!1;y=e,a.isSelectionValid=function(){return!0}}a.getNativeSelection=y;var R=y();if(!R)return b.fail("Native selection was null (possibly issue 138?)"),!1;var S=a.createNativeRange(document),T=M(document),U=D.areHostProperties(R,["anchorNode","focusNode","anchorOffset","focusOffset"]);J.selectionHasAnchorAndFocus=U;var V=E(R,"extend");J.selectionHasExtend=V;var W=typeof R.rangeCount==B;J.selectionHasRangeCount=W;var X=!1,Y=!0,Z=V?function(b,c){var d=F.getRangeDocument(c),e=a.createRange(d);e.collapseToPoint(c.endContainer,c.endOffset),b.addRange(k(e)),b.extend(c.startContainer,c.startOffset)}:null;D.areHostMethods(R,["addRange","getRangeAt","removeAllRanges"])&&typeof R.rangeCount==B&&J.implementsDomRange&&!function(){var b=window.getSelection();if(b){for(var c=b.rangeCount,d=c>1,e=[],f=g(b),h=0;c>h;++h)e[h]=b.getRangeAt(h);var i=C.createTestElement(document,"",!1),j=i.appendChild(document.createTextNode("   ")),k=document.createRange();if(k.setStart(j,1),k.collapse(!0),b.removeAllRanges(),b.addRange(k),Y=1==b.rangeCount,b.removeAllRanges(),!d){var l=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(l&&parseInt(l[1])>=36)X=!1;else{var m=k.cloneRange();k.setStart(j,0),m.setEnd(j,3),m.setStart(j,2),b.addRange(k),b.addRange(m),X=2==b.rangeCount}}for(C.removeNode(i),b.removeAllRanges(),h=0;c>h;++h)0==h&&f?Z?Z(b,e[h]):(a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),b.addRange(e[h])):b.addRange(e[h])}}(),J.selectionSupportsMultipleRanges=X,J.collapsedNonEditableSelectionsSupported=Y;var $,_=!1;T&&E(T,"createControlRange")&&($=T.createControlRange(),D.areHostProperties($,["item","add"])&&(_=!0)),J.implementsControlRange=_,z=U?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var aa;E(R,"getRangeAt")?aa=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:U&&(aa=function(b){var c=L(b.anchorNode),d=a.createRange(c);return d.setStartAndEnd(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),d.collapsed!==this.isCollapsed&&d.setStartAndEnd(b.focusNode,b.focusOffset,b.anchorNode,b.anchorOffset),d}),r.prototype=a.selectionPrototype;var ba=[],ca=function(a){if(a&&a instanceof r)return a.refresh(),a;a=d(a,"getNativeSelection");var b=t(a),c=y(a),e=P?f(a):null;return b?(b.nativeSelection=c,b.docSelection=e,b.refresh()):(b=new r(c,e,a),ba.push({win:a,selection:b})),b};a.getSelection=ca,D.createAliasForDeprecatedMethod(a,"getIframeSelection","getSelection");var da=r.prototype;if(!Q&&U&&D.areHostMethods(R,["removeAllRanges","addRange"])){da.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),j(this)};var ea=function(a,b){Z(a.nativeSelection,b),a.refresh()};W?da.addRange=function(b,d){if(_&&P&&this.docSelection.type==K)q(this,b);else if(c(d)&&V)ea(this,b);else{var e;X?e=this.rangeCount:(this.removeAllRanges(),e=0);var f=k(b).cloneRange();try{this.nativeSelection.addRange(f)}catch(g){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==e+1){if(a.config.checkSelectionRanges){var i=aa(this.nativeSelection,this.rangeCount-1);i&&!N(i,b)&&(b=new G(i))}this._ranges[this.rangeCount-1]=b,h(this,b,ha(this.nativeSelection)),this.isCollapsed=z(this)}else this.refresh()}}:da.addRange=function(a,b){c(b)&&V?ea(this,a):(this.nativeSelection.addRange(k(a)),this.refresh())},da.setRanges=function(a){if(_&&P&&a.length>1)u(this,a);else{this.removeAllRanges();for(var b=0,c=a.length;c>b;++b)this.addRange(a[b])}}}else{if(!(E(R,"empty")&&E(S,"select")&&_&&Q))return b.fail("No means of selecting a Range or TextRange was found"),!1;da.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var a;if(this.anchorNode)a=L(this.anchorNode);else if(this.docSelection.type==K){var b=this.docSelection.createRange();b.length&&(a=L(b.item(0)))}if(a){var c=M(a).createTextRange();c.select(),this.docSelection.empty()}}}catch(d){}j(this)},da.addRange=function(b){this.docSelection.type==K?q(this,b):(a.WrappedTextRange.rangeToTextRange(b).select(),this._ranges[0]=b,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,h(this,b,!1))},da.setRanges=function(a){this.removeAllRanges();var b=a.length;b>1?u(this,a):b&&this.addRange(a[0])}}da.getRangeAt=function(a){if(0>a||a>=this.rangeCount)throw new H("INDEX_SIZE_ERR");return this._ranges[a].cloneRange()};var fa;if(Q)fa=function(b){var c;a.isSelectionValid(b.win)?c=b.docSelection.createRange():(c=M(b.win.document).createTextRange(),c.collapse(!0)),b.docSelection.type==K?p(b):n(c)?o(b,c):j(b)};else if(E(R,"getRangeAt")&&typeof R.rangeCount==B)fa=function(b){if(_&&P&&b.docSelection.type==K)p(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,b.rangeCount){for(var c=0,d=b.rangeCount;d>c;++c)b._ranges[c]=new a.WrappedRange(b.nativeSelection.getRangeAt(c));h(b,b._ranges[b.rangeCount-1],ha(b.nativeSelection)),b.isCollapsed=z(b)}else j(b)};else{if(!U||typeof R.isCollapsed!=A||typeof S.collapsed!=A||!J.implementsDomRange)return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;fa=function(a){var b,c=a.nativeSelection;c.anchorNode?(b=aa(c,0),a._ranges=[b],a.rangeCount=1,i(a),a.isCollapsed=z(a)):j(a)}}da.refresh=function(a){var b=a?this._ranges.slice(0):null,c=this.anchorNode,d=this.anchorOffset;if(fa(this),a){var e=b.length;if(e!=this._ranges.length)return!0;if(this.anchorNode!=c||this.anchorOffset!=d)return!0;for(;e--;)if(!N(b[e],this._ranges[e]))return!0;return!1}};var ga=function(a,b){var c=a.getAllRanges();a.removeAllRanges();for(var d=0,e=c.length;e>d;++d)N(b,c[d])||a.addRange(c[d]);a.rangeCount||j(a)};_&&P?da.removeRange=function(a){if(this.docSelection.type==K){for(var b,c=this.docSelection.createRange(),d=m(a),e=L(c.item(0)),f=M(e).createControlRange(),g=!1,h=0,i=c.length;i>h;++h)b=c.item(h),b!==d||g?f.add(c.item(h)):g=!0;f.select(),p(this)}else ga(this,a)}:da.removeRange=function(a){ga(this,a)};var ha;!Q&&U&&J.implementsDomRange?(ha=g,da.isBackward=function(){return ha(this)}):ha=da.isBackward=function(){return!1},da.isBackwards=da.isBackward,da.toString=function(){for(var a=[],b=0,c=this.rangeCount;c>b;++b)a[b]=""+this._ranges[b];return a.join("")},da.collapse=function(b,c){v(this,b);var d=a.createRange(b);d.collapseToPoint(b,c),this.setSingleRange(d),this.isCollapsed=!0},da.collapseToStart=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)},da.collapseToEnd=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)},da.selectAllChildren=function(b){v(this,b);var c=a.createRange(b);c.selectNodeContents(b),this.setSingleRange(c)},da.deleteFromDocument=function(){if(_&&P&&this.docSelection.type==K){for(var a,b=this.docSelection.createRange();b.length;)a=b.item(0),b.remove(a),C.removeNode(a);this.refresh()}else if(this.rangeCount){var c=this.getAllRanges();if(c.length){this.removeAllRanges();for(var d=0,e=c.length;e>d;++d)c[d].deleteContents();this.addRange(c[e-1])}}},da.eachRange=function(a,b){for(var c=0,d=this._ranges.length;d>c;++c)if(a(this.getRangeAt(c)))return b},da.getAllRanges=function(){var a=[];return this.eachRange(function(b){a.push(b)}),a},da.setSingleRange=function(a,b){this.removeAllRanges(),this.addRange(a,b)},da.callMethodOnEachRange=function(a,b){var c=[];return this.eachRange(function(d){c.push(d[a].apply(d,b||[]))}),c},da.setStart=w(!0),da.setEnd=w(!1),a.rangePrototype.select=function(a){ca(this.getDocument()).setSingleRange(this,a)},da.changeEachRange=function(a){var b=[],c=this.isBackward();this.eachRange(function(c){a(c),b.push(c)}),this.removeAllRanges(),c&&1==b.length?this.addRange(b[0],"backward"):this.setRanges(b)},da.containsNode=function(a,b){return this.eachRange(function(c){return c.containsNode(a,b)},!0)||!1},da.getBookmark=function(a){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[a])}},da.moveToBookmark=function(b){for(var c,d,e=[],f=0;c=b.rangeBookmarks[f++];)d=a.createRange(this.win),d.moveToBookmark(c),e.push(d);b.backward?this.setSingleRange(e[0],"backward"):this.setRanges(e)},da.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},da.restoreRanges=function(a){this.removeAllRanges();for(var b,c=0;b=a.ranges[c];++c)this.addRange(b,a.backward&&0==c)},da.toHtml=function(){var a=[];return this.eachRange(function(b){a.push(F.toHtml(b))}),a.join("")},J.implementsTextRange&&(da.getNativeTextRange=function(){var c;if(c=this.docSelection){var d=c.createRange();if(n(d))return d;throw b.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return a.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw b.createError("getNativeTextRange: selection contains no range")}),da.getName=function(){return"WrappedSelection"},da.inspect=function(){return x(this)},da.detach=function(){t(this.win,"delete"),s(this)},r.detachAll=function(){t(null,"deleteAll")},r.inspect=x,r.isDirectionBackward=c,a.Selection=r,a.selectionPrototype=da,a.addShimListener(function(a){"undefined"==typeof a.getSelection&&(a.getSelection=function(){return ca(a)}),a=null})});var M=!1,N=function(a){M||(M=!0,!H.initialized&&H.config.autoInitialize&&l())};return F&&("complete"==document.readyState?N():(a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",N,!1),J(window,"load",N))),H},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("TextRange",["WrappedSelection"],function(a,b){function c(a,b){function c(a,b,c){h.push({start:a,end:b,isWord:c})}for(var d,e,f,g=a.join(""),h=[],i=0;d=b.wordRegex.exec(g);){if(e=d.index,f=e+d[0].length,e>i&&c(i,e,!1),b.includeTrailingSpace)for(;$.test(a[f]);)++f;c(e,f,!0),i=f}return ie;++e)c[e].token=d;return d}function e(a,b,c){for(var e,f=c(a,b),g=[],h=0;e=f[h++];)g.push(d(a,e));return g}function f(a){var b=a||"",c="string"==typeof b?b.split(""):b;return c.sort(function(a,b){return a.charCodeAt(0)-b.charCodeAt(0)}),c.join("").replace(/(.)\1+/g,"$1")}function g(a){var b,c;return a?(b=a.language||_,c={},U(c,ia[b]||ia[_]),U(c,a),c):ia[_]}function h(a,b){var c=V(a,b);return b.hasOwnProperty("wordOptions")&&(c.wordOptions=g(c.wordOptions)),b.hasOwnProperty("characterOptions")&&(c.characterOptions=V(c.characterOptions,ga)),c}function i(a,b){var c=na(a,"display",b),d=a.tagName.toLowerCase();return"block"==c&&fa&&oa.hasOwnProperty(d)?oa[d]:c}function j(a){for(var b=o(a),c=0,d=b.length;d>c;++c)if(1==b[c].nodeType&&"none"==i(b[c]))return!0;return!1}function k(a){var b;return 3==a.nodeType&&(b=a.parentNode)&&"hidden"==na(b,"visibility")}function l(a){return a&&(1==a.nodeType&&!/^(inline(-block|-table)?|none)$/.test(i(a))||9==a.nodeType||11==a.nodeType)}function m(a){return S.isCharacterDataNode(a)||!/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i.test(a.nodeName)}function n(a){for(var b=[];a.parentNode;)b.unshift(a.parentNode),a=a.parentNode;return b}function o(a){return n(a).concat([a])}function p(a){for(;a&&!a.nextSibling;)a=a.parentNode;return a?a.nextSibling:null}function q(a,b){return!b&&a.hasChildNodes()?a.firstChild:p(a)}function r(a){var b=a.previousSibling;if(b){for(a=b;a.hasChildNodes();)a=a.lastChild;return a}var c=a.parentNode;return c&&1==c.nodeType?c:null}function s(a){if(!a||3!=a.nodeType)return!1;var b=a.data;if(""===b)return!0;var c=a.parentNode;if(!c||1!=c.nodeType)return!1;var d=na(a.parentNode,"whiteSpace");return/^[\t\n\r ]+$/.test(b)&&/^(normal|nowrap)$/.test(d)||/^[\t\r ]+$/.test(b)&&"pre-line"==d}function t(a){if(""===a.data)return!0;if(!s(a))return!1;var b=a.parentNode;return b?j(a)?!0:!1:!0}function u(a){var b=a.nodeType;return 7==b||8==b||j(a)||/^(script|style)$/i.test(a.nodeName)||k(a)||t(a)}function v(a,b){var c=a.nodeType;return 7==c||8==c||1==c&&"none"==i(a,b)}function w(){this.store={}}function x(a,b,c){return function(d){var e=this.cache;if(e.hasOwnProperty(a))return pa++,e[a];qa++;var f=b.call(this,c?this[c]:this,d);return e[a]=f,f}}function y(a,b){this.node=a,this.session=b,this.cache=new w,this.positions=new w}function z(a,b){this.offset=b,this.nodeWrapper=a,this.node=a.node,this.session=a.session,this.cache=new w}function A(){return"[Position("+S.inspectNode(this.node)+":"+this.offset+")]"}function B(){return D(),Da=new Ea}function C(){return Da||B()}function D(){Da&&Da.detach(),Da=null}function E(a,c,d,e){function f(){var a=null;return c?(a=h,i||(h=h.previousVisible(),i=!h||d&&h.equals(d))):i||(a=h=h.nextVisible(),i=!h||d&&h.equals(d)),i&&(h=null),a}d&&(c?u(d.node)&&(d=a.previousVisible()):u(d.node)&&(d=d.nextVisible()));var g,h=a,i=!1,j=!1;return{next:function(){if(j)return j=!1,g;for(var a,b;a=f();)if(b=a.getCharacter(e))return g=a,a;return null},rewind:function(){if(!g)throw b.createError("createCharacterIterator: cannot rewind. Only one position can be rewound.");j=!0},dispose:function(){a=d=null}}}function F(a,b,c){function d(a){for(var b,c,d=[],e=a?f:g,h=!1,i=!1;b=e.next();){if(c=b.character,Z.test(c))i&&(i=!1,h=!0);else{if(h){e.rewind();break}i=!0}d.push(b)}return d}var f=E(a,!1,null,b),g=E(a,!0,null,b),h=c.tokenizer,i=d(!0),j=d(!1).reverse(),k=e(j.concat(i),c,h),l=i.length?k.slice(Fa(k,i[0].token)):[],m=j.length?k.slice(0,Fa(k,j.pop().token)+1):[];return{nextEndToken:function(){for(var a,b;1==l.length&&!(a=l[0]).isWord&&(b=d(!0)).length>0;)l=e(a.chars.concat(b),c,h);return l.shift()},previousStartToken:function(){for(var a,b;1==m.length&&!(a=m[0]).isWord&&(b=d(!1)).length>0;)m=e(b.reverse().concat(a.chars),c,h);return m.pop()},dispose:function(){f.dispose(),g.dispose(),l=m=null}}}function G(a,b,c,d,e){var f,g,h,i,j=0,k=a,l=Math.abs(c);if(0!==c){var m=0>c;switch(b){case Q:for(g=E(a,m,null,d);(f=g.next())&&l>j;)++j,k=f;h=f,g.dispose();break;case R:for(var n=F(a,d,e),o=m?n.previousStartToken:n.nextEndToken;(i=o())&&l>j;)i.isWord&&(++j,k=m?i.chars[0]:i.chars[i.chars.length-1]);break;default:throw new Error("movePositionBy: unit '"+b+"' not implemented")}m?(k=k.previousVisible(),j=-j):k&&k.isLeadingSpace&&!k.isTrailingSpace&&(b==R&&(g=E(a,!1,null,d),h=g.next(),g.dispose()),h&&(k=h.previousVisible()))}return{position:k,unitsMoved:j}}function H(a,b,c,d){var e=a.getRangeBoundaryPosition(b,!0),f=a.getRangeBoundaryPosition(b,!1),g=d?f:e,h=d?e:f;return E(g,!!d,h,c)}function I(a,b,c){for(var d,e=[],f=H(a,b,c);d=f.next();)e.push(d);return f.dispose(),e}function J(b,c,d){var e=a.createRange(b.node);return e.setStartAndEnd(b.node,b.offset,c.node,c.offset),!e.expand("word",{wordOptions:d})}function K(a,b,c,d,e){function f(a,b){var c=p[a].previousVisible(),d=p[b-1],f=!e.wholeWordsOnly||J(c,d,e.wordOptions);return{startPos:c,endPos:d,valid:f}}for(var g,h,i,j,k,l,m=aa(e.direction),n=E(a,m,a.session.getRangeBoundaryPosition(d,m),e.characterOptions),o="",p=[],q=null;g=n.next();)if(h=g.character,c||e.caseSensitive||(h=h.toLowerCase()),m?(p.unshift(g),o=h+o):(p.push(g),o+=h),c){if(k=b.exec(o))if(i=k.index,j=i+k[0].length,l){if(!m&&j0){q=f(i,j);break}}else l=!0}else if(-1!=(i=o.indexOf(b))){q=f(i,i+b.length);break}return l&&(q=f(i,j)),n.dispose(),q}function L(a){return function(){var b=!!Da,c=C(),d=[c].concat(T.toArray(arguments)),e=a.apply(this,d);return b||D(),e}}function M(a,b){return L(function(c,d,e,f){typeof e==P&&(e=d,d=Q),f=h(f,ka);var g=a;b&&(g=e>=0,this.collapse(!g));var i=G(c.getRangeBoundaryPosition(this,g),d,e,f.characterOptions,f.wordOptions),j=i.position;return this[g?"setStart":"setEnd"](j.node,j.offset),i.unitsMoved})}function N(a){return L(function(b,c){c=V(c,ga);for(var d,e=H(b,this,c,!a),f=0;(d=e.next())&&Z.test(d.character);)++f;e.dispose();var g=f>0;return g&&this[a?"moveStart":"moveEnd"]("character",a?f:-f,{characterOptions:c}),g})}function O(a){return L(function(b,c){var d=!1;return this.changeEachRange(function(b){d=b[a](c)||d}),d})}var P="undefined",Q="character",R="word",S=a.dom,T=a.util,U=T.extend,V=T.createOptions,W=S.getBody,X=/^[ \t\f\r\n]+$/,Y=/^[ \t\f\r]+$/,Z=/^[\t-\r \u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/,$=/^[\t \u00A0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000]+$/,_="en",aa=a.Selection.isDirectionBackward,ba=!1,ca=!1,da=!1,ea=!0;!function(){var b=S.createTestElement(document,"

    1

    ",!0),c=b.firstChild,d=a.getSelection();d.collapse(c.lastChild,2),d.setStart(c.firstChild,0),ba=1==(""+d).length,b.innerHTML="1
    ",d.collapse(b,2),d.setStart(b.firstChild,0),ca=1==(""+d).length,b.innerHTML="1

    1

    ",d.collapse(b,2),d.setStart(b.firstChild,0),da=1==(""+d).length,S.removeNode(b),d.removeAllRanges()}();var fa,ga={includeBlockContentTrailingSpace:!0,includeSpaceBeforeBr:!0,includeSpaceBeforeBlock:!0,includePreLineTrailingSpace:!0,ignoreCharacters:""},ha={includeBlockContentTrailingSpace:!ea,includeSpaceBeforeBr:!ca,includeSpaceBeforeBlock:!da,includePreLineTrailingSpace:!0},ia={en:{wordRegex:/[a-z0-9]+('[a-z0-9]+)*/gi,includeTrailingSpace:!1,tokenizer:c}},ja={caseSensitive:!1,withinRange:null,wholeWordsOnly:!1,wrap:!1,direction:"forward",wordOptions:null,characterOptions:null},ka={wordOptions:null,characterOptions:null},la={wordOptions:null,characterOptions:null,trim:!1,trimStart:!0,trimEnd:!0},ma={wordOptions:null,characterOptions:null,direction:"forward"},na=S.getComputedStyleProperty;!function(){var a=document.createElement("table"),b=W(document);b.appendChild(a),fa="block"==na(a,"display"),b.removeChild(a)}();var oa={table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell"};w.prototype={get:function(a){return this.store.hasOwnProperty(a)?this.store[a]:null},set:function(a,b){return this.store[a]=b}};var pa=0,qa=0,ra={getPosition:function(a){var b=this.positions;return b.get(a)||b.set(a,new z(this,a))},toString:function(){return"[NodeWrapper("+S.inspectNode(this.node)+")]"}};y.prototype=ra;var sa="EMPTY",ta="NON_SPACE",ua="UNCOLLAPSIBLE_SPACE",va="COLLAPSIBLE_SPACE",wa="TRAILING_SPACE_BEFORE_BLOCK",xa="TRAILING_SPACE_IN_BLOCK",ya="TRAILING_SPACE_BEFORE_BR",za="PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK",Aa="TRAILING_LINE_BREAK_AFTER_BR",Ba="INCLUDED_TRAILING_LINE_BREAK_AFTER_BR";U(ra,{isCharacterDataNode:x("isCharacterDataNode",S.isCharacterDataNode,"node"),getNodeIndex:x("nodeIndex",S.getNodeIndex,"node"),getLength:x("nodeLength",S.getNodeLength,"node"), +containsPositions:x("containsPositions",m,"node"),isWhitespace:x("isWhitespace",s,"node"),isCollapsedWhitespace:x("isCollapsedWhitespace",t,"node"),getComputedDisplay:x("computedDisplay",i,"node"),isCollapsed:x("collapsed",u,"node"),isIgnored:x("ignored",v,"node"),next:x("nextPos",q,"node"),previous:x("previous",r,"node"),getTextNodeInfo:x("textNodeInfo",function(a){var b=null,c=!1,d=na(a.parentNode,"whiteSpace"),e="pre-line"==d;return e?(b=Y,c=!0):("normal"==d||"nowrap"==d)&&(b=X,c=!0),{node:a,text:a.data,spaceRegex:b,collapseSpaces:c,preLine:e}},"node"),hasInnerText:x("hasInnerText",function(a,b){for(var c=this.session,d=c.getPosition(a.parentNode,this.getNodeIndex()+1),e=c.getPosition(a,0),f=b?d:e,g=b?e:d;f!==g;){if(f.prepopulateChar(),f.isDefinitelyNonEmpty())return!0;f=b?f.previousVisible():f.nextVisible()}return!1},"node"),isRenderedBlock:x("isRenderedBlock",function(a){for(var b=a.getElementsByTagName("br"),c=0,d=b.length;d>c;++c)if(!u(b[c]))return!0;return this.hasInnerText()},"node"),getTrailingSpace:x("trailingSpace",function(a){if("br"==a.tagName.toLowerCase())return"";switch(this.getComputedDisplay()){case"inline":for(var b=a.lastChild;b;){if(!v(b))return 1==b.nodeType?this.session.getNodeWrapper(b).getTrailingSpace():"";b=b.previousSibling}break;case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":break;case"table-cell":return" ";default:return this.isRenderedBlock(!0)?"\n":""}return""},"node"),getLeadingSpace:x("leadingSpace",function(a){switch(this.getComputedDisplay()){case"inline":case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":case"table-cell":break;default:return this.isRenderedBlock(!1)?"\n":""}return""},"node")});var Ca={character:"",characterType:sa,isBr:!1,prepopulateChar:function(){var a=this;if(!a.prepopulatedChar){var b=a.node,c=a.offset,d="",e=sa,f=!1;if(c>0)if(3==b.nodeType){var g=b.data,h=g.charAt(c-1),i=a.nodeWrapper.getTextNodeInfo(),j=i.spaceRegex;i.collapseSpaces?j.test(h)?c>1&&j.test(g.charAt(c-2))||(i.preLine&&"\n"===g.charAt(c)?(d=" ",e=za):(d=" ",e=va)):(d=h,e=ta,f=!0):(d=h,e=ua,f=!0)}else{var k=b.childNodes[c-1];if(k&&1==k.nodeType&&!u(k)&&("br"==k.tagName.toLowerCase()?(d="\n",a.isBr=!0,e=va,f=!1):a.checkForTrailingSpace=!0),!d){var l=b.childNodes[c];l&&1==l.nodeType&&!u(l)&&(a.checkForLeadingSpace=!0)}}a.prepopulatedChar=!0,a.character=d,a.characterType=e,a.isCharInvariant=f}},isDefinitelyNonEmpty:function(){var a=this.characterType;return a==ta||a==ua},resolveLeadingAndTrailingSpaces:function(){if(this.prepopulatedChar||this.prepopulateChar(),this.checkForTrailingSpace){var a=this.session.getNodeWrapper(this.node.childNodes[this.offset-1]).getTrailingSpace();a&&(this.isTrailingSpace=!0,this.character=a,this.characterType=va),this.checkForTrailingSpace=!1}if(this.checkForLeadingSpace){var b=this.session.getNodeWrapper(this.node.childNodes[this.offset]).getLeadingSpace();b&&(this.isLeadingSpace=!0,this.character=b,this.characterType=va),this.checkForLeadingSpace=!1}},getPrecedingUncollapsedPosition:function(a){for(var b,c=this;c=c.previousVisible();)if(b=c.getCharacter(a),""!==b)return c;return null},getCharacter:function(a){function b(){return n||(k=o.getPrecedingUncollapsedPosition(a),n=!0),k}this.resolveLeadingAndTrailingSpaces();var c,d=this.character,e=f(a.ignoreCharacters),g=""!==d&&e.indexOf(d)>-1;if(this.isCharInvariant)return c=g?"":d;var h=["character",a.includeSpaceBeforeBr,a.includeBlockContentTrailingSpace,a.includePreLineTrailingSpace,e].join("_"),i=this.cache.get(h);if(null!==i)return i;var j,k,l="",m=this.characterType==va,n=!1,o=this;return m&&(this.type==Ba?l="\n":" "==d&&(!b()||k.isTrailingSpace||"\n"==k.character||" "==k.character&&k.characterType==va)||("\n"==d&&this.isLeadingSpace?b()&&"\n"!=k.character&&(l="\n"):(j=this.nextUncollapsed(),j&&(j.isBr?this.type=ya:j.isTrailingSpace&&"\n"==j.character?this.type=xa:j.isLeadingSpace&&"\n"==j.character&&(this.type=wa),"\n"==j.character?(this.type!=ya||a.includeSpaceBeforeBr)&&(this.type!=wa||a.includeSpaceBeforeBlock)&&(this.type==xa&&j.isTrailingSpace&&!a.includeBlockContentTrailingSpace||(this.type!=za||j.type!=ta||a.includePreLineTrailingSpace)&&("\n"==d?j.isTrailingSpace?this.isTrailingSpace||this.isBr&&(j.type=Aa,b()&&k.isLeadingSpace&&!k.isTrailingSpace&&"\n"==k.character?j.character="":j.type=Ba):l="\n":" "==d&&(l=" "))):l=d)))),e.indexOf(l)>-1&&(l=""),this.cache.set(h,l),l},equals:function(a){return!!a&&this.node===a.node&&this.offset===a.offset},inspect:A,toString:function(){return this.character}};z.prototype=Ca,U(Ca,{next:x("nextPos",function(a){var b=a.nodeWrapper,c=a.node,d=a.offset,e=b.session;if(!c)return null;var f,g,h;return d==b.getLength()?(f=c.parentNode,g=f?b.getNodeIndex()+1:0):b.isCharacterDataNode()?(f=c,g=d+1):(h=c.childNodes[d],e.getNodeWrapper(h).containsPositions()?(f=h,g=0):(f=c,g=d+1)),f?e.getPosition(f,g):null}),previous:x("previous",function(a){var b,c,d,e=a.nodeWrapper,f=a.node,g=a.offset,h=e.session;return 0==g?(b=f.parentNode,c=b?e.getNodeIndex():0):e.isCharacterDataNode()?(b=f,c=g-1):(d=f.childNodes[g-1],h.getNodeWrapper(d).containsPositions()?(b=d,c=S.getNodeLength(d)):(b=f,c=g-1)),b?h.getPosition(b,c):null}),nextVisible:x("nextVisible",function(a){var b=a.next();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex()+1)),e}),nextUncollapsed:x("nextUncollapsed",function(a){for(var b=a;b=b.nextVisible();)if(b.resolveLeadingAndTrailingSpaces(),""!==b.character)return b;return null}),previousVisible:x("previousVisible",function(a){var b=a.previous();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex())),e})});var Da=null,Ea=function(){function a(a){var b=new w;return{get:function(c){var d=b.get(c[a]);if(d)for(var e,f=0;e=d[f++];)if(e.node===c)return e;return null},set:function(c){var d=c.node[a],e=b.get(d)||b.set(d,[]);e.push(c)}}}function b(){this.initCaches()}var c=T.isHostProperty(document.documentElement,"uniqueID");return b.prototype={initCaches:function(){this.elementCache=c?function(){var a=new w;return{get:function(b){return a.get(b.uniqueID)},set:function(b){a.set(b.node.uniqueID,b)}}}():a("tagName"),this.textNodeCache=a("data"),this.otherNodeCache=a("nodeName")},getNodeWrapper:function(a){var b;switch(a.nodeType){case 1:b=this.elementCache;break;case 3:b=this.textNodeCache;break;default:b=this.otherNodeCache}var c=b.get(a);return c||(c=new y(a,this),b.set(c)),c},getPosition:function(a,b){return this.getNodeWrapper(a).getPosition(b)},getRangeBoundaryPosition:function(a,b){var c=b?"start":"end";return this.getPosition(a[c+"Container"],a[c+"Offset"])},detach:function(){this.elementCache=this.textNodeCache=this.otherNodeCache=null}},b}();U(S,{nextNode:q,previousNode:r});var Fa=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)if(a[c]===b)return c;return-1};U(a.rangePrototype,{moveStart:M(!0,!1),moveEnd:M(!1,!1),move:M(!0,!0),trimStart:N(!0),trimEnd:N(!1),trim:L(function(a,b){var c=this.trimStart(b),d=this.trimEnd(b);return c||d}),expand:L(function(a,b,c){var d=!1;c=h(c,la);var e=c.characterOptions;if(b||(b=Q),b==R){var f,g,i=c.wordOptions,j=a.getRangeBoundaryPosition(this,!0),k=a.getRangeBoundaryPosition(this,!1),l=F(j,e,i),m=l.nextEndToken(),n=m.chars[0].previousVisible();if(this.collapsed)f=m;else{var o=F(k,e,i);f=o.previousStartToken()}return g=f.chars[f.chars.length-1],n.equals(j)||(this.setStart(n.node,n.offset),d=!0),g&&!g.equals(k)&&(this.setEnd(g.node,g.offset),d=!0),c.trim&&(c.trimStart&&(d=this.trimStart(e)||d),c.trimEnd&&(d=this.trimEnd(e)||d)),d}return this.moveEnd(Q,1,c)}),text:L(function(a,b){return this.collapsed?"":I(a,this,V(b,ga)).join("")}),selectCharacters:L(function(a,b,c,d,e){var f={characterOptions:e};b||(b=W(this.getDocument())),this.selectNodeContents(b),this.collapse(!0),this.moveStart("character",c,f),this.collapse(!0),this.moveEnd("character",d-c,f)}),toCharacterRange:L(function(a,b,c){b||(b=W(this.getDocument()));var d,e,f=b.parentNode,g=S.getNodeIndex(b),h=-1==S.comparePoints(this.startContainer,this.endContainer,f,g),i=this.cloneRange();return h?(i.setStartAndEnd(this.startContainer,this.startOffset,f,g),d=-i.text(c).length):(i.setStartAndEnd(f,g,this.startContainer,this.startOffset),d=i.text(c).length),e=d+this.text(c).length,{start:d,end:e}}),findText:L(function(b,c,d){d=h(d,ja),d.wholeWordsOnly&&(d.wordOptions.includeTrailingSpace=!1);var e=aa(d.direction),f=d.withinRange;f||(f=a.createRange(),f.selectNodeContents(this.getDocument()));var g=c,i=!1;"string"==typeof g?d.caseSensitive||(g=g.toLowerCase()):i=!0;var j=b.getRangeBoundaryPosition(this,!e),k=f.comparePoint(j.node,j.offset);-1===k?j=b.getRangeBoundaryPosition(f,!0):1===k&&(j=b.getRangeBoundaryPosition(f,!1));for(var l,m=j,n=!1;;)if(l=K(m,g,i,f,d)){if(l.valid)return this.setStartAndEnd(l.startPos.node,l.startPos.offset,l.endPos.node,l.endPos.offset),!0;m=e?l.startPos:l.endPos}else{if(!d.wrap||n)return!1;f=f.cloneRange(),m=b.getRangeBoundaryPosition(f,!e),f.setBoundary(j.node,j.offset,e),n=!0}}),pasteHtml:function(a){if(this.deleteContents(),a){var b=this.createContextualFragment(a),c=b.lastChild;this.insertNode(b),this.collapseAfter(c)}}}),U(a.selectionPrototype,{expand:L(function(a,b,c){this.changeEachRange(function(a){a.expand(b,c)})}),move:L(function(a,b,c,d){var e=0;if(this.focusNode){this.collapse(this.focusNode,this.focusOffset);var f=this.getRangeAt(0);d||(d={}),d.characterOptions=V(d.characterOptions,ha),e=f.move(b,c,d),this.setSingleRange(f)}return e}),trimStart:O("trimStart"),trimEnd:O("trimEnd"),trim:O("trim"),selectCharacters:L(function(b,c,d,e,f,g){var h=a.createRange(c);h.selectCharacters(c,d,e,g),this.setSingleRange(h,f)}),saveCharacterRanges:L(function(a,b,c){for(var d=this.getAllRanges(),e=d.length,f=[],g=1==e&&this.isBackward(),h=0,i=d.length;i>h;++h)f[h]={characterRange:d[h].toCharacterRange(b,c),backward:g,characterOptions:c};return f}),restoreCharacterRanges:L(function(b,c,d){this.removeAllRanges();for(var e,f,g,h=0,i=d.length;i>h;++h)f=d[h],g=f.characterRange,e=a.createRange(c),e.selectCharacters(c,g.start,g.end,f.characterOptions),this.addRange(e,f.backward)}),text:L(function(a,b){for(var c=[],d=0,e=this.rangeCount;e>d;++d)c[d]=this.getRangeAt(d).text(b);return c.join("")})}),a.innerText=function(b,c){var d=a.createRange(b);d.selectNodeContents(b);var e=d.text(c);return e},a.createWordIterator=function(a,b,c){var d=C();c=h(c,ma);var e=d.getPosition(a,b),f=F(e,c.characterOptions,c.wordOptions),g=aa(c.direction);return{next:function(){return g?f.previousStartToken():f.nextEndToken()},dispose:function(){f.dispose(),this.next=function(){}}}},a.noMutation=function(a){var b=C();a(b),D()},a.noMutation.createEntryPointFunction=L,a.textRange={isBlockNode:l,isCollapsedWhitespaceNode:t,createPosition:L(function(a,b,c){return a.getPosition(b,c)})}}),a},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("SaveRestore",["WrappedRange"],function(a,b){function c(a,b){return(b||document).getElementById(a)}function d(a,b){var c,d="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),e=o.getDocument(a.startContainer),f=a.cloneRange();return f.collapse(b),c=e.createElement("span"),c.id=d,c.style.lineHeight="0",c.style.display="none",c.className="rangySelectionBoundary",c.appendChild(e.createTextNode(r)),f.insertNode(c),c}function e(a,d,e,f){var g=c(e,a);g?(d[f?"setStartBefore":"setEndBefore"](g),p(g)):b.warn("Marker element has been removed. Cannot restore selection.")}function f(a,b){return b.compareBoundaryPoints(a.START_TO_START,a)}function g(b,c){var e,f,g=a.DomRange.getRangeDocument(b),h=b.toString(),i=q(c);return b.collapsed?(f=d(b,!1),{document:g,markerId:f.id,collapsed:!0}):(f=d(b,!1),e=d(b,!0),{document:g,startMarkerId:e.id,endMarkerId:f.id,collapsed:!1,backward:i,toString:function(){return"original text: '"+h+"', new text: '"+b.toString()+"'"}})}function h(d,f){var g=d.document;"undefined"==typeof f&&(f=!0);var h=a.createRange(g);if(d.collapsed){var i=c(d.markerId,g);if(i){i.style.display="inline";var j=i.previousSibling;j&&3==j.nodeType?(p(i),h.collapseToPoint(j,j.length)):(h.collapseBefore(i),p(i))}else b.warn("Marker element has been removed. Cannot restore selection.")}else e(g,h,d.startMarkerId,!0),e(g,h,d.endMarkerId,!1);return f&&h.normalizeBoundaries(),h}function i(b,d){var e,h,i=[],j=q(d);b=b.slice(0),b.sort(f);for(var k=0,l=b.length;l>k;++k)i[k]=g(b[k],j);for(k=l-1;k>=0;--k)e=b[k],h=a.DomRange.getRangeDocument(e),e.collapsed?e.collapseAfter(c(i[k].markerId,h)):(e.setEndBefore(c(i[k].endMarkerId,h)),e.setStartAfter(c(i[k].startMarkerId,h)));return i}function j(c){if(!a.isSelectionValid(c))return b.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var d=a.getSelection(c),e=d.getAllRanges(),f=1==e.length&&d.isBackward(),g=i(e,f);return f?d.setSingleRange(e[0],f):d.setRanges(e),{win:c,rangeInfos:g,restored:!1}}function k(a){for(var b=[],c=a.length,d=c-1;d>=0;d--)b[d]=h(a[d],!0);return b}function l(b,c){if(!b.restored){var d=b.rangeInfos,e=a.getSelection(b.win),f=k(d),g=d.length;1==g&&c&&a.features.selectionHasExtend&&d[0].backward?(e.removeAllRanges(),e.addRange(f[0],!0)):e.setRanges(f),b.restored=!0}}function m(a,b){var d=c(b,a);d&&p(d)}function n(a){for(var b,c=a.rangeInfos,d=0,e=c.length;e>d;++d)b=c[d],b.collapsed?m(a.doc,b.markerId):(m(a.doc,b.startMarkerId),m(a.doc,b.endMarkerId))}var o=a.dom,p=o.removeNode,q=a.Selection.isDirectionBackward,r="\ufeff";a.util.extend(a,{saveRange:g,restoreRange:h,saveRanges:i,restoreRanges:k,saveSelection:j,restoreSelection:l,removeMarkerElement:m,removeMarkers:n})}),a},this);var b=function(){};b.extend=function(a,c){var d=b.prototype.extend;b._prototyping=!0;var e=new this;d.call(e,a),e.base=function(){},delete b._prototyping;var f=e.constructor,g=e.constructor=function(){if(!b._prototyping)if(this._constructing||this.constructor==g)this._constructing=!0,f.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||d).call(arguments[0],e)};return g.ancestor=this,g.extend=this.extend,g.forEach=this.forEach,g.implement=this.implement,g.prototype=e,g.toString=this.toString,g.valueOf=function(a){return"object"==a?g:f.valueOf()},d.call(g,c),"function"==typeof g.init&&g.init(),g},b.prototype={extend:function(a,c){if(arguments.length>1){var d=this[a];if(d&&"function"==typeof c&&(!d.valueOf||d.valueOf()!=c.valueOf())&&/\bbase\b/.test(c)){var e=c.valueOf();c=function(){var a=this.base||b.prototype.base;this.base=d;var c=e.apply(this,arguments);return this.base=a,c},c.valueOf=function(a){return"object"==a?c:e},c.toString=b.toString}this[a]=c}else if(a){var f=b.prototype.extend;b._prototyping||"function"==typeof this||(f=this.extend||f);for(var g={toSource:null},h=["constructor","toString","valueOf"],i=b._prototyping?0:1;j=h[i++];)a[j]!=g[j]&&f.call(this,j,a[j]);for(var j in a)g[j]||f.call(this,j,a[j])}return this}},b=b.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(a,b,c){for(var d in a)void 0===this.prototype[d]&&b.call(c,a[d],d,a)},implement:function(){for(var a=0;a-1?c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"):/Edge\/(\d+)./i.test(navigator.userAgent)&&(c=/Edge\/(\d+)./i)),c&&null!=c.exec(navigator.userAgent)&&(d=parseFloat(RegExp.$1)),-1===d?!1:a?b?"<"===b?d>a:">"===b?a>d:"<="===b?d>=a:">="===b?a>=d:void 0:a===d:!0}var d=navigator.userAgent,e=document.createElement("div"),f=-1!==d.indexOf("Gecko")&&-1===d.indexOf("KHTML")&&!c(),g=-1!==d.indexOf("AppleWebKit/")&&!c(),h=-1!==d.indexOf("Chrome/")&&!c(),i=-1!==d.indexOf("Opera/")&&!c();return{USER_AGENT:d,supported:function(){var c=this.USER_AGENT.toLowerCase(),d="contentEditable"in e,f=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,g=document.querySelector&&document.querySelectorAll,h=this.isIos()&&a(c)<5||this.isAndroid()&&b(c)<4||-1!==c.indexOf("opera mobi")||-1!==c.indexOf("hpwos/");return d&&f&&g&&!h},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){return/ipad|iphone|ipod/i.test(this.USER_AGENT)},isAndroid:function(){return-1!==this.USER_AGENT.indexOf("Android")},supportsSandboxedIframes:function(){return c()},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return c(12,">")},hasCurrentStyleProperty:function(){return"currentStyle"in e},insertsLineBreaksOnReturn:function(){return f},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){return"on"+a in e||function(){return e.setAttribute("on"+a,"return;"),"function"==typeof e["on"+a]}()},supportsEventsInIframeCorrectly:function(){return!i},supportsHTML5Tags:function(a){var b=a.createElement("div"),c="
    foo
    ";return b.innerHTML=c,b.innerHTML.toLowerCase()===c},supportsCommand:function(){var a={formatBlock:c(10,"<="),insertUnorderedList:c(),insertOrderedList:c()},b={insertHTML:f};return function(c,d){var e=a[d];if(!e){try{return c.queryCommandSupported(d)}catch(f){}try{return c.queryCommandEnabled(d)}catch(g){return!!b[d]}}return!1}}(),doesAutoLinkingInContentEditable:function(){return c()},canDisableAutoLinking:function(){return this.supportsCommand(document,"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return f||i||g},supportsGetAttributeCorrectly:function(){var a=document.createElement("td");return"1"!=a.getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return f||c()||i},autoScrollsToCaret:function(){return!g},autoClosesUnclosedTags:function(){var a,b,c=e.cloneNode(!1);return c.innerHTML="

    ",b=c.innerHTML.toLowerCase(),a="

    "===b||"

    "===b,this.autoClosesUnclosedTags=function(){return a},a},supportsNativeGetElementsByClassName:function(){return-1!==String(document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},needsSpaceAfterLineBreak:function(){return i},supportsSpeechApiOn:function(a){var b=d.match(/Chrome\/(\d+)/)||[void 0,0];return b[1]>=11&&("onwebkitspeechchange"in a||"speech"in a)},crashesWhenDefineProperty:function(a){return c(9)&&("XMLHttpRequest"===a||"XDomainRequest"===a)},doesAsyncFocus:function(){return c(12,">")},hasProblemsSettingCaretAfterImg:function(){return c()},hasLiDeletingProblem:function(){return c()},hasUndoInContextMenu:function(){return f||h||i},hasInsertNodeIssue:function(){return i},hasIframeFocusIssue:function(){return c()},createsNestedInvalidMarkupAfterPaste:function(){return g},hasCaretBlockElementIssue:function(){return g},supportsMutationEvents:function(){return"MutationEvent"in window},supportsModernPaste:function(){return!c()},fixStyleKey:function(a){return"cssFloat"===a?"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat":a},usesControlRanges:function(){return document.body&&"createControlRange"in document.body}}}(),a.lang.array=function(b){return{contains:function(c){if(Array.isArray(c)){for(var d=c.length;d--;)if(-1!==a.lang.array(b).indexOf(c[d]))return!0;return!1}return-1!==a.lang.array(b).indexOf(c)},indexOf:function(a){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;d>c;c++)if(b[c]===a)return c;return-1},without:function(c){c=a.lang.array(c);for(var d=[],e=0,f=b.length;f>e;e++)c.contains(b[e])||d.push(b[e]);return d},get:function(){for(var a=0,c=b.length,d=[];c>a;a++)d.push(b[a]);return d},map:function(a,c){if(Array.prototype.map)return b.map(a,c);for(var d=b.length>>>0,e=new Array(d),f=0;d>f;f++)e[f]=a.call(c,b[f],f,b);return e},unique:function(){for(var c=[],d=b.length,e=0;d>e;)a.lang.array(c).contains(b[e])||c.push(b[e]),e++;return c}}},a.lang.Dispatcher=b.extend({on:function(a,b){return this.events=this.events||{},this.events[a]=this.events[a]||[],this.events[a].push(b),this},off:function(a,b){this.events=this.events||{};var c,d,e=0;if(a){for(c=this.events[a]||[],d=[];e\t"]/g,e={"&":"&","<":"<",">":">",'"':"""," ":"  "};a.lang.string=function(a){return a=String(a),{trim:function(){return a.replace(b,"").replace(c,"")},interpolate:function(b){for(var c in b)a=this.replace("#{"+c+"}").by(b[c]);return a},replace:function(b){return{by:function(c){return a.split(b).join(c)}}},escapeHTML:function(b,c){var f=a.replace(d,function(a){return e[a]});return b&&(f=f.replace(/(?:\r\n|\r|\n)/g,"
    ")),c&&(f=f.replace(/ /gi,"  ")),f}}}}(),function(a){function b(a,b){return f(a,b)?a:(a===a.ownerDocument.documentElement&&(a=a.ownerDocument.body),g(a,b))}function c(a){return a.replace(i,function(a,b){var c=(b.match(j)||[])[1]||"",d=l[c];b=b.replace(j,""),b.split(d).length>b.split(c).length&&(b+=c,c="");var e=b,f=b;return b.length>k&&(f=f.substr(0,k)+"..."),"www."===e.substr(0,4)&&(e="http://"+e),''+f+""+c})}function d(a){var b=a._wysihtml5_tempElement;return b||(b=a._wysihtml5_tempElement=a.createElement("div")),b}function e(b){var e=b.parentNode,f=a.lang.string(b.data).escapeHTML(),g=d(e.ownerDocument);for(g.innerHTML=""+c(f),g.removeChild(g.firstChild);g.firstChild;)e.insertBefore(g.firstChild,b);e.removeChild(b)}function f(b,c){for(var d;b.parentNode;){if(b=b.parentNode,d=b.nodeName,b.className&&a.lang.array(b.className.split(" ")).contains(c))return!0;if(h.contains(d))return!0;if("body"===d)return!1}return!1}function g(b,c){if(!(h.contains(b.nodeName)||b.className&&a.lang.array(b.className.split(" ")).contains(c))){if(b.nodeType===a.TEXT_NODE&&b.data.match(i))return void e(b);for(var d=a.lang.array(b.childNodes).get(),f=d.length,j=0;f>j;j++)g(d[j],c);return b}}var h=a.lang.array(["CODE","PRE","A","SCRIPT","HEAD","TITLE","STYLE"]),i=/((https?:\/\/|www\.)[^\s<]{3,})/gi,j=/([^\w\/\-](,?))$/i,k=100,l={")":"(","]":"[","}":"{"};a.dom.autoLink=b,a.dom.autoLink.URL_REG_EXP=i}(a),function(a){var b=a.dom;b.addClass=function(a,c){var d=a.classList;return d?d.add(c):void(b.hasClass(a,c)||(a.className+=" "+c))},b.removeClass=function(a,b){var c=a.classList;return c?c.remove(b):void(a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," "))},b.hasClass=function(a,b){var c=a.classList;if(c)return c.contains(b);var d=a.className;return d.length>0&&(d==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(d))}}(a),a.dom.contains=function(){var b=document.documentElement;return b.contains?function(b,c){if(c.nodeType!==a.ELEMENT_NODE){if(c.parentNode===b)return!0;c=c.parentNode}return b!==c&&b.contains(c)}:b.compareDocumentPosition?function(a,b){return!!(16&a.compareDocumentPosition(b))}:void 0}(),a.dom.convertToList=function(){function b(a,b){var c=a.createElement("li");return b.appendChild(c),c}function c(a,b){return a.createElement(b)}function d(d,e,f){if("UL"===d.nodeName||"OL"===d.nodeName||"MENU"===d.nodeName)return d;var g,h,i,j,k,l,m,n,o,p=d.ownerDocument,q=c(p,e),r=d.querySelectorAll("br"),s=r.length;for(o=0;s>o;o++)for(j=r[o];(k=j.parentNode)&&k!==d&&k.lastChild===j;){if("block"===a.dom.getStyle("display").from(k)){k.removeChild(j);break}a.dom.insert(j).after(j.parentNode)}for(g=a.lang.array(d.childNodes).get(),h=g.length,o=0;h>o;o++)n=n||b(p,q),i=g[o],l="block"===a.dom.getStyle("display").from(i),m="BR"===i.nodeName,!l||f&&a.dom.hasClass(i,f)?m?n=n.firstChild?null:n:n.appendChild(i):(n=n.firstChild?b(p,q):n,n.appendChild(i),n=null);return 0===g.length&&b(p,q),d.parentNode.replaceChild(q,d),q}return d}(),a.dom.copyAttributes=function(a){return{from:function(b){return{to:function(c){for(var d,e=0,f=a.length;f>e;e++)d=a[e],"undefined"!=typeof b[d]&&""!==b[d]&&(c[d]=b[d]);return{andTo:arguments.callee}}}}}},function(b){var c=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],d=function(a){return e(a)?parseInt(b.getStyle("width").from(a),10)d;d++)if("border-box"===b.getStyle(c[d]).from(a))return c[d]};b.copyStyles=function(e){return{from:function(f){d(f)&&(e=a.lang.array(e).without(c));for(var g,h="",i=e.length,j=0;i>j;j++)g=e[j],h+=g+":"+b.getStyle(g).from(f)+";";return{to:function(a){return b.setStyles(h).on(a),{andTo:arguments.callee}}}}}}}(a.dom),function(a){a.dom.delegate=function(a,b,c,d){var e=function(c){for(var e=c.target,f=3===e.nodeType?e.parentNode:e,g=a.querySelectorAll(b),h=0,i=g.length;i>h;h++)g[h].contains(f)&&d.call(g[h],c)};return a.addEventListener(c,e,!1),{stop:function(){a.removeEventListener(c,e,!1)}}}}(a),function(a){function b(a,b){for(var c=[a],d=a;b&&d&&d!==b||!b&&d;)c.unshift(d),d=d.parentNode;return c}a.dom.domNode=function(c){var d=[a.ELEMENT_NODE,a.TEXT_NODE];return{is:{emptyTextNode:function(b){var d=b?/^\s*$/g:/^[\r\n]*$/g;return c&&c.nodeType===a.TEXT_NODE&&d.test(c.data)},rangyBookmark:function(){return c&&1===c.nodeType&&c.classList.contains("rangySelectionBoundary")},visible:function(){var b=!/^\s*$/g.test(a.dom.getTextContent(c));return b||1===c.nodeType&&c.querySelector("img, br, hr, object, embed, canvas, input, textarea")&&(b=!0),b},lineBreak:function(){return c&&1===c.nodeType&&"BR"===c.nodeName},block:function(){return c&&1===c.nodeType&&"block"===c.ownerDocument.defaultView.getComputedStyle(c).display},voidElement:function(){return a.dom.domNode(c).test({query:a.VOID_ELEMENTS})}},prev:function(b){var e=c.previousSibling,f=b&&b.nodeTypes?b.nodeTypes:d;return e?a.dom.domNode(e).is.rangyBookmark()||!a.lang.array(f).contains(e.nodeType)||b&&b.ignoreBlankTexts&&a.dom.domNode(e).is.emptyTextNode(!0)?a.dom.domNode(e).prev(b):e:null},next:function(b){var e=c.nextSibling,f=b&&b.nodeTypes?b.nodeTypes:d;return e?a.dom.domNode(e).is.rangyBookmark()||!a.lang.array(f).contains(e.nodeType)||b&&b.ignoreBlankTexts&&a.dom.domNode(e).is.emptyTextNode(!0)?a.dom.domNode(e).next(b):e:null},commonAncestor:function(a,d){var e=b(c,d),f=b(a,d);if(e[0]!=f[0])return null;for(var g=0;g0)for(var f=!1,g=Array.isArray(b.styleProperty)?b.styleProperty:[b.styleProperty],h=0,i=g.length;i>h;h++){if(d=a.browser.fixStyleKey(g[h]),c.style[d]){if(!b.styleValue){f=!0;break}if(b.styleValue instanceof RegExp){if(c.style[d].trim().match(b.styleValue).length>0){f=!0;break}}else if(Array.isArray(b.styleValue)){if(b.styleValue.indexOf(c.style[d].trim())){f=!0;break}}else if(b.styleValue===c.style[d].trim().replace(/, /g,",")){f=!0;break}}if(!f)return!1}if(b.attribute){var j=a.dom.getAttributes(c),k=[],l=!1;Array.isArray(b.attribute)?k=b.attribute:k[b.attribute]=b.attributeValue;for(var m in k)if(k.hasOwnProperty(m))if("undefined"==typeof k[m]){if("undefined"!=typeof j[m]){l=!0;break}}else if(j[m]===k[m]){l=!0;break}if(!l)return!1}return!0}}}}(a),a.dom.getAsDom=function(){var b=function(a,b){var c=b.createElement("div");c.style.display="none",b.body.appendChild(c);try{c.innerHTML=a}catch(d){}return b.body.removeChild(c),c},c=function(a){if(!a._wysihtml5_supportsHTML5Tags){for(var b=0,c=d.length;c>b;b++)a.createElement(d[b]);a._wysihtml5_supportsHTML5Tags=!0}},d=["abbr","article","aside","audio","bdi","canvas","command","datalist","details","figcaption","figure","footer","header","hgroup","keygen","mark","meter","nav","output","progress","rp","rt","ruby","svg","section","source","summary","time","track","video","wbr"];return function(d,e){e=e||document;var f;return"object"==typeof d&&d.nodeType?(f=e.createElement("div"),f.appendChild(d)):a.browser.supportsHTML5Tags(e)?(f=e.createElement("div"),f.innerHTML=d):(c(e),f=b(d,e)),f}}(),a.dom.getParentElement=function(){return function(b,c,d,e){for(d=d||50;d--&&b&&"BODY"!==b.nodeName&&(!e||b!==e);){if(a.dom.domNode(b).test(c))return b;b=b.parentNode}return null}}(),a.dom.getStyle=function(){function b(a){return a.replace(d,function(a){return a.charAt(1).toUpperCase()})}var c={"float":"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat" +},d=/\-[a-z]/g;return function(d){return{from:function(e){if(e.nodeType===a.ELEMENT_NODE){var f=e.ownerDocument,g=c[d]||b(d),h=e.style,i=e.currentStyle,j=h[g];if(j)return j;if(i)try{return i[g]}catch(k){}var l,m,n=f.defaultView||f.parentWindow,o=("height"===d||"width"===d)&&"TEXTAREA"===e.nodeName;return n.getComputedStyle?(o&&(l=h.overflow,h.overflow="hidden"),m=n.getComputedStyle(e,null).getPropertyValue(d),o&&(h.overflow=l||""),m):void 0}}}}}(),a.dom.getTextNodes=function(b,c){var d=[];for(b=b.firstChild;b;b=b.nextSibling)3==b.nodeType?c&&/^\s*$/.test(b.innerText||b.textContent)||d.push(b):d=d.concat(a.dom.getTextNodes(b,c));return d},a.dom.hasElementWithTagName=function(){function a(a){return a._wysihtml5_identifier||(a._wysihtml5_identifier=c++)}var b={},c=1;return function(c,d){var e=a(c)+":"+d,f=b[e];return f||(f=b[e]=c.getElementsByTagName(d)),f.length>0}}(),function(a){function b(a){return a._wysihtml5_identifier||(a._wysihtml5_identifier=d++)}var c={},d=1;a.dom.hasElementWithClassName=function(d,e){if(!a.browser.supportsNativeGetElementsByClassName())return!!d.querySelector("."+e);var f=b(d)+":"+e,g=c[f];return g||(g=c[f]=d.getElementsByClassName(e)),g.length>0}}(a),a.dom.insert=function(a){return{after:function(b){b.parentNode.insertBefore(a,b.nextSibling)},before:function(b){b.parentNode.insertBefore(a,b)},into:function(b){b.appendChild(a)}}},a.dom.insertCSS=function(a){return a=a.join("\n"),{into:function(b){var c=b.createElement("style");c.type="text/css",c.styleSheet?c.styleSheet.cssText=a:c.appendChild(b.createTextNode(a));var d=b.querySelector("head link");if(d)return void d.parentNode.insertBefore(c,d);var e=b.querySelector("head");e&&e.appendChild(c)}}},function(a){a.dom.lineBreaks=function(b){function c(a){return"BR"===a.nodeName}function d(b){return c(b)?!0:"block"===a.dom.getStyle("display").from(b)?!0:!1}return{add:function(c){var e=b.ownerDocument,f=a.dom.domNode(b).next({ignoreBlankTexts:!0}),g=a.dom.domNode(b).prev({ignoreBlankTexts:!0});f&&!d(f)&&a.dom.insert(e.createElement("br")).after(b),g&&!d(g)&&a.dom.insert(e.createElement("br")).before(b)},remove:function(d){var e=a.dom.domNode(b).next({ignoreBlankTexts:!0}),f=a.dom.domNode(b).prev({ignoreBlankTexts:!0});e&&c(e)&&e.parentNode.removeChild(e),f&&c(f)&&f.parentNode.removeChild(f)}}}}(a),a.dom.observe=function(a,b,c){b="string"==typeof b?[b]:b;for(var d,e,f=0,g=b.length;g>f;f++)e=b[f],a.addEventListener?a.addEventListener(e,c,!1):(d=function(b){"target"in b||(b.target=b.srcElement),b.preventDefault=b.preventDefault||function(){this.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){this.cancelBubble=!0},c.call(a,b)},a.attachEvent("on"+e,d));return{stop:function(){for(var e,f=0,g=b.length;g>f;f++)e=b[f],a.removeEventListener?a.removeEventListener(e,c,!1):a.detachEvent("on"+e,d)}}},a.dom.parse=function(b,c){function d(b,c){a.lang.object(u).merge(t).merge(c.rules).get();var d,g,h,i=c.context||b.ownerDocument||document,j=i.createDocumentFragment(),k="string"==typeof b,l=!1;for(c.clearInternals===!0&&(l=!0),d=k?a.dom.getAsDom(b,i):b,u.selectors&&f(d,u.selectors);d.firstChild;)h=d.firstChild,g=e(h,c.cleanUp,l,c.uneditableClass),g&&j.appendChild(g),h!==g&&d.removeChild(h);if(c.unjoinNbsps)for(var m=a.dom.getTextNodes(j),n=m.length;n--;)m[n].nodeValue=m[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi,"$1 ");return d.innerHTML="",d.appendChild(j),k?a.quirks.getCorrectInnerHTML(d):d}function e(b,c,d,f){var g,h,i,j,k=b.nodeType,l=b.childNodes,m=l.length,n=q[k],o=0;if(f&&1===k&&a.dom.hasClass(b,f))return b;if(h=n&&n(b,d),!h){if(h===!1){for(g=b.ownerDocument.createDocumentFragment(),o=m;o--;)l[o]&&(i=e(l[o],c,d,f),i&&(l[o]===i&&o--,g.insertBefore(i,g.firstChild)));return j=a.dom.getStyle("display").from(b),""===j&&(j=a.lang.array(v).contains(b.tagName)?"block":""),a.lang.array(["block","flex","table"]).contains(j)&&g.appendChild(b.ownerDocument.createElement("br")),a.lang.array(["div","pre","p","table","td","th","ul","ol","li","dd","dl","footer","header","section","h1","h2","h3","h4","h5","h6"]).contains(b.nodeName.toLowerCase())&&b.parentNode.lastChild!==b&&(b.nextSibling&&3===b.nextSibling.nodeType&&/^\s/.test(b.nextSibling.nodeValue)||g.appendChild(b.ownerDocument.createTextNode(" "))),g.normalize&&g.normalize(),g}return null}for(o=0;m>o;o++)l[o]&&(i=e(l[o],c,d,f),i&&(l[o]===i&&o--,h.appendChild(i)));if(c&&h.nodeName.toLowerCase()===r&&(!h.childNodes.length||/^\s*$/gi.test(h.innerHTML)&&(d||"_wysihtml5-temp-placeholder"!==b.className&&"rangySelectionBoundary"!==b.className)||!h.attributes.length)){for(g=h.ownerDocument.createDocumentFragment();h.firstChild;)g.appendChild(h.firstChild);return g.normalize&&g.normalize(),g}return h.normalize&&h.normalize(),h}function f(b,c){var d,e,f;for(d in c)if(c.hasOwnProperty(d)){a.lang.object(c[d]).isFunction()?e=c[d]:"string"==typeof c[d]&&A[c[d]]&&(e=A[c[d]]),f=b.querySelectorAll(d);for(var g=f.length;g--;)e(f[g])}}function g(b,c){var d,e,f,g=u.tags,i=b.nodeName.toLowerCase(),k=b.scopeName;if(b._wysihtml5)return null;if(b._wysihtml5=1,"wysihtml5-temp"===b.className)return null;if(k&&"HTML"!=k&&(i=k+":"+i),"outerHTML"in b&&(a.browser.autoClosesUnclosedTags()||"P"!==b.nodeName||"

    "===b.outerHTML.slice(-4).toLowerCase()||(i="div")),i in g){if(d=g[i],!d||d.remove)return null;if(d.unwrap)return!1;d="string"==typeof d?{rename_tag:d}:d}else{if(!b.firstChild)return null;d={rename_tag:r}}if(d.one_of_type&&!h(b,u,d.one_of_type,c)){if(!d.remove_action)return null;if("unwrap"===d.remove_action)return!1;if("rename"!==d.remove_action)return null;f=d.remove_action_rename_to||r}return e=b.ownerDocument.createElement(f||d.rename_tag||i),n(b,e,d,c),j(b,e,d),b=null,e.normalize&&e.normalize(),e}function h(a,b,c,d){var e,f;if("SPAN"===a.nodeName&&!d&&("_wysihtml5-temp-placeholder"===a.className||"rangySelectionBoundary"===a.className))return!0;for(f in c)if(c.hasOwnProperty(f)&&b.type_definitions&&b.type_definitions[f]&&(e=b.type_definitions[f],i(a,e)))return!0;return!1}function i(b,c){var d,e,f,g,h,i=b.getAttribute("class"),j=b.getAttribute("style");if(c.methods)for(var k in c.methods)if(c.methods.hasOwnProperty(k)&&z[k]&&z[k](b))return!0;if(i&&c.classes){i=i.replace(/^\s+/g,"").replace(/\s+$/g,"").split(s),d=i.length;for(var l=0;d>l;l++)if(c.classes[i[l]])return!0}if(j&&c.styles){j=j.split(";");for(e in c.styles)if(c.styles.hasOwnProperty(e))for(var m=j.length;m--;)if(h=j[m].split(":"),h[0].replace(/\s/g,"").toLowerCase()===e&&(c.styles[e]===!0||1===c.styles[e]||a.lang.array(c.styles[e]).contains(h[1].replace(/\s/g,"").toLowerCase())))return!0}if(c.attrs)for(f in c.attrs)if(c.attrs.hasOwnProperty(f)&&(g=a.dom.getAttribute(b,f),"string"==typeof g&&g.search(c.attrs[f])>-1))return!0;return!1}function j(a,b,c){var d,e;if(c&&c.keep_styles)for(d in c.keep_styles)if(c.keep_styles.hasOwnProperty(d)){if(e="float"===d?a.style.styleFloat||a.style.cssFloat:a.style[d],c.keep_styles[d]instanceof RegExp&&!c.keep_styles[d].test(e))continue;"float"===d?b.style[a.style.styleFloat?"styleFloat":"cssFloat"]=e:a.style[d]&&(b.style[d]=e)}}function k(a,b){var c=[];for(var d in b)b.hasOwnProperty(d)&&0===d.indexOf(a)&&c.push(d);return c}function l(b,c,d,e){var f,g=a.lang.object(d).isFunction()?d:w[d];return g&&(f=g(c,e),"string"==typeof f)?f:!1}function m(b,c){var d,e,f,g=a.lang.object(u.attributes||{}).clone(),h=a.lang.object(g).merge(a.lang.object(c||{}).clone()).get(),i={},j=a.dom.getAttributes(b);for(d in h)if(/\*$/.test(d)){f=k(d.slice(0,-1),j);for(var m=0,n=f.length;n>m;m++)e=l(f[m],j[f[m]],h[d],b.nodeName),e!==!1&&(i[f[m]]=e)}else e=l(d,j[d],h[d],b.nodeName),e!==!1&&(i[d]=e);return i}function n(b,c,d,e){var f,g,h,i,j,k={},l=d.set_class,n=d.add_class,o=d.add_style,p=d.set_attributes,q=u.classes,r=0,t=[],v=[],w=[],z=[];if(p&&(k=a.lang.object(p).clone()),k=a.lang.object(k).merge(m(b,d.check_attributes)).get(),l&&t.push(l),n)for(i in n)j=y[n[i]],j&&(h=j(a.dom.getAttribute(b,i)),"string"==typeof h&&t.push(h));if(o)for(i in o)j=x[o[i]],j&&(newStyle=j(a.dom.getAttribute(b,i)),"string"==typeof newStyle&&v.push(newStyle));if("string"==typeof q&&"any"===q)if(b.getAttribute("class"))if(u.classes_blacklist){for(z=b.getAttribute("class"),z&&(t=t.concat(z.split(s))),f=t.length;f>r;r++)g=t[r],u.classes_blacklist[g]||w.push(g);w.length&&(k["class"]=a.lang.array(w).unique().join(" "))}else k["class"]=b.getAttribute("class");else t&&t.length>0&&(k["class"]=a.lang.array(t).unique().join(" "));else{for(e||(q["_wysihtml5-temp-placeholder"]=1,q._rangySelectionBoundary=1,q["wysiwyg-tmp-selected-cell"]=1),z=b.getAttribute("class"),z&&(t=t.concat(z.split(s))),f=t.length;f>r;r++)g=t[r],q[g]&&w.push(g);w.length&&(k["class"]=a.lang.array(w).unique().join(" "))}k["class"]&&e&&(k["class"]=k["class"].replace("wysiwyg-tmp-selected-cell",""),/^\s*$/g.test(k["class"])&&delete k["class"]),v.length&&(k.style=a.lang.array(v).unique().join(" "));for(i in k)try{c.setAttribute(i,k[i])}catch(A){}k.src&&("undefined"!=typeof k.width&&c.setAttribute("width",k.width),"undefined"!=typeof k.height&&c.setAttribute("height",k.height))}function o(b){var c=b.nextSibling;if(!c||c.nodeType!==a.TEXT_NODE){var d=b.data.replace(a.INVISIBLE_SPACE_REG_EXP,"");return b.ownerDocument.createTextNode(d)}c.data=b.data.replace(a.INVISIBLE_SPACE_REG_EXP,"")+c.data.replace(a.INVISIBLE_SPACE_REG_EXP,"")}function p(a){return u.comments?a.ownerDocument.createComment(a.nodeValue):void 0}var q={1:g,3:o,8:p},r="span",s=/\s+/,t={tags:{},classes:{}},u={},v=["ADDRESS","BLOCKQUOTE","CENTER","DIR","DIV","DL","FIELDSET","FORM","H1","H2","H3","H4","H5","H6","ISINDEX","MENU","NOFRAMES","NOSCRIPT","OL","P","PRE","TABLE","UL"],w={url:function(){var a=/^https?:\/\//i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),src:function(){var a=/^(\/|https?:\/\/)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),href:function(){var a=/^(#|\/|https?:\/\/|mailto:|tel:)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),alt:function(){var a=/[^ a-z0-9_\-]/gi;return function(b,c){return b?b.replace(a,""):"IMG"===c?"":null}}(),numbers:function(){var a=/\D/g;return function(b){return b=(b||"").replace(a,""),b||null}}(),dimension:function(){var a=/\D*(\d+)(\.\d+)?\s?(%)?\D*/;return function(b){return b=(b||"").replace(a,"$1$2$3"),b||null}}(),any:function(){return function(a){return a?a:null}}()},x={align_text:function(){var a={left:"text-align: left;",right:"text-align: right;",center:"text-align: center;"};return function(b){return a[String(b).toLowerCase()]}}()},y={align_img:function(){var a={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(b){return a[String(b).toLowerCase()]}}(),align_text:function(){var a={left:"wysiwyg-text-align-left",right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(b){return a[String(b).toLowerCase()]}}(),clear_br:function(){var a={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(b){return a[String(b).toLowerCase()]}}(),size_font:function(){var a={1:"wysiwyg-font-size-xx-small",2:"wysiwyg-font-size-small",3:"wysiwyg-font-size-medium",4:"wysiwyg-font-size-large",5:"wysiwyg-font-size-x-large",6:"wysiwyg-font-size-xx-large",7:"wysiwyg-font-size-xx-large","-":"wysiwyg-font-size-smaller","+":"wysiwyg-font-size-larger"};return function(b){return a[String(b).charAt(0)]}}()},z={has_visible_contet:function(){var a,b=["img","video","picture","br","script","noscript","style","table","iframe","object","embed","audio","svg","input","button","select","textarea","canvas"];return function(c){if(a=(c.innerText||c.textContent).replace(/\s/g,""),a&&a.length>0)return!0;for(var d=b.length;d--;)if(c.querySelector(b[d]))return!0;return c.offsetWidth&&c.offsetWidth>0&&c.offsetHeight&&c.offsetHeight>0?!0:!1}}()},A={unwrap:function(b){a.dom.unwrap(b)},remove:function(a){a.parentNode.removeChild(a)}};return d(b,c)},a.dom.removeEmptyTextNodes=function(b){for(var c,d=a.lang.array(b.childNodes).get(),e=d.length,f=0;e>f;f++)c=d[f],c.nodeType===a.TEXT_NODE&&/^[\n\r]*$/.test(c.data)&&c.parentNode.removeChild(c)},a.dom.renameElement=function(b,c){for(var d,e=b.ownerDocument.createElement(c);d=b.firstChild;)e.appendChild(d);return a.dom.copyAttributes(["align","className"]).from(b).to(e),b.parentNode&&b.parentNode.replaceChild(e,b),e},a.dom.replaceWithChildNodes=function(a){if(a.parentNode){for(;a.firstChild;)a.parentNode.insertBefore(a.firstChild,a);a.parentNode.removeChild(a)}},function(b){function c(a){return"block"===b.getStyle("display").from(a)}function d(a){return"BR"===a.nodeName}function e(a){var b=a.ownerDocument.createElement("br");a.appendChild(b)}function f(b,f){if(b.nodeName.match(/^(MENU|UL|OL)$/)){var g,h,i,j,k,l,m,n=b.ownerDocument,o=n.createDocumentFragment(),p=a.dom.domNode(b).prev({ignoreBlankTexts:!0}),q=a.dom.domNode(b).next({ignoreBlankTexts:!0}),r=b.lastElementChild||b.lastChild;if(f)for(!p||c(p)||d(p)||e(o);l=b.firstElementChild||b.firstChild;){for(h=l.lastChild,m=l===r;g=l.firstChild;)i=g===h,j=(!m||q&&!c(q))&&i&&!c(g)&&!d(g),o.appendChild(g),j&&e(o);l.parentNode.removeChild(l)}else for(;l=b.firstElementChild||b.firstChild;){if(l.querySelector&&l.querySelector("div, p, ul, ol, menu, blockquote, h1, h2, h3, h4, h5, h6"))for(;g=l.firstChild;)o.appendChild(g);else{for(k=n.createElement("p");g=l.firstChild;)k.appendChild(g);o.appendChild(k)}l.parentNode.removeChild(l)}b.parentNode.replaceChild(o,b)}}b.resolveList=f}(a.dom),function(a){var c=document,d=["parent","top","opener","frameElement","frames","localStorage","globalStorage","sessionStorage","indexedDB"],e=["open","close","openDialog","showModalDialog","alert","confirm","prompt","openDatabase","postMessage","XMLHttpRequest","XDomainRequest"],f=["referrer","write","open","close"];a.dom.Sandbox=b.extend({constructor:function(b,c){this.callback=b||a.EMPTY_FUNCTION,this.config=a.lang.object({}).merge(c).get(),this.config.className||(this.config.className="wysihtml5-sandbox"),this.editableArea=this._createIframe()},insertInto:function(a){"string"==typeof a&&(a=c.getElementById(a)),a.appendChild(this.editableArea)},getIframe:function(){return this.editableArea},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var a=this.getIframe();a.parentNode.removeChild(a)},_readyError:function(){throw new Error("wysihtml.Sandbox: Sandbox iframe isn't loaded yet")},_createIframe:function(){var b=this,d=c.createElement("iframe");return d.className=this.config.className,a.dom.setAttributes({security:"restricted",allowtransparency:"true",frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(d),a.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()&&(d.src="javascript:''"),d.onload=function(){d.onreadystatechange=d.onload=null,b._onLoadIframe(d)},d.onreadystatechange=function(){/loaded|complete/.test(d.readyState)&&(d.onreadystatechange=d.onload=null,b._onLoadIframe(d))},d},_onLoadIframe:function(b){if(a.dom.contains(c.documentElement,b)){var g=this,h=b.contentWindow,i=b.contentWindow.document,j=c.characterSet||c.charset||"utf-8",k=this._getHtml({charset:j,stylesheets:this.config.stylesheets});if(i.open("text/html","replace"),i.write(k),i.close(),this.getWindow=function(){return b.contentWindow},this.getDocument=function(){return b.contentWindow.document},h.onerror=function(a,b,c){throw new Error("wysihtml.Sandbox: "+a,b,c)},!a.browser.supportsSandboxedIframes()){var l,m;for(l=0,m=d.length;m>l;l++)this._unset(h,d[l]);for(l=0,m=e.length;m>l;l++)this._unset(h,e[l],a.EMPTY_FUNCTION);for(l=0,m=f.length;m>l;l++)this._unset(i,f[l]);this._unset(i,"cookie","",!0)}a.polyfills&&a.polyfills(h,i),this.loaded=!0,setTimeout(function(){g.callback(g)},0)}},_getHtml:function(b){var c,d=b.stylesheets,e="",f=0;if(d="string"==typeof d?[d]:d)for(c=d.length;c>f;f++)e+='';return b.stylesheets=e,a.lang.string('#{stylesheets}').interpolate(b)},_unset:function(b,c,d,e){try{b[c]=d}catch(f){}try{b.__defineGetter__(c,function(){return d})}catch(f){}if(e)try{b.__defineSetter__(c,function(){})}catch(f){}if(!a.browser.crashesWhenDefineProperty(c))try{var g={get:function(){return d}};e&&(g.set=function(){}),Object.defineProperty(b,c,g)}catch(f){}}})}(a),function(a){var c=document;a.dom.ContentEditableArea=b.extend({getContentEditable:function(){return this.element},getWindow:function(){return this.element.ownerDocument.defaultView||this.element.ownerDocument.parentWindow},getDocument:function(){return this.element.ownerDocument},constructor:function(b,c,d){this.callback=b||a.EMPTY_FUNCTION,this.config=a.lang.object({}).merge(c).get(),this.config.className||(this.config.className="wysihtml5-sandbox"),d?this.element=this._bindElement(d):this.element=this._createElement()},destroy:function(){},_createElement:function(){var a=c.createElement("div");return a.className=this.config.className,this._loadElement(a),a},_bindElement:function(a){return a.className=a.className?a.className+" wysihtml5-sandbox":"wysihtml5-sandbox",this._loadElement(a,!0),a},_loadElement:function(a,b){var c=this;if(!b){var d=this._getHtml();a.innerHTML=d}this.loaded=!0,setTimeout(function(){c.callback(c)},0)},_getHtml:function(a){return""}})}(a),function(){var b={className:"class"};a.dom.setAttributes=function(a){return{on:function(c){for(var d in a)c.setAttribute(b[d]||d,a[d])}}}}(),a.dom.setStyles=function(a){return{on:function(b){var c=b.style;if("string"==typeof a)return void(c.cssText+=";"+a);for(var d in a)"float"===d?(c.cssFloat=a[d],c.styleFloat=a[d]):c[d]=a[d]}}},function(a){a.simulatePlaceholder=function(b,c,d,e){var f=e||"wysihtml5-placeholder",g=function(){var b=c.element.offsetWidth>0&&c.element.offsetHeight>0;c.hasPlaceholderSet()&&(c.clear(),c.element.focus(),b&&setTimeout(function(){var a=c.selection.getSelection();a.focusNode&&a.anchorNode||c.selection.selectNode(c.element.firstChild||c.element)},0)),c.placeholderSet=!1,a.removeClass(c.element,f)},h=function(){c.isEmpty()&&!c.placeholderSet&&(c.placeholderSet=!0,c.setValue(d,!1),a.addClass(c.element,f))};b.on("set_placeholder",h).on("unset_placeholder",g).on("focus:composer",g).on("paste:composer",g).on("blur:composer",h),h()}}(a.dom),function(a){var b=document.documentElement;"textContent"in b?(a.setTextContent=function(a,b){a.textContent=b},a.getTextContent=function(a){return a.textContent}):"innerText"in b?(a.setTextContent=function(a,b){a.innerText=b},a.getTextContent=function(a){return a.innerText}):(a.setTextContent=function(a,b){a.nodeValue=b},a.getTextContent=function(a){return a.nodeValue})}(a.dom),a.dom.getAttribute=function(b,c){var d=!a.browser.supportsGetAttributeCorrectly();c=c.toLowerCase();var e=b.nodeName;if("IMG"==e&&"src"==c&&a.dom.isLoadedImage(b)===!0)return b.src;if(d&&"outerHTML"in b){var f=b.outerHTML.toLowerCase(),g=-1!=f.indexOf(" "+c+"=");return g?b.getAttribute(c):null}return b.getAttribute(c)},a.dom.getAttributes=function(b){var c,d=!a.browser.supportsGetAttributeCorrectly(),e=b.nodeName,f=[];for(c in b.attributes)(b.attributes.hasOwnProperty&&b.attributes.hasOwnProperty(c)||!b.attributes.hasOwnProperty&&Object.prototype.hasOwnProperty.call(b.attributes,c))&&b.attributes[c].specified&&("IMG"==e&&"src"==b.attributes[c].name.toLowerCase()&&a.dom.isLoadedImage(b)===!0?f.src=b.src:a.lang.array(["rowspan","colspan"]).contains(b.attributes[c].name.toLowerCase())&&d?1!==b.attributes[c].value&&(f[b.attributes[c].name]=b.attributes[c].value):f[b.attributes[c].name]=b.attributes[c].value);return f},a.dom.isLoadedImage=function(a){try{return a.complete&&!a.mozMatchesSelector(":-moz-broken")}catch(b){if(a.complete&&"complete"===a.readyState)return!0}},function(a){function b(a,b){for(var c,d=[],e=0,f=a.length;f>e;e++)if(c=a[e].querySelectorAll(b))for(var g=c.length;g--;d.unshift(c[g]));return d}function d(a){a.parentNode.removeChild(a)}function e(a,b){a.parentNode.insertBefore(b,a.nextSibling)}function f(a,b){for(var c=a.nextSibling;1!=c.nodeType;)if(c=c.nextSibling,!b||b==c.tagName.toLowerCase())return c;return null}var g=a.dom,h=function(a){this.el=a,this.isColspan=!1,this.isRowspan=!1,this.firstCol=!0,this.lastCol=!0,this.firstRow=!0,this.lastRow=!0,this.isReal=!0,this.spanCollection=[],this.modified=!1},i=function(a,b){a?(this.cell=a,this.table=g.getParentElement(a,{query:"table"})):b&&(this.table=b,this.cell=this.table.querySelectorAll("th, td")[0])};i.prototype={addSpannedCellToMap:function(a,b,c,d,e,f){for(var g=[],i=c+(f?parseInt(f,10)-1:0),j=d+(e?parseInt(e,10)-1:0),k=c;i>=k;k++){"undefined"==typeof b[k]&&(b[k]=[]);for(var l=d;j>=l;l++)b[k][l]=new h(a),b[k][l].isColspan=e&&parseInt(e,10)>1,b[k][l].isRowspan=f&&parseInt(f,10)>1,b[k][l].firstCol=l==d,b[k][l].lastCol=l==j,b[k][l].firstRow=k==c,b[k][l].lastRow=k==i,b[k][l].isReal=l==d&&k==c,b[k][l].spanCollection=g,g.push(b[k][l])}},setCellAsModified:function(a){if(a.modified=!0,a.spanCollection.length>0)for(var b=0,c=a.spanCollection.length;c>b;b++)a.spanCollection[b].modified=!0},setTableMap:function(){var a,b,c,d,e,f,i,j,k=[],l=this.getTableRows();for(a=0;a0?a.lang.array(f).without(e):f;return g},getTableRows:function(){var c=this.table.querySelectorAll("table"),d=c?b(c,"tr"):[],e=this.table.querySelectorAll("tr"),f=d.length>0?a.lang.array(e).without(d):e;return f},getMapIndex:function(a){for(var b=this.map.length,c=this.map&&this.map[0]?this.map[0].length:0,d=0;b>d;d++)for(var e=0;c>e;e++)if(this.map[d][e].el===a)return{row:d,col:e};return!1},getElementAtIndex:function(a){return this.setTableMap(),this.map[a.row]&&this.map[a.row][a.col]&&this.map[a.row][a.col].el?this.map[a.row][a.col].el:null},getMapElsTo:function(a){var b=[];if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(a),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var c=this.idx_start;this.idx_start=this.idx_end,this.idx_end=c}if(this.idx_start.col>this.idx_end.col){var d=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=d}if(null!=this.idx_start&&null!=this.idx_end)for(var e=this.idx_start.row,f=this.idx_end.row;f>=e;e++)for(var g=this.idx_start.col,h=this.idx_end.col;h>=g;g++)b.push(this.map[e][g].el);return b},orderSelectionEnds:function(a){if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(a),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var b=this.idx_start;this.idx_start=this.idx_end,this.idx_end=b}if(this.idx_start.col>this.idx_end.col){var c=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=c}return{start:this.map[this.idx_start.row][this.idx_start.col].el,end:this.map[this.idx_end.row][this.idx_end.col].el}},createCells:function(a,b,c){for(var d,e=this.table.ownerDocument,f=e.createDocumentFragment(),g=0;b>g;g++){if(d=e.createElement(a),c)for(var h in c)c.hasOwnProperty(h)&&d.setAttribute(h,c[h]);d.appendChild(document.createTextNode(" ")),f.appendChild(d)}return f},correctColIndexForUnreals:function(a,b){for(var c=this.map[b],d=-1,e=0;a>e;e++)c[e].isReal&&d++;return d},getLastNewCellOnRow:function(a,b){for(var c,d,e=this.getRowCells(a),f=0,g=e.length;g>f;f++)if(c=e[f],d=this.getMapIndex(c),d===!1||"undefined"!=typeof b&&d.row!=b)return c;return null},removeEmptyTable:function(){var a=this.table.querySelectorAll("td, th");return a&&0!=a.length?!1:(d(this.table),!0)},splitRowToCells:function(a){if(a.isColspan){var b=parseInt(g.getAttribute(a.el,"colspan")||1,10),c=a.el.tagName.toLowerCase();if(b>1){var d=this.createCells(c,b-1);e(a.el,d)}a.el.removeAttribute("colspan")}},getRealRowEl:function(a,b){var c=null,d=null;b=b||this.idx;for(var e=0,f=this.map[b.row].length;f>e;e++)if(d=this.map[b.row][e],d.isReal&&(c=g.getParentElement(d.el,{query:"tr"})))return c;return null===c&&a&&(c=g.getParentElement(this.map[b.row][b.col].el,{query:"tr"})||null),c},injectRowAt:function(a,b,c,d,f){var h=this.getRealRowEl(!1,{row:a,col:b}),i=this.createCells(d,c);if(h){var j=this.correctColIndexForUnreals(b,a);j>=0?e(this.getRowCells(h)[j],i):h.insertBefore(i,h.firstChild)}else{var k=this.table.ownerDocument.createElement("tr");k.appendChild(i),e(g.getParentElement(f.el,{query:"tr"}),k)}},canMerge:function(a){if(this.to=a,this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(this.to),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var b=this.idx_start;this.idx_start=this.idx_end,this.idx_end=b}if(this.idx_start.col>this.idx_end.col){var c=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=c}for(var d=this.idx_start.row,e=this.idx_end.row;e>=d;d++)for(var f=this.idx_start.col,g=this.idx_end.col;g>=f;f++)if(this.map[d][f].isColspan||this.map[d][f].isRowspan)return!1;return!0},decreaseCellSpan:function(a,b){var c=parseInt(g.getAttribute(a.el,b),10)-1;c>=1?a.el.setAttribute(b,c):(a.el.removeAttribute(b),"colspan"==b&&(a.isColspan=!1),"rowspan"==b&&(a.isRowspan=!1),a.firstCol=!0,a.lastCol=!0,a.firstRow=!0,a.lastRow=!0,a.isReal=!0)},removeSurplusLines:function(){var a,b,c,e,f,h,i;if(this.setTableMap(),this.map){for(c=0,e=this.map.length;e>c;c++){for(a=this.map[c],i=!0,f=0,h=a.length;h>f;f++)if(b=a[f],!(g.getAttribute(b.el,"rowspan")&&parseInt(g.getAttribute(b.el,"rowspan"),10)>1&&b.firstRow!==!0)){i=!1;break}if(i)for(f=0;h>f;f++)this.decreaseCellSpan(a[f],"rowspan")}var j=this.getTableRows();for(c=0,e=j.length;e>c;c++)a=j[c],0==a.childNodes.length&&/^\s*$/.test(a.textContent||a.innerText)&&d(a)}},fillMissingCells:function(){var a=0,b=0,c=null;if(this.setTableMap(),this.map){a=this.map.length;for(var d=0;a>d;d++)this.map[d].length>b&&(b=this.map[d].length);for(var f=0;a>f;f++)for(var g=0;b>g;g++)this.map[f]&&!this.map[f][g]&&g>0&&(this.map[f][g]=new h(this.createCells("td",1)),c=this.map[f][g-1],c&&c.el&&c.el.parent&&e(this.map[f][g-1].el,this.map[f][g].el))}},rectify:function(){return this.removeEmptyTable()?!1:(this.removeSurplusLines(),this.fillMissingCells(),!0)},unmerge:function(){if(this.rectify()&&(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx)){var a=this.map[this.idx.row][this.idx.col],b=g.getAttribute(a.el,"colspan")?parseInt(g.getAttribute(a.el,"colspan"),10):1,c=a.el.tagName.toLowerCase();if(a.isRowspan){var d=parseInt(g.getAttribute(a.el,"rowspan"),10);if(d>1)for(var e=1,f=d-1;f>=e;e++)this.injectRowAt(this.idx.row+e,this.idx.col,b,c,a);a.el.removeAttribute("rowspan")}this.splitRowToCells(a)}},merge:function(a){if(this.rectify())if(this.canMerge(a)){for(var b=this.idx_end.row-this.idx_start.row+1,c=this.idx_end.col-this.idx_start.col+1,e=this.idx_start.row,f=this.idx_end.row;f>=e;e++)for(var g=this.idx_start.col,h=this.idx_end.col;h>=g;g++)e==this.idx_start.row&&g==this.idx_start.col?(b>1&&this.map[e][g].el.setAttribute("rowspan",b),c>1&&this.map[e][g].el.setAttribute("colspan",c)):(/^\s*\s*$/.test(this.map[e][g].el.innerHTML.toLowerCase())||(this.map[this.idx_start.row][this.idx_start.col].el.innerHTML+=" "+this.map[e][g].el.innerHTML),d(this.map[e][g].el));this.rectify()}else window.console&&console.log("Do not know how to merge allready merged cells.")},collapseCellToNextRow:function(a){var b=this.getMapIndex(a.el),c=b.row+1,d={row:c,col:b.col};if(c=0)e(this.getRowCells(f)[h],a.el);else{var i=this.getLastNewCellOnRow(f,c);null!==i?e(i,a.el):f.insertBefore(a.el,f.firstChild)}parseInt(g.getAttribute(a.el,"rowspan"),10)>2?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)-1):a.el.removeAttribute("rowspan")}}},removeRowCell:function(a){a.isReal?a.isRowspan?this.collapseCellToNextRow(a):d(a.el):parseInt(g.getAttribute(a.el,"rowspan"),10)>2?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)-1):a.el.removeAttribute("rowspan")},getRowElementsByCell:function(){var a=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=this.map[this.idx.row],c=0,d=b.length;d>c;c++)b[c].isReal&&a.push(b[c].el);return a},getColumnElementsByCell:function(){var a=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=0,c=this.map.length;c>b;b++)this.map[b][this.idx.col]&&this.map[b][this.idx.col].isReal&&a.push(this.map[b][this.idx.col].el);return a},removeRow:function(){var a=g.getParentElement(this.cell,{query:"tr"});if(a){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=this.map[this.idx.row],c=0,e=b.length;e>c;c++)b[c].modified||(this.setCellAsModified(b[c]),this.removeRowCell(b[c]));d(a)}},removeColCell:function(a){a.isColspan?parseInt(g.getAttribute(a.el,"colspan"),10)>2?a.el.setAttribute("colspan",parseInt(g.getAttribute(a.el,"colspan"),10)-1):a.el.removeAttribute("colspan"):a.isReal&&d(a.el)},removeColumn:function(){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var a=0,b=this.map.length;b>a;a++)this.map[a][this.idx.col].modified||(this.setCellAsModified(this.map[a][this.idx.col]),this.removeColCell(this.map[a][this.idx.col]))},remove:function(a){if(this.rectify()){switch(a){case"row":this.removeRow();break;case"column":this.removeColumn()}this.rectify()}},addRow:function(a){var b=this.table.ownerDocument;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"below"==a&&g.getAttribute(this.cell,"rowspan")&&(this.idx.row=this.idx.row+parseInt(g.getAttribute(this.cell,"rowspan"),10)-1),this.idx!==!1){for(var c=this.map[this.idx.row],d=b.createElement("tr"),f=0,h=c.length;h>f;f++)c[f].modified||(this.setCellAsModified(c[f]),this.addRowCell(c[f],d,a));switch(a){case"below":e(this.getRealRowEl(!0),d);break;case"above":var i=g.getParentElement(this.map[this.idx.row][this.idx.col].el,{query:"tr"});i&&i.parentNode.insertBefore(d,i)}}},addRowCell:function(a,b,d){var e=a.isColspan?{colspan:g.getAttribute(a.el,"colspan")}:null;a.isReal?"above"!=d&&a.isRowspan?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)+1):b.appendChild(this.createCells("td",1,e)):"above"!=d&&a.isRowspan&&a.lastRow?b.appendChild(this.createCells("td",1,e)):c.isRowspan&&a.el.attr("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)+1)},add:function(a){this.rectify()&&(("below"==a||"above"==a)&&this.addRow(a),("before"==a||"after"==a)&&this.addColumn(a))},addColCell:function(a,b,c){var d,f=a.el.tagName.toLowerCase();switch(c){case"before":d=!a.isColspan||a.firstCol;break;case"after":d=!a.isColspan||a.lastCol||a.isColspan&&a.el==this.cell}if(d){switch(c){case"before":a.el.parentNode.insertBefore(this.createCells(f,1),a.el);break;case"after":e(a.el,this.createCells(f,1))}a.isRowspan&&this.handleCellAddWithRowspan(a,b+1,c)}else a.el.setAttribute("colspan",parseInt(g.getAttribute(a.el,"colspan"),10)+1)},addColumn:function(a){var b,c;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"after"==a&&g.getAttribute(this.cell,"colspan")&&(this.idx.col=this.idx.col+parseInt(g.getAttribute(this.cell,"colspan"),10)-1),this.idx!==!1)for(var d=0,e=this.map.length;e>d;d++)b=this.map[d],b[this.idx.col]&&(c=b[this.idx.col],c.modified||(this.setCellAsModified(c),this.addColCell(c,d,a)))},handleCellAddWithRowspan:function(a,b,c){for(var d,h,i,j=parseInt(g.getAttribute(this.cell,"rowspan"),10)-1,k=g.getParentElement(a.el,{ +query:"tr"}),l=a.el.tagName.toLowerCase(),m=this.table.ownerDocument,n=0;j>n;n++)if(d=this.correctColIndexForUnreals(this.idx.col,b+n),k=f(k,"tr"))if(d>0)switch(c){case"before":h=this.getRowCells(k),d>0&&this.map[b+n][this.idx.col].el!=h[d]&&d==h.length-1?e(h[d],this.createCells(l,1)):h[d].parentNode.insertBefore(this.createCells(l,1),h[d]);break;case"after":e(this.getRowCells(k)[d],this.createCells(l,1))}else k.insertBefore(this.createCells(l,1),k.firstChild);else i=m.createElement("tr"),i.appendChild(this.createCells(l,1)),this.table.appendChild(i)}},g.table={getCellsBetween:function(a,b){var c=new i(a);return c.getMapElsTo(b)},addCells:function(a,b){var c=new i(a);c.add(b)},removeCells:function(a,b){var c=new i(a);c.remove(b)},mergeCellsBetween:function(a,b){var c=new i(a);c.merge(b)},unmergeCell:function(a){var b=new i(a);b.unmerge()},orderSelectionEnds:function(a,b){var c=new i(a);return c.orderSelectionEnds(b)},indexOf:function(a){var b=new i(a);return b.setTableMap(),b.getMapIndex(a)},findCell:function(a,b){var c=new i(null,a);return c.getElementAtIndex(b)},findRowByCell:function(a){var b=new i(a);return b.getRowElementsByCell()},findColumnByCell:function(a){var b=new i(a);return b.getColumnElementsByCell()},canMerge:function(a,b){var c=new i(a);return c.canMerge(b)}}}(a),a.dom.query=function(a,b){var c,d=[];a.nodeType&&(a=[a]);for(var e=0,f=a.length;f>e;e++)if(c=a[e].querySelectorAll(b))for(var g=c.length;g--;d.unshift(c[g]));return d},a.dom.compareDocumentPosition=function(){var b=document.documentElement;return b.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)}:function(b,c){var d,e;if(d=9===b.nodeType?b:b.ownerDocument,e=9===c.nodeType?c:c.ownerDocument,b===c)return 0;if(b===c.ownerDocument)return 20;if(b.ownerDocument===c)return 10;if(d!==e)return 1;if(2===b.nodeType&&b.childNodes&&-1!==a.lang.array(b.childNodes).indexOf(c))return 20;if(2===c.nodeType&&c.childNodes&&-1!==a.lang.array(c.childNodes).indexOf(b))return 10;for(var f=b,g=[],h=null;f;){if(f==c)return 10;g.push(f),f=f.parentNode}for(f=c,h=null;f;){if(f==b)return 20;var i=a.lang.array(g).indexOf(f);if(-1!==i){var j=g[i],k=a.lang.array(j.childNodes).indexOf(g[i-1]),l=a.lang.array(j.childNodes).indexOf(h);return k>l?2:4}h=f,f=f.parentNode}return 1}}(),a.dom.unwrap=function(b){var c=[];if(b.parentNode){for(;b.lastChild;)c.unshift(b.lastChild),a.dom.insert(b.lastChild).after(b);b.parentNode.removeChild(b)}return c},a.dom.getPastedHtml=function(b){var c;return a.browser.supportsModernPaste()&&b.clipboardData&&(a.lang.array(b.clipboardData.types).contains("text/html")?c=b.clipboardData.getData("text/html"):a.lang.array(b.clipboardData.types).contains("text/plain")&&(c=a.lang.string(b.clipboardData.getData("text/plain")).escapeHTML(!0,!0))),c},a.dom.getPastedHtmlWithDiv=function(a,b){var c=a.selection.getBookmark(),d=a.element.ownerDocument,e=d.createElement("DIV"),f=a.getScrollPos();d.body.appendChild(e),e.style.width="1px",e.style.height="1px",e.style.overflow="hidden",e.style.position="absolute",e.style.top=f.y+"px",e.style.left=f.x+"px",e.setAttribute("contenteditable","true"),e.focus(),setTimeout(function(){var d;a.selection.setBookmark(c),d=e.innerHTML,d&&/^$/i.test(d.trim())&&(d=!1),b(d),e.parentNode.removeChild(e)},0)},a.dom.removeInvisibleSpaces=function(b){for(var c=a.dom.getTextNodes(b),d=c.length;d--;)c[d].nodeValue=c[d].nodeValue.replace(a.INVISIBLE_SPACE_REG_EXP,"")},a.quirks.cleanPastedHTML=function(){var b=function(b){var c=a.lang.string(b).trim(),d=c.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");return new RegExp("^((?!^"+d+"$).)*$","i")},c=function(c,d){var e,f,g=a.lang.object(c).clone(!0);for(e in g.tags)if(g.tags.hasOwnProperty(e)&&g.tags[e].keep_styles)for(f in g.tags[e].keep_styles)g.tags[e].keep_styles.hasOwnProperty(f)&&d[f]&&(g.tags[e].keep_styles[f]=b(d[f]));return g},d=function(a,b){var c;if(!a)return null;for(var d=0,e=a.length;e>d;d++)if(a[d].condition||(c=a[d].set),a[d].condition&&a[d].condition.test(b))return a[d].set;return c};return function(b,e){var f,g={color:a.dom.getStyle("color").from(e.referenceNode),fontSize:a.dom.getStyle("font-size").from(e.referenceNode)},h=c(d(e.rules,b)||{},g);return f=a.dom.parse(b,{rules:h,cleanUp:!0,context:e.referenceNode.ownerDocument,uneditableClass:e.uneditableClass,clearInternals:!0,unjoinNbsps:!0})}}(),a.quirks.ensureProperClearing=function(){var b=function(){var a=this;setTimeout(function(){var b=a.innerHTML.toLowerCase();("

     

    "==b||"

     

     

    "==b)&&(a.innerHTML="")},0)};return function(c){a.dom.observe(c.element,["cut","keydown"],b)}}(),function(a){var b="%7E";a.quirks.getCorrectInnerHTML=function(c){var d=c.innerHTML;if(-1===d.indexOf(b))return d;var e,f,g,h,i=c.querySelectorAll("[href*='~'], [src*='~']");for(h=0,g=i.length;g>h;h++)e=i[h].href||i[h].src,f=a.lang.string(e).replace("~").by(b),d=a.lang.string(d).replace(f).by(e);return d}}(a),function(a){var b="wysihtml5-quirks-redraw";a.quirks.redraw=function(c){a.dom.addClass(c,b),a.dom.removeClass(c,b);try{var d=c.ownerDocument;d.execCommand("italic",!1,null),d.execCommand("italic",!1,null)}catch(e){}}}(a),a.quirks.tableCellsSelection=function(b,c){function d(){return b.addEventListener("mousedown",o),m}function e(a){m.start=a,m.end=a,m.cells=[a],m.table=l.getParentElement(m.start,{query:"table"},!1,b),m.table&&(f(),l.addClass(a,n),b.addEventListener("mousemove",h),b.addEventListener("mouseup",i),c.fire("tableselectstart").fire("tableselectstart:composer"))}function f(){if(b){var a=b.querySelectorAll("."+n);if(a.length>0)for(var c=0;c1&&c.composer.selection.deselect(),g(m.cells),m.end!==d&&c.fire("tableselectchange").fire("tableselectchange:composer")))}function i(a){b.removeEventListener("mousemove",h),b.removeEventListener("mouseup",i),c.fire("tableselect").fire("tableselect:composer"),setTimeout(function(){j()},0)}function j(){b.ownerDocument.addEventListener("click",p)}function k(a,d){m.start=a,m.end=d,m.table=l.getParentElement(m.start,{query:"table"},!1,b),selectedCells=l.table.getCellsBetween(m.start,m.end),g(selectedCells),j(),c.fire("tableselect").fire("tableselect:composer")}var l=a.dom,m={table:null,start:null,end:null,cells:null,select:k},n="wysiwyg-tmp-selected-cell",o=function(c){var d=a.dom.getParentElement(c.target,{query:"td, th"},!1,b);d&&e(d)},p=function(a){b.ownerDocument.removeEventListener("click",p),l.getParentElement(a.target,{query:"table"},!1,b)!=m.table&&(f(),m.table=null,m.start=null,m.end=null,c.fire("tableunselect").fire("tableunselect:composer"))};return d()},function(a){function b(a){var b,c;for(b in d)if(d.hasOwnProperty(b)&&(c=d[b],c.regex.test(a)))return c}function c(a){var c=b(a);return c?c.name:void 0}var d={rgba:{regex:/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]+)\s*\)/i,name:"rgba"},rgb:{regex:/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i,name:"rgb"},hex6:{regex:/^#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])/i,name:"hex",radix:16},hex3:{regex:/^#([0-9a-f])([0-9a-f])([0-9a-f])/i,name:"hex",radix:16}},e=function(a){return new RegExp("(^|\\s|;)"+a+"\\s*:\\s*[^;$]+","gi")};a.quirks.styleParser={getColorParseMethod:b,getColorFormat:c,parseColor:function(c,f){var g,h,i,j,k,l=c;if(f){if(g=e(f),!(h=c.match(g)))return!1;h=h.pop().split(":")[1],l=a.lang.string(h).trim()}return(i=b(l))&&(j=l.match(i.regex))?(k=i.radix||10,i===d.hex3?(j.shift(),j.push(1),a.lang.array(j).map(function(a,b){return 3>b?parseInt(a,k)*k+parseInt(a,k):parseFloat(a)})):(j.shift(),j[3]||j.push(1),a.lang.array(j).map(function(a,b){return 3>b?parseInt(a,k):parseFloat(a)}))):!1},unparseColor:function(a,b){var c=16;return"hex"===b?(a[0].toString(c)+a[1].toString(c)+a[2].toString(c)).toUpperCase():"hash"===b?"#"+(a[0].toString(c)+a[1].toString(c)+a[2].toString(c)).toUpperCase():"rgb"===b?"rgb("+a[0]+","+a[1]+","+a[2]+")":"rgba"===b?"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")":"csv"===b?a[0]+","+a[1]+","+a[2]+","+a[3]:a[3]&&1!==a[3]?"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")":"rgb("+a[0]+","+a[1]+","+a[2]+")"},parseFontSize:function(b){var c=b.match(e("font-size"));return c?a.lang.string(c[c.length-1].split(":")[1]).trim():!1}}}(a),function(a){function c(a){var b=0;if(a.parentNode)do b+=a.offsetTop||0,a=a.offsetParent;while(a);return b}function d(a,b){for(var c=0;b!==a;)if(c++,b=b.parentNode,!b)throw new Error("not a descendant of ancestor!");return c}function e(a,b){return 3===a.nodeType?a:a.childNodes[b]||a}function f(b){var c=document.createElement("span"),d=function(a){b.removeEventListener("mouseup",d),b.removeEventListener("keydown",d),b.removeEventListener("touchstart",d),b.removeEventListener("focus",d),b.removeEventListener("blur",d),b.removeEventListener("paste",e),b.removeEventListener("drop",e),b.removeEventListener("beforepaste",e),c&&c.parentNode&&c.parentNode.removeChild(c)},e=function(a){c&&c.parentNode&&setTimeout(d,0)};return c.appendChild(b.ownerDocument.createTextNode(a.INVISIBLE_SPACE)),c.className="_wysihtml5-temp-caret-fix",c.style.display="block",c.style.minWidth="1px",c.style.height="0px",b.addEventListener("mouseup",d),b.addEventListener("keydown",d),b.addEventListener("touchstart",d),b.addEventListener("focus",d),b.addEventListener("blur",d),b.addEventListener("paste",e),b.addEventListener("drop",e),b.addEventListener("beforepaste",e),c}function g(a){if(!a.canSurroundContents())for(var b=a.commonAncestorContainer,c=d(b,a.startContainer),e=d(b,a.endContainer);!a.canSurroundContents();)c>e?(a.setStartBefore(a.startContainer),c=d(b,a.startContainer)):(a.setEndAfter(a.endContainer),e=d(b,a.endContainer))}var h=a.dom;a.Selection=b.extend({constructor:function(a,b,c){rangy.init(),this.editor=a,this.composer=a.composer,this.doc=this.composer.doc,this.win=this.composer.win,this.contain=b,this.unselectableClass=c||!1},getBookmark:function(){var a=this.getRange();return a&&a.cloneRange()},setBookmark:function(a){a&&this.setSelection(a)},setBefore:function(a){var b=rangy.createRange(this.doc);return b.setStartBefore(a),b.setEndBefore(a),this.setSelection(b)},createTemporaryCaretSpaceAfter:function(b){var c=this.doc.createElement("span"),d=this.doc.createTextNode(a.INVISIBLE_SPACE),e=function(b){var d;this.contain.removeEventListener("mouseup",e),this.contain.removeEventListener("keydown",g),this.contain.removeEventListener("touchstart",e),this.contain.removeEventListener("focus",e),this.contain.removeEventListener("blur",e),this.contain.removeEventListener("paste",f),this.contain.removeEventListener("drop",f),this.contain.removeEventListener("beforepaste",f),c&&c.parentNode&&(c.innerHTML=c.innerHTML.replace(a.INVISIBLE_SPACE_REG_EXP,""),/[^\s]+/.test(c.innerHTML)?(d=c.lastChild,a.dom.unwrap(c),this.setAfter(d)):c.parentNode.removeChild(c))}.bind(this),f=function(a){c&&c.parentNode&&setTimeout(e,0)},g=function(a){8===a.which||91===a.which||17===a.which||86===a.which&&(a.ctrlKey||a.metaKey)||e()};return c.className="_wysihtml5-temp-caret-fix",c.style.position="absolute",c.style.display="block",c.style.minWidth="1px",c.style.zIndex="99999",c.appendChild(d),b.parentNode.insertBefore(c,b.nextSibling),this.setBefore(d),this.contain.addEventListener("mouseup",e),this.contain.addEventListener("keydown",g),this.contain.addEventListener("touchstart",e),this.contain.addEventListener("focus",e),this.contain.addEventListener("blur",e),this.contain.addEventListener("paste",f),this.contain.addEventListener("drop",f),this.contain.addEventListener("beforepaste",f),c},setAfter:function(b,c,d){var e,f=this.win,g=rangy.createRange(this.doc),h=function(){var d=b.parentNode,g=d?d.childNodes[d.childNodes.length-1]:null;if(!e||g===b&&1===b.nodeType&&"block"===f.getComputedStyle(b).display)if(c){var h=this.doc.createTextNode(a.INVISIBLE_SPACE);b.parentNode.insertBefore(h,b.nextSibling),this.selectNode(h),setTimeout(function(){h&&h.parentNode&&h.parentNode.removeChild(h)},0)}else this.createTemporaryCaretSpaceAfter(b)}.bind(this);if(g.setStartAfter(b),g.setEndAfter(b),document.activeElement&&document.activeElement===this.composer.element)e=this.setSelection(g),h(),d&&d(e);else{var i=this.composer.getScrollPos();this.composer.element.focus(),this.composer.setScrollPos(i),setTimeout(function(){e=this.setSelection(g),h(),d&&d(e)}.bind(this),0)}},selectNode:function(b,c){var d=rangy.createRange(this.doc),e=b.nodeType===a.ELEMENT_NODE,f="canHaveHTML"in b?b.canHaveHTML:"IMG"!==b.nodeName,g=e?b.innerHTML:b.data,i=""===g||g===a.INVISIBLE_SPACE,j=h.getStyle("display").from(b),k="block"===j||"list-item"===j;if(i&&e&&f&&!c)try{b.innerHTML=a.INVISIBLE_SPACE}catch(l){}f?d.selectNodeContents(b):d.selectNode(b),f&&i&&e?d.collapse(k):f&&i&&(d.setStartAfter(b),d.setEndAfter(b)),this.setSelection(d)},getSelectedNode:function(a){var b,c;return a&&this.doc.selection&&"Control"===this.doc.selection.type&&(c=this.doc.selection.createRange(),c&&c.length)?c.item(0):(b=this.getSelection(this.doc),b.focusNode===b.anchorNode?b.focusNode:(c=this.getRange(this.doc),c?c.commonAncestorContainer:this.doc.body))},fixSelBorders:function(){var a=this.getRange();g(a),this.setSelection(a)},getSelectedOwnNodes:function(a){for(var b=this.getOwnRanges(),c=[],d=0,e=b.length;e>d;d++)c.push(b[d].commonAncestorContainer||this.doc.body);return c},findNodesInSelection:function(b){for(var c,d=this.getOwnRanges(),e=[],f=0,g=d.length;g>f;f++)c=d[f].getNodes([1],function(c){return a.lang.array(b).contains(c.nodeName)}),e=e.concat(c);return e},filterElements:function(a){for(var b,c=this.getOwnRanges(),d=[],e=0,f=c.length;f>e;e++)b=c[e].getNodes([1],function(b){return a(b,c[e])}),d=d.concat(b);return d},containsUneditable:function(){for(var a=this.getOwnUneditables(),b=this.getSelection(),c=0,d=a.length;d>c;c++)if(b.containsNode(a[c]))return!0;return!1},deleteContents:function(){var a=this.getRange();this.deleteRangeContents(a),this.setSelection(a)},deleteRangeContents:function(b){var c,d,e,f;if(this.unselectableClass){(c=a.dom.getParentElement(b.startContainer,{query:"."+this.unselectableClass},!1,this.contain))&&b.setStartBefore(c),(d=a.dom.getParentElement(b.endContainer,{query:"."+this.unselectableClass},!1,this.contain))&&b.setEndAfter(d),e=b.getNodes([1],function(b){return a.dom.hasClass(b,this.unselectableClass)}.bind(this));for(var g=e.length;g--;)try{f=new CustomEvent("wysihtml5:uneditable:delete"),e[g].dispatchEvent(f)}catch(h){}}b.deleteContents()},getCaretNode:function(){var a=this.getSelection();return a&&a.anchorNode?e(a.anchorNode,a.anchorOffset):null},getPreviousNode:function(b,c){var d;if(!b){var f=this.getSelection();b=f&&f.anchorNode?e(f.anchorNode,f.anchorOffset):null}if(b===this.contain)return!1;var g,h=b.previousSibling;return h===this.contain?!1:(h&&3!==h.nodeType&&1!==h.nodeType?h=this.getPreviousNode(h,c):h&&3===h.nodeType&&/^\s*$/.test(h.textContent)?h=this.getPreviousNode(h,c):c&&h&&1===h.nodeType?(d=a.dom.getStyle("display").from(h),a.lang.array(["BR","HR","IMG"]).contains(h.nodeName)||a.lang.array(["block","inline-block","flex","list-item","table"]).contains(d)||!/^[\s]*$/.test(h.innerHTML)||(h=this.getPreviousNode(h,c))):h||b===this.contain||(g=b.parentNode,g!==this.contain&&(h=this.getPreviousNode(g,c))),h!==this.contain?h:!1)},getNodesNearCaret:function(){if(!this.isCollapsed())throw"Selection must be caret when using selection.getNodesNearCaret()";var a,b,c,d,e=this.getOwnRanges();return e&&e.length>0?(1===e[0].startContainer.nodeType?(a=e[0].startContainer.childNodes[e[0].startOffset-1],a||0!==e[0].startOffset?a&&(b=a.previousSibling,c=a.nextSibling):c=e[0].startContainer.childNodes[0]):(0===e[0].startOffset&&e[0].startContainer.previousSibling?(a=e[0].startContainer.previousSibling,3===a.nodeType&&(d=a.data.length)):(a=e[0].startContainer,d=e[0].startOffset),b=a.previousSibling,c=a.nextSibling),{caretNode:a,prevNode:b,nextNode:c,textOffset:d}):null},getSelectionParentsByTag:function(b){for(var c,d=this.getSelectedOwnNodes(),e=[],f=0,g=d.length;g>f;f++)c=d[f].nodeName&&"LI"===d[f].nodeName?d[f]:a.dom.getParentElement(d[f],{query:"li"},!1,this.contain),c&&e.push(c);return e.length?e:null},getRangeToNodeEnd:function(){if(this.isCollapsed()){var a=this.getRange(),b=a.startContainer,c=a.startOffset,d=rangy.createRange(this.doc);return d.selectNodeContents(b),d.setStart(b,c),d}},caretIsLastInSelection:function(){var a=(rangy.createRange(this.doc),this.getSelection(),this.getRangeToNodeEnd().cloneContents()),b=a.textContent;return/^\s*$/.test(b)},caretIsFirstInSelection:function(b){var c=rangy.createRange(this.doc),d=this.getSelection(),f=this.getRange(),g=e(f.startContainer,f.startOffset);if(g){if(g.nodeType===a.TEXT_NODE){if(!g.parentNode)return!1;if(!this.isCollapsed()||g.parentNode.firstChild!==g&&!a.dom.domNode(g.previousSibling).is.block())return!1;var h=this.win.getComputedStyle(g.parentNode).whiteSpace;return"pre"===h||"pre-wrap"===h?0===f.startOffset:/^\s*$/.test(g.data.substr(0,f.startOffset))}return b&&a.dom.domNode(g).is.lineBreak()?!0:(c.selectNodeContents(this.getRange().commonAncestorContainer),c.collapse(!0),this.isCollapsed()&&(c.startContainer===d.anchorNode||c.endContainer===d.anchorNode)&&c.startOffset===d.anchorOffset)}},caretIsInTheBeginnig:function(b){var c=this.getSelection(),d=c.anchorNode,e=c.anchorOffset;return b&&d?0===e&&(d.nodeName&&d.nodeName===b.toUpperCase()||a.dom.getParentElement(d.parentNode,{query:b},1)):d?0===e&&!this.getPreviousNode(d,!0):void 0},getBeforeSelection:function(b){var c,d,e=this.getSelection(),f=e.isBackwards()?e.focusNode:e.anchorNode,g=e.isBackwards()?e.focusOffset:e.anchorOffset,h=this.createRange();if(f&&3===f.nodeType&&/^\s*$/.test(f.data.slice(0,g))&&(g=0),d=a.dom.getParentElement(f,{query:"._wysihtml5-temp-caret-fix"},1),d&&(f=d.parentNode,g=Array.prototype.indexOf.call(f.childNodes,d)),f){if(g>0)return 3===f.nodeType?(h.setStart(f,0),h.setEnd(f,g),{type:"text",range:h,offset:g,node:f}):(h.setStartBefore(f.childNodes[0]),c=f.childNodes[g-1],h.setEndAfter(c),{type:"element",range:h,offset:g,node:c});if(h.setStartAndEnd(f,0),b){var i=this.getPreviousNode(f,!0),j=null;if(i&&(j=1===i.nodeType&&a.dom.hasClass(i,this.unselectableClass)?i:a.dom.domNode(i).lastLeafNode()),j)return{type:"leafnode",range:h,offset:g,node:j}}return{type:"none",range:h,offset:g,node:f}}return null},executeAndRestoreRangy:function(a,b){var c=rangy.saveSelection(this.win);if(c)try{a()}catch(d){setTimeout(function(){throw d},0)}else a();rangy.restoreSelection(c)},executeAndRestore:function(b,c){var d,e,f,g,i,j,k,l,m=this.doc.body,n=c&&m.scrollTop,o=c&&m.scrollLeft,p="_wysihtml5-temp-placeholder",q=''+a.INVISIBLE_SPACE+"",r=this.getRange(!0);if(!r)return void b(m,m);r.collapsed||(k=r.cloneRange(),j=k.createContextualFragment(q),k.collapse(!1),k.insertNode(j),k.detach()),i=r.createContextualFragment(q),r.insertNode(i),j&&(d=this.contain.querySelectorAll("."+p),r.setStartBefore(d[0]),r.setEndAfter(d[d.length-1])),this.setSelection(r);try{b(r.startContainer,r.endContainer)}catch(s){setTimeout(function(){throw s},0)}if(d=this.contain.querySelectorAll("."+p),d&&d.length){l=rangy.createRange(this.doc),f=d[0].nextSibling,d.length>1&&(g=d[d.length-1].previousSibling),g&&f?(l.setStartBefore(f),l.setEndAfter(g)):(e=this.doc.createTextNode(a.INVISIBLE_SPACE),h.insert(e).after(d[0]),l.setStartBefore(e),l.setEndAfter(e)),this.setSelection(l);for(var t=d.length;t--;)d[t].parentNode.removeChild(d[t])}else this.contain.focus();c&&(m.scrollTop=n,m.scrollLeft=o);try{d.parentNode.removeChild(d)}catch(u){}},set:function(a,b){var c=rangy.createRange(this.doc);c.setStart(a,b||0),this.setSelection(c)},insertHTML:function(a){var b,c,d=this.getRange(),e=this.doc.createElement("DIV"),f=this.doc.createDocumentFragment();if(d){for(d.deleteContents(),e.innerHTML=a,b=e.lastChild;e.firstChild;)f.appendChild(e.firstChild);for(d.insertNode(f),c=this.contain.lastChild;c&&3===c.nodeType&&c.previousSibling&&/^\s*$/.test(c.data);)c=c.previousSibling;b&&(c&&b===c&&1===b.nodeType&&this.contain.appendChild(this.doc.createElement("br")),this.setAfter(b))}},insertNode:function(a){var b=this.getRange();b&&b.insertNode(a)},canAppendChild:function(a){var b,c,d=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],e=this.getRange();return b=a||e.startContainer,b&&(c=(b.tagName||b.nodeName).toLowerCase()),-1===d.indexOf(c)},splitElementAtCaret:function(b,c){var d,e,f,g,h,i=this.getSelection();if(i.rangeCount>0){d=i.getRangeAt(0).cloneRange(),d.setEndAfter(b),e=d.extractContents(),h=e.childNodes;for(var j=h.length;j--;)a.dom.domNode(h[j]).is.visible()||e.removeChild(h[j]);b.parentNode.insertBefore(e,b.nextSibling),c?(f=c.firstChild||c,g=c.lastChild||c,b.parentNode.insertBefore(c,b.nextSibling),f&&g&&(d.setStartBefore(f),d.setEndAfter(g),this.setSelection(d))):(d.setStartAfter(b),d.setEndAfter(b)),a.dom.domNode(b).is.visible()||(""===a.dom.getTextContent(b)?b.parentNode.removeChild(b):b.parentNode.replaceChild(this.doc.createTextNode(" "),b))}},surround:function(a){var b,c=this.getOwnRanges(),d=[];if(0==c.length)return d;for(var e=c.length;e--;){b=this.doc.createElement(a.nodeName),d.push(b),a.className&&(b.className=a.className),a.cssStyle&&b.setAttribute("style",a.cssStyle);try{c[e].surroundContents(b),this.selectNode(b)}catch(f){b.appendChild(c[e].extractContents()),c[e].insertNode(b)}}return d},scrollIntoView:function(){var b,d=this.doc,e=5,f=d.documentElement.scrollHeight>d.documentElement.offsetHeight,g=d._wysihtml5ScrollIntoViewElement=d._wysihtml5ScrollIntoViewElement||function(){var b=d.createElement("span");return b.innerHTML=a.INVISIBLE_SPACE,b}();f&&(this.insertNode(g),b=c(g),g.parentNode.removeChild(g),b>=d.body.scrollTop+d.documentElement.offsetHeight-e&&(d.body.scrollTop=b))},selectLine:function(){var b=rangy.createRange();a.browser.supportsSelectionModify()?this._selectLine_W3C():b.nativeRange&&b.nativeRange.getBoundingClientRect&&this._selectLineUniversal()},includeRangyRangeHelpers:function(){var a=this.getSelection(),b=a.getRangeAt(0),c=function(a){return a&&1===a.nodeType&&a.classList.contains("rangySelectionBoundary")},d=function(a){return 1===a.nodeType?a.childNodes&&a.childNodes.length||0:a.data&&a.data.length||0},e=1===a.anchorNode.nodeType?a.anchorNode.childNodes[a.anchorOffset]:a.anchorNode,f=1===a.focusNode.nodeType?a.focusNode.childNodes[a.focusOffset]:a.focusNode;f&&a.focusOffset===d(f)&&f.nextSibling&&c(f.nextSibling)&&b.setEndAfter(f.nextSibling),e&&0===a.anchorOffset&&e.previousSibling&&c(e.previousSibling)&&b.setStartBefore(e.previousSibling),b.select()},_selectLine_W3C:function(){var a=this.win.getSelection(),b=[a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset];a.modify("move","left","lineboundary"),a.modify("extend","right","lineboundary"),a.anchorNode===b[0]&&a.anchorOffset===b[1]&&a.focusNode===b[2]&&a.focusOffset===b[3]?this._selectLineUniversal():this.includeRangyRangeHelpers()},toLineBoundary:function(b,c){if(c="undefined"==typeof c?!1:c,a.browser.supportsSelectionModify()){var d=this.win.getSelection();d.modify("extend",b,"lineboundary"),c&&("left"===b?d.collapseToStart():"right"===b&&d.collapseToEnd())}},getRangeRect:function(a){var b,c=(this.doc.createTextNode("i"),this.doc.createTextNode("i"));return a.collapsed?(a.insertNode(c),a.selectNode(c),b=a.nativeRange.getBoundingClientRect(),a.deleteContents()):b=a.nativeRange.getBoundingClientRect(),b},_selectLineUniversal:function(){var b,c,d,e,f,g,h=this.getSelection(),i=h.getRangeAt(0),j=0,k=this,l=function(b){return b&&1===b.nodeType&&("block"===k.win.getComputedStyle(b).display||a.lang.array(["BR","HR"]).contains(b.nodeName))},m=function(a){var b=a;if(b)for(;b&&(1===b.nodeType&&b.classList.contains("rangySelectionBoundary")||3===b.nodeType&&/^\s*$/.test(b.data));)b=b.previousSibling;return b};c=i.cloneRange(),d=i.cloneRange(),i.collapsed&&(3===i.startContainer.nodeType&&i.startOffset0?i.moveEnd("character",1):i.startOffset>0&&(3===i.startContainer.nodeType||1===i.startContainer.nodeType&&!l(m(i.startContainer.childNodes[i.startOffset-1])))&&i.moveStart("character",-1)),i.collapsed||i.insertNode(this.doc.createTextNode(a.INVISIBLE_SPACE)),b=i.nativeRange.getBoundingClientRect();do e=i.moveStart("character",-1),f=i.nativeRange.getBoundingClientRect(),f&&Math.floor(f.top)===Math.floor(b.top)||(i.moveStart("character",1),g=!0),j++;while(0!==e&&!g&&2e3>j);if(j=0,g=!1,b=i.nativeRange.getBoundingClientRect(),i.endContainer!==this.contain||this.contain.lastChild&&this.contain.childNodes[i.endOffset]!==this.contain.lastChild)do e=i.moveEnd("character",1),f=i.nativeRange.getBoundingClientRect(),f&&Math.floor(f.bottom)===Math.floor(b.bottom)||(i.moveEnd("character",-1),i.endContainer&&1===i.endContainer.nodeType&&i.endContainer.childNodes[i.endOffset]&&1===i.endContainer.childNodes[i.endOffset].nodeType&&"BR"===i.endContainer.childNodes[i.endOffset].nodeName&&i.endContainer.childNodes[i.endOffset].previousSibling&&(1===i.endContainer.childNodes[i.endOffset].previousSibling.nodeType?i.setEnd(i.endContainer.childNodes[i.endOffset].previousSibling,i.endContainer.childNodes[i.endOffset].previousSibling.childNodes.length):3===i.endContainer.childNodes[i.endOffset].previousSibling.nodeType&&i.setEnd(i.endContainer.childNodes[i.endOffset].previousSibling,i.endContainer.childNodes[i.endOffset].previousSibling.data.length)),g=!0),j++;while(0!==e&&!g&&2e3>j);i.select(),this.includeRangyRangeHelpers()},getText:function(){var a=this.getSelection();return a?a.toString():""},getNodes:function(a,b){var c=this.getRange();return c?c.getNodes(Array.isArray(a)?a:[a],b):[]},getOwnNodes:function(a,b,c){for(var d=this.getOwnRanges(),e=[],f=0,g=d.length;g>f;f++)d[f]&&(c&&d[f].splitBoundaries(),e=e.concat(d[f].getNodes(Array.isArray(a)?a:[a],b)));return e},fixRangeOverflow:function(a){if(this.contain&&this.contain.firstChild&&a){var b=a.compareNode(this.contain);if(2!==b)1===b&&a.setStartBefore(this.contain.firstChild),0===b&&a.setEndAfter(this.contain.lastChild),3===b&&(a.setStartBefore(this.contain.firstChild),a.setEndAfter(this.contain.lastChild));else if(this._detectInlineRangeProblems(a)){var c=a.endContainer.previousElementSibling;c&&a.setEnd(c,this._endOffsetForNode(c))}}},_endOffsetForNode:function(a){var b=document.createRange();return b.selectNodeContents(a),b.endOffset},_detectInlineRangeProblems:function(a){var b=h.compareDocumentPosition(a.startContainer,a.endContainer);return 0==a.endOffset&&4&b},getRange:function(a){var b=this.getSelection(),c=b&&b.rangeCount&&b.getRangeAt(0);return a!==!0&&this.fixRangeOverflow(c),c},getOwnUneditables:function(){var b=h.query(this.contain,"."+this.unselectableClass),c=h.query(b,"."+this.unselectableClass);return a.lang.array(b).without(c)},getOwnRanges:function(){var a,b=[],c=this.getRange();if(c&&b.push(c),this.unselectableClass&&this.contain&&c){var d,e=this.getOwnUneditables();if(e.length>0)for(var f=0,g=e.length;g>f;f++){a=[];for(var h=0,i=b.length;i>h;h++){if(b[h])switch(b[h].compareNode(e[f])){case 2:break;case 3:d=b[h].cloneRange(),d.setEndBefore(e[f]),a.push(d),d=b[h].cloneRange(),d.setStartAfter(e[f]),a.push(d);break;default:a.push(b[h])}b=a}}}return b},getSelection:function(){return rangy.getSelection(this.win)},setSelection:function(a){var b=rangy.getSelection(this.win);return b.setSingleRange(a),b&&b.anchorNode&&b.focusNode?b:null},selectAll:function(){var b,c=this.createRange(),d=this.composer,e=this,g=f(this.composer.element),h=f(this.composer.element),i=function(){c.setStart(d.element,0),c.setEnd(d.element,d.element.childNodes.length),b=e.setSelection(c)},j=function(){return!b||b.nativeSelection&&b.nativeSelection.type&&("Caret"===b.nativeSelection.type||"None"===b.nativeSelection.type)};a.dom.removeInvisibleSpaces(this.composer.element),i(),this.composer.element.firstChild&&j()&&(this.composer.element.appendChild(g),i(),j()&&(g.parentNode.removeChild(g),this.composer.element.insertBefore(h,this.composer.element.firstChild),i(),j()&&(this.composer.element.appendChild(g),i())))},createRange:function(){return rangy.createRange(this.doc)},isCollapsed:function(){return this.getSelection().isCollapsed},getHtml:function(){return this.getSelection().toHtml()},getPlainText:function(){return this.getSelection().toString()},isEndToEndInNode:function(b){var c=this.getRange(),d=c.commonAncestorContainer,e=c.startContainer,f=c.endContainer;if(d.nodeType===a.TEXT_NODE&&(d=d.parentNode),e.nodeType===a.TEXT_NODE&&!/^\s*$/.test(e.data.substr(c.startOffset)))return!1;if(f.nodeType===a.TEXT_NODE&&!/^\s*$/.test(f.data.substr(c.endOffset)))return!1;for(;e&&e!==d;){if(e.nodeType!==a.TEXT_NODE&&!a.dom.contains(d,e))return!1;if(a.dom.domNode(e).prev({ignoreBlankTexts:!0}))return!1;e=e.parentNode}for(;f&&f!==d;){if(f.nodeType!==a.TEXT_NODE&&!a.dom.contains(d,f))return!1;if(a.dom.domNode(f).next({ignoreBlankTexts:!0}))return!1;f=f.parentNode}return a.lang.array(b).contains(d.nodeName)?d:!1},isInThisEditable:function(){var b=this.getSelection(),c=b.focusNode,d=b.anchorNode;return c&&1!==c.nodeType&&(c=c.parentNode),d&&1!==d.nodeType&&(d=d.parentNode),d&&c&&(a.dom.contains(this.composer.element,c)||this.composer.element===c)&&(a.dom.contains(this.composer.element,d)||this.composer.element===d)},deselect:function(){var a=this.getSelection();a&&a.removeAllRanges()}})}(a),a.Commands=b.extend({constructor:function(a){this.editor=a,this.composer=a.composer,this.doc=this.composer.doc},support:function(b){return a.browser.supportsCommand(this.doc,b)},exec:function(b,c){var d=a.commands[b],e=a.lang.array(arguments).get(),f=d&&d.exec,g=null;if(this.composer.hasPlaceholderSet()&&!a.lang.array(["styleWithCSS","enableObjectResizing","enableInlineTableEditing"]).contains(b)&&(this.composer.element.innerHTML="",this.composer.selection.selectNode(this.composer.element)),this.editor.fire("beforecommand:composer"),f)e.unshift(this.composer),g=f.apply(d,e);else try{g=this.doc.execCommand(b,!1,c)}catch(h){}return this.editor.fire("aftercommand:composer"),g},remove:function(b,c){var d=a.commands[b],e=a.lang.array(arguments).get(),f=d&&d.remove;return f?(e.unshift(this.composer),f.apply(d,e)):void 0},state:function(b,c){var d=a.commands[b],e=a.lang.array(arguments).get(),f=d&&d.state;if(f)return e.unshift(this.composer),f.apply(d,e);try{return this.doc.queryCommandState(b)}catch(g){return!1}},stateValue:function(b){var c=a.commands[b],d=a.lang.array(arguments).get(),e=c&&c.stateValue;return e?(d.unshift(this.composer),e.apply(c,d)):!1}}),function(a){function b(b){return a.lang.object({}).merge(c).merge({attribute:b}).get()}var c={nodeName:"A",toggle:!1};a.commands.createLink={exec:function(c,d,e){var f=b(e);if(c.selection.isCollapsed()&&!this.state(c,d)){var g=c.doc.createTextNode(f.attribute.href);c.selection.insertNode(g),c.selection.selectNode(g)}a.commands.formatInline.exec(c,d,f)},state:function(b,d){return a.commands.formatInline.state(b,d,c)}}}(a),function(a){var b={nodeName:"A"};a.commands.removeLink={exec:function(c,d){a.commands.formatInline.remove(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(a),function(a){function b(a){return{nodeName:a.nodeName||null,className:a.classRegExp?null:a.className||null,classRegExp:a.classRegExp||null,styleProperty:a.styleProperty||null}}function c(a,b){return 3===a.nodeType?a:a.childNodes[b]||a}function d(a){return a&&1===a.nodeType&&"BR"===a.nodeName}function e(a,b){return a&&1===a.nodeType&&"block"===b.win.getComputedStyle(a).display}function f(a){ +return a&&1===a.nodeType&&a.classList.contains("rangySelectionBoundary")}function g(a,b){return d(a)||e(a,b)}function h(b,c){a.dom.removeInvisibleSpaces(b.element);for(var d,e=b.element,f=e.querySelectorAll(E),g=b.config.classNames.uneditableContainer+[""].concat(E.split(",")).join(", "+b.config.classNames.uneditableContainer+" "),h=e.querySelectorAll(g),i=a.lang.array(f).without(h),j=i.length;j--;)""!==i[j].innerHTML.replace(/[\uFEFF]/g,"")||0!==c.length&&i[j]===c[c.length-1]||(d=a.lang.array(c).indexOf(i[j]),d>-1&&c.splice(d,1),i[j].parentNode.removeChild(i[j]));return c}function i(a){return a.config.useLineBreaks?"DIV":"P"}function j(a,b,c){for(var d=a,e=null;d&&b&&d!==b;)1===d.nodeType&&d.matches(c?E:D)&&(e=d),d=d.parentNode;return e}function k(a,b){for(var c,d,e,f=a,g=null;f&&b&&f!==b;)1===f.nodeType&&f.matches(F)&&(d=f,null===g?(g=f.cloneNode(!1),c=g):(e=f.cloneNode(!1),e.appendChild(g),g=e)),f=f.parentNode;return{parent:d,outerNode:g,innerNode:c}}function l(b,c,d){return b||(b=d.doc.createElement(c.nodeName||i(d)),b.appendChild(d.doc.createTextNode(a.INVISIBLE_SPACE))),c.nodeName&&b.nodeName!==c.nodeName&&(b=C.renameElement(b,c.nodeName)),c.classRegExp&&(b.className=b.className.replace(c.classRegExp,"")),c.className&&b.classList.add(c.className),c.styleProperty&&"undefined"!=typeof c.styleValue&&(b.style[a.browser.fixStyleKey(c.styleProperty)]=c.styleValue),b}function m(b,c,d){var e,f=b.previousSibling,g=b.nextSibling,h=!1;c.styleProperty&&(b.style[a.browser.fixStyleKey(c.styleProperty)]=""),c.className&&b.classList.remove(c.className),c.classRegExp&&(b.className=b.className.replace(c.classRegExp,"")),null!==b.getAttribute("class")&&""===b.getAttribute("class").trim()&&b.removeAttribute("class"),c.nodeName&&b.nodeName.toLowerCase()===c.nodeName.toLowerCase()&&(e=b.getAttribute("style"),e&&""!==e.trim()?b=C.renameElement(b,i(d)):(C.unwrap(b),h=!0)),null!==b.getAttribute("style")&&""===b.getAttribute("style").trim()&&b.removeAttribute("style"),h&&u(f,g,d)}function n(b){for(var c,d,e=b.querySelectorAll(E)||[],f=e.length;f--;)c=a.dom.domNode(e[f]).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),d=a.dom.domNode(e[f]).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),c&&1!==c.nodeType&&"BR"!==c.nodeName&&""!==(e[f].innerHTML||e[f].nodeValue||"").trim()&&e[f].parentNode.insertBefore(e[f].ownerDocument.createElement("BR"),c),c&&1!==c.nodeType&&"BR"!==c.nodeName&&""!==(e[f].innerHTML||e[f].nodeValue||"").trim()&&e[f].parentNode.insertBefore(e[f].ownerDocument.createElement("BR"),c),a.dom.unwrap(e[f])}function o(a,b){var c,d=a.startContainer,e=a.endContainer;return d&&1===d.nodeType&&d===e?void(d.firstChild===d.lastChild&&1===a.endOffset&&d!==b.element&&"LI"!==d.nodeName&&"TD"!==d.nodeName&&(a.setStartBefore(d),a.setEndAfter(e))):d&&1===d.nodeType&&3===e.nodeType?void(d.firstChild===e&&a.endOffset===e.data.length&&d!==b.element&&"LI"!==d.nodeName&&"TD"!==d.nodeName&&a.setEndAfter(d)):e&&1===e.nodeType&&3===d.nodeType?void(e.firstChild===d&&0===a.startOffset&&e!==b.element&&"LI"!==e.nodeName&&"TD"!==e.nodeName&&a.setStartBefore(e)):d&&3===d.nodeType&&d===e&&1===d.parentNode.childNodes.length?void(a.endOffset==e.data.length&&0===a.startOffset&&(c=d.parentNode,c!==b.element&&"LI"!==c.nodeName&&"TD"!==c.nodeName&&(a.setStartBefore(c),a.setEndAfter(c)))):void 0}function p(b){for(var c,d,e,f,g,h,i=[],j=0,k=b.length;k>j;j++)if(1===b[j].startContainer.nodeType&&b[j].startContainer.matches("ul, ol")&&b[j].setStart(b[j].startContainer.childNodes[b[j].startOffset],0),1===b[j].endContainer.nodeType&&b[j].endContainer.matches("ul, ol")&&(h=b[j].endContainer.childNodes[Math.max(b[j].endOffset-1,0)],h.childNodes&&b[j].setEnd(h,h.childNodes.length)),c=b[j].getNodes([1],function(a){return"LI"===a.nodeName}),c.length>0){for(d=0,e=c.length;e>d;d++)g=b[j].compareNode(c[d]),(g===b[j].NODE_AFTER||g===b[j].NODE_INSIDE)&&(f=b[j].cloneRange(),h=a.dom.domNode(c[d]).prev({nodeTypes:[1]}),h?f.setEnd(h,h.childNodes.length):c[d].closest("ul, ol")?f.setEndBefore(c[d].closest("ul, ol")):f.setEndBefore(c[d]),i.push(f),b[j].setStart(c[d],0)),(g===b[j].NODE_BEFORE||g===b[j].NODE_INSIDE)&&(f=b[j].cloneRange(),f.setEnd(c[d],c[d].childNodes.length),i.push(f),h=a.dom.domNode(c[d]).next({nodeTypes:[1]}),h?b[j].setStart(h,0):c[d].closest("ul, ol")?b[j].setStartAfter(c[d].closest("ul, ol")):b[j].setStartAfter(c[d]));i.push(b[j])}else i.push(b[j]);return i}function q(b,c,d){var e=b?a.lang.object(b).clone(!0):null;return e&&(e.nodeName=e.nodeName||c||i(d)),e}function r(b,c,d,e){var f,h,i,l,m,n=c.startContainer,e=e||j(n,d.element,!0);if(e)h=b.firstChild,i=b.lastChild,d.selection.splitElementAtCaret(e,b),m=a.dom.domNode(i).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),l=a.dom.domNode(h).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),h&&!g(h,d)&&l&&!g(l,d)&&h.parentNode.insertBefore(d.doc.createElement("br"),h),i&&!g(i,d)&&m&&!g(m,d)&&m.parentNode.insertBefore(d.doc.createElement("br"),m);else if(f=k(n,d.element),f.outerNode&&f.innerNode&&f.parent){if(1===b.childNodes.length){for(;b.firstChild.firstChild;)f.innerNode.appendChild(b.firstChild.firstChild);b.firstChild.appendChild(f.outerNode)}d.selection.splitElementAtCaret(f.parent,b)}else{var o=b.firstChild,p=b.lastChild;c.insertNode(b),c.setStartBefore(o),c.setEndAfter(p)}}function s(b,d,e){for(var f,h,i=b.cloneRange(),j=c(i.startContainer,i.startOffset).previousSibling,k=c(i.endContainer,i.endOffset).nextSibling,l=i.extractContents(),m=e.doc.createDocumentFragment(),o=!0;l.firstChild;){if(1===l.firstChild.nodeType&&l.firstChild.matches(E)){n(l.firstChild),f=a.dom.unwrap(l.firstChild),f.length>0&&(m.lastChild&&(1!==m.lastChild.nodeType||!g(m.lastChild,e))||!m.lastChild&&j&&(1!==j.nodeType||g(j,e)))&&m.appendChild(e.doc.createElement("BR"));for(var p=0,q=f.length;q>p;p++)m.appendChild(f[p]);f.length>0&&(1===m.lastChild.nodeType&&g(m.lastChild,e)||(k||m.lastChild!==l.lastChild)&&m.appendChild(e.doc.createElement("BR")))}else m.appendChild(l.firstChild);o=!1}return h=a.lang.array(m.childNodes).get(),r(m,i,e),h}function t(b,c,e){var f=b&&a.dom.domNode(b).prev({nodeTypes:[1,3],ignoreBlankTexts:!0});d(c)&&c.parentNode.removeChild(c),!d(b)||f&&1===f.nodeType&&"block"===e.win.getComputedStyle(f).display||b.parentNode.removeChild(b)}function u(a,b,c){var e;a&&f(a)&&(a=a.previousSibling),b&&f(b)&&(b=b.nextSibling),e=a&&a.previousSibling,a&&(1!==a.nodeType||"block"!==c.win.getComputedStyle(a).display&&!d(a))&&a.parentNode&&a.parentNode.insertBefore(c.doc.createElement("br"),a.nextSibling),b&&(1!==b.nodeType||"block"!==c.win.getComputedStyle(b).display)&&b.parentNode&&b.parentNode.insertBefore(c.doc.createElement("br"),b)}function v(d,e,f,g){var h,i,k=e?b(e):null,m=d.cloneRange(),o=m.startContainer,p=c(m.startContainer,m.startOffset),s=c(m.endContainer,m.endOffset),u=m.startContainer!==p||3!==p.nodeType||G(p,m.startOffset)?a.dom.domNode(p).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}):p,v=1===m.endContainer.nodeType&&m.endContainer.childNodes[m.endOffset]===s&&(1===s.nodeType||!H(s,m.endOffset)&&!a.dom.domNode(s).is.rangyBookmark())||m.endContainer===s&&3===s.nodeType&&!H(s,m.endOffset)?s:a.dom.domNode(s).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),w=m.extractContents(),x=g.doc.createDocumentFragment(),y=k?a.dom.getParentElement(o,k,null,g.element):null,z=!f||!e||"BLOCKQUOTE"===e.nodeName&&"BLOCKQUOTE"===f,A=y||j(o,g.element,z);if(a.dom.domNode(v).is.rangyBookmark()&&(s=v,v=s.nextSibling),I(w),e&&"BLOCKQUOTE"===e.nodeName){var B=l(null,e,g);B.appendChild(w),x.appendChild(B),i=[B]}else{if(w.firstChild)for(;w.firstChild;)if(1==w.firstChild.nodeType&&w.firstChild.matches(E))l(w.firstChild,e,g),w.firstChild.matches(D)&&n(w.firstChild),x.appendChild(w.firstChild);else{for(h=l(null,q(e,f,g),g);w.firstChild&&(1!==w.firstChild.nodeType||!w.firstChild.matches(E));)1==w.firstChild.nodeType&&h.matches(D)&&n(w.firstChild),h.appendChild(w.firstChild);x.appendChild(h)}else x.appendChild(l(null,e,g));i=a.lang.array(x.childNodes).get()}return r(x,m,g,A),t(u,v,g),i.length>0&&("undefined"==typeof i[i.length-1].lastChild||a.dom.domNode(i[i.length-1].lastChild).is.rangyBookmark())&&i[i.length-1].appendChild(g.doc.createElement("br")),i}function w(b,c){var d=a.dom.getParentElement(b,{query:E},null,c.element);return d?d.nodeName:null}function x(b,c){var d,e=a.dom.getParentElement(b.selection.getOwnRanges()[0].startContainer,{query:D+", "+(c?c.toLowerCase():"div")},null,b.element);e?(d=b.selection.createRange(),d.selectNode(e),b.selection.setSelection(d)):b.isEmpty()||b.selection.selectLine()}function y(a,b){var c=b.selection.createRange(),d=a[a.length-1],e=1===d.nodeType&&d.childNodes?0|d.childNodes.length:d.length||0;c.setStart(a[0],0),c.setEnd(d,e),c.select()}function z(a,b,c){var d,e=b.selection.getOwnRanges(),f=[];e=p(e);for(var g=e.length;g--;)o(e[g],b),d=w(e[g].startContainer,b),f="remove"===a?f.concat(s(e[g],d,b)):f.concat(v(e[g],c,d,b));return f}function A(a){return"string"==typeof a&&(a={nodeName:a.toUpperCase()}),a}function B(b){var c;return b.selection.isCollapsed()&&(c=b.selection.getNodesNearCaret(),c&&c.caretNode&&(a.dom.domNode(c.caretNode).is.lineBreak()||3===c.caretNode.nodeType&&0===c.textOffset&&(!c.prevNode||a.dom.domNode(c.prevNode).is.lineBreak())||1===c.caretNode.nodeType&&c.caretNode.classList.contains("rangySelectionBoundary")&&(!c.prevNode||a.dom.domNode(c.prevNode).is.lineBreak()||a.dom.domNode(c.prevNode).is.block())&&(!c.nextNode||a.dom.domNode(c.nextNode).is.lineBreak()||a.dom.domNode(c.nextNode).is.block())))?!0:!1}var C=a.dom,D="h1, h2, h3, h4, h5, h6, p, pre",E="h1, h2, h3, h4, h5, h6, p, pre, div, blockquote",F="b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",G=function(a,b){var c=a.data?a.data.slice(0,b):"";return/^\s*$/.test(c)},H=function(a,b){var c=a.data?a.data.slice(b):"";return/^\s*$/.test(c)},I=function(a){if(a){for(;a.firstChild&&3===a.firstChild.nodeType&&/^\s*$/.test(a.firstChild.data)&&a.lastChild!==a.firstChild;)a.removeChild(a.firstChild);for(;a.lastChild&&3===a.lastChild.nodeType&&/^\s*$/.test(a.lastChild.data)&&a.lastChild!==a.firstChild;)a.removeChild(a.lastChild);a.firstChild&&1===a.firstChild.nodeType&&"BR"===a.firstChild.nodeName&&a.lastChild!==a.firstChild&&a.removeChild(a.firstChild),a.lastChild&&1===a.lastChild.nodeType&&"BR"===a.lastChild.nodeName&&a.lastChild!==a.firstChild&&a.removeChild(a.lastChild)}};a.commands.formatBlock={exec:function(a,b,c){c=A(c);var d,e,f=[];if(c&&c.toggle&&(e=this.state(a,b,c)),e){d=rangy.saveSelection(a.win);for(var g=0,i=e.length;i>g;g++)m(e[g],c,a)}else a.selection.isCollapsed()&&(d=rangy.saveSelection(a.win),B(a)?a.selection.selectLine():x(a,c&&c.nodeName?c.nodeName.toUpperCase():void 0)),f=c?z("apply",a,c):z("remove",a);f=h(a,f),d?rangy.restoreSelection(d):y(f,a)},remove:function(a,b,c){c=A(c);var d,e;a.selection.isCollapsed()&&(e=rangy.saveSelection(a.win),x(a,c&&c.nodeName?c.nodeName.toUpperCase():void 0)),d=z("remove",a),d=h(a,d),e?rangy.restoreSelection(e):y(d,a)},state:function(b,c,d){d=A(d);for(var e,f=b.selection.filterElements(function(b){return a.dom.domNode(b).test(d||{query:E})}.bind(this)),g=b.selection.getSelectedOwnNodes(),h=0,i=g.length;i>h;h++)e=C.getParentElement(g[h],d||{query:E},null,b.element),e&&-1===f.indexOf(e)&&f.push(e);return 0===f.length?!1:f}}}(a),function(a){function b(a){return/^\s*$/.test(a.className)}function c(a){return!a.getAttribute("style")||/^\s*$/.test(a.getAttribute("style"))}function d(b){var c=a.dom.getAttributes(b);return a.lang.object(c).isEmpty()}function e(b,c){var d,e,f,g;return 1!==b.nodeType||1!==c.nodeType?!1:b.nodeName!==c.nodeName?!1:(d=b.className.trim().replace(/\s+/g," ").split(" "),e=c.className.trim().replace(/\s+/g," ").split(" "),a.lang.array(d).without(e).length>0?!1:(f=a.dom.getAttributes(b),g=a.dom.getAttributes(c),f.length===g.length&&a.lang.object(a.lang.object(f).difference(g)).isEmpty()?!0:!1))}function f(b,c){var d=c&&c.nodeName||F,e=b.ownerDocument.createElement(d);if(c.classRegExp&&(e.className=e.className.replace(c.classRegExp,"")),c.className&&e.classList.add(c.className),c.styleProperty&&"undefined"!=typeof c.styleValue&&(e.style[a.browser.fixStyleKey(c.styleProperty)]=c.styleValue),c.attribute)if("object"==typeof c.attribute)for(var f in c.attribute)c.attribute.hasOwnProperty(f)&&e.setAttribute(f,c.attribute[f]);else"undefined"!=typeof c.attributeValue&&e.setAttribute(c.attribute,c.attributeValue);return e}function g(a,b){for(var c in a)if(a.hasOwnProperty(c)&&(void 0===typeof b[c]||b[c]!==a[c]))return!1;return!0}function h(b,c,d){var e,f=a.dom.getAttributes(b),h=g(c,f);a.lang.object(f).difference(c);if(h&&d!==!1)for(e in c)c.hasOwnProperty(e)&&b.removeAttribute(e);else for(e in c)c.hasOwnProperty(e)&&b.setAttribute(e,c[e])}function i(e,f){var g,i,j;f.className&&(f.toggle!==!1&&e.classList.contains(f.className)?e.classList.remove(f.className):(f.classRegExp&&(e.className=e.className.replace(f.classRegExp,"")),e.classList.add(f.className)),b(e)&&e.removeAttribute("class")),f.styleProperty&&(f.toggle!==!1&&e.style[a.browser.fixStyleKey(f.styleProperty)].trim().replace(/, /g,",")===f.styleValue?e.style[a.browser.fixStyleKey(f.styleProperty)]="":e.style[a.browser.fixStyleKey(f.styleProperty)]=f.styleValue),c(e)&&e.removeAttribute("style"),f.attribute&&("object"==typeof f.attribute?g=f.attribute:(g={},g[f.attribute]=f.attributeValue||""),h(e,g,f.toggle)),i=f.nodeName?H[f.nodeName.toLowerCase()]||f.nodeName.toLowerCase():null,j=i?a.dom.domNode(e).test({query:i}):!1,(!f.nodeName||f.nodeName===F||j)&&(f.toggle!==!1&&j||!f.nodeName&&e.nodeName===F)&&b(e)&&c(e)&&d(e)&&a.dom.unwrap(e)}function j(b,c){var d=[];return b.isCollapsed()||(d=d.concat(b.getOwnNodes([3],function(b){return!a.dom.domNode(b).is.emptyTextNode()},c))),d}function k(a,b,c,d){var e=a,f=d?b:l(b);do{if(1===e.nodeType&&m(e,f))return e;e=e.parentNode}while(e&&e!==c);return null}function l(a){return{nodeName:a.nodeName||null,className:a.classRegExp?null:a.className||null,classRegExp:a.classRegExp||null,styleProperty:a.styleProperty||null}}function m(b,c){var d;if(c.nodeName){var e=H[c.nodeName.toLowerCase()]||c.nodeName.toLowerCase();return a.dom.domNode(b).test({query:e})}return d=a.lang.object(c).clone(),d.query=G,a.dom.domNode(b).test(d)}function n(b,c){var d=document.documentElement||document.body,e=d.scrollTop,f=d.scrollLeft;rangy.getSelection(b.win);rangy.getSelection(b.win).removeAllRanges();try{rangy.getSelection(b.win).addRange(c)}catch(g){}b.doc.activeElement&&a.dom.contains(b.element,b.doc.activeElement)||(b.element.focus(),d.scrollTop=e,d.scrollLeft=f,rangy.getSelection(b.win).addRange(c))}function o(a,b){var c=rangy.createRange(b.doc),d=a[a.length-1];a[0]&&d&&(c.setStart(a[0],0),c.setEnd(d,d.length),n(b,c))}function p(a,b,c,d){var e=rangy.createRange(a.doc);b&&(e.setStart(b,c),e.setEnd(b,"undefined"!=typeof d?d:c),n(a,e))}function q(a,b,c){var d,e,f,g=j(a.selection),h=[],i=!1;if(a.selection.isInThisEditable()){if(0===g.length&&a.selection.isCollapsed()){if(f=a.selection.getSelection().anchorNode,!f)return{nodes:[],partial:!1};3===f.nodeType&&(g=[f])}g.length||(e=a.selection.getOwnRanges()[0],e&&(g=[e.endContainer]));for(var l=0,m=g.length;m>l;l++)d=k(g[l],b,a.element,c),d?h.push(d):i=!0}return{nodes:h,partial:i}}function r(a){var b,c,d,e;return a&&(b=a.anchorNode,c=a.anchorOffset,b&&3===b.nodeType&&c>0&&c0&&/\w/.test(c.data[g-1]);)g--;for(;h0&&o(b,a),u(q(a,c).nodes),b.length>0&&o(b,a)}function w(a,b,c,d){p(a,b,c),u(q(a,d).nodes),p(a,b,c)}function x(a,b){var c=f(a,b);a.parentNode.insertBefore(c,a),c.appendChild(a)}function y(b,c,d){var e,f=c.element,g=k(b,d,f);g&&(e=g.cloneNode(!1),a.dom.domNode(b).escapeParent(g,e),i(e,d))}function z(b,c,d){var e=c.element,f=k(b,d,e);f&&a.dom.domNode(b).escapeParent(f)}function A(a,b,c){var d=f(a.endContainer,c);a.surroundContents(d),b.selection.selectNode(d)}function B(b,c,d,e){var f,g,h,j,l=q(b,e,!0),m=b.selection.getSelection();if(c.length){if(l.partial||e.toggle===!1)for(j=c.length;j--;)k(c[j],e,b.element)&&y(c[j],b,e),k(c[j],e,b.element)||x(c[j],e);else for(j=c.length;j--;)y(c[j],b,e);v(b,c,e)}else if(e.toggle!==!1)if(r(m))f=s(m),g=f.textNode,y(f.textNode,b,e),w(b,f.textNode,f.wordOffset,e);else{g=b.doc.createTextNode(a.INVISIBLE_SPACE),h=d.nodes[0].cloneNode(!1),h.appendChild(g),b.selection.splitElementAtCaret(d.nodes[0],h),i(h,e),v(b,[g],e);var n=b.selection.getSelection();if(n.anchorNode&&n.focusNode)try{n.collapseToEnd()}catch(o){}}else for(j=d.nodes.length;j--;)i(d.nodes[j],e)}function C(b,c,d,e){var f,g,h,i=b.selection.getSelection();if(c.length){for(h=c.length;h--;)z(c[h],b,e);v(b,c,e)}else{for(f=i.anchorNode,g=i.anchorOffset,h=d.nodes.length;h--;)a.dom.unwrap(d.nodes[h]);w(b,f,g,e)}}function D(a,b,c){var d,e,f=a.selection.getSelection();if(b.length){for(e=b.length;e--;)x(b[e],c);v(a,b,c)}else if(r(f))d=s(f),x(d.textNode,c),w(a,d.textNode,d.wordOffset,c);else{var g=a.selection.getOwnRanges()[0];g&&A(g,a,c)}}function E(a){return a="string"==typeof a?{nodeName:a}:a,a.nodeName&&(a.nodeName=a.nodeName.toUpperCase()),a}var F="SPAN",G="b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",H={b:"b, strong",strong:"b, strong",em:"em, i",i:"em, i"};a.commands.formatInline={exec:function(a,b,c){c=E(c),a.element.normalize();var d=j(a.selection,!0),e=q(a,c);e.nodes.length>0?B(a,d,e,c):D(a,d,c),a.element.normalize()},remove:function(a,b,c){c=E(c),a.element.normalize();var d=j(a.selection,!0),e=q(a,c);e.nodes.length>0&&C(a,d,e,c),a.element.normalize()},state:function(a,b,c){c=E(c);var d=q(a,c,!0).nodes;return 0===d.length?!1:d}}}(a),function(a){a.commands.insertHTML={exec:function(a,b,c){a.selection.insertHTML(c)},state:function(){return!1}}}(a),function(a){var b="
    "+(a.browser.needsSpaceAfterLineBreak()?" ":"");a.commands.insertLineBreak={exec:function(a,c){a.selection.insertHTML(b)},state:function(){return!1}}}(a),a.commands.insertList=function(a){var b=function(a,b){if(a&&a.nodeName){"string"==typeof b&&(b=[b]);for(var c=b.length;c--;)if(a.nodeName===b[c])return!0}return!1},c=function(c,d,e){var f={el:null,other:!1};if(c){var g=a.dom.getParentElement(c,{query:"li"},!1,e.element),h="UL"===d?"OL":"UL";b(c,d)?f.el=c:b(c,h)?f={el:c,other:!0}:g&&(b(g.parentNode,d)?f.el=g.parentNode:b(g.parentNode,h)&&(f={el:g.parentNode,other:!0}))}return f.el&&!e.element.contains(f.el)&&(f.el=null),f},d=function(b,c,d){var e,g,h="UL"===c?"OL":"UL";d.selection.executeAndRestoreRangy(function(){if(e=f(h,d),e.length)for(var i=e.length;i--;)a.dom.renameElement(e[i],c.toLowerCase());else{g=f(["OL","UL"],d);for(var j=g.length;j--;)a.dom.resolveList(g[j],d.config.useLineBreaks);0===g.length&&a.dom.resolveList(b,d.config.useLineBreaks)}})},e=function(b,c,d){var e="UL"===c?"OL":"UL";d.selection.executeAndRestoreRangy(function(){for(var g=[b].concat(f(e,d)),h=g.length;h--;)a.dom.renameElement(g[h],c.toLowerCase())})},f=function(a,c){for(var d=c.selection.getOwnRanges(),e=[],f=d.length;f--;)e=e.concat(d[f].getNodes([1],function(c){return b(c,a)}));return e},g=function(b,c){var d,e,f=rangy.saveSelection(c.win),g="_wysihtml5-temp-"+(new Date).getTime();c.commands.exec("formatBlock",{nodeName:"div",className:g});var h=c.element.querySelector("."+g);h.innerHTML=h.innerHTML.replace(a.INVISIBLE_SPACE_REG_EXP,""),h&&(d=/^(\s|(
    ))+$/i.test(h.innerHTML),e=a.dom.convertToList(h,b.toLowerCase(),c.parent.config.classNames.uneditableContainer),f&&rangy.restoreSelection(f),d&&c.selection.selectNode(e.querySelector("li"),!0))};return{exec:function(b,f,h){var i,j,k=b.doc,l="OL"===h?"insertOrderedList":"insertUnorderedList",m=b.selection.getSelection(),n=1===m.anchorNode.nodeType&&m.anchorNode.firstChild?m.anchorNode.childNodes[m.anchorOffset]:m.anchorNode,o=1===m.focusNode.nodeType&&m.focusNode.firstChild?m.focusNode.childNodes[m.focusOffset]||m.focusNode.lastChild:m.focusNode;m.isBackwards()&&(n=[o,o=n][0]),a.dom.domNode(o).is.emptyTextNode(!0)&&o&&(o=a.dom.domNode(o).prev({nodeTypes:[1,3],ignoreBlankTexts:!0})),a.dom.domNode(n).is.emptyTextNode(!0)&&n&&(n=a.dom.domNode(n).next({nodeTypes:[1,3],ignoreBlankTexts:!0})),i=n&&o?n===o?n:a.dom.domNode(n).commonAncestor(o,b.element):b.selection.getSelectedNode(),j=c(i,h,b),j.el?j.other?e(j.el,h,b):d(j.el,h,b):b.commands.support(l)?k.execCommand(l,!1,null):g(h,b)},state:function(a,b,d){var e=a.selection.getSelectedNode(),f=c(e,d,a);return f.el&&!f.other?f.el:!1}}}(a),function(a){a.commands.redo={exec:function(a){return a.undoManager.redo()},state:function(a){return!1}}}(a),function(a){a.commands.undo={exec:function(a){return a.undoManager.undo()},state:function(a){return!1}}}(a),function(a){a.commands.createTable={exec:function(a,b,c){var d,e,f;if(c&&c.cols&&c.rows&&parseInt(c.cols,10)>0&&parseInt(c.rows,10)>0){for(f=c.tableStyle?'':"
    ",f+="",e=0;e",d=0;d
    ";f+=""}f+="
    ",a.commands.exec("insertHTML",f)}},state:function(a,b){return!1}}}(a),function(a){a.commands.mergeTableCells={exec:function(b,c){b.tableSelection&&b.tableSelection.start&&b.tableSelection.end&&(this.state(b,c)?a.dom.table.unmergeCell(b.tableSelection.start):a.dom.table.mergeCellsBetween(b.tableSelection.start,b.tableSelection.end))},state:function(b,c){if(b.tableSelection){var d=b.tableSelection.start,e=b.tableSelection.end;if(d&&e&&d==e&&(a.dom.getAttribute(d,"colspan")&&parseInt(a.dom.getAttribute(d,"colspan"),10)>1||a.dom.getAttribute(d,"rowspan")&&parseInt(a.dom.getAttribute(d,"rowspan"),10)>1))return[d]}return!1}}}(a),function(a){a.commands.addTableCells={exec:function(b,c,d){if(b.tableSelection&&b.tableSelection.start&&b.tableSelection.end){var e=a.dom.table.orderSelectionEnds(b.tableSelection.start,b.tableSelection.end);"before"==d||"above"==d?a.dom.table.addCells(e.start,d):("after"==d||"below"==d)&&a.dom.table.addCells(e.end,d),setTimeout(function(){b.tableSelection.select(e.start,e.end)},0)}},state:function(a,b){return!1}}}(a),function(a){a.commands.deleteTableCells={exec:function(b,c,d){if(b.tableSelection&&b.tableSelection.start&&b.tableSelection.end){var e,f=a.dom.table.orderSelectionEnds(b.tableSelection.start,b.tableSelection.end),g=a.dom.table.indexOf(f.start),h=b.tableSelection.table;a.dom.table.removeCells(f.start,d),setTimeout(function(){e=a.dom.table.findCell(h,g),e||("row"==d&&(e=a.dom.table.findCell(h,{row:g.row-1,col:g.col})),"column"==d&&(e=a.dom.table.findCell(h,{row:g.row,col:g.col-1}))),e&&b.tableSelection.select(e,e)},0)}},state:function(a,b){return!1}}}(a),function(a){a.commands.indentList={exec:function(a,b,c){var d=a.selection.getSelectionParentsByTag("LI");return d?this.tryToPushLiLevel(d,a.selection):!1},state:function(a,b){return!1},tryToPushLiLevel:function(b,c){var d,e,f,g,h,i=!1;return c.executeAndRestoreRangy(function(){for(var c=b.length;c--;)g=b[c],d="OL"===g.parentNode.nodeName?"OL":"UL",e=g.ownerDocument.createElement(d),f=a.dom.domNode(g).prev({nodeTypes:[a.ELEMENT_NODE]}),h=f?f.querySelector("ul, ol"):null,f&&(h?h.appendChild(g):(e.appendChild(g),f.appendChild(e)),i=!0)}),i}}}(a),function(a){a.commands.outdentList={exec:function(a,b,c){var d=a.selection.getSelectionParentsByTag("LI");return d?this.tryToPullLiLevel(d,a):!1},state:function(a,b){return!1},tryToPullLiLevel:function(b,c){var d,e,f,g,h,i=!1,j=this;return c.selection.executeAndRestoreRangy(function(){for(var k=b.length;k--;)if(g=b[k],g.parentNode&&(d=g.parentNode,"OL"===d.tagName||"UL"===d.tagName)){if(i=!0,e=a.dom.getParentElement(d.parentNode,{query:"ol, ul"},!1,c.element),f=a.dom.getParentElement(d.parentNode,{query:"li"},!1,c.element),e&&f)g.nextSibling&&(h=j.getAfterList(d,g),g.appendChild(h)),e.insertBefore(g,f.nextSibling);else{g.nextSibling&&(h=j.getAfterList(d,g),g.appendChild(h));for(var l=g.childNodes.length;l--;)d.parentNode.insertBefore(g.childNodes[l],d.nextSibling);d.parentNode.insertBefore(document.createElement("br"),d.nextSibling),g.parentNode.removeChild(g)}0===d.childNodes.length&&d.parentNode.removeChild(d)}}),i},getAfterList:function(a,b){for(var c=a.nodeName,d=document.createElement(c);b.nextSibling;)d.appendChild(b.nextSibling);return d}}}(a),function(a){var b=90,c=89,d=8,e=46,f=25,g="data-wysihtml5-selection-node",h="data-wysihtml5-selection-offset",i=(''+a.INVISIBLE_SPACE+"",''+a.INVISIBLE_SPACE+"",a.dom);a.UndoManager=a.lang.Dispatcher.extend({constructor:function(a){this.editor=a,this.composer=a.composer,this.element=this.composer.element,this.position=0,this.historyStr=[],this.historyDom=[],this.transact(),this._observe()},_observe:function(){var a,f=this;this.composer.sandbox.getDocument();i.observe(this.element,"keydown",function(a){if(!a.altKey&&(a.ctrlKey||a.metaKey)){var d=a.keyCode,e=d===b&&!a.shiftKey,g=d===b&&a.shiftKey||d===c;e?(f.undo(),a.preventDefault()):g&&(f.redo(),a.preventDefault())}}),i.observe(this.element,"keydown",function(b){var c=b.keyCode;c!==a&&(a=c,(c===d||c===e)&&f.transact())}),this.editor.on("newword:composer",function(){f.transact()}).on("beforecommand:composer",function(){f.transact()})},transact:function(){var b,c,d,e,i,j=this.historyStr[this.position-1],k=this.composer.getValue(!1,!1),l=this.element.offsetWidth>0&&this.element.offsetHeight>0;if(k!==j){var m=this.historyStr.length=this.historyDom.length=this.position;m>f&&(this.historyStr.shift(),this.historyDom.shift(),this.position--),this.position++,l&&(b=this.composer.selection.getRange(),c=b&&b.startContainer?b.startContainer:this.element,d=b&&b.startOffset?b.startOffset:0,c.nodeType===a.ELEMENT_NODE?e=c:(e=c.parentNode,i=this.getChildNodeIndex(e,c)),e.setAttribute(h,d),"undefined"!=typeof i&&e.setAttribute(g,i));var n=this.element.cloneNode(!!k);this.historyDom.push(n),this.historyStr.push(k),e&&(e.removeAttribute(h),e.removeAttribute(g))}},undo:function(){this.transact(),this.undoPossible()&&(this.set(this.historyDom[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.redoPossible()&&(this.set(this.historyDom[++this.position-1]),this.editor.fire("redo:composer"))},undoPossible:function(){return this.position>1},redoPossible:function(){return this.positionb;b++)this.element.appendChild(c[b].cloneNode(!0));var e,f,i;a.hasAttribute(h)?(e=a.getAttribute(h),i=a.getAttribute(g),f=this.element):(f=this.element.querySelector("["+h+"]")||this.element,e=f.getAttribute(h),i=f.getAttribute(g),f.removeAttribute(h),f.removeAttribute(g)),null!==i&&(f=this.getChildNodeByIndex(f,+i)),this.composer.selection.set(f,e)},getChildNodeIndex:function(a,b){for(var c=0,d=a.childNodes,e=d.length;e>c;c++)if(d[c]===b)return c},getChildNodeByIndex:function(a,b){return a.childNodes[b]}})}(a),a.views.View=b.extend({constructor:function(a,b,c){this.parent=a,this.element=b,this.config=c,this.config.noTextarea||this._observeViewChange()},_observeViewChange:function(){var a=this;this.parent.on("beforeload",function(){a.parent.on("change_view",function(b){b===a.name?(a.parent.currentView=a,a.show(),setTimeout(function(){a.focus()},0)):a.hide()})})},focus:function(){if(!this.element||!this.element.ownerDocument||this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element&&this.element.focus()}catch(a){}},hide:function(){this.element.style.display="none"},show:function(){this.element.style.display=""},disable:function(){this.element.setAttribute("disabled","disabled")},enable:function(){this.element.removeAttribute("disabled")}}),function(a){var b=a.dom,c=a.browser;a.views.Composer=a.views.View.extend({name:"composer",constructor:function(a,b,c){this.base(a,b,c),this.config.noTextarea?this.editableArea=b:this.textarea=this.parent.textarea,this.config.contentEditableMode?this._initContentEditableArea():this._initSandbox()},clear:function(){this.element.innerHTML=c.displaysCaretInEmptyContentEditableCorrectly()?"":"
    "},getValue:function(b,c){var d=this.isEmpty()?"":a.quirks.getCorrectInnerHTML(this.element);return b!==!1&&(d=this.parent.parse(d,c===!1?!1:!0)),d},setValue:function(a,b){b!==!1&&(a=this.parent.parse(a));try{this.element.innerHTML=a}catch(c){this.element.innerText=a}},cleanUp:function(a){var b;this.selection&&this.selection.isInThisEditable()&&(b=rangy.saveSelection(this.win)),this.parent.parse(this.element,void 0,a),b&&rangy.restoreSelection(b)},show:function(){this.editableArea.style.display=this._displayStyle||"",this.config.noTextarea||this.textarea.element.disabled||(this.disable(),this.enable())},hide:function(){this._displayStyle=b.getStyle("display").from(this.editableArea),"none"===this._displayStyle&&(this._displayStyle=null),this.editableArea.style.display="none"},disable:function(){this.parent.fire("disable:composer"),this.element.removeAttribute("contentEditable")},enable:function(){this.parent.fire("enable:composer"),this.element.setAttribute("contentEditable","true")},focus:function(b){a.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear(),this.base();var c=this.element.lastChild;b&&c&&this.selection&&("BR"===c.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getScrollPos:function(){if(this.doc&&this.win){var a={};return"undefined"!=typeof this.win.pageYOffset?a.y=this.win.pageYOffset:a.y=(this.doc.documentElement||this.doc.body.parentNode||this.doc.body).scrollTop,"undefined"!=typeof this.win.pageXOffset?a.x=this.win.pageXOffset:a.x=(this.doc.documentElement||this.doc.body.parentNode||this.doc.body).scrollLeft,a}},setScrollPos:function(a){a&&"undefined"!=typeof a.x&&"undefined"!=typeof a.y&&this.win.scrollTo(a.x,a.y)},getTextContent:function(){return b.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==(this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder"))&&this.placeholderSet},isEmpty:function(){var a=this.element.innerHTML.toLowerCase();return/^(\s|
    |<\/br>|

    |<\/p>)*$/i.test(a)||""===a||"
    "===a||"

    "===a||"


    "===a||this.hasPlaceholderSet()},_initContentEditableArea:function(){var a=this;this.config.noTextarea?this.sandbox=new b.ContentEditableArea(function(){a._create()},{className:this.config.classNames.sandbox},this.editableArea):(this.sandbox=new b.ContentEditableArea(function(){a._create()},{className:this.config.classNames.sandbox}),this.editableArea=this.sandbox.getContentEditable(),b.insert(this.editableArea).after(this.textarea.element),this._createWysiwygFormField())},_initSandbox:function(){var a=this;this.sandbox=new b.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets,className:this.config.classNames.sandbox}),this.editableArea=this.sandbox.getIframe();var c=this.textarea.element;b.insert(this.editableArea).after(c),this._createWysiwygFormField()},_createWysiwygFormField:function(){if(this.textarea.element.form){var a=document.createElement("input");a.type="hidden",a.name="_wysihtml5_mode",a.value=1,b.insert(a).after(this.textarea.element); +}},_create:function(){var d=this;this.doc=this.sandbox.getDocument(),this.win=this.sandbox.getWindow(),this.element=this.config.contentEditableMode?this.sandbox.getContentEditable():this.doc.body,this.config.noTextarea?this.cleanUp():(this.textarea=this.parent.textarea,this.element.innerHTML=this.textarea.getValue(!0,!1)),this.selection=new a.Selection(this.parent,this.element,this.config.classNames.uneditableContainer),this.commands=new a.Commands(this.parent),this.config.noTextarea||b.copyAttributes(["className","spellcheck","title","lang","dir","accessKey"]).from(this.textarea.element).to(this.element),this._initAutoLinking(),b.addClass(this.element,this.config.classNames.composer),this.config.style&&!this.config.contentEditableMode&&this.style(),this.observe();var e=this.config.name;e&&(b.addClass(this.element,e),this.config.contentEditableMode||b.addClass(this.editableArea,e)),this.enable(),!this.config.noTextarea&&this.textarea.element.disabled&&this.disable();var f="string"==typeof this.config.placeholder?this.config.placeholder:this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder");f&&b.simulatePlaceholder(this.parent,this,f,this.config.classNames.placeholder),this.commands.exec("styleWithCSS",!1),this._initObjectResizing(),this._initUndoManager(),this._initLineBreaking(),this.config.noTextarea||!this.textarea.element.hasAttribute("autofocus")&&document.querySelector(":focus")!=this.textarea.element||c.isIos()||setTimeout(function(){d.focus(!0)},100),c.clearsContentEditableCorrectly()||a.quirks.ensureProperClearing(this),this.initSync&&this.config.sync&&this.initSync(),this.config.noTextarea||this.textarea.hide(),this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var d=this,e=c.canDisableAutoLinking(),f=c.doesAutoLinkingInContentEditable();if(e&&this.commands.exec("AutoUrlDetect",!1,!1),this.config.autoLink){(!f||f&&e)&&(this.parent.on("newword:composer",function(){if(b.getTextContent(d.element).match(b.autoLink.URL_REG_EXP)){for(var c=d.selection.getSelectedNode(),e=d.element.querySelectorAll("."+d.config.classNames.uneditableContainer),f=!1,g=e.length;g--;)a.dom.contains(e[g],c)&&(f=!0);f||b.autoLink(c,[d.config.classNames.uneditableContainer])}}),b.observe(this.element,"blur",function(){b.autoLink(d.element,[d.config.classNames.uneditableContainer])}));var g=this.sandbox.getDocument().getElementsByTagName("a"),h=b.autoLink.URL_REG_EXP,i=function(c){var d=a.lang.string(b.getTextContent(c)).trim();return"www."===d.substr(0,4)&&(d="http://"+d),d};b.observe(this.element,"keydown",function(a){if(g.length){var c,e=d.selection.getSelectedNode(a.target.ownerDocument),f=b.getParentElement(e,{query:"a"},4);f&&(c=i(f),setTimeout(function(){var a=i(f);a!==c&&a.match(h)&&f.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){if(this.commands.exec("enableObjectResizing",!0),c.supportsEvent("resizeend")){var d=["width","height"],e=d.length,f=this.element;b.observe(f,"resizeend",function(b){var c,g=b.target||b.srcElement,h=g.style,i=0;if("IMG"===g.nodeName){for(;e>i;i++)c=d[i],h[c]&&(g.setAttribute(c,parseInt(h[c],10)),h[c]="");a.quirks.redraw(f)}})}},_initUndoManager:function(){this.undoManager=new a.UndoManager(this.parent)},_initLineBreaking:function(){function d(a){var c=b.getParentElement(a,{query:"p, div"},2);c&&b.contains(e.element,c)&&e.selection.executeAndRestoreRangy(function(){e.config.useLineBreaks?((!c.firstChild||c.firstChild===c.lastChild&&1===c.firstChild.nodeType&&c.firstChild.classList.contains("rangySelectionBoundary"))&&c.appendChild(e.doc.createElement("br")),b.replaceWithChildNodes(c)):"P"!==c.nodeName&&b.renameElement(c,"p")})}var e=this,f="li, p, h1, h2, h3, h4, h5, h6",g="ul, ol, menu";this.config.useLineBreaks||b.observe(this.element,["focus"],function(){e.isEmpty()&&setTimeout(function(){var a=e.doc.createElement("P");e.element.innerHTML="",e.element.appendChild(a),c.displaysCaretInEmptyContentEditableCorrectly()?e.selection.selectNode(a,!0):(a.innerHTML="
    ",e.selection.setBefore(a.firstChild))},0)}),b.observe(this.element,"keydown",function(c){var h=c.keyCode;if(!(c.shiftKey||c.ctrlKey||c.defaultPrevented||h!==a.ENTER_KEY&&h!==a.BACKSPACE_KEY)){var i=b.getParentElement(e.selection.getSelectedNode(),{query:f},4);return i?void setTimeout(function(){var c,f=e.selection.getSelectedNode();if("LI"===i.nodeName){if(!f)return;c=b.getParentElement(f,{query:g},2),c||d(f)}h===a.ENTER_KEY&&i.nodeName.match(/^H[1-6]$/)&&d(f)},0):void(e.config.useLineBreaks&&h===a.ENTER_KEY&&!a.browser.insertsLineBreaksOnReturn()&&(c.preventDefault(),e.commands.exec("insertLineBreak")))}})}})}(a),function(a){var b=a.dom,c=document,d=window,e=c.createElement("div"),f=["background-color","color","cursor","font-family","font-size","font-style","font-variant","font-weight","line-height","letter-spacing","text-align","text-decoration","text-indent","text-rendering","word-break","word-wrap","word-spacing"],g=["background-color","border-collapse","border-bottom-color","border-bottom-style","border-bottom-width","border-left-color","border-left-style","border-left-width","border-right-color","border-right-style","border-right-width","border-top-color","border-top-style","border-top-width","clear","display","float","margin-bottom","margin-left","margin-right","margin-top","outline-color","outline-offset","outline-width","outline-style","padding-left","padding-right","padding-top","padding-bottom","position","top","left","right","bottom","z-index","vertical-align","text-align","-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing","-webkit-box-shadow","-moz-box-shadow","-ms-box-shadow","box-shadow","-webkit-border-top-right-radius","-moz-border-radius-topright","border-top-right-radius","-webkit-border-bottom-right-radius","-moz-border-radius-bottomright","border-bottom-right-radius","-webkit-border-bottom-left-radius","-moz-border-radius-bottomleft","border-bottom-left-radius","-webkit-border-top-left-radius","-moz-border-radius-topleft","border-top-left-radius","width","height"],h=["html { height: 100%; }","body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }","body > p:first-child { margin-top: 0; }","._wysihtml5-temp { display: none; }",a.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],i=function(a){if(a.setActive)try{a.setActive()}catch(e){}else{var f=a.style,g=c.documentElement.scrollTop||c.body.scrollTop,h=c.documentElement.scrollLeft||c.body.scrollLeft,i={position:f.position,top:f.top,left:f.left,WebkitUserSelect:f.WebkitUserSelect};b.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(a),a.focus(),b.setStyles(i).on(a),d.scrollTo&&d.scrollTo(h,g)}};a.views.Composer.prototype.style=function(){var d,j=this,k=c.querySelector(":focus"),l=this.textarea.element,m=l.hasAttribute("placeholder"),n=m&&l.getAttribute("placeholder"),o=l.style.display,p=l.disabled;this.focusStylesHost=e.cloneNode(!1),this.blurStylesHost=e.cloneNode(!1),this.disabledStylesHost=e.cloneNode(!1),m&&l.removeAttribute("placeholder"),l===k&&l.blur(),l.disabled=!1,l.style.display=d="none",(l.getAttribute("rows")&&"auto"===b.getStyle("height").from(l)||l.getAttribute("cols")&&"auto"===b.getStyle("width").from(l))&&(l.style.display=d=o),b.copyStyles(g).from(l).to(this.editableArea).andTo(this.blurStylesHost),b.copyStyles(f).from(l).to(this.element).andTo(this.blurStylesHost),b.insertCSS(h).into(this.element.ownerDocument),l.disabled=!0,b.copyStyles(g).from(l).to(this.disabledStylesHost),b.copyStyles(f).from(l).to(this.disabledStylesHost),l.disabled=p,l.style.display=o,i(l),l.style.display=d,b.copyStyles(g).from(l).to(this.focusStylesHost),b.copyStyles(f).from(l).to(this.focusStylesHost),l.style.display=o,b.copyStyles(["display"]).from(l).to(this.editableArea);var q=a.lang.array(g).without(["display"]);return k?k.focus():l.blur(),m&&l.setAttribute("placeholder",n),this.parent.on("focus:composer",function(){b.copyStyles(q).from(j.focusStylesHost).to(j.editableArea),b.copyStyles(f).from(j.focusStylesHost).to(j.element)}),this.parent.on("blur:composer",function(){b.copyStyles(q).from(j.blurStylesHost).to(j.editableArea),b.copyStyles(f).from(j.blurStylesHost).to(j.element)}),this.parent.observe("disable:composer",function(){b.copyStyles(q).from(j.disabledStylesHost).to(j.editableArea),b.copyStyles(f).from(j.disabledStylesHost).to(j.element)}),this.parent.observe("enable:composer",function(){b.copyStyles(q).from(j.blurStylesHost).to(j.editableArea),b.copyStyles(f).from(j.blurStylesHost).to(j.element)}),this}}(a),function(a){var b=a.dom,c=b.domNode,d=a.browser,e={66:"bold",73:"italic",85:"underline"},f={addListeners:function(a,b,c){for(var d=0,e=b.length;e>d;d++)a.addEventListener(b[d],c,!1)},removeListeners:function(a,b,c){for(var d=0,e=b.length;e>d;d++)a.removeEventListener(b[d],c,!1)},fixLastBrDeletionInTable:function(b,c){if(b.selection.caretIsLastInSelection()){var d=b.selection.getSelection(),e=d.anchorNode;if(e&&1===e.nodeType&&(a.dom.getParentElement(e,{query:"td, th"},!1,b.element)||c)){var f=e.childNodes[d.anchorOffset];if(f&&1===f.nodeType&"BR"===f.nodeName)return f.parentNode.removeChild(f),!0}}return!1},handleUneditableDeletion:function(a){var b=a.selection.getBeforeSelection(!0);if(b&&("element"===b.type||"leafnode"===b.type)&&1===b.node.nodeType&&b.node.classList.contains(a.config.classNames.uneditableContainer)){if(f.fixLastBrDeletionInTable(a,!0))return!0;try{var c=new CustomEvent("wysihtml5:uneditable:delete",{bubbles:!0,cancelable:!1});b.node.dispatchEvent(c)}catch(d){}return b.node.parentNode.removeChild(b.node),!0}return!1},fixDeleteInTheBeginningOfBlock:function(b){var d=b.selection,e=d.getPreviousNode();if(d.caretIsFirstInSelection(a.browser.usesControlRanges())&&e&&1===e.nodeType&&a.dom.domNode(e).is.block()&&!c(e).test({query:"ol, ul, table, tr, dl"})){if(/^\s*$/.test(e.textContent||e.innerText))return e.parentNode.removeChild(e),!0;if(e.lastChild){var f=e.lastChild,g=d.getSelectedNode(),h=c(e).commonAncestor(g,b.element),i=a.dom.getParentElement(g,{query:"h1, h2, h3, h4, h5, h6, p, pre, div, blockquote"},!1,h||b.element);if(i)return c(i).transferContentTo(e,!0),d.setAfter(f),!0;if(a.browser.usesControlRanges())return g=d.getCaretNode(),c(g).transferContentTo(e,!0),d.setAfter(f),!0}}return!1},fixDeleteInTheBeginningOfLi:function(b){if(a.browser.hasLiDeletingProblem()){var d,e,f=b.selection.getSelection(),g=f.anchorNode,h=b.selection.caretIsFirstInSelection();if(3===g.nodeType&&0===f.anchorOffset&&g===g.parentNode.firstChild&&(g=g.parentNode,h=!0),h&&g&&1===g.nodeType&&"LI"===g.nodeName&&(d=c(g).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),d||!g.parentNode||"UL"!==g.parentNode.nodeName&&"OL"!==g.parentNode.nodeName||(d=c(g.parentNode).prev({nodeTypes:[1,3],ignoreBlankTexts:!0})),d))return e=g.firstChild,c(g).transferContentTo(d,!0),e?b.selection.setBefore(e):d&&(1===d.nodeType?d.lastChild?b.selection.setAfter(d.lastChild):b.selection.selectNode(d):b.selection.setAfter(d)),!0}return!1},fixDeleteInTheBeginningOfControlSelection:function(a){var b,d=a.selection,e=d.getPreviousNode(),f=d.getSelectedNode();return d.caretIsFirstInSelection()?(3===f.nodeType&&(f=f.parentNode),b=f.firstChild,c(f).transferContentTo(e,!0),b&&a.selection.setBefore(b),!0):!1},initTableHandling:function(){var b=function(){window.removeEventListener("load",b),this.doc.execCommand("enableObjectResizing",!1,"false"),this.doc.execCommand("enableInlineTableEditing",!1,"false")}.bind(this),c=function(){b.call(this),f.removeListeners(this.sandbox.getIframe(),["focus","mouseup","mouseover"],c)}.bind(this);this.doc.execCommand&&a.browser.supportsCommand(this.doc,"enableObjectResizing")&&a.browser.supportsCommand(this.doc,"enableInlineTableEditing")&&(this.sandbox.getIframe?f.addListeners(this.sandbox.getIframe(),["focus","mouseup","mouseover"],c):window.addEventListener("load",b)),this.tableSelection=a.quirks.tableCellsSelection(this.element,this.parent)},doLineBreaksModeEnterWithCaret:function(d){var e,f,g="p, pre, div, blockquote",h=!1;if(e=d.selection.getNodesNearCaret(),e&&((e.caretNode||e.nextNode)&&(f=b.getParentElement(e.caretNode||e.nextNode,{query:g},2),f===d.element&&(f=void 0)),f&&e.caretNode))if(c(e.caretNode).is.lineBreak()){if(d.config.doubleLineBreakEscapesBlock){h=!0,e.caretNode.parentNode.removeChild(e.caretNode),c(e.nextNode).is.lineBreak()&&e.nextNode.parentNode.removeChild(e.nextNode);var i=d.doc.createElement("br");c(e.nextNode).is.lineBreak()&&e.nextNode===f.lastChild?f.parentNode.insertBefore(i,f.nextSibling):d.selection.splitElementAtCaret(f,i),e.nextNode&&3===e.nextNode.nodeType&&(e.nextNode.data=e.nextNode.data.replace(/^ *[\r\n]+/,"")),d.selection.setBefore(i)}}else if(3===e.caretNode.nodeType&&a.browser.hasCaretBlockElementIssue()&&e.textOffset===e.caretNode.data.length&&!e.nextNode){h=!0;var j=d.doc.createElement("br"),k=d.doc.createElement("br"),l=d.doc.createDocumentFragment();l.appendChild(j),l.appendChild(k),d.selection.insertNode(l),d.selection.setBefore(k)}return h}},g=function(b,c){var d=c.selection;c.element;if(d.isCollapsed()){if(c.isEmpty()&&!c.config.useLineBreaks)return void b.preventDefault();if(f.handleUneditableDeletion(c))return void b.preventDefault();if(f.fixDeleteInTheBeginningOfLi(c))return void b.preventDefault();if(f.fixDeleteInTheBeginningOfBlock(c))return void b.preventDefault();if(f.fixLastBrDeletionInTable(c))return void b.preventDefault();if(a.browser.usesControlRanges()&&f.fixDeleteInTheBeginningOfControlSelection(c))return void b.preventDefault()}else d.containsUneditable()&&(b.preventDefault(),d.deleteContents())},h=function(a,b){if(b.config.useLineBreaks&&!a.shiftKey&&!a.ctrlKey){b.selection.isCollapsed()&&f.doLineBreaksModeEnterWithCaret(b)&&a.preventDefault()}},i=function(a,b,c){if(a.selection.isCollapsed()){if(a.selection.caretIsInTheBeginnig("li"))if(c){if(a.commands.exec("outdentList"))return}else if(a.commands.exec("indentList"))return}else a.selection.deleteContents();a.commands.exec("insertHTML"," ")},j=function(a){this.domNodeRemovedInterval&&clearInterval(domNodeRemovedInterval),this.parent.fire("destroy:composer")},k=function(a){this.parent.fire("beforeinteraction",a).fire("beforeinteraction:composer",a),setTimeout(function(){this.parent.fire("interaction",a).fire("interaction:composer",a)}.bind(this),0)},l=function(a){this.parent.fire("focus",a).fire("focus:composer",a),setTimeout(function(){this.focusState=this.getValue(!1,!1)}.bind(this),0)},m=function(a){if(this.focusState!==this.getValue(!1,!1)){var b=a;"function"==typeof Object.create&&(b=Object.create(a,{type:{value:"change"}})),this.parent.fire("change",b).fire("change:composer",b)}this.parent.fire("blur",a).fire("blur:composer",a)},n=function(a){this.parent.fire(a.type,a).fire(a.type+":composer",a),"paste"===a.type&&setTimeout(function(){this.parent.fire("newword:composer")}.bind(this),0)},o=function(b){this.config.copyedFromMarking&&(a.browser.supportsModernPaste()&&(b.clipboardData.setData("text/html",this.config.copyedFromMarking+this.selection.getHtml()),b.clipboardData.setData("text/plain",this.selection.getPlainText()),b.preventDefault()),this.parent.fire(b.type,b).fire(b.type+":composer",b))},p=function(b){var c=b.keyCode;(c===a.SPACE_KEY||c===a.ENTER_KEY)&&this.parent.fire("newword:composer")},q=function(b){if(!d.canSelectImagesInContentEditable()){var c=b.target,e=this.element.querySelectorAll("img"),f=this.element.querySelectorAll("."+this.config.classNames.uneditableContainer+" img"),g=a.lang.array(e).without(f);"IMG"===c.nodeName&&a.lang.array(g).contains(c)&&this.selection.selectNode(c)}a.browser.usesControlRanges()&&(this.selection.lastMouseDownPos={x:b.clientX,y:b.clientY},setTimeout(function(){delete this.selection.lastMouseDownPos}.bind(this),0))},r=function(a){var b=(a.target,this.selection.lastMouseDownPos);if(b){var c=document.body.createTextRange();setTimeout(function(){try{c.moveToPoint(b.x,b.y),c.select()}catch(a){}}.bind(this),0)}},s=function(b){if(this.config.classNames.uneditableContainer){var c=a.dom.getParentElement(b.target,{query:"."+this.config.classNames.uneditableContainer},!1,this.element);c&&this.selection.setAfter(c)}},t=function(a){d.canSelectImagesInContentEditable()||setTimeout(function(){this.selection.getSelection().removeAllRanges()}.bind(this),0)},u=function(b){var c,d,f=b.keyCode,j=e[f];return!b.ctrlKey&&!b.metaKey||b.altKey||65!==f?((b.ctrlKey||b.metaKey)&&!b.altKey&&j&&(this.commands.exec(j),b.preventDefault()),f===a.BACKSPACE_KEY&&g(b,this),(f===a.BACKSPACE_KEY||f===a.DELETE_KEY)&&(c=this.selection.getSelectedNode(!0),c&&"IMG"===c.nodeName&&(b.preventDefault(),d=c.parentNode,d.removeChild(c),"A"!==d.nodeName||d.firstChild||d.parentNode.removeChild(d),setTimeout(function(){a.quirks.redraw(this.element)}.bind(this),0))),this.config.handleTabKey&&f===a.TAB_KEY&&(b.preventDefault(),i(this,this.element,b.shiftKey)),void(f===a.ENTER_KEY&&h(b,this))):(this.selection.selectAll(),void b.preventDefault())};a.views.Composer.prototype.observeActions=f,a.views.Composer.prototype.observe=function(){var c=this.sandbox.getIframe?this.sandbox.getIframe():this.sandbox.getContentEditable(),e=(this.element,d.supportsEventsInIframeCorrectly()||this.sandbox.getContentEditable?this.element:this.sandbox.getWindow());this.focusState=this.getValue(!1,!1),c.addEventListener(["DOMNodeRemoved"],j.bind(this),!1),d.supportsMutationEvents()||(this.domNodeRemovedInterval=setInterval(function(){b.contains(document.documentElement,c)||j.call(this)},250)),this.config.handleTables&&f.initTableHandling.call(this),f.addListeners(e,["drop","paste","mouseup","focus","keyup"],k.bind(this)),e.addEventListener("focus",l.bind(this),!1),e.addEventListener("blur",m.bind(this),!1),f.addListeners(this.element,["drop","paste","beforepaste"],n.bind(this),!1),this.element.addEventListener("copy",o.bind(this),!1),this.element.addEventListener("mousedown",q.bind(this),!1),this.element.addEventListener("click",s.bind(this),!1),this.element.addEventListener("drop",t.bind(this),!1),this.element.addEventListener("keyup",p.bind(this),!1),this.element.addEventListener("keydown",u.bind(this),!1),a.browser.usesControlRanges()&&this.element.addEventListener("mscontrolselect",r.bind(this),!1),this.element.addEventListener("dragenter",function(){this.parent.fire("unset_placeholder")}.bind(this),!1)}}(a),function(a){var c=400;a.views.Synchronizer=b.extend({constructor:function(a,b,c){this.editor=a,this.textarea=b,this.composer=c,this._observe()},fromComposerToTextarea:function(b){this.textarea.setValue(a.lang.string(this.composer.getValue(!1,!1)).trim(),b)},fromTextareaToComposer:function(a){var b=this.textarea.getValue(!1,!1);b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(a){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(a):this.fromComposerToTextarea(a)},_observe:function(){var b,d=this,e=this.textarea.element.form,f=function(){b=setInterval(function(){d.fromComposerToTextarea()},c)},g=function(){clearInterval(b),b=null};f(),e&&(a.dom.observe(e,"submit",function(){d.sync(!0)}),a.dom.observe(e,"reset",function(){setTimeout(function(){d.fromTextareaToComposer()},0)})),this.editor.on("change_view",function(a){"composer"!==a||b?"textarea"===a&&(d.fromComposerToTextarea(!0),g()):(d.fromTextareaToComposer(!0),f())}),this.editor.on("destroy:composer",g)}})}(a),function(a){a.views.SourceView=b.extend({constructor:function(a,b){this.editor=a,this.composer=b,this._observe()},switchToTextarea:function(a){var b=this.composer.win.getComputedStyle(this.composer.element),c=parseFloat(b.width),d=Math.max(parseFloat(b.height),100);this.textarea||(this.textarea=this.composer.doc.createElement("textarea"),this.textarea.className="wysihtml5-source-view"),this.textarea.style.width=c+"px",this.textarea.style.height=d+"px",this.textarea.value=this.editor.getValue(a,!0),this.composer.element.parentNode.insertBefore(this.textarea,this.composer.element),this.editor.currentView="source",this.composer.element.style.display="none"},switchToComposer:function(a){var b=this.textarea.value;b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder")),this.textarea.parentNode.removeChild(this.textarea),this.editor.currentView=this.composer,this.composer.element.style.display=""},_observe:function(){this.editor.on("change_view",function(a){"composer"===a?this.switchToComposer(!0):"textarea"===a&&this.switchToTextarea(!0)}.bind(this))}})}(a),a.views.Textarea=a.views.View.extend({name:"textarea",constructor:function(a,b,c){this.base(a,b,c),this._observe()},clear:function(){this.element.value=""},getValue:function(a){var b=this.isEmpty()?"":this.element.value;return a!==!1&&(b=this.parent.parse(b)),b},setValue:function(a,b){b!==!1&&(a=this.parent.parse(a)),this.element.value=a},cleanUp:function(a){var b=this.parent.parse(this.element.value,void 0,a);this.element.value=b},hasPlaceholderSet:function(){var b=a.browser.supportsPlaceholderAttributeOn(this.element),c=this.element.getAttribute("placeholder")||null,d=this.element.value,e=!d;return b&&e||d===c},isEmpty:function(){return!a.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var b=this.element,c=this.parent,d={focusin:"focus",focusout:"blur"},e=a.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];c.on("beforeload",function(){a.dom.observe(b,e,function(a){var b=d[a.type]||a.type;c.fire(b).fire(b+":textarea")}),a.dom.observe(b,["paste","drop"],function(){setTimeout(function(){c.fire("paste").fire("paste:textarea")},0)})})}}),function(a){var b,c={name:b,style:!0,toolbar:b,showToolbarAfterInit:!0,showToolbarDialogsOnSelection:!0,autoLink:!0,handleTables:!0,handleTabKey:!0,parserRules:{tags:{br:{},span:{},div:{},p:{},b:{},i:{},u:{}},classes:{}},pasteParserRulesets:null,parser:a.dom.parse,useLineBreaks:!0,doubleLineBreakEscapesBlock:!0,stylesheets:[],placeholderText:b,supportTouchDevices:!0,cleanUp:!0,contentEditableMode:!1,classNames:{composer:"wysihtml5-editor",body:"wysihtml5-supported",sandbox:"wysihtml5-sandbox",placeholder:"wysihtml5-placeholder",uneditableContainer:"wysihtml5-uneditable-container"},copyedFromMarking:''};a.Editor=a.lang.Dispatcher.extend({constructor:function(b,d){if(this.editableElement="string"==typeof b?document.getElementById(b):b,this.config=a.lang.object({}).merge(c).merge(d).get(),this._isCompatible=a.browser.supported(),d&&d.classNames&&a.lang.object(this.config.classNames).merge(d.classNames),"textarea"!=this.editableElement.nodeName.toLowerCase()&&(this.config.contentEditableMode=!0,this.config.noTextarea=!0),this.config.noTextarea||(this.textarea=new a.views.Textarea(this,this.editableElement,this.config),this.currentView=this.textarea),!this._isCompatible||!this.config.supportTouchDevices&&a.browser.isTouchDevice()){var e=this;return void setTimeout(function(){e.fire("beforeload").fire("load")},0)}a.dom.addClass(document.body,this.config.classNames.body),this.composer=new a.views.Composer(this,this.editableElement,this.config),this.currentView=this.composer,"function"==typeof this.config.parser&&this._initParser(),this.on("beforeload",this.handleBeforeLoad)},handleBeforeLoad:function(){if(this.config.noTextarea?this.sourceView=new a.views.SourceView(this,this.composer):this.synchronizer=new a.views.Synchronizer(this,this.textarea,this.composer),this.config.toolbar){if("undefined"==typeof a.toolbar)throw Error("Toolbar not found. Make sure you're loading wysihtml-toolbar.js or wysihtml-toolbar.min.js");this.toolbar=new a.toolbar.Toolbar(this,this.config.toolbar,this.config.showToolbarAfterInit)}},isCompatible:function(){return this._isCompatible},clear:function(){return this.currentView.clear(),this},getValue:function(a,b){return this.currentView.getValue(a,b)},setValue:function(a,b){return this.fire("unset_placeholder"),a?(this.currentView.setValue(a,b),this):this.clear()},cleanUp:function(a){this.currentView.cleanUp(a)},focus:function(a){return this.currentView.focus(a),this},disable:function(){return this.currentView.disable(),this},enable:function(){return this.currentView.enable(),this},isEmpty:function(){return this.currentView.isEmpty()},hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},destroy:function(){this.composer&&this.composer.sandbox&&this.composer.sandbox.destroy(),this.toolbar&&this.toolbar.destroy(),this.off()},parse:function(b,c,d){var e=this.config.contentEditableMode?document:this.composer?this.composer.sandbox.getDocument():null,f=this.config.parser(b,{rules:d||this.config.parserRules,cleanUp:this.config.cleanUp,context:e,uneditableClass:this.config.classNames.uneditableContainer,clearInternals:c});return"object"==typeof b&&a.quirks.redraw(b),f},_initParser:function(){var b;a.browser.supportsModernPaste()?this.on("paste:composer",function(c){c.preventDefault(),b=a.dom.getPastedHtml(c),b&&this._cleanAndPaste(b)}.bind(this)):this.on("beforepaste:composer",function(b){b.preventDefault();var c=this.composer.getScrollPos();a.dom.getPastedHtmlWithDiv(this.composer,function(a){a&&this._cleanAndPaste(a),this.composer.setScrollPos(c)}.bind(this))}.bind(this))},_cleanAndPaste:function(b){var c=a.quirks.cleanPastedHTML(b,{referenceNode:this.composer.element,rules:this.config.pasteParserRulesets||[{set:this.config.parserRules}],uneditableClass:this.config.classNames.uneditableContainer});this.composer.selection.deleteContents(),this.composer.selection.insertHTML(c)}})}(a),function(a){var b=a.dom,c="wysihtml5-command-dialog-opened",d="input, select, textarea",e="[data-wysihtml5-dialog-field]",f="data-wysihtml5-dialog-field";a.toolbar.Dialog=a.lang.Dispatcher.extend({constructor:function(a,b){this.link=a,this.container=b},_observe:function(){if(!this._observed){var d=this,e=function(a){var b=d._serialize();d.fire("save",b),d.hide(),a.preventDefault(),a.stopPropagation()};b.observe(d.link,"click",function(){b.hasClass(d.link,c)&&setTimeout(function(){d.hide()},0)}),b.observe(this.container,"keydown",function(b){var c=b.keyCode;c===a.ENTER_KEY&&e(b),c===a.ESCAPE_KEY&&d.cancel()}),b.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",e),b.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(a){d.cancel(),a.preventDefault(),a.stopPropagation()}),this._observed=!0}},_serialize:function(){for(var a={},b=this.container.querySelectorAll(e),c=b.length,d=0;c>d;d++)a[b[d].getAttribute(f)]=b[d].value;return a},_interpolate:function(a){for(var b,c,d,g=document.querySelector(":focus"),h=this.container.querySelectorAll(e),i=h.length,j=0;i>j;j++)b=h[j],b!==g&&(a&&"hidden"===b.type||(c=b.getAttribute(f),d=this.elementToChange&&"boolean"!=typeof this.elementToChange?this.elementToChange.getAttribute(c)||"":b.defaultValue,b.value=d))},update:function(a){this.elementToChange=a?a:this.elementToChange,this._interpolate()},show:function(a){var e=this.container.querySelector(d);if(this._observe(),this.update(a),b.addClass(this.link,c),this.container.style.display="",this.isOpen=!0,this.fire("show"),e&&!a)try{e.focus()}catch(f){}},_hide:function(a){this.elementToChange=null,b.removeClass(this.link,c),this.container.style.display="none",this.isOpen=!1},hide:function(){this._hide(),this.fire("hide")},cancel:function(){this._hide(),this.fire("cancel")}})}(a),function(a){var b=a.dom,c={position:"relative"},d={left:0,margin:0,opacity:0,overflow:"hidden",padding:0,position:"absolute",top:0,zIndex:1},e={cursor:"inherit",fontSize:"50px",height:"50px",marginTop:"-25px",outline:0,padding:0,position:"absolute",right:"-4px",top:"50%"},f={"x-webkit-speech":"",speech:""};a.toolbar.Speech=function(g,h){var i=document.createElement("input");if(!a.browser.supportsSpeechApiOn(i))return void(h.style.display="none");var j=g.editor.textarea.element.getAttribute("lang");j&&(f.lang=j);var k=document.createElement("div");a.lang.object(d).merge({width:h.offsetWidth+"px",height:h.offsetHeight+"px"}),b.insert(i).into(k),b.insert(k).into(h),b.setStyles(e).on(i),b.setAttributes(f).on(i),b.setStyles(d).on(k),b.setStyles(c).on(h);var l="onwebkitspeechchange"in i?"webkitspeechchange":"speechchange";b.observe(i,l,function(){g.execCommand("insertText",i.value),i.value=""}),b.observe(i,"click",function(a){b.hasClass(h,"wysihtml5-command-disabled")&&a.preventDefault(),a.stopPropagation()})}}(a),function(a){function c(b,c){var d=b.commands.state(c.name,c.value);return!c.dialog.multiselect&&a.lang.object(d).isArray()&&(d=1===d.length?d[0]:!0),d}var d="wysihtml5-command-disabled",e="wysihtml5-commands-disabled",f="wysihtml5-command-active",g="wysihtml5-action-active",h=a.dom;a.toolbar.Toolbar=b.extend({constructor:function(b,c,h){this.editor=b,this.container="string"==typeof c?document.getElementById(c):c,this.composer=b.composer,this._getLinks("command"),this._getLinks("action"),this._observe(),h&&this.show(),null!=b.config.classNameCommandDisabled&&(d=b.config.classNameCommandDisabled),null!=b.config.classNameCommandsDisabled&&(e=b.config.classNameCommandsDisabled),null!=b.config.classNameCommandActive&&(f=b.config.classNameCommandActive),null!=b.config.classNameActionActive&&(g=b.config.classNameActionActive);for(var i=this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"),j=i.length,k=0;j>k;k++)new a.toolbar.Speech(this,i[k])},_getLinks:function(b){for(var c,d,e,f,g,h,i=this[b+"Links"]=a.lang.array(this.container.querySelectorAll("[data-wysihtml5-"+b+"]")).get(),j=i.length,k=0,l=this[b+"Mapping"]={};j>k;k++)c=i[k],e=c.getAttribute("data-wysihtml5-"+b),f=c.getAttribute("data-wysihtml5-"+b+"-value"),h=c.getAttribute("data-wysihtml5-"+b+"-blank-value"),d=this.container.querySelector("[data-wysihtml5-"+b+"-group='"+e+"']"),g=this._getDialog(c,e),l[e+":"+f]={link:c,group:d,name:e,value:f,tracksBlankValue:h,dialog:g,state:!1}},_getDialog:function(b,c){var d,e,f=this,g=this.container.querySelector("[data-wysihtml5-dialog='"+c+"']");return g&&(d=a.toolbar["Dialog_"+c]?new a.toolbar["Dialog_"+c](b,g):new a.toolbar.Dialog(b,g),d.on("show",function(){e=f.composer.selection.getBookmark(),f.editor.fire("show:dialog",{command:c,dialogContainer:g,commandLink:b})}),d.on("save",function(a){e&&f.composer.selection.setBookmark(e),f._execCommand(c,a),f.editor.fire("save:dialog",{command:c,dialogContainer:g,commandLink:b}),f._hideAllDialogs(),f._preventInstantFocus(),e=void 0}),d.on("cancel",function(){e&&f.composer.selection.setBookmark(e),f.editor.fire("cancel:dialog",{command:c,dialogContainer:g,commandLink:b}),e=void 0,f._preventInstantFocus()}),d.on("hide",function(){f.editor.fire("hide:dialog",{command:c,dialogContainer:g,commandLink:b}),e=void 0})),d},execCommand:function(a,b){this.commandsDisabled||this._execCommand(a,b)},_execCommand:function(a,b){this.editor.focus(!1),this.composer.commands.exec(a,b),this._updateLinkStates()},execAction:function(a){var b=this.editor;"change_view"===a&&(b.currentView===b.textarea||"source"===b.currentView?b.fire("change_view","composer"):b.fire("change_view","textarea")),"showSource"==a&&b.fire("showSource")},_observe:function(){for(var b=this,d=this.editor,f=this.container,g=this.commandLinks.concat(this.actionLinks),i=g.length,j=0;i>j;j++)"A"===g[j].nodeName?h.setAttributes({href:"javascript:;",unselectable:"on"}).on(g[j]):h.setAttributes({unselectable:"on"}).on(g[j]);h.delegate(f,"[data-wysihtml5-command], [data-wysihtml5-action]","mousedown",function(a){a.preventDefault()}),h.delegate(f,"[data-wysihtml5-command]","click",function(a){var d,e=this,f=e.getAttribute("data-wysihtml5-command"),g=e.getAttribute("data-wysihtml5-command-value"),h=b.commandMapping[f+":"+g];g||!h.dialog?b.execCommand(f,g):(d=c(b.composer,h),h.dialog.show(d)),a.preventDefault()}), +h.delegate(f,"[data-wysihtml5-action]","click",function(a){var c=this.getAttribute("data-wysihtml5-action");b.execAction(c),a.preventDefault()}),d.on("interaction:composer",function(a){b.preventFocus||b._updateLinkStates()}),this._ownerDocumentClick=function(c){a.dom.contains(b.container,c.target)||a.dom.contains(b.composer.element,c.target)||(b._updateLinkStates(),b._preventInstantFocus())},this.container.ownerDocument.addEventListener("click",this._ownerDocumentClick,!1),this.editor.on("destroy:composer",this.destroy.bind(this)),this.editor.config.handleTables&&(d.on("tableselect:composer",function(){b.container.querySelectorAll('[data-wysihtml5-hiddentools="table"]')[0].style.display=""}),d.on("tableunselect:composer",function(){b.container.querySelectorAll('[data-wysihtml5-hiddentools="table"]')[0].style.display="none"})),d.on("change_view",function(a){setTimeout(function(){b.commandsDisabled="composer"!==a,b._updateLinkStates(),b.commandsDisabled?h.addClass(f,e):h.removeClass(f,e)},0)})},destroy:function(){this.container.ownerDocument.removeEventListener("click",this._ownerDocumentClick,!1)},_hideAllDialogs:function(){var a=this.commandMapping;for(var b in a)a[b].dialog&&a[b].dialog.hide()},_preventInstantFocus:function(){this.preventFocus=!0,setTimeout(function(){this.preventFocus=!1}.bind(this),0)},_updateLinkStates:function(){var a,b,e,i,j,k=this.commandMapping,l=this.composer,m=this.actionMapping;for(a in k)i=k[a],this.commandsDisabled?(b=!1,h.removeClass(i.link,f),i.group&&h.removeClass(i.group,f),i.dialog&&i.dialog.hide()):(b=this.composer.commands.state(i.name,i.value),h.removeClass(i.link,d),i.group&&h.removeClass(i.group,d)),(i.state!==b||i.tracksBlankValue)&&(i.state=b,b?i.tracksBlankValue?h.removeClass(i.link,f):(h.addClass(i.link,f),i.group&&h.addClass(i.group,f),!i.dialog||"undefined"!=typeof i.value&&null!==i.value||(b&&"object"==typeof b?(b=c(l,i),i.state=b,j=i.dialog.container.dataset?i.dialog.container.dataset.showdialogonselection:!1,l.config.showToolbarDialogsOnSelection||j?i.dialog.show(b):i.dialog.update(b)):i.dialog.hide())):i.tracksBlankValue?h.addClass(i.link,f):(h.removeClass(i.link,f),i.group&&h.removeClass(i.group,f),i.dialog&&!i.value&&i.dialog.hide()));for(a in m)e=m[a],"change_view"===e.name&&(e.state=this.editor.currentView===this.editor.textarea||"source"===this.editor.currentView,e.state?h.addClass(e.link,g):h.removeClass(e.link,g))},show:function(){this.container.style.display=""},hide:function(){this.container.style.display="none"}})}(a),function(a){a.toolbar.Dialog_createTable=a.toolbar.Dialog.extend({show:function(a){this.base(a)}})}(a),function(a){var b="[data-wysihtml5-dialog-field]",c="data-wysihtml5-dialog-field";a.toolbar.Dialog_foreColorStyle=a.toolbar.Dialog.extend({multiselect:!0,_serialize:function(){for(var a={},d=this.container.querySelectorAll(b),e=d.length,f=0;e>f;f++)a[d[f].getAttribute(c)]=d[f].value;return a},_interpolate:function(d){for(var e,f,g=a.quirks.styleParser,h=document.querySelector(":focus"),i=this.container.querySelectorAll(b),j=i.length,k=0,l=this.elementToChange?a.lang.object(this.elementToChange).isArray()?this.elementToChange[0]:this.elementToChange:null,m=l?l.getAttribute("style"):null,n=m?g.parseColor(m,"color"):null;j>k;k++)e=i[k],e!==h&&(d&&"hidden"===e.type||"color"===e.getAttribute(c)&&(f=(e.dataset.colormode||"rgb").toLowerCase(),f="hex"===f?"hash":f,n?e.value=g.unparseColor(n,f):e.value=g.unparseColor([0,0,0],f)))}})}(a),function(a){a.dom;a.toolbar.Dialog_fontSizeStyle=a.toolbar.Dialog.extend({multiselect:!0,_serialize:function(){return{size:this.container.querySelector('[data-wysihtml5-dialog-field="size"]').value}},_interpolate:function(b){var c=document.querySelector(":focus"),d=this.container.querySelector("[data-wysihtml5-dialog-field='size']"),e=this.elementToChange?a.lang.object(this.elementToChange).isArray()?this.elementToChange[0]:this.elementToChange:null,f=e?e.getAttribute("style"):null,g=f?a.quirks.styleParser.parseFontSize(f):null;d&&d!==c&&g&&!/^\s*$/.test(g)&&(d.value=g)}})}(a)}); //# sourceMappingURL=wysihtml-toolbar.min.map \ No newline at end of file diff --git a/dist/wysihtml-toolbar.min.map b/dist/wysihtml-toolbar.min.map index 87738fa..872ed88 100644 --- a/dist/wysihtml-toolbar.min.map +++ b/dist/wysihtml-toolbar.min.map @@ -1 +1 @@ -{"version":3,"file":"wysihtml-toolbar.min.js","sources":["wysihtml-toolbar.js"],"names":["wysihtml5","version","commands","dom","quirks","toolbar","lang","selection","views","INVISIBLE_SPACE","INVISIBLE_SPACE_REG_EXP","VOID_ELEMENTS","EMPTY_FUNCTION","ELEMENT_NODE","TEXT_NODE","BACKSPACE_KEY","ENTER_KEY","ESCAPE_KEY","SPACE_KEY","TAB_KEY","DELETE_KEY","polyfills","win","doc","nativeCustomEventSupported","p","CustomEvent","detail","foo","type","e","String","prototype","trim","rtrim","this","replace","s_add","s_rem","Element","on","fn","self","attachEvent","event","target","srcElement","preventDefault","returnValue","stopPropagation","cancelBubble","which","button","keyCode","call","detachEvent","Object","defineProperty","getOwnPropertyDescriptor","get","innerText","set","s","Array","isArray","arg","toString","indexOf","a","f","c","length","r","d","Function","bind","oThis","TypeError","aArgs","slice","arguments","fToBind","fNOP","fBound","apply","concat","ELEMENT","matches","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","selector","element","elements","document","ownerDocument","querySelectorAll","index","closest","parentElement","createElement","testElement","classList","add","contains","createMethod","method","original","DOMTokenList","token","i","len","toggle","_toggle","force","view","classListProp","protoProp","elemCtrProto","objCtr","strTrim","arrIndexOf","item","DOMEx","message","name","code","DOMException","checkTokenAndGetIndex","test","ClassList","elem","trimmedClasses","getAttribute","classes","split","push","_updateClassName","setAttribute","classListProto","classListGetter","Error","tokens","l","updated","remove","splice","result","join","classListPropDesc","enumerable","configurable","ex","number","__defineGetter__","normalizeHasCaretError","window","ret","t1","createTextNode","t2","t3","createRange","appendChild","body","setStart","setEnd","getSelection","removeAllRanges","addRange","normalize","childNodes","anchorNode","firstChild","anchorOffset","parentNode","removeChild","getTextNodes","node","all","nextSibling","nodeType","isInDom","n","normalizeFix","nf","Node","texts","defaultView","anode","aoffset","aelement","undefined","fnode","focusNode","foffset","focusOffset","felement","prevTxt","shift","curText","nodeValue","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","previousSibling","F","removeEventListener","readyState","addEventListener","customEventSupported","params","bubbles","cancelable","evt","createEvent","initCustomEvent","Event","factory","root","define","amd","module","exports","rangy","isHostMethod","o","t","FUNCTION","OBJECT","isHostObject","isHostProperty","UNDEFINED","createMultiplePropertyTest","testFunc","props","isTextRange","range","areHostMethods","textRangeMethods","areHostProperties","textRangeProperties","getBody","getElementsByTagName","consoleLog","msg","console","log","alertOrLog","shouldAlert","isBrowser","alert","fail","reason","api","initialized","supported","config","alertOnFail","warn","alertOnWarn","getErrorDesc","description","init","testRange","implementsDomRange","implementsTextRange","domRangeMethods","domRangeProperties","nodeName","toLowerCase","createTextRange","features","errorMessage","moduleName","modules","Module","initListeners","deprecationNotice","deprecated","replacement","createAliasForDeprecatedMethod","owner","util","toArray","shim","shimListeners","dependencies","initializer","createModule","initFunc","newModule","stack","RangePrototype","SelectionPrototype","areHostObjects","forEach","arr","func","preferTextRange","autoInitialize","rangyAutoInitialize","extend","hasOwnProperty","obj","deep","createOptions","optionsParam","defaults","options","el","arrayLike","addListener","eventType","listener","addInitListener","addShimListener","createMissingNativeApi","requiredModule","requiredModuleNames","createError","createCoreModule","rangePrototype","selectionPrototype","isHtmlNamespace","ns","namespaceURI","UNDEF","parent","getNodeIndex","getNodeLength","getCommonAncestor","node1","node2","ancestors","arrayContains","isAncestorOf","ancestor","descendant","selfIsAncestor","isOrIsAncestorOf","getClosestAncestorIn","isCharacterDataNode","isTextOrCommentNode","insertAfter","precedingNode","nextNode","insertBefore","splitDataNode","positionsToPreserve","newNode","cloneNode","deleteData","position","offset","getDocument","getWindow","parentWindow","getIframeDocument","iframeEl","contentDocument","contentWindow","getIframeWindow","isWindow","getContentDocument","methodName","tagName","getRootContainer","comparePoints","nodeA","offsetA","nodeB","offsetB","nodeC","childA","childB","isBrokenNode","inspectNode","crashyTextNodes","data","idAttr","id","innerHTML","fragmentFromNodeChildren","child","fragment","createDocumentFragment","createTestElement","html","contentEditable","bodyFirstChild","removeNode","NodeIterator","_next","createIterator","DomPosition","codeName","textNode","val","getComputedStyleProperty","getComputedStyle","propName","documentElement","currentStyle","_current","hasNext","next","detach","equals","pos","inspect","INDEX_SIZE_ERR","HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INVALID_STATE_ERR","INVALID_NODE_TYPE_ERR","isNonTextPartiallySelected","startContainer","endContainer","getRangeDocument","getRangeRoot","getBoundaryBeforeNode","getBoundaryAfterNode","insertNodeAtPosition","firstNodeInserted","rangesIntersect","rangeA","rangeB","touchingIsIntersecting","assertRangeValid","startComparison","startOffset","endOffset","endComparison","cloneSubtree","iterator","partiallySelected","subIterator","frag","isPartiallySelectedSubtree","getSubtreeIterator","iterateSubtree","rangeIterator","iteratorState","it","stop","subRangeIterator","deleteSubtree","extractSubtree","getNodesInRange","nodeTypes","filter","regex","filterNodeTypes","filterExists","RegExp","nodes","RangeIterator","sc","ec","getName","clonePartiallySelectedTextNodes","collapsed","so","eo","commonAncestorContainer","isSingleCharacterDataNode","_first","_last","createAncestorFinder","assertNoDocTypeNotationEntityAncestor","allowSelf","getDocTypeNotationEntityAncestor","assertValidNodeType","invalidTypes","assertValidOffset","assertSameDocumentOrFragment","getDocumentOrFragmentContainer","assertNodeNotReadOnly","getReadonlyAncestor","assertNode","isValidOffset","isRangeValid","splitRangeBoundaries","startEndSame","setStartAndEnd","rangeToHtml","container","cloneContents","copyComparisonConstantsToObject","START_TO_START","s2s","START_TO_END","s2e","END_TO_END","e2e","END_TO_START","e2s","NODE_BEFORE","n_b","NODE_AFTER","n_a","NODE_BEFORE_AND_AFTER","n_b_a","NODE_INSIDE","n_i","copyComparisonConstants","constructor","createRangeContentRemover","remover","boundaryUpdater","boundary","reset","createPrototypeRange","createBeforeAfterNodeSetter","isBefore","isStart","beforeAfterNodeTypes","rootContainerNodeTypes","setRangeStart","setRangeEnd","args","setBoundary","setStartBefore","setStartAfter","setEndBefore","setEndAfter","collapse","selectNodeContents","selectNode","start","end","extractContents","deleteContents","canSurroundContents","boundariesInvalid","splitBoundaries","splitBoundariesPreservingPositions","normalizeBoundaries","sibling","mergeForward","appendData","mergeBackward","nodeLength","insertData","nodeIndex","normalizeStart","endNode","startNode","collapseToPoint","updateCollapsedAndCommonAncestor","updateBoundaries","Range","current","subRange","cloneRange","readonlyNodeTypes","insertableNodeTypes","surroundNodeTypes","styleEl","htmlParsingConforms","createContextualFragment","fragmentStr","rangeProperties","compareBoundaryPoints","how","prefixA","prefixB","insertNode","clone","surroundContents","content","hasChildNodes","lastChild","prop","textParts","compareNode","comparePoint","toHtml","intersectsNode","isPointInRange","intersectsRange","intersectsOrTouchesRange","intersection","intersectionRange","union","unionRange","containsNode","allowPartial","containsNodeContents","containsRange","containsNodeText","nodeRange","textNodes","getNodes","lastTextNode","pop","collapseBefore","collapseAfter","getBookmark","containerNode","preSelectionRange","moveToBookmark","bookmark","charIndex","nextCharIndex","nodeStack","foundStart","rangesEqual","isValid","r1","r2","DomRange","WrappedRange","WrappedTextRange","updateRangeProperties","nativeRange","updateNativeRange","startMoved","endMoved","nativeRangeDifferent","rangeProto","refresh","testTextNode","oppositeName","range2","createNativeRange","getTextRangeContainerElement","textRange","parentEl","duplicate","startEl","endEl","startEndContainer","textRangeIsCollapsed","compareEndPoints","getTextRangeBoundaryPosition","wholeRangeContainerElement","isCollapsed","startInfo","workingRange","containerElement","canHaveHTML","boundaryPosition","nodeInfo","workingNode","comparison","previousNode","boundaryNode","workingComparisonType","childNodeCount","moveToElementText","Math","floor","setEndPoint","tempRange","rangeLength","text","moveStart","createBoundaryTextRange","boundaryParent","boundaryOffset","nodeIsDataNode","startBoundary","rangeContainerElement","rangeToTextRange","startRange","endRange","toTextRange","globalObj","createRangyRange","isDirectionBackward","dir","WrappedSelection","getWinSelection","winParam","getDocSelection","winSelectionIsBackward","sel","backward","updateAnchorAndFocusFromRange","anchorPrefix","focusPrefix","updateAnchorAndFocusFromNativeSelection","nativeSel","nativeSelection","updateEmptySelection","rangeCount","_ranges","getNativeRange","rangeContainsSingleElement","rangeNodes","getSingleElementFromRange","updateFromTextRange","wrappedRange","updateControlSelection","docSelection","controlRange","addRangeToControlSelection","rangeElement","newControlRange","createControlRange","select","deleteProperties","detached","actOnCachedSelection","action","cached","cachedRangySelections","createControlSelection","ranges","assertNodeInSameDocument","createStartOrEndSetter","getRangeAt","setSingleRange","isBackward","rangeInspects","anchor","focus","checkSelectionRanges","getNativeSelection","selectionIsCollapsed","BOOLEAN","NUMBER","CONTROL","implementsWinGetSelection","implementsDocSelection","useDocumentSelection","isSelectionValid","testSelection","selectionHasAnchorAndFocus","selectionHasExtend","selectionHasRangeCount","selectionSupportsMultipleRanges","collapsedNonEditableSelectionsSupported","addRangeBackwardToNative","originalSelectionRangeCount","selectionHasMultipleRanges","originalSelectionRanges","originalSelectionBackward","testEl","chromeMatch","navigator","appVersion","match","parseInt","testControlRange","implementsControlRange","getSelectionRangeAt","docSel","selProto","addRangeBackward","direction","previousRangeCount","clonedNativeRange","selectionIsBackward","setRanges","empty","refreshSelection","checkForChanges","oldRanges","oldAnchorNode","oldAnchorOffset","removeRangeManually","getAllRanges","removeRange","removed","isBackwards","rangeTexts","collapseToStart","collapseToEnd","selectAllChildren","deleteFromDocument","eachRange","callMethodOnEachRange","results","changeEachRange","rangeBookmarks","rangeBookmark","selRanges","saveRanges","restoreRanges","rangeHtmls","getNativeTextRange","detachAll","Selection","docReady","loadHandler","require","defaultTokenizer","chars","wordOptions","createTokenRange","isWord","tokenRanges","wordStart","wordEnd","word","lastWordEnd","wordRegex","exec","includeTrailingSpace","nonLineBreakWhiteSpaceRegex","convertCharRangeToToken","tokenRange","tokenChars","tokenize","tokenizer","normalizeIgnoredCharacters","ignoredCharacters","ignoredChars","ignoredCharsArray","sort","char1","char2","charCodeAt","createWordOptions","language","defaultLanguage","defaultWordOptions","createNestedOptions","characterOptions","defaultCharacterOptions","getComputedDisplay","display","tableCssDisplayBlock","defaultDisplayValueForTag","isHidden","getAncestorsAndSelf","isVisibilityHiddenTextNode","isBlockNode","containsPositions","getAncestors","unshift","nextNodeDescendants","excludeChildren","previous","isWhitespaceNode","computedWhiteSpace","isCollapsedWhitespaceNode","isCollapsedNode","isIgnoredNode","Cache","store","createCachingGetter","objProperty","cache","cachedCount","uncachedCount","value","NodeWrapper","session","positions","Position","nodeWrapper","inspectPosition","startSession","endSession","currentSession","Session","getSession","createCharacterIterator","startPos","endPos","charPos","finished","previousVisible","nextVisible","previousTextPos","returnPreviousTextPos","character","getCharacter","rewind","dispose","createTokenizedTextProvider","consumeWord","forward","textChar","newChars","forwardIterator","backwardIterator","passedWordBoundary","insideWord","allWhiteSpaceRegex","forwardChars","backwardChars","reverse","forwardTokensBuffer","arrayIndexOf","backwardTokensBuffer","nextEndToken","lastToken","previousStartToken","movePositionBy","unit","count","currentPos","charIterator","nextPos","unitsMoved","newPos","absCount","abs","CHARACTER","WORD","tokenizedTextProvider","isLeadingSpace","isTrailingSpace","createRangeCharacterIterator","rangeStart","getRangeBoundaryPosition","rangeEnd","itStart","itEnd","getRangeCharacters","isWholeWord","expand","findTextFromPosition","initialPos","searchTerm","isRegex","searchScopeRange","findOptions","handleMatch","startIndex","endIndex","valid","wholeWordsOnly","currentChar","matchStartIndex","matchEndIndex","insideRegexMatch","caseSensitive","createEntryPointFunction","sessionRunning","createRangeBoundaryMover","moveOptions","defaultMoveOptions","boundaryIsStart","moveResult","createRangeTrimmer","trimCharCount","trimmed","createSelectionTrimmer","spacesRegex","spacesMinusLineBreaksRegex","trailingSpaceInBlockCollapses","trailingSpaceBeforeBrCollapses","trailingSpaceBeforeBlockCollapses","trailingSpaceBeforeLineBreakInPreLineCollapses","includeBlockContentTrailingSpace","includeSpaceBeforeBr","includeSpaceBeforeBlock","includePreLineTrailingSpace","ignoreCharacters","defaultCaretCharacterOptions","en","defaultFindOptions","withinRange","wrap","defaultExpandOptions","trimStart","trimEnd","defaultWordIteratorOptions","table","caption","colgroup","col","thead","tbody","tfoot","tr","td","th","key","nodeProto","getPosition","EMPTY","NON_SPACE","UNCOLLAPSIBLE_SPACE","COLLAPSIBLE_SPACE","TRAILING_SPACE_BEFORE_BLOCK","TRAILING_SPACE_IN_BLOCK","TRAILING_SPACE_BEFORE_BR","PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK","TRAILING_LINE_BREAK_AFTER_BR","INCLUDED_TRAILING_LINE_BREAK_AFTER_BR","getLength","isWhitespace","isCollapsedWhitespace","isIgnored","getTextNodeInfo","spaceRegex","collapseSpaces","cssWhitespace","preLine","hasInnerText","posAfterEl","firstPosInEl","prepopulateChar","isDefinitelyNonEmpty","isRenderedBlock","brs","getTrailingSpace","getNodeWrapper","getLeadingSpace","positionProto","characterType","isBr","prepopulatedChar","visibleChar","charType","finalizedChar","charAt","nodePassed","checkForTrailingSpace","checkForLeadingSpace","isCharInvariant","resolveLeadingAndTrailingSpaces","trailingSpace","leadingSpace","getPrecedingUncollapsedPosition","getPreviousPos","gotPreviousPos","previousPos","returnChar","thisChar","isIgnoredCharacter","cacheKey","cachedChar","collapsible","nextUncollapsed","nextOffset","previousOffset","createWrapperCache","nodeProperty","wrappersByProperty","wrapper","property","initCaches","uniqueIDSupported","elementCache","elementsCache","uniqueID","elWrapper","textNodeCache","otherNodeCache","wrapperCache","prefix","moveEnd","move","startTrimmed","endTrimmed","expandOptions","moved","endToken","newEndPos","startTokenizedTextProvider","startToken","newStartPos","endTokenizedTextProvider","selectCharacters","toCharacterRange","rangeStartsBeforeNode","rangeBetween","findText","searchTermParam","findResult","wrappedAround","pasteHtml","saveCharacterRanges","rangeInfos","characterRange","restoreCharacterRanges","saved","rangeInfo","createWordIterator","iteratorOptions","noMutation","createPosition","gEBI","getElementById","insertRangeBoundaryMarker","atStart","markerEl","markerId","Date","random","boundaryRange","style","lineHeight","className","markerTextChar","setRangeBoundary","compareRanges","saveRange","startMarkerId","endMarkerId","restoreRange","saveSelection","restored","restoreSelection","savedSelection","preserveDirection","removeMarkerElement","removeMarkers","Base","_instance","_static","_prototyping","proto","base","klass","_constructing","implement","valueOf","source","toSource","hidden","object","block","context","browser","iosVersion","userAgent","androidVersion","isIE","equation","re","rv","appName","parseFloat","$1","isGecko","isWebKit","isChrome","isOpera","USER_AGENT","hasContentEditableSupport","hasEditingApiSupport","execCommand","queryCommandSupported","queryCommandState","hasQuerySelectorSupport","querySelector","isIncompatibleMobileBrowser","isIos","isAndroid","isTouchDevice","supportsEvent","supportsSandboxedIframes","throwsMixedContentWarningWhenIframeSrcIsEmpty","displaysCaretInEmptyContentEditableCorrectly","hasCurrentStyleProperty","insertsLineBreaksOnReturn","supportsPlaceholderAttributeOn","eventName","supportsEventsInIframeCorrectly","supportsHTML5Tags","html5","supportsCommand","buggyCommands","formatBlock","insertUnorderedList","insertOrderedList","insertHTML","command","isBuggy","e1","queryCommandEnabled","e2","doesAutoLinkingInContentEditable","canDisableAutoLinking","clearsContentEditableCorrectly","supportsGetAttributeCorrectly","canSelectImagesInContentEditable","autoScrollsToCaret","autoClosesUnclosedTags","clonedTestElement","supportsNativeGetElementsByClassName","getElementsByClassName","supportsSelectionModify","needsSpaceAfterLineBreak","supportsSpeechApiOn","input","chromeVersion","crashesWhenDefineProperty","doesAsyncFocus","hasProblemsSettingCaretAfterImg","hasLiDeletingProblem","hasUndoInContextMenu","hasInsertNodeIssue","hasIframeFocusIssue","createsNestedInvalidMarkupAfterPaste","hasCaretBlockElementIssue","supportsMutationEvents","supportsModernPaste","fixStyleKey","usesControlRanges","array","needle","without","arrayToSubstract","newArr","newArray","map","callback","thisArg","A","unique","vals","max","idx","Dispatcher","handler","events","off","handlers","newHandlers","fire","payload","observe","stopObserving","merge","otherObj","isPlainObject","difference","diffObj","newObj","isFunction","Text","isEmpty","WHITE_SPACE_START","WHITE_SPACE_END","ENTITY_REG_EXP","ENTITY_MAP","&","<",">","\"","\t","string","str","interpolate","vars","by","search","escapeHTML","linebreaks","convertSpaces","autoLink","ignoreInClasses","_hasParentThatShouldBeIgnored","_parseNode","_convertUrlsToLinks","URL_REG_EXP","url","punctuation","TRAILING_CHAR_REG_EXP","opening","BRACKETS","realUrl","displayUrl","MAX_DISPLAY_LENGTH","substr","_getTempElement","tempElement","_wysihtml5_tempElement","_wrapMatchesInNode","IGNORE_URLS_IN","childNodesLength",")","]","}","addClass","hasClass","removeClass","elementClassName","convertToList","_createListItem","list","listItem","_createList","listType","uneditableClass","childNode","lineBreak","isBlockElement","isLineBreak","currentListItem","lineBreaks","lineBreaksLength","getStyle","from","insert","after","replaceChild","copyAttributes","attributesToCopy","elementToCopyFrom","to","elementToCopyTo","attribute","andTo","callee","BOX_SIZING_PROPERTIES","shouldIgnoreBoxSizingBorderBox","hasBoxSizingBorderBox","offsetWidth","copyStyles","stylesToCopy","cssText","setStyles","delegate","parents","domNode","defaultNodeTypes","is","emptyTextNode","ignoreWhitespace","regx","rangyBookmark","visible","isVisible","getTextContent","voidElement","query","prev","prevNode","types","ignoreBlankTexts","commonAncestor","parents1","parents2","lastLeafNode","leafClasses","escapeParent","newWrapper","split2","nodeWrap","curNode","transferContentTo","targetNode","removeOldWrapper","properties","classRegExp","styleProperty","hasOneStyle","styles","j","maxStyleP","styleValue","attr","getAttributes","attrList","hasOneAttribute","attributeValue","getAsDom","_innerHTMLShiv","_ensureHTML5Compatibility","_wysihtml5_supportsHTML5Tags","HTML5_ELEMENTS","getParentElement","levels","camelize","REG_EXP_CAMELIZE","toUpperCase","stylePropertyMapping","float","camelizedProperty","originalOverflow","needsOverflowReset","overflow","getPropertyValue","ingoreEmpty","textContent","hasElementWithTagName","_getDocumentIdentifier","_wysihtml5_identifier","DOCUMENT_IDENTIFIER","LIVE_CACHE","cacheEntry","hasElementWithClassName","elementToInsert","before","into","insertCSS","rules","styleElement","styleSheet","link","head","_isLineBreak","_isLineBreakOrBlockElement","eventNames","handlerWrapper","parse","elementOrHtml_current","config_current","elementOrHtml","currentRules","defaultRules","isString","clearInternals","selectors","_applySelectorRules","_convert","cleanUp","unjoinNbsps","txtnodes","getCorrectInnerHTML","oldNode","newChild","nodeDisplay","oldNodeType","oldChilds","oldChildsLength","NODE_TYPE_MAPPING","blockElements","DEFAULT_NODE_NAME","attributes","selectorRules","els","elementHandlingMethods","_handleElement","rule","renameTag","tagRules","tags","scopeName","_wysihtml5","outerHTML","unwrap","rename_tag","one_of_type","_testTypes","remove_action","remove_action_rename_to","_handleAttributes","_handleStyles","definition","type_definitions","_testType","classesLength","styleProp","nodeClasses","nodeStyles","methods","m","typeCeckMethods","WHITE_SPACE_REG_EXP","sp","attrs","v","keep_styles","styleFloat","cssFloat","_getAttributesBeginningWith","beginning","returnAttributes","_checkAttribute","attributeName","newAttributeValue","attributeCheckMethods","_checkAttributes","local_attributes","newValue","matchingAttributes","globalAttributes","checkAttributes","oldAttributes","imax","currentClass","newClass","setClass","set_class","add_class","addStyle","add_style","setAttributes","set_attributes","allowedClasses","newClasses","oldClasses","check_attributes","addClassMethods","addStyleMethods","newStyle","classes_blacklist","src","width","height","_handleText","_handleComment","comments","createComment","1","3","8","REG_EXP","href","alt","numbers","dimension","any","align_text","mapping","left","right","center","align_img","justify","clear_br","both","size_font","2","4","5","6","7","-","+","has_visible_contet","txt","visibleElements","offsetHeight","removeEmptyTextNodes","renameElement","newNodeName","newElement","replaceWithChildNodes","_isBlockElement","_appendLineBreak","resolveList","useLineBreaks","isLastChild","shouldAppendLineBreak","paragraph","isLastItem","lastListItem","lastElementChild","firstElementChild","windowProperties","windowProperties2","documentProperties","Sandbox","readyCallback","editableArea","_createIframe","insertInto","getIframe","_readyError","destroy","iframe","that","security","allowtransparency","frameborder","marginwidth","marginheight","onload","onreadystatechange","_onLoadIframe","iframeWindow","iframeDocument","charset","characterSet","sandboxHtml","_getHtml","stylesheets","open","write","close","onerror","fileName","lineNumber","_unset","loaded","setTimeout","templateVars","setter","__defineSetter__","ContentEditableArea","getContentEditable","_bindElement","_createElement","_loadElement","contentExists","innerHtml","simulatePlaceholder","editor","placeholderText","placeholderClassName","CLASS_NAME","unset","composerIsVisible","hasPlaceholderSet","clear","placeholderSet","setValue","setTextContent","HAS_GET_ATTRIBUTE_BUG","isLoadedImage","hasAttribute","specified","complete","queryInList","q","removeElement","referenceNode","tag","MapCell","cell","isColspan","isRowspan","firstCol","lastCol","firstRow","lastRow","isReal","spanCollection","modified","TableModifyerByCell","addSpannedCellToMap","cspan","rspan","spanCollect","rmax","cmax","rr","cc","setCellAsModified","smax","setTableMap","ridx","row","cells","cidx","tableRows","getTableRows","getRowCells","inlineTables","inlineCells","allCells","tableCells","inlineRows","allRows","getMapIndex","r_length","c_length","r_idx","c_idx","getElementAtIndex","getMapElsTo","to_cell","idx_start","idx_end","temp_idx","temp_cidx","maxr","maxc","orderSelectionEnds","secondcell","createCells","nr","correctColIndexForUnreals","corrIdx","getLastNewCellOnRow","rowLimit","removeEmptyTable","splitRowToCells","colspan","cType","newCells","removeAttribute","getRealRowEl","injectRowAt","new_cells","n_cidx","canMerge","decreaseCellSpan","span","removeSurplusLines","allRowspan","fillMissingCells","r_max","c_max","prevcell","rectify","unmerge","thisCell","rowspan","collapseCellToNextRow","cellIdx","newRowIdx","newIdx","lastCell","removeRowCell","getRowElementsByCell","modRow","getColumnElementsByCell","removeRow","oldRow","removeColCell","removeColumn","what","addRow","where","newRow","addRowCell","cr","colSpanAttr","addColumn","addColCell","doAdd","handleCellAddWithRowspan","modCell","temp_r_cells","nrow","addRowsNr","crow","getCellsBetween","cell1","cell2","c1","addCells","removeCells","mergeCellsBetween","unmergeCell","findCell","findRowByCell","findColumnByCell","thisOwner","otherOwner","point","location_index","smallest_common_ancestor","this_index","other_index","children","getPastedHtml","clipboardData","getData","getPastedHtmlWithDiv","composer","selBookmark","cleanerDiv","scrollPos","getScrollPos","top","y","x","setBookmark","removeInvisibleSpaces","cleanPastedHTML","styleToRegex","styleStr","trimmedStr","escapedStr","extendRulesWithStyleExceptions","exceptStyles","newRules","pickRuleset","ruleset","defaultSet","condition","newHtml","color","fontSize","ensureProperClearing","clearIfNecessary","TILDE_ESCAPED","urlToSearch","elementsWithTilde","redraw","tableCellsSelection","editable","handleMouseDown","handleSelectionMousedown","removeCellSelections","selection_class","handleMouseMove","handleMouseUp","selectedCells","addSelections","oldEnd","curTable","deselect","bindSideclick","sideClickHandler","selectCells","getColorParseMethod","colorStr","colorTypeConf","colorParseMethods","getColorFormat","rgba","rgb","hex6","radix","hex3","makeParamRegExp","styleParser","parseColor","stylesStr","paramName","paramsRegex","colorType","colorMatch","unparseColor","colorFormat","hexRadix","parseFontSize","_getCumulativeOffsetTop","offsetTop","offsetParent","getDepth","getRangeNode","getWebkitSelectionFixNode","blankNode","placeholderRemover","delayedPlaceholderRemover","minWidth","expandRangeToSurround","common","start_depth","end_depth","contain","unselectableClass","getRange","setSelection","setBefore","createTemporaryCaretSpaceAfter","caretPlaceholder","caretPlaceholderText","keyDownHandler","setAfter","ctrlKey","metaKey","zIndex","notVisual","fixWebkitSelection","lastSibling","activeElement","setScrollPos","avoidInvisibleSpace","isElement","displayStyle","getSelectedNode","fixSelBorders","getSelectedOwnNodes","getOwnRanges","ownNodes","maxi","findNodesInSelection","curNodes","filterElements","containsUneditable","uneditables","getOwnUneditables","deleteRangeContents","startParent","endParent","ev","dispatchEvent","err","getCaretNode","getPreviousNode","ignoreEmpty","getNodesNearCaret","caretNode","textOffset","getSelectionParentsByTag","curEl","getRangeToNodeEnd","sNode","lastR","caretIsLastInSelection","endc","endtxt","caretIsFirstInSelection","includeLineBreaks","ws","whiteSpace","caretIsInTheBeginnig","ofNode","getBeforeSelection","includePrevLeaves","inTmpCaret","rng","prevLeaf","executeAndRestoreRangy","restoreScrollPosition","executeAndRestore","newCaretPlaceholder","prevSibling","newRange","oldScrollTop","scrollTop","oldScrollLeft","scrollLeft","placeholderHtml","lastEditorElement","canAppendChild","anchorNodeTagNameLower","voidElements","splitElementAtCaret","contentAfterRangeStart","surround","nodeOptions","cssStyle","scrollIntoView","tolerance","hasScrollBars","scrollHeight","_wysihtml5ScrollIntoViewElement","selectLine","_selectLine_W3C","getBoundingClientRect","_selectLineUniversal","includeRangyRangeHelpers","isHelperNode","initialBoundry","modify","toLineBoundary","location","getRangeRect","rect","testNode","amount","testRect","found","isLineBreakingElement","pnode","bottom","getText","getOwnNodes","splitBounds","fixRangeOverflow","containment","_detectInlineRangeProblems","previousElementSibling","_endOffsetForNode","dontFix","allUneditables","deepUneditables","tmpRanges","tmpRange","jmax","selectAll","blankEndNode","blankStartNode","doSelect","notSelected","getHtml","getPlainText","isEndToEndInNode","nodeNames","isInThisEditable","cssClass","regExp","matchingClassNames","hasStyleAttr","removeStyle","s2","getMatchingStyleRegexp","regexes","sSplit","elStyle","isMatchingAllready","areMatchingAllready","removeOrChangeStyle","exactRegex","hasSameClasses","el1","el2","REG_EXP_WHITE_SPACE","replaceWithOwnChildren","elementsHaveSameNonClassAttributes","attr1","attr2","getNamedItem","isSplitPoint","splitNodeAt","descendantNode","descendantOffset","Merge","firstNode","isElementMerge","firstTextNode","HTMLApplier","tagNames","similarClassRegExp","similarStyleRegExp","defaultTagName","applyToAnyTagName","doMerge","textBits","getAncestorWithClass","cssClassMatch","getAncestorWithStyle","cssStyleMatch","getMatchingAncestor","matchType","postApply","currentMerge","precedingTextNode","lastNode","merges","rangeStartNode","rangeEndNode","rangeStartOffset","rangeEndOffset","getAdjacentMergeableTextNode","nextTextNode","adjacentNode","isTextNode","areElementsMergeable","createContainer","applyToTextNode","isRemovable","undoToTextNode","ancestorWithClass","ancestorWithStyle","styleMode","styleChanged","ancestorRange","applyToRange","ri","undoToRange","getTextSelectedByRange","isAppliedToRange","appliedType","coverage","selectedText","toggleRange","parentsExactMatch","isApplied","Commands","support","commandValue","state","stateValue","bold","formatInline","getOptions","createLink","opts","removeLink","size","fontSizeStyle","st","foreColor","foreColorStyle","colorVals","colString","bgColorStyle","correctOptionsForSimilarityCheck","isBlock","isBookmark","isLineBreaking","cleanup","newBlockElements","nbIdx","allElements","BLOCK_ELEMENTS","noEditQuery","classNames","uneditableContainer","defaultNodeName","findOuterBlock","allBlocks","UNNESTABLE_BLOCK_ELEMENTS","cloneOuterInlines","innerNode","INLINE_ELEMENTS","outerNode","applyOptionsToElement","removeOptionsFromElement","unwrapped","applySurroundingLineBreaks","unwrapBlocksFromContent","nextEl","prevEl","blocks","fixRangeCoverage","fixNotPermittedInsertionPoints","lis","maxj","rangePos","closestLI","newRanges","getOptionsWithNodename","defaultName","correctedOptions","injectFragmentToRange","firstOuterBlock","outerInlines","first","last","rangeStartContainer","fc","lc","clearRangeBlockFromating","closestBlockName","removeSurroundingLineBreaks","prevPrev","wrapRangeWithElement","similarOptions","isWhitespaceBefore","isWhitespaceAfter","similarOuterBlock","splitAllBlocks","trimBlankTextsAndBreaks","tmpEl","getParentBlockNodeName","expandCaretToBlock","insertingNodeName","selectElements","lastEl","lastOffset","formatSelection","parseOptions","caretIsOnEmptyLine","caretInfo","parentNodes","formatCode","classname","selectedNodes","pre","selectedNode","hasNoClass","hasNoStyle","hasNoAttributes","isSameNode","element1","element2","classes1","classes2","createWrapNode","defaultTag","containsSameAttributes","updateElementAttributes","newAttributes","fullContain","updateFormatOfElement","nodeNameQuery","nodeQueryMatch","queryAliasMap","getSelectedTextNodes","findSimilarTextNodeWrapper","exact","isSimilarNode","selectRange","selectTextNodes","lastText","selectTextNode","getState","searchNodes","partial","caretIsInsideWord","beforeChar","afterChar","getRangeForWord","offsetStart","offsetEnd","txtNodes","wordOffset","mergeContents","mergeConsequentSimilarElements","cleanupAndSetSelection","cleanupAndSetCaret","formatTextNode","wrapNode","unformatTextNode","newWrapNode","removeFormatFromTextNode","formatTextRange","updateFormat","wordObj","exactState","removeFormat","applyFormat","fixOptions","b","strong","em","insertBlockQuote","NODE_NAME","insertImage","image","imagesInSelection","LINE_BREAK","insertLineBreak","insertList","isNode","findListEl","other","parentLi","otherNodeName","handleSameTypeList","otherLists","innerLists","getListsInSelection","handleOtherTypeList","renameLists","createListFallback","tempClassName","getTime","cmd","italic","justifyCenter","justifyLeft","justifyRight","justifyFull","alignRightStyle","alignLeftStyle","alignCenterStyle","alignJustifyStyle","redo","undoManager","underline","undo","createTable","cols","rows","tableStyle","mergeTableCells","tableSelection","addTableCells","tableSelect","deleteTableCells","selCell","indentList","listEls","tryToPushLiLevel","liNodes","listTag","prevLi","liNode","prevLiList","outdentList","tryToPullLiLevel","listNode","outerListNode","outerLiNode","afterList","getAfterList","newList","subscript","superscript","Z_KEY","Y_KEY","MAX_HISTORY_ENTRIES","DATA_ATTR_NODE","DATA_ATTR_OFFSET","UndoManager","historyStr","historyDom","transact","_observe","lastKey","sandbox","altKey","isUndo","shiftKey","isRedo","previousHtml","currentHtml","getValue","getChildNodeIndex","undoPossible","redoPossible","historyEntry","getChildNodeByIndex","View","textareaElement","noTextarea","_observeViewChange","currentView","show","hide","disable","enable","Composer","editableElement","textarea","contentEditableMode","_initContentEditableArea","_initSandbox","_displayStyle","disabled","setToEnd","pageYOffset","pageXOffset","scrollTo","_create","_createWysiwygFormField","form","hiddenField","_initAutoLinking","placeholder","_initObjectResizing","_initUndoManager","_initLineBreaking","initSync","sync","supportsDisablingOfAutoLinking","supportsAutoLinking","nodeWithSelection","isInUneditable","links","urlRegExp","newTextContent","propertiesLength","adjust","USE_NATIVE_LINE_BREAK_INSIDE_TAGS","LIST_TAGS","defaultPrevented","blockElement","HOST_TEMPLATE","TEXT_FORMATTING","BOX_FORMATTING","ADDITIONAL_CSS_RULES","focusWithoutScrolling","setActive","elementStyle","originalScrollTop","originalScrollLeft","originalStyles","WebkitUserSelect","displayValueForCopying","originalActiveElement","hasPlaceholder","originalPlaceholder","originalDisplayValue","originalDisabled","focusStylesHost","blurStylesHost","disabledStylesHost","blur","boxFormattingStyles","shortcuts","66","73","85","actions","addListeners","removeListeners","fixLastBrDeletionInTable","aNode","handleUneditableDeletion","fixDeleteInTheBeginningOfBlock","selNode","commonAncestorNode","fixDeleteInTheBeginningOfLi","isInBeginnig","fixDeleteInTheBeginningOfControlSelection","afterCaretNode","initTableHandling","hideHandlers","iframeInitiator","doLineBreaksModeEnterWithCaret","breakNodes","doubleLineBreakEscapesBlock","brNode","br1","br2","handleDeleteKeyPress","handleEnterKeyPress","handleTabKeyDown","handleDomNodeRemoved","domNodeRemovedInterval","clearInterval","handleUserInteraction","handleFocus","focusState","handleBlur","changeevent","create","handlePaste","handleCopy","copyedFromMarking","setData","handleKeyUp","allImages","notMyImages","myImages","lastMouseDownPos","clientX","clientY","handleIEControlSelect","caretPosition","moveToPoint","handleClick","uneditable","handleDrop","handleKeyDown","handleTabKey","observeActions","focusBlurElement","setInterval","handleTables","INTERVAL","Synchronizer","fromComposerToTextarea","shouldParseHtml","fromTextareaToComposer","textareaValue","interval","startInterval","stopInterval","SourceView","switchToTextarea","composerStyles","switchToComposer","Textarea","supportsPlaceholder","eventMapping","focusin","focusout","undef","defaultConfig","showToolbarAfterInit","showToolbarDialogsOnSelection","parserRules","br","div","u","pasteParserRulesets","parser","supportTouchDevices","Editor","_isCompatible","_initParser","handleBeforeLoad","sourceView","synchronizer","Toolbar","isCompatible","htmlOrElement","customRules","parseContext","oldHtml","_cleanAndPaste","pastedHTML","cleanHtml","CLASS_NAME_OPENED","SELECTOR_FORM_ELEMENTS","SELECTOR_FIELDS","ATTRIBUTE_FIELDS","Dialog","_observed","callbackWrapper","_serialize","cancel","fields","_interpolate","avoidHiddenFields","field","fieldName","focusedElement","elementToChange","defaultValue","update","firstField","isOpen","_hide","linkStyles","wrapperStyles","margin","opacity","padding","inputStyles","cursor","marginTop","outline","inputAttributes","x-webkit-speech","speech","Speech","getCommandState","dialog","multiselect","CLASS_NAME_COMMAND_DISABLED","CLASS_NAME_COMMANDS_DISABLED","CLASS_NAME_COMMAND_ACTIVE","CLASS_NAME_ACTION_ACTIVE","showOnInit","_getLinks","classNameCommandDisabled","classNameCommandsDisabled","classNameCommandActive","classNameActionActive","speechInputLinks","group","tracksBlankValue","_getDialog","caretBookmark","dialogElement","dialogContainer","commandLink","_execCommand","_hideAllDialogs","_preventInstantFocus","commandsDisabled","_updateLinkStates","execAction","commandLinks","actionLinks","unselectable","commandObj","commandMapping","preventFocus","_ownerDocumentClick","displayDialogAttributeValue","actionMapping","dataset","showdialogonselection","Dialog_createTable","Dialog_foreColorStyle","colourMode","firstElement","colourStr","colour","colormode","Dialog_fontSizeStyle"],"mappings":";;AAWA,GAAIA,YACFC,QAAS,QAGTC,YACAC,OACAC,UACAC,WACAC,QACAC,aACAC,SAEAC,gBAAiB,SACjBC,wBAAyB,UAEzBC,cAAe,4FAEfC,eAAgB,aAEhBC,aAAc,EACdC,UAAc,EAEdC,cAAgB,EAChBC,UAAgB,GAChBC,WAAgB,GAChBC,UAAgB,GAChBC,QAAgB,EAChBC,WAAgB,GAEjBpB,WAAUqB,UAAY,SAASC,EAAKC,GAkenC,QAASC,KACP,IACE,GAAIC,GAAI,GAAIC,aAAY,OAAQC,QAASC,IAAK,QAC9C,OAAQ,QAAUH,EAAEI,MAAQ,QAAUJ,EAAEE,OAAOC,IAC/C,MAAOE,IACT,OAAO,EA/dJC,OAAOC,UAAUC,OACpB,WAEE,GAAIC,GAAQ,oCACZH,QAAOC,UAAUC,KAAO,WACtB,MAAOE,MAAKC,QAAQF,EAAO,QAMjC,WACE,GAAIG,GAAQ,mBACRC,EAAQ,qBACRf,GAAIc,KACRf,EAAIiB,QAAQP,UAAWK,GAAUf,EAAKe,GAAUd,EAAKc,GAAU,SAAUG,EAAIC,EAAIC,GAC/E,OAAQA,EAAOP,MAAMQ,YAAa,KAAOH,EAAI,SAASV,GACpD,GAAIA,GAAIA,GAAKR,EAAIsB,KACjBd,GAAEe,OAASf,EAAEe,QAAUf,EAAEgB,WACzBhB,EAAEiB,eAAkBjB,EAAEiB,gBAAmB,WAAWjB,EAAEkB,aAAc,GACpElB,EAAEmB,gBAAkBnB,EAAEmB,iBAAmB,WAAWnB,EAAEoB,cAAe,GACrEpB,EAAEqB,MAAQrB,EAAEsB,OAAwB,IAAbtB,EAAEsB,OAAe,EAAiB,IAAbtB,EAAEsB,OAAe,EAAItB,EAAEsB,OAAWtB,EAAEuB,QAChFZ,EAAGa,KAAKZ,EAAMZ,MAGlBR,EAAIiB,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argE,EAAUI,OAAO0wD,YAAYU,cAAcxD,GAAY,IAErF+rB,IAASA,IAAUE,GAAkB5Z,IAAS,QAAUn4D,KAAKm4D,KAC/D0Z,EAAM1kD,MAAQgrC,OAInBrgE"} \ No newline at end of file +{"version":3,"file":"wysihtml-toolbar.min.js","sources":["wysihtml-toolbar.js"],"names":["root","factory","define","amd","module","exports","this","wysihtml","version","commands","dom","quirks","toolbar","lang","selection","views","INVISIBLE_SPACE","INVISIBLE_SPACE_REG_EXP","VOID_ELEMENTS","EMPTY_FUNCTION","ELEMENT_NODE","TEXT_NODE","BACKSPACE_KEY","ENTER_KEY","ESCAPE_KEY","SPACE_KEY","TAB_KEY","DELETE_KEY","polyfills","win","doc","nativeCustomEventSupported","p","CustomEvent","detail","foo","type","e","String","prototype","trim","rtrim","replace","s_add","s_rem","Element","on","fn","self","attachEvent","event","target","srcElement","preventDefault","returnValue","stopPropagation","cancelBubble","which","button","keyCode","call","detachEvent","Object","defineProperty","getOwnPropertyDescriptor","get","innerText","set","s","Array","isArray","arg","toString","indexOf","a","f","c","length","r","d","Function","bind","oThis","TypeError","aArgs","slice","arguments","fToBind","fNOP","fBound","apply","concat","ELEMENT","matches","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","selector","element","elements","document","ownerDocument","querySelectorAll","index","closest","parentElement","createElement","testElement","classList","add","contains","createMethod","method","original","DOMTokenList","token","i","len","toggle","_toggle","force","view","classListProp","protoProp","elemCtrProto","objCtr","strTrim","arrIndexOf","item","DOMEx","message","name","code","DOMException","checkTokenAndGetIndex","test","ClassList","elem","trimmedClasses","getAttribute","classes","split","push","_updateClassName","setAttribute","classListProto","classListGetter","Error","tokens","l","updated","remove","splice","result","join","classListPropDesc","enumerable","configurable","ex","number","__defineGetter__","normalizeHasCaretError","window","ret","t1","createTextNode","t2","t3","createRange","appendChild","body","setStart","setEnd","getSelection","removeAllRanges","addRange","normalize","childNodes","anchorNode","firstChild","anchorOffset","parentNode","removeChild","getTextNodes","node","all","nextSibling","nodeType","isInDom","n","normalizeFix","nf","Node","texts","defaultView","anode","aoffset","aelement","undefined","fnode","focusNode","foffset","focusOffset","felement","prevTxt","shift","curText","nodeValue","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","previousSibling","F","removeEventListener","readyState","addEventListener","customEventSupported","params","bubbles","cancelable","evt","createEvent","initCustomEvent","Event","rangy","isHostMethod","o","t","FUNCTION","OBJECT","isHostObject","isHostProperty","UNDEFINED","createMultiplePropertyTest","testFunc","props","isTextRange","range","areHostMethods","textRangeMethods","areHostProperties","textRangeProperties","getBody","getElementsByTagName","consoleLog","msg","console","log","alertOrLog","shouldAlert","isBrowser","alert","fail","reason","api","initialized","supported","config","alertOnFail","warn","alertOnWarn","getErrorDesc","description","init","testRange","implementsDomRange","implementsTextRange","domRangeMethods","domRangeProperties","nodeName","toLowerCase","createTextRange","features","errorMessage","moduleName","modules","Module","initListeners","deprecationNotice","deprecated","replacement","createAliasForDeprecatedMethod","owner","util","toArray","shim","shimListeners","dependencies","initializer","createModule","initFunc","newModule","stack","RangePrototype","SelectionPrototype","areHostObjects","forEach","arr","func","preferTextRange","autoInitialize","rangyAutoInitialize","extend","hasOwnProperty","obj","deep","createOptions","optionsParam","defaults","options","el","arrayLike","addListener","eventType","listener","addInitListener","addShimListener","createMissingNativeApi","requiredModule","requiredModuleNames","createError","createCoreModule","rangePrototype","selectionPrototype","isHtmlNamespace","ns","namespaceURI","UNDEF","parent","getNodeIndex","getNodeLength","getCommonAncestor","node1","node2","ancestors","arrayContains","isAncestorOf","ancestor","descendant","selfIsAncestor","isOrIsAncestorOf","getClosestAncestorIn","isCharacterDataNode","isTextOrCommentNode","insertAfter","precedingNode","nextNode","insertBefore","splitDataNode","positionsToPreserve","newNode","cloneNode","deleteData","position","offset","getDocument","getWindow","parentWindow","getIframeDocument","iframeEl","contentDocument","contentWindow","getIframeWindow","isWindow","getContentDocument","methodName","tagName","getRootContainer","comparePoints","nodeA","offsetA","nodeB","offsetB","nodeC","childA","childB","isBrokenNode","inspectNode","crashyTextNodes","data","idAttr","id","innerHTML","fragmentFromNodeChildren","child","fragment","createDocumentFragment","createTestElement","html","contentEditable","bodyFirstChild","removeNode","NodeIterator","_next","createIterator","DomPosition","codeName","textNode","val","getComputedStyleProperty","getComputedStyle","propName","documentElement","currentStyle","_current","hasNext","next","detach","equals","pos","inspect","INDEX_SIZE_ERR","HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INVALID_STATE_ERR","INVALID_NODE_TYPE_ERR","isNonTextPartiallySelected","startContainer","endContainer","getRangeDocument","getRangeRoot","getBoundaryBeforeNode","getBoundaryAfterNode","insertNodeAtPosition","firstNodeInserted","rangesIntersect","rangeA","rangeB","touchingIsIntersecting","assertRangeValid","startComparison","startOffset","endOffset","endComparison","cloneSubtree","iterator","partiallySelected","subIterator","frag","isPartiallySelectedSubtree","getSubtreeIterator","iterateSubtree","rangeIterator","iteratorState","it","stop","subRangeIterator","deleteSubtree","extractSubtree","getNodesInRange","nodeTypes","filter","regex","filterNodeTypes","filterExists","RegExp","nodes","RangeIterator","sc","ec","getName","clonePartiallySelectedTextNodes","collapsed","so","eo","commonAncestorContainer","isSingleCharacterDataNode","_first","_last","createAncestorFinder","assertNoDocTypeNotationEntityAncestor","allowSelf","getDocTypeNotationEntityAncestor","assertValidNodeType","invalidTypes","assertValidOffset","assertSameDocumentOrFragment","getDocumentOrFragmentContainer","assertNodeNotReadOnly","getReadonlyAncestor","assertNode","isValidOffset","isRangeValid","splitRangeBoundaries","startEndSame","setStartAndEnd","rangeToHtml","container","cloneContents","copyComparisonConstantsToObject","START_TO_START","s2s","START_TO_END","s2e","END_TO_END","e2e","END_TO_START","e2s","NODE_BEFORE","n_b","NODE_AFTER","n_a","NODE_BEFORE_AND_AFTER","n_b_a","NODE_INSIDE","n_i","copyComparisonConstants","constructor","createRangeContentRemover","remover","boundaryUpdater","boundary","reset","createPrototypeRange","createBeforeAfterNodeSetter","isBefore","isStart","beforeAfterNodeTypes","rootContainerNodeTypes","setRangeStart","setRangeEnd","args","setBoundary","setStartBefore","setStartAfter","setEndBefore","setEndAfter","collapse","selectNodeContents","selectNode","start","end","extractContents","deleteContents","canSurroundContents","boundariesInvalid","splitBoundaries","splitBoundariesPreservingPositions","normalizeBoundaries","sibling","mergeForward","appendData","mergeBackward","nodeLength","insertData","nodeIndex","normalizeStart","endNode","startNode","collapseToPoint","updateCollapsedAndCommonAncestor","updateBoundaries","Range","current","subRange","cloneRange","readonlyNodeTypes","insertableNodeTypes","surroundNodeTypes","styleEl","htmlParsingConforms","createContextualFragment","fragmentStr","rangeProperties","compareBoundaryPoints","how","prefixA","prefixB","insertNode","clone","surroundContents","content","hasChildNodes","lastChild","prop","textParts","compareNode","comparePoint","toHtml","intersectsNode","isPointInRange","intersectsRange","intersectsOrTouchesRange","intersection","intersectionRange","union","unionRange","containsNode","allowPartial","containsNodeContents","containsRange","containsNodeText","nodeRange","textNodes","getNodes","lastTextNode","pop","collapseBefore","collapseAfter","getBookmark","containerNode","preSelectionRange","moveToBookmark","bookmark","charIndex","nextCharIndex","nodeStack","foundStart","rangesEqual","isValid","r1","r2","DomRange","WrappedRange","WrappedTextRange","updateRangeProperties","nativeRange","updateNativeRange","startMoved","endMoved","nativeRangeDifferent","rangeProto","refresh","testTextNode","oppositeName","range2","createNativeRange","getTextRangeContainerElement","textRange","parentEl","duplicate","startEl","endEl","startEndContainer","textRangeIsCollapsed","compareEndPoints","getTextRangeBoundaryPosition","wholeRangeContainerElement","isCollapsed","startInfo","workingRange","containerElement","canHaveHTML","boundaryPosition","nodeInfo","workingNode","comparison","previousNode","boundaryNode","workingComparisonType","childNodeCount","moveToElementText","Math","floor","setEndPoint","tempRange","rangeLength","text","moveStart","createBoundaryTextRange","boundaryParent","boundaryOffset","nodeIsDataNode","startBoundary","rangeContainerElement","rangeToTextRange","startRange","endRange","toTextRange","globalObj","createRangyRange","isDirectionBackward","dir","WrappedSelection","getWinSelection","winParam","getDocSelection","winSelectionIsBackward","sel","backward","updateAnchorAndFocusFromRange","anchorPrefix","focusPrefix","updateAnchorAndFocusFromNativeSelection","nativeSel","nativeSelection","updateEmptySelection","rangeCount","_ranges","getNativeRange","rangeContainsSingleElement","rangeNodes","getSingleElementFromRange","updateFromTextRange","wrappedRange","updateControlSelection","docSelection","controlRange","addRangeToControlSelection","rangeElement","newControlRange","createControlRange","select","deleteProperties","detached","actOnCachedSelection","action","cached","cachedRangySelections","createControlSelection","ranges","assertNodeInSameDocument","createStartOrEndSetter","getRangeAt","setSingleRange","isBackward","rangeInspects","anchor","focus","checkSelectionRanges","getNativeSelection","selectionIsCollapsed","BOOLEAN","NUMBER","CONTROL","implementsWinGetSelection","implementsDocSelection","useDocumentSelection","isSelectionValid","testSelection","selectionHasAnchorAndFocus","selectionHasExtend","selectionHasRangeCount","selectionSupportsMultipleRanges","collapsedNonEditableSelectionsSupported","addRangeBackwardToNative","originalSelectionRangeCount","selectionHasMultipleRanges","originalSelectionRanges","originalSelectionBackward","testEl","chromeMatch","navigator","appVersion","match","parseInt","testControlRange","implementsControlRange","getSelectionRangeAt","docSel","selProto","addRangeBackward","direction","previousRangeCount","clonedNativeRange","selectionIsBackward","setRanges","empty","refreshSelection","checkForChanges","oldRanges","oldAnchorNode","oldAnchorOffset","removeRangeManually","getAllRanges","removeRange","removed","isBackwards","rangeTexts","collapseToStart","collapseToEnd","selectAllChildren","deleteFromDocument","eachRange","callMethodOnEachRange","results","changeEachRange","rangeBookmarks","rangeBookmark","selRanges","saveRanges","restoreRanges","rangeHtmls","getNativeTextRange","detachAll","Selection","docReady","loadHandler","require","defaultTokenizer","chars","wordOptions","createTokenRange","isWord","tokenRanges","wordStart","wordEnd","word","lastWordEnd","wordRegex","exec","includeTrailingSpace","nonLineBreakWhiteSpaceRegex","convertCharRangeToToken","tokenRange","tokenChars","tokenize","tokenizer","normalizeIgnoredCharacters","ignoredCharacters","ignoredChars","ignoredCharsArray","sort","char1","char2","charCodeAt","createWordOptions","language","defaultLanguage","defaultWordOptions","createNestedOptions","characterOptions","defaultCharacterOptions","getComputedDisplay","display","tableCssDisplayBlock","defaultDisplayValueForTag","isHidden","getAncestorsAndSelf","isVisibilityHiddenTextNode","isBlockNode","containsPositions","getAncestors","unshift","nextNodeDescendants","excludeChildren","previous","isWhitespaceNode","computedWhiteSpace","isCollapsedWhitespaceNode","isCollapsedNode","isIgnoredNode","Cache","store","createCachingGetter","objProperty","cache","cachedCount","uncachedCount","value","NodeWrapper","session","positions","Position","nodeWrapper","inspectPosition","startSession","endSession","currentSession","Session","getSession","createCharacterIterator","startPos","endPos","charPos","finished","previousVisible","nextVisible","previousTextPos","returnPreviousTextPos","character","getCharacter","rewind","dispose","createTokenizedTextProvider","consumeWord","forward","textChar","newChars","forwardIterator","backwardIterator","passedWordBoundary","insideWord","allWhiteSpaceRegex","forwardChars","backwardChars","reverse","forwardTokensBuffer","arrayIndexOf","backwardTokensBuffer","nextEndToken","lastToken","previousStartToken","movePositionBy","unit","count","currentPos","charIterator","nextPos","unitsMoved","newPos","absCount","abs","CHARACTER","WORD","tokenizedTextProvider","isLeadingSpace","isTrailingSpace","createRangeCharacterIterator","rangeStart","getRangeBoundaryPosition","rangeEnd","itStart","itEnd","getRangeCharacters","isWholeWord","expand","findTextFromPosition","initialPos","searchTerm","isRegex","searchScopeRange","findOptions","handleMatch","startIndex","endIndex","valid","wholeWordsOnly","currentChar","matchStartIndex","matchEndIndex","insideRegexMatch","caseSensitive","createEntryPointFunction","sessionRunning","createRangeBoundaryMover","moveOptions","defaultMoveOptions","boundaryIsStart","moveResult","createRangeTrimmer","trimCharCount","trimmed","createSelectionTrimmer","spacesRegex","spacesMinusLineBreaksRegex","trailingSpaceInBlockCollapses","trailingSpaceBeforeBrCollapses","trailingSpaceBeforeBlockCollapses","trailingSpaceBeforeLineBreakInPreLineCollapses","includeBlockContentTrailingSpace","includeSpaceBeforeBr","includeSpaceBeforeBlock","includePreLineTrailingSpace","ignoreCharacters","defaultCaretCharacterOptions","en","defaultFindOptions","withinRange","wrap","defaultExpandOptions","trimStart","trimEnd","defaultWordIteratorOptions","table","caption","colgroup","col","thead","tbody","tfoot","tr","td","th","key","nodeProto","getPosition","EMPTY","NON_SPACE","UNCOLLAPSIBLE_SPACE","COLLAPSIBLE_SPACE","TRAILING_SPACE_BEFORE_BLOCK","TRAILING_SPACE_IN_BLOCK","TRAILING_SPACE_BEFORE_BR","PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK","TRAILING_LINE_BREAK_AFTER_BR","INCLUDED_TRAILING_LINE_BREAK_AFTER_BR","getLength","isWhitespace","isCollapsedWhitespace","isIgnored","getTextNodeInfo","spaceRegex","collapseSpaces","cssWhitespace","preLine","hasInnerText","posAfterEl","firstPosInEl","prepopulateChar","isDefinitelyNonEmpty","isRenderedBlock","brs","getTrailingSpace","getNodeWrapper","getLeadingSpace","positionProto","characterType","isBr","prepopulatedChar","visibleChar","charType","finalizedChar","charAt","nodePassed","checkForTrailingSpace","checkForLeadingSpace","isCharInvariant","resolveLeadingAndTrailingSpaces","trailingSpace","leadingSpace","getPrecedingUncollapsedPosition","getPreviousPos","gotPreviousPos","previousPos","returnChar","thisChar","isIgnoredCharacter","cacheKey","cachedChar","collapsible","nextUncollapsed","nextOffset","previousOffset","createWrapperCache","nodeProperty","wrappersByProperty","wrapper","property","initCaches","uniqueIDSupported","elementCache","elementsCache","uniqueID","elWrapper","textNodeCache","otherNodeCache","wrapperCache","prefix","moveEnd","move","startTrimmed","endTrimmed","expandOptions","moved","endToken","newEndPos","startTokenizedTextProvider","startToken","newStartPos","endTokenizedTextProvider","selectCharacters","toCharacterRange","rangeStartsBeforeNode","rangeBetween","findText","searchTermParam","findResult","wrappedAround","pasteHtml","saveCharacterRanges","rangeInfos","characterRange","restoreCharacterRanges","saved","rangeInfo","createWordIterator","iteratorOptions","noMutation","createPosition","gEBI","getElementById","insertRangeBoundaryMarker","atStart","markerEl","markerId","Date","random","boundaryRange","style","lineHeight","className","markerTextChar","setRangeBoundary","compareRanges","saveRange","startMarkerId","endMarkerId","restoreRange","saveSelection","restored","restoreSelection","savedSelection","preserveDirection","removeMarkerElement","removeMarkers","Base","_instance","_static","_prototyping","proto","base","klass","_constructing","implement","valueOf","source","toSource","hidden","object","block","context","browser","iosVersion","userAgent","androidVersion","isIE","equation","re","rv","appName","parseFloat","$1","isGecko","isWebKit","isChrome","isOpera","USER_AGENT","hasContentEditableSupport","hasEditingApiSupport","execCommand","queryCommandSupported","queryCommandState","hasQuerySelectorSupport","querySelector","isIncompatibleMobileBrowser","isIos","isAndroid","isTouchDevice","supportsEvent","supportsSandboxedIframes","throwsMixedContentWarningWhenIframeSrcIsEmpty","displaysCaretInEmptyContentEditableCorrectly","hasCurrentStyleProperty","insertsLineBreaksOnReturn","supportsPlaceholderAttributeOn","eventName","supportsEventsInIframeCorrectly","supportsHTML5Tags","html5","supportsCommand","buggyCommands","formatBlock","insertUnorderedList","insertOrderedList","insertHTML","command","isBuggy","e1","queryCommandEnabled","e2","doesAutoLinkingInContentEditable","canDisableAutoLinking","clearsContentEditableCorrectly","supportsGetAttributeCorrectly","canSelectImagesInContentEditable","autoScrollsToCaret","autoClosesUnclosedTags","clonedTestElement","supportsNativeGetElementsByClassName","getElementsByClassName","supportsSelectionModify","needsSpaceAfterLineBreak","supportsSpeechApiOn","input","chromeVersion","crashesWhenDefineProperty","doesAsyncFocus","hasProblemsSettingCaretAfterImg","hasLiDeletingProblem","hasUndoInContextMenu","hasInsertNodeIssue","hasIframeFocusIssue","createsNestedInvalidMarkupAfterPaste","hasCaretBlockElementIssue","supportsMutationEvents","supportsModernPaste","fixStyleKey","usesControlRanges","array","needle","without","arrayToSubstract","newArr","newArray","map","callback","thisArg","A","unique","vals","max","idx","Dispatcher","handler","events","off","handlers","newHandlers","fire","payload","observe","stopObserving","merge","otherObj","isPlainObject","difference","diffObj","newObj","isFunction","Text","isEmpty","WHITE_SPACE_START","WHITE_SPACE_END","ENTITY_REG_EXP","ENTITY_MAP","&","<",">","\"","\t","string","str","interpolate","vars","by","search","escapeHTML","linebreaks","convertSpaces","autoLink","ignoreInClasses","_hasParentThatShouldBeIgnored","_parseNode","_convertUrlsToLinks","URL_REG_EXP","url","punctuation","TRAILING_CHAR_REG_EXP","opening","BRACKETS","realUrl","displayUrl","MAX_DISPLAY_LENGTH","substr","_getTempElement","tempElement","_wysihtml5_tempElement","_wrapMatchesInNode","IGNORE_URLS_IN","childNodesLength",")","]","}","addClass","hasClass","removeClass","elementClassName","convertToList","_createListItem","list","listItem","_createList","listType","uneditableClass","childNode","lineBreak","isBlockElement","isLineBreak","currentListItem","lineBreaks","lineBreaksLength","getStyle","from","insert","after","replaceChild","copyAttributes","attributesToCopy","elementToCopyFrom","to","elementToCopyTo","attribute","andTo","callee","BOX_SIZING_PROPERTIES","shouldIgnoreBoxSizingBorderBox","hasBoxSizingBorderBox","offsetWidth","copyStyles","stylesToCopy","cssText","setStyles","delegate","parents","domNode","defaultNodeTypes","is","emptyTextNode","ignoreWhitespace","regx","rangyBookmark","visible","isVisible","getTextContent","voidElement","query","prev","prevNode","types","ignoreBlankTexts","commonAncestor","parents1","parents2","lastLeafNode","leafClasses","escapeParent","newWrapper","split2","nodeWrap","curNode","transferContentTo","targetNode","removeOldWrapper","properties","classRegExp","styleProperty","hasOneStyle","styles","j","maxStyleP","styleValue","attr","getAttributes","attrList","hasOneAttribute","attributeValue","getAsDom","_innerHTMLShiv","_ensureHTML5Compatibility","_wysihtml5_supportsHTML5Tags","HTML5_ELEMENTS","getParentElement","levels","camelize","REG_EXP_CAMELIZE","toUpperCase","stylePropertyMapping","float","camelizedProperty","originalOverflow","needsOverflowReset","overflow","getPropertyValue","ingoreEmpty","textContent","hasElementWithTagName","_getDocumentIdentifier","_wysihtml5_identifier","DOCUMENT_IDENTIFIER","LIVE_CACHE","cacheEntry","hasElementWithClassName","elementToInsert","before","into","insertCSS","rules","styleElement","styleSheet","link","head","_isLineBreak","_isLineBreakOrBlockElement","eventNames","handlerWrapper","parse","elementOrHtml_current","config_current","elementOrHtml","currentRules","defaultRules","isString","clearInternals","selectors","_applySelectorRules","_convert","cleanUp","unjoinNbsps","txtnodes","getCorrectInnerHTML","oldNode","newChild","nodeDisplay","oldNodeType","oldChilds","oldChildsLength","NODE_TYPE_MAPPING","blockElements","DEFAULT_NODE_NAME","attributes","selectorRules","els","elementHandlingMethods","_handleElement","rule","renameTag","tagRules","tags","scopeName","_wysihtml5","outerHTML","unwrap","rename_tag","one_of_type","_testTypes","remove_action","remove_action_rename_to","_handleAttributes","_handleStyles","definition","type_definitions","_testType","classesLength","styleProp","nodeClasses","nodeStyles","methods","m","typeCeckMethods","WHITE_SPACE_REG_EXP","sp","attrs","v","keep_styles","styleFloat","cssFloat","_getAttributesBeginningWith","beginning","returnAttributes","_checkAttribute","attributeName","newAttributeValue","attributeCheckMethods","_checkAttributes","local_attributes","newValue","matchingAttributes","globalAttributes","checkAttributes","oldAttributes","imax","currentClass","newClass","setClass","set_class","add_class","addStyle","add_style","setAttributes","set_attributes","allowedClasses","newClasses","oldClasses","check_attributes","addClassMethods","addStyleMethods","newStyle","classes_blacklist","src","width","height","_handleText","_handleComment","comments","createComment","1","3","8","REG_EXP","href","alt","numbers","dimension","any","align_text","mapping","left","right","center","align_img","justify","clear_br","both","size_font","2","4","5","6","7","-","+","has_visible_contet","txt","visibleElements","offsetHeight","removeEmptyTextNodes","renameElement","newNodeName","newElement","replaceWithChildNodes","_isBlockElement","_appendLineBreak","resolveList","useLineBreaks","isLastChild","shouldAppendLineBreak","paragraph","isLastItem","lastListItem","lastElementChild","firstElementChild","windowProperties","windowProperties2","documentProperties","Sandbox","readyCallback","editableArea","_createIframe","insertInto","getIframe","_readyError","destroy","iframe","that","security","allowtransparency","frameborder","marginwidth","marginheight","onload","onreadystatechange","_onLoadIframe","iframeWindow","iframeDocument","charset","characterSet","sandboxHtml","_getHtml","stylesheets","open","write","close","onerror","fileName","lineNumber","_unset","loaded","setTimeout","templateVars","setter","__defineSetter__","ContentEditableArea","getContentEditable","_bindElement","_createElement","_loadElement","contentExists","innerHtml","simulatePlaceholder","editor","placeholderText","placeholderClassName","CLASS_NAME","unset","composerIsVisible","hasPlaceholderSet","clear","placeholderSet","setValue","setTextContent","HAS_GET_ATTRIBUTE_BUG","isLoadedImage","hasAttribute","specified","complete","queryInList","q","removeElement","referenceNode","tag","MapCell","cell","isColspan","isRowspan","firstCol","lastCol","firstRow","lastRow","isReal","spanCollection","modified","TableModifyerByCell","addSpannedCellToMap","cspan","rspan","spanCollect","rmax","cmax","rr","cc","setCellAsModified","smax","setTableMap","ridx","row","cells","cidx","tableRows","getTableRows","getRowCells","inlineTables","inlineCells","allCells","tableCells","inlineRows","allRows","getMapIndex","r_length","c_length","r_idx","c_idx","getElementAtIndex","getMapElsTo","to_cell","idx_start","idx_end","temp_idx","temp_cidx","maxr","maxc","orderSelectionEnds","secondcell","createCells","nr","correctColIndexForUnreals","corrIdx","getLastNewCellOnRow","rowLimit","removeEmptyTable","splitRowToCells","colspan","cType","newCells","removeAttribute","getRealRowEl","injectRowAt","new_cells","n_cidx","canMerge","decreaseCellSpan","span","removeSurplusLines","allRowspan","fillMissingCells","r_max","c_max","prevcell","rectify","unmerge","thisCell","rowspan","collapseCellToNextRow","cellIdx","newRowIdx","newIdx","lastCell","removeRowCell","getRowElementsByCell","modRow","getColumnElementsByCell","removeRow","oldRow","removeColCell","removeColumn","what","addRow","where","newRow","addRowCell","cr","colSpanAttr","addColumn","addColCell","doAdd","handleCellAddWithRowspan","modCell","temp_r_cells","nrow","addRowsNr","crow","getCellsBetween","cell1","cell2","c1","addCells","removeCells","mergeCellsBetween","unmergeCell","findCell","findRowByCell","findColumnByCell","thisOwner","otherOwner","point","location_index","smallest_common_ancestor","this_index","other_index","children","getPastedHtml","clipboardData","getData","getPastedHtmlWithDiv","composer","selBookmark","cleanerDiv","scrollPos","getScrollPos","top","y","x","setBookmark","removeInvisibleSpaces","cleanPastedHTML","styleToRegex","styleStr","trimmedStr","escapedStr","extendRulesWithStyleExceptions","exceptStyles","newRules","pickRuleset","ruleset","defaultSet","condition","newHtml","color","fontSize","ensureProperClearing","clearIfNecessary","TILDE_ESCAPED","urlToSearch","elementsWithTilde","redraw","tableCellsSelection","editable","handleMouseDown","handleSelectionMousedown","removeCellSelections","selection_class","handleMouseMove","handleMouseUp","selectedCells","addSelections","oldEnd","curTable","deselect","bindSideclick","sideClickHandler","selectCells","getColorParseMethod","colorStr","colorTypeConf","colorParseMethods","getColorFormat","rgba","rgb","hex6","radix","hex3","makeParamRegExp","styleParser","parseColor","stylesStr","paramName","paramsRegex","colorType","colorMatch","unparseColor","colorFormat","hexRadix","parseFontSize","_getCumulativeOffsetTop","offsetTop","offsetParent","getDepth","getRangeNode","getWebkitSelectionFixNode","blankNode","placeholderRemover","delayedPlaceholderRemover","minWidth","expandRangeToSurround","common","start_depth","end_depth","contain","unselectableClass","getRange","setSelection","setBefore","createTemporaryCaretSpaceAfter","caretPlaceholder","caretPlaceholderText","keyDownHandler","setAfter","ctrlKey","metaKey","zIndex","notVisual","fixWebkitSelection","lastSibling","activeElement","setScrollPos","avoidInvisibleSpace","isElement","displayStyle","getSelectedNode","fixSelBorders","getSelectedOwnNodes","getOwnRanges","ownNodes","maxi","findNodesInSelection","curNodes","filterElements","containsUneditable","uneditables","getOwnUneditables","deleteRangeContents","startParent","endParent","ev","dispatchEvent","err","getCaretNode","getPreviousNode","ignoreEmpty","getNodesNearCaret","caretNode","textOffset","getSelectionParentsByTag","curEl","getRangeToNodeEnd","sNode","lastR","caretIsLastInSelection","endc","endtxt","caretIsFirstInSelection","includeLineBreaks","ws","whiteSpace","caretIsInTheBeginnig","ofNode","getBeforeSelection","includePrevLeaves","inTmpCaret","rng","prevLeaf","executeAndRestoreRangy","restoreScrollPosition","executeAndRestore","newCaretPlaceholder","prevSibling","newRange","oldScrollTop","scrollTop","oldScrollLeft","scrollLeft","placeholderHtml","lastEditorElement","canAppendChild","anchorNodeTagNameLower","voidElements","splitElementAtCaret","contentAfterRangeStart","surround","nodeOptions","cssStyle","scrollIntoView","tolerance","hasScrollBars","scrollHeight","_wysihtml5ScrollIntoViewElement","selectLine","_selectLine_W3C","getBoundingClientRect","_selectLineUniversal","includeRangyRangeHelpers","isHelperNode","initialBoundry","modify","toLineBoundary","location","getRangeRect","rect","testNode","amount","testRect","found","isLineBreakingElement","pnode","bottom","getText","getOwnNodes","splitBounds","fixRangeOverflow","containment","_detectInlineRangeProblems","previousElementSibling","_endOffsetForNode","dontFix","allUneditables","deepUneditables","tmpRanges","tmpRange","jmax","selectAll","blankEndNode","blankStartNode","doSelect","notSelected","getHtml","getPlainText","isEndToEndInNode","nodeNames","isInThisEditable","Commands","support","commandValue","state","stateValue","getOptions","createLink","opts","formatInline","removeLink","correctOptionsForSimilarityCheck","isBlock","isBookmark","isLineBreaking","cleanup","newBlockElements","nbIdx","allElements","BLOCK_ELEMENTS","noEditQuery","classNames","uneditableContainer","defaultNodeName","findOuterBlock","allBlocks","UNNESTABLE_BLOCK_ELEMENTS","cloneOuterInlines","innerNode","el2","INLINE_ELEMENTS","outerNode","applyOptionsToElement","removeOptionsFromElement","unwrapped","applySurroundingLineBreaks","unwrapBlocksFromContent","nextEl","prevEl","blocks","fixRangeCoverage","fixNotPermittedInsertionPoints","lis","maxj","rangePos","closestLI","newRanges","getOptionsWithNodename","defaultName","correctedOptions","injectFragmentToRange","firstOuterBlock","outerInlines","first","last","rangeStartContainer","fc","lc","clearRangeBlockFromating","closestBlockName","removeSurroundingLineBreaks","prevPrev","wrapRangeWithElement","similarOptions","isWhitespaceBefore","isWhitespaceAfter","similarOuterBlock","splitAllBlocks","trimBlankTextsAndBreaks","tmpEl","getParentBlockNodeName","expandCaretToBlock","insertingNodeName","selectElements","lastEl","lastOffset","formatSelection","parseOptions","caretIsOnEmptyLine","caretInfo","parentNodes","hasNoClass","hasNoStyle","hasNoAttributes","isSameNode","element1","element2","classes1","classes2","attr1","attr2","createWrapNode","defaultTag","containsSameAttributes","updateElementAttributes","newAttributes","fullContain","updateFormatOfElement","nodeNameQuery","nodeQueryMatch","queryAliasMap","getSelectedTextNodes","findSimilarTextNodeWrapper","exact","isSimilarNode","selectRange","selectTextNodes","lastText","selectTextNode","getState","searchNodes","partial","caretIsInsideWord","beforeChar","afterChar","getRangeForWord","offsetStart","offsetEnd","txtNodes","wordOffset","mergeContents","mergeConsequentSimilarElements","cleanupAndSetSelection","cleanupAndSetCaret","formatTextNode","wrapNode","unformatTextNode","newWrapNode","removeFormatFromTextNode","formatTextRange","updateFormat","wordObj","exactState","removeFormat","applyFormat","fixOptions","b","strong","em","LINE_BREAK","insertLineBreak","insertList","isNode","findListEl","other","parentLi","otherNodeName","handleSameTypeList","otherLists","innerLists","getListsInSelection","handleOtherTypeList","renameLists","createListFallback","tempClassName","getTime","selectedNode","cmd","redo","undoManager","undo","createTable","cols","rows","tableStyle","mergeTableCells","tableSelection","addTableCells","tableSelect","deleteTableCells","selCell","indentList","listEls","tryToPushLiLevel","liNodes","listTag","prevLi","liNode","prevLiList","outdentList","tryToPullLiLevel","listNode","outerListNode","outerLiNode","afterList","getAfterList","newList","Z_KEY","Y_KEY","MAX_HISTORY_ENTRIES","DATA_ATTR_NODE","DATA_ATTR_OFFSET","UndoManager","historyStr","historyDom","transact","_observe","lastKey","sandbox","altKey","isUndo","shiftKey","isRedo","previousHtml","currentHtml","getValue","getChildNodeIndex","undoPossible","redoPossible","historyEntry","getChildNodeByIndex","View","textareaElement","noTextarea","_observeViewChange","currentView","show","hide","disable","enable","Composer","editableElement","textarea","contentEditableMode","_initContentEditableArea","_initSandbox","_displayStyle","disabled","setToEnd","pageYOffset","pageXOffset","scrollTo","_create","_createWysiwygFormField","form","hiddenField","_initAutoLinking","placeholder","_initObjectResizing","_initUndoManager","_initLineBreaking","initSync","sync","supportsDisablingOfAutoLinking","supportsAutoLinking","nodeWithSelection","isInUneditable","links","urlRegExp","newTextContent","propertiesLength","adjust","USE_NATIVE_LINE_BREAK_INSIDE_TAGS","LIST_TAGS","defaultPrevented","blockElement","HOST_TEMPLATE","TEXT_FORMATTING","BOX_FORMATTING","ADDITIONAL_CSS_RULES","focusWithoutScrolling","setActive","elementStyle","originalScrollTop","originalScrollLeft","originalStyles","WebkitUserSelect","displayValueForCopying","originalActiveElement","hasPlaceholder","originalPlaceholder","originalDisplayValue","originalDisabled","focusStylesHost","blurStylesHost","disabledStylesHost","blur","boxFormattingStyles","shortcuts","66","73","85","actions","addListeners","removeListeners","fixLastBrDeletionInTable","aNode","handleUneditableDeletion","fixDeleteInTheBeginningOfBlock","selNode","commonAncestorNode","fixDeleteInTheBeginningOfLi","firstNode","isInBeginnig","fixDeleteInTheBeginningOfControlSelection","afterCaretNode","initTableHandling","hideHandlers","iframeInitiator","doLineBreaksModeEnterWithCaret","breakNodes","doubleLineBreakEscapesBlock","brNode","br1","br2","handleDeleteKeyPress","handleEnterKeyPress","handleTabKeyDown","handleDomNodeRemoved","domNodeRemovedInterval","clearInterval","handleUserInteraction","handleFocus","focusState","handleBlur","changeevent","create","handlePaste","handleCopy","copyedFromMarking","setData","handleKeyUp","allImages","notMyImages","myImages","lastMouseDownPos","clientX","clientY","handleIEControlSelect","caretPosition","moveToPoint","handleClick","uneditable","handleDrop","handleKeyDown","handleTabKey","observeActions","focusBlurElement","setInterval","handleTables","INTERVAL","Synchronizer","fromComposerToTextarea","shouldParseHtml","fromTextareaToComposer","textareaValue","interval","startInterval","stopInterval","SourceView","switchToTextarea","composerStyles","switchToComposer","Textarea","supportsPlaceholder","eventMapping","focusin","focusout","undef","defaultConfig","showToolbarAfterInit","showToolbarDialogsOnSelection","parserRules","br","div","u","pasteParserRulesets","parser","supportTouchDevices","Editor","_isCompatible","_initParser","handleBeforeLoad","sourceView","synchronizer","Toolbar","isCompatible","htmlOrElement","customRules","parseContext","oldHtml","_cleanAndPaste","pastedHTML","cleanHtml","CLASS_NAME_OPENED","SELECTOR_FORM_ELEMENTS","SELECTOR_FIELDS","ATTRIBUTE_FIELDS","Dialog","_observed","callbackWrapper","_serialize","cancel","fields","_interpolate","avoidHiddenFields","field","fieldName","focusedElement","elementToChange","defaultValue","update","firstField","isOpen","_hide","linkStyles","wrapperStyles","margin","opacity","padding","inputStyles","cursor","marginTop","outline","inputAttributes","x-webkit-speech","speech","Speech","getCommandState","dialog","multiselect","CLASS_NAME_COMMAND_DISABLED","CLASS_NAME_COMMANDS_DISABLED","CLASS_NAME_COMMAND_ACTIVE","CLASS_NAME_ACTION_ACTIVE","showOnInit","_getLinks","classNameCommandDisabled","classNameCommandsDisabled","classNameCommandActive","classNameActionActive","speechInputLinks","group","tracksBlankValue","_getDialog","caretBookmark","dialogElement","dialogContainer","commandLink","_execCommand","_hideAllDialogs","_preventInstantFocus","commandsDisabled","_updateLinkStates","execAction","commandLinks","actionLinks","unselectable","commandObj","commandMapping","preventFocus","_ownerDocumentClick","displayDialogAttributeValue","actionMapping","dataset","showdialogonselection","Dialog_createTable","Dialog_foreColorStyle","colourMode","firstElement","colourStr","colour","colormode","Dialog_fontSizeStyle","size"],"mappings":";;CAAA,SAAWA,EAAMC,GACI,kBAAXC,SAAyBA,OAAOC,IACxCD,OAAOD,GACmB,gBAAXG,SAAuBA,OAAOC,QAC7CD,OAAOC,QAAUJ,IAEjBA,KAECK,KAAM,WAaT,GAAIC,IACFC,QAAS,QAGTC,YACAC,OACAC,UACAC,WACAC,QACAC,aACAC,SAEAC,gBAAiB,SACjBC,wBAAyB,UAEzBC,cAAe,4FAEfC,eAAgB,aAEhBC,aAAc,EACdC,UAAc,EAEdC,cAAgB,EAChBC,UAAgB,GAChBC,WAAgB,GAChBC,UAAgB,GAChBC,QAAgB,EAChBC,WAAgB,GAEjBpB,GAASqB,UAAY,SAASC,EAAKC,GAkelC,QAASC,KACP,IACE,GAAIC,GAAI,GAAIC,aAAY,OAAQC,QAASC,IAAK,QAC9C,OAAQ,QAAUH,EAAEI,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B,EAAiB,EAAiBqpB,EAAazuE,aAAa,SAAW,KACvE8uE,EAAiB,EAAan3E,EAASI,OAAOmwD,YAAYU,cAAcxD,GAAY,IAEpFslB,IAASA,IAAUE,GAAkBkE,IAAS,QAAUlvE,KAAKkvE,KAC/DpE,EAAMj+C,MAAQqiD,OAInBn3E"} \ No newline at end of file diff --git a/dist/wysihtml.js b/dist/wysihtml.js index 716cadc..715a6c3 100644 --- a/dist/wysihtml.js +++ b/dist/wysihtml.js @@ -1,3 +1,13 @@ +(function (root, factory) { +if(typeof define === 'function' && define.amd) { + define(factory); +} else if(typeof module === 'object' && module.exports) { + module.exports = factory(); +} else { + factory(); +} +})(this, function() { + /** * @license wysihtml v0.5.5 * https://github.com/Voog/wysihtml @@ -9,7 +19,7 @@ * Licensed under the MIT license (MIT) * */ -var wysihtml5 = { +var wysihtml = { version: "0.5.5", // namespaces @@ -38,7 +48,7 @@ var wysihtml5 = { TAB_KEY: 9, DELETE_KEY: 46 }; -;wysihtml5.polyfills = function(win, doc) { +;wysihtml.polyfills = function(win, doc) { // TODO: in future try to replace most inline compability checks with polyfills for code readability @@ -545,7 +555,7 @@ var wysihtml5 = { })(); }; -wysihtml5.polyfills(window, document); +wysihtml.polyfills(window, document); ;/** * Rangy, a cross-browser JavaScript range and selection library * https://github.com/timdown/rangy @@ -6712,7 +6722,7 @@ Base = Base.extend({ });;/** * Detect browser support for specific features */ -wysihtml5.browser = (function() { +wysihtml.browser = (function() { var userAgent = navigator.userAgent, testElement = document.createElement("div"), // Browser sniffing is unfortunately needed since some behaviors are impossible to feature detect @@ -6867,7 +6877,7 @@ wysihtml5.browser = (function() { * @param {Object} context The document object on which to check HTML5 support * * @example - * wysihtml5.browser.supportsHTML5Tags(document); + * wysihtml.browser.supportsHTML5Tags(document); */ supportsHTML5Tags: function(context) { var element = context.createElement("div"), @@ -6886,7 +6896,7 @@ wysihtml5.browser = (function() { * @return {Boolean} * * @example - * wysihtml5.browser.supportsCommand(document, "bold"); + * wysihtml.browser.supportsCommand(document, "bold"); */ supportsCommand: (function() { // Following commands are supported but contain bugs in some browsers @@ -7023,7 +7033,7 @@ wysihtml5.browser = (function() { * * @example * var input = document.createElement("input"); - * if (wysihtml5.browser.supportsSpeechApiOn(input)) { + * if (wysihtml.browser.supportsSpeechApiOn(input)) { * // ... * } */ @@ -7126,13 +7136,13 @@ wysihtml5.browser = (function() { } }; })(); -;wysihtml5.lang.array = function(arr) { +;wysihtml.lang.array = function(arr) { return { /** * Check whether a given object exists in an array * * @example - * wysihtml5.lang.array([1, 2]).contains(1); + * wysihtml.lang.array([1, 2]).contains(1); * // => true * * Can be used to match array with array. If intersection is found true is returned @@ -7140,13 +7150,13 @@ wysihtml5.browser = (function() { contains: function(needle) { if (Array.isArray(needle)) { for (var i = needle.length; i--;) { - if (wysihtml5.lang.array(arr).indexOf(needle[i]) !== -1) { + if (wysihtml.lang.array(arr).indexOf(needle[i]) !== -1) { return true; } } return false; } else { - return wysihtml5.lang.array(arr).indexOf(needle) !== -1; + return wysihtml.lang.array(arr).indexOf(needle) !== -1; } }, @@ -7155,7 +7165,7 @@ wysihtml5.browser = (function() { * If no elelemt found returns -1 * * @example - * wysihtml5.lang.array([1, 2]).indexOf(2); + * wysihtml.lang.array([1, 2]).indexOf(2); * // => 1 */ indexOf: function(needle) { @@ -7173,11 +7183,11 @@ wysihtml5.browser = (function() { * Substract one array from another * * @example - * wysihtml5.lang.array([1, 2, 3, 4]).without([3, 4]); + * wysihtml.lang.array([1, 2, 3, 4]).without([3, 4]); * // => [1, 2] */ without: function(arrayToSubstract) { - arrayToSubstract = wysihtml5.lang.array(arrayToSubstract); + arrayToSubstract = wysihtml.lang.array(arrayToSubstract); var newArr = [], i = 0, length = arr.length; @@ -7194,7 +7204,7 @@ wysihtml5.browser = (function() { * * Following will convert a Live NodeList to a proper Array * @example - * var childNodes = wysihtml5.lang.array(document.body.childNodes).get(); + * var childNodes = wysihtml.lang.array(document.body.childNodes).get(); */ get: function() { var i = 0, @@ -7211,7 +7221,7 @@ wysihtml5.browser = (function() { * optionally this can be provided as second argument * * @example - * var childNodes = wysihtml5.lang.array([1,2,3,4]).map(function (value, index, array) { + * var childNodes = wysihtml.lang.array([1,2,3,4]).map(function (value, index, array) { return value * 2; * }); * // => [2,4,6,8] @@ -7233,7 +7243,7 @@ wysihtml5.browser = (function() { /* ReturnS new array without duplicate entries * * @example - * var uniq = wysihtml5.lang.array([1,2,3,2,1,4]).unique(); + * var uniq = wysihtml.lang.array([1,2,3,2,1,4]).unique(); * // => [1,2,3,4] */ unique: function() { @@ -7242,7 +7252,7 @@ wysihtml5.browser = (function() { idx = 0; while (idx < max) { - if (!wysihtml5.lang.array(vals).contains(arr[idx])) { + if (!wysihtml.lang.array(vals).contains(arr[idx])) { vals.push(arr[idx]); } idx++; @@ -7252,8 +7262,8 @@ wysihtml5.browser = (function() { }; }; -;wysihtml5.lang.Dispatcher = Base.extend( - /** @scope wysihtml5.lang.Dialog.prototype */ { +;wysihtml.lang.Dispatcher = Base.extend( + /** @scope wysihtml.lang.Dialog.prototype */ { on: function(eventName, handler) { this.events = this.events || {}; this.events[eventName] = this.events[eventName] || []; @@ -7302,23 +7312,23 @@ wysihtml5.browser = (function() { return this.off.apply(this, arguments); } }); -;wysihtml5.lang.object = function(obj) { +;wysihtml.lang.object = function(obj) { return { /** * @example - * wysihtml5.lang.object({ foo: 1, bar: 1 }).merge({ bar: 2, baz: 3 }).get(); + * wysihtml.lang.object({ foo: 1, bar: 1 }).merge({ bar: 2, baz: 3 }).get(); * // => { foo: 1, bar: 2, baz: 3 } */ merge: function(otherObj, deep) { for (var i in otherObj) { - if (deep && wysihtml5.lang.object(otherObj[i]).isPlainObject() && (typeof obj[i] === "undefined" || wysihtml5.lang.object(obj[i]).isPlainObject())) { + if (deep && wysihtml.lang.object(otherObj[i]).isPlainObject() && (typeof obj[i] === "undefined" || wysihtml.lang.object(obj[i]).isPlainObject())) { if (typeof obj[i] === "undefined") { - obj[i] = wysihtml5.lang.object(otherObj[i]).clone(true); + obj[i] = wysihtml.lang.object(otherObj[i]).clone(true); } else { - wysihtml5.lang.object(obj[i]).merge(wysihtml5.lang.object(otherObj[i]).clone(true)); + wysihtml.lang.object(obj[i]).merge(wysihtml.lang.object(otherObj[i]).clone(true)); } } else { - obj[i] = wysihtml5.lang.object(otherObj[i]).isPlainObject() ? wysihtml5.lang.object(otherObj[i]).clone(true) : otherObj[i]; + obj[i] = wysihtml.lang.object(otherObj[i]).isPlainObject() ? wysihtml.lang.object(otherObj[i]).clone(true) : otherObj[i]; } } return this; @@ -7353,23 +7363,23 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.object({ foo: 1 }).clone(); + * wysihtml.lang.object({ foo: 1 }).clone(); * // => { foo: 1 } * - * v0.4.14 adds options for deep clone : wysihtml5.lang.object({ foo: 1 }).clone(true); + * v0.4.14 adds options for deep clone : wysihtml.lang.object({ foo: 1 }).clone(true); */ clone: function(deep) { var newObj = {}, i; - if (obj === null || !wysihtml5.lang.object(obj).isPlainObject()) { + if (obj === null || !wysihtml.lang.object(obj).isPlainObject()) { return obj; } for (i in obj) { if(obj.hasOwnProperty(i)) { if (deep) { - newObj[i] = wysihtml5.lang.object(obj[i]).clone(deep); + newObj[i] = wysihtml.lang.object(obj[i]).clone(deep); } else { newObj[i] = obj[i]; } @@ -7380,7 +7390,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.object([]).isArray(); + * wysihtml.lang.object([]).isArray(); * // => true */ isArray: function() { @@ -7389,7 +7399,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.object(function() {}).isFunction(); + * wysihtml.lang.object(function() {}).isFunction(); * // => true */ isFunction: function() { @@ -7402,7 +7412,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.object({}).isEmpty(); + * wysihtml.lang.object({}).isEmpty(); * // => true */ isEmpty: function() { @@ -7426,12 +7436,12 @@ wysihtml5.browser = (function() { '"': """, '\t':"  " }; - wysihtml5.lang.string = function(str) { + wysihtml.lang.string = function(str) { str = String(str); return { /** * @example - * wysihtml5.lang.string(" foo ").trim(); + * wysihtml.lang.string(" foo ").trim(); * // => "foo" */ trim: function() { @@ -7440,7 +7450,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.string("Hello #{name}").interpolate({ name: "Christopher" }); + * wysihtml.lang.string("Hello #{name}").interpolate({ name: "Christopher" }); * // => "Hello Christopher" */ interpolate: function(vars) { @@ -7452,7 +7462,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.string("Hello Tom").replace("Tom").with("Hans"); + * wysihtml.lang.string("Hello Tom").replace("Tom").with("Hans"); * // => "Hello Hans" */ replace: function(search) { @@ -7465,7 +7475,7 @@ wysihtml5.browser = (function() { /** * @example - * wysihtml5.lang.string("hello
    ").escapeHTML(); + * wysihtml.lang.string("hello
    ").escapeHTML(); * // => "hello<br>" */ escapeHTML: function(linebreaks, convertSpaces) { @@ -7489,13 +7499,13 @@ wysihtml5.browser = (function() { * * @example *
    Please click here: www.google.com
    - * + * */ -(function(wysihtml5) { +(function(wysihtml) { var /** * Don't auto-link urls that are contained in the following elements: */ - IGNORE_URLS_IN = wysihtml5.lang.array(["CODE", "PRE", "A", "SCRIPT", "HEAD", "TITLE", "STYLE"]), + IGNORE_URLS_IN = wysihtml.lang.array(["CODE", "PRE", "A", "SCRIPT", "HEAD", "TITLE", "STYLE"]), /** * revision 1: * /(\S+\.{1}[^\s\,\.\!]+)/g @@ -7568,7 +7578,7 @@ wysihtml5.browser = (function() { */ function _wrapMatchesInNode(textNode) { var parentNode = textNode.parentNode, - nodeValue = wysihtml5.lang.string(textNode.data).escapeHTML(), + nodeValue = wysihtml.lang.string(textNode.data).escapeHTML(), tempElement = _getTempElement(parentNode.ownerDocument); // We need to insert an empty/temporary to fix IE quirks @@ -7588,7 +7598,7 @@ wysihtml5.browser = (function() { while (node.parentNode) { node = node.parentNode; nodeName = node.nodeName; - if (node.className && wysihtml5.lang.array(node.className.split(' ')).contains(ignoreInClasses)) { + if (node.className && wysihtml.lang.array(node.className.split(' ')).contains(ignoreInClasses)) { return true; } if (IGNORE_URLS_IN.contains(nodeName)) { @@ -7605,16 +7615,16 @@ wysihtml5.browser = (function() { return; } - if (element.className && wysihtml5.lang.array(element.className.split(' ')).contains(ignoreInClasses)) { + if (element.className && wysihtml.lang.array(element.className.split(' ')).contains(ignoreInClasses)) { return; } - if (element.nodeType === wysihtml5.TEXT_NODE && element.data.match(URL_REG_EXP)) { + if (element.nodeType === wysihtml.TEXT_NODE && element.data.match(URL_REG_EXP)) { _wrapMatchesInNode(element); return; } - var childNodes = wysihtml5.lang.array(element.childNodes).get(), + var childNodes = wysihtml.lang.array(element.childNodes).get(), childNodesLength = childNodes.length, i = 0; @@ -7625,13 +7635,13 @@ wysihtml5.browser = (function() { return element; } - wysihtml5.dom.autoLink = autoLink; + wysihtml.dom.autoLink = autoLink; // Reveal url reg exp to the outside - wysihtml5.dom.autoLink.URL_REG_EXP = URL_REG_EXP; -})(wysihtml5); -;(function(wysihtml5) { - var api = wysihtml5.dom; + wysihtml.dom.autoLink.URL_REG_EXP = URL_REG_EXP; +})(wysihtml); +;(function(wysihtml) { + var api = wysihtml.dom; api.addClass = function(element, className) { var classList = element.classList; @@ -7662,12 +7672,12 @@ wysihtml5.browser = (function() { var elementClassName = element.className; return (elementClassName.length > 0 && (elementClassName == className || new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); }; -})(wysihtml5); -;wysihtml5.dom.contains = (function() { +})(wysihtml); +;wysihtml.dom.contains = (function() { var documentElement = document.documentElement; if (documentElement.contains) { return function(container, element) { - if (element.nodeType !== wysihtml5.ELEMENT_NODE) { + if (element.nodeType !== wysihtml.ELEMENT_NODE) { if (element.parentNode === container) { return true; } @@ -7698,7 +7708,7 @@ wysihtml5.browser = (function() { * * * * * @@ -7708,7 +7718,7 @@ wysihtml5.browser = (function() { *
  • 50 Cent
  • * */ -wysihtml5.dom.convertToList = (function() { +wysihtml.dom.convertToList = (function() { function _createListItem(doc, list) { var listItem = doc.createElement("li"); list.appendChild(listItem); @@ -7743,25 +7753,25 @@ wysihtml5.dom.convertToList = (function() { for (i=0; i if empty, otherwise create a new one currentListItem = currentListItem.firstChild ? _createListItem(doc, list) : currentListItem; currentListItem.appendChild(childNode); @@ -7800,10 +7810,10 @@ wysihtml5.dom.convertToList = (function() { * var textarea = document.querySelector("textarea"), * div = document.querySelector("div[contenteditable=true]"), * anotherDiv = document.querySelector("div.preview"); - * wysihtml5.dom.copyAttributes(["spellcheck", "value", "placeholder"]).from(textarea).to(div).andTo(anotherDiv); + * wysihtml.dom.copyAttributes(["spellcheck", "value", "placeholder"]).from(textarea).to(div).andTo(anotherDiv); * */ -wysihtml5.dom.copyAttributes = function(attributesToCopy) { +wysihtml.dom.copyAttributes = function(attributesToCopy) { return { from: function(elementToCopyFrom) { return { @@ -7839,7 +7849,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { * var textarea = document.querySelector("textarea"), * div = document.querySelector("div[contenteditable=true]"), * anotherDiv = document.querySelector("div.preview"); - * wysihtml5.dom.copyStyles(["overflow-y", "width", "height"]).from(textarea).to(div).andTo(anotherDiv); + * wysihtml.dom.copyStyles(["overflow-y", "width", "height"]).from(textarea).to(div).andTo(anotherDiv); * */ (function(dom) { @@ -7874,7 +7884,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { return { from: function(element) { if (shouldIgnoreBoxSizingBorderBox(element)) { - stylesToCopy = wysihtml5.lang.array(stylesToCopy).without(BOX_SIZING_PROPERTIES); + stylesToCopy = wysihtml.lang.array(stylesToCopy).without(BOX_SIZING_PROPERTIES); } var cssText = "", @@ -7895,17 +7905,17 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } }; }; -})(wysihtml5.dom); +})(wysihtml.dom); ;/** * Event Delegation * * @example - * wysihtml5.dom.delegate(document.body, "a", "click", function() { + * wysihtml.dom.delegate(document.body, "a", "click", function() { * // foo * }); */ -(function(wysihtml5) { - wysihtml5.dom.delegate = function(container, selector, eventName, handler) { +(function(wysihtml) { + wysihtml.dom.delegate = function(container, selector, eventName, handler) { var callback = function(event) { var target = event.target, element = (target.nodeType === 3) ? target.parentNode : target, // IE has .contains only seeing elements not textnodes @@ -7925,9 +7935,9 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } }; }; -})(wysihtml5); +})(wysihtml); ;// TODO: Refactor dom tree traversing here -(function(wysihtml5) { +(function(wysihtml) { // Finds parents of a node, returning the outermost node first in Array // if contain node is given parents search is stopped at the container @@ -7942,15 +7952,15 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { return nodes; } - wysihtml5.dom.domNode = function(node) { - var defaultNodeTypes = [wysihtml5.ELEMENT_NODE, wysihtml5.TEXT_NODE]; + wysihtml.dom.domNode = function(node) { + var defaultNodeTypes = [wysihtml.ELEMENT_NODE, wysihtml.TEXT_NODE]; return { is: { emptyTextNode: function(ignoreWhitespace) { var regx = ignoreWhitespace ? (/^\s*$/g) : (/^[\r\n]*$/g); - return node && node.nodeType === wysihtml5.TEXT_NODE && (regx).test(node.data); + return node && node.nodeType === wysihtml.TEXT_NODE && (regx).test(node.data); }, // Returns if node is the rangy selection bookmark element (that must not be taken into account in most situatons and is removed on selection restoring) @@ -7959,7 +7969,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { }, visible: function() { - var isVisible = !(/^\s*$/g).test(wysihtml5.dom.getTextContent(node)); + var isVisible = !(/^\s*$/g).test(wysihtml.dom.getTextContent(node)); if (!isVisible) { if (node.nodeType === 1 && node.querySelector('img, br, hr, object, embed, canvas, input, textarea')) { @@ -7978,13 +7988,13 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { // In most cases browsers should solve the cases for you when you try to insert content into those, // but IE does not and it is not nice to do so anyway. voidElement: function() { - return wysihtml5.dom.domNode(node).test({ - query: wysihtml5.VOID_ELEMENTS + return wysihtml.dom.domNode(node).test({ + query: wysihtml.VOID_ELEMENTS }); } }, - // var node = wysihtml5.dom.domNode(element).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + // var node = wysihtml.dom.domNode(element).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); prev: function(options) { var prevNode = node.previousSibling, types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes; @@ -7994,17 +8004,17 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } if ( - wysihtml5.dom.domNode(prevNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) - (!wysihtml5.lang.array(types).contains(prevNode.nodeType)) || // nodeTypes check. - (options && options.ignoreBlankTexts && wysihtml5.dom.domNode(prevNode).is.emptyTextNode(true)) // Blank text nodes bypassed if set + wysihtml.dom.domNode(prevNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) + (!wysihtml.lang.array(types).contains(prevNode.nodeType)) || // nodeTypes check. + (options && options.ignoreBlankTexts && wysihtml.dom.domNode(prevNode).is.emptyTextNode(true)) // Blank text nodes bypassed if set ) { - return wysihtml5.dom.domNode(prevNode).prev(options); + return wysihtml.dom.domNode(prevNode).prev(options); } return prevNode; }, - // var node = wysihtml5.dom.domNode(element).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + // var node = wysihtml.dom.domNode(element).next({nodeTypes: [1,3], ignoreBlankTexts: true}); next: function(options) { var nextNode = node.nextSibling, types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes; @@ -8014,11 +8024,11 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } if ( - wysihtml5.dom.domNode(nextNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) - (!wysihtml5.lang.array(types).contains(nextNode.nodeType)) || // nodeTypes check. - (options && options.ignoreBlankTexts && wysihtml5.dom.domNode(nextNode).is.emptyTextNode(true)) // blank text nodes bypassed if set + wysihtml.dom.domNode(nextNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) + (!wysihtml.lang.array(types).contains(nextNode.nodeType)) || // nodeTypes check. + (options && options.ignoreBlankTexts && wysihtml.dom.domNode(nextNode).is.emptyTextNode(true)) // blank text nodes bypassed if set ) { - return wysihtml5.dom.domNode(nextNode).next(options); + return wysihtml.dom.domNode(nextNode).next(options); } return nextNode; @@ -8027,7 +8037,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { // Finds the common acnestor container of two nodes // If container given stops search at the container // If no common ancestor found returns null - // var node = wysihtml5.dom.domNode(element).commonAncestor(node2, container); + // var node = wysihtml.dom.domNode(element).commonAncestor(node2, container); commonAncestor: function(node2, container) { var parents1 = parents(node, container), parents2 = parents(node2, container); @@ -8068,24 +8078,24 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { // Returns if element is of of options.leafClasses leaf if (options && options.leafClasses) { for (var i = options.leafClasses.length; i--;) { - if (wysihtml5.dom.hasClass(node, options.leafClasses[i])) { + if (wysihtml.dom.hasClass(node, options.leafClasses[i])) { return node; } } } - return wysihtml5.dom.domNode(lastChild).lastLeafNode(options); + return wysihtml.dom.domNode(lastChild).lastLeafNode(options); }, // Splits element at childnode and extracts the childNode out of the element context // Example: - // var node = wysihtml5.dom.domNode(node).escapeParent(parentNode); + // var node = wysihtml.dom.domNode(node).escapeParent(parentNode); escapeParent: function(element, newWrapper) { var parent, split2, nodeWrap, curNode = node; // Stop if node is not a descendant of element - if (!wysihtml5.dom.contains(element, node)) { + if (!wysihtml.dom.contains(element, node)) { throw new Error("Child is not a descendant of node."); } @@ -8140,7 +8150,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { transferContentTo: function(targetNode, removeOldWrapper) { if (node.nodeType === 1) { - if (wysihtml5.dom.domNode(targetNode).is.voidElement() || targetNode.nodeType === 3) { + if (wysihtml.dom.domNode(targetNode).is.voidElement() || targetNode.nodeType === 3) { while (node.lastChild) { targetNode.parentNode.insertBefore(node.lastChild, targetNode.nextSibling); } @@ -8153,7 +8163,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { node.parentNode.removeChild(node); } } else if (node.nodeType === 3 || node.nodeType === 8){ - if (wysihtml5.dom.domNode(targetNode).is.voidElement()) { + if (wysihtml.dom.domNode(targetNode).is.voidElement()) { targetNode.parentNode.insertBefore(node, targetNode.nextSibling); } else { targetNode.appendChild(node); @@ -8178,12 +8188,12 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } Example: - var node = wysihtml5.dom.domNode(element).test({}) + var node = wysihtml.dom.domNode(element).test({}) */ test: function(properties) { var prop; - // retuern false if properties object is not defined + // return false if properties object is not defined if (!properties) { return false; } @@ -8221,7 +8231,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { styles = (Array.isArray(properties.styleProperty)) ? properties.styleProperty : [properties.styleProperty]; for (var j = 0, maxStyleP = styles.length; j < maxStyleP; j++) { // Some old IE-s have different property name for cssFloat - prop = wysihtml5.browser.fixStyleKey(styles[j]); + prop = wysihtml.browser.fixStyleKey(styles[j]); if (node.style[prop]) { if (properties.styleValue) { // Style value as additional parameter @@ -8256,7 +8266,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { } if (properties.attribute) { - var attr = wysihtml5.dom.getAttributes(node), + var attr = wysihtml.dom.getAttributes(node), attrList = [], hasOneAttribute = false; @@ -8291,7 +8301,7 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { }; }; -})(wysihtml5); +})(wysihtml); ;/** * Returns the given html wrapped in a div element * @@ -8302,9 +8312,9 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) { * @param {Obejct} [context] Document object of the context the html belongs to * * @example - * wysihtml5.dom.getAsDom("
    foo
    "); + * wysihtml.dom.getAsDom("
    foo
    "); */ -wysihtml5.dom.getAsDom = (function() { +wysihtml.dom.getAsDom = (function() { var _innerHTMLShiv = function(html, context) { var tempElement = context.createElement("div"); @@ -8346,7 +8356,7 @@ wysihtml5.dom.getAsDom = (function() { if (typeof(html) === "object" && html.nodeType) { tempElement = context.createElement("div"); tempElement.appendChild(html); - } else if (wysihtml5.browser.supportsHTML5Tags(context)) { + } else if (wysihtml.browser.supportsHTML5Tags(context)) { tempElement = context.createElement("div"); tempElement.innerHTML = html; } else { @@ -8373,12 +8383,12 @@ wysihtml5.dom.getAsDom = (function() { * @return {null|Element} Returns the first element that matched the desiredNodeName(s) */ -wysihtml5.dom.getParentElement = (function() { +wysihtml.dom.getParentElement = (function() { return function(node, properties, levels, container) { levels = levels || 50; while (levels-- && node && node.nodeName !== "BODY" && (!container || node !== container)) { - if (wysihtml5.dom.domNode(node).test(properties)) { + if (wysihtml.dom.domNode(node).test(properties)) { return node; } node = node.parentNode; @@ -8394,10 +8404,10 @@ wysihtml5.dom.getParentElement = (function() { * @param {String} property The CSS property to retrieve ("float", "display", "text-align", ...) * * @example - * wysihtml5.dom.getStyle("display").from(document.body); + * wysihtml.dom.getStyle("display").from(document.body); * // => "block" */ -wysihtml5.dom.getStyle = (function() { +wysihtml.dom.getStyle = (function() { var stylePropertyMapping = { "float": ("styleFloat" in document.createElement("div").style) ? "styleFloat" : "cssFloat" }, @@ -8412,7 +8422,7 @@ wysihtml5.dom.getStyle = (function() { return function(property) { return { from: function(element) { - if (element.nodeType !== wysihtml5.ELEMENT_NODE) { + if (element.nodeType !== wysihtml.ELEMENT_NODE) { return; } @@ -8460,7 +8470,7 @@ wysihtml5.dom.getStyle = (function() { }; }; })(); -;wysihtml5.dom.getTextNodes = function(node, ingoreEmpty){ +;wysihtml.dom.getTextNodes = function(node, ingoreEmpty){ var all = []; for (node=node.firstChild;node;node=node.nextSibling){ if (node.nodeType == 3) { @@ -8468,7 +8478,7 @@ wysihtml5.dom.getStyle = (function() { all.push(node); } } else { - all = all.concat(wysihtml5.dom.getTextNodes(node, ingoreEmpty)); + all = all.concat(wysihtml.dom.getTextNodes(node, ingoreEmpty)); } } return all; @@ -8481,9 +8491,9 @@ wysihtml5.dom.getStyle = (function() { * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @example - * wysihtml5.dom.hasElementWithTagName(document, "IMG"); + * wysihtml.dom.hasElementWithTagName(document, "IMG"); */ -wysihtml5.dom.hasElementWithTagName = (function() { +wysihtml.dom.hasElementWithTagName = (function() { var LIVE_CACHE = {}, DOCUMENT_IDENTIFIER = 1; @@ -8509,9 +8519,9 @@ wysihtml5.dom.hasElementWithTagName = (function() { * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @example - * wysihtml5.dom.hasElementWithClassName(document, "foobar"); + * wysihtml.dom.hasElementWithClassName(document, "foobar"); */ -(function(wysihtml5) { +(function(wysihtml) { var LIVE_CACHE = {}, DOCUMENT_IDENTIFIER = 1; @@ -8519,10 +8529,10 @@ wysihtml5.dom.hasElementWithTagName = (function() { return doc._wysihtml5_identifier || (doc._wysihtml5_identifier = DOCUMENT_IDENTIFIER++); } - wysihtml5.dom.hasElementWithClassName = function(doc, className) { + wysihtml.dom.hasElementWithClassName = function(doc, className) { // getElementsByClassName is not supported by IE<9 // but is sometimes mocked via library code (which then doesn't return live node lists) - if (!wysihtml5.browser.supportsNativeGetElementsByClassName()) { + if (!wysihtml.browser.supportsNativeGetElementsByClassName()) { return !!doc.querySelector("." + className); } @@ -8534,8 +8544,8 @@ wysihtml5.dom.hasElementWithTagName = (function() { return cacheEntry.length > 0; }; -})(wysihtml5); -;wysihtml5.dom.insert = function(elementToInsert) { +})(wysihtml); +;wysihtml.dom.insert = function(elementToInsert) { return { after: function(element) { element.parentNode.insertBefore(elementToInsert, element.nextSibling); @@ -8550,7 +8560,7 @@ wysihtml5.dom.hasElementWithTagName = (function() { } }; }; -;wysihtml5.dom.insertCSS = function(rules) { +;wysihtml.dom.insertCSS = function(rules) { rules = rules.join("\n"); return { @@ -8578,8 +8588,8 @@ wysihtml5.dom.hasElementWithTagName = (function() { }; }; ;// TODO: Refactor dom tree traversing here -(function(wysihtml5) { - wysihtml5.dom.lineBreaks = function(node) { +(function(wysihtml) { + wysihtml.dom.lineBreaks = function(node) { function _isLineBreak(n) { return n.nodeName === "BR"; @@ -8594,7 +8604,7 @@ wysihtml5.dom.hasElementWithTagName = (function() { return true; } - if (wysihtml5.dom.getStyle("display").from(element) === "block") { + if (wysihtml.dom.getStyle("display").from(element) === "block") { return true; } @@ -8603,31 +8613,31 @@ wysihtml5.dom.hasElementWithTagName = (function() { return { - /* wysihtml5.dom.lineBreaks(element).add(); + /* wysihtml.dom.lineBreaks(element).add(); * * Adds line breaks before and after the given node if the previous and next siblings * aren't already causing a visual line break (block element or
    ) */ add: function(options) { var doc = node.ownerDocument, - nextSibling = wysihtml5.dom.domNode(node).next({ignoreBlankTexts: true}), - previousSibling = wysihtml5.dom.domNode(node).prev({ignoreBlankTexts: true}); + nextSibling = wysihtml.dom.domNode(node).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(node).prev({ignoreBlankTexts: true}); if (nextSibling && !_isLineBreakOrBlockElement(nextSibling)) { - wysihtml5.dom.insert(doc.createElement("br")).after(node); + wysihtml.dom.insert(doc.createElement("br")).after(node); } if (previousSibling && !_isLineBreakOrBlockElement(previousSibling)) { - wysihtml5.dom.insert(doc.createElement("br")).before(node); + wysihtml.dom.insert(doc.createElement("br")).before(node); } }, - /* wysihtml5.dom.lineBreaks(element).remove(); + /* wysihtml.dom.lineBreaks(element).remove(); * * Removes line breaks before and after the given node */ remove: function(options) { - var nextSibling = wysihtml5.dom.domNode(node).next({ignoreBlankTexts: true}), - previousSibling = wysihtml5.dom.domNode(node).prev({ignoreBlankTexts: true}); + var nextSibling = wysihtml.dom.domNode(node).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(node).prev({ignoreBlankTexts: true}); if (nextSibling && _isLineBreak(nextSibling)) { nextSibling.parentNode.removeChild(nextSibling); @@ -8638,13 +8648,13 @@ wysihtml5.dom.hasElementWithTagName = (function() { } }; }; -})(wysihtml5);;/** +})(wysihtml);;/** * Method to set dom events * * @example - * wysihtml5.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); + * wysihtml.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); */ -wysihtml5.dom.observe = function(element, eventNames, handler) { +wysihtml.dom.observe = function(element, eventNames, handler) { eventNames = typeof(eventNames) === "string" ? [eventNames] : eventNames; var handlerWrapper, @@ -8703,7 +8713,7 @@ wysihtml5.dom.observe = function(element, eventNames, handler) { * * @example * var userHTML = '

    foo

    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * tags { * p: "div", // Rename p tags to div tags * font: "span" // Rename font tags to span tags @@ -8714,11 +8724,11 @@ wysihtml5.dom.observe = function(element, eventNames, handler) { * // =>
    foo bar
    * * var userHTML = '
    I'm a table!
    '; - * wysihtml5.dom.parse(userHTML); + * wysihtml.dom.parse(userHTML); * // => 'I'm a table!' * * var userHTML = '
    foobar
    foobar
    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * tags: { * div: undefined, * br: true @@ -8727,7 +8737,7 @@ wysihtml5.dom.observe = function(element, eventNames, handler) { * // => '' * * var userHTML = '
    foo
    bar
    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * classes: { * red: 1, * green: 1 @@ -8741,7 +8751,7 @@ wysihtml5.dom.observe = function(element, eventNames, handler) { * // => '

    foo

    bar

    ' */ -wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { +wysihtml.dom.parse = function(elementOrHtml_current, config_current) { /* TODO: Currently escaped module pattern as otherwise folloowing default swill be shared among multiple editors. * Refactor whole code as this method while workind is kind of awkward too */ @@ -8771,7 +8781,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { * which later replaces the entire body content */ function parse(elementOrHtml, config) { - wysihtml5.lang.object(currentRules).merge(defaultRules).merge(config.rules).get(); + wysihtml.lang.object(currentRules).merge(defaultRules).merge(config.rules).get(); var context = config.context || elementOrHtml.ownerDocument || document, fragment = context.createDocumentFragment(), @@ -8786,7 +8796,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (isString) { - element = wysihtml5.dom.getAsDom(elementOrHtml, context); + element = wysihtml.dom.getAsDom(elementOrHtml, context); } else { element = elementOrHtml; } @@ -8808,7 +8818,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (config.unjoinNbsps) { // replace joined non-breakable spaces with unjoined - var txtnodes = wysihtml5.dom.getTextNodes(fragment); + var txtnodes = wysihtml.dom.getTextNodes(fragment); for (var n = txtnodes.length; n--;) { txtnodes[n].nodeValue = txtnodes[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi, "$1 "); } @@ -8820,7 +8830,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { // Insert new DOM tree element.appendChild(fragment); - return isString ? wysihtml5.quirks.getCorrectInnerHTML(element) : element; + return isString ? wysihtml.quirks.getCorrectInnerHTML(element) : element; } function _convert(oldNode, cleanUp, clearInternals, uneditableClass) { @@ -8835,7 +8845,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { nodeDisplay; // Passes directly elemets with uneditable class - if (uneditableClass && oldNodeType === 1 && wysihtml5.dom.hasClass(oldNode, uneditableClass)) { + if (uneditableClass && oldNodeType === 1 && wysihtml.dom.hasClass(oldNode, uneditableClass)) { return oldNode; } @@ -8859,18 +8869,18 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } } - nodeDisplay = wysihtml5.dom.getStyle("display").from(oldNode); + nodeDisplay = wysihtml.dom.getStyle("display").from(oldNode); if (nodeDisplay === '') { // Handle display style when element not in dom - nodeDisplay = wysihtml5.lang.array(blockElements).contains(oldNode.tagName) ? "block" : ""; + nodeDisplay = wysihtml.lang.array(blockElements).contains(oldNode.tagName) ? "block" : ""; } - if (wysihtml5.lang.array(["block", "flex", "table"]).contains(nodeDisplay)) { + if (wysihtml.lang.array(["block", "flex", "table"]).contains(nodeDisplay)) { fragment.appendChild(oldNode.ownerDocument.createElement("br")); } // TODO: try to minimize surplus spaces - if (wysihtml5.lang.array([ + if (wysihtml.lang.array([ "div", "pre", "p", "table", "td", "th", "ul", "ol", "li", @@ -8935,7 +8945,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { for (sel in selectorRules) { if (selectorRules.hasOwnProperty(sel)) { - if (wysihtml5.lang.object(selectorRules[sel]).isFunction()) { + if (wysihtml.lang.object(selectorRules[sel]).isFunction()) { method = selectorRules[sel]; } else if (typeof(selectorRules[sel]) === "string" && elementHandlingMethods[selectorRules[sel]]) { method = elementHandlingMethods[selectorRules[sel]]; @@ -8984,7 +8994,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { * A

    doesn't need to be closed according HTML4-5 spec, we simply replace it with a

    to preserve its content and layout */ if ("outerHTML" in oldNode) { - if (!wysihtml5.browser.autoClosesUnclosedTags() && + if (!wysihtml.browser.autoClosesUnclosedTags() && oldNode.nodeName === "P" && oldNode.outerHTML.slice(-4).toLowerCase() !== "

    ") { nodeName = "div"; @@ -9099,7 +9109,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { styleProp = nodeStyles[sp].split(':'); if (styleProp[0].replace(/\s/g, '').toLowerCase() === s) { - if (definition.styles[s] === true || definition.styles[s] === 1 || wysihtml5.lang.array(definition.styles[s]).contains(styleProp[1].replace(/\s/g, '').toLowerCase()) ) { + if (definition.styles[s] === true || definition.styles[s] === 1 || wysihtml.lang.array(definition.styles[s]).contains(styleProp[1].replace(/\s/g, '').toLowerCase()) ) { return true; } } @@ -9112,7 +9122,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (definition.attrs) { for (a in definition.attrs) { if (definition.attrs.hasOwnProperty(a)) { - attr = wysihtml5.dom.getAttribute(oldNode, a); + attr = wysihtml.dom.getAttribute(oldNode, a); if (typeof(attr) === "string") { if (attr.search(definition.attrs[a]) > -1) { return true; @@ -9156,7 +9166,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } function _checkAttribute(attributeName, attributeValue, methodName, nodeName) { - var method = wysihtml5.lang.object(methodName).isFunction() ? methodName : attributeCheckMethods[methodName], + var method = wysihtml.lang.object(methodName).isFunction() ? methodName : attributeCheckMethods[methodName], newAttributeValue; if (method) { @@ -9170,10 +9180,10 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } function _checkAttributes(oldNode, local_attributes) { - var globalAttributes = wysihtml5.lang.object(currentRules.attributes || {}).clone(), // global values for check/convert values of attributes - checkAttributes = wysihtml5.lang.object(globalAttributes).merge( wysihtml5.lang.object(local_attributes || {}).clone()).get(), + var globalAttributes = wysihtml.lang.object(currentRules.attributes || {}).clone(), // global values for check/convert values of attributes + checkAttributes = wysihtml.lang.object(globalAttributes).merge( wysihtml.lang.object(local_attributes || {}).clone()).get(), attributes = {}, - oldAttributes = wysihtml5.dom.getAttributes(oldNode), + oldAttributes = wysihtml.dom.getAttributes(oldNode), attributeName, newValue, matchingAttributes; for (attributeName in checkAttributes) { @@ -9219,11 +9229,11 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { method; if (setAttributes) { - attributes = wysihtml5.lang.object(setAttributes).clone(); + attributes = wysihtml.lang.object(setAttributes).clone(); } // check/convert values of attributes - attributes = wysihtml5.lang.object(attributes).merge(_checkAttributes(oldNode, rule.check_attributes)).get(); + attributes = wysihtml.lang.object(attributes).merge(_checkAttributes(oldNode, rule.check_attributes)).get(); if (setClass) { classes.push(setClass); @@ -9235,7 +9245,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (!method) { continue; } - newClass = method(wysihtml5.dom.getAttribute(oldNode, attributeName)); + newClass = method(wysihtml.dom.getAttribute(oldNode, attributeName)); if (typeof(newClass) === "string") { classes.push(newClass); } @@ -9249,7 +9259,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { continue; } - newStyle = method(wysihtml5.dom.getAttribute(oldNode, attributeName)); + newStyle = method(wysihtml.dom.getAttribute(oldNode, attributeName)); if (typeof(newStyle) === "string") { styles.push(newStyle); } @@ -9274,7 +9284,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (newClasses.length) { - attributes["class"] = wysihtml5.lang.array(newClasses).unique().join(" "); + attributes["class"] = wysihtml.lang.array(newClasses).unique().join(" "); } } else { @@ -9282,7 +9292,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } } else { if(classes && classes.length > 0) { - attributes["class"] = wysihtml5.lang.array(classes).unique().join(" "); + attributes["class"] = wysihtml.lang.array(classes).unique().join(" "); } } } else { @@ -9307,7 +9317,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (newClasses.length) { - attributes["class"] = wysihtml5.lang.array(newClasses).unique().join(" "); + attributes["class"] = wysihtml.lang.array(newClasses).unique().join(" "); } } @@ -9320,7 +9330,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (styles.length) { - attributes["style"] = wysihtml5.lang.array(styles).unique().join(" "); + attributes["style"] = wysihtml.lang.array(styles).unique().join(" "); } // set attributes on newNode @@ -9347,12 +9357,12 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { function _handleText(oldNode) { var nextSibling = oldNode.nextSibling; - if (nextSibling && nextSibling.nodeType === wysihtml5.TEXT_NODE) { + if (nextSibling && nextSibling.nodeType === wysihtml.TEXT_NODE) { // Concatenate text nodes - nextSibling.data = oldNode.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, "") + nextSibling.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + nextSibling.data = oldNode.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, "") + nextSibling.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); } else { - // \uFEFF = wysihtml5.INVISIBLE_SPACE (used as a hack in certain rich text editing situations) - var data = oldNode.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + // \uFEFF = wysihtml.INVISIBLE_SPACE (used as a hack in certain rich text editing situations) + var data = oldNode.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); return oldNode.ownerDocument.createTextNode(data); } } @@ -9547,7 +9557,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { var elementHandlingMethods = { unwrap: function (element) { - wysihtml5.dom.unwrap(element); + wysihtml.dom.unwrap(element); }, remove: function (element) { @@ -9562,17 +9572,17 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { * * @param {Element} node The element in which to cleanup * @example - * wysihtml5.dom.removeEmptyTextNodes(element); + * wysihtml.dom.removeEmptyTextNodes(element); */ -wysihtml5.dom.removeEmptyTextNodes = function(node) { +wysihtml.dom.removeEmptyTextNodes = function(node) { var childNode, - childNodes = wysihtml5.lang.array(node.childNodes).get(), + childNodes = wysihtml.lang.array(node.childNodes).get(), childNodesLength = childNodes.length, i = 0; for (; i * * * * @@ -9602,13 +9612,13 @@ wysihtml5.dom.removeEmptyTextNodes = function(node) { *
  • 50 Cent
  • * */ -wysihtml5.dom.renameElement = function(element, newNodeName) { +wysihtml.dom.renameElement = function(element, newNodeName) { var newElement = element.ownerDocument.createElement(newNodeName), firstChild; while (firstChild = element.firstChild) { newElement.appendChild(firstChild); } - wysihtml5.dom.copyAttributes(["align", "className"]).from(element).to(newElement); + wysihtml.dom.copyAttributes(["align", "className"]).from(element).to(newElement); if (element.parentNode) { element.parentNode.replaceChild(newElement, element); @@ -9626,10 +9636,10 @@ wysihtml5.dom.renameElement = function(element, newNodeName) { *
    * */ -wysihtml5.dom.replaceWithChildNodes = function(node) { +wysihtml.dom.replaceWithChildNodes = function(node) { if (!node.parentNode) { return; } @@ -9653,7 +9663,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { * * * * * @@ -9682,8 +9692,8 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { var doc = list.ownerDocument, fragment = doc.createDocumentFragment(), - previousSibling = wysihtml5.dom.domNode(list).prev({ignoreBlankTexts: true}), - nextSibling = wysihtml5.dom.domNode(list).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(list).prev({ignoreBlankTexts: true}), + nextSibling = wysihtml.dom.domNode(list).next({ignoreBlankTexts: true}), firstChild, lastChild, isLastChild, @@ -9735,7 +9745,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { } dom.resolveList = resolveList; -})(wysihtml5.dom); +})(wysihtml.dom); ;/** * Sandbox for executing javascript, parsing css styles and doing dom operations in a secure way * @@ -9754,11 +9764,11 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { * @param {Object} [config] Optional parameters * * @example - * new wysihtml5.dom.Sandbox(function(sandbox) { + * new wysihtml.dom.Sandbox(function(sandbox) { * sandbox.getWindow().document.body.innerHTML = ''; * }); */ -(function(wysihtml5) { +(function(wysihtml) { var /** * Default configuration */ @@ -9787,12 +9797,12 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { "write", "open", "close" ]; - wysihtml5.dom.Sandbox = Base.extend( - /** @scope wysihtml5.dom.Sandbox.prototype */ { + wysihtml.dom.Sandbox = Base.extend( + /** @scope wysihtml.dom.Sandbox.prototype */ { constructor: function(readyCallback, config) { - this.callback = readyCallback || wysihtml5.EMPTY_FUNCTION; - this.config = wysihtml5.lang.object({}).merge(config).get(); + this.callback = readyCallback || wysihtml.EMPTY_FUNCTION; + this.config = wysihtml.lang.object({}).merge(config).get(); if (!this.config.className) { this.config.className = "wysihtml5-sandbox"; } @@ -9825,7 +9835,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { }, _readyError: function() { - throw new Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet"); + throw new Error("wysihtml.Sandbox: Sandbox iframe isn't loaded yet"); }, /** @@ -9851,7 +9861,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { var that = this, iframe = doc.createElement("iframe"); iframe.className = this.config.className; - wysihtml5.dom.setAttributes({ + wysihtml.dom.setAttributes({ "security": "restricted", "allowtransparency": "true", "frameborder": 0, @@ -9862,7 +9872,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { }).on(iframe); // Setting the src like this prevents ssl warnings in IE6 - if (wysihtml5.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()) { + if (wysihtml.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()) { iframe.src = "javascript:''"; } @@ -9886,7 +9896,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { */ _onLoadIframe: function(iframe) { // don't resume when the iframe got unloaded (eg. by removing it from the dom) - if (!wysihtml5.dom.contains(doc.documentElement, iframe)) { + if (!wysihtml.dom.contains(doc.documentElement, iframe)) { return; } @@ -9911,10 +9921,10 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { // addEventListener("error") doesn't work properly in some browsers // TODO: apparently this doesn't work in IE9! iframeWindow.onerror = function(errorMessage, fileName, lineNumber) { - throw new Error("wysihtml5.Sandbox: " + errorMessage, fileName, lineNumber); + throw new Error("wysihtml.Sandbox: " + errorMessage, fileName, lineNumber); }; - if (!wysihtml5.browser.supportsSandboxedIframes()) { + if (!wysihtml.browser.supportsSandboxedIframes()) { // Unset a bunch of sensitive variables // Please note: This isn't hack safe! // It more or less just takes care of basic attacks and prevents accidental theft of sensitive information @@ -9926,7 +9936,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { this._unset(iframeWindow, windowProperties[i]); } for (i=0, length=windowProperties2.length; i' + '#{stylesheets}' + '' @@ -9981,7 +9991,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { try { object.__defineSetter__(property, function() {}); } catch(e) {} } - if (!wysihtml5.browser.crashesWhenDefineProperty(property)) { + if (!wysihtml.browser.crashesWhenDefineProperty(property)) { try { var config = { get: function() { return value; } @@ -9994,10 +10004,10 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { } } }); -})(wysihtml5); -;(function(wysihtml5) { +})(wysihtml); +;(function(wysihtml) { var doc = document; - wysihtml5.dom.ContentEditableArea = Base.extend({ + wysihtml.dom.ContentEditableArea = Base.extend({ getContentEditable: function() { return this.element; }, @@ -10011,8 +10021,8 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { }, constructor: function(readyCallback, config, contentEditable) { - this.callback = readyCallback || wysihtml5.EMPTY_FUNCTION; - this.config = wysihtml5.lang.object({}).merge(config).get(); + this.callback = readyCallback || wysihtml.EMPTY_FUNCTION; + this.config = wysihtml.lang.object({}).merge(config).get(); if (!this.config.className) { this.config.className = "wysihtml5-sandbox"; } @@ -10060,12 +10070,12 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { } }); -})(wysihtml5); +})(wysihtml); ;(function() { var mapping = { "className": "class" }; - wysihtml5.dom.setAttributes = function(attributes) { + wysihtml.dom.setAttributes = function(attributes) { return { on: function(element) { for (var i in attributes) { @@ -10075,7 +10085,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { }; }; })(); -;wysihtml5.dom.setStyles = function(styles) { +;wysihtml.dom.setStyles = function(styles) { return { on: function(element) { var style = element.style; @@ -10101,8 +10111,8 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { * - div[contentEditable] elements don't support it * - older browsers (such as IE8 and Firefox 3.6) don't support it at all * - * @param {Object} parent Instance of main wysihtml5.Editor class - * @param {Element} view Instance of wysihtml5.views.* class + * @param {Object} parent Instance of main wysihtml.Editor class + * @param {Element} view Instance of wysihtml.views.* class * @param {String} placeholderText * * @example @@ -10145,7 +10155,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { set(); }; -})(wysihtml5.dom); +})(wysihtml.dom); ;(function(dom) { var documentElement = document.documentElement; if ("textContent" in documentElement) { @@ -10173,7 +10183,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { return element.nodeValue; }; } -})(wysihtml5.dom); +})(wysihtml.dom); ;/** * Get a set of attribute from one element * @@ -10184,11 +10194,11 @@ wysihtml5.dom.replaceWithChildNodes = function(node) { * Therefore we have to check the element's outerHTML for the attribute */ -wysihtml5.dom.getAttribute = function(node, attributeName) { - var HAS_GET_ATTRIBUTE_BUG = !wysihtml5.browser.supportsGetAttributeCorrectly(); +wysihtml.dom.getAttribute = function(node, attributeName) { + var HAS_GET_ATTRIBUTE_BUG = !wysihtml.browser.supportsGetAttributeCorrectly(); attributeName = attributeName.toLowerCase(); var nodeName = node.nodeName; - if (nodeName == "IMG" && attributeName == "src" && wysihtml5.dom.isLoadedImage(node) === true) { + if (nodeName == "IMG" && attributeName == "src" && wysihtml.dom.isLoadedImage(node) === true) { // Get 'src' attribute value via object property since this will always contain the // full absolute url (http://...) // this fixes a very annoying bug in firefox (ver 3.6 & 4) and IE 8 where images copied from the same host @@ -10215,8 +10225,8 @@ wysihtml5.dom.getAttribute = function(node, attributeName) { * Therefore we have to check the element's outerHTML for the attribute */ -wysihtml5.dom.getAttributes = function(node) { - var HAS_GET_ATTRIBUTE_BUG = !wysihtml5.browser.supportsGetAttributeCorrectly(), +wysihtml.dom.getAttributes = function(node) { + var HAS_GET_ATTRIBUTE_BUG = !wysihtml.browser.supportsGetAttributeCorrectly(), nodeName = node.nodeName, attributes = [], attr; @@ -10224,9 +10234,9 @@ wysihtml5.dom.getAttributes = function(node) { for (attr in node.attributes) { if ((node.attributes.hasOwnProperty && node.attributes.hasOwnProperty(attr)) || (!node.attributes.hasOwnProperty && Object.prototype.hasOwnProperty.call(node.attributes, attr))) { if (node.attributes[attr].specified) { - if (nodeName == "IMG" && node.attributes[attr].name.toLowerCase() == "src" && wysihtml5.dom.isLoadedImage(node) === true) { + if (nodeName == "IMG" && node.attributes[attr].name.toLowerCase() == "src" && wysihtml.dom.isLoadedImage(node) === true) { attributes['src'] = node.src; - } else if (wysihtml5.lang.array(['rowspan', 'colspan']).contains(node.attributes[attr].name.toLowerCase()) && HAS_GET_ATTRIBUTE_BUG) { + } else if (wysihtml.lang.array(['rowspan', 'colspan']).contains(node.attributes[attr].name.toLowerCase()) && HAS_GET_ATTRIBUTE_BUG) { if (node.attributes[attr].value !== 1) { attributes[node.attributes[attr].name] = node.attributes[attr].value; } @@ -10243,7 +10253,7 @@ wysihtml5.dom.getAttributes = function(node) { * FIXME: Returns undefined when unknown (Chrome, Safari) */ -wysihtml5.dom.isLoadedImage = function (node) { +wysihtml.dom.isLoadedImage = function (node) { try { return node.complete && !node.mozMatchesSelector(":-moz-broken"); } catch(e) { @@ -10252,9 +10262,9 @@ wysihtml5.dom.isLoadedImage = function (node) { } } }; -;(function(wysihtml5) { +;(function(wysihtml) { - var api = wysihtml5.dom; + var api = wysihtml.dom; var MapCell = function(cell) { this.el = cell; @@ -10383,7 +10393,7 @@ wysihtml5.dom.isLoadedImage = function (node) { var inlineTables = this.table.querySelectorAll('table'), inlineCells = (inlineTables) ? queryInList(inlineTables, 'th, td') : [], allCells = row.querySelectorAll('th, td'), - tableCells = (inlineCells.length > 0) ? wysihtml5.lang.array(allCells).without(inlineCells) : allCells; + tableCells = (inlineCells.length > 0) ? wysihtml.lang.array(allCells).without(inlineCells) : allCells; return tableCells; }, @@ -10392,7 +10402,7 @@ wysihtml5.dom.isLoadedImage = function (node) { var inlineTables = this.table.querySelectorAll('table'), inlineRows = (inlineTables) ? queryInList(inlineTables, 'tr') : [], allRows = this.table.querySelectorAll('tr'), - tableRows = (inlineRows.length > 0) ? wysihtml5.lang.array(allRows).without(inlineRows) : allRows; + tableRows = (inlineRows.length > 0) ? wysihtml.lang.array(allRows).without(inlineRows) : allRows; return tableRows; }, @@ -10981,7 +10991,7 @@ wysihtml5.dom.isLoadedImage = function (node) { doAdd = (!cell.isColspan || cell.firstCol); break; case "after": - doAdd = (!cell.isColspan || cell.lastCol || (cell.isColspan && c.el == this.cell)); + doAdd = (!cell.isColspan || cell.lastCol || (cell.isColspan && cell.el == this.cell)); break; } @@ -11127,9 +11137,9 @@ wysihtml5.dom.isLoadedImage = function (node) { } }; -})(wysihtml5); +})(wysihtml); ;// does a selector query on element or array of elements -wysihtml5.dom.query = function(elements, query) { +wysihtml.dom.query = function(elements, query) { var ret = [], q; @@ -11145,7 +11155,7 @@ wysihtml5.dom.query = function(elements, query) { } return ret; }; -;wysihtml5.dom.compareDocumentPosition = (function() { +;wysihtml.dom.compareDocumentPosition = (function() { var documentElement = document.documentElement; if (documentElement.compareDocumentPosition) { return function(container, element) { @@ -11172,10 +11182,10 @@ wysihtml5.dom.query = function(elements, query) { if( thisOwner !== otherOwner ) return 1; // Node.DOCUMENT_POSITION_DISCONNECTED; // Text nodes for attributes does not have a _parentNode. So we need to find them as attribute child. - if( container.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && container.childNodes && wysihtml5.lang.array(container.childNodes).indexOf( element ) !== -1) + if( container.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && container.childNodes && wysihtml.lang.array(container.childNodes).indexOf( element ) !== -1) return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - if( element.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && element.childNodes && wysihtml5.lang.array(element.childNodes).indexOf( container ) !== -1) + if( element.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && element.childNodes && wysihtml.lang.array(element.childNodes).indexOf( container ) !== -1) return 2 + 8; //Node.DOCUMENT_POSITION_PRECEDING + Node.DOCUMENT_POSITION_CONTAINS; var point = container; @@ -11190,11 +11200,11 @@ wysihtml5.dom.query = function(elements, query) { previous = null; while( point ) { if( point == container ) return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - var location_index = wysihtml5.lang.array(parents).indexOf( point ); + var location_index = wysihtml.lang.array(parents).indexOf( point ); if( location_index !== -1) { var smallest_common_ancestor = parents[ location_index ]; - var this_index = wysihtml5.lang.array(smallest_common_ancestor.childNodes).indexOf( parents[location_index - 1]);//smallest_common_ancestor.childNodes.toArray().indexOf( parents[location_index - 1] ); - var other_index = wysihtml5.lang.array(smallest_common_ancestor.childNodes).indexOf( previous ); //smallest_common_ancestor.childNodes.toArray().indexOf( previous ); + var this_index = wysihtml.lang.array(smallest_common_ancestor.childNodes).indexOf( parents[location_index - 1]);//smallest_common_ancestor.childNodes.toArray().indexOf( parents[location_index - 1] ); + var other_index = wysihtml.lang.array(smallest_common_ancestor.childNodes).indexOf( previous ); //smallest_common_ancestor.childNodes.toArray().indexOf( previous ); if( this_index > other_index ) { return 2; //Node.DOCUMENT_POSITION_PRECEDING; } @@ -11212,15 +11222,15 @@ wysihtml5.dom.query = function(elements, query) { ;/* Unwraps element and returns list of childNodes that the node contained. * * Example: - * var childnodes = wysihtml5.dom.unwrap(document.querySelector('.unwrap-me')); + * var childnodes = wysihtml.dom.unwrap(document.querySelector('.unwrap-me')); */ -wysihtml5.dom.unwrap = function(node) { +wysihtml.dom.unwrap = function(node) { var children = []; if (node.parentNode) { while (node.lastChild) { children.unshift(node.lastChild); - wysihtml5.dom.insert(node.lastChild).after(node); + wysihtml.dom.insert(node.lastChild).after(node); } node.parentNode.removeChild(node); } @@ -11234,20 +11244,20 @@ wysihtml5.dom.unwrap = function(node) { * Advantage is that it does not have to loose selection or modify dom to catch the data. * IE does not support though. **/ -wysihtml5.dom.getPastedHtml = function(event) { +wysihtml.dom.getPastedHtml = function(event) { var html; - if (wysihtml5.browser.supportsModernPaste() && event.clipboardData) { - if (wysihtml5.lang.array(event.clipboardData.types).contains('text/html')) { + if (wysihtml.browser.supportsModernPaste() && event.clipboardData) { + if (wysihtml.lang.array(event.clipboardData.types).contains('text/html')) { html = event.clipboardData.getData('text/html'); - } else if (wysihtml5.lang.array(event.clipboardData.types).contains('text/plain')) { - html = wysihtml5.lang.string(event.clipboardData.getData('text/plain')).escapeHTML(true, true); + } else if (wysihtml.lang.array(event.clipboardData.types).contains('text/plain')) { + html = wysihtml.lang.string(event.clipboardData.getData('text/plain')).escapeHTML(true, true); } } return html; }; /* Older temprorary contenteditable as paste source catcher method for fallbacks */ -wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) { +wysihtml.dom.getPastedHtmlWithDiv = function (composer, f) { var selBookmark = composer.selection.getBookmark(), doc = composer.element.ownerDocument, cleanerDiv = doc.createElement('DIV'), @@ -11277,10 +11287,10 @@ wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) { cleanerDiv.parentNode.removeChild(cleanerDiv); }, 0); }; -;wysihtml5.dom.removeInvisibleSpaces = function(node) { - var textNodes = wysihtml5.dom.getTextNodes(node); +;wysihtml.dom.removeInvisibleSpaces = function(node) { + var textNodes = wysihtml.dom.getTextNodes(node); for (var n = textNodes.length; n--;) { - textNodes[n].nodeValue = textNodes[n].nodeValue.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + textNodes[n].nodeValue = textNodes[n].nodeValue.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); } }; ;/** @@ -11289,17 +11299,17 @@ wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) { * * @author Christopher Blum */ -wysihtml5.quirks.cleanPastedHTML = (function() { +wysihtml.quirks.cleanPastedHTML = (function() { var styleToRegex = function (styleStr) { - var trimmedStr = wysihtml5.lang.string(styleStr).trim(), + var trimmedStr = wysihtml.lang.string(styleStr).trim(), escapedStr = trimmedStr.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); return new RegExp("^((?!^" + escapedStr + "$).)*$", "i"); }; var extendRulesWithStyleExceptions = function (rules, exceptStyles) { - var newRules = wysihtml5.lang.object(rules).clone(true), + var newRules = wysihtml.lang.object(rules).clone(true), tag, style; for (tag in newRules.tags) { @@ -11341,13 +11351,13 @@ wysihtml5.quirks.cleanPastedHTML = (function() { return function(html, options) { var exceptStyles = { - 'color': wysihtml5.dom.getStyle("color").from(options.referenceNode), - 'fontSize': wysihtml5.dom.getStyle("font-size").from(options.referenceNode) + 'color': wysihtml.dom.getStyle("color").from(options.referenceNode), + 'fontSize': wysihtml.dom.getStyle("font-size").from(options.referenceNode) }, rules = extendRulesWithStyleExceptions(pickRuleset(options.rules, html) || {}, exceptStyles), newHtml; - newHtml = wysihtml5.dom.parse(html, { + newHtml = wysihtml.dom.parse(html, { "rules": rules, "cleanUp": true, // elements, empty or without attributes, should be removed/replaced with their content "context": options.referenceNode.ownerDocument, @@ -11365,9 +11375,9 @@ wysihtml5.quirks.cleanPastedHTML = (function() { * * @param {Object} contentEditableElement The contentEditable element to observe for clearing events * @exaple - * wysihtml5.quirks.ensureProperClearing(myContentEditableElement); + * wysihtml.quirks.ensureProperClearing(myContentEditableElement); */ -wysihtml5.quirks.ensureProperClearing = (function() { +wysihtml.quirks.ensureProperClearing = (function() { var clearIfNecessary = function() { var element = this; setTimeout(function() { @@ -11380,7 +11390,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { }; return function(composer) { - wysihtml5.dom.observe(composer.element, ["cut", "keydown"], clearIfNecessary); + wysihtml.dom.observe(composer.element, ["cut", "keydown"], clearIfNecessary); }; })(); ;// See https://bugzilla.mozilla.org/show_bug.cgi?id=664398 @@ -11392,9 +11402,9 @@ wysihtml5.quirks.ensureProperClearing = (function() { // will result in: // // which is wrong -(function(wysihtml5) { +(function(wysihtml) { var TILDE_ESCAPED = "%7E"; - wysihtml5.quirks.getCorrectInnerHTML = function(element) { + wysihtml.quirks.getCorrectInnerHTML = function(element) { var innerHTML = element.innerHTML; if (innerHTML.indexOf(TILDE_ESCAPED) === -1) { return innerHTML; @@ -11407,26 +11417,26 @@ wysihtml5.quirks.ensureProperClearing = (function() { i; for (i=0, length=elementsWithTilde.length; i' + wysihtml5.INVISIBLE_SPACE + '', + placeholderHtml = '' + wysihtml.INVISIBLE_SPACE + '', range = this.getRange(true), caretPlaceholder, newCaretPlaceholder, @@ -12459,7 +12469,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { newRange.setStartBefore(nextSibling); newRange.setEndAfter(prevSibling); } else { - newCaretPlaceholder = this.doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + newCaretPlaceholder = this.doc.createTextNode(wysihtml.INVISIBLE_SPACE); dom.insert(newCaretPlaceholder).after(caretPlaceholder[0]); newRange.setStartBefore(newCaretPlaceholder); newRange.setEndAfter(newCaretPlaceholder); @@ -12573,7 +12583,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { // Empty elements are cleaned up from extracted content for (var i = childNodes.length; i --;) { - if (!wysihtml5.dom.domNode(childNodes[i]).is.visible()) { + if (!wysihtml.dom.domNode(childNodes[i]).is.visible()) { contentAfterRangeStart.removeChild(childNodes[i]); } } @@ -12597,8 +12607,8 @@ wysihtml5.quirks.ensureProperClearing = (function() { range.setEndAfter(element); } - if (!wysihtml5.dom.domNode(element).is.visible()) { - if (wysihtml5.dom.getTextContent(element) === '') { + if (!wysihtml.dom.domNode(element).is.visible()) { + if (wysihtml.dom.getTextContent(element) === '') { element.parentNode.removeChild(element); } else { element.parentNode.replaceChild(this.doc.createTextNode(" "), element); @@ -12657,7 +12667,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { tempElement = doc._wysihtml5ScrollIntoViewElement = doc._wysihtml5ScrollIntoViewElement || (function() { var element = doc.createElement("span"); // The element needs content in order to be able to calculate it's position properly - element.innerHTML = wysihtml5.INVISIBLE_SPACE; + element.innerHTML = wysihtml.INVISIBLE_SPACE; return element; })(), offsetTop; @@ -12677,7 +12687,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { */ selectLine: function() { var r = rangy.createRange(); - if (wysihtml5.browser.supportsSelectionModify()) { + if (wysihtml.browser.supportsSelectionModify()) { this._selectLine_W3C(); } else if (r.nativeRange && r.nativeRange.getBoundingClientRect) { // For IE Edge as it ditched the old api and did not fully implement the new one (as expected) @@ -12735,7 +12745,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { // collapses selection to current line beginning or end toLineBoundary: function (location, collapse) { collapse = (typeof collapse === 'undefined') ? false : collapse; - if (wysihtml5.browser.supportsSelectionModify()) { + if (wysihtml.browser.supportsSelectionModify()) { var selection = this.win.getSelection(); selection.modify("extend", location, "lineboundary"); @@ -12783,7 +12793,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { amount, testRect, found, that = this, isLineBreakingElement = function(el) { - return el && el.nodeType === 1 && (that.win.getComputedStyle(el).display === "block" || wysihtml5.lang.array(['BR', 'HR']).contains(el.nodeName)); + return el && el.nodeType === 1 && (that.win.getComputedStyle(el).display === "block" || wysihtml.lang.array(['BR', 'HR']).contains(el.nodeName)); }, prevNode = function(node) { var pnode = node; @@ -12819,7 +12829,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { } } if (!r.collapsed) { - r.insertNode(this.doc.createTextNode(wysihtml5.INVISIBLE_SPACE)); + r.insertNode(this.doc.createTextNode(wysihtml.INVISIBLE_SPACE)); } // Is probably just empty line as can not be expanded @@ -12948,7 +12958,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { var allUneditables = dom.query(this.contain, '.' + this.unselectableClass), deepUneditables = dom.query(allUneditables, '.' + this.unselectableClass); - return wysihtml5.lang.array(allUneditables).without(deepUneditables); + return wysihtml.lang.array(allUneditables).without(deepUneditables); }, // Returns an array of ranges that belong only to this editable @@ -13030,7 +13040,7 @@ wysihtml5.quirks.ensureProperClearing = (function() { return !s || (s.nativeSelection && s.nativeSelection.type && (s.nativeSelection.type === "Caret" || s.nativeSelection.type === "None")); } - wysihtml5.dom.removeInvisibleSpaces(this.composer.element); + wysihtml.dom.removeInvisibleSpaces(this.composer.element); doSelect(); if (this.composer.element.firstChild && notSelected()) { @@ -13078,39 +13088,39 @@ wysihtml5.quirks.ensureProperClearing = (function() { endNode = range.endContainer; - if (parentElement.nodeType === wysihtml5.TEXT_NODE) { + if (parentElement.nodeType === wysihtml.TEXT_NODE) { parentElement = parentElement.parentNode; } - if (startNode.nodeType === wysihtml5.TEXT_NODE && !(/^\s*$/).test(startNode.data.substr(range.startOffset))) { + if (startNode.nodeType === wysihtml.TEXT_NODE && !(/^\s*$/).test(startNode.data.substr(range.startOffset))) { return false; } - if (endNode.nodeType === wysihtml5.TEXT_NODE && !(/^\s*$/).test(endNode.data.substr(range.endOffset))) { + if (endNode.nodeType === wysihtml.TEXT_NODE && !(/^\s*$/).test(endNode.data.substr(range.endOffset))) { return false; } while (startNode && startNode !== parentElement) { - if (startNode.nodeType !== wysihtml5.TEXT_NODE && !wysihtml5.dom.contains(parentElement, startNode)) { + if (startNode.nodeType !== wysihtml.TEXT_NODE && !wysihtml.dom.contains(parentElement, startNode)) { return false; } - if (wysihtml5.dom.domNode(startNode).prev({ignoreBlankTexts: true})) { + if (wysihtml.dom.domNode(startNode).prev({ignoreBlankTexts: true})) { return false; } startNode = startNode.parentNode; } while (endNode && endNode !== parentElement) { - if (endNode.nodeType !== wysihtml5.TEXT_NODE && !wysihtml5.dom.contains(parentElement, endNode)) { + if (endNode.nodeType !== wysihtml.TEXT_NODE && !wysihtml.dom.contains(parentElement, endNode)) { return false; } - if (wysihtml5.dom.domNode(endNode).next({ignoreBlankTexts: true})) { + if (wysihtml.dom.domNode(endNode).next({ignoreBlankTexts: true})) { return false; } endNode = endNode.parentNode; } - return (wysihtml5.lang.array(nodeNames).contains(parentElement.nodeName)) ? parentElement : false; + return (wysihtml.lang.array(nodeNames).contains(parentElement.nodeName)) ? parentElement : false; }, isInThisEditable: function() { @@ -13128,8 +13138,8 @@ wysihtml5.quirks.ensureProperClearing = (function() { } return anode && fnode && - (wysihtml5.dom.contains(this.composer.element, fnode) || this.composer.element === fnode) && - (wysihtml5.dom.contains(this.composer.element, anode) || this.composer.element === anode); + (wysihtml.dom.contains(this.composer.element, fnode) || this.composer.element === fnode) && + (wysihtml.dom.contains(this.composer.element, anode) || this.composer.element === anode); }, deselect: function() { @@ -13138,659 +13148,15 @@ wysihtml5.quirks.ensureProperClearing = (function() { } }); -})(wysihtml5); -;/** - * Inspired by the rangy CSS Applier module written by Tim Down and licensed under the MIT license. - * http://code.google.com/p/rangy/ - * - * changed in order to be able ... - * - to use custom tags - * - to detect and replace similar css classes via reg exp - */ -(function(wysihtml5, rangy) { - var defaultTagName = "span"; - - var REG_EXP_WHITE_SPACE = /\s+/g; - - function hasClass(el, cssClass, regExp) { - if (!el.className) { - return false; - } - - var matchingClassNames = el.className.match(regExp) || []; - return matchingClassNames[matchingClassNames.length - 1] === cssClass; - } - - function hasStyleAttr(el, regExp) { - if (!el.getAttribute || !el.getAttribute('style')) { - return false; - } - var matchingStyles = el.getAttribute('style').match(regExp); - return (el.getAttribute('style').match(regExp)) ? true : false; - } - - function addStyle(el, cssStyle, regExp) { - if (el.getAttribute('style')) { - removeStyle(el, regExp); - if (el.getAttribute('style') && !(/^\s*$/).test(el.getAttribute('style'))) { - el.setAttribute('style', cssStyle + ";" + el.getAttribute('style')); - } else { - el.setAttribute('style', cssStyle); - } - } else { - el.setAttribute('style', cssStyle); - } - } - - function addClass(el, cssClass, regExp) { - if (el.className) { - removeClass(el, regExp); - el.className += " " + cssClass; - } else { - el.className = cssClass; - } - } - - function removeClass(el, regExp) { - if (el.className) { - el.className = el.className.replace(regExp, ""); - } - } - - function removeStyle(el, regExp) { - var s, - s2 = []; - if (el.getAttribute('style')) { - s = el.getAttribute('style').split(';'); - for (var i = s.length; i--;) { - if (!s[i].match(regExp) && !(/^\s*$/).test(s[i])) { - s2.push(s[i]); - } - } - if (s2.length) { - el.setAttribute('style', s2.join(';')); - } else { - el.removeAttribute('style'); - } - } - } - - function getMatchingStyleRegexp(el, style) { - var regexes = [], - sSplit = style.split(';'), - elStyle = el.getAttribute('style'); - - if (elStyle) { - elStyle = elStyle.replace(/\s/gi, '').toLowerCase(); - regexes.push(new RegExp("(^|\\s|;)" + style.replace(/\s/gi, '').replace(/([\(\)])/gi, "\\$1").toLowerCase().replace(";", ";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi, "\\s?rgb\\($1,\\s?$2,\\s?$3\\)"), "gi")); - - for (var i = sSplit.length; i-- > 0;) { - if (!(/^\s*$/).test(sSplit[i])) { - regexes.push(new RegExp("(^|\\s|;)" + sSplit[i].replace(/\s/gi, '').replace(/([\(\)])/gi, "\\$1").toLowerCase().replace(";", ";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi, "\\s?rgb\\($1,\\s?$2,\\s?$3\\)"), "gi")); - } - } - for (var j = 0, jmax = regexes.length; j < jmax; j++) { - if (elStyle.match(regexes[j])) { - return regexes[j]; - } - } - } - - return false; - } - - function isMatchingAllready(node, tags, style, className) { - if (style) { - return getMatchingStyleRegexp(node, style); - } else if (className) { - return wysihtml5.dom.hasClass(node, className); - } else { - return rangy.dom.arrayContains(tags, node.tagName.toLowerCase()); - } - } - - function areMatchingAllready(nodes, tags, style, className) { - for (var i = nodes.length; i--;) { - if (!isMatchingAllready(nodes[i], tags, style, className)) { - return false; - } - } - return nodes.length ? true : false; - } - - function removeOrChangeStyle(el, style, regExp) { - - var exactRegex = getMatchingStyleRegexp(el, style); - if (exactRegex) { - // adding same style value on property again removes style - removeStyle(el, exactRegex); - return "remove"; - } else { - // adding new style value changes value - addStyle(el, style, regExp); - return "change"; - } - } - - function hasSameClasses(el1, el2) { - return el1.className.replace(REG_EXP_WHITE_SPACE, " ") == el2.className.replace(REG_EXP_WHITE_SPACE, " "); - } - - function replaceWithOwnChildren(el) { - var parent = el.parentNode; - while (el.firstChild) { - parent.insertBefore(el.firstChild, el); - } - parent.removeChild(el); - } - - function elementsHaveSameNonClassAttributes(el1, el2) { - if (el1.attributes.length != el2.attributes.length) { - return false; - } - for (var i = 0, len = el1.attributes.length, attr1, attr2, name; i < len; ++i) { - attr1 = el1.attributes[i]; - name = attr1.name; - if (name != "class") { - attr2 = el2.attributes.getNamedItem(name); - if (attr1.specified != attr2.specified) { - return false; - } - if (attr1.specified && attr1.nodeValue !== attr2.nodeValue) { - return false; - } - } - } - return true; - } - - function isSplitPoint(node, offset) { - if (rangy.dom.isCharacterDataNode(node)) { - if (offset == 0) { - return !!node.previousSibling; - } else if (offset == node.length) { - return !!node.nextSibling; - } else { - return true; - } - } - - return offset > 0 && offset < node.childNodes.length; - } - - function splitNodeAt(node, descendantNode, descendantOffset, container) { - var newNode; - if (rangy.dom.isCharacterDataNode(descendantNode)) { - if (descendantOffset == 0) { - descendantOffset = rangy.dom.getNodeIndex(descendantNode); - descendantNode = descendantNode.parentNode; - } else if (descendantOffset == descendantNode.length) { - descendantOffset = rangy.dom.getNodeIndex(descendantNode) + 1; - descendantNode = descendantNode.parentNode; - } else { - newNode = rangy.dom.splitDataNode(descendantNode, descendantOffset); - } - } - if (!newNode) { - if (!container || descendantNode !== container) { - - newNode = descendantNode.cloneNode(false); - if (newNode.id) { - newNode.removeAttribute("id"); - } - var child; - while ((child = descendantNode.childNodes[descendantOffset])) { - newNode.appendChild(child); - } - rangy.dom.insertAfter(newNode, descendantNode); - - } - } - return (descendantNode == node) ? newNode : splitNodeAt(node, newNode.parentNode, rangy.dom.getNodeIndex(newNode), container); - } - - function Merge(firstNode) { - this.isElementMerge = (firstNode.nodeType == wysihtml5.ELEMENT_NODE); - this.firstTextNode = this.isElementMerge ? firstNode.lastChild : firstNode; - this.textNodes = [this.firstTextNode]; - } - - Merge.prototype = { - doMerge: function() { - var textBits = [], textNode, parent, text; - for (var i = 0, len = this.textNodes.length; i < len; ++i) { - textNode = this.textNodes[i]; - parent = textNode.parentNode; - textBits[i] = textNode.data; - if (i) { - parent.removeChild(textNode); - if (!parent.hasChildNodes()) { - parent.parentNode.removeChild(parent); - } - } - } - this.firstTextNode.data = text = textBits.join(""); - return text; - }, - - getLength: function() { - var i = this.textNodes.length, len = 0; - while (i--) { - len += this.textNodes[i].length; - } - return len; - }, - - toString: function() { - var textBits = []; - for (var i = 0, len = this.textNodes.length; i < len; ++i) { - textBits[i] = "'" + this.textNodes[i].data + "'"; - } - return "[Merge(" + textBits.join(",") + ")]"; - } - }; - - function HTMLApplier(tagNames, cssClass, similarClassRegExp, normalize, cssStyle, similarStyleRegExp, container) { - this.tagNames = tagNames || [defaultTagName]; - this.cssClass = cssClass || ((cssClass === false) ? false : ""); - this.similarClassRegExp = similarClassRegExp; - this.cssStyle = cssStyle || ""; - this.similarStyleRegExp = similarStyleRegExp; - this.normalize = normalize; - this.applyToAnyTagName = false; - this.container = container; - } - - HTMLApplier.prototype = { - getAncestorWithClass: function(node) { - var cssClassMatch; - while (node) { - cssClassMatch = this.cssClass ? hasClass(node, this.cssClass, this.similarClassRegExp) : (this.cssStyle !== "") ? false : true; - if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssClassMatch) { - return node; - } - node = node.parentNode; - } - return false; - }, - - // returns parents of node with given style attribute - getAncestorWithStyle: function(node) { - var cssStyleMatch; - while (node) { - cssStyleMatch = this.cssStyle ? hasStyleAttr(node, this.similarStyleRegExp) : false; - - if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssStyleMatch) { - return node; - } - node = node.parentNode; - } - return false; - }, - - getMatchingAncestor: function(node) { - var ancestor = this.getAncestorWithClass(node), - matchType = false; - - if (!ancestor) { - ancestor = this.getAncestorWithStyle(node); - if (ancestor) { - matchType = "style"; - } - } else { - if (this.cssStyle) { - matchType = "class"; - } - } - - return { - "element": ancestor, - "type": matchType - }; - }, - - // Normalizes nodes after applying a CSS class to a Range. - postApply: function(textNodes, range) { - var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1]; - - var merges = [], currentMerge; - - var rangeStartNode = firstNode, rangeEndNode = lastNode; - var rangeStartOffset = 0, rangeEndOffset = lastNode.length; - - var textNode, precedingTextNode; - - for (var i = 0, len = textNodes.length; i < len; ++i) { - textNode = textNodes[i]; - precedingTextNode = null; - if (textNode && textNode.parentNode) { - precedingTextNode = this.getAdjacentMergeableTextNode(textNode.parentNode, false); - } - if (precedingTextNode) { - if (!currentMerge) { - currentMerge = new Merge(precedingTextNode); - merges.push(currentMerge); - } - currentMerge.textNodes.push(textNode); - if (textNode === firstNode) { - rangeStartNode = currentMerge.firstTextNode; - rangeStartOffset = rangeStartNode.length; - } - if (textNode === lastNode) { - rangeEndNode = currentMerge.firstTextNode; - rangeEndOffset = currentMerge.getLength(); - } - } else { - currentMerge = null; - } - } - // Test whether the first node after the range needs merging - if(lastNode && lastNode.parentNode) { - var nextTextNode = this.getAdjacentMergeableTextNode(lastNode.parentNode, true); - if (nextTextNode) { - if (!currentMerge) { - currentMerge = new Merge(lastNode); - merges.push(currentMerge); - } - currentMerge.textNodes.push(nextTextNode); - } - } - // Do the merges - if (merges.length) { - for (i = 0, len = merges.length; i < len; ++i) { - merges[i].doMerge(); - } - // Set the range boundaries - range.setStart(rangeStartNode, rangeStartOffset); - range.setEnd(rangeEndNode, rangeEndOffset); - } - }, - - getAdjacentMergeableTextNode: function(node, forward) { - var isTextNode = (node.nodeType == wysihtml5.TEXT_NODE); - var el = isTextNode ? node.parentNode : node; - var adjacentNode; - var propName = forward ? "nextSibling" : "previousSibling"; - if (isTextNode) { - // Can merge if the node's previous/next sibling is a text node - adjacentNode = node[propName]; - if (adjacentNode && adjacentNode.nodeType == wysihtml5.TEXT_NODE) { - return adjacentNode; - } - } else { - // Compare element with its sibling - adjacentNode = el[propName]; - if (adjacentNode && this.areElementsMergeable(node, adjacentNode)) { - return adjacentNode[forward ? "firstChild" : "lastChild"]; - } - } - return null; - }, - - areElementsMergeable: function(el1, el2) { - return rangy.dom.arrayContains(this.tagNames, (el1.tagName || "").toLowerCase()) - && rangy.dom.arrayContains(this.tagNames, (el2.tagName || "").toLowerCase()) - && hasSameClasses(el1, el2) - && elementsHaveSameNonClassAttributes(el1, el2); - }, - - createContainer: function(doc) { - var el = doc.createElement(this.tagNames[0]); - if (this.cssClass) { - el.className = this.cssClass; - } - if (this.cssStyle) { - el.setAttribute('style', this.cssStyle); - } - return el; - }, - - applyToTextNode: function(textNode) { - var parent = textNode.parentNode; - if (parent.childNodes.length == 1 && rangy.dom.arrayContains(this.tagNames, parent.tagName.toLowerCase())) { - - if (this.cssClass) { - addClass(parent, this.cssClass, this.similarClassRegExp); - } - if (this.cssStyle) { - addStyle(parent, this.cssStyle, this.similarStyleRegExp); - } - } else { - var el = this.createContainer(rangy.dom.getDocument(textNode)); - textNode.parentNode.insertBefore(el, textNode); - el.appendChild(textNode); - } - }, - - isRemovable: function(el) { - return rangy.dom.arrayContains(this.tagNames, el.tagName.toLowerCase()) && - wysihtml5.lang.string(el.className).trim() === "" && - ( - !el.getAttribute('style') || - wysihtml5.lang.string(el.getAttribute('style')).trim() === "" - ); - }, - - undoToTextNode: function(textNode, range, ancestorWithClass, ancestorWithStyle) { - var styleMode = (ancestorWithClass) ? false : true, - ancestor = ancestorWithClass || ancestorWithStyle, - styleChanged = false; - if (!range.containsNode(ancestor)) { - // Split out the portion of the ancestor from which we can remove the CSS class - var ancestorRange = range.cloneRange(); - ancestorRange.selectNode(ancestor); - - if (ancestorRange.isPointInRange(range.endContainer, range.endOffset) && isSplitPoint(range.endContainer, range.endOffset)) { - splitNodeAt(ancestor, range.endContainer, range.endOffset, this.container); - range.setEndAfter(ancestor); - } - if (ancestorRange.isPointInRange(range.startContainer, range.startOffset) && isSplitPoint(range.startContainer, range.startOffset)) { - ancestor = splitNodeAt(ancestor, range.startContainer, range.startOffset, this.container); - } - } - - if (!styleMode && this.similarClassRegExp) { - removeClass(ancestor, this.similarClassRegExp); - } - - if (styleMode && this.similarStyleRegExp) { - styleChanged = (removeOrChangeStyle(ancestor, this.cssStyle, this.similarStyleRegExp) === "change"); - } - if (this.isRemovable(ancestor) && !styleChanged) { - replaceWithOwnChildren(ancestor); - } - }, - - applyToRange: function(range) { - var textNodes; - for (var ri = range.length; ri--;) { - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - - if (!textNodes.length) { - try { - var node = this.createContainer(range[ri].endContainer.ownerDocument); - range[ri].surroundContents(node); - this.selectNode(range[ri], node); - return; - } catch(e) {} - } - - range[ri].splitBoundaries(); - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (textNodes.length) { - var textNode; - - for (var i = 0, len = textNodes.length; i < len; ++i) { - textNode = textNodes[i]; - if (!this.getMatchingAncestor(textNode).element) { - this.applyToTextNode(textNode); - } - } - - range[ri].setStart(textNodes[0], 0); - textNode = textNodes[textNodes.length - 1]; - range[ri].setEnd(textNode, textNode.length); - - if (this.normalize) { - this.postApply(textNodes, range[ri]); - } - } - - } - }, - - undoToRange: function(range) { - var textNodes, textNode, ancestorWithClass, ancestorWithStyle, ancestor; - for (var ri = range.length; ri--;) { - - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (textNodes.length) { - range[ri].splitBoundaries(); - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - } else { - var doc = range[ri].endContainer.ownerDocument, - node = doc.createTextNode(wysihtml5.INVISIBLE_SPACE); - range[ri].insertNode(node); - range[ri].selectNode(node); - textNodes = [node]; - } - - for (var i = 0, len = textNodes.length; i < len; ++i) { - if (range[ri].isValid()) { - textNode = textNodes[i]; - - ancestor = this.getMatchingAncestor(textNode); - if (ancestor.type === "style") { - this.undoToTextNode(textNode, range[ri], false, ancestor.element); - } else if (ancestor.element) { - this.undoToTextNode(textNode, range[ri], ancestor.element); - } - } - } - - if (len == 1) { - this.selectNode(range[ri], textNodes[0]); - } else { - range[ri].setStart(textNodes[0], 0); - textNode = textNodes[textNodes.length - 1]; - range[ri].setEnd(textNode, textNode.length); - - if (this.normalize) { - this.postApply(textNodes, range[ri]); - } - } - - } - }, - - selectNode: function(range, node) { - var isElement = node.nodeType === wysihtml5.ELEMENT_NODE, - canHaveHTML = "canHaveHTML" in node ? node.canHaveHTML : true, - content = isElement ? node.innerHTML : node.data, - isEmpty = (content === "" || content === wysihtml5.INVISIBLE_SPACE); - - if (isEmpty && isElement && canHaveHTML) { - // Make sure that caret is visible in node by inserting a zero width no breaking space - try { node.innerHTML = wysihtml5.INVISIBLE_SPACE; } catch(e) {} - } - range.selectNodeContents(node); - if (isEmpty && isElement) { - range.collapse(false); - } else if (isEmpty) { - range.setStartAfter(node); - range.setEndAfter(node); - } - }, - - getTextSelectedByRange: function(textNode, range) { - var textRange = range.cloneRange(); - textRange.selectNodeContents(textNode); - - var intersectionRange = textRange.intersection(range); - var text = intersectionRange ? intersectionRange.toString() : ""; - textRange.detach(); - - return text; - }, - - isAppliedToRange: function(range) { - var ancestors = [], - appliedType = "full", - ancestor, styleAncestor, textNodes; - - for (var ri = range.length; ri--;) { - - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (!textNodes.length) { - ancestor = this.getMatchingAncestor(range[ri].startContainer).element; - - return (ancestor) ? { - "elements": [ancestor], - "coverage": appliedType - } : false; - } - - for (var i = 0, len = textNodes.length, selectedText; i < len; ++i) { - selectedText = this.getTextSelectedByRange(textNodes[i], range[ri]); - ancestor = this.getMatchingAncestor(textNodes[i]).element; - if (ancestor && selectedText != "") { - ancestors.push(ancestor); - - if (wysihtml5.dom.getTextNodes(ancestor, true).length === 1) { - appliedType = "full"; - } else if (appliedType === "full") { - appliedType = "inline"; - } - } else if (!ancestor) { - appliedType = "partial"; - } - } - - } - - return (ancestors.length) ? { - "elements": ancestors, - "coverage": appliedType - } : false; - }, - - toggleRange: function(range) { - var isApplied = this.isAppliedToRange(range), - parentsExactMatch; - - if (isApplied) { - if (isApplied.coverage === "full") { - this.undoToRange(range); - } else if (isApplied.coverage === "inline") { - parentsExactMatch = areMatchingAllready(isApplied.elements, this.tagNames, this.cssStyle, this.cssClass); - this.undoToRange(range); - if (!parentsExactMatch) { - this.applyToRange(range); - } - } else { - // partial - if (!areMatchingAllready(isApplied.elements, this.tagNames, this.cssStyle, this.cssClass)) { - this.undoToRange(range); - } - this.applyToRange(range); - } - } else { - this.applyToRange(range); - } - } - }; - - wysihtml5.selection.HTMLApplier = HTMLApplier; - -})(wysihtml5, rangy); +})(wysihtml); ;/** * Rich Text Query/Formatting Commands * * @example - * var commands = new wysihtml5.Commands(editor); + * var commands = new wysihtml.Commands(editor); */ -wysihtml5.Commands = Base.extend( - /** @scope wysihtml5.Commands.prototype */ { +wysihtml.Commands = Base.extend( + /** @scope wysihtml.Commands.prototype */ { constructor: function(editor) { this.editor = editor; this.composer = editor.composer; @@ -13805,7 +13171,7 @@ wysihtml5.Commands = Base.extend( * commands.supports("createLink"); */ support: function(command) { - return wysihtml5.browser.supportsCommand(this.doc, command); + return wysihtml.browser.supportsCommand(this.doc, command); }, /** @@ -13817,14 +13183,14 @@ wysihtml5.Commands = Base.extend( * commands.exec("insertImage", "http://a1.twimg.com/profile_images/113868655/schrei_twitter_reasonably_small.jpg"); */ exec: function(command, value) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), method = obj && obj.exec, result = null; // If composer ahs placeholder unset it before command // Do not apply on commands that are behavioral - if (this.composer.hasPlaceholderSet() && !wysihtml5.lang.array(['styleWithCSS', 'enableObjectResizing', 'enableInlineTableEditing']).contains(command)) { + if (this.composer.hasPlaceholderSet() && !wysihtml.lang.array(['styleWithCSS', 'enableObjectResizing', 'enableInlineTableEditing']).contains(command)) { this.composer.element.innerHTML = ""; this.composer.selection.selectNode(this.composer.element); } @@ -13846,8 +13212,8 @@ wysihtml5.Commands = Base.extend( }, remove: function(command, commandValue) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), method = obj && obj.remove; if (method) { args.unshift(this.composer); @@ -13866,8 +13232,8 @@ wysihtml5.Commands = Base.extend( * var isCurrentSelectionBold = commands.state("bold"); */ state: function(command, commandValue) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), method = obj && obj.state; if (method) { args.unshift(this.composer); @@ -13884,8 +13250,8 @@ wysihtml5.Commands = Base.extend( /* Get command state parsed value if command has stateValue parsing function */ stateValue: function(command) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), method = obj && obj.stateValue; if (method) { args.unshift(this.composer); @@ -13895,25 +13261,7 @@ wysihtml5.Commands = Base.extend( } } }); -;(function(wysihtml5) { - - var nodeOptions = { - nodeName: "B", - toggle: true - }; - - wysihtml5.commands.bold = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); -;(function(wysihtml5) { +;(function(wysihtml) { var nodeOptions = { nodeName: "A", @@ -13922,10 +13270,10 @@ wysihtml5.Commands = Base.extend( function getOptions(value) { var options = typeof value === 'object' ? value : {'href': value}; - return wysihtml5.lang.object({}).merge(nodeOptions).merge({'attribute': value}).get(); + return wysihtml.lang.object({}).merge(nodeOptions).merge({'attribute': value}).get(); } - wysihtml5.commands.createLink = { + wysihtml.commands.createLink = { exec: function(composer, command, value) { var opts = getOptions(value); @@ -13934,219 +13282,40 @@ wysihtml5.Commands = Base.extend( composer.selection.insertNode(textNode); composer.selection.selectNode(textNode); } - wysihtml5.commands.formatInline.exec(composer, command, opts); + wysihtml.commands.formatInline.exec(composer, command, opts); }, state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); } }; -})(wysihtml5); -;(function(wysihtml5) { +})(wysihtml); +;(function(wysihtml) { var nodeOptions = { nodeName: "A" }; - wysihtml5.commands.removeLink = { + wysihtml.commands.removeLink = { exec: function(composer, command) { - wysihtml5.commands.formatInline.remove(composer, command, nodeOptions); + wysihtml.commands.formatInline.remove(composer, command, nodeOptions); }, state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -})(wysihtml5); -;/** - * Set font size css class - */ -(function(wysihtml5) { - var REG_EXP = /wysiwyg-font-size-[0-9a-z\-]+/g; - - wysihtml5.commands.fontSize = { - exec: function(composer, command, size) { - wysihtml5.commands.formatInline.exec(composer, command, {className: "wysiwyg-font-size-" + size, classRegExp: REG_EXP, toggle: true}); - }, - - state: function(composer, command, size) { - return wysihtml5.commands.formatInline.state(composer, command, {className: "wysiwyg-font-size-" + size}); - } - }; -})(wysihtml5); -;/** - * Set font size by inline style - */ -(function(wysihtml5) { - - wysihtml5.commands.fontSizeStyle = { - exec: function(composer, command, size) { - size = size.size || size; - if (!(/^\s*$/).test(size)) { - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: "fontSize", styleValue: size, toggle: false}); - } - }, - - state: function(composer, command, size) { - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: "fontSize", styleValue: size || undefined}); - }, - - remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: "fontSize"}); - }, - - stateValue: function(composer, command) { - var styleStr, - st = this.state(composer, command); - - if (st && wysihtml5.lang.object(st).isArray()) { - st = st[0]; - } - if (st) { - styleStr = st.getAttribute("style"); - if (styleStr) { - return wysihtml5.quirks.styleParser.parseFontSize(styleStr); - } - } - return false; - } - }; -})(wysihtml5); -;/** - * Set color css class - */ -(function(wysihtml5) { - var REG_EXP = /wysiwyg-color-[0-9a-z]+/g; - - wysihtml5.commands.foreColor = { - exec: function(composer, command, color) { - wysihtml5.commands.formatInline.exec(composer, command, {className: "wysiwyg-color-" + color, classRegExp: REG_EXP, toggle: true}); - }, - - state: function(composer, command, color) { - return wysihtml5.commands.formatInline.state(composer, command, {className: "wysiwyg-color-" + color}); + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); } }; -})(wysihtml5); -;/** - * Sets text color by inline styles - */ -(function(wysihtml5) { - - wysihtml5.commands.foreColorStyle = { - exec: function(composer, command, color) { - var colorVals, colString; - - if (!color) { return; } - - colorVals = wysihtml5.quirks.styleParser.parseColor("color:" + (color.color || color), "color"); - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')'; - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: "color", styleValue: colString}); - } - }, - - state: function(composer, command, color) { - var colorVals = color ? wysihtml5.quirks.styleParser.parseColor("color:" + (color.color || color), "color") : null, - colString; - - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')'; - } - - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: "color", styleValue: colString}); - }, - - remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: "color"}); - }, - - stateValue: function(composer, command, props) { - var st = this.state(composer, command), - colorStr, - val = false; - - if (st && wysihtml5.lang.object(st).isArray()) { - st = st[0]; - } - - if (st) { - colorStr = st.getAttribute("style"); - if (colorStr) { - val = wysihtml5.quirks.styleParser.parseColor(colorStr, "color"); - return wysihtml5.quirks.styleParser.unparseColor(val, props); - } - } - return false; - } - - }; -})(wysihtml5); -;/** - * Sets text background color by inline styles - */ -(function(wysihtml5) { - - wysihtml5.commands.bgColorStyle = { - exec: function(composer, command, color) { - var colorVals = wysihtml5.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color"), - colString; - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); - } - }, - - state: function(composer, command, color) { - var colorVals = color ? wysihtml5.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color") : null, - colString; - - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; - } - - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); - }, - - remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: 'backgroundColor'}); - }, - - stateValue: function(composer, command, props) { - var st = this.state(composer, command), - colorStr, - val = false; - - if (st && wysihtml5.lang.object(st).isArray()) { - st = st[0]; - } - if (st) { - colorStr = st.getAttribute('style'); - if (colorStr) { - val = wysihtml5.quirks.styleParser.parseColor(colorStr, "background-color"); - return wysihtml5.quirks.styleParser.unparseColor(val, props); - } - } - return false; - } - - }; -})(wysihtml5); +})(wysihtml); ;/* Formatblock * Is used to insert block level elements * It tries to solve the case that some block elements should not contain other block level elements (h1-6, p, ...) * */ -(function(wysihtml5) { +(function(wysihtml) { - var dom = wysihtml5.dom, + var dom = wysihtml.dom, // When the caret is within a H1 and the H4 is invoked, the H1 should turn into H4 // instead of creating a H4 within a H1 which would result in semantically invalid html UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre", @@ -14192,18 +13361,18 @@ wysihtml5.Commands = Base.extend( // Removes empty block level elements function cleanup(composer, newBlockElements) { - wysihtml5.dom.removeInvisibleSpaces(composer.element); + wysihtml.dom.removeInvisibleSpaces(composer.element); var container = composer.element, allElements = container.querySelectorAll(BLOCK_ELEMENTS), noEditQuery = composer.config.classNames.uneditableContainer + ([""]).concat(BLOCK_ELEMENTS.split(',')).join(", " + composer.config.classNames.uneditableContainer + ' '), uneditables = container.querySelectorAll(noEditQuery), - elements = wysihtml5.lang.array(allElements).without(uneditables), // Lets not touch uneditable elements and their contents + elements = wysihtml.lang.array(allElements).without(uneditables), // Lets not touch uneditable elements and their contents nbIdx; for (var i = elements.length; i--;) { if (elements[i].innerHTML.replace(/[\uFEFF]/g, '') === "" && (newBlockElements.length === 0 || elements[i] !== newBlockElements[newBlockElements.length - 1])) { // If cleanup removes some new block elements. remove them from newblocks array too - nbIdx = wysihtml5.lang.array(newBlockElements).indexOf(elements[i]); + nbIdx = wysihtml.lang.array(newBlockElements).indexOf(elements[i]); if (nbIdx > -1) { newBlockElements.splice(nbIdx, 1); } @@ -14272,7 +13441,7 @@ wysihtml5.Commands = Base.extend( if (!element) { element = composer.doc.createElement(options.nodeName || defaultNodeName(composer)); // Add invisible space as otherwise webkit cannot set selection or range to it correctly - element.appendChild(composer.doc.createTextNode(wysihtml5.INVISIBLE_SPACE)); + element.appendChild(composer.doc.createTextNode(wysihtml.INVISIBLE_SPACE)); } if (options.nodeName && element.nodeName !== options.nodeName) { @@ -14288,7 +13457,7 @@ wysihtml5.Commands = Base.extend( } if (options.styleProperty && typeof options.styleValue !== "undefined") { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } return element; @@ -14303,7 +13472,7 @@ wysihtml5.Commands = Base.extend( unwrapped = false; if (options.styleProperty) { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = ''; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = ''; } if (options.className) { element.classList.remove(options.className); @@ -14345,8 +13514,8 @@ wysihtml5.Commands = Base.extend( nextEl, prevEl; for (var i = blocks.length; i--;) { - nextEl = wysihtml5.dom.domNode(blocks[i]).next({nodeTypes: [1,3], ignoreBlankTexts: true}), - prevEl = wysihtml5.dom.domNode(blocks[i]).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + nextEl = wysihtml.dom.domNode(blocks[i]).next({nodeTypes: [1,3], ignoreBlankTexts: true}), + prevEl = wysihtml.dom.domNode(blocks[i]).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (nextEl && nextEl.nodeType !== 1 && nextEl.nodeName !== 'BR') { if ((blocks[i].innerHTML || blocks[i].nodeValue || '').trim() !== '') { @@ -14358,7 +13527,7 @@ wysihtml5.Commands = Base.extend( blocks[i].parentNode.insertBefore(blocks[i].ownerDocument.createElement('BR'), nextEl); } } - wysihtml5.dom.unwrap(blocks[i]); + wysihtml.dom.unwrap(blocks[i]); } } @@ -14450,7 +13619,7 @@ wysihtml5.Commands = Base.extend( // Range starts before and ends inside the node tmpRange = ranges[i].cloneRange(); - closestLI = wysihtml5.dom.domNode(lis[j]).prev({nodeTypes: [1]}); + closestLI = wysihtml.dom.domNode(lis[j]).prev({nodeTypes: [1]}); if (closestLI) { tmpRange.setEnd(closestLI, closestLI.childNodes.length); @@ -14472,7 +13641,7 @@ wysihtml5.Commands = Base.extend( newRanges.push(tmpRange); // Find next LI in list and if present set range to it, else - closestLI = wysihtml5.dom.domNode(lis[j]).next({nodeTypes: [1]}); + closestLI = wysihtml.dom.domNode(lis[j]).next({nodeTypes: [1]}); if (closestLI) { ranges[i].setStart(closestLI, 0); } else if (lis[j].closest('ul, ol')) { @@ -14493,7 +13662,7 @@ wysihtml5.Commands = Base.extend( // Return options object with nodeName set if original did not have any // Node name is set to local or global default function getOptionsWithNodename(options, defaultName, composer) { - var correctedOptions = (options) ? wysihtml5.lang.object(options).clone(true) : null; + var correctedOptions = (options) ? wysihtml.lang.object(options).clone(true) : null; if (correctedOptions) { correctedOptions.nodeName = correctedOptions.nodeName || defaultName || defaultNodeName(composer); } @@ -14515,8 +13684,8 @@ wysihtml5.Commands = Base.extend( composer.selection.splitElementAtCaret(firstOuterBlock, fragment); - next = wysihtml5.dom.domNode(last).next({nodeTypes: [1,3], ignoreBlankTexts: true}); - prev = wysihtml5.dom.domNode(first).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + next = wysihtml.dom.domNode(last).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + prev = wysihtml.dom.domNode(first).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (first && !isLineBreaking(first, composer) && prev && !isLineBreaking(prev, composer)) { first.parentNode.insertBefore(composer.doc.createElement('br'), first); @@ -14566,7 +13735,7 @@ wysihtml5.Commands = Base.extend( // Split block formating and add new block to wrap caret unwrapBlocksFromContent(content.firstChild); - children = wysihtml5.dom.unwrap(content.firstChild); + children = wysihtml.dom.unwrap(content.firstChild); // Add line break before if needed if (children.length > 0) { @@ -14597,14 +13766,14 @@ wysihtml5.Commands = Base.extend( first = false; } - blocks = wysihtml5.lang.array(fragment.childNodes).get(); + blocks = wysihtml.lang.array(fragment.childNodes).get(); injectFragmentToRange(fragment, r, composer); return blocks; } // When block node is inserted, look surrounding nodes and remove surplous linebreak tags (as block format breaks line itself) function removeSurroundingLineBreaks(prevNode, nextNode, composer) { - var prevPrev = prevNode && wysihtml5.dom.domNode(prevNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + var prevPrev = prevNode && wysihtml.dom.domNode(prevNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (isBr(nextNode)) { nextNode.parentNode.removeChild(nextNode); } @@ -14672,7 +13841,7 @@ wysihtml5.Commands = Base.extend( rangeStartContainer = r.startContainer, startNode = getRangeNode(r.startContainer, r.startOffset), endNode = getRangeNode(r.endContainer, r.endOffset), - prevNode = (r.startContainer === startNode && startNode.nodeType === 3 && !isWhitespaceBefore(startNode, r.startOffset)) ? startNode : wysihtml5.dom.domNode(startNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}), + prevNode = (r.startContainer === startNode && startNode.nodeType === 3 && !isWhitespaceBefore(startNode, r.startOffset)) ? startNode : wysihtml.dom.domNode(startNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}), nextNode = ( ( r.endContainer.nodeType === 1 && @@ -14680,23 +13849,23 @@ wysihtml5.Commands = Base.extend( ( endNode.nodeType === 1 || !isWhitespaceAfter(endNode, r.endOffset) && - !wysihtml5.dom.domNode(endNode).is.rangyBookmark() + !wysihtml.dom.domNode(endNode).is.rangyBookmark() ) ) || ( r.endContainer === endNode && endNode.nodeType === 3 && !isWhitespaceAfter(endNode, r.endOffset) ) - ) ? endNode : wysihtml5.dom.domNode(endNode).next({nodeTypes: [1,3], ignoreBlankTexts: true}), + ) ? endNode : wysihtml.dom.domNode(endNode).next({nodeTypes: [1,3], ignoreBlankTexts: true}), content = r.extractContents(), fragment = composer.doc.createDocumentFragment(), - similarOuterBlock = similarOptions ? wysihtml5.dom.getParentElement(rangeStartContainer, similarOptions, null, composer.element) : null, + similarOuterBlock = similarOptions ? wysihtml.dom.getParentElement(rangeStartContainer, similarOptions, null, composer.element) : null, splitAllBlocks = !closestBlockName || !options || (options.nodeName === "BLOCKQUOTE" && closestBlockName === "BLOCKQUOTE"), firstOuterBlock = similarOuterBlock || findOuterBlock(rangeStartContainer, composer.element, splitAllBlocks), // The outermost un-nestable block element parent of selection start wrapper, blocks, children, firstc, lastC; - if (wysihtml5.dom.domNode(nextNode).is.rangyBookmark()) { + if (wysihtml.dom.domNode(nextNode).is.rangyBookmark()) { endNode = nextNode; nextNode = endNode.nextSibling; } @@ -14746,7 +13915,7 @@ wysihtml5.Commands = Base.extend( } } - blocks = wysihtml5.lang.array(fragment.childNodes).get(); + blocks = wysihtml.lang.array(fragment.childNodes).get(); } injectFragmentToRange(fragment, r, composer, firstOuterBlock); removeSurroundingLineBreaks(prevNode, nextNode, composer); @@ -14755,7 +13924,7 @@ wysihtml5.Commands = Base.extend( // (if it contains rangy bookmark, so selection can be restored later correctly) if (blocks.length > 0 && ( - typeof blocks[blocks.length - 1].lastChild === "undefined" || wysihtml5.dom.domNode(blocks[blocks.length - 1].lastChild).is.rangyBookmark() + typeof blocks[blocks.length - 1].lastChild === "undefined" || wysihtml.dom.domNode(blocks[blocks.length - 1].lastChild).is.rangyBookmark() ) ) { blocks[blocks.length - 1].appendChild(composer.doc.createElement('br')); @@ -14765,7 +13934,7 @@ wysihtml5.Commands = Base.extend( // Find closest block level element function getParentBlockNodeName(element, composer) { - var parentNode = wysihtml5.dom.getParentElement(element, { + var parentNode = wysihtml.dom.getParentElement(element, { query: BLOCK_ELEMENTS }, null, composer.element); @@ -14780,7 +13949,7 @@ wysihtml5.Commands = Base.extend( // // If nothing found selects the current line function expandCaretToBlock(composer, insertingNodeName) { - var parent = wysihtml5.dom.getParentElement(composer.selection.getOwnRanges()[0].startContainer, { + var parent = wysihtml.dom.getParentElement(composer.selection.getOwnRanges()[0].startContainer, { query: UNNESTABLE_BLOCK_ELEMENTS + ', ' + (insertingNodeName ? insertingNodeName.toLowerCase() : 'div'), }, null, composer.element), range; @@ -14846,13 +14015,13 @@ wysihtml5.Commands = Base.extend( if (caretInfo && caretInfo.caretNode) { if ( // caret is allready breaknode - wysihtml5.dom.domNode(caretInfo.caretNode).is.lineBreak() || + wysihtml.dom.domNode(caretInfo.caretNode).is.lineBreak() || // caret is textnode - (caretInfo.caretNode.nodeType === 3 && caretInfo.textOffset === 0 && (!caretInfo.prevNode || wysihtml5.dom.domNode(caretInfo.prevNode).is.lineBreak())) || + (caretInfo.caretNode.nodeType === 3 && caretInfo.textOffset === 0 && (!caretInfo.prevNode || wysihtml.dom.domNode(caretInfo.prevNode).is.lineBreak())) || // Caret is temprorary rangy selection marker (caretInfo.caretNode.nodeType === 1 && caretInfo.caretNode.classList.contains('rangySelectionBoundary') && - (!caretInfo.prevNode || wysihtml5.dom.domNode(caretInfo.prevNode).is.lineBreak() || wysihtml5.dom.domNode(caretInfo.prevNode).is.block()) && - (!caretInfo.nextNode || wysihtml5.dom.domNode(caretInfo.nextNode).is.lineBreak() || wysihtml5.dom.domNode(caretInfo.nextNode).is.block()) + (!caretInfo.prevNode || wysihtml.dom.domNode(caretInfo.prevNode).is.lineBreak() || wysihtml.dom.domNode(caretInfo.prevNode).is.block()) && + (!caretInfo.nextNode || wysihtml.dom.domNode(caretInfo.nextNode).is.lineBreak() || wysihtml.dom.domNode(caretInfo.nextNode).is.block()) ) ) { return true; @@ -14862,7 +14031,7 @@ wysihtml5.Commands = Base.extend( return false; } - wysihtml5.commands.formatBlock = { + wysihtml.commands.formatBlock = { exec: function(composer, command, options) { options = parseOptions(options); var newBlockElements = [], @@ -14938,7 +14107,7 @@ wysihtml5.Commands = Base.extend( options = parseOptions(options); var nodes = composer.selection.filterElements((function (element) { // Finds matching elements inside selection - return wysihtml5.dom.domNode(element).test(options || { query: BLOCK_ELEMENTS }); + return wysihtml.dom.domNode(element).test(options || { query: BLOCK_ELEMENTS }); }).bind(this)), parentNodes = composer.selection.getSelectedOwnNodes(), parent; @@ -14955,67 +14124,13 @@ wysihtml5.Commands = Base.extend( } }; -})(wysihtml5); -;/* Formats block for as a
    block - * Useful in conjuction for sytax highlight utility: highlight.js - * - * Usage: - * - * editorInstance.composer.commands.exec("formatCode", "language-html"); -*/ - -(function(wysihtml5){ - wysihtml5.commands.formatCode = { - - exec: function(composer, command, classname) { - var pre = this.state(composer)[0], - code, range, selectedNodes; - - if (pre) { - // caret is already within a
    ...
    - composer.selection.executeAndRestore(function() { - code = pre.querySelector("code"); - wysihtml5.dom.replaceWithChildNodes(pre); - if (code) { - wysihtml5.dom.replaceWithChildNodes(code); - } - }); - } else { - // Wrap in
    ...
    - range = composer.selection.getRange(); - selectedNodes = range.extractContents(); - pre = composer.doc.createElement("pre"); - code = composer.doc.createElement("code"); - - if (classname) { - code.className = classname; - } - - pre.appendChild(code); - code.appendChild(selectedNodes); - range.insertNode(pre); - composer.selection.selectNode(pre); - } - }, - - state: function(composer) { - var selectedNode = composer.selection.getSelectedNode(), node; - if (selectedNode && selectedNode.nodeName && selectedNode.nodeName == "PRE"&& - selectedNode.firstChild && selectedNode.firstChild.nodeName && selectedNode.firstChild.nodeName == "CODE") { - return [selectedNode]; - } else { - node = wysihtml5.dom.getParentElement(selectedNode, { query: "pre code" }); - return node ? [node.parentNode] : false; - } - } - }; -}(wysihtml5)); +})(wysihtml); ;/** * Unifies all inline tags additions and removals * See https://github.com/Voog/wysihtml/pull/169 for specification of action */ -(function(wysihtml5) { +(function(wysihtml) { var defaultTag = "SPAN", INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u", @@ -15037,8 +14152,8 @@ wysihtml5.Commands = Base.extend( // Associative arrays in javascript are really objects and do not have length defined // Thus have to check emptyness in a different way function hasNoAttributes(element) { - var attr = wysihtml5.dom.getAttributes(element); - return wysihtml5.lang.object(attr).isEmpty(); + var attr = wysihtml.dom.getAttributes(element); + return wysihtml.lang.object(attr).isEmpty(); } // compares two nodes if they are semantically the same @@ -15057,14 +14172,14 @@ wysihtml5.Commands = Base.extend( classes1 = element1.className.trim().replace(/\s+/g, ' ').split(' '); classes2 = element2.className.trim().replace(/\s+/g, ' ').split(' '); - if (wysihtml5.lang.array(classes1).without(classes2).length > 0) { + if (wysihtml.lang.array(classes1).without(classes2).length > 0) { return false; } - attr1 = wysihtml5.dom.getAttributes(element1); - attr2 = wysihtml5.dom.getAttributes(element2); + attr1 = wysihtml.dom.getAttributes(element1); + attr2 = wysihtml.dom.getAttributes(element2); - if (attr1.length !== attr2.length || !wysihtml5.lang.object(wysihtml5.lang.object(attr1).difference(attr2)).isEmpty()) { + if (attr1.length !== attr2.length || !wysihtml.lang.object(wysihtml.lang.object(attr1).difference(attr2)).isEmpty()) { return false; } @@ -15085,7 +14200,7 @@ wysihtml5.Commands = Base.extend( } if (options.styleProperty && typeof options.styleValue !== "undefined") { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } if (options.attribute) { @@ -15119,9 +14234,9 @@ wysihtml5.Commands = Base.extend( // If attrbutes and values are the same > remove // if attributes or values function updateElementAttributes(element, newAttributes, toggle) { - var attr = wysihtml5.dom.getAttributes(element), + var attr = wysihtml.dom.getAttributes(element), fullContain = containsSameAttributes(newAttributes, attr), - attrDifference = wysihtml5.lang.object(attr).difference(newAttributes), + attrDifference = wysihtml.lang.object(attr).difference(newAttributes), a, b; if (fullContain && toggle !== false) { @@ -15132,7 +14247,7 @@ wysihtml5.Commands = Base.extend( } } else { - /*if (!wysihtml5.lang.object(attrDifference).isEmpty()) { + /*if (!wysihtml.lang.object(attrDifference).isEmpty()) { for (b in attrDifference) { if (attrDifference.hasOwnProperty(b)) { element.removeAttribute(b); @@ -15167,10 +14282,10 @@ wysihtml5.Commands = Base.extend( // change/remove style if (options.styleProperty) { - if (options.toggle !== false && element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)].trim().replace(/, /g, ",") === options.styleValue) { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = ''; + if (options.toggle !== false && element.style[wysihtml.browser.fixStyleKey(options.styleProperty)].trim().replace(/, /g, ",") === options.styleValue) { + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = ''; } else { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } } if (hasNoStyle(element)) { @@ -15190,7 +14305,7 @@ wysihtml5.Commands = Base.extend( // Handle similar semantically same elements (queryAliasMap) nodeNameQuery = options.nodeName ? queryAliasMap[options.nodeName.toLowerCase()] || options.nodeName.toLowerCase() : null; - nodeQueryMatch = nodeNameQuery ? wysihtml5.dom.domNode(element).test({ query: nodeNameQuery }) : false; + nodeQueryMatch = nodeNameQuery ? wysihtml.dom.domNode(element).test({ query: nodeNameQuery }) : false; // Unwrap element if no attributes present and node name given // or no attributes and if no nodename set but node is the default @@ -15199,7 +14314,7 @@ wysihtml5.Commands = Base.extend( ((options.toggle !== false && nodeQueryMatch) || (!options.nodeName && element.nodeName === defaultTag)) && hasNoClass(element) && hasNoStyle(element) && hasNoAttributes(element) ) { - wysihtml5.dom.unwrap(element); + wysihtml.dom.unwrap(element); } } @@ -15213,7 +14328,7 @@ wysihtml5.Commands = Base.extend( if (!selection.isCollapsed()) { textNodes = textNodes.concat(selection.getOwnNodes([3], function(node) { // Exclude empty nodes except caret node - return (!wysihtml5.dom.domNode(node).is.emptyTextNode()); + return (!wysihtml.dom.domNode(node).is.emptyTextNode()); }, splitBounds)); } @@ -15249,11 +14364,11 @@ wysihtml5.Commands = Base.extend( var o; if (options.nodeName) { var query = queryAliasMap[options.nodeName.toLowerCase()] || options.nodeName.toLowerCase(); - return wysihtml5.dom.domNode(node).test({ query: query }); + return wysihtml.dom.domNode(node).test({ query: query }); } else { - o = wysihtml5.lang.object(options).clone(); + o = wysihtml.lang.object(options).clone(); o.query = INLINE_ELEMENTS; // make sure only inline elements with styles and classes are counted - return wysihtml5.dom.domNode(node).test(o); + return wysihtml.dom.domNode(node).test(o); } } @@ -15269,7 +14384,7 @@ wysihtml5.Commands = Base.extend( try { rangy.getSelection(composer.win).addRange(range); } catch (e) {} - if (!composer.doc.activeElement || !wysihtml5.dom.contains(composer.element, composer.doc.activeElement)) { + if (!composer.doc.activeElement || !wysihtml.dom.contains(composer.element, composer.doc.activeElement)) { composer.element.focus(); d.scrollTop = oldScrollTop; d.scrollLeft = oldScrollLeft; @@ -15386,7 +14501,7 @@ wysihtml5.Commands = Base.extend( range.setStartAndEnd(anchor, offsetStart, offsetEnd); range.splitBoundaries(); txtNodes = range.getNodes([3], function(node) { - return (!wysihtml5.dom.domNode(node).is.emptyTextNode()); + return (!wysihtml.dom.domNode(node).is.emptyTextNode()); }); return { @@ -15458,7 +14573,7 @@ wysihtml5.Commands = Base.extend( if (wrapNode) { newWrapNode = wrapNode.cloneNode(false); - wysihtml5.dom.domNode(textNode).escapeParent(wrapNode, newWrapNode); + wysihtml.dom.domNode(textNode).escapeParent(wrapNode, newWrapNode); updateFormatOfElement(newWrapNode, options); } } @@ -15469,7 +14584,7 @@ wysihtml5.Commands = Base.extend( wrapNode = findSimilarTextNodeWrapper(textNode, options, container); if (wrapNode) { - wysihtml5.dom.domNode(textNode).escapeParent(wrapNode); + wysihtml.dom.domNode(textNode).escapeParent(wrapNode); } } @@ -15503,7 +14618,7 @@ wysihtml5.Commands = Base.extend( } else { // Escape caret out of format - textNode = composer.doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + textNode = composer.doc.createTextNode(wysihtml.INVISIBLE_SPACE); newNode = state.nodes[0].cloneNode(false); newNode.appendChild(textNode); composer.selection.splitElementAtCaret(state.nodes[0], newNode); @@ -15568,7 +14683,7 @@ wysihtml5.Commands = Base.extend( textOffset = selection.anchorOffset; for (i = state.nodes.length; i--;) { - wysihtml5.dom.unwrap(state.nodes[i]); + wysihtml.dom.unwrap(state.nodes[i]); } cleanupAndSetCaret(composer, textNode, textOffset, options); @@ -15616,7 +14731,7 @@ wysihtml5.Commands = Base.extend( return options; } - wysihtml5.commands.formatInline = { + wysihtml.commands.formatInline = { // Basics: // In case of plain text or inline state not set wrap all non-empty textnodes with @@ -15662,27 +14777,9 @@ wysihtml5.Commands = Base.extend( } }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - nodeName: "BLOCKQUOTE", - toggle: true - }; - - wysihtml5.commands.insertBlockQuote = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5){ - wysihtml5.commands.insertHTML = { +})(wysihtml); +;(function(wysihtml){ + wysihtml.commands.insertHTML = { exec: function(composer, command, html) { composer.selection.insertHTML(html); }, @@ -15691,120 +14788,11 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5) { - var NODE_NAME = "IMG"; - - wysihtml5.commands.insertImage = { - /** - * Inserts an - * If selection is already an image link, it removes it - * - * @example - * // either ... - * wysihtml5.commands.insertImage.exec(composer, "insertImage", "http://www.google.de/logo.jpg"); - * // ... or ... - * wysihtml5.commands.insertImage.exec(composer, "insertImage", { src: "http://www.google.de/logo.jpg", title: "foo" }); - */ - exec: function(composer, command, value) { - value = typeof(value) === "object" ? value : { src: value }; - - var doc = composer.doc, - image = this.state(composer), - textNode, - parent; - - // If image is selected and src ie empty, set the caret before it and delete the image - if (image && !value.src) { - composer.selection.setBefore(image); - parent = image.parentNode; - parent.removeChild(image); - - // and it's parent too if it hasn't got any other relevant child nodes - wysihtml5.dom.removeEmptyTextNodes(parent); - if (parent.nodeName === "A" && !parent.firstChild) { - composer.selection.setAfter(parent); - parent.parentNode.removeChild(parent); - } - - // firefox and ie sometimes don't remove the image handles, even though the image got removed - wysihtml5.quirks.redraw(composer.element); - return; - } - - // If image selected change attributes accordingly - if (image) { - for (var key in value) { - if (value.hasOwnProperty(key)) { - image.setAttribute(key === "className" ? "class" : key, value[key]); - } - } - return; - } - - // Otherwise lets create the image - image = doc.createElement(NODE_NAME); - - for (var i in value) { - image.setAttribute(i === "className" ? "class" : i, value[i]); - } - - composer.selection.insertNode(image); - if (wysihtml5.browser.hasProblemsSettingCaretAfterImg()) { - textNode = doc.createTextNode(wysihtml5.INVISIBLE_SPACE); - composer.selection.insertNode(textNode); - composer.selection.setAfter(textNode); - } else { - composer.selection.setAfter(image); - } - }, - - state: function(composer) { - var doc = composer.doc, - selectedNode, - text, - imagesInSelection; - - if (!wysihtml5.dom.hasElementWithTagName(doc, NODE_NAME)) { - return false; - } - - selectedNode = composer.selection.getSelectedNode(); - if (!selectedNode) { - return false; - } - - if (selectedNode.nodeName === NODE_NAME) { - // This works perfectly in IE - return selectedNode; - } - - if (selectedNode.nodeType !== wysihtml5.ELEMENT_NODE) { - return false; - } - - text = composer.selection.getText(); - text = wysihtml5.lang.string(text).trim(); - if (text) { - return false; - } - - imagesInSelection = composer.selection.getNodes(wysihtml5.ELEMENT_NODE, function(node) { - return node.nodeName === "IMG"; - }); - - if (imagesInSelection.length !== 1) { - return false; - } - - return imagesInSelection[0]; - } - }; -})(wysihtml5); -;(function(wysihtml5) { - var LINE_BREAK = "
    " + (wysihtml5.browser.needsSpaceAfterLineBreak() ? " " : ""); +}(wysihtml)); +;(function(wysihtml) { + var LINE_BREAK = "
    " + (wysihtml.browser.needsSpaceAfterLineBreak() ? " " : ""); - wysihtml5.commands.insertLineBreak = { + wysihtml.commands.insertLineBreak = { exec: function(composer, command) { composer.selection.insertHTML(LINE_BREAK); }, @@ -15813,30 +14801,8 @@ wysihtml5.Commands = Base.extend( return false; } }; -})(wysihtml5); -;(function(wysihtml5){ - wysihtml5.commands.insertOrderedList = { - exec: function(composer, command) { - wysihtml5.commands.insertList.exec(composer, command, "OL"); - }, - - state: function(composer, command) { - return wysihtml5.commands.insertList.state(composer, command, "OL"); - } - }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.insertUnorderedList = { - exec: function(composer, command) { - wysihtml5.commands.insertList.exec(composer, command, "UL"); - }, - - state: function(composer, command) { - return wysihtml5.commands.insertList.state(composer, command, "UL"); - } - }; -}(wysihtml5)); -;wysihtml5.commands.insertList = (function(wysihtml5) { +})(wysihtml); +;wysihtml.commands.insertList = (function(wysihtml) { var isNode = function(node, name) { if (node && node.nodeName) { @@ -15859,7 +14825,7 @@ wysihtml5.Commands = Base.extend( }; if (node) { - var parentLi = wysihtml5.dom.getParentElement(node, { query: "li" }, false, composer.element), + var parentLi = wysihtml.dom.getParentElement(node, { query: "li" }, false, composer.element), otherNodeName = (nodeName === "UL") ? "OL" : "UL"; if (isNode(node, nodeName)) { @@ -15901,15 +14867,15 @@ wysihtml5.Commands = Base.extend( otherLists = getListsInSelection(otherNodeName, composer); if (otherLists.length) { for (var l = otherLists.length; l--;) { - wysihtml5.dom.renameElement(otherLists[l], nodeName.toLowerCase()); + wysihtml.dom.renameElement(otherLists[l], nodeName.toLowerCase()); } } else { innerLists = getListsInSelection(['OL', 'UL'], composer); for (var i = innerLists.length; i--;) { - wysihtml5.dom.resolveList(innerLists[i], composer.config.useLineBreaks); + wysihtml.dom.resolveList(innerLists[i], composer.config.useLineBreaks); } if (innerLists.length === 0) { - wysihtml5.dom.resolveList(el, composer.config.useLineBreaks); + wysihtml.dom.resolveList(el, composer.config.useLineBreaks); } } }); @@ -15927,7 +14893,7 @@ wysihtml5.Commands = Base.extend( // All selection inner lists get renamed too for (var l = renameLists.length; l--;) { - wysihtml5.dom.renameElement(renameLists[l], nodeName.toLowerCase()); + wysihtml.dom.renameElement(renameLists[l], nodeName.toLowerCase()); } }); }; @@ -15961,10 +14927,10 @@ wysihtml5.Commands = Base.extend( // This space causes new lists to never break on enter var INVISIBLE_SPACE_REG_EXP = /\uFEFF/g; - tempElement.innerHTML = tempElement.innerHTML.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + tempElement.innerHTML = tempElement.innerHTML.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); if (tempElement) { isEmpty = (/^(\s|(
    ))+$/i).test(tempElement.innerHTML); - list = wysihtml5.dom.convertToList(tempElement, nodeName.toLowerCase(), composer.parent.config.classNames.uneditableContainer); + list = wysihtml.dom.convertToList(tempElement, nodeName.toLowerCase(), composer.parent.config.classNames.uneditableContainer); if (sel) { rangy.restoreSelection(sel); } @@ -15988,18 +14954,18 @@ wysihtml5.Commands = Base.extend( anode = [fnode, fnode = anode][0]; } - if (wysihtml5.dom.domNode(fnode).is.emptyTextNode(true) && fnode) { - fnode = wysihtml5.dom.domNode(fnode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + if (wysihtml.dom.domNode(fnode).is.emptyTextNode(true) && fnode) { + fnode = wysihtml.dom.domNode(fnode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); } - if (wysihtml5.dom.domNode(anode).is.emptyTextNode(true) && anode) { - anode = wysihtml5.dom.domNode(anode).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + if (wysihtml.dom.domNode(anode).is.emptyTextNode(true) && anode) { + anode = wysihtml.dom.domNode(anode).next({nodeTypes: [1,3], ignoreBlankTexts: true}); } if (anode && fnode) { if (anode === fnode) { selectedNode = anode; } else { - selectedNode = wysihtml5.dom.domNode(anode).commonAncestor(fnode, composer.element); + selectedNode = wysihtml.dom.domNode(anode).commonAncestor(fnode, composer.element); } } else { selectedNode = composer.selection.getSelectedNode(); @@ -16028,174 +14994,9 @@ wysihtml5.Commands = Base.extend( } }; -})(wysihtml5); -;(function(wysihtml5){ - - var nodeOptions = { - nodeName: "I", - toggle: true - }; - - wysihtml5.commands.italic = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); -;(function(wysihtml5) { - - var nodeOptions = { - className: "wysiwyg-text-align-center", - classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, - toggle: true - }; - - wysihtml5.commands.justifyCenter = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - className: "wysiwyg-text-align-left", - classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, - toggle: true - }; - - wysihtml5.commands.justifyLeft = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - className: "wysiwyg-text-align-right", - classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, - toggle: true - }; - - wysihtml5.commands.justifyRight = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - className: "wysiwyg-text-align-justify", - classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, - toggle: true - }; - - wysihtml5.commands.justifyFull = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "right", - toggle: true - }; - - wysihtml5.commands.alignRightStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "left", - toggle: true - }; - - wysihtml5.commands.alignLeftStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "center", - toggle: true - }; - - wysihtml5.commands.alignCenterStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); -;(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "justify", - toggle: true - }; - - wysihtml5.commands.alignJustifyStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); -;(function(wysihtml5){ - wysihtml5.commands.redo = { +})(wysihtml); +;(function(wysihtml){ + wysihtml.commands.redo = { exec: function(composer) { return composer.undoManager.redo(); }, @@ -16204,27 +15005,9 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - - var nodeOptions = { - nodeName: "U", - toggle: true - }; - - wysihtml5.commands.underline = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.undo = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.undo = { exec: function(composer) { return composer.undoManager.undo(); }, @@ -16233,9 +15016,9 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.createTable = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.createTable = { exec: function(composer, command, value) { var col, row, html; if (value && value.cols && value.rows && parseInt(value.cols, 10) > 0 && parseInt(value.rows, 10) > 0) { @@ -16263,15 +15046,15 @@ wysihtml5.Commands = Base.extend( } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.mergeTableCells = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.mergeTableCells = { exec: function(composer, command) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { if (this.state(composer, command)) { - wysihtml5.dom.table.unmergeCell(composer.tableSelection.start); + wysihtml.dom.table.unmergeCell(composer.tableSelection.start); } else { - wysihtml5.dom.table.mergeCellsBetween(composer.tableSelection.start, composer.tableSelection.end); + wysihtml.dom.table.mergeCellsBetween(composer.tableSelection.start, composer.tableSelection.end); } } }, @@ -16282,11 +15065,11 @@ wysihtml5.Commands = Base.extend( end = composer.tableSelection.end; if (start && end && start == end && (( - wysihtml5.dom.getAttribute(start, "colspan") && - parseInt(wysihtml5.dom.getAttribute(start, "colspan"), 10) > 1 + wysihtml.dom.getAttribute(start, "colspan") && + parseInt(wysihtml.dom.getAttribute(start, "colspan"), 10) > 1 ) || ( - wysihtml5.dom.getAttribute(start, "rowspan") && - parseInt(wysihtml5.dom.getAttribute(start, "rowspan"), 10) > 1 + wysihtml.dom.getAttribute(start, "rowspan") && + parseInt(wysihtml.dom.getAttribute(start, "rowspan"), 10) > 1 )) ) { return [start]; @@ -16295,18 +15078,18 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.addTableCells = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.addTableCells = { exec: function(composer, command, value) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { // switches start and end if start is bigger than end (reverse selection) - var tableSelect = wysihtml5.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end); + var tableSelect = wysihtml.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end); if (value == "before" || value == "above") { - wysihtml5.dom.table.addCells(tableSelect.start, value); + wysihtml.dom.table.addCells(tableSelect.start, value); } else if (value == "after" || value == "below") { - wysihtml5.dom.table.addCells(tableSelect.end, value); + wysihtml.dom.table.addCells(tableSelect.end, value); } setTimeout(function() { composer.tableSelection.select(tableSelect.start, tableSelect.end); @@ -16318,31 +15101,31 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.deleteTableCells = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.deleteTableCells = { exec: function(composer, command, value) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { - var tableSelect = wysihtml5.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end), - idx = wysihtml5.dom.table.indexOf(tableSelect.start), + var tableSelect = wysihtml.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end), + idx = wysihtml.dom.table.indexOf(tableSelect.start), selCell, table = composer.tableSelection.table; - wysihtml5.dom.table.removeCells(tableSelect.start, value); + wysihtml.dom.table.removeCells(tableSelect.start, value); setTimeout(function() { // move selection to next or previous if not present - selCell = wysihtml5.dom.table.findCell(table, idx); + selCell = wysihtml.dom.table.findCell(table, idx); if (!selCell){ if (value == "row") { - selCell = wysihtml5.dom.table.findCell(table, { + selCell = wysihtml.dom.table.findCell(table, { "row": idx.row - 1, "col": idx.col }); } if (value == "column") { - selCell = wysihtml5.dom.table.findCell(table, { + selCell = wysihtml.dom.table.findCell(table, { "row": idx.row, "col": idx.col - 1 }); @@ -16359,9 +15142,9 @@ wysihtml5.Commands = Base.extend( return false; } }; -}(wysihtml5)); -;(function(wysihtml5){ - wysihtml5.commands.indentList = { +}(wysihtml)); +;(function(wysihtml){ + wysihtml.commands.indentList = { exec: function(composer, command, value) { var listEls = composer.selection.getSelectionParentsByTag('LI'); if (listEls) { @@ -16384,7 +15167,7 @@ wysihtml5.Commands = Base.extend( liNode = liNodes[i]; listTag = (liNode.parentNode.nodeName === 'OL') ? 'OL' : 'UL'; list = liNode.ownerDocument.createElement(listTag); - prevLi = wysihtml5.dom.domNode(liNode).prev({nodeTypes: [wysihtml5.ELEMENT_NODE]}); + prevLi = wysihtml.dom.domNode(liNode).prev({nodeTypes: [wysihtml.ELEMENT_NODE]}); prevLiList = (prevLi) ? prevLi.querySelector('ul, ol') : null; if (prevLi) { @@ -16402,10 +15185,10 @@ wysihtml5.Commands = Base.extend( return found; } }; -}(wysihtml5)); -;(function(wysihtml5){ +}(wysihtml)); +;(function(wysihtml){ - wysihtml5.commands.outdentList = { + wysihtml.commands.outdentList = { exec: function(composer, command, value) { var listEls = composer.selection.getSelectionParentsByTag('LI'); if (listEls) { @@ -16433,8 +15216,8 @@ wysihtml5.Commands = Base.extend( if (listNode.tagName === 'OL' || listNode.tagName === 'UL') { found = true; - outerListNode = wysihtml5.dom.getParentElement(listNode.parentNode, { query: 'ol, ul' }, false, composer.element); - outerLiNode = wysihtml5.dom.getParentElement(listNode.parentNode, { query: 'li' }, false, composer.element); + outerListNode = wysihtml.dom.getParentElement(listNode.parentNode, { query: 'ol, ul' }, false, composer.element); + outerLiNode = wysihtml.dom.getParentElement(listNode.parentNode, { query: 'li' }, false, composer.element); if (outerListNode && outerLiNode) { @@ -16483,46 +15266,12 @@ wysihtml5.Commands = Base.extend( } }; -}(wysihtml5)); -;(function(wysihtml5){ - - var nodeOptions = { - nodeName: "SUB", - toggle: true - }; - - wysihtml5.commands.subscript = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; -}(wysihtml5)); -;(function(wysihtml5) { - - var nodeOptions = { - nodeName: "SUP", - toggle: true - }; - - wysihtml5.commands.superscript = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; -}(wysihtml5)); +}(wysihtml)); ;/** * Undo Manager for wysihtml5 * slightly inspired by http://rniwa.com/editing/undomanager.html#the-undomanager-interface */ -(function(wysihtml5) { +(function(wysihtml) { var Z_KEY = 90, Y_KEY = 89, BACKSPACE_KEY = 8, @@ -16530,9 +15279,9 @@ wysihtml5.Commands = Base.extend( MAX_HISTORY_ENTRIES = 25, DATA_ATTR_NODE = "data-wysihtml5-selection-node", DATA_ATTR_OFFSET = "data-wysihtml5-selection-offset", - UNDO_HTML = '' + wysihtml5.INVISIBLE_SPACE + '', - REDO_HTML = '' + wysihtml5.INVISIBLE_SPACE + '', - dom = wysihtml5.dom; + UNDO_HTML = '' + wysihtml.INVISIBLE_SPACE + '', + REDO_HTML = '' + wysihtml.INVISIBLE_SPACE + '', + dom = wysihtml.dom; function cleanTempElements(doc) { var tempElement; @@ -16541,8 +15290,8 @@ wysihtml5.Commands = Base.extend( } } - wysihtml5.UndoManager = wysihtml5.lang.Dispatcher.extend( - /** @scope wysihtml5.UndoManager.prototype */ { + wysihtml.UndoManager = wysihtml.lang.Dispatcher.extend( + /** @scope wysihtml.UndoManager.prototype */ { constructor: function(editor) { this.editor = editor; this.composer = editor.composer; @@ -16630,7 +15379,7 @@ wysihtml5.Commands = Base.extend( node = (range && range.startContainer) ? range.startContainer : this.element; offset = (range && range.startOffset) ? range.startOffset : 0; - if (node.nodeType === wysihtml5.ELEMENT_NODE) { + if (node.nodeType === wysihtml.ELEMENT_NODE) { element = node; } else { element = node.parentNode; @@ -16732,12 +15481,12 @@ wysihtml5.Commands = Base.extend( return parent.childNodes[index]; } }); -})(wysihtml5); +})(wysihtml); ;/** * TODO: the following methods still need unit test coverage */ -wysihtml5.views.View = Base.extend( - /** @scope wysihtml5.views.View.prototype */ { +wysihtml.views.View = Base.extend( + /** @scope wysihtml.views.View.prototype */ { constructor: function(parent, textareaElement, config) { this.parent = parent; this.element = textareaElement; @@ -16787,12 +15536,12 @@ wysihtml5.views.View = Base.extend( this.element.removeAttribute("disabled"); } }); -;(function(wysihtml5) { - var dom = wysihtml5.dom, - browser = wysihtml5.browser; +;(function(wysihtml) { + var dom = wysihtml.dom, + browser = wysihtml.browser; - wysihtml5.views.Composer = wysihtml5.views.View.extend( - /** @scope wysihtml5.views.Composer.prototype */ { + wysihtml.views.Composer = wysihtml.views.View.extend( + /** @scope wysihtml.views.Composer.prototype */ { name: "composer", constructor: function(parent, editableElement, config) { @@ -16814,7 +15563,7 @@ wysihtml5.views.View = Base.extend( }, getValue: function(parse, clearInternals) { - var value = this.isEmpty() ? "" : wysihtml5.quirks.getCorrectInnerHTML(this.element); + var value = this.isEmpty() ? "" : wysihtml.quirks.getCorrectInnerHTML(this.element); if (parse !== false) { value = this.parent.parse(value, (clearInternals === false) ? false : true); } @@ -16876,7 +15625,7 @@ wysihtml5.views.View = Base.extend( // IE 8 fires the focus event after .focus() // This is needed by our simulate_placeholder.js to work // therefore we clear it ourselves this time - if (wysihtml5.browser.doesAsyncFocus() && this.hasPlaceholderSet()) { + if (wysihtml.browser.doesAsyncFocus() && this.hasPlaceholderSet()) { this.clear(); } @@ -16996,10 +15745,10 @@ wysihtml5.views.View = Base.extend( } // Make sure our selection handler is ready - this.selection = new wysihtml5.Selection(this.parent, this.element, this.config.classNames.uneditableContainer); + this.selection = new wysihtml.Selection(this.parent, this.element, this.config.classNames.uneditableContainer); // Make sure commands dispatcher is ready - this.commands = new wysihtml5.Commands(this.parent); + this.commands = new wysihtml.Commands(this.parent); if (!this.config.noTextarea) { dom.copyAttributes([ @@ -17053,7 +15802,7 @@ wysihtml5.views.View = Base.extend( // IE sometimes leaves a single paragraph, which can't be removed by the user if (!browser.clearsContentEditableCorrectly()) { - wysihtml5.quirks.ensureProperClearing(this); + wysihtml.quirks.ensureProperClearing(this); } // Set up a sync that makes sure that textarea and editor have the same content @@ -17091,7 +15840,7 @@ wysihtml5.views.View = Base.extend( isInUneditable = false; for (var i = uneditables.length; i--;) { - if (wysihtml5.dom.contains(uneditables[i], nodeWithSelection)) { + if (wysihtml.dom.contains(uneditables[i], nodeWithSelection)) { isInUneditable = true; } } @@ -17114,7 +15863,7 @@ wysihtml5.views.View = Base.extend( // The autoLink helper method reveals a reg exp to detect correct urls urlRegExp = dom.autoLink.URL_REG_EXP, getTextContent = function(element) { - var textContent = wysihtml5.lang.string(dom.getTextContent(element)).trim(); + var textContent = wysihtml.lang.string(dom.getTextContent(element)).trim(); if (textContent.substr(0, 4) === "www.") { textContent = "http://" + textContent; } @@ -17181,13 +15930,13 @@ wysihtml5.views.View = Base.extend( } // After resizing IE sometimes forgets to remove the old resize handles - wysihtml5.quirks.redraw(element); + wysihtml.quirks.redraw(element); }); } }, _initUndoManager: function() { - this.undoManager = new wysihtml5.UndoManager(this.parent); + this.undoManager = new wysihtml.UndoManager(this.parent); }, _initLineBreaking: function() { @@ -17237,7 +15986,7 @@ wysihtml5.views.View = Base.extend( return; } - if (keyCode !== wysihtml5.ENTER_KEY && keyCode !== wysihtml5.BACKSPACE_KEY) { + if (keyCode !== wysihtml.ENTER_KEY && keyCode !== wysihtml.BACKSPACE_KEY) { return; } var blockElement = dom.getParentElement(that.selection.getSelectedNode(), { query: USE_NATIVE_LINE_BREAK_INSIDE_TAGS }, 4); @@ -17259,22 +16008,22 @@ wysihtml5.views.View = Base.extend( } } - if (keyCode === wysihtml5.ENTER_KEY && blockElement.nodeName.match(/^H[1-6]$/)) { + if (keyCode === wysihtml.ENTER_KEY && blockElement.nodeName.match(/^H[1-6]$/)) { adjust(selectedNode); } }, 0); return; } - if (that.config.useLineBreaks && keyCode === wysihtml5.ENTER_KEY && !wysihtml5.browser.insertsLineBreaksOnReturn()) { + if (that.config.useLineBreaks && keyCode === wysihtml.ENTER_KEY && !wysihtml.browser.insertsLineBreaksOnReturn()) { event.preventDefault(); that.commands.exec("insertLineBreak"); } }); } }); -})(wysihtml5); -;(function(wysihtml5) { - var dom = wysihtml5.dom, +})(wysihtml); +;(function(wysihtml) { + var dom = wysihtml.dom, doc = document, win = window, HOST_TEMPLATE = doc.createElement("div"), @@ -17318,7 +16067,7 @@ wysihtml5.views.View = Base.extend( "body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }", "body > p:first-child { margin-top: 0; }", "._wysihtml5-temp { display: none; }", - wysihtml5.browser.isGecko ? + wysihtml.browser.isGecko ? "body.placeholder { color: graytext !important; }" : "body.placeholder { color: #a9a9a9 !important; }", // Ensure that user see's broken images and can delete them @@ -17371,7 +16120,7 @@ wysihtml5.views.View = Base.extend( }; - wysihtml5.views.Composer.prototype.style = function() { + wysihtml.views.Composer.prototype.style = function() { var that = this, originalActiveElement = doc.querySelector(":focus"), textareaElement = this.textarea.element, @@ -17436,7 +16185,7 @@ wysihtml5.views.View = Base.extend( // Make sure that we don't change the display style of the iframe when copying styles oblur/onfocus // this is needed for when the change_view event is fired where the iframe is hidden and then // the blur event fires and re-displays it - var boxFormattingStyles = wysihtml5.lang.array(BOX_FORMATTING).without(["display"]); + var boxFormattingStyles = wysihtml.lang.array(BOX_FORMATTING).without(["display"]); // --------- restore focus --------- if (originalActiveElement) { @@ -17473,7 +16222,7 @@ wysihtml5.views.View = Base.extend( return this; }; -})(wysihtml5); +})(wysihtml); ;/** * Taking care of events * - Simulating 'change' event on contentEditable element @@ -17482,10 +16231,10 @@ wysihtml5.views.View = Base.extend( * - Dispatch proprietary newword:composer event * - Keyboard shortcuts */ -(function(wysihtml5) { - var dom = wysihtml5.dom, +(function(wysihtml) { + var dom = wysihtml.dom, domNode = dom.domNode, - browser = wysihtml5.browser, + browser = wysihtml.browser, /** * Map keyCodes to query commands */ @@ -17494,11 +16243,11 @@ wysihtml5.views.View = Base.extend( "73": "italic", // I "85": "underline" // U }; - + var actions = { // Adds multiple eventlisteners to target, bound to one callback - // TODO: If needed elsewhere make it part of wysihtml5.dom or sth + // TODO: If needed elsewhere make it part of wysihtml.dom or sth addListeners: function (target, events, callback) { for(var i = 0, max = events.length; i < max; i++) { target.addEventListener(events[i], callback, false); @@ -17506,7 +16255,7 @@ wysihtml5.views.View = Base.extend( }, // Removes multiple eventlisteners from target, bound to one callback - // TODO: If needed elsewhere make it part of wysihtml5.dom or sth + // TODO: If needed elsewhere make it part of wysihtml.dom or sth removeListeners: function (target, events, callback) { for(var i = 0, max = events.length; i < max; i++) { target.removeEventListener(events[i], callback, false); @@ -17518,7 +16267,7 @@ wysihtml5.views.View = Base.extend( if (composer.selection.caretIsLastInSelection()) { var sel = composer.selection.getSelection(), aNode = sel.anchorNode; - if (aNode && aNode.nodeType === 1 && (wysihtml5.dom.getParentElement(aNode, {query: 'td, th'}, false, composer.element) || force)) { + if (aNode && aNode.nodeType === 1 && (wysihtml.dom.getParentElement(aNode, {query: 'td, th'}, false, composer.element) || force)) { var nextNode = aNode.childNodes[sel.anchorOffset]; if (nextNode && nextNode.nodeType === 1 & nextNode.nodeName === "BR") { nextNode.parentNode.removeChild(nextNode); @@ -17552,9 +16301,9 @@ wysihtml5.views.View = Base.extend( var selection = composer.selection, prevNode = selection.getPreviousNode(); - if (selection.caretIsFirstInSelection(wysihtml5.browser.usesControlRanges()) && prevNode) { + if (selection.caretIsFirstInSelection(wysihtml.browser.usesControlRanges()) && prevNode) { if (prevNode.nodeType === 1 && - wysihtml5.dom.domNode(prevNode).is.block() && + wysihtml.dom.domNode(prevNode).is.block() && !domNode(prevNode).test({ query: "ol, ul, table, tr, dl" }) @@ -17568,7 +16317,7 @@ wysihtml5.views.View = Base.extend( var selNode = prevNode.lastChild, selectedNode = selection.getSelectedNode(), commonAncestorNode = domNode(prevNode).commonAncestor(selectedNode, composer.element), - curNode = wysihtml5.dom.getParentElement(selectedNode, { + curNode = wysihtml.dom.getParentElement(selectedNode, { query: "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote" }, false, commonAncestorNode || composer.element); @@ -17576,7 +16325,7 @@ wysihtml5.views.View = Base.extend( domNode(curNode).transferContentTo(prevNode, true); selection.setAfter(selNode); return true; - } else if (wysihtml5.browser.usesControlRanges()) { + } else if (wysihtml.browser.usesControlRanges()) { selectedNode = selection.getCaretNode(); domNode(selectedNode).transferContentTo(prevNode, true); selection.setAfter(selNode); @@ -17592,7 +16341,7 @@ wysihtml5.views.View = Base.extend( /* In IE when deleting with caret at the begining of LI, list gets broken into half instead of merging the LI with previous */ /* This does not match other browsers an is less intuitive from UI standpoint, thus has to be fixed */ fixDeleteInTheBeginningOfLi: function(composer) { - if (wysihtml5.browser.hasLiDeletingProblem()) { + if (wysihtml.browser.hasLiDeletingProblem()) { var selection = composer.selection.getSelection(), aNode = selection.anchorNode, listNode, prevNode, firstNode, @@ -17631,7 +16380,7 @@ wysihtml5.views.View = Base.extend( } return false; }, - + fixDeleteInTheBeginningOfControlSelection: function(composer) { var selection = composer.selection, prevNode = selection.getPreviousNode(), @@ -17666,8 +16415,8 @@ wysihtml5.views.View = Base.extend( }).bind(this); if( this.doc.execCommand && - wysihtml5.browser.supportsCommand(this.doc, "enableObjectResizing") && - wysihtml5.browser.supportsCommand(this.doc, "enableInlineTableEditing")) + wysihtml.browser.supportsCommand(this.doc, "enableObjectResizing") && + wysihtml.browser.supportsCommand(this.doc, "enableInlineTableEditing")) { if (this.sandbox.getIframe) { actions.addListeners(this.sandbox.getIframe(), ["focus", "mouseup", "mouseover"], iframeInitiator); @@ -17675,7 +16424,7 @@ wysihtml5.views.View = Base.extend( window.addEventListener('load', hideHandlers); } } - this.tableSelection = wysihtml5.quirks.tableCellsSelection(this.element, this.parent); + this.tableSelection = wysihtml.quirks.tableCellsSelection(this.element, this.parent); }, // Fixes some misbehaviours of enters in linebreaks mode (natively a bit unsupported feature) @@ -17723,7 +16472,7 @@ wysihtml5.views.View = Base.extend( composer.selection.setBefore(brNode); } - } else if (caretInfo.caretNode.nodeType === 3 && wysihtml5.browser.hasCaretBlockElementIssue() && caretInfo.textOffset === caretInfo.caretNode.data.length && !caretInfo.nextNode) { + } else if (caretInfo.caretNode.nodeType === 3 && wysihtml.browser.hasCaretBlockElementIssue() && caretInfo.textOffset === caretInfo.caretNode.data.length && !caretInfo.nextNode) { // This fixes annoying webkit issue when you press enter at the end of a block then seemingly nothing happens. // in reality one line break is generated and cursor is reported after it, but when entering something cursor jumps before the br @@ -17748,6 +16497,14 @@ wysihtml5.views.View = Base.extend( element = composer.element; if (selection.isCollapsed()) { + /** + * when the editor is empty in useLineBreaks = false mode, preserve + * the default value in it which is


    + */ + if (composer.isEmpty() && !composer.config.useLineBreaks) { + event.preventDefault(); + return; + } if (actions.handleUneditableDeletion(composer)) { event.preventDefault(); return; @@ -17764,7 +16521,7 @@ wysihtml5.views.View = Base.extend( event.preventDefault(); return; } - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { if (actions.fixDeleteInTheBeginningOfControlSelection(composer)) { event.preventDefault(); return; @@ -17858,7 +16615,7 @@ wysihtml5.views.View = Base.extend( if (this.config.copyedFromMarking) { // If supported the copied source can be based directly on selection // Very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection. - if (wysihtml5.browser.supportsModernPaste()) { + if (wysihtml.browser.supportsModernPaste()) { event.clipboardData.setData("text/html", this.config.copyedFromMarking + this.selection.getHtml()); event.clipboardData.setData("text/plain", this.selection.getPlainText()); event.preventDefault(); @@ -17869,7 +16626,7 @@ wysihtml5.views.View = Base.extend( var handleKeyUp = function(event) { var keyCode = event.keyCode; - if (keyCode === wysihtml5.SPACE_KEY || keyCode === wysihtml5.ENTER_KEY) { + if (keyCode === wysihtml.SPACE_KEY || keyCode === wysihtml.ENTER_KEY) { this.parent.fire("newword:composer"); } }; @@ -17880,15 +16637,15 @@ wysihtml5.views.View = Base.extend( var target = event.target, allImages = this.element.querySelectorAll('img'), notMyImages = this.element.querySelectorAll('.' + this.config.classNames.uneditableContainer + ' img'), - myImages = wysihtml5.lang.array(allImages).without(notMyImages); + myImages = wysihtml.lang.array(allImages).without(notMyImages); - if (target.nodeName === "IMG" && wysihtml5.lang.array(myImages).contains(target)) { + if (target.nodeName === "IMG" && wysihtml.lang.array(myImages).contains(target)) { this.selection.selectNode(target); } } // Saves mousedown position for IE controlSelect fix - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { this.selection.lastMouseDownPos = {x: event.clientX, y: event.clientY}; setTimeout(function() { delete this.selection.lastMouseDownPos; @@ -17916,7 +16673,7 @@ wysihtml5.views.View = Base.extend( if (this.config.classNames.uneditableContainer) { // If uneditables is configured, makes clicking on uneditable move caret after clicked element (so it can be deleted like text) // If uneditable needs text selection itself event.stopPropagation can be used to prevent this behaviour - var uneditable = wysihtml5.dom.getParentElement(event.target, { query: "." + this.config.classNames.uneditableContainer }, false, this.element); + var uneditable = wysihtml.dom.getParentElement(event.target, { query: "." + this.config.classNames.uneditableContainer }, false, this.element); if (uneditable) { this.selection.setAfter(uneditable); } @@ -17950,13 +16707,13 @@ wysihtml5.views.View = Base.extend( event.preventDefault(); } - if (keyCode === wysihtml5.BACKSPACE_KEY) { + if (keyCode === wysihtml.BACKSPACE_KEY) { // Delete key override for special cases handleDeleteKeyPress(event, this); } // Make sure that when pressing backspace/delete on selected images deletes the image and it's anchor - if (keyCode === wysihtml5.BACKSPACE_KEY || keyCode === wysihtml5.DELETE_KEY) { + if (keyCode === wysihtml.BACKSPACE_KEY || keyCode === wysihtml.DELETE_KEY) { target = this.selection.getSelectedNode(true); if (target && target.nodeName === "IMG") { event.preventDefault(); @@ -17967,18 +16724,18 @@ wysihtml5.views.View = Base.extend( parent.parentNode.removeChild(parent); } setTimeout((function() { - wysihtml5.quirks.redraw(this.element); + wysihtml.quirks.redraw(this.element); }).bind(this), 0); } } - if (this.config.handleTabKey && keyCode === wysihtml5.TAB_KEY) { + if (this.config.handleTabKey && keyCode === wysihtml.TAB_KEY) { // TAB key handling event.preventDefault(); handleTabKeyDown(this, this.element, event.shiftKey); } - if (keyCode === wysihtml5.ENTER_KEY) { + if (keyCode === wysihtml.ENTER_KEY) { handleEnterKeyPress(event, this); } @@ -17997,11 +16754,11 @@ wysihtml5.views.View = Base.extend( this.selection.getSelection().removeAllRanges(); }).bind(this), 0); }; - + // Testing requires actions to be accessible from out of scope - wysihtml5.views.Composer.prototype.observeActions = actions; + wysihtml.views.Composer.prototype.observeActions = actions; - wysihtml5.views.Composer.prototype.observe = function() { + wysihtml.views.Composer.prototype.observe = function() { var that = this, container = (this.sandbox.getIframe) ? this.sandbox.getIframe() : this.sandbox.getContentEditable(), element = this.element, @@ -18031,7 +16788,7 @@ wysihtml5.views.View = Base.extend( actions.addListeners(focusBlurElement, ["drop", "paste", "mouseup", "focus", "keyup"], handleUserInteraction.bind(this)); focusBlurElement.addEventListener("focus", handleFocus.bind(this), false); focusBlurElement.addEventListener("blur", handleBlur.bind(this), false); - + actions.addListeners(this.element, ["drop", "paste", "beforepaste"], handlePaste.bind(this), false); this.element.addEventListener("copy", handleCopy.bind(this), false); this.element.addEventListener("mousedown", handleMouseDown.bind(this), false); @@ -18041,7 +16798,7 @@ wysihtml5.views.View = Base.extend( this.element.addEventListener("keydown", handleKeyDown.bind(this), false); // IE controlselect madness fix - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { this.element.addEventListener('mscontrolselect', handleIEControlSelect.bind(this), false); } @@ -18050,15 +16807,15 @@ wysihtml5.views.View = Base.extend( }).bind(this), false); }; -})(wysihtml5); +})(wysihtml); ;/** * Class that takes care that the value of the composer and the textarea is always in sync */ -(function(wysihtml5) { +(function(wysihtml) { var INTERVAL = 400; - wysihtml5.views.Synchronizer = Base.extend( - /** @scope wysihtml5.views.Synchronizer.prototype */ { + wysihtml.views.Synchronizer = Base.extend( + /** @scope wysihtml.views.Synchronizer.prototype */ { constructor: function(editor, textarea, composer) { this.editor = editor; @@ -18074,7 +16831,7 @@ wysihtml5.views.View = Base.extend( * @param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the textarea */ fromComposerToTextarea: function(shouldParseHtml) { - this.textarea.setValue(wysihtml5.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml); + this.textarea.setValue(wysihtml.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml); }, /** @@ -18126,10 +16883,10 @@ wysihtml5.views.View = Base.extend( if (form) { // If the textarea is in a form make sure that after onreset and onsubmit the composer // has the correct state - wysihtml5.dom.observe(form, "submit", function() { + wysihtml.dom.observe(form, "submit", function() { that.sync(true); }); - wysihtml5.dom.observe(form, "reset", function() { + wysihtml.dom.observe(form, "reset", function() { setTimeout(function() { that.fromTextareaToComposer(); }, 0); }); } @@ -18147,11 +16904,11 @@ wysihtml5.views.View = Base.extend( this.editor.on("destroy:composer", stopInterval); } }); -})(wysihtml5); -;(function(wysihtml5) { +})(wysihtml); +;(function(wysihtml) { - wysihtml5.views.SourceView = Base.extend( - /** @scope wysihtml5.views.SourceView.prototype */ { + wysihtml.views.SourceView = Base.extend( + /** @scope wysihtml.views.SourceView.prototype */ { constructor: function(editor, composer) { this.editor = editor; @@ -18202,9 +16959,9 @@ wysihtml5.views.View = Base.extend( }); -})(wysihtml5); -;wysihtml5.views.Textarea = wysihtml5.views.View.extend( - /** @scope wysihtml5.views.Textarea.prototype */ { +})(wysihtml); +;wysihtml.views.Textarea = wysihtml.views.View.extend( + /** @scope wysihtml.views.Textarea.prototype */ { name: "textarea", constructor: function(parent, textareaElement, config) { @@ -18238,7 +16995,7 @@ wysihtml5.views.View = Base.extend( }, hasPlaceholderSet: function() { - var supportsPlaceholder = wysihtml5.browser.supportsPlaceholderAttributeOn(this.element), + var supportsPlaceholder = wysihtml.browser.supportsPlaceholderAttributeOn(this.element), placeholderText = this.element.getAttribute("placeholder") || null, value = this.element.value, isEmpty = !value; @@ -18246,7 +17003,7 @@ wysihtml5.views.View = Base.extend( }, isEmpty: function() { - return !wysihtml5.lang.string(this.element.value).trim() || this.hasPlaceholderSet(); + return !wysihtml.lang.string(this.element.value).trim() || this.hasPlaceholderSet(); }, _observe: function() { @@ -18260,15 +17017,15 @@ wysihtml5.views.View = Base.extend( * Calling focus() or blur() on an element doesn't synchronously trigger the attached focus/blur events * This is the case for focusin and focusout, so let's use them whenever possible, kkthxbai */ - events = wysihtml5.browser.supportsEvent("focusin") ? ["focusin", "focusout", "change"] : ["focus", "blur", "change"]; + events = wysihtml.browser.supportsEvent("focusin") ? ["focusin", "focusout", "change"] : ["focus", "blur", "change"]; parent.on("beforeload", function() { - wysihtml5.dom.observe(element, events, function(event) { + wysihtml.dom.observe(element, events, function(event) { var eventName = eventMapping[event.type] || event.type; parent.fire(eventName).fire(eventName + ":textarea"); }); - wysihtml5.dom.observe(element, ["paste", "drop"], function() { + wysihtml.dom.observe(element, ["paste", "drop"], function() { setTimeout(function() { parent.fire("paste").fire("paste:textarea"); }, 0); }); }); @@ -18305,7 +17062,7 @@ wysihtml5.views.View = Base.extend( * disable:composer * change_view */ -(function(wysihtml5) { +(function(wysihtml) { var undef; var defaultConfig = { @@ -18332,7 +17089,7 @@ wysihtml5.views.View = Base.extend( // Object which includes parser when the user inserts content via copy & paste. If null parserRules will be used instead pasteParserRulesets: null, // Parser method to use when the user inserts content - parser: wysihtml5.dom.parse, + parser: wysihtml.dom.parse, // By default wysihtml5 will insert a
    for line breaks, set this to false to use

    useLineBreaks: true, // Double enter (enter on blank line) exits block element in useLineBreaks mode. @@ -18367,16 +17124,16 @@ wysihtml5.views.View = Base.extend( copyedFromMarking: '' }; - wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend( - /** @scope wysihtml5.Editor.prototype */ { + wysihtml.Editor = wysihtml.lang.Dispatcher.extend( + /** @scope wysihtml.Editor.prototype */ { constructor: function(editableElement, config) { this.editableElement = typeof(editableElement) === "string" ? document.getElementById(editableElement) : editableElement; - this.config = wysihtml5.lang.object({}).merge(defaultConfig).merge(config).get(); - this._isCompatible = wysihtml5.browser.supported(); + this.config = wysihtml.lang.object({}).merge(defaultConfig).merge(config).get(); + this._isCompatible = wysihtml.browser.supported(); // merge classNames if (config && config.classNames) { - wysihtml5.lang.object(this.config.classNames).merge(config.classNames); + wysihtml.lang.object(this.config.classNames).merge(config.classNames); } if (this.editableElement.nodeName.toLowerCase() != "textarea") { @@ -18384,21 +17141,21 @@ wysihtml5.views.View = Base.extend( this.config.noTextarea = true; } if (!this.config.noTextarea) { - this.textarea = new wysihtml5.views.Textarea(this, this.editableElement, this.config); + this.textarea = new wysihtml.views.Textarea(this, this.editableElement, this.config); this.currentView = this.textarea; } // Sort out unsupported/unwanted browsers here - if (!this._isCompatible || (!this.config.supportTouchDevices && wysihtml5.browser.isTouchDevice())) { + if (!this._isCompatible || (!this.config.supportTouchDevices && wysihtml.browser.isTouchDevice())) { var that = this; setTimeout(function() { that.fire("beforeload").fire("load"); }, 0); return; } // Add class name to body, to indicate that the editor is supported - wysihtml5.dom.addClass(document.body, this.config.classNames.body); + wysihtml.dom.addClass(document.body, this.config.classNames.body); - this.composer = new wysihtml5.views.Composer(this, this.editableElement, this.config); + this.composer = new wysihtml.views.Composer(this, this.editableElement, this.config); this.currentView = this.composer; if (typeof(this.config.parser) === "function") { @@ -18410,12 +17167,15 @@ wysihtml5.views.View = Base.extend( handleBeforeLoad: function() { if (!this.config.noTextarea) { - this.synchronizer = new wysihtml5.views.Synchronizer(this, this.textarea, this.composer); + this.synchronizer = new wysihtml.views.Synchronizer(this, this.textarea, this.composer); } else { - this.sourceView = new wysihtml5.views.SourceView(this, this.composer); + this.sourceView = new wysihtml.views.SourceView(this, this.composer); } if (this.config.toolbar) { - this.toolbar = new wysihtml5.toolbar.Toolbar(this, this.config.toolbar, this.config.showToolbarAfterInit); + if (typeof wysihtml.toolbar === "undefined") { + throw Error("Toolbar not found. Make sure you're loading wysihtml-toolbar.js or wysihtml-toolbar.min.js"); + } + this.toolbar = new wysihtml.toolbar.Toolbar(this, this.config.toolbar, this.config.showToolbarAfterInit); } }, @@ -18496,7 +17256,7 @@ wysihtml5.views.View = Base.extend( "clearInternals" : clearInternals }); if (typeof(htmlOrElement) === "object") { - wysihtml5.quirks.redraw(htmlOrElement); + wysihtml.quirks.redraw(htmlOrElement); } return returnValue; }, @@ -18508,10 +17268,10 @@ wysihtml5.views.View = Base.extend( _initParser: function() { var oldHtml; - if (wysihtml5.browser.supportsModernPaste()) { + if (wysihtml.browser.supportsModernPaste()) { this.on("paste:composer", function(event) { event.preventDefault(); - oldHtml = wysihtml5.dom.getPastedHtml(event); + oldHtml = wysihtml.dom.getPastedHtml(event); if (oldHtml) { this._cleanAndPaste(oldHtml); } @@ -18522,7 +17282,7 @@ wysihtml5.views.View = Base.extend( event.preventDefault(); var scrollPos = this.composer.getScrollPos(); - wysihtml5.dom.getPastedHtmlWithDiv(this.composer, function(pastedHTML) { + wysihtml.dom.getPastedHtmlWithDiv(this.composer, function(pastedHTML) { if (pastedHTML) { this._cleanAndPaste(pastedHTML); } @@ -18534,7 +17294,7 @@ wysihtml5.views.View = Base.extend( }, _cleanAndPaste: function (oldHtml) { - var cleanHtml = wysihtml5.quirks.cleanPastedHTML(oldHtml, { + var cleanHtml = wysihtml.quirks.cleanPastedHTML(oldHtml, { "referenceNode": this.composer.element, "rules": this.config.pasteParserRulesets || [{"set": this.config.parserRules}], "uneditableClass": this.config.classNames.uneditableContainer @@ -18543,4 +17303,6 @@ wysihtml5.views.View = Base.extend( this.composer.selection.insertHTML(cleanHtml); } }); -})(wysihtml5); +})(wysihtml); + +}); diff --git a/dist/wysihtml.min.js b/dist/wysihtml.min.js index 8a4e8e4..e85fac3 100644 --- a/dist/wysihtml.min.js +++ b/dist/wysihtml.min.js @@ -1,11 +1,10 @@ -/*! wysihtml - v0.5.5 (2016-01-06) */ +/*! wysihtml - v0.5.5 (2016-04-29) */ -var wysihtml5={version:"0.5.5",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",INVISIBLE_SPACE_REG_EXP:/\uFEFF/g,VOID_ELEMENTS:"area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, wbr",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,TAB_KEY:9,DELETE_KEY:46};wysihtml5.polyfills=function(a,b){function c(){try{var a=new CustomEvent("cat",{detail:{foo:"bar"}});return"cat"===a.type&&"bar"===a.detail.foo}catch(b){}return!1}String.prototype.trim||!function(){var a=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(a,"")}}(),function(){var c="addEventListener",d="removeEventListener";b[c]||(a.Element.prototype[c]=a[c]=b[c]=function(b,c,d){return(d=this).attachEvent("on"+b,function(b){var b=b||a.event;b.target=b.target||b.srcElement,b.preventDefault=b.preventDefault||function(){b.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){b.cancelBubble=!0},b.which=b.button?2===b.button?3:4===b.button?2:b.button:b.keyCode,c.call(d,b)})},a.Element.prototype[d]=a[d]=b[d]=function(a,b){return this.detachEvent("on"+a,b)})}(),Object.defineProperty&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(a.Element.prototype,"textContent")&&!Object.getOwnPropertyDescriptor(a.Element.prototype,"textContent").get&&!function(){var b=Object.getOwnPropertyDescriptor(a.Element.prototype,"innerText");Object.defineProperty(a.Element.prototype,"textContent",{get:function(){return b.get.call(this)},set:function(a){return b.set.call(this,a)}})}(),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){for(var c=this.length,d=-1,e=b>>>0;~(c-e);d=this[--c]===a?c:d);return d}),Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),function(a){a.matches=a.matches||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector||function(a){for(var b=this,c=(b.document||b.ownerDocument).querySelectorAll(a),d=0;c[d]&&c[d]!==b;)++d;return c[d]?!0:!1},a.closest=a.closest||function(a){for(var b=this;b&&!b.matches(a);)b=b.parentElement;return b}}(Element.prototype),"document"in a&&("classList"in b.createElement("_")?"DOMTokenList"in a&&!function(){"use strict";var c=b.createElement("_");if(c.classList.add("c1","c2"),!c.classList.contains("c2")){var d=function(b){var c=a.DOMTokenList.prototype[b];a.DOMTokenList.prototype[b]=function(a){var b,d=arguments.length;for(b=0;d>b;b++)a=arguments[b],c.call(this,a)}};d("add"),d("remove")}if(c.classList.toggle("c3",!1),c.classList.contains("c3")){var e=a.DOMTokenList.prototype.toggle;a.DOMTokenList.prototype.toggle=function(a,b){return 1 in arguments&&!this.contains(a)==!b?b:e.call(this,a)}}c=null}():!function(a){"use strict";if("Element"in a){var b="classList",c="prototype",d=a.Element[c],e=Object,f=String[c].trim||function(){return this.replace(/^\s+|\s+$/g,"")},g=Array[c].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},h=function(a,b){this.name=a,this.code=DOMException[a],this.message=b},i=function(a,b){if(""===b)throw new h("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(b))throw new h("INVALID_CHARACTER_ERR","String contains an invalid character");return g.call(a,b)},j=function(a){for(var b=f.call(a.getAttribute("class")||""),c=b?b.split(/\s+/):[],d=0,e=c.length;e>d;d++)this.push(c[d]);this._updateClassName=function(){a.setAttribute("class",this.toString())}},k=j[c]=[],l=function(){return new j(this)};if(h[c]=Error[c],k.item=function(a){return this[a]||null},k.contains=function(a){return a+="",-1!==i(this,a)},k.add=function(){var a,b=arguments,c=0,d=b.length,e=!1;do a=b[c]+"",-1===i(this,a)&&(this.push(a),e=!0);while(++c0?c.childNodes[d]:void 0,h=b.focusNode,i=b.focusOffset,j=h&&1===h.nodeType&&i>0?h.childNodes[i-1]:void 0,k=this.ownerDocument.createRange(),l=a.shift(),m=l?a.shift():null;for(j&&3===j.nodeType&&(h=j,i=j.nodeValue.length,j=void 0),g&&3===g.nodeType&&(c=g,d=0,g=void 0),(c===h&&d>i||c!==h&&c.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_PRECEDING&&!(c.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_CONTAINS))&&(h=[c,c=h][0],i=[d,d=i][0]);l&&m;)m.previousSibling&&m.previousSibling===l?(c===m&&(c=l,d=l.nodeValue.length+d),h===m&&(h=l,i=l.nodeValue.length+i),l.nodeValue=l.nodeValue+m.nodeValue,m.parentNode.removeChild(m),m=a.shift()):(l=m,m=a.shift());j&&(i=Array.prototype.indexOf.call(j.parentNode.childNodes,j)+1),g&&(d=Array.prototype.indexOf.call(g.parentNode.childNodes,g)),f(this)&&c&&c.parentNode&&h&&h.parentNode&&(k.setStart(c,d),k.setEnd(h,i),b.removeAllRanges(),b.addRange(k))});Node.prototype.normalize=a},h=function(){window.removeEventListener("load",h),"Node"in window&&"normalize"in Node.prototype&&d()&&g()};"complete"!==b.readyState?window.addEventListener("load",h):h();var i=c();!function(){function c(a,c){c=c||{bubbles:!1,cancelable:!1,detail:void 0};var d=b.createEvent("CustomEvent");return d.initCustomEvent(a,c.bubbles,c.cancelable,c.detail),d}!i&&"CustomEvent"in window&&(c.prototype=a.Event.prototype,a.CustomEvent=c,i=!0)}()},wysihtml5.polyfills(window,document),function(a,b){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a():b.rangy=a()}(function(){function a(a,b){var c=typeof a[b];return c==u||!(c!=t||!a[b])||"unknown"==c}function b(a,b){return!(typeof a[b]!=t||!a[b])}function c(a,b){return typeof a[b]!=v}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&A(a,z)&&C(a,y)}function f(a){return b(a,"body")?a.body:a.getElementsByTagName("body")[0]}function g(b){typeof console!=v&&a(console,"log")&&console.log(b)}function h(a,b){F&&b?alert(a):g(a)}function i(a){H.initialized=!0,H.supported=!1,h("Rangy is not supported in this environment. Reason: "+a,H.config.alertOnFail)}function j(a){h("Rangy warning: "+a,H.config.alertOnWarn)}function k(a){return a.message||a.description||String(a)}function l(){if(F&&!H.initialized){var b,c=!1,d=!1;a(document,"createRange")&&(b=document.createRange(),A(b,x)&&C(b,w)&&(c=!0));var h=f(document);if(!h||"body"!=h.nodeName.toLowerCase())return void i("No body element found");if(h&&a(h,"createTextRange")&&(b=h.createTextRange(),e(b)&&(d=!0)),!c&&!d)return void i("Neither Range nor TextRange are available");H.initialized=!0,H.features={implementsDomRange:c,implementsTextRange:d};var j,l;for(var m in E)(j=E[m])instanceof p&&j.init(j,H);for(var n=0,o=K.length;o>n;++n)try{K[n](H)}catch(q){l="Rangy init listener threw an exception. Continuing. Detail: "+k(q),g(l)}}}function m(a,b,c){c&&(a+=" in module "+c.name),H.warn("DEPRECATED: "+a+" is deprecated. Please use "+b+" instead.")}function n(a,b,c,d){a[b]=function(){return m(b,c,d),a[c].apply(a,G.toArray(arguments))}}function o(a){a=a||window,l();for(var b=0,c=L.length;c>b;++b)L[b](a)}function p(a,b,c){this.name=a,this.dependencies=b,this.initialized=!1,this.supported=!1,this.initializer=c}function q(a,b,c){var d=new p(a,b,function(b){if(!b.initialized){b.initialized=!0;try{c(H,b),b.supported=!0}catch(d){var e="Module '"+a+"' failed to load: "+k(d);g(e),d.stack&&g(d.stack)}}});return E[a]=d,d}function r(){}function s(){}var t="object",u="function",v="undefined",w=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],x=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],y=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],z=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],A=d(a),B=d(b),C=d(c),D=[].forEach?function(a,b){a.forEach(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)b(a[c],c)},E={},F=typeof window!=v&&typeof document!=v,G={isHostMethod:a,isHostObject:b,isHostProperty:c,areHostMethods:A,areHostObjects:B,areHostProperties:C,isTextRange:e,getBody:f,forEach:D},H={version:"1.3.0",initialized:!1,isBrowser:F,supported:!0,util:G,features:{},modules:E,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==v?!0:rangyAutoInitialize}};H.fail=i,H.warn=j;var I;({}).hasOwnProperty?(G.extend=I=function(a,b,c){var d,e;for(var f in b)b.hasOwnProperty(f)&&(d=a[f],e=b[f],c&&null!==d&&"object"==typeof d&&null!==e&&"object"==typeof e&&I(d,e,!0),a[f]=e);return b.hasOwnProperty("toString")&&(a.toString=b.toString),a},G.createOptions=function(a,b){var c={};return I(c,b),a&&I(c,a),c}):i("hasOwnProperty not supported"),F||i("Rangy can only run in a browser"),function(){var a;if(F){var b=document.createElement("div");b.appendChild(document.createElement("span"));var c=[].slice;try{1==c.call(b.childNodes,0)[0].nodeType&&(a=function(a){return c.call(a,0)})}catch(d){}}a||(a=function(a){for(var b=[],c=0,d=a.length;d>c;++c)b[c]=a[c];return b}),G.toArray=a}();var J;F&&(a(document,"addEventListener")?J=function(a,b,c){a.addEventListener(b,c,!1)}:a(document,"attachEvent")?J=function(a,b,c){a.attachEvent("on"+b,c)}:i("Document does not have required addEventListener or attachEvent method"),G.addListener=J);var K=[];G.deprecationNotice=m,G.createAliasForDeprecatedMethod=n,H.init=l,H.addInitListener=function(a){H.initialized?a(H):K.push(a)};var L=[];H.addShimListener=function(a){L.push(a)},F&&(H.shim=H.createMissingNativeApi=o,n(H,"createMissingNativeApi","shim")),p.prototype={init:function(){for(var a,b,c=this.dependencies||[],d=0,e=c.length;e>d;++d){if(b=c[d],a=E[b],!(a&&a instanceof p))throw new Error("required module '"+b+"' not found");if(a.init(),!a.supported)throw new Error("required module '"+b+"' not supported")}this.initializer(this)},fail:function(a){throw this.initialized=!0,this.supported=!1,new Error(a)},warn:function(a){H.warn("Module "+this.name+": "+a)},deprecationNotice:function(a,b){H.warn("DEPRECATED: "+a+" in module "+this.name+" is deprecated. Please use "+b+" instead")},createError:function(a){return new Error("Error in Rangy "+this.name+" module: "+a)}},H.createModule=function(a){var b,c;2==arguments.length?(b=arguments[1],c=[]):(b=arguments[2],c=arguments[1]);var d=q(a,c,b);H.initialized&&H.supported&&d.init()},H.createCoreModule=function(a,b,c){q(a,b,c)},H.RangePrototype=r,H.rangePrototype=new r,H.selectionPrototype=new s,H.createCoreModule("DomUtil",[],function(a,b){function c(a){var b;return typeof a.namespaceURI==F||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==b}function d(a){var b=a.parentNode;return 1==b.nodeType?b:null}function e(a){for(var b=0;a=a.previousSibling;)++b;return b}function f(a){switch(a.nodeType){case 7:case 10:return 0;case 3:case 8:return a.length;default:return a.childNodes.length}}function g(a,b){var c,d=[];for(c=a;c;c=c.parentNode)d.push(c);for(c=b;c;c=c.parentNode)if(K(d,c))return c;return null}function h(a,b,c){for(var d=c?b:b.parentNode;d;){if(d===a)return!0;d=d.parentNode}return!1}function i(a,b){return h(a,b,!0)}function j(a,b,c){for(var d,e=c?a:a.parentNode;e;){if(d=e.parentNode,d===b)return e;e=d}return null}function k(a){var b=a.nodeType;return 3==b||4==b||8==b}function l(a){if(!a)return!1;var b=a.nodeType;return 3==b||8==b}function m(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a}function n(a,b,c){var d=a.cloneNode(!1);if(d.deleteData(0,b),a.deleteData(b,a.length-b),m(d,a),c)for(var f,g=0;f=c[g++];)f.node==a&&f.offset>b?(f.node=d,f.offset-=b):f.node==a.parentNode&&f.offset>e(a)&&++f.offset;return d}function o(a){if(9==a.nodeType)return a;if(typeof a.ownerDocument!=F)return a.ownerDocument;if(typeof a.document!=F)return a.document;if(a.parentNode)return o(a.parentNode);throw b.createError("getDocument: no document found for node")}function p(a){var c=o(a);if(typeof c.defaultView!=F)return c.defaultView;if(typeof c.parentWindow!=F)return c.parentWindow;throw b.createError("Cannot get a window object for node")}function q(a){if(typeof a.contentDocument!=F)return a.contentDocument;if(typeof a.contentWindow!=F)return a.contentWindow.document;throw b.createError("getIframeDocument: No Document object found for iframe element")}function r(a){if(typeof a.contentWindow!=F)return a.contentWindow;if(typeof a.contentDocument!=F)return a.contentDocument.defaultView;throw b.createError("getIframeWindow: No Window object found for iframe element")}function s(a){return a&&G.isHostMethod(a,"setTimeout")&&G.isHostObject(a,"document")}function t(a,b,c){var d;if(a?G.isHostProperty(a,"nodeType")?d=1==a.nodeType&&"iframe"==a.tagName.toLowerCase()?q(a):o(a):s(a)&&(d=a.document):d=document,!d)throw b.createError(c+"(): Parameter must be a Window object or DOM node");return d}function u(a){for(var b;b=a.parentNode;)a=b;return a}function v(a,c,d,f){var h,i,k,l,m;if(a==d)return c===f?0:f>c?-1:1;if(h=j(d,a,!0))return c<=e(h)?-1:1;if(h=j(a,d,!0))return e(h)[index:"+e(a)+",length:"+a.childNodes.length+"]["+(a.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return a.nodeName}function y(a){for(var b,c=o(a).createDocumentFragment();b=a.firstChild;)c.appendChild(b);return c}function z(a,b,c){var d=H(a),e=a.createElement("div");e.contentEditable=""+!!c,b&&(e.innerHTML=b);var f=d.firstChild;return f?d.insertBefore(e,f):d.appendChild(e),e}function A(a){return a.parentNode.removeChild(a)}function B(a){this.root=a,this._next=a}function C(a){return new B(a)}function D(a,b){this.node=a,this.offset=b}function E(a){this.code=this[a],this.codeName=a,this.message="DOMException: "+this.codeName}var F="undefined",G=a.util,H=G.getBody;G.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method"),G.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var I=document.createElement("div");G.areHostMethods(I,["insertBefore","appendChild","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"]))||b.fail("Incomplete Element implementation"),G.isHostProperty(I,"innerHTML")||b.fail("Element is missing innerHTML property");var J=document.createTextNode("test");G.areHostMethods(J,["splitText","deleteData","insertData","appendData","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"])||!G.areHostProperties(J,["data"]))||b.fail("Incomplete Text Node implementation");var K=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},L=!1;!function(){var b=document.createElement("b");b.innerHTML="1";var c=b.firstChild;b.innerHTML="
    ",L=w(c),a.features.crashyTextNodes=L}();var M;typeof window.getComputedStyle!=F?M=function(a,b){return p(a).getComputedStyle(a,null)[b]}:typeof document.documentElement.currentStyle!=F?M=function(a,b){return a.currentStyle?a.currentStyle[b]:""}:b.fail("No means of obtaining computed style properties found"),B.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a,b,c=this._current=this._next;if(this._current)if(a=c.firstChild)this._next=a;else{for(b=null;c!==this.root&&!(b=c.nextSibling);)c=c.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}},D.prototype={equals:function(a){return!!a&&this.node===a.node&&this.offset==a.offset},inspect:function(){return"[DomPosition("+x(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},E.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},E.prototype.toString=function(){return this.message},a.dom={arrayContains:K,isHtmlNamespace:c,parentElement:d,getNodeIndex:e,getNodeLength:f,getCommonAncestor:g,isAncestorOf:h,isOrIsAncestorOf:i,getClosestAncestorIn:j,isCharacterDataNode:k,isTextOrCommentNode:l,insertAfter:m,splitDataNode:n,getDocument:o,getWindow:p,getIframeWindow:r,getIframeDocument:q,getBody:H,isWindow:s,getContentDocument:t,getRootContainer:u,comparePoints:v,isBrokenNode:w,inspectNode:x,getComputedStyleProperty:M,createTestElement:z,removeNode:A,fragmentFromNodeChildren:y,createIterator:C,DomPosition:D},a.DOMException=E}),H.createCoreModule("DomRange",["DomUtil"],function(a,b){function c(a,b){return 3!=a.nodeType&&(P(a,b.startContainer)||P(a,b.endContainer))}function d(a){return a.document||Q(a.startContainer)}function e(a){return W(a.startContainer)}function f(a){return new L(a.parentNode,O(a))}function g(a){return new L(a.parentNode,O(a)+1)}function h(a,b,c){var d=11==a.nodeType?a.firstChild:a;return N(b)?c==b.length?J.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:S(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]),d}function i(a,b,c){if(z(a),z(b),d(b)!=d(a))throw new M("WRONG_DOCUMENT_ERR");var e=R(a.startContainer,a.startOffset,b.endContainer,b.endOffset),f=R(a.endContainer,a.endOffset,b.startContainer,b.startOffset);return c?0>=e&&f>=0:0>e&&f>0}function j(a){for(var b,c,e,f=d(a.range).createDocumentFragment();c=a.next();){if(b=a.isPartiallySelectedSubtree(),c=c.cloneNode(!b),b&&(e=a.getSubtreeIterator(),c.appendChild(j(e)),e.detach()),10==c.nodeType)throw new M("HIERARCHY_REQUEST_ERR");f.appendChild(c)}return f}function k(a,b,c){var d,e;c=c||{stop:!1};for(var f,g;f=a.next();)if(a.isPartiallySelectedSubtree()){if(b(f)===!1)return void(c.stop=!0);if(g=a.getSubtreeIterator(),k(g,b,c),g.detach(),c.stop)return}else for(d=J.createIterator(f);e=d.next();)if(b(e)===!1)return void(c.stop=!0)}function l(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),l(b),b.detach()):a.remove()}function m(a){for(var b,c,e=d(a.range).createDocumentFragment();b=a.next();){if(a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),c=a.getSubtreeIterator(),b.appendChild(m(c)),c.detach()):a.remove(),10==b.nodeType)throw new M("HIERARCHY_REQUEST_ERR");e.appendChild(b)}return e}function n(a,b,c){var d,e=!(!b||!b.length),f=!!c;e&&(d=new RegExp("^("+b.join("|")+")$"));var g=[];return k(new p(a,!1),function(b){if((!e||d.test(b.nodeType))&&(!f||c(b))){var h=a.startContainer;if(b!=h||!N(h)||a.startOffset!=h.length){var i=a.endContainer;b==i&&N(i)&&0==a.endOffset||g.push(b)}}}),g}function o(a){var b="undefined"==typeof a.getName?"Range":a.getName();return"["+b+"("+J.inspectNode(a.startContainer)+":"+a.startOffset+", "+J.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function p(a,b){if(this.range=a,this.clonePartiallySelectedTextNodes=b,!a.collapsed){this.sc=a.startContainer,this.so=a.startOffset,this.ec=a.endContainer,this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&N(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==c||N(this.sc)?T(this.sc,c,!0):this.sc.childNodes[this.so],this._last=this.ec!==c||N(this.ec)?T(this.ec,c,!0):this.ec.childNodes[this.eo-1])}}function q(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){if(d=e.nodeType,V(a,d))return e;e=e.parentNode}return null}}function r(a,b){if(ea(a,b))throw new M("INVALID_NODE_TYPE_ERR")}function s(a,b){if(!V(b,a.nodeType))throw new M("INVALID_NODE_TYPE_ERR")}function t(a,b){if(0>b||b>(N(a)?a.length:a.childNodes.length))throw new M("INDEX_SIZE_ERR")}function u(a,b){if(ca(a,!0)!==ca(b,!0))throw new M("WRONG_DOCUMENT_ERR")}function v(a){if(da(a,!0))throw new M("NO_MODIFICATION_ALLOWED_ERR")}function w(a,b){if(!a)throw new M(b)}function x(a,b){return b<=(N(a)?a.length:a.childNodes.length)}function y(a){return!!a.startContainer&&!!a.endContainer&&!(X&&(J.isBrokenNode(a.startContainer)||J.isBrokenNode(a.endContainer)))&&W(a.startContainer)==W(a.endContainer)&&x(a.startContainer,a.startOffset)&&x(a.endContainer,a.endOffset)}function z(a){if(!y(a))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+a.inspect()+")")}function A(a,b){z(a);var c=a.startContainer,d=a.startOffset,e=a.endContainer,f=a.endOffset,g=c===e;N(e)&&f>0&&f0&&d=O(c)&&f++,d=0),a.setStartAndEnd(c,d,e,f)}function B(a){z(a);var b=a.commonAncestorContainer.parentNode.cloneNode(!1);return b.appendChild(a.cloneContents()),b.innerHTML}function C(a){a.START_TO_START=ka,a.START_TO_END=la,a.END_TO_END=ma,a.END_TO_START=na,a.NODE_BEFORE=oa,a.NODE_AFTER=pa,a.NODE_BEFORE_AND_AFTER=qa,a.NODE_INSIDE=ra}function D(a){C(a),C(a.prototype)}function E(a,b){return function(){z(this);var c,d,e=this.startContainer,f=this.startOffset,h=this.commonAncestorContainer,i=new p(this,!0);e!==h&&(c=T(e,h,!0),d=g(c),e=d.node,f=d.offset),k(i,v),i.reset();var j=a(i);return i.detach(),b(this,e,f,e,f),j}}function F(b,d){function e(a,b){return function(c){s(c,Z),s(W(c),$);var d=(a?f:g)(c);(b?h:i)(this,d.node,d.offset)}}function h(a,b,c){var e=a.endContainer,f=a.endOffset;(b!==a.startContainer||c!==a.startOffset)&&((W(b)!=W(e)||1==R(b,c,e,f))&&(e=b,f=c),d(a,b,c,e,f))}function i(a,b,c){var e=a.startContainer,f=a.startOffset;(b!==a.endContainer||c!==a.endOffset)&&((W(b)!=W(e)||-1==R(b,c,e,f))&&(e=b,f=c),d(a,e,f,b,c))}var j=function(){};j.prototype=a.rangePrototype,b.prototype=new j,K.extend(b.prototype,{setStart:function(a,b){r(a,!0),t(a,b),h(this,a,b)},setEnd:function(a,b){r(a,!0),t(a,b),i(this,a,b)},setStartAndEnd:function(){var a=arguments,b=a[0],c=a[1],e=b,f=c;switch(a.length){case 3:f=a[2];break;case 4:e=a[2],f=a[3]}d(this,b,c,e,f)},setBoundary:function(a,b,c){this["set"+(c?"Start":"End")](a,b)},setStartBefore:e(!0,!0),setStartAfter:e(!1,!0),setEndBefore:e(!0,!1),setEndAfter:e(!1,!1),collapse:function(a){z(this),a?d(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){r(a,!0),d(this,a,0,a,U(a))},selectNode:function(a){r(a,!1),s(a,Z);var b=f(a),c=g(a);d(this,b.node,b.offset,c.node,c.offset)},extractContents:E(m,d),deleteContents:E(l,d),canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},splitBoundaries:function(){A(this)},splitBoundariesPreservingPositions:function(a){A(this,a)},normalizeBoundaries:function(){z(this);var a,b=this.startContainer,c=this.startOffset,e=this.endContainer,f=this.endOffset,g=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(e=a,f=a.length,a.appendData(b.data),Y(b))},h=function(a){var d=a.previousSibling;if(d&&d.nodeType==a.nodeType){b=a;var g=a.length;if(c=d.length,a.insertData(0,d.data),Y(d),b==e)f+=c,e=b;else if(e==a.parentNode){var h=O(a);f==h?(e=a,f=g):f>h&&f--}}},i=!0;if(N(e))f==e.length?g(e):0==f&&(a=e.previousSibling,a&&a.nodeType==e.nodeType&&(f=a.length,b==e&&(i=!1),a.appendData(e.data),Y(e),e=a));else{if(f>0){var j=e.childNodes[f-1];j&&N(j)&&g(j)}i=!this.collapsed}if(i){if(N(b))0==c?h(b):c==b.length&&(a=b.nextSibling,a&&a.nodeType==b.nodeType&&(e==a&&(e=b,f+=b.length),b.appendData(a.data),Y(a)));else if(cx",ga=3==fa.firstChild.nodeType}catch(ha){}a.features.htmlParsingConforms=ga;var ia=ga?function(a){var b=this.startContainer,c=Q(b);if(!b)throw new M("INVALID_STATE_ERR");var d=null;return 1==b.nodeType?d=b:N(b)&&(d=J.parentElement(b)),d=null===d||"HTML"==d.nodeName&&J.isHtmlNamespace(Q(d).documentElement)&&J.isHtmlNamespace(d)?c.createElement("body"):d.cloneNode(!1),d.innerHTML=a,J.fragmentFromNodeChildren(d)}:function(a){var b=d(this),c=b.createElement("body");return c.innerHTML=a,J.fragmentFromNodeChildren(c)},ja=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ka=0,la=1,ma=2,na=3,oa=0,pa=1,qa=2,ra=3;K.extend(a.rangePrototype,{compareBoundaryPoints:function(a,b){z(this),u(this.startContainer,b.startContainer);var c,d,e,f,g=a==na||a==ka?"start":"end",h=a==la||a==ka?"start":"end";return c=this[g+"Container"],d=this[g+"Offset"],e=b[h+"Container"],f=b[h+"Offset"],R(c,d,e,f)},insertNode:function(a){if(z(this),s(a,aa),v(this.startContainer),P(a,this.startContainer))throw new M("HIERARCHY_REQUEST_ERR");var b=h(a,this.startContainer,this.startOffset);this.setStartBefore(b)},cloneContents:function(){z(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();if(this.startContainer===this.endContainer&&N(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;var c=new p(this,!0);return a=j(c),c.detach(),a},canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},surroundContents:function(a){if(s(a,ba),!this.canSurroundContents())throw new M("INVALID_STATE_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);h(a,this.startContainer,this.startOffset),a.appendChild(b),this.selectNode(a)},cloneRange:function(){z(this);for(var a,b=new I(d(this)),c=ja.length;c--;)a=ja[c],b[a]=this[a];return b},toString:function(){z(this);var a=this.startContainer;if(a===this.endContainer&&N(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],c=new p(this,!0);return k(c,function(a){(3==a.nodeType||4==a.nodeType)&&b.push(a.data)}),c.detach(),b.join("")},compareNode:function(a){z(this);var b=a.parentNode,c=O(a);if(!b)throw new M("NOT_FOUND_ERR");var d=this.comparePoint(b,c),e=this.comparePoint(b,c+1);return 0>d?e>0?qa:oa:e>0?pa:ra},comparePoint:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)<0?-1:R(a,b,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:ia,toHtml:function(){return B(this)},intersectsNode:function(a,b){if(z(this),W(a)!=e(this))return!1;var c=a.parentNode,d=O(a);if(!c)return!0;var f=R(c,d,this.endContainer,this.endOffset),g=R(c,d+1,this.startContainer,this.startOffset);return b?0>=f&&g>=0:0>f&&g>0},isPointInRange:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)>=0&&R(a,b,this.endContainer,this.endOffset)<=0},intersectsRange:function(a){return i(this,a,!1)},intersectsOrTouchesRange:function(a){return i(this,a,!0)},intersection:function(a){if(this.intersectsRange(a)){var b=R(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=R(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();return-1==b&&d.setStart(a.startContainer,a.startOffset),1==c&&d.setEnd(a.endContainer,a.endOffset),d}return null},union:function(a){if(this.intersectsOrTouchesRange(a)){var b=this.cloneRange();return-1==R(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset),1==R(a.endContainer,a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset), -b}throw new M("Ranges do not intersect")},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==ra},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,U(a))<=0},containsRange:function(a){var b=this.intersection(a);return null!==b&&a.equals(b)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);if(c.length>0){b.setStart(c[0],0);var d=c.pop();return b.setEnd(d,d.length),this.containsRange(b)}return this.containsNodeContents(a)},getNodes:function(a,b){return z(this),n(this,a,b)},getDocument:function(){return d(this)},collapseBefore:function(a){this.setEndBefore(a),this.collapse(!1)},collapseAfter:function(a){this.setStartAfter(a),this.collapse(!0)},getBookmark:function(b){var c=d(this),e=a.createRange(c);b=b||J.getBody(c),e.selectNodeContents(b);var f=this.intersection(e),g=0,h=0;return f&&(e.setEnd(f.startContainer,f.startOffset),g=e.toString().length,h=g+f.toString().length),{start:g,end:h,containerNode:b}},moveToBookmark:function(a){var b=a.containerNode,c=0;this.setStart(b,0),this.collapse(!0);for(var d,e,f,g,h=[b],i=!1,j=!1;!j&&(d=h.pop());)if(3==d.nodeType)e=c+d.length,!i&&a.start>=c&&a.start<=e&&(this.setStart(d,a.start-c),i=!0),i&&a.end>=c&&a.end<=e&&(this.setEnd(d,a.end-c),j=!0),c=e;else for(g=d.childNodes,f=g.length;f--;)h.push(g[f])},getName:function(){return"DomRange"},equals:function(a){return I.rangesEqual(this,a)},isValid:function(){return y(this)},inspect:function(){return o(this)},detach:function(){}}),F(I,H),K.extend(I,{rangeProperties:ja,RangeIterator:p,copyComparisonConstants:D,createPrototypeRange:F,inspect:o,toHtml:B,getRangeDocument:d,rangesEqual:function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset}}),a.DomRange=I}),H.createCoreModule("WrappedRange",["DomRange"],function(a,b){var c,d,e=a.dom,f=a.util,g=e.DomPosition,h=a.DomRange,i=e.getBody,j=e.getContentDocument,k=e.isCharacterDataNode;if(a.features.implementsDomRange&&!function(){function d(a){for(var b,c=m.length;c--;)b=m[c],a[b]=a.nativeRange[b];a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset}function g(a,b,c,d,e){var f=a.startContainer!==b||a.startOffset!=c,g=a.endContainer!==d||a.endOffset!=e,h=!a.equals(a.nativeRange);(f||g||h)&&(a.setEnd(d,e),a.setStart(b,c))}var k,l,m=h.rangeProperties;c=function(a){if(!a)throw b.createError("WrappedRange: Range must be specified");this.nativeRange=a,d(this)},h.createPrototypeRange(c,g),k=c.prototype,k.selectNode=function(a){this.nativeRange.selectNode(a),d(this)},k.cloneContents=function(){return this.nativeRange.cloneContents()},k.surroundContents=function(a){this.nativeRange.surroundContents(a),d(this)},k.collapse=function(a){this.nativeRange.collapse(a),d(this)},k.cloneRange=function(){return new c(this.nativeRange.cloneRange())},k.refresh=function(){d(this)},k.toString=function(){return this.nativeRange.toString()};var n=document.createTextNode("test");i(document).appendChild(n);var o=document.createRange();o.setStart(n,0),o.setEnd(n,0);try{o.setStart(n,1),k.setStart=function(a,b){this.nativeRange.setStart(a,b),d(this)},k.setEnd=function(a,b){this.nativeRange.setEnd(a,b),d(this)},l=function(a){return function(b){this.nativeRange[a](b),d(this)}}}catch(p){k.setStart=function(a,b){try{this.nativeRange.setStart(a,b)}catch(c){this.nativeRange.setEnd(a,b),this.nativeRange.setStart(a,b)}d(this)},k.setEnd=function(a,b){try{this.nativeRange.setEnd(a,b)}catch(c){this.nativeRange.setStart(a,b),this.nativeRange.setEnd(a,b)}d(this)},l=function(a,b){return function(c){try{this.nativeRange[a](c)}catch(e){this.nativeRange[b](c),this.nativeRange[a](c)}d(this)}}}k.setStartBefore=l("setStartBefore","setEndBefore"),k.setStartAfter=l("setStartAfter","setEndAfter"),k.setEndBefore=l("setEndBefore","setStartBefore"),k.setEndAfter=l("setEndAfter","setStartAfter"),k.selectNodeContents=function(a){this.setStartAndEnd(a,0,e.getNodeLength(a))},o.selectNodeContents(n),o.setEnd(n,3);var q=document.createRange();q.selectNodeContents(n),q.setEnd(n,4),q.setStart(n,2),-1==o.compareBoundaryPoints(o.START_TO_END,q)&&1==o.compareBoundaryPoints(o.END_TO_START,q)?k.compareBoundaryPoints=function(a,b){return b=b.nativeRange||b,a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&(a=b.START_TO_END),this.nativeRange.compareBoundaryPoints(a,b)}:k.compareBoundaryPoints=function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};var r=document.createElement("div");r.innerHTML="123";var s=r.firstChild,t=i(document);t.appendChild(r),o.setStart(s,1),o.setEnd(s,2),o.deleteContents(),"13"==s.data&&(k.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},k.extractContents=function(){var a=this.nativeRange.extractContents();return d(this),a}),t.removeChild(r),t=null,f.isHostMethod(o,"createContextualFragment")&&(k.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)}),i(document).removeChild(n),k.getName=function(){return"WrappedRange"},a.WrappedRange=c,a.createNativeRange=function(a){return a=j(a,b,"createNativeRange"),a.createRange()}}(),a.features.implementsTextRange){var l=function(a){var b=a.parentElement(),c=a.duplicate();c.collapse(!0);var d=c.parentElement();c=a.duplicate(),c.collapse(!1);var f=c.parentElement(),g=d==f?d:e.getCommonAncestor(d,f);return g==b?g:e.getCommonAncestor(b,g)},m=function(a){return 0==a.compareEndPoints("StartToEnd",a)},n=function(a,b,c,d,f){var h=a.duplicate();h.collapse(c);var i=h.parentElement();if(e.isOrIsAncestorOf(b,i)||(i=b),!i.canHaveHTML){var j=new g(i.parentNode,e.getNodeIndex(i));return{boundaryPosition:j,nodeInfo:{nodeIndex:j.offset,containerElement:j.node}}}var l=e.getDocument(i).createElement("span");l.parentNode&&e.removeNode(l);for(var m,n,o,p,q,r=c?"StartToStart":"StartToEnd",s=f&&f.containerElement==i?f.nodeIndex:0,t=i.childNodes.length,u=t,v=u;;){if(v==t?i.appendChild(l):i.insertBefore(l,i.childNodes[v]),h.moveToElementText(l),m=h.compareEndPoints(r,a),0==m||s==u)break;if(-1==m){if(u==s+1)break;s=v}else u=u==s+1?s:v;v=Math.floor((s+u)/2),i.removeChild(l)}if(q=l.nextSibling,-1==m&&q&&k(q)){h.setEndPoint(c?"EndToStart":"EndToEnd",a);var w;if(/[\r\n]/.test(q.data)){var x=h.duplicate(),y=x.text.replace(/\r\n/g,"\r").length;for(w=x.moveStart("character",y);-1==(m=x.compareEndPoints("StartToEnd",x));)w++,x.moveStart("character",1)}else w=h.text.length;p=new g(q,w)}else n=(d||!c)&&l.previousSibling,o=(d||c)&&l.nextSibling,p=o&&k(o)?new g(o,0):n&&k(n)?new g(n,n.data.length):new g(i,e.getNodeIndex(l));return e.removeNode(l),{boundaryPosition:p,nodeInfo:{nodeIndex:v,containerElement:i}}},o=function(a,b){var c,d,f,g,h=a.offset,j=e.getDocument(a.node),l=i(j).createTextRange(),m=k(a.node);return m?(c=a.node,d=c.parentNode):(g=a.node.childNodes,c=hb;++b)if(!C.isAncestorOf(a[0],a[b]))return!1;return!0}function m(a){var c=a.getNodes();if(!l(c))throw b.createError("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return c[0]}function n(a){return!!a&&"undefined"!=typeof a.text}function o(a,b){var c=new G(b);a._ranges=[c],h(a,c,!1),a.rangeCount=1,a.isCollapsed=c.collapsed}function p(b){if(b._ranges.length=0,"None"==b.docSelection.type)j(b);else{var c=b.docSelection.createRange();if(n(c))o(b,c);else{b.rangeCount=c.length;for(var d,e=L(c.item(0)),f=0;fh;++h)g.add(d.item(h));try{g.add(e)}catch(j){throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}g.select(),p(a)}function r(a,b,c){this.nativeSelection=a,this.docSelection=b,this._ranges=[],this.win=c,this.refresh()}function s(a){a.win=a.anchorNode=a.focusNode=a._ranges=null,a.rangeCount=a.anchorOffset=a.focusOffset=0,a.detached=!0}function t(a,b){for(var c,d,e=ba.length;e--;)if(c=ba[e],d=c.selection,"deleteAll"==b)s(d);else if(c.win==a)return"delete"==b?(ba.splice(e,1),!0):d;return"deleteAll"==b&&(ba.length=0),null}function u(a,c){for(var d,e=L(c[0].startContainer),f=M(e).createControlRange(),g=0,h=c.length;h>g;++g){d=m(c[g]);try{f.add(d)}catch(i){throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}f.select(),p(a)}function v(a,b){if(a.win.document!=L(b))throw new H("WRONG_DOCUMENT_ERR")}function w(b){return function(c,d){var e;this.rangeCount?(e=this.getRangeAt(0),e["set"+(b?"Start":"End")](c,d)):(e=a.createRange(this.win.document),e.setStartAndEnd(c,d)),this.setSingleRange(e,this.isBackward())}}function x(a){var b=[],c=new I(a.anchorNode,a.anchorOffset),d=new I(a.focusNode,a.focusOffset),e="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var f=0,g=a.rangeCount;g>f;++f)b[f]=F.inspect(a.getRangeAt(f));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}a.config.checkSelectionRanges=!0;var y,z,A="boolean",B="number",C=a.dom,D=a.util,E=D.isHostMethod,F=a.DomRange,G=a.WrappedRange,H=a.DOMException,I=C.DomPosition,J=a.features,K="Control",L=C.getDocument,M=C.getBody,N=F.rangesEqual,O=E(window,"getSelection"),P=D.isHostObject(document,"selection");J.implementsWinGetSelection=O,J.implementsDocSelection=P;var Q=P&&(!O||a.config.preferTextRange);if(Q)y=f,a.isSelectionValid=function(a){var b=d(a,"isSelectionValid").document,c=b.selection;return"None"!=c.type||L(c.createRange().parentElement())==b};else{if(!O)return b.fail("Neither document.selection or window.getSelection() detected."),!1;y=e,a.isSelectionValid=function(){return!0}}a.getNativeSelection=y;var R=y();if(!R)return b.fail("Native selection was null (possibly issue 138?)"),!1;var S=a.createNativeRange(document),T=M(document),U=D.areHostProperties(R,["anchorNode","focusNode","anchorOffset","focusOffset"]);J.selectionHasAnchorAndFocus=U;var V=E(R,"extend");J.selectionHasExtend=V;var W=typeof R.rangeCount==B;J.selectionHasRangeCount=W;var X=!1,Y=!0,Z=V?function(b,c){var d=F.getRangeDocument(c),e=a.createRange(d);e.collapseToPoint(c.endContainer,c.endOffset),b.addRange(k(e)),b.extend(c.startContainer,c.startOffset)}:null;D.areHostMethods(R,["addRange","getRangeAt","removeAllRanges"])&&typeof R.rangeCount==B&&J.implementsDomRange&&!function(){var b=window.getSelection();if(b){for(var c=b.rangeCount,d=c>1,e=[],f=g(b),h=0;c>h;++h)e[h]=b.getRangeAt(h);var i=C.createTestElement(document,"",!1),j=i.appendChild(document.createTextNode("   ")),k=document.createRange();if(k.setStart(j,1),k.collapse(!0),b.removeAllRanges(),b.addRange(k),Y=1==b.rangeCount,b.removeAllRanges(),!d){var l=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(l&&parseInt(l[1])>=36)X=!1;else{var m=k.cloneRange();k.setStart(j,0),m.setEnd(j,3),m.setStart(j,2),b.addRange(k),b.addRange(m),X=2==b.rangeCount}}for(C.removeNode(i),b.removeAllRanges(),h=0;c>h;++h)0==h&&f?Z?Z(b,e[h]):(a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),b.addRange(e[h])):b.addRange(e[h])}}(),J.selectionSupportsMultipleRanges=X,J.collapsedNonEditableSelectionsSupported=Y;var $,_=!1;T&&E(T,"createControlRange")&&($=T.createControlRange(),D.areHostProperties($,["item","add"])&&(_=!0)),J.implementsControlRange=_,z=U?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var aa;E(R,"getRangeAt")?aa=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:U&&(aa=function(b){var c=L(b.anchorNode),d=a.createRange(c);return d.setStartAndEnd(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),d.collapsed!==this.isCollapsed&&d.setStartAndEnd(b.focusNode,b.focusOffset,b.anchorNode,b.anchorOffset),d}),r.prototype=a.selectionPrototype;var ba=[],ca=function(a){if(a&&a instanceof r)return a.refresh(),a;a=d(a,"getNativeSelection");var b=t(a),c=y(a),e=P?f(a):null;return b?(b.nativeSelection=c,b.docSelection=e,b.refresh()):(b=new r(c,e,a),ba.push({win:a,selection:b})),b};a.getSelection=ca,D.createAliasForDeprecatedMethod(a,"getIframeSelection","getSelection");var da=r.prototype;if(!Q&&U&&D.areHostMethods(R,["removeAllRanges","addRange"])){da.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),j(this)};var ea=function(a,b){Z(a.nativeSelection,b),a.refresh()};W?da.addRange=function(b,d){if(_&&P&&this.docSelection.type==K)q(this,b);else if(c(d)&&V)ea(this,b);else{var e;X?e=this.rangeCount:(this.removeAllRanges(),e=0);var f=k(b).cloneRange();try{this.nativeSelection.addRange(f)}catch(g){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==e+1){if(a.config.checkSelectionRanges){var i=aa(this.nativeSelection,this.rangeCount-1);i&&!N(i,b)&&(b=new G(i))}this._ranges[this.rangeCount-1]=b,h(this,b,ha(this.nativeSelection)),this.isCollapsed=z(this)}else this.refresh()}}:da.addRange=function(a,b){c(b)&&V?ea(this,a):(this.nativeSelection.addRange(k(a)),this.refresh())},da.setRanges=function(a){if(_&&P&&a.length>1)u(this,a);else{this.removeAllRanges();for(var b=0,c=a.length;c>b;++b)this.addRange(a[b])}}}else{if(!(E(R,"empty")&&E(S,"select")&&_&&Q))return b.fail("No means of selecting a Range or TextRange was found"),!1;da.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var a;if(this.anchorNode)a=L(this.anchorNode);else if(this.docSelection.type==K){var b=this.docSelection.createRange();b.length&&(a=L(b.item(0)))}if(a){var c=M(a).createTextRange();c.select(),this.docSelection.empty()}}}catch(d){}j(this)},da.addRange=function(b){this.docSelection.type==K?q(this,b):(a.WrappedTextRange.rangeToTextRange(b).select(),this._ranges[0]=b,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,h(this,b,!1))},da.setRanges=function(a){this.removeAllRanges();var b=a.length;b>1?u(this,a):b&&this.addRange(a[0])}}da.getRangeAt=function(a){if(0>a||a>=this.rangeCount)throw new H("INDEX_SIZE_ERR");return this._ranges[a].cloneRange()};var fa;if(Q)fa=function(b){var c;a.isSelectionValid(b.win)?c=b.docSelection.createRange():(c=M(b.win.document).createTextRange(),c.collapse(!0)),b.docSelection.type==K?p(b):n(c)?o(b,c):j(b)};else if(E(R,"getRangeAt")&&typeof R.rangeCount==B)fa=function(b){if(_&&P&&b.docSelection.type==K)p(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,b.rangeCount){for(var c=0,d=b.rangeCount;d>c;++c)b._ranges[c]=new a.WrappedRange(b.nativeSelection.getRangeAt(c));h(b,b._ranges[b.rangeCount-1],ha(b.nativeSelection)),b.isCollapsed=z(b)}else j(b)};else{if(!U||typeof R.isCollapsed!=A||typeof S.collapsed!=A||!J.implementsDomRange)return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;fa=function(a){var b,c=a.nativeSelection;c.anchorNode?(b=aa(c,0),a._ranges=[b],a.rangeCount=1,i(a),a.isCollapsed=z(a)):j(a)}}da.refresh=function(a){var b=a?this._ranges.slice(0):null,c=this.anchorNode,d=this.anchorOffset;if(fa(this),a){var e=b.length;if(e!=this._ranges.length)return!0;if(this.anchorNode!=c||this.anchorOffset!=d)return!0;for(;e--;)if(!N(b[e],this._ranges[e]))return!0;return!1}};var ga=function(a,b){var c=a.getAllRanges();a.removeAllRanges();for(var d=0,e=c.length;e>d;++d)N(b,c[d])||a.addRange(c[d]);a.rangeCount||j(a)};_&&P?da.removeRange=function(a){if(this.docSelection.type==K){for(var b,c=this.docSelection.createRange(),d=m(a),e=L(c.item(0)),f=M(e).createControlRange(),g=!1,h=0,i=c.length;i>h;++h)b=c.item(h),b!==d||g?f.add(c.item(h)):g=!0;f.select(),p(this)}else ga(this,a)}:da.removeRange=function(a){ga(this,a)};var ha;!Q&&U&&J.implementsDomRange?(ha=g,da.isBackward=function(){return ha(this)}):ha=da.isBackward=function(){return!1},da.isBackwards=da.isBackward,da.toString=function(){for(var a=[],b=0,c=this.rangeCount;c>b;++b)a[b]=""+this._ranges[b];return a.join("")},da.collapse=function(b,c){v(this,b);var d=a.createRange(b);d.collapseToPoint(b,c),this.setSingleRange(d),this.isCollapsed=!0},da.collapseToStart=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)},da.collapseToEnd=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)},da.selectAllChildren=function(b){v(this,b);var c=a.createRange(b);c.selectNodeContents(b),this.setSingleRange(c)},da.deleteFromDocument=function(){if(_&&P&&this.docSelection.type==K){for(var a,b=this.docSelection.createRange();b.length;)a=b.item(0),b.remove(a),C.removeNode(a);this.refresh()}else if(this.rangeCount){var c=this.getAllRanges();if(c.length){this.removeAllRanges();for(var d=0,e=c.length;e>d;++d)c[d].deleteContents();this.addRange(c[e-1])}}},da.eachRange=function(a,b){for(var c=0,d=this._ranges.length;d>c;++c)if(a(this.getRangeAt(c)))return b},da.getAllRanges=function(){var a=[];return this.eachRange(function(b){a.push(b)}),a},da.setSingleRange=function(a,b){this.removeAllRanges(),this.addRange(a,b)},da.callMethodOnEachRange=function(a,b){var c=[];return this.eachRange(function(d){c.push(d[a].apply(d,b||[]))}),c},da.setStart=w(!0),da.setEnd=w(!1),a.rangePrototype.select=function(a){ca(this.getDocument()).setSingleRange(this,a)},da.changeEachRange=function(a){var b=[],c=this.isBackward();this.eachRange(function(c){a(c),b.push(c)}),this.removeAllRanges(),c&&1==b.length?this.addRange(b[0],"backward"):this.setRanges(b)},da.containsNode=function(a,b){return this.eachRange(function(c){return c.containsNode(a,b)},!0)||!1},da.getBookmark=function(a){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[a])}},da.moveToBookmark=function(b){for(var c,d,e=[],f=0;c=b.rangeBookmarks[f++];)d=a.createRange(this.win),d.moveToBookmark(c),e.push(d);b.backward?this.setSingleRange(e[0],"backward"):this.setRanges(e)},da.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},da.restoreRanges=function(a){this.removeAllRanges();for(var b,c=0;b=a.ranges[c];++c)this.addRange(b,a.backward&&0==c)},da.toHtml=function(){var a=[];return this.eachRange(function(b){a.push(F.toHtml(b))}),a.join("")},J.implementsTextRange&&(da.getNativeTextRange=function(){var c;if(c=this.docSelection){var d=c.createRange();if(n(d))return d;throw b.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return a.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw b.createError("getNativeTextRange: selection contains no range")}),da.getName=function(){return"WrappedSelection"},da.inspect=function(){return x(this)},da.detach=function(){t(this.win,"delete"),s(this)},r.detachAll=function(){t(null,"deleteAll")},r.inspect=x,r.isDirectionBackward=c,a.Selection=r,a.selectionPrototype=da,a.addShimListener(function(a){"undefined"==typeof a.getSelection&&(a.getSelection=function(){return ca(a)}),a=null})});var M=!1,N=function(a){M||(M=!0,!H.initialized&&H.config.autoInitialize&&l())};return F&&("complete"==document.readyState?N():(a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",N,!1),J(window,"load",N))),H},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("TextRange",["WrappedSelection"],function(a,b){function c(a,b){function c(a,b,c){h.push({start:a,end:b,isWord:c})}for(var d,e,f,g=a.join(""),h=[],i=0;d=b.wordRegex.exec(g);){if(e=d.index,f=e+d[0].length,e>i&&c(i,e,!1),b.includeTrailingSpace)for(;$.test(a[f]);)++f;c(e,f,!0),i=f}return ie;++e)c[e].token=d;return d}function e(a,b,c){for(var e,f=c(a,b),g=[],h=0;e=f[h++];)g.push(d(a,e));return g}function f(a){var b=a||"",c="string"==typeof b?b.split(""):b;return c.sort(function(a,b){return a.charCodeAt(0)-b.charCodeAt(0)}),c.join("").replace(/(.)\1+/g,"$1")}function g(a){var b,c;return a?(b=a.language||_,c={},U(c,ia[b]||ia[_]),U(c,a),c):ia[_]}function h(a,b){var c=V(a,b);return b.hasOwnProperty("wordOptions")&&(c.wordOptions=g(c.wordOptions)),b.hasOwnProperty("characterOptions")&&(c.characterOptions=V(c.characterOptions,ga)),c}function i(a,b){var c=na(a,"display",b),d=a.tagName.toLowerCase();return"block"==c&&fa&&oa.hasOwnProperty(d)?oa[d]:c}function j(a){for(var b=o(a),c=0,d=b.length;d>c;++c)if(1==b[c].nodeType&&"none"==i(b[c]))return!0;return!1}function k(a){var b;return 3==a.nodeType&&(b=a.parentNode)&&"hidden"==na(b,"visibility")}function l(a){return a&&(1==a.nodeType&&!/^(inline(-block|-table)?|none)$/.test(i(a))||9==a.nodeType||11==a.nodeType)}function m(a){return S.isCharacterDataNode(a)||!/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i.test(a.nodeName)}function n(a){for(var b=[];a.parentNode;)b.unshift(a.parentNode),a=a.parentNode;return b}function o(a){return n(a).concat([a])}function p(a){for(;a&&!a.nextSibling;)a=a.parentNode;return a?a.nextSibling:null}function q(a,b){return!b&&a.hasChildNodes()?a.firstChild:p(a)}function r(a){var b=a.previousSibling;if(b){for(a=b;a.hasChildNodes();)a=a.lastChild;return a}var c=a.parentNode;return c&&1==c.nodeType?c:null}function s(a){if(!a||3!=a.nodeType)return!1;var b=a.data;if(""===b)return!0;var c=a.parentNode;if(!c||1!=c.nodeType)return!1;var d=na(a.parentNode,"whiteSpace");return/^[\t\n\r ]+$/.test(b)&&/^(normal|nowrap)$/.test(d)||/^[\t\r ]+$/.test(b)&&"pre-line"==d}function t(a){if(""===a.data)return!0;if(!s(a))return!1;var b=a.parentNode;return b?j(a)?!0:!1:!0}function u(a){var b=a.nodeType;return 7==b||8==b||j(a)||/^(script|style)$/i.test(a.nodeName)||k(a)||t(a)}function v(a,b){var c=a.nodeType;return 7==c||8==c||1==c&&"none"==i(a,b)}function w(){this.store={}}function x(a,b,c){return function(d){var e=this.cache;if(e.hasOwnProperty(a))return pa++,e[a];qa++;var f=b.call(this,c?this[c]:this,d);return e[a]=f,f}}function y(a,b){this.node=a,this.session=b,this.cache=new w,this.positions=new w}function z(a,b){this.offset=b,this.nodeWrapper=a,this.node=a.node,this.session=a.session,this.cache=new w}function A(){return"[Position("+S.inspectNode(this.node)+":"+this.offset+")]"}function B(){return D(),Da=new Ea}function C(){return Da||B()}function D(){Da&&Da.detach(),Da=null}function E(a,c,d,e){function f(){var a=null;return c?(a=h,i||(h=h.previousVisible(),i=!h||d&&h.equals(d))):i||(a=h=h.nextVisible(),i=!h||d&&h.equals(d)),i&&(h=null),a}d&&(c?u(d.node)&&(d=a.previousVisible()):u(d.node)&&(d=d.nextVisible()));var g,h=a,i=!1,j=!1;return{next:function(){if(j)return j=!1,g;for(var a,b;a=f();)if(b=a.getCharacter(e))return g=a,a;return null},rewind:function(){if(!g)throw b.createError("createCharacterIterator: cannot rewind. Only one position can be rewound.");j=!0},dispose:function(){a=d=null}}}function F(a,b,c){function d(a){for(var b,c,d=[],e=a?f:g,h=!1,i=!1;b=e.next();){if(c=b.character,Z.test(c))i&&(i=!1,h=!0);else{if(h){e.rewind();break}i=!0}d.push(b)}return d}var f=E(a,!1,null,b),g=E(a,!0,null,b),h=c.tokenizer,i=d(!0),j=d(!1).reverse(),k=e(j.concat(i),c,h),l=i.length?k.slice(Fa(k,i[0].token)):[],m=j.length?k.slice(0,Fa(k,j.pop().token)+1):[];return{nextEndToken:function(){for(var a,b;1==l.length&&!(a=l[0]).isWord&&(b=d(!0)).length>0;)l=e(a.chars.concat(b),c,h);return l.shift()},previousStartToken:function(){for(var a,b;1==m.length&&!(a=m[0]).isWord&&(b=d(!1)).length>0;)m=e(b.reverse().concat(a.chars),c,h);return m.pop()},dispose:function(){f.dispose(),g.dispose(),l=m=null}}}function G(a,b,c,d,e){var f,g,h,i,j=0,k=a,l=Math.abs(c);if(0!==c){var m=0>c;switch(b){case Q:for(g=E(a,m,null,d);(f=g.next())&&l>j;)++j,k=f;h=f,g.dispose();break;case R:for(var n=F(a,d,e),o=m?n.previousStartToken:n.nextEndToken;(i=o())&&l>j;)i.isWord&&(++j,k=m?i.chars[0]:i.chars[i.chars.length-1]);break;default:throw new Error("movePositionBy: unit '"+b+"' not implemented")}m?(k=k.previousVisible(),j=-j):k&&k.isLeadingSpace&&!k.isTrailingSpace&&(b==R&&(g=E(a,!1,null,d),h=g.next(),g.dispose()),h&&(k=h.previousVisible()))}return{position:k,unitsMoved:j}}function H(a,b,c,d){var e=a.getRangeBoundaryPosition(b,!0),f=a.getRangeBoundaryPosition(b,!1),g=d?f:e,h=d?e:f;return E(g,!!d,h,c)}function I(a,b,c){for(var d,e=[],f=H(a,b,c);d=f.next();)e.push(d);return f.dispose(),e}function J(b,c,d){var e=a.createRange(b.node);return e.setStartAndEnd(b.node,b.offset,c.node,c.offset),!e.expand("word",{wordOptions:d})}function K(a,b,c,d,e){function f(a,b){var c=p[a].previousVisible(),d=p[b-1],f=!e.wholeWordsOnly||J(c,d,e.wordOptions);return{startPos:c,endPos:d,valid:f}}for(var g,h,i,j,k,l,m=aa(e.direction),n=E(a,m,a.session.getRangeBoundaryPosition(d,m),e.characterOptions),o="",p=[],q=null;g=n.next();)if(h=g.character,c||e.caseSensitive||(h=h.toLowerCase()),m?(p.unshift(g),o=h+o):(p.push(g),o+=h),c){if(k=b.exec(o))if(i=k.index,j=i+k[0].length,l){if(!m&&j0){q=f(i,j);break}}else l=!0}else if(-1!=(i=o.indexOf(b))){q=f(i,i+b.length);break}return l&&(q=f(i,j)),n.dispose(),q}function L(a){return function(){var b=!!Da,c=C(),d=[c].concat(T.toArray(arguments)),e=a.apply(this,d);return b||D(),e}}function M(a,b){return L(function(c,d,e,f){typeof e==P&&(e=d,d=Q),f=h(f,ka);var g=a;b&&(g=e>=0,this.collapse(!g));var i=G(c.getRangeBoundaryPosition(this,g),d,e,f.characterOptions,f.wordOptions),j=i.position;return this[g?"setStart":"setEnd"](j.node,j.offset),i.unitsMoved})}function N(a){return L(function(b,c){c=V(c,ga);for(var d,e=H(b,this,c,!a),f=0;(d=e.next())&&Z.test(d.character);)++f;e.dispose();var g=f>0;return g&&this[a?"moveStart":"moveEnd"]("character",a?f:-f,{characterOptions:c}),g})}function O(a){return L(function(b,c){var d=!1;return this.changeEachRange(function(b){d=b[a](c)||d}),d})}var P="undefined",Q="character",R="word",S=a.dom,T=a.util,U=T.extend,V=T.createOptions,W=S.getBody,X=/^[ \t\f\r\n]+$/,Y=/^[ \t\f\r]+$/,Z=/^[\t-\r \u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/,$=/^[\t \u00A0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000]+$/,_="en",aa=a.Selection.isDirectionBackward,ba=!1,ca=!1,da=!1,ea=!0;!function(){var b=S.createTestElement(document,"

    1

    ",!0),c=b.firstChild,d=a.getSelection();d.collapse(c.lastChild,2),d.setStart(c.firstChild,0),ba=1==(""+d).length,b.innerHTML="1
    ",d.collapse(b,2),d.setStart(b.firstChild,0),ca=1==(""+d).length,b.innerHTML="1

    1

    ",d.collapse(b,2),d.setStart(b.firstChild,0),da=1==(""+d).length,S.removeNode(b),d.removeAllRanges()}();var fa,ga={includeBlockContentTrailingSpace:!0,includeSpaceBeforeBr:!0,includeSpaceBeforeBlock:!0,includePreLineTrailingSpace:!0,ignoreCharacters:""},ha={includeBlockContentTrailingSpace:!ea,includeSpaceBeforeBr:!ca,includeSpaceBeforeBlock:!da,includePreLineTrailingSpace:!0},ia={en:{wordRegex:/[a-z0-9]+('[a-z0-9]+)*/gi,includeTrailingSpace:!1,tokenizer:c}},ja={caseSensitive:!1,withinRange:null,wholeWordsOnly:!1,wrap:!1,direction:"forward",wordOptions:null,characterOptions:null},ka={wordOptions:null,characterOptions:null},la={wordOptions:null,characterOptions:null,trim:!1,trimStart:!0,trimEnd:!0},ma={wordOptions:null,characterOptions:null,direction:"forward"},na=S.getComputedStyleProperty;!function(){var a=document.createElement("table"),b=W(document);b.appendChild(a),fa="block"==na(a,"display"),b.removeChild(a)}();var oa={table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell"};w.prototype={get:function(a){return this.store.hasOwnProperty(a)?this.store[a]:null},set:function(a,b){return this.store[a]=b}};var pa=0,qa=0,ra={getPosition:function(a){var b=this.positions;return b.get(a)||b.set(a,new z(this,a))},toString:function(){return"[NodeWrapper("+S.inspectNode(this.node)+")]"}};y.prototype=ra;var sa="EMPTY",ta="NON_SPACE",ua="UNCOLLAPSIBLE_SPACE",va="COLLAPSIBLE_SPACE",wa="TRAILING_SPACE_BEFORE_BLOCK",xa="TRAILING_SPACE_IN_BLOCK",ya="TRAILING_SPACE_BEFORE_BR",za="PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK",Aa="TRAILING_LINE_BREAK_AFTER_BR",Ba="INCLUDED_TRAILING_LINE_BREAK_AFTER_BR";U(ra,{isCharacterDataNode:x("isCharacterDataNode",S.isCharacterDataNode,"node"),getNodeIndex:x("nodeIndex",S.getNodeIndex,"node"),getLength:x("nodeLength",S.getNodeLength,"node"),containsPositions:x("containsPositions",m,"node"),isWhitespace:x("isWhitespace",s,"node"), -isCollapsedWhitespace:x("isCollapsedWhitespace",t,"node"),getComputedDisplay:x("computedDisplay",i,"node"),isCollapsed:x("collapsed",u,"node"),isIgnored:x("ignored",v,"node"),next:x("nextPos",q,"node"),previous:x("previous",r,"node"),getTextNodeInfo:x("textNodeInfo",function(a){var b=null,c=!1,d=na(a.parentNode,"whiteSpace"),e="pre-line"==d;return e?(b=Y,c=!0):("normal"==d||"nowrap"==d)&&(b=X,c=!0),{node:a,text:a.data,spaceRegex:b,collapseSpaces:c,preLine:e}},"node"),hasInnerText:x("hasInnerText",function(a,b){for(var c=this.session,d=c.getPosition(a.parentNode,this.getNodeIndex()+1),e=c.getPosition(a,0),f=b?d:e,g=b?e:d;f!==g;){if(f.prepopulateChar(),f.isDefinitelyNonEmpty())return!0;f=b?f.previousVisible():f.nextVisible()}return!1},"node"),isRenderedBlock:x("isRenderedBlock",function(a){for(var b=a.getElementsByTagName("br"),c=0,d=b.length;d>c;++c)if(!u(b[c]))return!0;return this.hasInnerText()},"node"),getTrailingSpace:x("trailingSpace",function(a){if("br"==a.tagName.toLowerCase())return"";switch(this.getComputedDisplay()){case"inline":for(var b=a.lastChild;b;){if(!v(b))return 1==b.nodeType?this.session.getNodeWrapper(b).getTrailingSpace():"";b=b.previousSibling}break;case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":break;case"table-cell":return" ";default:return this.isRenderedBlock(!0)?"\n":""}return""},"node"),getLeadingSpace:x("leadingSpace",function(a){switch(this.getComputedDisplay()){case"inline":case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":case"table-cell":break;default:return this.isRenderedBlock(!1)?"\n":""}return""},"node")});var Ca={character:"",characterType:sa,isBr:!1,prepopulateChar:function(){var a=this;if(!a.prepopulatedChar){var b=a.node,c=a.offset,d="",e=sa,f=!1;if(c>0)if(3==b.nodeType){var g=b.data,h=g.charAt(c-1),i=a.nodeWrapper.getTextNodeInfo(),j=i.spaceRegex;i.collapseSpaces?j.test(h)?c>1&&j.test(g.charAt(c-2))||(i.preLine&&"\n"===g.charAt(c)?(d=" ",e=za):(d=" ",e=va)):(d=h,e=ta,f=!0):(d=h,e=ua,f=!0)}else{var k=b.childNodes[c-1];if(k&&1==k.nodeType&&!u(k)&&("br"==k.tagName.toLowerCase()?(d="\n",a.isBr=!0,e=va,f=!1):a.checkForTrailingSpace=!0),!d){var l=b.childNodes[c];l&&1==l.nodeType&&!u(l)&&(a.checkForLeadingSpace=!0)}}a.prepopulatedChar=!0,a.character=d,a.characterType=e,a.isCharInvariant=f}},isDefinitelyNonEmpty:function(){var a=this.characterType;return a==ta||a==ua},resolveLeadingAndTrailingSpaces:function(){if(this.prepopulatedChar||this.prepopulateChar(),this.checkForTrailingSpace){var a=this.session.getNodeWrapper(this.node.childNodes[this.offset-1]).getTrailingSpace();a&&(this.isTrailingSpace=!0,this.character=a,this.characterType=va),this.checkForTrailingSpace=!1}if(this.checkForLeadingSpace){var b=this.session.getNodeWrapper(this.node.childNodes[this.offset]).getLeadingSpace();b&&(this.isLeadingSpace=!0,this.character=b,this.characterType=va),this.checkForLeadingSpace=!1}},getPrecedingUncollapsedPosition:function(a){for(var b,c=this;c=c.previousVisible();)if(b=c.getCharacter(a),""!==b)return c;return null},getCharacter:function(a){function b(){return n||(k=o.getPrecedingUncollapsedPosition(a),n=!0),k}this.resolveLeadingAndTrailingSpaces();var c,d=this.character,e=f(a.ignoreCharacters),g=""!==d&&e.indexOf(d)>-1;if(this.isCharInvariant)return c=g?"":d;var h=["character",a.includeSpaceBeforeBr,a.includeBlockContentTrailingSpace,a.includePreLineTrailingSpace,e].join("_"),i=this.cache.get(h);if(null!==i)return i;var j,k,l="",m=this.characterType==va,n=!1,o=this;return m&&(this.type==Ba?l="\n":" "==d&&(!b()||k.isTrailingSpace||"\n"==k.character||" "==k.character&&k.characterType==va)||("\n"==d&&this.isLeadingSpace?b()&&"\n"!=k.character&&(l="\n"):(j=this.nextUncollapsed(),j&&(j.isBr?this.type=ya:j.isTrailingSpace&&"\n"==j.character?this.type=xa:j.isLeadingSpace&&"\n"==j.character&&(this.type=wa),"\n"==j.character?(this.type!=ya||a.includeSpaceBeforeBr)&&(this.type!=wa||a.includeSpaceBeforeBlock)&&(this.type==xa&&j.isTrailingSpace&&!a.includeBlockContentTrailingSpace||(this.type!=za||j.type!=ta||a.includePreLineTrailingSpace)&&("\n"==d?j.isTrailingSpace?this.isTrailingSpace||this.isBr&&(j.type=Aa,b()&&k.isLeadingSpace&&!k.isTrailingSpace&&"\n"==k.character?j.character="":j.type=Ba):l="\n":" "==d&&(l=" "))):l=d)))),e.indexOf(l)>-1&&(l=""),this.cache.set(h,l),l},equals:function(a){return!!a&&this.node===a.node&&this.offset===a.offset},inspect:A,toString:function(){return this.character}};z.prototype=Ca,U(Ca,{next:x("nextPos",function(a){var b=a.nodeWrapper,c=a.node,d=a.offset,e=b.session;if(!c)return null;var f,g,h;return d==b.getLength()?(f=c.parentNode,g=f?b.getNodeIndex()+1:0):b.isCharacterDataNode()?(f=c,g=d+1):(h=c.childNodes[d],e.getNodeWrapper(h).containsPositions()?(f=h,g=0):(f=c,g=d+1)),f?e.getPosition(f,g):null}),previous:x("previous",function(a){var b,c,d,e=a.nodeWrapper,f=a.node,g=a.offset,h=e.session;return 0==g?(b=f.parentNode,c=b?e.getNodeIndex():0):e.isCharacterDataNode()?(b=f,c=g-1):(d=f.childNodes[g-1],h.getNodeWrapper(d).containsPositions()?(b=d,c=S.getNodeLength(d)):(b=f,c=g-1)),b?h.getPosition(b,c):null}),nextVisible:x("nextVisible",function(a){var b=a.next();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex()+1)),e}),nextUncollapsed:x("nextUncollapsed",function(a){for(var b=a;b=b.nextVisible();)if(b.resolveLeadingAndTrailingSpaces(),""!==b.character)return b;return null}),previousVisible:x("previousVisible",function(a){var b=a.previous();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex())),e})});var Da=null,Ea=function(){function a(a){var b=new w;return{get:function(c){var d=b.get(c[a]);if(d)for(var e,f=0;e=d[f++];)if(e.node===c)return e;return null},set:function(c){var d=c.node[a],e=b.get(d)||b.set(d,[]);e.push(c)}}}function b(){this.initCaches()}var c=T.isHostProperty(document.documentElement,"uniqueID");return b.prototype={initCaches:function(){this.elementCache=c?function(){var a=new w;return{get:function(b){return a.get(b.uniqueID)},set:function(b){a.set(b.node.uniqueID,b)}}}():a("tagName"),this.textNodeCache=a("data"),this.otherNodeCache=a("nodeName")},getNodeWrapper:function(a){var b;switch(a.nodeType){case 1:b=this.elementCache;break;case 3:b=this.textNodeCache;break;default:b=this.otherNodeCache}var c=b.get(a);return c||(c=new y(a,this),b.set(c)),c},getPosition:function(a,b){return this.getNodeWrapper(a).getPosition(b)},getRangeBoundaryPosition:function(a,b){var c=b?"start":"end";return this.getPosition(a[c+"Container"],a[c+"Offset"])},detach:function(){this.elementCache=this.textNodeCache=this.otherNodeCache=null}},b}();U(S,{nextNode:q,previousNode:r});var Fa=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)if(a[c]===b)return c;return-1};U(a.rangePrototype,{moveStart:M(!0,!1),moveEnd:M(!1,!1),move:M(!0,!0),trimStart:N(!0),trimEnd:N(!1),trim:L(function(a,b){var c=this.trimStart(b),d=this.trimEnd(b);return c||d}),expand:L(function(a,b,c){var d=!1;c=h(c,la);var e=c.characterOptions;if(b||(b=Q),b==R){var f,g,i=c.wordOptions,j=a.getRangeBoundaryPosition(this,!0),k=a.getRangeBoundaryPosition(this,!1),l=F(j,e,i),m=l.nextEndToken(),n=m.chars[0].previousVisible();if(this.collapsed)f=m;else{var o=F(k,e,i);f=o.previousStartToken()}return g=f.chars[f.chars.length-1],n.equals(j)||(this.setStart(n.node,n.offset),d=!0),g&&!g.equals(k)&&(this.setEnd(g.node,g.offset),d=!0),c.trim&&(c.trimStart&&(d=this.trimStart(e)||d),c.trimEnd&&(d=this.trimEnd(e)||d)),d}return this.moveEnd(Q,1,c)}),text:L(function(a,b){return this.collapsed?"":I(a,this,V(b,ga)).join("")}),selectCharacters:L(function(a,b,c,d,e){var f={characterOptions:e};b||(b=W(this.getDocument())),this.selectNodeContents(b),this.collapse(!0),this.moveStart("character",c,f),this.collapse(!0),this.moveEnd("character",d-c,f)}),toCharacterRange:L(function(a,b,c){b||(b=W(this.getDocument()));var d,e,f=b.parentNode,g=S.getNodeIndex(b),h=-1==S.comparePoints(this.startContainer,this.endContainer,f,g),i=this.cloneRange();return h?(i.setStartAndEnd(this.startContainer,this.startOffset,f,g),d=-i.text(c).length):(i.setStartAndEnd(f,g,this.startContainer,this.startOffset),d=i.text(c).length),e=d+this.text(c).length,{start:d,end:e}}),findText:L(function(b,c,d){d=h(d,ja),d.wholeWordsOnly&&(d.wordOptions.includeTrailingSpace=!1);var e=aa(d.direction),f=d.withinRange;f||(f=a.createRange(),f.selectNodeContents(this.getDocument()));var g=c,i=!1;"string"==typeof g?d.caseSensitive||(g=g.toLowerCase()):i=!0;var j=b.getRangeBoundaryPosition(this,!e),k=f.comparePoint(j.node,j.offset);-1===k?j=b.getRangeBoundaryPosition(f,!0):1===k&&(j=b.getRangeBoundaryPosition(f,!1));for(var l,m=j,n=!1;;)if(l=K(m,g,i,f,d)){if(l.valid)return this.setStartAndEnd(l.startPos.node,l.startPos.offset,l.endPos.node,l.endPos.offset),!0;m=e?l.startPos:l.endPos}else{if(!d.wrap||n)return!1;f=f.cloneRange(),m=b.getRangeBoundaryPosition(f,!e),f.setBoundary(j.node,j.offset,e),n=!0}}),pasteHtml:function(a){if(this.deleteContents(),a){var b=this.createContextualFragment(a),c=b.lastChild;this.insertNode(b),this.collapseAfter(c)}}}),U(a.selectionPrototype,{expand:L(function(a,b,c){this.changeEachRange(function(a){a.expand(b,c)})}),move:L(function(a,b,c,d){var e=0;if(this.focusNode){this.collapse(this.focusNode,this.focusOffset);var f=this.getRangeAt(0);d||(d={}),d.characterOptions=V(d.characterOptions,ha),e=f.move(b,c,d),this.setSingleRange(f)}return e}),trimStart:O("trimStart"),trimEnd:O("trimEnd"),trim:O("trim"),selectCharacters:L(function(b,c,d,e,f,g){var h=a.createRange(c);h.selectCharacters(c,d,e,g),this.setSingleRange(h,f)}),saveCharacterRanges:L(function(a,b,c){for(var d=this.getAllRanges(),e=d.length,f=[],g=1==e&&this.isBackward(),h=0,i=d.length;i>h;++h)f[h]={characterRange:d[h].toCharacterRange(b,c),backward:g,characterOptions:c};return f}),restoreCharacterRanges:L(function(b,c,d){this.removeAllRanges();for(var e,f,g,h=0,i=d.length;i>h;++h)f=d[h],g=f.characterRange,e=a.createRange(c),e.selectCharacters(c,g.start,g.end,f.characterOptions),this.addRange(e,f.backward)}),text:L(function(a,b){for(var c=[],d=0,e=this.rangeCount;e>d;++d)c[d]=this.getRangeAt(d).text(b);return c.join("")})}),a.innerText=function(b,c){var d=a.createRange(b);d.selectNodeContents(b);var e=d.text(c);return e},a.createWordIterator=function(a,b,c){var d=C();c=h(c,ma);var e=d.getPosition(a,b),f=F(e,c.characterOptions,c.wordOptions),g=aa(c.direction);return{next:function(){return g?f.previousStartToken():f.nextEndToken()},dispose:function(){f.dispose(),this.next=function(){}}}},a.noMutation=function(a){var b=C();a(b),D()},a.noMutation.createEntryPointFunction=L,a.textRange={isBlockNode:l,isCollapsedWhitespaceNode:t,createPosition:L(function(a,b,c){return a.getPosition(b,c)})}}),a},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("SaveRestore",["WrappedRange"],function(a,b){function c(a,b){return(b||document).getElementById(a)}function d(a,b){var c,d="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),e=o.getDocument(a.startContainer),f=a.cloneRange();return f.collapse(b),c=e.createElement("span"),c.id=d,c.style.lineHeight="0",c.style.display="none",c.className="rangySelectionBoundary",c.appendChild(e.createTextNode(r)),f.insertNode(c),c}function e(a,d,e,f){var g=c(e,a);g?(d[f?"setStartBefore":"setEndBefore"](g),p(g)):b.warn("Marker element has been removed. Cannot restore selection.")}function f(a,b){return b.compareBoundaryPoints(a.START_TO_START,a)}function g(b,c){var e,f,g=a.DomRange.getRangeDocument(b),h=b.toString(),i=q(c);return b.collapsed?(f=d(b,!1),{document:g,markerId:f.id,collapsed:!0}):(f=d(b,!1),e=d(b,!0),{document:g,startMarkerId:e.id,endMarkerId:f.id,collapsed:!1,backward:i,toString:function(){return"original text: '"+h+"', new text: '"+b.toString()+"'"}})}function h(d,f){var g=d.document;"undefined"==typeof f&&(f=!0);var h=a.createRange(g);if(d.collapsed){var i=c(d.markerId,g);if(i){i.style.display="inline";var j=i.previousSibling;j&&3==j.nodeType?(p(i),h.collapseToPoint(j,j.length)):(h.collapseBefore(i),p(i))}else b.warn("Marker element has been removed. Cannot restore selection.")}else e(g,h,d.startMarkerId,!0),e(g,h,d.endMarkerId,!1);return f&&h.normalizeBoundaries(),h}function i(b,d){var e,h,i=[],j=q(d);b=b.slice(0),b.sort(f);for(var k=0,l=b.length;l>k;++k)i[k]=g(b[k],j);for(k=l-1;k>=0;--k)e=b[k],h=a.DomRange.getRangeDocument(e),e.collapsed?e.collapseAfter(c(i[k].markerId,h)):(e.setEndBefore(c(i[k].endMarkerId,h)),e.setStartAfter(c(i[k].startMarkerId,h)));return i}function j(c){if(!a.isSelectionValid(c))return b.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var d=a.getSelection(c),e=d.getAllRanges(),f=1==e.length&&d.isBackward(),g=i(e,f);return f?d.setSingleRange(e[0],f):d.setRanges(e),{win:c,rangeInfos:g,restored:!1}}function k(a){for(var b=[],c=a.length,d=c-1;d>=0;d--)b[d]=h(a[d],!0);return b}function l(b,c){if(!b.restored){var d=b.rangeInfos,e=a.getSelection(b.win),f=k(d),g=d.length;1==g&&c&&a.features.selectionHasExtend&&d[0].backward?(e.removeAllRanges(),e.addRange(f[0],!0)):e.setRanges(f),b.restored=!0}}function m(a,b){var d=c(b,a);d&&p(d)}function n(a){for(var b,c=a.rangeInfos,d=0,e=c.length;e>d;++d)b=c[d],b.collapsed?m(a.doc,b.markerId):(m(a.doc,b.startMarkerId),m(a.doc,b.endMarkerId))}var o=a.dom,p=o.removeNode,q=a.Selection.isDirectionBackward,r="\ufeff";a.util.extend(a,{saveRange:g,restoreRange:h,saveRanges:i,restoreRanges:k,saveSelection:j,restoreSelection:l,removeMarkerElement:m,removeMarkers:n})}),a},this);var Base=function(){};Base.extend=function(a,b){var c=Base.prototype.extend;Base._prototyping=!0;var d=new this;c.call(d,a),d.base=function(){},delete Base._prototyping;var e=d.constructor,f=d.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==f)this._constructing=!0,e.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||c).call(arguments[0],d)};return f.ancestor=this,f.extend=this.extend,f.forEach=this.forEach,f.implement=this.implement,f.prototype=d,f.toString=this.toString,f.valueOf=function(a){return"object"==a?f:e.valueOf()},c.call(f,b),"function"==typeof f.init&&f.init(),f},Base.prototype={extend:function(a,b){if(arguments.length>1){var c=this[a];if(c&&"function"==typeof b&&(!c.valueOf||c.valueOf()!=b.valueOf())&&/\bbase\b/.test(b)){var d=b.valueOf();b=function(){var a=this.base||Base.prototype.base;this.base=c;var b=d.apply(this,arguments);return this.base=a,b},b.valueOf=function(a){return"object"==a?b:d},b.toString=Base.toString}this[a]=b}else if(a){var e=Base.prototype.extend;Base._prototyping||"function"==typeof this||(e=this.extend||e);for(var f={toSource:null},g=["constructor","toString","valueOf"],h=Base._prototyping?0:1;i=g[h++];)a[i]!=f[i]&&e.call(this,i,a[i]);for(var i in a)f[i]||e.call(this,i,a[i])}return this}},Base=Base.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(a,b,c){for(var d in a)void 0===this.prototype[d]&&b.call(c,a[d],d,a)},implement:function(){for(var a=0;a-1?c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"):/Edge\/(\d+)./i.test(navigator.userAgent)&&(c=/Edge\/(\d+)./i)),c&&null!=c.exec(navigator.userAgent)&&(d=parseFloat(RegExp.$1)),-1===d?!1:a?b?"<"===b?d>a:">"===b?a>d:"<="===b?d>=a:">="===b?a>=d:void 0:a===d:!0}var d=navigator.userAgent,e=document.createElement("div"),f=-1!==d.indexOf("Gecko")&&-1===d.indexOf("KHTML")&&!c(),g=-1!==d.indexOf("AppleWebKit/")&&!c(),h=-1!==d.indexOf("Chrome/")&&!c(),i=-1!==d.indexOf("Opera/")&&!c();return{USER_AGENT:d,supported:function(){var c=this.USER_AGENT.toLowerCase(),d="contentEditable"in e,f=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,g=document.querySelector&&document.querySelectorAll,h=this.isIos()&&a(c)<5||this.isAndroid()&&b(c)<4||-1!==c.indexOf("opera mobi")||-1!==c.indexOf("hpwos/");return d&&f&&g&&!h},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){return/ipad|iphone|ipod/i.test(this.USER_AGENT)},isAndroid:function(){return-1!==this.USER_AGENT.indexOf("Android")},supportsSandboxedIframes:function(){return c()},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return c(12,">")},hasCurrentStyleProperty:function(){return"currentStyle"in e},insertsLineBreaksOnReturn:function(){return f},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){return"on"+a in e||function(){return e.setAttribute("on"+a,"return;"),"function"==typeof e["on"+a]}()},supportsEventsInIframeCorrectly:function(){return!i},supportsHTML5Tags:function(a){var b=a.createElement("div"),c="
    foo
    ";return b.innerHTML=c,b.innerHTML.toLowerCase()===c},supportsCommand:function(){var a={formatBlock:c(10,"<="),insertUnorderedList:c(),insertOrderedList:c()},b={insertHTML:f};return function(c,d){var e=a[d];if(!e){try{return c.queryCommandSupported(d)}catch(f){}try{return c.queryCommandEnabled(d)}catch(g){return!!b[d]}}return!1}}(),doesAutoLinkingInContentEditable:function(){return c()},canDisableAutoLinking:function(){return this.supportsCommand(document,"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return f||i||g},supportsGetAttributeCorrectly:function(){var a=document.createElement("td");return"1"!=a.getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return f||c()||i},autoScrollsToCaret:function(){return!g},autoClosesUnclosedTags:function(){var a,b,c=e.cloneNode(!1);return c.innerHTML="

    ",b=c.innerHTML.toLowerCase(),a="

    "===b||"

    "===b,this.autoClosesUnclosedTags=function(){return a},a},supportsNativeGetElementsByClassName:function(){return-1!==String(document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},needsSpaceAfterLineBreak:function(){return i},supportsSpeechApiOn:function(a){var b=d.match(/Chrome\/(\d+)/)||[void 0,0];return b[1]>=11&&("onwebkitspeechchange"in a||"speech"in a)},crashesWhenDefineProperty:function(a){return c(9)&&("XMLHttpRequest"===a||"XDomainRequest"===a)},doesAsyncFocus:function(){return c(12,">")},hasProblemsSettingCaretAfterImg:function(){return c()},hasLiDeletingProblem:function(){return c()},hasUndoInContextMenu:function(){return f||h||i},hasInsertNodeIssue:function(){return i},hasIframeFocusIssue:function(){return c()},createsNestedInvalidMarkupAfterPaste:function(){return g},hasCaretBlockElementIssue:function(){return g},supportsMutationEvents:function(){return"MutationEvent"in window},supportsModernPaste:function(){return!c()},fixStyleKey:function(a){return"cssFloat"===a?"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat":a},usesControlRanges:function(){return document.body&&"createControlRange"in document.body}}}(),wysihtml5.lang.array=function(a){return{contains:function(b){if(Array.isArray(b)){for(var c=b.length;c--;)if(-1!==wysihtml5.lang.array(a).indexOf(b[c]))return!0;return!1}return-1!==wysihtml5.lang.array(a).indexOf(b)},indexOf:function(b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},without:function(b){b=wysihtml5.lang.array(b);for(var c=[],d=0,e=a.length;e>d;d++)b.contains(a[d])||c.push(a[d]);return c},get:function(){for(var b=0,c=a.length,d=[];c>b;b++)d.push(a[b]);return d},map:function(b,c){if(Array.prototype.map)return a.map(b,c);for(var d=a.length>>>0,e=new Array(d),f=0;d>f;f++)e[f]=b.call(c,a[f],f,a);return e},unique:function(){for(var b=[],c=a.length,d=0;c>d;)wysihtml5.lang.array(b).contains(a[d])||b.push(a[d]),d++;return b}}},wysihtml5.lang.Dispatcher=Base.extend({on:function(a,b){return this.events=this.events||{},this.events[a]=this.events[a]||[],this.events[a].push(b),this},off:function(a,b){this.events=this.events||{};var c,d,e=0;if(a){for(c=this.events[a]||[],d=[];e\t"]/g,d={"&":"&","<":"<",">":">",'"':"""," ":"  "};wysihtml5.lang.string=function(e){return e=String(e),{trim:function(){return e.replace(a,"").replace(b,"")},interpolate:function(a){for(var b in a)e=this.replace("#{"+b+"}").by(a[b]);return e},replace:function(a){return{by:function(b){return e.split(a).join(b)}}},escapeHTML:function(a,b){var f=e.replace(c,function(a){return d[a]});return a&&(f=f.replace(/(?:\r\n|\r|\n)/g,"
    ")),b&&(f=f.replace(/ /gi,"  ")),f}}}}(),function(a){function b(a,b){return f(a,b)?a:(a===a.ownerDocument.documentElement&&(a=a.ownerDocument.body),g(a,b))}function c(a){return a.replace(i,function(a,b){var c=(b.match(j)||[])[1]||"",d=l[c];b=b.replace(j,""),b.split(d).length>b.split(c).length&&(b+=c,c="");var e=b,f=b;return b.length>k&&(f=f.substr(0,k)+"..."),"www."===e.substr(0,4)&&(e="http://"+e),'
    '+f+""+c})}function d(a){var b=a._wysihtml5_tempElement;return b||(b=a._wysihtml5_tempElement=a.createElement("div")),b}function e(b){var e=b.parentNode,f=a.lang.string(b.data).escapeHTML(),g=d(e.ownerDocument);for(g.innerHTML=""+c(f),g.removeChild(g.firstChild);g.firstChild;)e.insertBefore(g.firstChild,b);e.removeChild(b)}function f(b,c){for(var d;b.parentNode;){if(b=b.parentNode,d=b.nodeName,b.className&&a.lang.array(b.className.split(" ")).contains(c))return!0;if(h.contains(d))return!0;if("body"===d)return!1}return!1}function g(b,c){if(!(h.contains(b.nodeName)||b.className&&a.lang.array(b.className.split(" ")).contains(c))){if(b.nodeType===a.TEXT_NODE&&b.data.match(i))return void e(b);for(var d=a.lang.array(b.childNodes).get(),f=d.length,j=0;f>j;j++)g(d[j],c);return b}}var h=a.lang.array(["CODE","PRE","A","SCRIPT","HEAD","TITLE","STYLE"]),i=/((https?:\/\/|www\.)[^\s<]{3,})/gi,j=/([^\w\/\-](,?))$/i,k=100,l={")":"(","]":"[","}":"{"};a.dom.autoLink=b,a.dom.autoLink.URL_REG_EXP=i}(wysihtml5),function(a){var b=a.dom;b.addClass=function(a,c){var d=a.classList;return d?d.add(c):void(b.hasClass(a,c)||(a.className+=" "+c))},b.removeClass=function(a,b){var c=a.classList;return c?c.remove(b):void(a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," "))},b.hasClass=function(a,b){var c=a.classList;if(c)return c.contains(b);var d=a.className;return d.length>0&&(d==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(d))}}(wysihtml5),wysihtml5.dom.contains=function(){var a=document.documentElement;return a.contains?function(a,b){if(b.nodeType!==wysihtml5.ELEMENT_NODE){if(b.parentNode===a)return!0;b=b.parentNode}return a!==b&&a.contains(b)}:a.compareDocumentPosition?function(a,b){return!!(16&a.compareDocumentPosition(b))}:void 0}(),wysihtml5.dom.convertToList=function(){function a(a,b){var c=a.createElement("li");return b.appendChild(c),c}function b(a,b){return a.createElement(b)}function c(c,d,e){if("UL"===c.nodeName||"OL"===c.nodeName||"MENU"===c.nodeName)return c;var f,g,h,i,j,k,l,m,n,o=c.ownerDocument,p=b(o,d),q=c.querySelectorAll("br"),r=q.length;for(n=0;r>n;n++)for(i=q[n];(j=i.parentNode)&&j!==c&&j.lastChild===i;){if("block"===wysihtml5.dom.getStyle("display").from(j)){j.removeChild(i);break}wysihtml5.dom.insert(i).after(i.parentNode)}for(f=wysihtml5.lang.array(c.childNodes).get(),g=f.length,n=0;g>n;n++)m=m||a(o,p),h=f[n],k="block"===wysihtml5.dom.getStyle("display").from(h),l="BR"===h.nodeName,!k||e&&wysihtml5.dom.hasClass(h,e)?l?m=m.firstChild?null:m:m.appendChild(h):(m=m.firstChild?a(o,p):m,m.appendChild(h),m=null);return 0===f.length&&a(o,p),c.parentNode.replaceChild(p,c),p}return c}(),wysihtml5.dom.copyAttributes=function(a){return{from:function(b){return{to:function(c){for(var d,e=0,f=a.length;f>e;e++)d=a[e],"undefined"!=typeof b[d]&&""!==b[d]&&(c[d]=b[d]);return{andTo:arguments.callee}}}}}},function(a){var b=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],c=function(b){return d(b)?parseInt(a.getStyle("width").from(b),10)d;d++)if("border-box"===a.getStyle(b[d]).from(c))return b[d]};a.copyStyles=function(d){return{from:function(e){c(e)&&(d=wysihtml5.lang.array(d).without(b));for(var f,g="",h=d.length,i=0;h>i;i++)f=d[i],g+=f+":"+a.getStyle(f).from(e)+";";return{to:function(b){return a.setStyles(g).on(b),{andTo:arguments.callee}}}}}}}(wysihtml5.dom),function(a){a.dom.delegate=function(a,b,c,d){var e=function(c){for(var e=c.target,f=3===e.nodeType?e.parentNode:e,g=a.querySelectorAll(b),h=0,i=g.length;i>h;h++)g[h].contains(f)&&d.call(g[h],c)};return a.addEventListener(c,e,!1),{stop:function(){a.removeEventListener(c,e,!1)}}}}(wysihtml5),function(a){function b(a,b){for(var c=[a],d=a;b&&d&&d!==b||!b&&d;)c.unshift(d),d=d.parentNode;return c}a.dom.domNode=function(c){var d=[a.ELEMENT_NODE,a.TEXT_NODE];return{is:{emptyTextNode:function(b){var d=b?/^\s*$/g:/^[\r\n]*$/g;return c&&c.nodeType===a.TEXT_NODE&&d.test(c.data)},rangyBookmark:function(){return c&&1===c.nodeType&&c.classList.contains("rangySelectionBoundary")},visible:function(){var b=!/^\s*$/g.test(a.dom.getTextContent(c));return b||1===c.nodeType&&c.querySelector("img, br, hr, object, embed, canvas, input, textarea")&&(b=!0),b},lineBreak:function(){return c&&1===c.nodeType&&"BR"===c.nodeName},block:function(){return c&&1===c.nodeType&&"block"===c.ownerDocument.defaultView.getComputedStyle(c).display},voidElement:function(){return a.dom.domNode(c).test({query:a.VOID_ELEMENTS})}},prev:function(b){var e=c.previousSibling,f=b&&b.nodeTypes?b.nodeTypes:d;return e?a.dom.domNode(e).is.rangyBookmark()||!a.lang.array(f).contains(e.nodeType)||b&&b.ignoreBlankTexts&&a.dom.domNode(e).is.emptyTextNode(!0)?a.dom.domNode(e).prev(b):e:null},next:function(b){var e=c.nextSibling,f=b&&b.nodeTypes?b.nodeTypes:d;return e?a.dom.domNode(e).is.rangyBookmark()||!a.lang.array(f).contains(e.nodeType)||b&&b.ignoreBlankTexts&&a.dom.domNode(e).is.emptyTextNode(!0)?a.dom.domNode(e).next(b):e:null},commonAncestor:function(a,d){var e=b(c,d),f=b(a,d);if(e[0]!=f[0])return null;for(var g=0;g0)for(var f=!1,g=Array.isArray(b.styleProperty)?b.styleProperty:[b.styleProperty],h=0,i=g.length;i>h;h++){if(d=a.browser.fixStyleKey(g[h]),c.style[d]){if(!b.styleValue){f=!0;break}if(b.styleValue instanceof RegExp){if(c.style[d].trim().match(b.styleValue).length>0){f=!0;break}}else if(Array.isArray(b.styleValue)){if(b.styleValue.indexOf(c.style[d].trim())){f=!0;break}}else if(b.styleValue===c.style[d].trim().replace(/, /g,",")){f=!0;break}}if(!f)return!1}if(b.attribute){var j=a.dom.getAttributes(c),k=[],l=!1;Array.isArray(b.attribute)?k=b.attribute:k[b.attribute]=b.attributeValue;for(var m in k)if(k.hasOwnProperty(m))if("undefined"==typeof k[m]){if("undefined"!=typeof j[m]){l=!0;break}}else if(j[m]===k[m]){l=!0;break}if(!l)return!1}return!0}}}}(wysihtml5),wysihtml5.dom.getAsDom=function(){var a=function(a,b){var c=b.createElement("div");c.style.display="none",b.body.appendChild(c);try{c.innerHTML=a}catch(d){}return b.body.removeChild(c),c},b=function(a){if(!a._wysihtml5_supportsHTML5Tags){for(var b=0,d=c.length;d>b;b++)a.createElement(c[b]);a._wysihtml5_supportsHTML5Tags=!0}},c=["abbr","article","aside","audio","bdi","canvas","command","datalist","details","figcaption","figure","footer","header","hgroup","keygen","mark","meter","nav","output","progress","rp","rt","ruby","svg","section","source","summary","time","track","video","wbr"];return function(c,d){d=d||document;var e;return"object"==typeof c&&c.nodeType?(e=d.createElement("div"),e.appendChild(c)):wysihtml5.browser.supportsHTML5Tags(d)?(e=d.createElement("div"),e.innerHTML=c):(b(d),e=a(c,d)),e}}(),wysihtml5.dom.getParentElement=function(){return function(a,b,c,d){ -for(c=c||50;c--&&a&&"BODY"!==a.nodeName&&(!d||a!==d);){if(wysihtml5.dom.domNode(a).test(b))return a;a=a.parentNode}return null}}(),wysihtml5.dom.getStyle=function(){function a(a){return a.replace(c,function(a){return a.charAt(1).toUpperCase()})}var b={"float":"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat"},c=/\-[a-z]/g;return function(c){return{from:function(d){if(d.nodeType===wysihtml5.ELEMENT_NODE){var e=d.ownerDocument,f=b[c]||a(c),g=d.style,h=d.currentStyle,i=g[f];if(i)return i;if(h)try{return h[f]}catch(j){}var k,l,m=e.defaultView||e.parentWindow,n=("height"===c||"width"===c)&&"TEXTAREA"===d.nodeName;return m.getComputedStyle?(n&&(k=g.overflow,g.overflow="hidden"),l=m.getComputedStyle(d,null).getPropertyValue(c),n&&(g.overflow=k||""),l):void 0}}}}}(),wysihtml5.dom.getTextNodes=function(a,b){var c=[];for(a=a.firstChild;a;a=a.nextSibling)3==a.nodeType?b&&/^\s*$/.test(a.innerText||a.textContent)||c.push(a):c=c.concat(wysihtml5.dom.getTextNodes(a,b));return c},wysihtml5.dom.hasElementWithTagName=function(){function a(a){return a._wysihtml5_identifier||(a._wysihtml5_identifier=c++)}var b={},c=1;return function(c,d){var e=a(c)+":"+d,f=b[e];return f||(f=b[e]=c.getElementsByTagName(d)),f.length>0}}(),function(a){function b(a){return a._wysihtml5_identifier||(a._wysihtml5_identifier=d++)}var c={},d=1;a.dom.hasElementWithClassName=function(d,e){if(!a.browser.supportsNativeGetElementsByClassName())return!!d.querySelector("."+e);var f=b(d)+":"+e,g=c[f];return g||(g=c[f]=d.getElementsByClassName(e)),g.length>0}}(wysihtml5),wysihtml5.dom.insert=function(a){return{after:function(b){b.parentNode.insertBefore(a,b.nextSibling)},before:function(b){b.parentNode.insertBefore(a,b)},into:function(b){b.appendChild(a)}}},wysihtml5.dom.insertCSS=function(a){return a=a.join("\n"),{into:function(b){var c=b.createElement("style");c.type="text/css",c.styleSheet?c.styleSheet.cssText=a:c.appendChild(b.createTextNode(a));var d=b.querySelector("head link");if(d)return void d.parentNode.insertBefore(c,d);var e=b.querySelector("head");e&&e.appendChild(c)}}},function(a){a.dom.lineBreaks=function(b){function c(a){return"BR"===a.nodeName}function d(b){return c(b)?!0:"block"===a.dom.getStyle("display").from(b)?!0:!1}return{add:function(c){var e=b.ownerDocument,f=a.dom.domNode(b).next({ignoreBlankTexts:!0}),g=a.dom.domNode(b).prev({ignoreBlankTexts:!0});f&&!d(f)&&a.dom.insert(e.createElement("br")).after(b),g&&!d(g)&&a.dom.insert(e.createElement("br")).before(b)},remove:function(d){var e=a.dom.domNode(b).next({ignoreBlankTexts:!0}),f=a.dom.domNode(b).prev({ignoreBlankTexts:!0});e&&c(e)&&e.parentNode.removeChild(e),f&&c(f)&&f.parentNode.removeChild(f)}}}}(wysihtml5),wysihtml5.dom.observe=function(a,b,c){b="string"==typeof b?[b]:b;for(var d,e,f=0,g=b.length;g>f;f++)e=b[f],a.addEventListener?a.addEventListener(e,c,!1):(d=function(b){"target"in b||(b.target=b.srcElement),b.preventDefault=b.preventDefault||function(){this.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){this.cancelBubble=!0},c.call(a,b)},a.attachEvent("on"+e,d));return{stop:function(){for(var e,f=0,g=b.length;g>f;f++)e=b[f],a.removeEventListener?a.removeEventListener(e,c,!1):a.detachEvent("on"+e,d)}}},wysihtml5.dom.parse=function(a,b){function c(a,b){wysihtml5.lang.object(t).merge(s).merge(b.rules).get();var c,f,g,h=b.context||a.ownerDocument||document,i=h.createDocumentFragment(),j="string"==typeof a,k=!1;for(b.clearInternals===!0&&(k=!0),c=j?wysihtml5.dom.getAsDom(a,h):a,t.selectors&&e(c,t.selectors);c.firstChild;)g=c.firstChild,f=d(g,b.cleanUp,k,b.uneditableClass),f&&i.appendChild(f),g!==f&&c.removeChild(g);if(b.unjoinNbsps)for(var l=wysihtml5.dom.getTextNodes(i),m=l.length;m--;)l[m].nodeValue=l[m].nodeValue.replace(/([\S\u00A0])\u00A0/gi,"$1 ");return c.innerHTML="",c.appendChild(i),j?wysihtml5.quirks.getCorrectInnerHTML(c):c}function d(a,b,c,e){var f,g,h,i,j=a.nodeType,k=a.childNodes,l=k.length,m=p[j],n=0;if(e&&1===j&&wysihtml5.dom.hasClass(a,e))return a;if(g=m&&m(a,c),!g){if(g===!1){for(f=a.ownerDocument.createDocumentFragment(),n=l;n--;)k[n]&&(h=d(k[n],b,c,e),h&&(k[n]===h&&n--,f.insertBefore(h,f.firstChild)));return i=wysihtml5.dom.getStyle("display").from(a),""===i&&(i=wysihtml5.lang.array(u).contains(a.tagName)?"block":""),wysihtml5.lang.array(["block","flex","table"]).contains(i)&&f.appendChild(a.ownerDocument.createElement("br")),wysihtml5.lang.array(["div","pre","p","table","td","th","ul","ol","li","dd","dl","footer","header","section","h1","h2","h3","h4","h5","h6"]).contains(a.nodeName.toLowerCase())&&a.parentNode.lastChild!==a&&(a.nextSibling&&3===a.nextSibling.nodeType&&/^\s/.test(a.nextSibling.nodeValue)||f.appendChild(a.ownerDocument.createTextNode(" "))),f.normalize&&f.normalize(),f}return null}for(n=0;l>n;n++)k[n]&&(h=d(k[n],b,c,e),h&&(k[n]===h&&n--,g.appendChild(h)));if(b&&g.nodeName.toLowerCase()===q&&(!g.childNodes.length||/^\s*$/gi.test(g.innerHTML)&&(c||"_wysihtml5-temp-placeholder"!==a.className&&"rangySelectionBoundary"!==a.className)||!g.attributes.length)){for(f=g.ownerDocument.createDocumentFragment();g.firstChild;)f.appendChild(g.firstChild);return f.normalize&&f.normalize(),f}return g.normalize&&g.normalize(),g}function e(a,b){var c,d,e;for(c in b)if(b.hasOwnProperty(c)){wysihtml5.lang.object(b[c]).isFunction()?d=b[c]:"string"==typeof b[c]&&z[b[c]]&&(d=z[b[c]]),e=a.querySelectorAll(c);for(var f=e.length;f--;)d(e[f])}}function f(a,b){var c,d,e,f=t.tags,h=a.nodeName.toLowerCase(),j=a.scopeName;if(a._wysihtml5)return null;if(a._wysihtml5=1,"wysihtml5-temp"===a.className)return null;if(j&&"HTML"!=j&&(h=j+":"+h),"outerHTML"in a&&(wysihtml5.browser.autoClosesUnclosedTags()||"P"!==a.nodeName||"

    "===a.outerHTML.slice(-4).toLowerCase()||(h="div")),h in f){if(c=f[h],!c||c.remove)return null;if(c.unwrap)return!1;c="string"==typeof c?{rename_tag:c}:c}else{if(!a.firstChild)return null;c={rename_tag:q}}if(c.one_of_type&&!g(a,t,c.one_of_type,b)){if(!c.remove_action)return null;if("unwrap"===c.remove_action)return!1;if("rename"!==c.remove_action)return null;e=c.remove_action_rename_to||q}return d=a.ownerDocument.createElement(e||c.rename_tag||h),m(a,d,c,b),i(a,d,c),a=null,d.normalize&&d.normalize(),d}function g(a,b,c,d){var e,f;if("SPAN"===a.nodeName&&!d&&("_wysihtml5-temp-placeholder"===a.className||"rangySelectionBoundary"===a.className))return!0;for(f in c)if(c.hasOwnProperty(f)&&b.type_definitions&&b.type_definitions[f]&&(e=b.type_definitions[f],h(a,e)))return!0;return!1}function h(a,b){var c,d,e,f,g,h=a.getAttribute("class"),i=a.getAttribute("style");if(b.methods)for(var j in b.methods)if(b.methods.hasOwnProperty(j)&&y[j]&&y[j](a))return!0;if(h&&b.classes){h=h.replace(/^\s+/g,"").replace(/\s+$/g,"").split(r),c=h.length;for(var k=0;c>k;k++)if(b.classes[h[k]])return!0}if(i&&b.styles){i=i.split(";");for(d in b.styles)if(b.styles.hasOwnProperty(d))for(var l=i.length;l--;)if(g=i[l].split(":"),g[0].replace(/\s/g,"").toLowerCase()===d&&(b.styles[d]===!0||1===b.styles[d]||wysihtml5.lang.array(b.styles[d]).contains(g[1].replace(/\s/g,"").toLowerCase())))return!0}if(b.attrs)for(e in b.attrs)if(b.attrs.hasOwnProperty(e)&&(f=wysihtml5.dom.getAttribute(a,e),"string"==typeof f&&f.search(b.attrs[e])>-1))return!0;return!1}function i(a,b,c){var d,e;if(c&&c.keep_styles)for(d in c.keep_styles)if(c.keep_styles.hasOwnProperty(d)){if(e="float"===d?a.style.styleFloat||a.style.cssFloat:a.style[d],c.keep_styles[d]instanceof RegExp&&!c.keep_styles[d].test(e))continue;"float"===d?b.style[a.style.styleFloat?"styleFloat":"cssFloat"]=e:a.style[d]&&(b.style[d]=e)}}function j(a,b){var c=[];for(var d in b)b.hasOwnProperty(d)&&0===d.indexOf(a)&&c.push(d);return c}function k(a,b,c,d){var e,f=wysihtml5.lang.object(c).isFunction()?c:v[c];return f&&(e=f(b,d),"string"==typeof e)?e:!1}function l(a,b){var c,d,e,f=wysihtml5.lang.object(t.attributes||{}).clone(),g=wysihtml5.lang.object(f).merge(wysihtml5.lang.object(b||{}).clone()).get(),h={},i=wysihtml5.dom.getAttributes(a);for(c in g)if(/\*$/.test(c)){e=j(c.slice(0,-1),i);for(var l=0,m=e.length;m>l;l++)d=k(e[l],i[e[l]],g[c],a.nodeName),d!==!1&&(h[e[l]]=d)}else d=k(c,i[c],g[c],a.nodeName),d!==!1&&(h[c]=d);return h}function m(a,b,c,d){var e,f,g,h,i,j={},k=c.set_class,m=c.add_class,n=c.add_style,o=c.set_attributes,p=t.classes,q=0,s=[],u=[],v=[],y=[];if(o&&(j=wysihtml5.lang.object(o).clone()),j=wysihtml5.lang.object(j).merge(l(a,c.check_attributes)).get(),k&&s.push(k),m)for(h in m)i=x[m[h]],i&&(g=i(wysihtml5.dom.getAttribute(a,h)),"string"==typeof g&&s.push(g));if(n)for(h in n)i=w[n[h]],i&&(newStyle=i(wysihtml5.dom.getAttribute(a,h)),"string"==typeof newStyle&&u.push(newStyle));if("string"==typeof p&&"any"===p)if(a.getAttribute("class"))if(t.classes_blacklist){for(y=a.getAttribute("class"),y&&(s=s.concat(y.split(r))),e=s.length;e>q;q++)f=s[q],t.classes_blacklist[f]||v.push(f);v.length&&(j["class"]=wysihtml5.lang.array(v).unique().join(" "))}else j["class"]=a.getAttribute("class");else s&&s.length>0&&(j["class"]=wysihtml5.lang.array(s).unique().join(" "));else{for(d||(p["_wysihtml5-temp-placeholder"]=1,p._rangySelectionBoundary=1,p["wysiwyg-tmp-selected-cell"]=1),y=a.getAttribute("class"),y&&(s=s.concat(y.split(r))),e=s.length;e>q;q++)f=s[q],p[f]&&v.push(f);v.length&&(j["class"]=wysihtml5.lang.array(v).unique().join(" "))}j["class"]&&d&&(j["class"]=j["class"].replace("wysiwyg-tmp-selected-cell",""),/^\s*$/g.test(j["class"])&&delete j["class"]),u.length&&(j.style=wysihtml5.lang.array(u).unique().join(" "));for(h in j)try{b.setAttribute(h,j[h])}catch(z){}j.src&&("undefined"!=typeof j.width&&b.setAttribute("width",j.width),"undefined"!=typeof j.height&&b.setAttribute("height",j.height))}function n(a){var b=a.nextSibling;if(!b||b.nodeType!==wysihtml5.TEXT_NODE){var c=a.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP,"");return a.ownerDocument.createTextNode(c)}b.data=a.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP,"")+b.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP,"")}function o(a){return t.comments?a.ownerDocument.createComment(a.nodeValue):void 0}var p={1:f,3:n,8:o},q="span",r=/\s+/,s={tags:{},classes:{}},t={},u=["ADDRESS","BLOCKQUOTE","CENTER","DIR","DIV","DL","FIELDSET","FORM","H1","H2","H3","H4","H5","H6","ISINDEX","MENU","NOFRAMES","NOSCRIPT","OL","P","PRE","TABLE","UL"],v={url:function(){var a=/^https?:\/\//i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),src:function(){var a=/^(\/|https?:\/\/)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),href:function(){var a=/^(#|\/|https?:\/\/|mailto:|tel:)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),alt:function(){var a=/[^ a-z0-9_\-]/gi;return function(b,c){return b?b.replace(a,""):"IMG"===c?"":null}}(),numbers:function(){var a=/\D/g;return function(b){return b=(b||"").replace(a,""),b||null}}(),dimension:function(){var a=/\D*(\d+)(\.\d+)?\s?(%)?\D*/;return function(b){return b=(b||"").replace(a,"$1$2$3"),b||null}}(),any:function(){return function(a){return a?a:null}}()},w={align_text:function(){var a={left:"text-align: left;",right:"text-align: right;",center:"text-align: center;"};return function(b){return a[String(b).toLowerCase()]}}()},x={align_img:function(){var a={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(b){return a[String(b).toLowerCase()]}}(),align_text:function(){var a={left:"wysiwyg-text-align-left",right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(b){return a[String(b).toLowerCase()]}}(),clear_br:function(){var a={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(b){return a[String(b).toLowerCase()]}}(),size_font:function(){var a={1:"wysiwyg-font-size-xx-small",2:"wysiwyg-font-size-small",3:"wysiwyg-font-size-medium",4:"wysiwyg-font-size-large",5:"wysiwyg-font-size-x-large",6:"wysiwyg-font-size-xx-large",7:"wysiwyg-font-size-xx-large","-":"wysiwyg-font-size-smaller","+":"wysiwyg-font-size-larger"};return function(b){return a[String(b).charAt(0)]}}()},y={has_visible_contet:function(){var a,b=["img","video","picture","br","script","noscript","style","table","iframe","object","embed","audio","svg","input","button","select","textarea","canvas"];return function(c){if(a=(c.innerText||c.textContent).replace(/\s/g,""),a&&a.length>0)return!0;for(var d=b.length;d--;)if(c.querySelector(b[d]))return!0;return c.offsetWidth&&c.offsetWidth>0&&c.offsetHeight&&c.offsetHeight>0?!0:!1}}()},z={unwrap:function(a){wysihtml5.dom.unwrap(a)},remove:function(a){a.parentNode.removeChild(a)}};return c(a,b)},wysihtml5.dom.removeEmptyTextNodes=function(a){for(var b,c=wysihtml5.lang.array(a.childNodes).get(),d=c.length,e=0;d>e;e++)b=c[e],b.nodeType===wysihtml5.TEXT_NODE&&/^[\n\r]*$/.test(b.data)&&b.parentNode.removeChild(b)},wysihtml5.dom.renameElement=function(a,b){for(var c,d=a.ownerDocument.createElement(b);c=a.firstChild;)d.appendChild(c);return wysihtml5.dom.copyAttributes(["align","className"]).from(a).to(d),a.parentNode&&a.parentNode.replaceChild(d,a),d},wysihtml5.dom.replaceWithChildNodes=function(a){if(a.parentNode){for(;a.firstChild;)a.parentNode.insertBefore(a.firstChild,a);a.parentNode.removeChild(a)}},function(a){function b(b){return"block"===a.getStyle("display").from(b)}function c(a){return"BR"===a.nodeName}function d(a){var b=a.ownerDocument.createElement("br");a.appendChild(b)}function e(a,e){if(a.nodeName.match(/^(MENU|UL|OL)$/)){var f,g,h,i,j,k,l,m=a.ownerDocument,n=m.createDocumentFragment(),o=wysihtml5.dom.domNode(a).prev({ignoreBlankTexts:!0}),p=wysihtml5.dom.domNode(a).next({ignoreBlankTexts:!0}),q=a.lastElementChild||a.lastChild;if(e)for(!o||b(o)||c(o)||d(n);k=a.firstElementChild||a.firstChild;){for(g=k.lastChild,l=k===q;f=k.firstChild;)h=f===g,i=(!l||p&&!b(p))&&h&&!b(f)&&!c(f),n.appendChild(f),i&&d(n);k.parentNode.removeChild(k)}else for(;k=a.firstElementChild||a.firstChild;){if(k.querySelector&&k.querySelector("div, p, ul, ol, menu, blockquote, h1, h2, h3, h4, h5, h6"))for(;f=k.firstChild;)n.appendChild(f);else{for(j=m.createElement("p");f=k.firstChild;)j.appendChild(f);n.appendChild(j)}k.parentNode.removeChild(k)}a.parentNode.replaceChild(n,a)}}a.resolveList=e}(wysihtml5.dom),function(a){var b=document,c=["parent","top","opener","frameElement","frames","localStorage","globalStorage","sessionStorage","indexedDB"],d=["open","close","openDialog","showModalDialog","alert","confirm","prompt","openDatabase","postMessage","XMLHttpRequest","XDomainRequest"],e=["referrer","write","open","close"];a.dom.Sandbox=Base.extend({constructor:function(b,c){this.callback=b||a.EMPTY_FUNCTION,this.config=a.lang.object({}).merge(c).get(),this.config.className||(this.config.className="wysihtml5-sandbox"),this.editableArea=this._createIframe()},insertInto:function(a){"string"==typeof a&&(a=b.getElementById(a)),a.appendChild(this.editableArea)},getIframe:function(){return this.editableArea},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var a=this.getIframe();a.parentNode.removeChild(a)},_readyError:function(){throw new Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet")},_createIframe:function(){var c=this,d=b.createElement("iframe");return d.className=this.config.className,a.dom.setAttributes({security:"restricted",allowtransparency:"true",frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(d),a.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()&&(d.src="javascript:''"),d.onload=function(){d.onreadystatechange=d.onload=null,c._onLoadIframe(d)},d.onreadystatechange=function(){/loaded|complete/.test(d.readyState)&&(d.onreadystatechange=d.onload=null,c._onLoadIframe(d))},d},_onLoadIframe:function(f){if(a.dom.contains(b.documentElement,f)){var g=this,h=f.contentWindow,i=f.contentWindow.document,j=b.characterSet||b.charset||"utf-8",k=this._getHtml({charset:j,stylesheets:this.config.stylesheets});if(i.open("text/html","replace"),i.write(k),i.close(),this.getWindow=function(){return f.contentWindow},this.getDocument=function(){return f.contentWindow.document},h.onerror=function(a,b,c){throw new Error("wysihtml5.Sandbox: "+a,b,c)},!a.browser.supportsSandboxedIframes()){var l,m;for(l=0,m=c.length;m>l;l++)this._unset(h,c[l]);for(l=0,m=d.length;m>l;l++)this._unset(h,d[l],a.EMPTY_FUNCTION);for(l=0,m=e.length;m>l;l++)this._unset(i,e[l]);this._unset(i,"cookie","",!0)}a.polyfills&&a.polyfills(h,i),this.loaded=!0,setTimeout(function(){g.callback(g)},0)}},_getHtml:function(b){var c,d=b.stylesheets,e="",f=0;if(d="string"==typeof d?[d]:d)for(c=d.length;c>f;f++)e+='';return b.stylesheets=e,a.lang.string('#{stylesheets}').interpolate(b)},_unset:function(b,c,d,e){try{b[c]=d}catch(f){}try{b.__defineGetter__(c,function(){return d})}catch(f){}if(e)try{b.__defineSetter__(c,function(){})}catch(f){}if(!a.browser.crashesWhenDefineProperty(c))try{var g={get:function(){return d}};e&&(g.set=function(){}),Object.defineProperty(b,c,g)}catch(f){}}})}(wysihtml5),function(a){var b=document;a.dom.ContentEditableArea=Base.extend({getContentEditable:function(){return this.element},getWindow:function(){return this.element.ownerDocument.defaultView||this.element.ownerDocument.parentWindow},getDocument:function(){return this.element.ownerDocument},constructor:function(b,c,d){this.callback=b||a.EMPTY_FUNCTION,this.config=a.lang.object({}).merge(c).get(),this.config.className||(this.config.className="wysihtml5-sandbox"),d?this.element=this._bindElement(d):this.element=this._createElement()},destroy:function(){},_createElement:function(){var a=b.createElement("div");return a.className=this.config.className,this._loadElement(a),a},_bindElement:function(a){return a.className=a.className?a.className+" wysihtml5-sandbox":"wysihtml5-sandbox",this._loadElement(a,!0),a},_loadElement:function(a,b){var c=this;if(!b){var d=this._getHtml();a.innerHTML=d}this.loaded=!0,setTimeout(function(){c.callback(c)},0)},_getHtml:function(a){return""}})}(wysihtml5),function(){var a={className:"class"};wysihtml5.dom.setAttributes=function(b){return{on:function(c){for(var d in b)c.setAttribute(a[d]||d,b[d])}}}}(),wysihtml5.dom.setStyles=function(a){return{on:function(b){var c=b.style;if("string"==typeof a)return void(c.cssText+=";"+a);for(var d in a)"float"===d?(c.cssFloat=a[d],c.styleFloat=a[d]):c[d]=a[d]}}},function(a){a.simulatePlaceholder=function(b,c,d,e){var f=e||"wysihtml5-placeholder",g=function(){var b=c.element.offsetWidth>0&&c.element.offsetHeight>0;c.hasPlaceholderSet()&&(c.clear(),c.element.focus(),b&&setTimeout(function(){var a=c.selection.getSelection();a.focusNode&&a.anchorNode||c.selection.selectNode(c.element.firstChild||c.element)},0)),c.placeholderSet=!1,a.removeClass(c.element,f)},h=function(){c.isEmpty()&&!c.placeholderSet&&(c.placeholderSet=!0,c.setValue(d,!1),a.addClass(c.element,f))};b.on("set_placeholder",h).on("unset_placeholder",g).on("focus:composer",g).on("paste:composer",g).on("blur:composer",h),h()}}(wysihtml5.dom),function(a){var b=document.documentElement;"textContent"in b?(a.setTextContent=function(a,b){a.textContent=b},a.getTextContent=function(a){return a.textContent}):"innerText"in b?(a.setTextContent=function(a,b){a.innerText=b},a.getTextContent=function(a){return a.innerText}):(a.setTextContent=function(a,b){a.nodeValue=b},a.getTextContent=function(a){return a.nodeValue})}(wysihtml5.dom),wysihtml5.dom.getAttribute=function(a,b){var c=!wysihtml5.browser.supportsGetAttributeCorrectly();b=b.toLowerCase();var d=a.nodeName;if("IMG"==d&&"src"==b&&wysihtml5.dom.isLoadedImage(a)===!0)return a.src;if(c&&"outerHTML"in a){var e=a.outerHTML.toLowerCase(),f=-1!=e.indexOf(" "+b+"=");return f?a.getAttribute(b):null}return a.getAttribute(b)},wysihtml5.dom.getAttributes=function(a){var b,c=!wysihtml5.browser.supportsGetAttributeCorrectly(),d=a.nodeName,e=[];for(b in a.attributes)(a.attributes.hasOwnProperty&&a.attributes.hasOwnProperty(b)||!a.attributes.hasOwnProperty&&Object.prototype.hasOwnProperty.call(a.attributes,b))&&a.attributes[b].specified&&("IMG"==d&&"src"==a.attributes[b].name.toLowerCase()&&wysihtml5.dom.isLoadedImage(a)===!0?e.src=a.src:wysihtml5.lang.array(["rowspan","colspan"]).contains(a.attributes[b].name.toLowerCase())&&c?1!==a.attributes[b].value&&(e[a.attributes[b].name]=a.attributes[b].value):e[a.attributes[b].name]=a.attributes[b].value);return e},wysihtml5.dom.isLoadedImage=function(a){try{return a.complete&&!a.mozMatchesSelector(":-moz-broken")}catch(b){if(a.complete&&"complete"===a.readyState)return!0}},function(a){function b(a,b){for(var c,d=[],e=0,f=a.length;f>e;e++)if(c=a[e].querySelectorAll(b))for(var g=c.length;g--;d.unshift(c[g]));return d}function d(a){a.parentNode.removeChild(a)}function e(a,b){a.parentNode.insertBefore(b,a.nextSibling)}function f(a,b){for(var c=a.nextSibling;1!=c.nodeType;)if(c=c.nextSibling,!b||b==c.tagName.toLowerCase())return c;return null}var g=a.dom,h=function(a){this.el=a,this.isColspan=!1,this.isRowspan=!1,this.firstCol=!0,this.lastCol=!0,this.firstRow=!0,this.lastRow=!0,this.isReal=!0,this.spanCollection=[],this.modified=!1},i=function(a,b){a?(this.cell=a,this.table=g.getParentElement(a,{query:"table"})):b&&(this.table=b,this.cell=this.table.querySelectorAll("th, td")[0])};i.prototype={addSpannedCellToMap:function(a,b,c,d,e,f){for(var g=[],i=c+(f?parseInt(f,10)-1:0),j=d+(e?parseInt(e,10)-1:0),k=c;i>=k;k++){"undefined"==typeof b[k]&&(b[k]=[]);for(var l=d;j>=l;l++)b[k][l]=new h(a),b[k][l].isColspan=e&&parseInt(e,10)>1,b[k][l].isRowspan=f&&parseInt(f,10)>1,b[k][l].firstCol=l==d,b[k][l].lastCol=l==j,b[k][l].firstRow=k==c,b[k][l].lastRow=k==i,b[k][l].isReal=l==d&&k==c,b[k][l].spanCollection=g,g.push(b[k][l])}},setCellAsModified:function(a){if(a.modified=!0,a.spanCollection.length>0)for(var b=0,c=a.spanCollection.length;c>b;b++)a.spanCollection[b].modified=!0},setTableMap:function(){var a,b,c,d,e,f,i,j,k=[],l=this.getTableRows();for(a=0;a0?a.lang.array(f).without(e):f;return g},getTableRows:function(){var c=this.table.querySelectorAll("table"),d=c?b(c,"tr"):[],e=this.table.querySelectorAll("tr"),f=d.length>0?a.lang.array(e).without(d):e;return f},getMapIndex:function(a){for(var b=this.map.length,c=this.map&&this.map[0]?this.map[0].length:0,d=0;b>d;d++)for(var e=0;c>e;e++)if(this.map[d][e].el===a)return{row:d,col:e};return!1},getElementAtIndex:function(a){return this.setTableMap(),this.map[a.row]&&this.map[a.row][a.col]&&this.map[a.row][a.col].el?this.map[a.row][a.col].el:null},getMapElsTo:function(a){var b=[];if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(a),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var c=this.idx_start;this.idx_start=this.idx_end,this.idx_end=c}if(this.idx_start.col>this.idx_end.col){var d=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=d}if(null!=this.idx_start&&null!=this.idx_end)for(var e=this.idx_start.row,f=this.idx_end.row;f>=e;e++)for(var g=this.idx_start.col,h=this.idx_end.col;h>=g;g++)b.push(this.map[e][g].el);return b},orderSelectionEnds:function(a){if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(a),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var b=this.idx_start;this.idx_start=this.idx_end,this.idx_end=b}if(this.idx_start.col>this.idx_end.col){var c=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=c}return{start:this.map[this.idx_start.row][this.idx_start.col].el,end:this.map[this.idx_end.row][this.idx_end.col].el}},createCells:function(a,b,c){for(var d,e=this.table.ownerDocument,f=e.createDocumentFragment(),g=0;b>g;g++){if(d=e.createElement(a),c)for(var h in c)c.hasOwnProperty(h)&&d.setAttribute(h,c[h]);d.appendChild(document.createTextNode(" ")),f.appendChild(d)}return f},correctColIndexForUnreals:function(a,b){for(var c=this.map[b],d=-1,e=0;a>e;e++)c[e].isReal&&d++;return d},getLastNewCellOnRow:function(a,b){for(var c,d,e=this.getRowCells(a),f=0,g=e.length;g>f;f++)if(c=e[f],d=this.getMapIndex(c),d===!1||"undefined"!=typeof b&&d.row!=b)return c;return null},removeEmptyTable:function(){var a=this.table.querySelectorAll("td, th");return a&&0!=a.length?!1:(d(this.table),!0)},splitRowToCells:function(a){if(a.isColspan){var b=parseInt(g.getAttribute(a.el,"colspan")||1,10),c=a.el.tagName.toLowerCase();if(b>1){var d=this.createCells(c,b-1);e(a.el,d)}a.el.removeAttribute("colspan")}},getRealRowEl:function(a,b){var c=null,d=null;b=b||this.idx;for(var e=0,f=this.map[b.row].length;f>e;e++)if(d=this.map[b.row][e],d.isReal&&(c=g.getParentElement(d.el,{query:"tr"})))return c;return null===c&&a&&(c=g.getParentElement(this.map[b.row][b.col].el,{query:"tr"})||null),c},injectRowAt:function(a,b,c,d,f){var h=this.getRealRowEl(!1,{row:a,col:b}),i=this.createCells(d,c);if(h){var j=this.correctColIndexForUnreals(b,a);j>=0?e(this.getRowCells(h)[j],i):h.insertBefore(i,h.firstChild)}else{var k=this.table.ownerDocument.createElement("tr");k.appendChild(i),e(g.getParentElement(f.el,{query:"tr"}),k)}},canMerge:function(a){if(this.to=a,this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(this.to),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var b=this.idx_start;this.idx_start=this.idx_end,this.idx_end=b}if(this.idx_start.col>this.idx_end.col){var c=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=c}for(var d=this.idx_start.row,e=this.idx_end.row;e>=d;d++)for(var f=this.idx_start.col,g=this.idx_end.col;g>=f;f++)if(this.map[d][f].isColspan||this.map[d][f].isRowspan)return!1;return!0},decreaseCellSpan:function(a,b){var c=parseInt(g.getAttribute(a.el,b),10)-1;c>=1?a.el.setAttribute(b,c):(a.el.removeAttribute(b),"colspan"==b&&(a.isColspan=!1),"rowspan"==b&&(a.isRowspan=!1),a.firstCol=!0,a.lastCol=!0,a.firstRow=!0,a.lastRow=!0,a.isReal=!0)},removeSurplusLines:function(){var a,b,c,e,f,h,i;if(this.setTableMap(),this.map){for(c=0,e=this.map.length;e>c;c++){for(a=this.map[c],i=!0,f=0,h=a.length;h>f;f++)if(b=a[f],!(g.getAttribute(b.el,"rowspan")&&parseInt(g.getAttribute(b.el,"rowspan"),10)>1&&b.firstRow!==!0)){i=!1;break}if(i)for(f=0;h>f;f++)this.decreaseCellSpan(a[f],"rowspan")}var j=this.getTableRows();for(c=0,e=j.length;e>c;c++)a=j[c],0==a.childNodes.length&&/^\s*$/.test(a.textContent||a.innerText)&&d(a)}},fillMissingCells:function(){var a=0,b=0,c=null;if(this.setTableMap(),this.map){a=this.map.length;for(var d=0;a>d;d++)this.map[d].length>b&&(b=this.map[d].length);for(var f=0;a>f;f++)for(var g=0;b>g;g++)this.map[f]&&!this.map[f][g]&&g>0&&(this.map[f][g]=new h(this.createCells("td",1)),c=this.map[f][g-1],c&&c.el&&c.el.parent&&e(this.map[f][g-1].el,this.map[f][g].el))}},rectify:function(){return this.removeEmptyTable()?!1:(this.removeSurplusLines(),this.fillMissingCells(),!0)},unmerge:function(){if(this.rectify()&&(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx)){var a=this.map[this.idx.row][this.idx.col],b=g.getAttribute(a.el,"colspan")?parseInt(g.getAttribute(a.el,"colspan"),10):1,c=a.el.tagName.toLowerCase();if(a.isRowspan){var d=parseInt(g.getAttribute(a.el,"rowspan"),10);if(d>1)for(var e=1,f=d-1;f>=e;e++)this.injectRowAt(this.idx.row+e,this.idx.col,b,c,a);a.el.removeAttribute("rowspan")}this.splitRowToCells(a)}},merge:function(a){if(this.rectify())if(this.canMerge(a)){for(var b=this.idx_end.row-this.idx_start.row+1,c=this.idx_end.col-this.idx_start.col+1,e=this.idx_start.row,f=this.idx_end.row;f>=e;e++)for(var g=this.idx_start.col,h=this.idx_end.col;h>=g;g++)e==this.idx_start.row&&g==this.idx_start.col?(b>1&&this.map[e][g].el.setAttribute("rowspan",b),c>1&&this.map[e][g].el.setAttribute("colspan",c)):(/^\s*\s*$/.test(this.map[e][g].el.innerHTML.toLowerCase())||(this.map[this.idx_start.row][this.idx_start.col].el.innerHTML+=" "+this.map[e][g].el.innerHTML),d(this.map[e][g].el));this.rectify()}else window.console&&console.log("Do not know how to merge allready merged cells.")},collapseCellToNextRow:function(a){var b=this.getMapIndex(a.el),c=b.row+1,d={row:c,col:b.col};if(c=0)e(this.getRowCells(f)[h],a.el);else{var i=this.getLastNewCellOnRow(f,c);null!==i?e(i,a.el):f.insertBefore(a.el,f.firstChild)}parseInt(g.getAttribute(a.el,"rowspan"),10)>2?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)-1):a.el.removeAttribute("rowspan")}}},removeRowCell:function(a){a.isReal?a.isRowspan?this.collapseCellToNextRow(a):d(a.el):parseInt(g.getAttribute(a.el,"rowspan"),10)>2?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)-1):a.el.removeAttribute("rowspan")},getRowElementsByCell:function(){var a=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=this.map[this.idx.row],c=0,d=b.length;d>c;c++)b[c].isReal&&a.push(b[c].el);return a},getColumnElementsByCell:function(){var a=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=0,c=this.map.length;c>b;b++)this.map[b][this.idx.col]&&this.map[b][this.idx.col].isReal&&a.push(this.map[b][this.idx.col].el);return a},removeRow:function(){var a=g.getParentElement(this.cell,{query:"tr"});if(a){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=this.map[this.idx.row],c=0,e=b.length;e>c;c++)b[c].modified||(this.setCellAsModified(b[c]),this.removeRowCell(b[c]));d(a)}},removeColCell:function(a){a.isColspan?parseInt(g.getAttribute(a.el,"colspan"),10)>2?a.el.setAttribute("colspan",parseInt(g.getAttribute(a.el,"colspan"),10)-1):a.el.removeAttribute("colspan"):a.isReal&&d(a.el)},removeColumn:function(){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var a=0,b=this.map.length;b>a;a++)this.map[a][this.idx.col].modified||(this.setCellAsModified(this.map[a][this.idx.col]),this.removeColCell(this.map[a][this.idx.col]))},remove:function(a){if(this.rectify()){switch(a){case"row":this.removeRow();break;case"column":this.removeColumn()}this.rectify()}},addRow:function(a){var b=this.table.ownerDocument;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"below"==a&&g.getAttribute(this.cell,"rowspan")&&(this.idx.row=this.idx.row+parseInt(g.getAttribute(this.cell,"rowspan"),10)-1),this.idx!==!1){for(var c=this.map[this.idx.row],d=b.createElement("tr"),f=0,h=c.length;h>f;f++)c[f].modified||(this.setCellAsModified(c[f]),this.addRowCell(c[f],d,a));switch(a){case"below":e(this.getRealRowEl(!0),d);break;case"above":var i=g.getParentElement(this.map[this.idx.row][this.idx.col].el,{query:"tr"});i&&i.parentNode.insertBefore(d,i)}}},addRowCell:function(a,b,d){var e=a.isColspan?{colspan:g.getAttribute(a.el,"colspan")}:null;a.isReal?"above"!=d&&a.isRowspan?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)+1):b.appendChild(this.createCells("td",1,e)):"above"!=d&&a.isRowspan&&a.lastRow?b.appendChild(this.createCells("td",1,e)):c.isRowspan&&a.el.attr("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)+1)},add:function(a){this.rectify()&&(("below"==a||"above"==a)&&this.addRow(a),("before"==a||"after"==a)&&this.addColumn(a))},addColCell:function(a,b,d){ -var f,h=a.el.tagName.toLowerCase();switch(d){case"before":f=!a.isColspan||a.firstCol;break;case"after":f=!a.isColspan||a.lastCol||a.isColspan&&c.el==this.cell}if(f){switch(d){case"before":a.el.parentNode.insertBefore(this.createCells(h,1),a.el);break;case"after":e(a.el,this.createCells(h,1))}a.isRowspan&&this.handleCellAddWithRowspan(a,b+1,d)}else a.el.setAttribute("colspan",parseInt(g.getAttribute(a.el,"colspan"),10)+1)},addColumn:function(a){var b,c;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"after"==a&&g.getAttribute(this.cell,"colspan")&&(this.idx.col=this.idx.col+parseInt(g.getAttribute(this.cell,"colspan"),10)-1),this.idx!==!1)for(var d=0,e=this.map.length;e>d;d++)b=this.map[d],b[this.idx.col]&&(c=b[this.idx.col],c.modified||(this.setCellAsModified(c),this.addColCell(c,d,a)))},handleCellAddWithRowspan:function(a,b,c){for(var d,h,i,j=parseInt(g.getAttribute(this.cell,"rowspan"),10)-1,k=g.getParentElement(a.el,{query:"tr"}),l=a.el.tagName.toLowerCase(),m=this.table.ownerDocument,n=0;j>n;n++)if(d=this.correctColIndexForUnreals(this.idx.col,b+n),k=f(k,"tr"))if(d>0)switch(c){case"before":h=this.getRowCells(k),d>0&&this.map[b+n][this.idx.col].el!=h[d]&&d==h.length-1?e(h[d],this.createCells(l,1)):h[d].parentNode.insertBefore(this.createCells(l,1),h[d]);break;case"after":e(this.getRowCells(k)[d],this.createCells(l,1))}else k.insertBefore(this.createCells(l,1),k.firstChild);else i=m.createElement("tr"),i.appendChild(this.createCells(l,1)),this.table.appendChild(i)}},g.table={getCellsBetween:function(a,b){var c=new i(a);return c.getMapElsTo(b)},addCells:function(a,b){var c=new i(a);c.add(b)},removeCells:function(a,b){var c=new i(a);c.remove(b)},mergeCellsBetween:function(a,b){var c=new i(a);c.merge(b)},unmergeCell:function(a){var b=new i(a);b.unmerge()},orderSelectionEnds:function(a,b){var c=new i(a);return c.orderSelectionEnds(b)},indexOf:function(a){var b=new i(a);return b.setTableMap(),b.getMapIndex(a)},findCell:function(a,b){var c=new i(null,a);return c.getElementAtIndex(b)},findRowByCell:function(a){var b=new i(a);return b.getRowElementsByCell()},findColumnByCell:function(a){var b=new i(a);return b.getColumnElementsByCell()},canMerge:function(a,b){var c=new i(a);return c.canMerge(b)}}}(wysihtml5),wysihtml5.dom.query=function(a,b){var c,d=[];a.nodeType&&(a=[a]);for(var e=0,f=a.length;f>e;e++)if(c=a[e].querySelectorAll(b))for(var g=c.length;g--;d.unshift(c[g]));return d},wysihtml5.dom.compareDocumentPosition=function(){var a=document.documentElement;return a.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)}:function(a,b){var c,d;if(c=9===a.nodeType?a:a.ownerDocument,d=9===b.nodeType?b:b.ownerDocument,a===b)return 0;if(a===b.ownerDocument)return 20;if(a.ownerDocument===b)return 10;if(c!==d)return 1;if(2===a.nodeType&&a.childNodes&&-1!==wysihtml5.lang.array(a.childNodes).indexOf(b))return 20;if(2===b.nodeType&&b.childNodes&&-1!==wysihtml5.lang.array(b.childNodes).indexOf(a))return 10;for(var e=a,f=[],g=null;e;){if(e==b)return 10;f.push(e),e=e.parentNode}for(e=b,g=null;e;){if(e==a)return 20;var h=wysihtml5.lang.array(f).indexOf(e);if(-1!==h){var i=f[h],j=wysihtml5.lang.array(i.childNodes).indexOf(f[h-1]),k=wysihtml5.lang.array(i.childNodes).indexOf(g);return j>k?2:4}g=e,e=e.parentNode}return 1}}(),wysihtml5.dom.unwrap=function(a){var b=[];if(a.parentNode){for(;a.lastChild;)b.unshift(a.lastChild),wysihtml5.dom.insert(a.lastChild).after(a);a.parentNode.removeChild(a)}return b},wysihtml5.dom.getPastedHtml=function(a){var b;return wysihtml5.browser.supportsModernPaste()&&a.clipboardData&&(wysihtml5.lang.array(a.clipboardData.types).contains("text/html")?b=a.clipboardData.getData("text/html"):wysihtml5.lang.array(a.clipboardData.types).contains("text/plain")&&(b=wysihtml5.lang.string(a.clipboardData.getData("text/plain")).escapeHTML(!0,!0))),b},wysihtml5.dom.getPastedHtmlWithDiv=function(a,b){var c=a.selection.getBookmark(),d=a.element.ownerDocument,e=d.createElement("DIV"),f=a.getScrollPos();d.body.appendChild(e),e.style.width="1px",e.style.height="1px",e.style.overflow="hidden",e.style.position="absolute",e.style.top=f.y+"px",e.style.left=f.x+"px",e.setAttribute("contenteditable","true"),e.focus(),setTimeout(function(){var d;a.selection.setBookmark(c),d=e.innerHTML,d&&/^$/i.test(d.trim())&&(d=!1),b(d),e.parentNode.removeChild(e)},0)},wysihtml5.dom.removeInvisibleSpaces=function(a){for(var b=wysihtml5.dom.getTextNodes(a),c=b.length;c--;)b[c].nodeValue=b[c].nodeValue.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP,"")},wysihtml5.quirks.cleanPastedHTML=function(){var a=function(a){var b=wysihtml5.lang.string(a).trim(),c=b.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");return new RegExp("^((?!^"+c+"$).)*$","i")},b=function(b,c){var d,e,f=wysihtml5.lang.object(b).clone(!0);for(d in f.tags)if(f.tags.hasOwnProperty(d)&&f.tags[d].keep_styles)for(e in f.tags[d].keep_styles)f.tags[d].keep_styles.hasOwnProperty(e)&&c[e]&&(f.tags[d].keep_styles[e]=a(c[e]));return f},c=function(a,b){var c;if(!a)return null;for(var d=0,e=a.length;e>d;d++)if(a[d].condition||(c=a[d].set),a[d].condition&&a[d].condition.test(b))return a[d].set;return c};return function(a,d){var e,f={color:wysihtml5.dom.getStyle("color").from(d.referenceNode),fontSize:wysihtml5.dom.getStyle("font-size").from(d.referenceNode)},g=b(c(d.rules,a)||{},f);return e=wysihtml5.dom.parse(a,{rules:g,cleanUp:!0,context:d.referenceNode.ownerDocument,uneditableClass:d.uneditableClass,clearInternals:!0,unjoinNbsps:!0})}}(),wysihtml5.quirks.ensureProperClearing=function(){var a=function(){var a=this;setTimeout(function(){var b=a.innerHTML.toLowerCase();("

     

    "==b||"

     

     

    "==b)&&(a.innerHTML="")},0)};return function(b){wysihtml5.dom.observe(b.element,["cut","keydown"],a)}}(),function(a){var b="%7E";a.quirks.getCorrectInnerHTML=function(c){var d=c.innerHTML;if(-1===d.indexOf(b))return d;var e,f,g,h,i=c.querySelectorAll("[href*='~'], [src*='~']");for(h=0,g=i.length;g>h;h++)e=i[h].href||i[h].src,f=a.lang.string(e).replace("~").by(b),d=a.lang.string(d).replace(f).by(e);return d}}(wysihtml5),function(a){var b="wysihtml5-quirks-redraw";a.quirks.redraw=function(c){a.dom.addClass(c,b),a.dom.removeClass(c,b);try{var d=c.ownerDocument;d.execCommand("italic",!1,null),d.execCommand("italic",!1,null)}catch(e){}}}(wysihtml5),wysihtml5.quirks.tableCellsSelection=function(a,b){function c(){return a.addEventListener("mousedown",n),l}function d(c){l.start=c,l.end=c,l.cells=[c],l.table=k.getParentElement(l.start,{query:"table"},!1,a),l.table&&(e(),k.addClass(c,m),a.addEventListener("mousemove",g),a.addEventListener("mouseup",h),b.fire("tableselectstart").fire("tableselectstart:composer"))}function e(){if(a){var b=a.querySelectorAll("."+m);if(b.length>0)for(var c=0;c1&&b.composer.selection.deselect(),f(l.cells),l.end!==d&&b.fire("tableselectchange").fire("tableselectchange:composer")))}function h(c){a.removeEventListener("mousemove",g),a.removeEventListener("mouseup",h),b.fire("tableselect").fire("tableselect:composer"),setTimeout(function(){i()},0)}function i(){a.ownerDocument.addEventListener("click",o)}function j(c,d){l.start=c,l.end=d,l.table=k.getParentElement(l.start,{query:"table"},!1,a),selectedCells=k.table.getCellsBetween(l.start,l.end),f(selectedCells),i(),b.fire("tableselect").fire("tableselect:composer")}var k=wysihtml5.dom,l={table:null,start:null,end:null,cells:null,select:j},m="wysiwyg-tmp-selected-cell",n=function(b){var c=wysihtml5.dom.getParentElement(b.target,{query:"td, th"},!1,a);c&&d(c)},o=function(c){a.ownerDocument.removeEventListener("click",o),k.getParentElement(c.target,{query:"table"},!1,a)!=l.table&&(e(),l.table=null,l.start=null,l.end=null,b.fire("tableunselect").fire("tableunselect:composer"))};return c()},function(a){function b(a){var b,c;for(b in d)if(d.hasOwnProperty(b)&&(c=d[b],c.regex.test(a)))return c}function c(a){var c=b(a);return c?c.name:void 0}var d={rgba:{regex:/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]+)\s*\)/i,name:"rgba"},rgb:{regex:/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i,name:"rgb"},hex6:{regex:/^#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])/i,name:"hex",radix:16},hex3:{regex:/^#([0-9a-f])([0-9a-f])([0-9a-f])/i,name:"hex",radix:16}},e=function(a){return new RegExp("(^|\\s|;)"+a+"\\s*:\\s*[^;$]+","gi")};a.quirks.styleParser={getColorParseMethod:b,getColorFormat:c,parseColor:function(c,f){var g,h,i,j,k,l=c;if(f){if(g=e(f),!(h=c.match(g)))return!1;h=h.pop().split(":")[1],l=a.lang.string(h).trim()}return(i=b(l))&&(j=l.match(i.regex))?(k=i.radix||10,i===d.hex3?(j.shift(),j.push(1),a.lang.array(j).map(function(a,b){return 3>b?parseInt(a,k)*k+parseInt(a,k):parseFloat(a)})):(j.shift(),j[3]||j.push(1),a.lang.array(j).map(function(a,b){return 3>b?parseInt(a,k):parseFloat(a)}))):!1},unparseColor:function(a,b){var c=16;return"hex"===b?(a[0].toString(c)+a[1].toString(c)+a[2].toString(c)).toUpperCase():"hash"===b?"#"+(a[0].toString(c)+a[1].toString(c)+a[2].toString(c)).toUpperCase():"rgb"===b?"rgb("+a[0]+","+a[1]+","+a[2]+")":"rgba"===b?"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")":"csv"===b?a[0]+","+a[1]+","+a[2]+","+a[3]:a[3]&&1!==a[3]?"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")":"rgb("+a[0]+","+a[1]+","+a[2]+")"},parseFontSize:function(b){var c=b.match(e("font-size"));return c?a.lang.string(c[c.length-1].split(":")[1]).trim():!1}}}(wysihtml5),function(a){function b(a){var b=0;if(a.parentNode)do b+=a.offsetTop||0,a=a.offsetParent;while(a);return b}function c(a,b){for(var c=0;b!==a;)if(c++,b=b.parentNode,!b)throw new Error("not a descendant of ancestor!");return c}function d(a,b){return 3===a.nodeType?a:a.childNodes[b]||a}function e(b){var c=document.createElement("span"),d=function(a){b.removeEventListener("mouseup",d),b.removeEventListener("keydown",d),b.removeEventListener("touchstart",d),b.removeEventListener("focus",d),b.removeEventListener("blur",d),b.removeEventListener("paste",e),b.removeEventListener("drop",e),b.removeEventListener("beforepaste",e),c&&c.parentNode&&c.parentNode.removeChild(c)},e=function(a){c&&c.parentNode&&setTimeout(d,0)};return c.appendChild(b.ownerDocument.createTextNode(a.INVISIBLE_SPACE)),c.className="_wysihtml5-temp-caret-fix",c.style.display="block",c.style.minWidth="1px",c.style.height="0px",b.addEventListener("mouseup",d),b.addEventListener("keydown",d),b.addEventListener("touchstart",d),b.addEventListener("focus",d),b.addEventListener("blur",d),b.addEventListener("paste",e),b.addEventListener("drop",e),b.addEventListener("beforepaste",e),c}function f(a){if(!a.canSurroundContents())for(var b=a.commonAncestorContainer,d=c(b,a.startContainer),e=c(b,a.endContainer);!a.canSurroundContents();)d>e?(a.setStartBefore(a.startContainer),d=c(b,a.startContainer)):(a.setEndAfter(a.endContainer),e=c(b,a.endContainer))}var g=a.dom;a.Selection=Base.extend({constructor:function(a,b,c){rangy.init(),this.editor=a,this.composer=a.composer,this.doc=this.composer.doc,this.win=this.composer.win,this.contain=b,this.unselectableClass=c||!1},getBookmark:function(){var a=this.getRange();return a&&a.cloneRange()},setBookmark:function(a){a&&this.setSelection(a)},setBefore:function(a){var b=rangy.createRange(this.doc);return b.setStartBefore(a),b.setEndBefore(a),this.setSelection(b)},createTemporaryCaretSpaceAfter:function(b){var c=this.doc.createElement("span"),d=this.doc.createTextNode(a.INVISIBLE_SPACE),e=function(b){var d;this.contain.removeEventListener("mouseup",e),this.contain.removeEventListener("keydown",g),this.contain.removeEventListener("touchstart",e),this.contain.removeEventListener("focus",e),this.contain.removeEventListener("blur",e),this.contain.removeEventListener("paste",f),this.contain.removeEventListener("drop",f),this.contain.removeEventListener("beforepaste",f),c&&c.parentNode&&(c.innerHTML=c.innerHTML.replace(a.INVISIBLE_SPACE_REG_EXP,""),/[^\s]+/.test(c.innerHTML)?(d=c.lastChild,a.dom.unwrap(c),this.setAfter(d)):c.parentNode.removeChild(c))}.bind(this),f=function(a){c&&c.parentNode&&setTimeout(e,0)},g=function(a){8===a.which||91===a.which||17===a.which||86===a.which&&(a.ctrlKey||a.metaKey)||e()};return c.className="_wysihtml5-temp-caret-fix",c.style.position="absolute",c.style.display="block",c.style.minWidth="1px",c.style.zIndex="99999",c.appendChild(d),b.parentNode.insertBefore(c,b.nextSibling),this.setBefore(d),this.contain.addEventListener("mouseup",e),this.contain.addEventListener("keydown",g),this.contain.addEventListener("touchstart",e),this.contain.addEventListener("focus",e),this.contain.addEventListener("blur",e),this.contain.addEventListener("paste",f),this.contain.addEventListener("drop",f),this.contain.addEventListener("beforepaste",f),c},setAfter:function(b,c,d){var e,f=this.win,g=rangy.createRange(this.doc),h=function(){var d=b.parentNode,g=d?d.childNodes[d.childNodes.length-1]:null;if(!e||g===b&&1===b.nodeType&&"block"===f.getComputedStyle(b).display)if(c){var h=this.doc.createTextNode(a.INVISIBLE_SPACE);b.parentNode.insertBefore(h,b.nextSibling),this.selectNode(h),setTimeout(function(){h&&h.parentNode&&h.parentNode.removeChild(h)},0)}else this.createTemporaryCaretSpaceAfter(b)}.bind(this);if(g.setStartAfter(b),g.setEndAfter(b),document.activeElement&&document.activeElement===this.composer.element)e=this.setSelection(g),h(),d&&d(e);else{var i=this.composer.getScrollPos();this.composer.element.focus(),this.composer.setScrollPos(i),setTimeout(function(){e=this.setSelection(g),h(),d&&d(e)}.bind(this),0)}},selectNode:function(b,c){var d=rangy.createRange(this.doc),e=b.nodeType===a.ELEMENT_NODE,f="canHaveHTML"in b?b.canHaveHTML:"IMG"!==b.nodeName,h=e?b.innerHTML:b.data,i=""===h||h===a.INVISIBLE_SPACE,j=g.getStyle("display").from(b),k="block"===j||"list-item"===j;if(i&&e&&f&&!c)try{b.innerHTML=a.INVISIBLE_SPACE}catch(l){}f?d.selectNodeContents(b):d.selectNode(b),f&&i&&e?d.collapse(k):f&&i&&(d.setStartAfter(b),d.setEndAfter(b)),this.setSelection(d)},getSelectedNode:function(a){var b,c;return a&&this.doc.selection&&"Control"===this.doc.selection.type&&(c=this.doc.selection.createRange(),c&&c.length)?c.item(0):(b=this.getSelection(this.doc),b.focusNode===b.anchorNode?b.focusNode:(c=this.getRange(this.doc),c?c.commonAncestorContainer:this.doc.body))},fixSelBorders:function(){var a=this.getRange();f(a),this.setSelection(a)},getSelectedOwnNodes:function(a){for(var b=this.getOwnRanges(),c=[],d=0,e=b.length;e>d;d++)c.push(b[d].commonAncestorContainer||this.doc.body);return c},findNodesInSelection:function(b){for(var c,d=this.getOwnRanges(),e=[],f=0,g=d.length;g>f;f++)c=d[f].getNodes([1],function(c){return a.lang.array(b).contains(c.nodeName)}),e=e.concat(c);return e},filterElements:function(a){for(var b,c=this.getOwnRanges(),d=[],e=0,f=c.length;f>e;e++)b=c[e].getNodes([1],function(b){return a(b,c[e])}),d=d.concat(b);return d},containsUneditable:function(){for(var a=this.getOwnUneditables(),b=this.getSelection(),c=0,d=a.length;d>c;c++)if(b.containsNode(a[c]))return!0;return!1},deleteContents:function(){var a=this.getRange();this.deleteRangeContents(a),this.setSelection(a)},deleteRangeContents:function(b){var c,d,e,f;if(this.unselectableClass){(c=a.dom.getParentElement(b.startContainer,{query:"."+this.unselectableClass},!1,this.contain))&&b.setStartBefore(c),(d=a.dom.getParentElement(b.endContainer,{query:"."+this.unselectableClass},!1,this.contain))&&b.setEndAfter(d),e=b.getNodes([1],function(b){return a.dom.hasClass(b,this.unselectableClass)}.bind(this));for(var g=e.length;g--;)try{f=new CustomEvent("wysihtml5:uneditable:delete"),e[g].dispatchEvent(f)}catch(h){}}b.deleteContents()},getCaretNode:function(){var a=this.getSelection();return a&&a.anchorNode?d(a.anchorNode,a.anchorOffset):null},getPreviousNode:function(b,c){var e;if(!b){var f=this.getSelection();b=f&&f.anchorNode?d(f.anchorNode,f.anchorOffset):null}if(b===this.contain)return!1;var g,h=b.previousSibling;return h===this.contain?!1:(h&&3!==h.nodeType&&1!==h.nodeType?h=this.getPreviousNode(h,c):h&&3===h.nodeType&&/^\s*$/.test(h.textContent)?h=this.getPreviousNode(h,c):c&&h&&1===h.nodeType?(e=a.dom.getStyle("display").from(h),a.lang.array(["BR","HR","IMG"]).contains(h.nodeName)||a.lang.array(["block","inline-block","flex","list-item","table"]).contains(e)||!/^[\s]*$/.test(h.innerHTML)||(h=this.getPreviousNode(h,c))):h||b===this.contain||(g=b.parentNode,g!==this.contain&&(h=this.getPreviousNode(g,c))),h!==this.contain?h:!1)},getNodesNearCaret:function(){if(!this.isCollapsed())throw"Selection must be caret when using selection.getNodesNearCaret()";var a,b,c,d,e=this.getOwnRanges();return e&&e.length>0?(1===e[0].startContainer.nodeType?(a=e[0].startContainer.childNodes[e[0].startOffset-1],a||0!==e[0].startOffset?a&&(b=a.previousSibling,c=a.nextSibling):c=e[0].startContainer.childNodes[0]):(0===e[0].startOffset&&e[0].startContainer.previousSibling?(a=e[0].startContainer.previousSibling,3===a.nodeType&&(d=a.data.length)):(a=e[0].startContainer,d=e[0].startOffset),b=a.previousSibling,c=a.nextSibling),{caretNode:a,prevNode:b,nextNode:c,textOffset:d}):null},getSelectionParentsByTag:function(b){for(var c,d=this.getSelectedOwnNodes(),e=[],f=0,g=d.length;g>f;f++)c=d[f].nodeName&&"LI"===d[f].nodeName?d[f]:a.dom.getParentElement(d[f],{query:"li"},!1,this.contain),c&&e.push(c);return e.length?e:null},getRangeToNodeEnd:function(){if(this.isCollapsed()){var a=this.getRange(),b=a.startContainer,c=a.startOffset,d=rangy.createRange(this.doc);return d.selectNodeContents(b),d.setStart(b,c),d}},caretIsLastInSelection:function(){var a=(rangy.createRange(this.doc),this.getSelection(),this.getRangeToNodeEnd().cloneContents()),b=a.textContent;return/^\s*$/.test(b)},caretIsFirstInSelection:function(b){var c=rangy.createRange(this.doc),e=this.getSelection(),f=this.getRange(),g=d(f.startContainer,f.startOffset);if(g){if(g.nodeType===a.TEXT_NODE){if(!g.parentNode)return!1;if(!this.isCollapsed()||g.parentNode.firstChild!==g&&!a.dom.domNode(g.previousSibling).is.block())return!1;var h=this.win.getComputedStyle(g.parentNode).whiteSpace;return"pre"===h||"pre-wrap"===h?0===f.startOffset:/^\s*$/.test(g.data.substr(0,f.startOffset))}return b&&a.dom.domNode(g).is.lineBreak()?!0:(c.selectNodeContents(this.getRange().commonAncestorContainer),c.collapse(!0),this.isCollapsed()&&(c.startContainer===e.anchorNode||c.endContainer===e.anchorNode)&&c.startOffset===e.anchorOffset)}},caretIsInTheBeginnig:function(b){var c=this.getSelection(),d=c.anchorNode,e=c.anchorOffset;return b&&d?0===e&&(d.nodeName&&d.nodeName===b.toUpperCase()||a.dom.getParentElement(d.parentNode,{query:b},1)):d?0===e&&!this.getPreviousNode(d,!0):void 0},getBeforeSelection:function(b){var c,d,e=this.getSelection(),f=e.isBackwards()?e.focusNode:e.anchorNode,g=e.isBackwards()?e.focusOffset:e.anchorOffset,h=this.createRange();if(f&&3===f.nodeType&&/^\s*$/.test(f.data.slice(0,g))&&(g=0),d=a.dom.getParentElement(f,{query:"._wysihtml5-temp-caret-fix"},1),d&&(f=d.parentNode,g=Array.prototype.indexOf.call(f.childNodes,d)),f){if(g>0)return 3===f.nodeType?(h.setStart(f,0),h.setEnd(f,g),{type:"text",range:h,offset:g,node:f}):(h.setStartBefore(f.childNodes[0]),c=f.childNodes[g-1],h.setEndAfter(c),{type:"element",range:h,offset:g,node:c});if(h.setStartAndEnd(f,0),b){var i=this.getPreviousNode(f,!0),j=null;if(i&&(j=1===i.nodeType&&a.dom.hasClass(i,this.unselectableClass)?i:a.dom.domNode(i).lastLeafNode()),j)return{type:"leafnode",range:h,offset:g,node:j}}return{type:"none",range:h,offset:g,node:f}}return null},executeAndRestoreRangy:function(a,b){var c=rangy.saveSelection(this.win);if(c)try{a()}catch(d){setTimeout(function(){throw d},0)}else a();rangy.restoreSelection(c)},executeAndRestore:function(b,c){var d,e,f,h,i,j,k,l,m=this.doc.body,n=c&&m.scrollTop,o=c&&m.scrollLeft,p="_wysihtml5-temp-placeholder",q=''+a.INVISIBLE_SPACE+"",r=this.getRange(!0);if(!r)return void b(m,m);r.collapsed||(k=r.cloneRange(),j=k.createContextualFragment(q),k.collapse(!1),k.insertNode(j),k.detach()),i=r.createContextualFragment(q),r.insertNode(i),j&&(d=this.contain.querySelectorAll("."+p),r.setStartBefore(d[0]),r.setEndAfter(d[d.length-1])),this.setSelection(r);try{b(r.startContainer,r.endContainer)}catch(s){setTimeout(function(){throw s},0)}if(d=this.contain.querySelectorAll("."+p),d&&d.length){l=rangy.createRange(this.doc),f=d[0].nextSibling,d.length>1&&(h=d[d.length-1].previousSibling),h&&f?(l.setStartBefore(f),l.setEndAfter(h)):(e=this.doc.createTextNode(a.INVISIBLE_SPACE),g.insert(e).after(d[0]),l.setStartBefore(e),l.setEndAfter(e)),this.setSelection(l);for(var t=d.length;t--;)d[t].parentNode.removeChild(d[t])}else this.contain.focus();c&&(m.scrollTop=n,m.scrollLeft=o);try{d.parentNode.removeChild(d)}catch(u){}},set:function(a,b){var c=rangy.createRange(this.doc);c.setStart(a,b||0),this.setSelection(c)},insertHTML:function(a){var b,c,d=this.getRange(),e=this.doc.createElement("DIV"),f=this.doc.createDocumentFragment();if(d){for(d.deleteContents(),e.innerHTML=a,b=e.lastChild;e.firstChild;)f.appendChild(e.firstChild);for(d.insertNode(f),c=this.contain.lastChild;c&&3===c.nodeType&&c.previousSibling&&/^\s*$/.test(c.data);)c=c.previousSibling;b&&(c&&b===c&&1===b.nodeType&&this.contain.appendChild(this.doc.createElement("br")),this.setAfter(b))}},insertNode:function(a){var b=this.getRange();b&&b.insertNode(a)},canAppendChild:function(a){var b,c,d=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],e=this.getRange();return b=a||e.startContainer,b&&(c=(b.tagName||b.nodeName).toLowerCase()),-1===d.indexOf(c)},splitElementAtCaret:function(b,c){var d,e,f,g,h,i=this.getSelection();if(i.rangeCount>0){d=i.getRangeAt(0).cloneRange(),d.setEndAfter(b),e=d.extractContents(),h=e.childNodes;for(var j=h.length;j--;)a.dom.domNode(h[j]).is.visible()||e.removeChild(h[j]);b.parentNode.insertBefore(e,b.nextSibling),c?(f=c.firstChild||c,g=c.lastChild||c,b.parentNode.insertBefore(c,b.nextSibling),f&&g&&(d.setStartBefore(f),d.setEndAfter(g),this.setSelection(d))):(d.setStartAfter(b),d.setEndAfter(b)),a.dom.domNode(b).is.visible()||(""===a.dom.getTextContent(b)?b.parentNode.removeChild(b):b.parentNode.replaceChild(this.doc.createTextNode(" "),b))}},surround:function(a){var b,c=this.getOwnRanges(),d=[];if(0==c.length)return d;for(var e=c.length;e--;){b=this.doc.createElement(a.nodeName),d.push(b),a.className&&(b.className=a.className),a.cssStyle&&b.setAttribute("style",a.cssStyle);try{c[e].surroundContents(b),this.selectNode(b)}catch(f){b.appendChild(c[e].extractContents()),c[e].insertNode(b)}}return d},scrollIntoView:function(){var c,d=this.doc,e=5,f=d.documentElement.scrollHeight>d.documentElement.offsetHeight,g=d._wysihtml5ScrollIntoViewElement=d._wysihtml5ScrollIntoViewElement||function(){var b=d.createElement("span");return b.innerHTML=a.INVISIBLE_SPACE,b}();f&&(this.insertNode(g),c=b(g),g.parentNode.removeChild(g),c>=d.body.scrollTop+d.documentElement.offsetHeight-e&&(d.body.scrollTop=c))},selectLine:function(){var b=rangy.createRange();a.browser.supportsSelectionModify()?this._selectLine_W3C():b.nativeRange&&b.nativeRange.getBoundingClientRect&&this._selectLineUniversal()},includeRangyRangeHelpers:function(){var a=this.getSelection(),b=a.getRangeAt(0),c=function(a){return a&&1===a.nodeType&&a.classList.contains("rangySelectionBoundary")},d=function(a){return 1===a.nodeType?a.childNodes&&a.childNodes.length||0:a.data&&a.data.length||0},e=1===a.anchorNode.nodeType?a.anchorNode.childNodes[a.anchorOffset]:a.anchorNode,f=1===a.focusNode.nodeType?a.focusNode.childNodes[a.focusOffset]:a.focusNode;f&&a.focusOffset===d(f)&&f.nextSibling&&c(f.nextSibling)&&b.setEndAfter(f.nextSibling),e&&0===a.anchorOffset&&e.previousSibling&&c(e.previousSibling)&&b.setStartBefore(e.previousSibling),b.select()},_selectLine_W3C:function(){var a=this.win.getSelection(),b=[a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset];a.modify("move","left","lineboundary"),a.modify("extend","right","lineboundary"),a.anchorNode===b[0]&&a.anchorOffset===b[1]&&a.focusNode===b[2]&&a.focusOffset===b[3]?this._selectLineUniversal():this.includeRangyRangeHelpers()},toLineBoundary:function(b,c){if(c="undefined"==typeof c?!1:c,a.browser.supportsSelectionModify()){var d=this.win.getSelection();d.modify("extend",b,"lineboundary"),c&&("left"===b?d.collapseToStart():"right"===b&&d.collapseToEnd())}},getRangeRect:function(a){var b,c=(this.doc.createTextNode("i"),this.doc.createTextNode("i"));return a.collapsed?(a.insertNode(c),a.selectNode(c),b=a.nativeRange.getBoundingClientRect(),a.deleteContents()):b=a.nativeRange.getBoundingClientRect(),b},_selectLineUniversal:function(){var b,c,d,e,f,g,h=this.getSelection(),i=h.getRangeAt(0),j=0,k=this,l=function(b){return b&&1===b.nodeType&&("block"===k.win.getComputedStyle(b).display||a.lang.array(["BR","HR"]).contains(b.nodeName))},m=function(a){var b=a;if(b)for(;b&&(1===b.nodeType&&b.classList.contains("rangySelectionBoundary")||3===b.nodeType&&/^\s*$/.test(b.data));)b=b.previousSibling;return b};c=i.cloneRange(),d=i.cloneRange(),i.collapsed&&(3===i.startContainer.nodeType&&i.startOffset0?i.moveEnd("character",1):i.startOffset>0&&(3===i.startContainer.nodeType||1===i.startContainer.nodeType&&!l(m(i.startContainer.childNodes[i.startOffset-1])))&&i.moveStart("character",-1)),i.collapsed||i.insertNode(this.doc.createTextNode(a.INVISIBLE_SPACE)),b=i.nativeRange.getBoundingClientRect();do e=i.moveStart("character",-1),f=i.nativeRange.getBoundingClientRect(),f&&Math.floor(f.top)===Math.floor(b.top)||(i.moveStart("character",1),g=!0),j++;while(0!==e&&!g&&2e3>j);if(j=0,g=!1,b=i.nativeRange.getBoundingClientRect(),i.endContainer!==this.contain||this.contain.lastChild&&this.contain.childNodes[i.endOffset]!==this.contain.lastChild)do e=i.moveEnd("character",1),f=i.nativeRange.getBoundingClientRect(),f&&Math.floor(f.bottom)===Math.floor(b.bottom)||(i.moveEnd("character",-1),i.endContainer&&1===i.endContainer.nodeType&&i.endContainer.childNodes[i.endOffset]&&1===i.endContainer.childNodes[i.endOffset].nodeType&&"BR"===i.endContainer.childNodes[i.endOffset].nodeName&&i.endContainer.childNodes[i.endOffset].previousSibling&&(1===i.endContainer.childNodes[i.endOffset].previousSibling.nodeType?i.setEnd(i.endContainer.childNodes[i.endOffset].previousSibling,i.endContainer.childNodes[i.endOffset].previousSibling.childNodes.length):3===i.endContainer.childNodes[i.endOffset].previousSibling.nodeType&&i.setEnd(i.endContainer.childNodes[i.endOffset].previousSibling,i.endContainer.childNodes[i.endOffset].previousSibling.data.length)),g=!0),j++;while(0!==e&&!g&&2e3>j);i.select(),this.includeRangyRangeHelpers()},getText:function(){var a=this.getSelection();return a?a.toString():""},getNodes:function(a,b){var c=this.getRange();return c?c.getNodes(Array.isArray(a)?a:[a],b):[]},getOwnNodes:function(a,b,c){for(var d=this.getOwnRanges(),e=[],f=0,g=d.length;g>f;f++)d[f]&&(c&&d[f].splitBoundaries(),e=e.concat(d[f].getNodes(Array.isArray(a)?a:[a],b)));return e},fixRangeOverflow:function(a){if(this.contain&&this.contain.firstChild&&a){var b=a.compareNode(this.contain);if(2!==b)1===b&&a.setStartBefore(this.contain.firstChild),0===b&&a.setEndAfter(this.contain.lastChild),3===b&&(a.setStartBefore(this.contain.firstChild),a.setEndAfter(this.contain.lastChild));else if(this._detectInlineRangeProblems(a)){var c=a.endContainer.previousElementSibling;c&&a.setEnd(c,this._endOffsetForNode(c))}}},_endOffsetForNode:function(a){var b=document.createRange();return b.selectNodeContents(a),b.endOffset},_detectInlineRangeProblems:function(a){var b=g.compareDocumentPosition(a.startContainer,a.endContainer);return 0==a.endOffset&&4&b},getRange:function(a){var b=this.getSelection(),c=b&&b.rangeCount&&b.getRangeAt(0);return a!==!0&&this.fixRangeOverflow(c),c},getOwnUneditables:function(){var b=g.query(this.contain,"."+this.unselectableClass),c=g.query(b,"."+this.unselectableClass);return a.lang.array(b).without(c)},getOwnRanges:function(){var a,b=[],c=this.getRange();if(c&&b.push(c),this.unselectableClass&&this.contain&&c){var d,e=this.getOwnUneditables();if(e.length>0)for(var f=0,g=e.length;g>f;f++){a=[];for(var h=0,i=b.length;i>h;h++){if(b[h])switch(b[h].compareNode(e[f])){case 2:break;case 3:d=b[h].cloneRange(),d.setEndBefore(e[f]),a.push(d),d=b[h].cloneRange(),d.setStartAfter(e[f]),a.push(d);break;default:a.push(b[h])}b=a}}}return b},getSelection:function(){return rangy.getSelection(this.win)},setSelection:function(a){var b=rangy.getSelection(this.win);return b.setSingleRange(a),b&&b.anchorNode&&b.focusNode?b:null},selectAll:function(){var b,c=this.createRange(),d=this.composer,f=this,g=e(this.composer.element),h=e(this.composer.element),i=function(){c.setStart(d.element,0),c.setEnd(d.element,d.element.childNodes.length),b=f.setSelection(c)},j=function(){return!b||b.nativeSelection&&b.nativeSelection.type&&("Caret"===b.nativeSelection.type||"None"===b.nativeSelection.type)};a.dom.removeInvisibleSpaces(this.composer.element),i(),this.composer.element.firstChild&&j()&&(this.composer.element.appendChild(g),i(),j()&&(g.parentNode.removeChild(g),this.composer.element.insertBefore(h,this.composer.element.firstChild),i(),j()&&(this.composer.element.appendChild(g),i())))},createRange:function(){return rangy.createRange(this.doc)},isCollapsed:function(){return this.getSelection().isCollapsed},getHtml:function(){return this.getSelection().toHtml()},getPlainText:function(){return this.getSelection().toString()},isEndToEndInNode:function(b){var c=this.getRange(),d=c.commonAncestorContainer,e=c.startContainer,f=c.endContainer;if(d.nodeType===a.TEXT_NODE&&(d=d.parentNode),e.nodeType===a.TEXT_NODE&&!/^\s*$/.test(e.data.substr(c.startOffset)))return!1;if(f.nodeType===a.TEXT_NODE&&!/^\s*$/.test(f.data.substr(c.endOffset)))return!1;for(;e&&e!==d;){if(e.nodeType!==a.TEXT_NODE&&!a.dom.contains(d,e))return!1;if(a.dom.domNode(e).prev({ignoreBlankTexts:!0}))return!1;e=e.parentNode}for(;f&&f!==d;){if(f.nodeType!==a.TEXT_NODE&&!a.dom.contains(d,f))return!1;if(a.dom.domNode(f).next({ignoreBlankTexts:!0}))return!1;f=f.parentNode}return a.lang.array(b).contains(d.nodeName)?d:!1},isInThisEditable:function(){var b=this.getSelection(),c=b.focusNode,d=b.anchorNode;return c&&1!==c.nodeType&&(c=c.parentNode),d&&1!==d.nodeType&&(d=d.parentNode),d&&c&&(a.dom.contains(this.composer.element,c)||this.composer.element===c)&&(a.dom.contains(this.composer.element,d)||this.composer.element===d)},deselect:function(){var a=this.getSelection();a&&a.removeAllRanges()}})}(wysihtml5),function(a,b){function c(a,b,c){if(!a.className)return!1;var d=a.className.match(c)||[];return d[d.length-1]===b}function d(a,b){if(!a.getAttribute||!a.getAttribute("style"))return!1;a.getAttribute("style").match(b);return a.getAttribute("style").match(b)?!0:!1}function e(a,b,c){a.getAttribute("style")?(h(a,c),a.getAttribute("style")&&!/^\s*$/.test(a.getAttribute("style"))?a.setAttribute("style",b+";"+a.getAttribute("style")):a.setAttribute("style",b)):a.setAttribute("style",b)}function f(a,b,c){a.className?(g(a,c),a.className+=" "+b):a.className=b}function g(a,b){a.className&&(a.className=a.className.replace(b,""))}function h(a,b){var c,d=[];if(a.getAttribute("style")){c=a.getAttribute("style").split(";");for(var e=c.length;e--;)c[e].match(b)||/^\s*$/.test(c[e])||d.push(c[e]);d.length?a.setAttribute("style",d.join(";")):a.removeAttribute("style")}}function i(a,b){var c=[],d=b.split(";"),e=a.getAttribute("style");if(e){e=e.replace(/\s/gi,"").toLowerCase(), -c.push(new RegExp("(^|\\s|;)"+b.replace(/\s/gi,"").replace(/([\(\)])/gi,"\\$1").toLowerCase().replace(";",";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi,"\\s?rgb\\($1,\\s?$2,\\s?$3\\)"),"gi"));for(var f=d.length;f-->0;)/^\s*$/.test(d[f])||c.push(new RegExp("(^|\\s|;)"+d[f].replace(/\s/gi,"").replace(/([\(\)])/gi,"\\$1").toLowerCase().replace(";",";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi,"\\s?rgb\\($1,\\s?$2,\\s?$3\\)"),"gi"));for(var g=0,h=c.length;h>g;g++)if(e.match(c[g]))return c[g]}return!1}function j(c,d,e,f){return e?i(c,e):f?a.dom.hasClass(c,f):b.dom.arrayContains(d,c.tagName.toLowerCase())}function k(a,b,c,d){for(var e=a.length;e--;)if(!j(a[e],b,c,d))return!1;return a.length?!0:!1}function l(a,b,c){var d=i(a,b);return d?(h(a,d),"remove"):(e(a,b,c),"change")}function m(a,b){return a.className.replace(u," ")==b.className.replace(u," ")}function n(a){for(var b=a.parentNode;a.firstChild;)b.insertBefore(a.firstChild,a);b.removeChild(a)}function o(a,b){if(a.attributes.length!=b.attributes.length)return!1;for(var c,d,e,f=0,g=a.attributes.length;g>f;++f)if(c=a.attributes[f],e=c.name,"class"!=e){if(d=b.attributes.getNamedItem(e),c.specified!=d.specified)return!1;if(c.specified&&c.nodeValue!==d.nodeValue)return!1}return!0}function p(a,c){return b.dom.isCharacterDataNode(a)?0==c?!!a.previousSibling:c==a.length?!!a.nextSibling:!0:c>0&&ce;++e)a=this.textNodes[e],b=a.parentNode,d[e]=a.data,e&&(b.removeChild(a),b.hasChildNodes()||b.parentNode.removeChild(b));return this.firstTextNode.data=c=d.join(""),c},getLength:function(){for(var a=this.textNodes.length,b=0;a--;)b+=this.textNodes[a].length;return b},toString:function(){for(var a=[],b=0,c=this.textNodes.length;c>b;++b)a[b]="'"+this.textNodes[b].data+"'";return"[Merge("+a.join(",")+")]"}},s.prototype={getAncestorWithClass:function(d){for(var e;d;){if(e=this.cssClass?c(d,this.cssClass,this.similarClassRegExp):""!==this.cssStyle?!1:!0,d.nodeType==a.ELEMENT_NODE&&"false"!=d.getAttribute("contenteditable")&&b.dom.arrayContains(this.tagNames,d.tagName.toLowerCase())&&e)return d;d=d.parentNode}return!1},getAncestorWithStyle:function(c){for(var e;c;){if(e=this.cssStyle?d(c,this.similarStyleRegExp):!1,c.nodeType==a.ELEMENT_NODE&&"false"!=c.getAttribute("contenteditable")&&b.dom.arrayContains(this.tagNames,c.tagName.toLowerCase())&&e)return c;c=c.parentNode}return!1},getMatchingAncestor:function(a){var b=this.getAncestorWithClass(a),c=!1;return b?this.cssStyle&&(c="class"):(b=this.getAncestorWithStyle(a),b&&(c="style")),{element:b,type:c}},postApply:function(a,b){for(var c,d,e,f=a[0],g=a[a.length-1],h=[],i=f,j=g,k=0,l=g.length,m=0,n=a.length;n>m;++m)d=a[m],e=null,d&&d.parentNode&&(e=this.getAdjacentMergeableTextNode(d.parentNode,!1)),e?(c||(c=new r(e),h.push(c)),c.textNodes.push(d),d===f&&(i=c.firstTextNode,k=i.length),d===g&&(j=c.firstTextNode,l=c.getLength())):c=null;if(g&&g.parentNode){var o=this.getAdjacentMergeableTextNode(g.parentNode,!0);o&&(c||(c=new r(g),h.push(c)),c.textNodes.push(o))}if(h.length){for(m=0,n=h.length;n>m;++m)h[m].doMerge();b.setStart(i,k),b.setEnd(j,l)}},getAdjacentMergeableTextNode:function(b,c){var d,e=b.nodeType==a.TEXT_NODE,f=e?b.parentNode:b,g=c?"nextSibling":"previousSibling";if(e){if(d=b[g],d&&d.nodeType==a.TEXT_NODE)return d}else if(d=f[g],d&&this.areElementsMergeable(b,d))return d[c?"firstChild":"lastChild"];return null},areElementsMergeable:function(a,c){return b.dom.arrayContains(this.tagNames,(a.tagName||"").toLowerCase())&&b.dom.arrayContains(this.tagNames,(c.tagName||"").toLowerCase())&&m(a,c)&&o(a,c)},createContainer:function(a){var b=a.createElement(this.tagNames[0]);return this.cssClass&&(b.className=this.cssClass),this.cssStyle&&b.setAttribute("style",this.cssStyle),b},applyToTextNode:function(a){var c=a.parentNode;if(1==c.childNodes.length&&b.dom.arrayContains(this.tagNames,c.tagName.toLowerCase()))this.cssClass&&f(c,this.cssClass,this.similarClassRegExp),this.cssStyle&&e(c,this.cssStyle,this.similarStyleRegExp);else{var d=this.createContainer(b.dom.getDocument(a));a.parentNode.insertBefore(d,a),d.appendChild(a)}},isRemovable:function(c){return b.dom.arrayContains(this.tagNames,c.tagName.toLowerCase())&&""===a.lang.string(c.className).trim()&&(!c.getAttribute("style")||""===a.lang.string(c.getAttribute("style")).trim())},undoToTextNode:function(a,b,c,d){var e=c?!1:!0,f=c||d,h=!1;if(!b.containsNode(f)){var i=b.cloneRange();i.selectNode(f),i.isPointInRange(b.endContainer,b.endOffset)&&p(b.endContainer,b.endOffset)&&(q(f,b.endContainer,b.endOffset,this.container),b.setEndAfter(f)),i.isPointInRange(b.startContainer,b.startOffset)&&p(b.startContainer,b.startOffset)&&(f=q(f,b.startContainer,b.startOffset,this.container))}!e&&this.similarClassRegExp&&g(f,this.similarClassRegExp),e&&this.similarStyleRegExp&&(h="change"===l(f,this.cssStyle,this.similarStyleRegExp)),this.isRemovable(f)&&!h&&n(f)},applyToRange:function(b){for(var c,d=b.length;d--;){if(c=b[d].getNodes([a.TEXT_NODE]),!c.length)try{var e=this.createContainer(b[d].endContainer.ownerDocument);return b[d].surroundContents(e),void this.selectNode(b[d],e)}catch(f){}if(b[d].splitBoundaries(),c=b[d].getNodes([a.TEXT_NODE]),c.length){for(var g,h=0,i=c.length;i>h;++h)g=c[h],this.getMatchingAncestor(g).element||this.applyToTextNode(g);b[d].setStart(c[0],0),g=c[c.length-1],b[d].setEnd(g,g.length),this.normalize&&this.postApply(c,b[d])}}},undoToRange:function(b){for(var c,d,e,f=b.length;f--;){if(c=b[f].getNodes([a.TEXT_NODE]),c.length)b[f].splitBoundaries(),c=b[f].getNodes([a.TEXT_NODE]);else{var g=b[f].endContainer.ownerDocument,h=g.createTextNode(a.INVISIBLE_SPACE);b[f].insertNode(h),b[f].selectNode(h),c=[h]}for(var i=0,j=c.length;j>i;++i)b[f].isValid()&&(d=c[i],e=this.getMatchingAncestor(d),"style"===e.type?this.undoToTextNode(d,b[f],!1,e.element):e.element&&this.undoToTextNode(d,b[f],e.element));1==j?this.selectNode(b[f],c[0]):(b[f].setStart(c[0],0),d=c[c.length-1],b[f].setEnd(d,d.length),this.normalize&&this.postApply(c,b[f]))}},selectNode:function(b,c){var d=c.nodeType===a.ELEMENT_NODE,e="canHaveHTML"in c?c.canHaveHTML:!0,f=d?c.innerHTML:c.data,g=""===f||f===a.INVISIBLE_SPACE;if(g&&d&&e)try{c.innerHTML=a.INVISIBLE_SPACE}catch(h){}b.selectNodeContents(c),g&&d?b.collapse(!1):g&&(b.setStartAfter(c),b.setEndAfter(c))},getTextSelectedByRange:function(a,b){var c=b.cloneRange();c.selectNodeContents(a);var d=c.intersection(b),e=d?d.toString():"";return c.detach(),e},isAppliedToRange:function(b){for(var c,d,e=[],f="full",g=b.length;g--;){if(d=b[g].getNodes([a.TEXT_NODE]),!d.length)return c=this.getMatchingAncestor(b[g].startContainer).element,c?{elements:[c],coverage:f}:!1;for(var h,i=0,j=d.length;j>i;++i)h=this.getTextSelectedByRange(d[i],b[g]),c=this.getMatchingAncestor(d[i]).element,c&&""!=h?(e.push(c),1===a.dom.getTextNodes(c,!0).length?f="full":"full"===f&&(f="inline")):c||(f="partial")}return e.length?{elements:e,coverage:f}:!1},toggleRange:function(a){var b,c=this.isAppliedToRange(a);c?"full"===c.coverage?this.undoToRange(a):"inline"===c.coverage?(b=k(c.elements,this.tagNames,this.cssStyle,this.cssClass),this.undoToRange(a),b||this.applyToRange(a)):(k(c.elements,this.tagNames,this.cssStyle,this.cssClass)||this.undoToRange(a),this.applyToRange(a)):this.applyToRange(a)}},a.selection.HTMLApplier=s}(wysihtml5,rangy),wysihtml5.Commands=Base.extend({constructor:function(a){this.editor=a,this.composer=a.composer,this.doc=this.composer.doc},support:function(a){return wysihtml5.browser.supportsCommand(this.doc,a)},exec:function(a,b){var c=wysihtml5.commands[a],d=wysihtml5.lang.array(arguments).get(),e=c&&c.exec,f=null;if(this.composer.hasPlaceholderSet()&&!wysihtml5.lang.array(["styleWithCSS","enableObjectResizing","enableInlineTableEditing"]).contains(a)&&(this.composer.element.innerHTML="",this.composer.selection.selectNode(this.composer.element)),this.editor.fire("beforecommand:composer"),e)d.unshift(this.composer),f=e.apply(c,d);else try{f=this.doc.execCommand(a,!1,b)}catch(g){}return this.editor.fire("aftercommand:composer"),f},remove:function(a,b){var c=wysihtml5.commands[a],d=wysihtml5.lang.array(arguments).get(),e=c&&c.remove;return e?(d.unshift(this.composer),e.apply(c,d)):void 0},state:function(a,b){var c=wysihtml5.commands[a],d=wysihtml5.lang.array(arguments).get(),e=c&&c.state;if(e)return d.unshift(this.composer),e.apply(c,d);try{return this.doc.queryCommandState(a)}catch(f){return!1}},stateValue:function(a){var b=wysihtml5.commands[a],c=wysihtml5.lang.array(arguments).get(),d=b&&b.stateValue;return d?(c.unshift(this.composer),d.apply(b,c)):!1}}),function(a){var b={nodeName:"B",toggle:!0};a.commands.bold={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){function b(b){return a.lang.object({}).merge(c).merge({attribute:b}).get()}var c={nodeName:"A",toggle:!1};a.commands.createLink={exec:function(c,d,e){var f=b(e);if(c.selection.isCollapsed()&&!this.state(c,d)){var g=c.doc.createTextNode(f.attribute.href);c.selection.insertNode(g),c.selection.selectNode(g)}a.commands.formatInline.exec(c,d,f)},state:function(b,d){return a.commands.formatInline.state(b,d,c)}}}(wysihtml5),function(a){var b={nodeName:"A"};a.commands.removeLink={exec:function(c,d){a.commands.formatInline.remove(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){var b=/wysiwyg-font-size-[0-9a-z\-]+/g;a.commands.fontSize={exec:function(c,d,e){a.commands.formatInline.exec(c,d,{className:"wysiwyg-font-size-"+e,classRegExp:b,toggle:!0})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{className:"wysiwyg-font-size-"+d})}}}(wysihtml5),function(a){a.commands.fontSizeStyle={exec:function(b,c,d){d=d.size||d,/^\s*$/.test(d)||a.commands.formatInline.exec(b,c,{styleProperty:"fontSize",styleValue:d,toggle:!1})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{styleProperty:"fontSize",styleValue:d||void 0})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"fontSize"})},stateValue:function(b,c){var d,e=this.state(b,c);return e&&a.lang.object(e).isArray()&&(e=e[0]),e&&(d=e.getAttribute("style"))?a.quirks.styleParser.parseFontSize(d):!1}}}(wysihtml5),function(a){var b=/wysiwyg-color-[0-9a-z]+/g;a.commands.foreColor={exec:function(c,d,e){a.commands.formatInline.exec(c,d,{className:"wysiwyg-color-"+e,classRegExp:b,toggle:!0})},state:function(b,c,d){return a.commands.formatInline.state(b,c,{className:"wysiwyg-color-"+d})}}}(wysihtml5),function(a){a.commands.foreColorStyle={exec:function(b,c,d){var e,f;d&&(e=a.quirks.styleParser.parseColor("color:"+(d.color||d),"color"),e&&(f=(1===e[3]?"rgb("+[e[0],e[1],e[2]].join(", "):"rgba("+e.join(", "))+")",a.commands.formatInline.exec(b,c,{styleProperty:"color",styleValue:f})))},state:function(b,c,d){var e,f=d?a.quirks.styleParser.parseColor("color:"+(d.color||d),"color"):null;return f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")"),a.commands.formatInline.state(b,c,{styleProperty:"color",styleValue:e})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"color"})},stateValue:function(b,c,d){var e,f=this.state(b,c),g=!1;return f&&a.lang.object(f).isArray()&&(f=f[0]),f&&(e=f.getAttribute("style"))?(g=a.quirks.styleParser.parseColor(e,"color"),a.quirks.styleParser.unparseColor(g,d)):!1}}}(wysihtml5),function(a){a.commands.bgColorStyle={exec:function(b,c,d){var e,f=a.quirks.styleParser.parseColor("background-color:"+(d.color||d),"background-color");f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")",a.commands.formatInline.exec(b,c,{styleProperty:"backgroundColor",styleValue:e}))},state:function(b,c,d){var e,f=d?a.quirks.styleParser.parseColor("background-color:"+(d.color||d),"background-color"):null;return f&&(e=(1===f[3]?"rgb("+[f[0],f[1],f[2]].join(", "):"rgba("+f.join(", "))+")"),a.commands.formatInline.state(b,c,{styleProperty:"backgroundColor",styleValue:e})},remove:function(b,c){return a.commands.formatInline.remove(b,c,{styleProperty:"backgroundColor"})},stateValue:function(b,c,d){var e,f=this.state(b,c),g=!1;return f&&a.lang.object(f).isArray()&&(f=f[0]),f&&(e=f.getAttribute("style"))?(g=a.quirks.styleParser.parseColor(e,"background-color"),a.quirks.styleParser.unparseColor(g,d)):!1}}}(wysihtml5),function(a){function b(a){return{nodeName:a.nodeName||null,className:a.classRegExp?null:a.className||null,classRegExp:a.classRegExp||null,styleProperty:a.styleProperty||null}}function c(a,b){return 3===a.nodeType?a:a.childNodes[b]||a}function d(a){return a&&1===a.nodeType&&"BR"===a.nodeName}function e(a,b){return a&&1===a.nodeType&&"block"===b.win.getComputedStyle(a).display}function f(a){return a&&1===a.nodeType&&a.classList.contains("rangySelectionBoundary")}function g(a,b){return d(a)||e(a,b)}function h(b,c){a.dom.removeInvisibleSpaces(b.element);for(var d,e=b.element,f=e.querySelectorAll(E),g=b.config.classNames.uneditableContainer+[""].concat(E.split(",")).join(", "+b.config.classNames.uneditableContainer+" "),h=e.querySelectorAll(g),i=a.lang.array(f).without(h),j=i.length;j--;)""!==i[j].innerHTML.replace(/[\uFEFF]/g,"")||0!==c.length&&i[j]===c[c.length-1]||(d=a.lang.array(c).indexOf(i[j]),d>-1&&c.splice(d,1),i[j].parentNode.removeChild(i[j]));return c}function i(a){return a.config.useLineBreaks?"DIV":"P"}function j(a,b,c){for(var d=a,e=null;d&&b&&d!==b;)1===d.nodeType&&d.matches(c?E:D)&&(e=d),d=d.parentNode;return e}function k(a,b){for(var c,d,e,f=a,g=null;f&&b&&f!==b;)1===f.nodeType&&f.matches(F)&&(d=f,null===g?(g=f.cloneNode(!1),c=g):(e=f.cloneNode(!1),e.appendChild(g),g=e)),f=f.parentNode;return{parent:d,outerNode:g,innerNode:c}}function l(b,c,d){return b||(b=d.doc.createElement(c.nodeName||i(d)),b.appendChild(d.doc.createTextNode(a.INVISIBLE_SPACE))),c.nodeName&&b.nodeName!==c.nodeName&&(b=C.renameElement(b,c.nodeName)),c.classRegExp&&(b.className=b.className.replace(c.classRegExp,"")),c.className&&b.classList.add(c.className),c.styleProperty&&"undefined"!=typeof c.styleValue&&(b.style[a.browser.fixStyleKey(c.styleProperty)]=c.styleValue),b}function m(b,c,d){var e,f=b.previousSibling,g=b.nextSibling,h=!1;c.styleProperty&&(b.style[a.browser.fixStyleKey(c.styleProperty)]=""),c.className&&b.classList.remove(c.className),c.classRegExp&&(b.className=b.className.replace(c.classRegExp,"")),null!==b.getAttribute("class")&&""===b.getAttribute("class").trim()&&b.removeAttribute("class"),c.nodeName&&b.nodeName.toLowerCase()===c.nodeName.toLowerCase()&&(e=b.getAttribute("style"),e&&""!==e.trim()?b=C.renameElement(b,i(d)):(C.unwrap(b),h=!0)),null!==b.getAttribute("style")&&""===b.getAttribute("style").trim()&&b.removeAttribute("style"),h&&u(f,g,d)}function n(b){for(var c,d,e=b.querySelectorAll(E)||[],f=e.length;f--;)c=a.dom.domNode(e[f]).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),d=a.dom.domNode(e[f]).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),c&&1!==c.nodeType&&"BR"!==c.nodeName&&""!==(e[f].innerHTML||e[f].nodeValue||"").trim()&&e[f].parentNode.insertBefore(e[f].ownerDocument.createElement("BR"),c),c&&1!==c.nodeType&&"BR"!==c.nodeName&&""!==(e[f].innerHTML||e[f].nodeValue||"").trim()&&e[f].parentNode.insertBefore(e[f].ownerDocument.createElement("BR"),c),a.dom.unwrap(e[f])}function o(a,b){var c,d=a.startContainer,e=a.endContainer;return d&&1===d.nodeType&&d===e?void(d.firstChild===d.lastChild&&1===a.endOffset&&d!==b.element&&"LI"!==d.nodeName&&"TD"!==d.nodeName&&(a.setStartBefore(d),a.setEndAfter(e))):d&&1===d.nodeType&&3===e.nodeType?void(d.firstChild===e&&a.endOffset===e.data.length&&d!==b.element&&"LI"!==d.nodeName&&"TD"!==d.nodeName&&a.setEndAfter(d)):e&&1===e.nodeType&&3===d.nodeType?void(e.firstChild===d&&0===a.startOffset&&e!==b.element&&"LI"!==e.nodeName&&"TD"!==e.nodeName&&a.setStartBefore(e)):d&&3===d.nodeType&&d===e&&1===d.parentNode.childNodes.length?void(a.endOffset==e.data.length&&0===a.startOffset&&(c=d.parentNode,c!==b.element&&"LI"!==c.nodeName&&"TD"!==c.nodeName&&(a.setStartBefore(c),a.setEndAfter(c)))):void 0}function p(b){for(var c,d,e,f,g,h,i=[],j=0,k=b.length;k>j;j++)if(1===b[j].startContainer.nodeType&&b[j].startContainer.matches("ul, ol")&&b[j].setStart(b[j].startContainer.childNodes[b[j].startOffset],0),1===b[j].endContainer.nodeType&&b[j].endContainer.matches("ul, ol")&&(h=b[j].endContainer.childNodes[Math.max(b[j].endOffset-1,0)],h.childNodes&&b[j].setEnd(h,h.childNodes.length)),c=b[j].getNodes([1],function(a){return"LI"===a.nodeName}),c.length>0){for(d=0,e=c.length;e>d;d++)g=b[j].compareNode(c[d]),(g===b[j].NODE_AFTER||g===b[j].NODE_INSIDE)&&(f=b[j].cloneRange(),h=a.dom.domNode(c[d]).prev({nodeTypes:[1]}),h?f.setEnd(h,h.childNodes.length):c[d].closest("ul, ol")?f.setEndBefore(c[d].closest("ul, ol")):f.setEndBefore(c[d]),i.push(f),b[j].setStart(c[d],0)),(g===b[j].NODE_BEFORE||g===b[j].NODE_INSIDE)&&(f=b[j].cloneRange(),f.setEnd(c[d],c[d].childNodes.length),i.push(f),h=a.dom.domNode(c[d]).next({nodeTypes:[1]}),h?b[j].setStart(h,0):c[d].closest("ul, ol")?b[j].setStartAfter(c[d].closest("ul, ol")):b[j].setStartAfter(c[d]));i.push(b[j])}else i.push(b[j]);return i}function q(b,c,d){var e=b?a.lang.object(b).clone(!0):null;return e&&(e.nodeName=e.nodeName||c||i(d)),e}function r(b,c,d,e){var f,h,i,l,m,n=c.startContainer,e=e||j(n,d.element,!0);if(e)h=b.firstChild,i=b.lastChild,d.selection.splitElementAtCaret(e,b),m=a.dom.domNode(i).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),l=a.dom.domNode(h).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),h&&!g(h,d)&&l&&!g(l,d)&&h.parentNode.insertBefore(d.doc.createElement("br"),h),i&&!g(i,d)&&m&&!g(m,d)&&m.parentNode.insertBefore(d.doc.createElement("br"),m);else if(f=k(n,d.element),f.outerNode&&f.innerNode&&f.parent){if(1===b.childNodes.length){for(;b.firstChild.firstChild;)f.innerNode.appendChild(b.firstChild.firstChild);b.firstChild.appendChild(f.outerNode)}d.selection.splitElementAtCaret(f.parent,b)}else{var o=b.firstChild,p=b.lastChild;c.insertNode(b),c.setStartBefore(o),c.setEndAfter(p)}}function s(b,d,e){for(var f,h,i=b.cloneRange(),j=c(i.startContainer,i.startOffset).previousSibling,k=c(i.endContainer,i.endOffset).nextSibling,l=i.extractContents(),m=e.doc.createDocumentFragment(),o=!0;l.firstChild;){if(1===l.firstChild.nodeType&&l.firstChild.matches(E)){n(l.firstChild),f=a.dom.unwrap(l.firstChild),f.length>0&&(m.lastChild&&(1!==m.lastChild.nodeType||!g(m.lastChild,e))||!m.lastChild&&j&&(1!==j.nodeType||g(j,e)))&&m.appendChild(e.doc.createElement("BR"));for(var p=0,q=f.length;q>p;p++)m.appendChild(f[p]);f.length>0&&(1===m.lastChild.nodeType&&g(m.lastChild,e)||(k||m.lastChild!==l.lastChild)&&m.appendChild(e.doc.createElement("BR")))}else m.appendChild(l.firstChild);o=!1}return h=a.lang.array(m.childNodes).get(),r(m,i,e),h}function t(b,c,e){var f=b&&a.dom.domNode(b).prev({nodeTypes:[1,3],ignoreBlankTexts:!0});d(c)&&c.parentNode.removeChild(c),!d(b)||f&&1===f.nodeType&&"block"===e.win.getComputedStyle(f).display||b.parentNode.removeChild(b)}function u(a,b,c){var e;a&&f(a)&&(a=a.previousSibling),b&&f(b)&&(b=b.nextSibling),e=a&&a.previousSibling,a&&(1!==a.nodeType||"block"!==c.win.getComputedStyle(a).display&&!d(a))&&a.parentNode&&a.parentNode.insertBefore(c.doc.createElement("br"),a.nextSibling),b&&(1!==b.nodeType||"block"!==c.win.getComputedStyle(b).display)&&b.parentNode&&b.parentNode.insertBefore(c.doc.createElement("br"),b)}function v(d,e,f,g){var h,i,k=e?b(e):null,m=d.cloneRange(),o=m.startContainer,p=c(m.startContainer,m.startOffset),s=c(m.endContainer,m.endOffset),u=m.startContainer!==p||3!==p.nodeType||G(p,m.startOffset)?a.dom.domNode(p).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}):p,v=1===m.endContainer.nodeType&&m.endContainer.childNodes[m.endOffset]===s&&(1===s.nodeType||!H(s,m.endOffset)&&!a.dom.domNode(s).is.rangyBookmark())||m.endContainer===s&&3===s.nodeType&&!H(s,m.endOffset)?s:a.dom.domNode(s).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),w=m.extractContents(),x=g.doc.createDocumentFragment(),y=k?a.dom.getParentElement(o,k,null,g.element):null,z=!f||!e||"BLOCKQUOTE"===e.nodeName&&"BLOCKQUOTE"===f,A=y||j(o,g.element,z);if(a.dom.domNode(v).is.rangyBookmark()&&(s=v,v=s.nextSibling),I(w),e&&"BLOCKQUOTE"===e.nodeName){var B=l(null,e,g);B.appendChild(w),x.appendChild(B),i=[B]}else{if(w.firstChild)for(;w.firstChild;)if(1==w.firstChild.nodeType&&w.firstChild.matches(E))l(w.firstChild,e,g),w.firstChild.matches(D)&&n(w.firstChild),x.appendChild(w.firstChild);else{for(h=l(null,q(e,f,g),g);w.firstChild&&(1!==w.firstChild.nodeType||!w.firstChild.matches(E));)1==w.firstChild.nodeType&&h.matches(D)&&n(w.firstChild),h.appendChild(w.firstChild);x.appendChild(h)}else x.appendChild(l(null,e,g));i=a.lang.array(x.childNodes).get()}return r(x,m,g,A),t(u,v,g),i.length>0&&("undefined"==typeof i[i.length-1].lastChild||a.dom.domNode(i[i.length-1].lastChild).is.rangyBookmark())&&i[i.length-1].appendChild(g.doc.createElement("br")),i}function w(b,c){var d=a.dom.getParentElement(b,{query:E},null,c.element);return d?d.nodeName:null}function x(b,c){var d,e=a.dom.getParentElement(b.selection.getOwnRanges()[0].startContainer,{query:D+", "+(c?c.toLowerCase():"div")},null,b.element);e?(d=b.selection.createRange(),d.selectNode(e),b.selection.setSelection(d)):b.isEmpty()||b.selection.selectLine()}function y(a,b){var c=b.selection.createRange(),d=a[a.length-1],e=1===d.nodeType&&d.childNodes?0|d.childNodes.length:d.length||0;c.setStart(a[0],0),c.setEnd(d,e),c.select()}function z(a,b,c){var d,e=b.selection.getOwnRanges(),f=[];e=p(e);for(var g=e.length;g--;)o(e[g],b),d=w(e[g].startContainer,b),f="remove"===a?f.concat(s(e[g],d,b)):f.concat(v(e[g],c,d,b));return f}function A(a){return"string"==typeof a&&(a={nodeName:a.toUpperCase()}),a}function B(b){var c;return b.selection.isCollapsed()&&(c=b.selection.getNodesNearCaret(),c&&c.caretNode&&(a.dom.domNode(c.caretNode).is.lineBreak()||3===c.caretNode.nodeType&&0===c.textOffset&&(!c.prevNode||a.dom.domNode(c.prevNode).is.lineBreak())||1===c.caretNode.nodeType&&c.caretNode.classList.contains("rangySelectionBoundary")&&(!c.prevNode||a.dom.domNode(c.prevNode).is.lineBreak()||a.dom.domNode(c.prevNode).is.block())&&(!c.nextNode||a.dom.domNode(c.nextNode).is.lineBreak()||a.dom.domNode(c.nextNode).is.block())))?!0:!1}var C=a.dom,D="h1, h2, h3, h4, h5, h6, p, pre",E="h1, h2, h3, h4, h5, h6, p, pre, div, blockquote",F="b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",G=function(a,b){var c=a.data?a.data.slice(0,b):"";return/^\s*$/.test(c)},H=function(a,b){var c=a.data?a.data.slice(b):"";return/^\s*$/.test(c)},I=function(a){if(a){for(;a.firstChild&&3===a.firstChild.nodeType&&/^\s*$/.test(a.firstChild.data)&&a.lastChild!==a.firstChild;)a.removeChild(a.firstChild);for(;a.lastChild&&3===a.lastChild.nodeType&&/^\s*$/.test(a.lastChild.data)&&a.lastChild!==a.firstChild;)a.removeChild(a.lastChild);a.firstChild&&1===a.firstChild.nodeType&&"BR"===a.firstChild.nodeName&&a.lastChild!==a.firstChild&&a.removeChild(a.firstChild),a.lastChild&&1===a.lastChild.nodeType&&"BR"===a.lastChild.nodeName&&a.lastChild!==a.firstChild&&a.removeChild(a.lastChild)}};a.commands.formatBlock={exec:function(a,b,c){c=A(c);var d,e,f=[];if(c&&c.toggle&&(e=this.state(a,b,c)),e){d=rangy.saveSelection(a.win);for(var g=0,i=e.length;i>g;g++)m(e[g],c,a)}else a.selection.isCollapsed()&&(d=rangy.saveSelection(a.win),B(a)?a.selection.selectLine():x(a,c&&c.nodeName?c.nodeName.toUpperCase():void 0)),f=c?z("apply",a,c):z("remove",a);f=h(a,f),d?rangy.restoreSelection(d):y(f,a)},remove:function(a,b,c){c=A(c);var d,e;a.selection.isCollapsed()&&(e=rangy.saveSelection(a.win),x(a,c&&c.nodeName?c.nodeName.toUpperCase():void 0)),d=z("remove",a),d=h(a,d),e?rangy.restoreSelection(e):y(d,a)},state:function(b,c,d){d=A(d);for(var e,f=b.selection.filterElements(function(b){return a.dom.domNode(b).test(d||{query:E})}.bind(this)),g=b.selection.getSelectedOwnNodes(),h=0,i=g.length;i>h;h++)e=C.getParentElement(g[h],d||{query:E},null,b.element),e&&-1===f.indexOf(e)&&f.push(e);return 0===f.length?!1:f}}}(wysihtml5),function(a){a.commands.formatCode={exec:function(b,c,d){var e,f,g,h=this.state(b)[0];h?b.selection.executeAndRestore(function(){e=h.querySelector("code"),a.dom.replaceWithChildNodes(h),e&&a.dom.replaceWithChildNodes(e)}):(f=b.selection.getRange(),g=f.extractContents(),h=b.doc.createElement("pre"),e=b.doc.createElement("code"),d&&(e.className=d),h.appendChild(e),e.appendChild(g),f.insertNode(h),b.selection.selectNode(h))},state:function(b){var c,d=b.selection.getSelectedNode();return d&&d.nodeName&&"PRE"==d.nodeName&&d.firstChild&&d.firstChild.nodeName&&"CODE"==d.firstChild.nodeName?[d]:(c=a.dom.getParentElement(d,{query:"pre code"}),c?[c.parentNode]:!1)}}}(wysihtml5),function(a){function b(a){return/^\s*$/.test(a.className)}function c(a){return!a.getAttribute("style")||/^\s*$/.test(a.getAttribute("style"))}function d(b){var c=a.dom.getAttributes(b);return a.lang.object(c).isEmpty()}function e(b,c){var d,e,f,g;return 1!==b.nodeType||1!==c.nodeType?!1:b.nodeName!==c.nodeName?!1:(d=b.className.trim().replace(/\s+/g," ").split(" "),e=c.className.trim().replace(/\s+/g," ").split(" "),a.lang.array(d).without(e).length>0?!1:(f=a.dom.getAttributes(b),g=a.dom.getAttributes(c),f.length===g.length&&a.lang.object(a.lang.object(f).difference(g)).isEmpty()?!0:!1))}function f(b,c){var d=c&&c.nodeName||F,e=b.ownerDocument.createElement(d);if(c.classRegExp&&(e.className=e.className.replace(c.classRegExp,"")),c.className&&e.classList.add(c.className),c.styleProperty&&"undefined"!=typeof c.styleValue&&(e.style[a.browser.fixStyleKey(c.styleProperty)]=c.styleValue),c.attribute)if("object"==typeof c.attribute)for(var f in c.attribute)c.attribute.hasOwnProperty(f)&&e.setAttribute(f,c.attribute[f]);else"undefined"!=typeof c.attributeValue&&e.setAttribute(c.attribute,c.attributeValue);return e}function g(a,b){for(var c in a)if(a.hasOwnProperty(c)&&(void 0===typeof b[c]||b[c]!==a[c]))return!1;return!0}function h(b,c,d){var e,f=a.dom.getAttributes(b),h=g(c,f);a.lang.object(f).difference(c);if(h&&d!==!1)for(e in c)c.hasOwnProperty(e)&&b.removeAttribute(e);else for(e in c)c.hasOwnProperty(e)&&b.setAttribute(e,c[e])}function i(e,f){var g,i,j;f.className&&(f.toggle!==!1&&e.classList.contains(f.className)?e.classList.remove(f.className):(f.classRegExp&&(e.className=e.className.replace(f.classRegExp,"")),e.classList.add(f.className)),b(e)&&e.removeAttribute("class")),f.styleProperty&&(f.toggle!==!1&&e.style[a.browser.fixStyleKey(f.styleProperty)].trim().replace(/, /g,",")===f.styleValue?e.style[a.browser.fixStyleKey(f.styleProperty)]="":e.style[a.browser.fixStyleKey(f.styleProperty)]=f.styleValue),c(e)&&e.removeAttribute("style"),f.attribute&&("object"==typeof f.attribute?g=f.attribute:(g={},g[f.attribute]=f.attributeValue||""),h(e,g,f.toggle)),i=f.nodeName?H[f.nodeName.toLowerCase()]||f.nodeName.toLowerCase():null,j=i?a.dom.domNode(e).test({query:i}):!1,(!f.nodeName||f.nodeName===F||j)&&(f.toggle!==!1&&j||!f.nodeName&&e.nodeName===F)&&b(e)&&c(e)&&d(e)&&a.dom.unwrap(e)}function j(b,c){var d=[];return b.isCollapsed()||(d=d.concat(b.getOwnNodes([3],function(b){return!a.dom.domNode(b).is.emptyTextNode()},c))),d}function k(a,b,c,d){var e=a,f=d?b:l(b);do{if(1===e.nodeType&&m(e,f))return e;e=e.parentNode}while(e&&e!==c);return null}function l(a){return{nodeName:a.nodeName||null,className:a.classRegExp?null:a.className||null,classRegExp:a.classRegExp||null,styleProperty:a.styleProperty||null}}function m(b,c){var d;if(c.nodeName){var e=H[c.nodeName.toLowerCase()]||c.nodeName.toLowerCase();return a.dom.domNode(b).test({query:e})}return d=a.lang.object(c).clone(),d.query=G,a.dom.domNode(b).test(d)}function n(b,c){var d=document.documentElement||document.body,e=d.scrollTop,f=d.scrollLeft;rangy.getSelection(b.win);rangy.getSelection(b.win).removeAllRanges();try{rangy.getSelection(b.win).addRange(c)}catch(g){}b.doc.activeElement&&a.dom.contains(b.element,b.doc.activeElement)||(b.element.focus(),d.scrollTop=e,d.scrollLeft=f,rangy.getSelection(b.win).addRange(c))}function o(a,b){var c=rangy.createRange(b.doc),d=a[a.length-1];a[0]&&d&&(c.setStart(a[0],0),c.setEnd(d,d.length),n(b,c))}function p(a,b,c,d){var e=rangy.createRange(a.doc);b&&(e.setStart(b,c),e.setEnd(b,"undefined"!=typeof d?d:c),n(a,e))}function q(a,b,c){var d,e,f,g=j(a.selection),h=[],i=!1;if(a.selection.isInThisEditable()){if(0===g.length&&a.selection.isCollapsed()){if(f=a.selection.getSelection().anchorNode,!f)return{nodes:[],partial:!1};3===f.nodeType&&(g=[f])}g.length||(e=a.selection.getOwnRanges()[0],e&&(g=[e.endContainer]));for(var l=0,m=g.length;m>l;l++)d=k(g[l],b,a.element,c),d?h.push(d):i=!0}return{nodes:h,partial:i}}function r(a){var b,c,d,e;return a&&(b=a.anchorNode,c=a.anchorOffset,b&&3===b.nodeType&&c>0&&c0&&/\w/.test(c.data[g-1]);)g--;for(;h0&&o(b,a),u(q(a,c).nodes),b.length>0&&o(b,a)}function w(a,b,c,d){p(a,b,c),u(q(a,d).nodes),p(a,b,c)}function x(a,b){var c=f(a,b);a.parentNode.insertBefore(c,a),c.appendChild(a)}function y(b,c,d){var e,f=c.element,g=k(b,d,f);g&&(e=g.cloneNode(!1),a.dom.domNode(b).escapeParent(g,e),i(e,d))}function z(b,c,d){var e=c.element,f=k(b,d,e);f&&a.dom.domNode(b).escapeParent(f)}function A(a,b,c){var d=f(a.endContainer,c);a.surroundContents(d),b.selection.selectNode(d)}function B(b,c,d,e){var f,g,h,j,l=q(b,e,!0),m=b.selection.getSelection();if(c.length){if(l.partial||e.toggle===!1)for(j=c.length;j--;)k(c[j],e,b.element)&&y(c[j],b,e),k(c[j],e,b.element)||x(c[j],e);else for(j=c.length;j--;)y(c[j],b,e);v(b,c,e)}else if(e.toggle!==!1)if(r(m))f=s(m),g=f.textNode,y(f.textNode,b,e),w(b,f.textNode,f.wordOffset,e);else{g=b.doc.createTextNode(a.INVISIBLE_SPACE),h=d.nodes[0].cloneNode(!1),h.appendChild(g),b.selection.splitElementAtCaret(d.nodes[0],h),i(h,e),v(b,[g],e);var n=b.selection.getSelection();if(n.anchorNode&&n.focusNode)try{n.collapseToEnd()}catch(o){}}else for(j=d.nodes.length;j--;)i(d.nodes[j],e)}function C(b,c,d,e){var f,g,h,i=b.selection.getSelection();if(c.length){for(h=c.length;h--;)z(c[h],b,e);v(b,c,e)}else{for(f=i.anchorNode,g=i.anchorOffset,h=d.nodes.length;h--;)a.dom.unwrap(d.nodes[h]);w(b,f,g,e)}}function D(a,b,c){var d,e,f=a.selection.getSelection();if(b.length){for(e=b.length;e--;)x(b[e],c);v(a,b,c)}else if(r(f))d=s(f),x(d.textNode,c),w(a,d.textNode,d.wordOffset,c);else{var g=a.selection.getOwnRanges()[0];g&&A(g,a,c)}}function E(a){ -return a="string"==typeof a?{nodeName:a}:a,a.nodeName&&(a.nodeName=a.nodeName.toUpperCase()),a}var F="SPAN",G="b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",H={b:"b, strong",strong:"b, strong",em:"em, i",i:"em, i"};a.commands.formatInline={exec:function(a,b,c){c=E(c),a.element.normalize();var d=j(a.selection,!0),e=q(a,c);e.nodes.length>0?B(a,d,e,c):D(a,d,c),a.element.normalize()},remove:function(a,b,c){c=E(c),a.element.normalize();var d=j(a.selection,!0),e=q(a,c);e.nodes.length>0&&C(a,d,e,c),a.element.normalize()},state:function(a,b,c){c=E(c);var d=q(a,c,!0).nodes;return 0===d.length?!1:d}}}(wysihtml5),function(a){var b={nodeName:"BLOCKQUOTE",toggle:!0};a.commands.insertBlockQuote={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){a.commands.insertHTML={exec:function(a,b,c){a.selection.insertHTML(c)},state:function(){return!1}}}(wysihtml5),function(a){var b="IMG";a.commands.insertImage={exec:function(c,d,e){e="object"==typeof e?e:{src:e};var f,g,h=c.doc,i=this.state(c);if(i&&!e.src)return c.selection.setBefore(i),g=i.parentNode,g.removeChild(i),a.dom.removeEmptyTextNodes(g),"A"!==g.nodeName||g.firstChild||(c.selection.setAfter(g),g.parentNode.removeChild(g)),void a.quirks.redraw(c.element);if(i)for(var j in e)e.hasOwnProperty(j)&&i.setAttribute("className"===j?"class":j,e[j]);else{i=h.createElement(b);for(var k in e)i.setAttribute("className"===k?"class":k,e[k]);c.selection.insertNode(i),a.browser.hasProblemsSettingCaretAfterImg()?(f=h.createTextNode(a.INVISIBLE_SPACE),c.selection.insertNode(f),c.selection.setAfter(f)):c.selection.setAfter(i)}},state:function(c){var d,e,f,g=c.doc;return a.dom.hasElementWithTagName(g,b)&&(d=c.selection.getSelectedNode())?d.nodeName===b?d:d.nodeType!==a.ELEMENT_NODE?!1:(e=c.selection.getText(),(e=a.lang.string(e).trim())?!1:(f=c.selection.getNodes(a.ELEMENT_NODE,function(a){return"IMG"===a.nodeName}),1!==f.length?!1:f[0])):!1}}}(wysihtml5),function(a){var b="
    "+(a.browser.needsSpaceAfterLineBreak()?" ":"");a.commands.insertLineBreak={exec:function(a,c){a.selection.insertHTML(b)},state:function(){return!1}}}(wysihtml5),function(a){a.commands.insertOrderedList={exec:function(b,c){a.commands.insertList.exec(b,c,"OL")},state:function(b,c){return a.commands.insertList.state(b,c,"OL")}}}(wysihtml5),function(a){a.commands.insertUnorderedList={exec:function(b,c){a.commands.insertList.exec(b,c,"UL")},state:function(b,c){return a.commands.insertList.state(b,c,"UL")}}}(wysihtml5),wysihtml5.commands.insertList=function(a){var b=function(a,b){if(a&&a.nodeName){"string"==typeof b&&(b=[b]);for(var c=b.length;c--;)if(a.nodeName===b[c])return!0}return!1},c=function(c,d,e){var f={el:null,other:!1};if(c){var g=a.dom.getParentElement(c,{query:"li"},!1,e.element),h="UL"===d?"OL":"UL";b(c,d)?f.el=c:b(c,h)?f={el:c,other:!0}:g&&(b(g.parentNode,d)?f.el=g.parentNode:b(g.parentNode,h)&&(f={el:g.parentNode,other:!0}))}return f.el&&!e.element.contains(f.el)&&(f.el=null),f},d=function(b,c,d){var e,g,h="UL"===c?"OL":"UL";d.selection.executeAndRestoreRangy(function(){if(e=f(h,d),e.length)for(var i=e.length;i--;)a.dom.renameElement(e[i],c.toLowerCase());else{g=f(["OL","UL"],d);for(var j=g.length;j--;)a.dom.resolveList(g[j],d.config.useLineBreaks);0===g.length&&a.dom.resolveList(b,d.config.useLineBreaks)}})},e=function(b,c,d){var e="UL"===c?"OL":"UL";d.selection.executeAndRestoreRangy(function(){for(var g=[b].concat(f(e,d)),h=g.length;h--;)a.dom.renameElement(g[h],c.toLowerCase())})},f=function(a,c){for(var d=c.selection.getOwnRanges(),e=[],f=d.length;f--;)e=e.concat(d[f].getNodes([1],function(c){return b(c,a)}));return e},g=function(b,c){var d,e,f=rangy.saveSelection(c.win),g="_wysihtml5-temp-"+(new Date).getTime();c.commands.exec("formatBlock",{nodeName:"div",className:g});var h=c.element.querySelector("."+g);h.innerHTML=h.innerHTML.replace(a.INVISIBLE_SPACE_REG_EXP,""),h&&(d=/^(\s|(
    ))+$/i.test(h.innerHTML),e=a.dom.convertToList(h,b.toLowerCase(),c.parent.config.classNames.uneditableContainer),f&&rangy.restoreSelection(f),d&&c.selection.selectNode(e.querySelector("li"),!0))};return{exec:function(b,f,h){var i,j,k=b.doc,l="OL"===h?"insertOrderedList":"insertUnorderedList",m=b.selection.getSelection(),n=1===m.anchorNode.nodeType&&m.anchorNode.firstChild?m.anchorNode.childNodes[m.anchorOffset]:m.anchorNode,o=1===m.focusNode.nodeType&&m.focusNode.firstChild?m.focusNode.childNodes[m.focusOffset]||m.focusNode.lastChild:m.focusNode;m.isBackwards()&&(n=[o,o=n][0]),a.dom.domNode(o).is.emptyTextNode(!0)&&o&&(o=a.dom.domNode(o).prev({nodeTypes:[1,3],ignoreBlankTexts:!0})),a.dom.domNode(n).is.emptyTextNode(!0)&&n&&(n=a.dom.domNode(n).next({nodeTypes:[1,3],ignoreBlankTexts:!0})),i=n&&o?n===o?n:a.dom.domNode(n).commonAncestor(o,b.element):b.selection.getSelectedNode(),j=c(i,h,b),j.el?j.other?e(j.el,h,b):d(j.el,h,b):b.commands.support(l)?k.execCommand(l,!1,null):g(h,b)},state:function(a,b,d){var e=a.selection.getSelectedNode(),f=c(e,d,a);return f.el&&!f.other?f.el:!1}}}(wysihtml5),function(a){var b={nodeName:"I",toggle:!0};a.commands.italic={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){var b={className:"wysiwyg-text-align-center",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};a.commands.justifyCenter={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={className:"wysiwyg-text-align-left",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};a.commands.justifyLeft={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={className:"wysiwyg-text-align-right",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};a.commands.justifyRight={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={className:"wysiwyg-text-align-justify",classRegExp:/wysiwyg-text-align-[0-9a-z]+/g,toggle:!0};a.commands.justifyFull={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={styleProperty:"textAlign",styleValue:"right",toggle:!0};a.commands.alignRightStyle={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={styleProperty:"textAlign",styleValue:"left",toggle:!0};a.commands.alignLeftStyle={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={styleProperty:"textAlign",styleValue:"center",toggle:!0};a.commands.alignCenterStyle={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){var b={styleProperty:"textAlign",styleValue:"justify",toggle:!0};a.commands.alignJustifyStyle={exec:function(c,d){return a.commands.formatBlock.exec(c,"formatBlock",b)},state:function(c,d){return a.commands.formatBlock.state(c,"formatBlock",b)}}}(wysihtml5),function(a){a.commands.redo={exec:function(a){return a.undoManager.redo()},state:function(a){return!1}}}(wysihtml5),function(a){var b={nodeName:"U",toggle:!0};a.commands.underline={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){a.commands.undo={exec:function(a){return a.undoManager.undo()},state:function(a){return!1}}}(wysihtml5),function(a){a.commands.createTable={exec:function(a,b,c){var d,e,f;if(c&&c.cols&&c.rows&&parseInt(c.cols,10)>0&&parseInt(c.rows,10)>0){for(f=c.tableStyle?'':"
    ",f+="",e=0;e",d=0;d
    ";f+=""}f+="
    ",a.commands.exec("insertHTML",f)}},state:function(a,b){return!1}}}(wysihtml5),function(a){a.commands.mergeTableCells={exec:function(b,c){b.tableSelection&&b.tableSelection.start&&b.tableSelection.end&&(this.state(b,c)?a.dom.table.unmergeCell(b.tableSelection.start):a.dom.table.mergeCellsBetween(b.tableSelection.start,b.tableSelection.end))},state:function(b,c){if(b.tableSelection){var d=b.tableSelection.start,e=b.tableSelection.end;if(d&&e&&d==e&&(a.dom.getAttribute(d,"colspan")&&parseInt(a.dom.getAttribute(d,"colspan"),10)>1||a.dom.getAttribute(d,"rowspan")&&parseInt(a.dom.getAttribute(d,"rowspan"),10)>1))return[d]}return!1}}}(wysihtml5),function(a){a.commands.addTableCells={exec:function(b,c,d){if(b.tableSelection&&b.tableSelection.start&&b.tableSelection.end){var e=a.dom.table.orderSelectionEnds(b.tableSelection.start,b.tableSelection.end);"before"==d||"above"==d?a.dom.table.addCells(e.start,d):("after"==d||"below"==d)&&a.dom.table.addCells(e.end,d),setTimeout(function(){b.tableSelection.select(e.start,e.end)},0)}},state:function(a,b){return!1}}}(wysihtml5),function(a){a.commands.deleteTableCells={exec:function(b,c,d){if(b.tableSelection&&b.tableSelection.start&&b.tableSelection.end){var e,f=a.dom.table.orderSelectionEnds(b.tableSelection.start,b.tableSelection.end),g=a.dom.table.indexOf(f.start),h=b.tableSelection.table;a.dom.table.removeCells(f.start,d),setTimeout(function(){e=a.dom.table.findCell(h,g),e||("row"==d&&(e=a.dom.table.findCell(h,{row:g.row-1,col:g.col})),"column"==d&&(e=a.dom.table.findCell(h,{row:g.row,col:g.col-1}))),e&&b.tableSelection.select(e,e)},0)}},state:function(a,b){return!1}}}(wysihtml5),function(a){a.commands.indentList={exec:function(a,b,c){var d=a.selection.getSelectionParentsByTag("LI");return d?this.tryToPushLiLevel(d,a.selection):!1},state:function(a,b){return!1},tryToPushLiLevel:function(b,c){var d,e,f,g,h,i=!1;return c.executeAndRestoreRangy(function(){for(var c=b.length;c--;)g=b[c],d="OL"===g.parentNode.nodeName?"OL":"UL",e=g.ownerDocument.createElement(d),f=a.dom.domNode(g).prev({nodeTypes:[a.ELEMENT_NODE]}),h=f?f.querySelector("ul, ol"):null,f&&(h?h.appendChild(g):(e.appendChild(g),f.appendChild(e)),i=!0)}),i}}}(wysihtml5),function(a){a.commands.outdentList={exec:function(a,b,c){var d=a.selection.getSelectionParentsByTag("LI");return d?this.tryToPullLiLevel(d,a):!1},state:function(a,b){return!1},tryToPullLiLevel:function(b,c){var d,e,f,g,h,i=!1,j=this;return c.selection.executeAndRestoreRangy(function(){for(var k=b.length;k--;)if(g=b[k],g.parentNode&&(d=g.parentNode,"OL"===d.tagName||"UL"===d.tagName)){if(i=!0,e=a.dom.getParentElement(d.parentNode,{query:"ol, ul"},!1,c.element),f=a.dom.getParentElement(d.parentNode,{query:"li"},!1,c.element),e&&f)g.nextSibling&&(h=j.getAfterList(d,g),g.appendChild(h)),e.insertBefore(g,f.nextSibling);else{g.nextSibling&&(h=j.getAfterList(d,g),g.appendChild(h));for(var l=g.childNodes.length;l--;)d.parentNode.insertBefore(g.childNodes[l],d.nextSibling);d.parentNode.insertBefore(document.createElement("br"),d.nextSibling),g.parentNode.removeChild(g)}0===d.childNodes.length&&d.parentNode.removeChild(d)}}),i},getAfterList:function(a,b){for(var c=a.nodeName,d=document.createElement(c);b.nextSibling;)d.appendChild(b.nextSibling);return d}}}(wysihtml5),function(a){var b={nodeName:"SUB",toggle:!0};a.commands.subscript={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){var b={nodeName:"SUP",toggle:!0};a.commands.superscript={exec:function(c,d){a.commands.formatInline.exec(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(wysihtml5),function(a){var b=90,c=89,d=8,e=46,f=25,g="data-wysihtml5-selection-node",h="data-wysihtml5-selection-offset",i=(''+a.INVISIBLE_SPACE+"",''+a.INVISIBLE_SPACE+"",a.dom);a.UndoManager=a.lang.Dispatcher.extend({constructor:function(a){this.editor=a,this.composer=a.composer,this.element=this.composer.element,this.position=0,this.historyStr=[],this.historyDom=[],this.transact(),this._observe()},_observe:function(){var a,f=this;this.composer.sandbox.getDocument();i.observe(this.element,"keydown",function(a){if(!a.altKey&&(a.ctrlKey||a.metaKey)){var d=a.keyCode,e=d===b&&!a.shiftKey,g=d===b&&a.shiftKey||d===c;e?(f.undo(),a.preventDefault()):g&&(f.redo(),a.preventDefault())}}),i.observe(this.element,"keydown",function(b){var c=b.keyCode;c!==a&&(a=c,(c===d||c===e)&&f.transact())}),this.editor.on("newword:composer",function(){f.transact()}).on("beforecommand:composer",function(){f.transact()})},transact:function(){var b,c,d,e,i,j=this.historyStr[this.position-1],k=this.composer.getValue(!1,!1),l=this.element.offsetWidth>0&&this.element.offsetHeight>0;if(k!==j){var m=this.historyStr.length=this.historyDom.length=this.position;m>f&&(this.historyStr.shift(),this.historyDom.shift(),this.position--),this.position++,l&&(b=this.composer.selection.getRange(),c=b&&b.startContainer?b.startContainer:this.element,d=b&&b.startOffset?b.startOffset:0,c.nodeType===a.ELEMENT_NODE?e=c:(e=c.parentNode,i=this.getChildNodeIndex(e,c)),e.setAttribute(h,d),"undefined"!=typeof i&&e.setAttribute(g,i));var n=this.element.cloneNode(!!k);this.historyDom.push(n),this.historyStr.push(k),e&&(e.removeAttribute(h),e.removeAttribute(g))}},undo:function(){this.transact(),this.undoPossible()&&(this.set(this.historyDom[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.redoPossible()&&(this.set(this.historyDom[++this.position-1]),this.editor.fire("redo:composer"))},undoPossible:function(){return this.position>1},redoPossible:function(){return this.positionb;b++)this.element.appendChild(c[b].cloneNode(!0));var e,f,i;a.hasAttribute(h)?(e=a.getAttribute(h),i=a.getAttribute(g),f=this.element):(f=this.element.querySelector("["+h+"]")||this.element,e=f.getAttribute(h),i=f.getAttribute(g),f.removeAttribute(h),f.removeAttribute(g)),null!==i&&(f=this.getChildNodeByIndex(f,+i)),this.composer.selection.set(f,e)},getChildNodeIndex:function(a,b){for(var c=0,d=a.childNodes,e=d.length;e>c;c++)if(d[c]===b)return c},getChildNodeByIndex:function(a,b){return a.childNodes[b]}})}(wysihtml5),wysihtml5.views.View=Base.extend({constructor:function(a,b,c){this.parent=a,this.element=b,this.config=c,this.config.noTextarea||this._observeViewChange()},_observeViewChange:function(){var a=this;this.parent.on("beforeload",function(){a.parent.on("change_view",function(b){b===a.name?(a.parent.currentView=a,a.show(),setTimeout(function(){a.focus()},0)):a.hide()})})},focus:function(){if(!this.element||!this.element.ownerDocument||this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element&&this.element.focus()}catch(a){}},hide:function(){this.element.style.display="none"},show:function(){this.element.style.display=""},disable:function(){this.element.setAttribute("disabled","disabled")},enable:function(){this.element.removeAttribute("disabled")}}),function(a){var b=a.dom,c=a.browser;a.views.Composer=a.views.View.extend({name:"composer",constructor:function(a,b,c){this.base(a,b,c),this.config.noTextarea?this.editableArea=b:this.textarea=this.parent.textarea,this.config.contentEditableMode?this._initContentEditableArea():this._initSandbox()},clear:function(){this.element.innerHTML=c.displaysCaretInEmptyContentEditableCorrectly()?"":"
    "},getValue:function(b,c){var d=this.isEmpty()?"":a.quirks.getCorrectInnerHTML(this.element);return b!==!1&&(d=this.parent.parse(d,c===!1?!1:!0)),d},setValue:function(a,b){b!==!1&&(a=this.parent.parse(a));try{this.element.innerHTML=a}catch(c){this.element.innerText=a}},cleanUp:function(a){var b;this.selection&&this.selection.isInThisEditable()&&(b=rangy.saveSelection(this.win)),this.parent.parse(this.element,void 0,a),b&&rangy.restoreSelection(b)},show:function(){this.editableArea.style.display=this._displayStyle||"",this.config.noTextarea||this.textarea.element.disabled||(this.disable(),this.enable())},hide:function(){this._displayStyle=b.getStyle("display").from(this.editableArea),"none"===this._displayStyle&&(this._displayStyle=null),this.editableArea.style.display="none"},disable:function(){this.parent.fire("disable:composer"),this.element.removeAttribute("contentEditable")},enable:function(){this.parent.fire("enable:composer"),this.element.setAttribute("contentEditable","true")},focus:function(b){a.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear(),this.base();var c=this.element.lastChild;b&&c&&this.selection&&("BR"===c.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getScrollPos:function(){if(this.doc&&this.win){var a={};return"undefined"!=typeof this.win.pageYOffset?a.y=this.win.pageYOffset:a.y=(this.doc.documentElement||this.doc.body.parentNode||this.doc.body).scrollTop,"undefined"!=typeof this.win.pageXOffset?a.x=this.win.pageXOffset:a.x=(this.doc.documentElement||this.doc.body.parentNode||this.doc.body).scrollLeft,a}},setScrollPos:function(a){a&&"undefined"!=typeof a.x&&"undefined"!=typeof a.y&&this.win.scrollTo(a.x,a.y)},getTextContent:function(){return b.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==(this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder"))&&this.placeholderSet},isEmpty:function(){var a=this.element.innerHTML.toLowerCase();return/^(\s|
    |<\/br>|

    |<\/p>)*$/i.test(a)||""===a||"
    "===a||"

    "===a||"


    "===a||this.hasPlaceholderSet()},_initContentEditableArea:function(){var a=this;this.config.noTextarea?this.sandbox=new b.ContentEditableArea(function(){a._create()},{className:this.config.classNames.sandbox},this.editableArea):(this.sandbox=new b.ContentEditableArea(function(){a._create()},{className:this.config.classNames.sandbox}),this.editableArea=this.sandbox.getContentEditable(),b.insert(this.editableArea).after(this.textarea.element),this._createWysiwygFormField())},_initSandbox:function(){var a=this;this.sandbox=new b.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets,className:this.config.classNames.sandbox}),this.editableArea=this.sandbox.getIframe();var c=this.textarea.element;b.insert(this.editableArea).after(c),this._createWysiwygFormField()},_createWysiwygFormField:function(){if(this.textarea.element.form){var a=document.createElement("input");a.type="hidden",a.name="_wysihtml5_mode",a.value=1,b.insert(a).after(this.textarea.element)}},_create:function(){var d=this;this.doc=this.sandbox.getDocument(),this.win=this.sandbox.getWindow(),this.element=this.config.contentEditableMode?this.sandbox.getContentEditable():this.doc.body,this.config.noTextarea?this.cleanUp():(this.textarea=this.parent.textarea,this.element.innerHTML=this.textarea.getValue(!0,!1)),this.selection=new a.Selection(this.parent,this.element,this.config.classNames.uneditableContainer),this.commands=new a.Commands(this.parent),this.config.noTextarea||b.copyAttributes(["className","spellcheck","title","lang","dir","accessKey"]).from(this.textarea.element).to(this.element),this._initAutoLinking(),b.addClass(this.element,this.config.classNames.composer),this.config.style&&!this.config.contentEditableMode&&this.style(),this.observe();var e=this.config.name;e&&(b.addClass(this.element,e),this.config.contentEditableMode||b.addClass(this.editableArea,e)),this.enable(),!this.config.noTextarea&&this.textarea.element.disabled&&this.disable();var f="string"==typeof this.config.placeholder?this.config.placeholder:this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder");f&&b.simulatePlaceholder(this.parent,this,f,this.config.classNames.placeholder),this.commands.exec("styleWithCSS",!1),this._initObjectResizing(),this._initUndoManager(),this._initLineBreaking(),this.config.noTextarea||!this.textarea.element.hasAttribute("autofocus")&&document.querySelector(":focus")!=this.textarea.element||c.isIos()||setTimeout(function(){d.focus(!0)},100),c.clearsContentEditableCorrectly()||a.quirks.ensureProperClearing(this),this.initSync&&this.config.sync&&this.initSync(),this.config.noTextarea||this.textarea.hide(),this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var d=this,e=c.canDisableAutoLinking(),f=c.doesAutoLinkingInContentEditable();if(e&&this.commands.exec("AutoUrlDetect",!1,!1),this.config.autoLink){(!f||f&&e)&&(this.parent.on("newword:composer",function(){if(b.getTextContent(d.element).match(b.autoLink.URL_REG_EXP)){for(var c=d.selection.getSelectedNode(),e=d.element.querySelectorAll("."+d.config.classNames.uneditableContainer),f=!1,g=e.length;g--;)a.dom.contains(e[g],c)&&(f=!0);f||b.autoLink(c,[d.config.classNames.uneditableContainer])}}),b.observe(this.element,"blur",function(){b.autoLink(d.element,[d.config.classNames.uneditableContainer])}));var g=this.sandbox.getDocument().getElementsByTagName("a"),h=b.autoLink.URL_REG_EXP,i=function(c){var d=a.lang.string(b.getTextContent(c)).trim();return"www."===d.substr(0,4)&&(d="http://"+d),d};b.observe(this.element,"keydown",function(a){if(g.length){var c,e=d.selection.getSelectedNode(a.target.ownerDocument),f=b.getParentElement(e,{query:"a"},4);f&&(c=i(f),setTimeout(function(){var a=i(f);a!==c&&a.match(h)&&f.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){if(this.commands.exec("enableObjectResizing",!0),c.supportsEvent("resizeend")){var d=["width","height"],e=d.length,f=this.element;b.observe(f,"resizeend",function(b){var c,g=b.target||b.srcElement,h=g.style,i=0;if("IMG"===g.nodeName){for(;e>i;i++)c=d[i],h[c]&&(g.setAttribute(c,parseInt(h[c],10)),h[c]="");a.quirks.redraw(f)}})}},_initUndoManager:function(){this.undoManager=new a.UndoManager(this.parent)},_initLineBreaking:function(){function d(a){var c=b.getParentElement(a,{query:"p, div"},2);c&&b.contains(e.element,c)&&e.selection.executeAndRestoreRangy(function(){e.config.useLineBreaks?((!c.firstChild||c.firstChild===c.lastChild&&1===c.firstChild.nodeType&&c.firstChild.classList.contains("rangySelectionBoundary"))&&c.appendChild(e.doc.createElement("br")),b.replaceWithChildNodes(c)):"P"!==c.nodeName&&b.renameElement(c,"p")})}var e=this,f="li, p, h1, h2, h3, h4, h5, h6",g="ul, ol, menu";this.config.useLineBreaks||b.observe(this.element,["focus"],function(){e.isEmpty()&&setTimeout(function(){var a=e.doc.createElement("P");e.element.innerHTML="",e.element.appendChild(a),c.displaysCaretInEmptyContentEditableCorrectly()?e.selection.selectNode(a,!0):(a.innerHTML="
    ",e.selection.setBefore(a.firstChild))},0)}),b.observe(this.element,"keydown",function(c){var h=c.keyCode;if(!(c.shiftKey||c.ctrlKey||c.defaultPrevented||h!==a.ENTER_KEY&&h!==a.BACKSPACE_KEY)){var i=b.getParentElement(e.selection.getSelectedNode(),{query:f},4);return i?void setTimeout(function(){var c,f=e.selection.getSelectedNode();if("LI"===i.nodeName){if(!f)return;c=b.getParentElement(f,{query:g},2),c||d(f)}h===a.ENTER_KEY&&i.nodeName.match(/^H[1-6]$/)&&d(f)},0):void(e.config.useLineBreaks&&h===a.ENTER_KEY&&!a.browser.insertsLineBreaksOnReturn()&&(c.preventDefault(),e.commands.exec("insertLineBreak")))}})}})}(wysihtml5),function(a){var b=a.dom,c=document,d=window,e=c.createElement("div"),f=["background-color","color","cursor","font-family","font-size","font-style","font-variant","font-weight","line-height","letter-spacing","text-align","text-decoration","text-indent","text-rendering","word-break","word-wrap","word-spacing"],g=["background-color","border-collapse","border-bottom-color","border-bottom-style","border-bottom-width","border-left-color","border-left-style","border-left-width","border-right-color","border-right-style","border-right-width","border-top-color","border-top-style","border-top-width","clear","display","float","margin-bottom","margin-left","margin-right","margin-top","outline-color","outline-offset","outline-width","outline-style","padding-left","padding-right","padding-top","padding-bottom","position","top","left","right","bottom","z-index","vertical-align","text-align","-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing","-webkit-box-shadow","-moz-box-shadow","-ms-box-shadow","box-shadow","-webkit-border-top-right-radius","-moz-border-radius-topright","border-top-right-radius","-webkit-border-bottom-right-radius","-moz-border-radius-bottomright","border-bottom-right-radius","-webkit-border-bottom-left-radius","-moz-border-radius-bottomleft","border-bottom-left-radius","-webkit-border-top-left-radius","-moz-border-radius-topleft","border-top-left-radius","width","height"],h=["html { height: 100%; }","body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }","body > p:first-child { margin-top: 0; }","._wysihtml5-temp { display: none; }",a.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],i=function(a){if(a.setActive)try{a.setActive()}catch(e){}else{var f=a.style,g=c.documentElement.scrollTop||c.body.scrollTop,h=c.documentElement.scrollLeft||c.body.scrollLeft,i={position:f.position,top:f.top,left:f.left,WebkitUserSelect:f.WebkitUserSelect};b.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(a),a.focus(),b.setStyles(i).on(a),d.scrollTo&&d.scrollTo(h,g)}};a.views.Composer.prototype.style=function(){var d,j=this,k=c.querySelector(":focus"),l=this.textarea.element,m=l.hasAttribute("placeholder"),n=m&&l.getAttribute("placeholder"),o=l.style.display,p=l.disabled;this.focusStylesHost=e.cloneNode(!1),this.blurStylesHost=e.cloneNode(!1),this.disabledStylesHost=e.cloneNode(!1),m&&l.removeAttribute("placeholder"),l===k&&l.blur(),l.disabled=!1,l.style.display=d="none",(l.getAttribute("rows")&&"auto"===b.getStyle("height").from(l)||l.getAttribute("cols")&&"auto"===b.getStyle("width").from(l))&&(l.style.display=d=o),b.copyStyles(g).from(l).to(this.editableArea).andTo(this.blurStylesHost),b.copyStyles(f).from(l).to(this.element).andTo(this.blurStylesHost),b.insertCSS(h).into(this.element.ownerDocument),l.disabled=!0,b.copyStyles(g).from(l).to(this.disabledStylesHost),b.copyStyles(f).from(l).to(this.disabledStylesHost),l.disabled=p,l.style.display=o,i(l),l.style.display=d,b.copyStyles(g).from(l).to(this.focusStylesHost),b.copyStyles(f).from(l).to(this.focusStylesHost),l.style.display=o,b.copyStyles(["display"]).from(l).to(this.editableArea);var q=a.lang.array(g).without(["display"]);return k?k.focus():l.blur(),m&&l.setAttribute("placeholder",n),this.parent.on("focus:composer",function(){b.copyStyles(q).from(j.focusStylesHost).to(j.editableArea),b.copyStyles(f).from(j.focusStylesHost).to(j.element)}),this.parent.on("blur:composer",function(){b.copyStyles(q).from(j.blurStylesHost).to(j.editableArea),b.copyStyles(f).from(j.blurStylesHost).to(j.element)}),this.parent.observe("disable:composer",function(){b.copyStyles(q).from(j.disabledStylesHost).to(j.editableArea),b.copyStyles(f).from(j.disabledStylesHost).to(j.element)}),this.parent.observe("enable:composer",function(){b.copyStyles(q).from(j.blurStylesHost).to(j.editableArea),b.copyStyles(f).from(j.blurStylesHost).to(j.element)}),this}}(wysihtml5),function(a){var b=a.dom,c=b.domNode,d=a.browser,e={66:"bold",73:"italic",85:"underline"},f={addListeners:function(a,b,c){for(var d=0,e=b.length;e>d;d++)a.addEventListener(b[d],c,!1)},removeListeners:function(a,b,c){for(var d=0,e=b.length;e>d;d++)a.removeEventListener(b[d],c,!1)},fixLastBrDeletionInTable:function(b,c){if(b.selection.caretIsLastInSelection()){var d=b.selection.getSelection(),e=d.anchorNode;if(e&&1===e.nodeType&&(a.dom.getParentElement(e,{query:"td, th"},!1,b.element)||c)){var f=e.childNodes[d.anchorOffset];if(f&&1===f.nodeType&"BR"===f.nodeName)return f.parentNode.removeChild(f),!0}}return!1},handleUneditableDeletion:function(a){var b=a.selection.getBeforeSelection(!0);if(b&&("element"===b.type||"leafnode"===b.type)&&1===b.node.nodeType&&b.node.classList.contains(a.config.classNames.uneditableContainer)){if(f.fixLastBrDeletionInTable(a,!0))return!0;try{var c=new CustomEvent("wysihtml5:uneditable:delete",{bubbles:!0,cancelable:!1});b.node.dispatchEvent(c)}catch(d){}return b.node.parentNode.removeChild(b.node),!0}return!1},fixDeleteInTheBeginningOfBlock:function(b){var d=b.selection,e=d.getPreviousNode();if(d.caretIsFirstInSelection(a.browser.usesControlRanges())&&e&&1===e.nodeType&&a.dom.domNode(e).is.block()&&!c(e).test({query:"ol, ul, table, tr, dl"})){if(/^\s*$/.test(e.textContent||e.innerText))return e.parentNode.removeChild(e),!0;if(e.lastChild){var f=e.lastChild,g=d.getSelectedNode(),h=c(e).commonAncestor(g,b.element),i=a.dom.getParentElement(g,{query:"h1, h2, h3, h4, h5, h6, p, pre, div, blockquote"},!1,h||b.element);if(i)return c(i).transferContentTo(e,!0),d.setAfter(f),!0;if(a.browser.usesControlRanges())return g=d.getCaretNode(),c(g).transferContentTo(e,!0),d.setAfter(f),!0}}return!1},fixDeleteInTheBeginningOfLi:function(b){if(a.browser.hasLiDeletingProblem()){var d,e,f=b.selection.getSelection(),g=f.anchorNode,h=b.selection.caretIsFirstInSelection();if(3===g.nodeType&&0===f.anchorOffset&&g===g.parentNode.firstChild&&(g=g.parentNode,h=!0),h&&g&&1===g.nodeType&&"LI"===g.nodeName&&(d=c(g).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),d||!g.parentNode||"UL"!==g.parentNode.nodeName&&"OL"!==g.parentNode.nodeName||(d=c(g.parentNode).prev({nodeTypes:[1,3],ignoreBlankTexts:!0})),d))return e=g.firstChild,c(g).transferContentTo(d,!0),e?b.selection.setBefore(e):d&&(1===d.nodeType?d.lastChild?b.selection.setAfter(d.lastChild):b.selection.selectNode(d):b.selection.setAfter(d)),!0}return!1},fixDeleteInTheBeginningOfControlSelection:function(a){var b,d=a.selection,e=d.getPreviousNode(),f=d.getSelectedNode();return d.caretIsFirstInSelection()?(3===f.nodeType&&(f=f.parentNode),b=f.firstChild,c(f).transferContentTo(e,!0),b&&a.selection.setBefore(b),!0):!1},initTableHandling:function(){var b=function(){window.removeEventListener("load",b),this.doc.execCommand("enableObjectResizing",!1,"false"),this.doc.execCommand("enableInlineTableEditing",!1,"false")}.bind(this),c=function(){b.call(this),f.removeListeners(this.sandbox.getIframe(),["focus","mouseup","mouseover"],c)}.bind(this);this.doc.execCommand&&a.browser.supportsCommand(this.doc,"enableObjectResizing")&&a.browser.supportsCommand(this.doc,"enableInlineTableEditing")&&(this.sandbox.getIframe?f.addListeners(this.sandbox.getIframe(),["focus","mouseup","mouseover"],c):window.addEventListener("load",b)),this.tableSelection=a.quirks.tableCellsSelection(this.element,this.parent)},doLineBreaksModeEnterWithCaret:function(d){var e,f,g="p, pre, div, blockquote",h=!1;if(e=d.selection.getNodesNearCaret(),e&&((e.caretNode||e.nextNode)&&(f=b.getParentElement(e.caretNode||e.nextNode,{query:g},2),f===d.element&&(f=void 0)),f&&e.caretNode))if(c(e.caretNode).is.lineBreak()){if(d.config.doubleLineBreakEscapesBlock){h=!0,e.caretNode.parentNode.removeChild(e.caretNode),c(e.nextNode).is.lineBreak()&&e.nextNode.parentNode.removeChild(e.nextNode);var i=d.doc.createElement("br");c(e.nextNode).is.lineBreak()&&e.nextNode===f.lastChild?f.parentNode.insertBefore(i,f.nextSibling):d.selection.splitElementAtCaret(f,i),e.nextNode&&3===e.nextNode.nodeType&&(e.nextNode.data=e.nextNode.data.replace(/^ *[\r\n]+/,"")), -d.selection.setBefore(i)}}else if(3===e.caretNode.nodeType&&a.browser.hasCaretBlockElementIssue()&&e.textOffset===e.caretNode.data.length&&!e.nextNode){h=!0;var j=d.doc.createElement("br"),k=d.doc.createElement("br"),l=d.doc.createDocumentFragment();l.appendChild(j),l.appendChild(k),d.selection.insertNode(l),d.selection.setBefore(k)}return h}},g=function(b,c){var d=c.selection;c.element;if(d.isCollapsed()){if(f.handleUneditableDeletion(c))return void b.preventDefault();if(f.fixDeleteInTheBeginningOfLi(c))return void b.preventDefault();if(f.fixDeleteInTheBeginningOfBlock(c))return void b.preventDefault();if(f.fixLastBrDeletionInTable(c))return void b.preventDefault();if(a.browser.usesControlRanges()&&f.fixDeleteInTheBeginningOfControlSelection(c))return void b.preventDefault()}else d.containsUneditable()&&(b.preventDefault(),d.deleteContents())},h=function(a,b){if(b.config.useLineBreaks&&!a.shiftKey&&!a.ctrlKey){b.selection.isCollapsed()&&f.doLineBreaksModeEnterWithCaret(b)&&a.preventDefault()}},i=function(a,b,c){if(a.selection.isCollapsed()){if(a.selection.caretIsInTheBeginnig("li"))if(c){if(a.commands.exec("outdentList"))return}else if(a.commands.exec("indentList"))return}else a.selection.deleteContents();a.commands.exec("insertHTML"," ")},j=function(a){this.domNodeRemovedInterval&&clearInterval(domNodeRemovedInterval),this.parent.fire("destroy:composer")},k=function(a){this.parent.fire("beforeinteraction",a).fire("beforeinteraction:composer",a),setTimeout(function(){this.parent.fire("interaction",a).fire("interaction:composer",a)}.bind(this),0)},l=function(a){this.parent.fire("focus",a).fire("focus:composer",a),setTimeout(function(){this.focusState=this.getValue(!1,!1)}.bind(this),0)},m=function(a){if(this.focusState!==this.getValue(!1,!1)){var b=a;"function"==typeof Object.create&&(b=Object.create(a,{type:{value:"change"}})),this.parent.fire("change",b).fire("change:composer",b)}this.parent.fire("blur",a).fire("blur:composer",a)},n=function(a){this.parent.fire(a.type,a).fire(a.type+":composer",a),"paste"===a.type&&setTimeout(function(){this.parent.fire("newword:composer")}.bind(this),0)},o=function(b){this.config.copyedFromMarking&&(a.browser.supportsModernPaste()&&(b.clipboardData.setData("text/html",this.config.copyedFromMarking+this.selection.getHtml()),b.clipboardData.setData("text/plain",this.selection.getPlainText()),b.preventDefault()),this.parent.fire(b.type,b).fire(b.type+":composer",b))},p=function(b){var c=b.keyCode;(c===a.SPACE_KEY||c===a.ENTER_KEY)&&this.parent.fire("newword:composer")},q=function(b){if(!d.canSelectImagesInContentEditable()){var c=b.target,e=this.element.querySelectorAll("img"),f=this.element.querySelectorAll("."+this.config.classNames.uneditableContainer+" img"),g=a.lang.array(e).without(f);"IMG"===c.nodeName&&a.lang.array(g).contains(c)&&this.selection.selectNode(c)}a.browser.usesControlRanges()&&(this.selection.lastMouseDownPos={x:b.clientX,y:b.clientY},setTimeout(function(){delete this.selection.lastMouseDownPos}.bind(this),0))},r=function(a){var b=(a.target,this.selection.lastMouseDownPos);if(b){var c=document.body.createTextRange();setTimeout(function(){try{c.moveToPoint(b.x,b.y),c.select()}catch(a){}}.bind(this),0)}},s=function(b){if(this.config.classNames.uneditableContainer){var c=a.dom.getParentElement(b.target,{query:"."+this.config.classNames.uneditableContainer},!1,this.element);c&&this.selection.setAfter(c)}},t=function(a){d.canSelectImagesInContentEditable()||setTimeout(function(){this.selection.getSelection().removeAllRanges()}.bind(this),0)},u=function(b){var c,d,f=b.keyCode,j=e[f];return!b.ctrlKey&&!b.metaKey||b.altKey||65!==f?((b.ctrlKey||b.metaKey)&&!b.altKey&&j&&(this.commands.exec(j),b.preventDefault()),f===a.BACKSPACE_KEY&&g(b,this),(f===a.BACKSPACE_KEY||f===a.DELETE_KEY)&&(c=this.selection.getSelectedNode(!0),c&&"IMG"===c.nodeName&&(b.preventDefault(),d=c.parentNode,d.removeChild(c),"A"!==d.nodeName||d.firstChild||d.parentNode.removeChild(d),setTimeout(function(){a.quirks.redraw(this.element)}.bind(this),0))),this.config.handleTabKey&&f===a.TAB_KEY&&(b.preventDefault(),i(this,this.element,b.shiftKey)),void(f===a.ENTER_KEY&&h(b,this))):(this.selection.selectAll(),void b.preventDefault())};a.views.Composer.prototype.observeActions=f,a.views.Composer.prototype.observe=function(){var c=this.sandbox.getIframe?this.sandbox.getIframe():this.sandbox.getContentEditable(),e=(this.element,d.supportsEventsInIframeCorrectly()||this.sandbox.getContentEditable?this.element:this.sandbox.getWindow());this.focusState=this.getValue(!1,!1),c.addEventListener(["DOMNodeRemoved"],j.bind(this),!1),d.supportsMutationEvents()||(this.domNodeRemovedInterval=setInterval(function(){b.contains(document.documentElement,c)||j.call(this)},250)),this.config.handleTables&&f.initTableHandling.call(this),f.addListeners(e,["drop","paste","mouseup","focus","keyup"],k.bind(this)),e.addEventListener("focus",l.bind(this),!1),e.addEventListener("blur",m.bind(this),!1),f.addListeners(this.element,["drop","paste","beforepaste"],n.bind(this),!1),this.element.addEventListener("copy",o.bind(this),!1),this.element.addEventListener("mousedown",q.bind(this),!1),this.element.addEventListener("click",s.bind(this),!1),this.element.addEventListener("drop",t.bind(this),!1),this.element.addEventListener("keyup",p.bind(this),!1),this.element.addEventListener("keydown",u.bind(this),!1),a.browser.usesControlRanges()&&this.element.addEventListener("mscontrolselect",r.bind(this),!1),this.element.addEventListener("dragenter",function(){this.parent.fire("unset_placeholder")}.bind(this),!1)}}(wysihtml5),function(a){var b=400;a.views.Synchronizer=Base.extend({constructor:function(a,b,c){this.editor=a,this.textarea=b,this.composer=c,this._observe()},fromComposerToTextarea:function(b){this.textarea.setValue(a.lang.string(this.composer.getValue(!1,!1)).trim(),b)},fromTextareaToComposer:function(a){var b=this.textarea.getValue(!1,!1);b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(a){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(a):this.fromComposerToTextarea(a)},_observe:function(){var c,d=this,e=this.textarea.element.form,f=function(){c=setInterval(function(){d.fromComposerToTextarea()},b)},g=function(){clearInterval(c),c=null};f(),e&&(a.dom.observe(e,"submit",function(){d.sync(!0)}),a.dom.observe(e,"reset",function(){setTimeout(function(){d.fromTextareaToComposer()},0)})),this.editor.on("change_view",function(a){"composer"!==a||c?"textarea"===a&&(d.fromComposerToTextarea(!0),g()):(d.fromTextareaToComposer(!0),f())}),this.editor.on("destroy:composer",g)}})}(wysihtml5),function(a){a.views.SourceView=Base.extend({constructor:function(a,b){this.editor=a,this.composer=b,this._observe()},switchToTextarea:function(a){var b=this.composer.win.getComputedStyle(this.composer.element),c=parseFloat(b.width),d=Math.max(parseFloat(b.height),100);this.textarea||(this.textarea=this.composer.doc.createElement("textarea"),this.textarea.className="wysihtml5-source-view"),this.textarea.style.width=c+"px",this.textarea.style.height=d+"px",this.textarea.value=this.editor.getValue(a,!0),this.composer.element.parentNode.insertBefore(this.textarea,this.composer.element),this.editor.currentView="source",this.composer.element.style.display="none"},switchToComposer:function(a){var b=this.textarea.value;b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder")),this.textarea.parentNode.removeChild(this.textarea),this.editor.currentView=this.composer,this.composer.element.style.display=""},_observe:function(){this.editor.on("change_view",function(a){"composer"===a?this.switchToComposer(!0):"textarea"===a&&this.switchToTextarea(!0)}.bind(this))}})}(wysihtml5),wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(a,b,c){this.base(a,b,c),this._observe()},clear:function(){this.element.value=""},getValue:function(a){var b=this.isEmpty()?"":this.element.value;return a!==!1&&(b=this.parent.parse(b)),b},setValue:function(a,b){b!==!1&&(a=this.parent.parse(a)),this.element.value=a},cleanUp:function(a){var b=this.parent.parse(this.element.value,void 0,a);this.element.value=b},hasPlaceholderSet:function(){var a=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),b=this.element.getAttribute("placeholder")||null,c=this.element.value,d=!c;return a&&d||c===b},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var a=this.element,b=this.parent,c={focusin:"focus",focusout:"blur"},d=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];b.on("beforeload",function(){wysihtml5.dom.observe(a,d,function(a){var d=c[a.type]||a.type;b.fire(d).fire(d+":textarea")}),wysihtml5.dom.observe(a,["paste","drop"],function(){setTimeout(function(){b.fire("paste").fire("paste:textarea")},0)})})}}),function(a){var b,c={name:b,style:!0,toolbar:b,showToolbarAfterInit:!0,showToolbarDialogsOnSelection:!0,autoLink:!0,handleTables:!0,handleTabKey:!0,parserRules:{tags:{br:{},span:{},div:{},p:{},b:{},i:{},u:{}},classes:{}},pasteParserRulesets:null,parser:a.dom.parse,useLineBreaks:!0,doubleLineBreakEscapesBlock:!0,stylesheets:[],placeholderText:b,supportTouchDevices:!0,cleanUp:!0,contentEditableMode:!1,classNames:{composer:"wysihtml5-editor",body:"wysihtml5-supported",sandbox:"wysihtml5-sandbox",placeholder:"wysihtml5-placeholder",uneditableContainer:"wysihtml5-uneditable-container"},copyedFromMarking:''};a.Editor=a.lang.Dispatcher.extend({constructor:function(b,d){if(this.editableElement="string"==typeof b?document.getElementById(b):b,this.config=a.lang.object({}).merge(c).merge(d).get(),this._isCompatible=a.browser.supported(),d&&d.classNames&&a.lang.object(this.config.classNames).merge(d.classNames),"textarea"!=this.editableElement.nodeName.toLowerCase()&&(this.config.contentEditableMode=!0,this.config.noTextarea=!0),this.config.noTextarea||(this.textarea=new a.views.Textarea(this,this.editableElement,this.config),this.currentView=this.textarea),!this._isCompatible||!this.config.supportTouchDevices&&a.browser.isTouchDevice()){var e=this;return void setTimeout(function(){e.fire("beforeload").fire("load")},0)}a.dom.addClass(document.body,this.config.classNames.body),this.composer=new a.views.Composer(this,this.editableElement,this.config),this.currentView=this.composer,"function"==typeof this.config.parser&&this._initParser(),this.on("beforeload",this.handleBeforeLoad)},handleBeforeLoad:function(){this.config.noTextarea?this.sourceView=new a.views.SourceView(this,this.composer):this.synchronizer=new a.views.Synchronizer(this,this.textarea,this.composer),this.config.toolbar&&(this.toolbar=new a.toolbar.Toolbar(this,this.config.toolbar,this.config.showToolbarAfterInit))},isCompatible:function(){return this._isCompatible},clear:function(){return this.currentView.clear(),this},getValue:function(a,b){return this.currentView.getValue(a,b)},setValue:function(a,b){return this.fire("unset_placeholder"),a?(this.currentView.setValue(a,b),this):this.clear()},cleanUp:function(a){this.currentView.cleanUp(a)},focus:function(a){return this.currentView.focus(a),this},disable:function(){return this.currentView.disable(),this},enable:function(){return this.currentView.enable(),this},isEmpty:function(){return this.currentView.isEmpty()},hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},destroy:function(){this.composer&&this.composer.sandbox&&this.composer.sandbox.destroy(),this.toolbar&&this.toolbar.destroy(),this.off()},parse:function(b,c,d){var e=this.config.contentEditableMode?document:this.composer?this.composer.sandbox.getDocument():null,f=this.config.parser(b,{rules:d||this.config.parserRules,cleanUp:this.config.cleanUp,context:e,uneditableClass:this.config.classNames.uneditableContainer,clearInternals:c});return"object"==typeof b&&a.quirks.redraw(b),f},_initParser:function(){var b;a.browser.supportsModernPaste()?this.on("paste:composer",function(c){c.preventDefault(),b=a.dom.getPastedHtml(c),b&&this._cleanAndPaste(b)}.bind(this)):this.on("beforepaste:composer",function(b){b.preventDefault();var c=this.composer.getScrollPos();a.dom.getPastedHtmlWithDiv(this.composer,function(a){a&&this._cleanAndPaste(a),this.composer.setScrollPos(c)}.bind(this))}.bind(this))},_cleanAndPaste:function(b){var c=a.quirks.cleanPastedHTML(b,{referenceNode:this.composer.element,rules:this.config.pasteParserRulesets||[{set:this.config.parserRules}],uneditableClass:this.config.classNames.uneditableContainer});this.composer.selection.deleteContents(),this.composer.selection.insertHTML(c)}})}(wysihtml5); +!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof module&&module.exports?module.exports=b():b()}(this,function(){var a={version:"0.5.5",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",INVISIBLE_SPACE_REG_EXP:/\uFEFF/g,VOID_ELEMENTS:"area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, wbr",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,TAB_KEY:9,DELETE_KEY:46};a.polyfills=function(a,b){function c(){try{var a=new CustomEvent("cat",{detail:{foo:"bar"}});return"cat"===a.type&&"bar"===a.detail.foo}catch(b){}return!1}String.prototype.trim||!function(){var a=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(a,"")}}(),function(){var c="addEventListener",d="removeEventListener";b[c]||(a.Element.prototype[c]=a[c]=b[c]=function(b,c,d){return(d=this).attachEvent("on"+b,function(b){var b=b||a.event;b.target=b.target||b.srcElement,b.preventDefault=b.preventDefault||function(){b.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){b.cancelBubble=!0},b.which=b.button?2===b.button?3:4===b.button?2:b.button:b.keyCode,c.call(d,b)})},a.Element.prototype[d]=a[d]=b[d]=function(a,b){return this.detachEvent("on"+a,b)})}(),Object.defineProperty&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(a.Element.prototype,"textContent")&&!Object.getOwnPropertyDescriptor(a.Element.prototype,"textContent").get&&!function(){var b=Object.getOwnPropertyDescriptor(a.Element.prototype,"innerText");Object.defineProperty(a.Element.prototype,"textContent",{get:function(){return b.get.call(this)},set:function(a){return b.set.call(this,a)}})}(),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){for(var c=this.length,d=-1,e=b>>>0;~(c-e);d=this[--c]===a?c:d);return d}),Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),function(a){a.matches=a.matches||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector||function(a){for(var b=this,c=(b.document||b.ownerDocument).querySelectorAll(a),d=0;c[d]&&c[d]!==b;)++d;return c[d]?!0:!1},a.closest=a.closest||function(a){for(var b=this;b&&!b.matches(a);)b=b.parentElement;return b}}(Element.prototype),"document"in a&&("classList"in b.createElement("_")?"DOMTokenList"in a&&!function(){"use strict";var c=b.createElement("_");if(c.classList.add("c1","c2"),!c.classList.contains("c2")){var d=function(b){var c=a.DOMTokenList.prototype[b];a.DOMTokenList.prototype[b]=function(a){var b,d=arguments.length;for(b=0;d>b;b++)a=arguments[b],c.call(this,a)}};d("add"),d("remove")}if(c.classList.toggle("c3",!1),c.classList.contains("c3")){var e=a.DOMTokenList.prototype.toggle;a.DOMTokenList.prototype.toggle=function(a,b){return 1 in arguments&&!this.contains(a)==!b?b:e.call(this,a)}}c=null}():!function(a){"use strict";if("Element"in a){var b="classList",c="prototype",d=a.Element[c],e=Object,f=String[c].trim||function(){return this.replace(/^\s+|\s+$/g,"")},g=Array[c].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},h=function(a,b){this.name=a,this.code=DOMException[a],this.message=b},i=function(a,b){if(""===b)throw new h("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(b))throw new h("INVALID_CHARACTER_ERR","String contains an invalid character");return g.call(a,b)},j=function(a){for(var b=f.call(a.getAttribute("class")||""),c=b?b.split(/\s+/):[],d=0,e=c.length;e>d;d++)this.push(c[d]);this._updateClassName=function(){a.setAttribute("class",this.toString())}},k=j[c]=[],l=function(){return new j(this)};if(h[c]=Error[c],k.item=function(a){return this[a]||null},k.contains=function(a){return a+="",-1!==i(this,a)},k.add=function(){var a,b=arguments,c=0,d=b.length,e=!1;do a=b[c]+"",-1===i(this,a)&&(this.push(a),e=!0);while(++c0?c.childNodes[d]:void 0,h=b.focusNode,i=b.focusOffset,j=h&&1===h.nodeType&&i>0?h.childNodes[i-1]:void 0,k=this.ownerDocument.createRange(),l=a.shift(),m=l?a.shift():null;for(j&&3===j.nodeType&&(h=j,i=j.nodeValue.length,j=void 0),g&&3===g.nodeType&&(c=g,d=0,g=void 0),(c===h&&d>i||c!==h&&c.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_PRECEDING&&!(c.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_CONTAINS))&&(h=[c,c=h][0],i=[d,d=i][0]);l&&m;)m.previousSibling&&m.previousSibling===l?(c===m&&(c=l,d=l.nodeValue.length+d),h===m&&(h=l,i=l.nodeValue.length+i),l.nodeValue=l.nodeValue+m.nodeValue,m.parentNode.removeChild(m),m=a.shift()):(l=m,m=a.shift());j&&(i=Array.prototype.indexOf.call(j.parentNode.childNodes,j)+1),g&&(d=Array.prototype.indexOf.call(g.parentNode.childNodes,g)),f(this)&&c&&c.parentNode&&h&&h.parentNode&&(k.setStart(c,d),k.setEnd(h,i),b.removeAllRanges(),b.addRange(k))});Node.prototype.normalize=a},h=function(){window.removeEventListener("load",h),"Node"in window&&"normalize"in Node.prototype&&d()&&g()};"complete"!==b.readyState?window.addEventListener("load",h):h();var i=c();!function(){function c(a,c){c=c||{bubbles:!1,cancelable:!1,detail:void 0};var d=b.createEvent("CustomEvent");return d.initCustomEvent(a,c.bubbles,c.cancelable,c.detail),d}!i&&"CustomEvent"in window&&(c.prototype=a.Event.prototype,a.CustomEvent=c,i=!0)}()},a.polyfills(window,document),function(a,b){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a():b.rangy=a()}(function(){function a(a,b){var c=typeof a[b];return c==u||!(c!=t||!a[b])||"unknown"==c}function b(a,b){return!(typeof a[b]!=t||!a[b])}function c(a,b){return typeof a[b]!=v}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&A(a,z)&&C(a,y)}function f(a){return b(a,"body")?a.body:a.getElementsByTagName("body")[0]}function g(b){typeof console!=v&&a(console,"log")&&console.log(b)}function h(a,b){F&&b?alert(a):g(a)}function i(a){H.initialized=!0,H.supported=!1,h("Rangy is not supported in this environment. Reason: "+a,H.config.alertOnFail)}function j(a){h("Rangy warning: "+a,H.config.alertOnWarn)}function k(a){return a.message||a.description||String(a)}function l(){if(F&&!H.initialized){var b,c=!1,d=!1;a(document,"createRange")&&(b=document.createRange(),A(b,x)&&C(b,w)&&(c=!0));var h=f(document);if(!h||"body"!=h.nodeName.toLowerCase())return void i("No body element found");if(h&&a(h,"createTextRange")&&(b=h.createTextRange(),e(b)&&(d=!0)),!c&&!d)return void i("Neither Range nor TextRange are available");H.initialized=!0,H.features={implementsDomRange:c,implementsTextRange:d};var j,l;for(var m in E)(j=E[m])instanceof p&&j.init(j,H);for(var n=0,o=K.length;o>n;++n)try{K[n](H)}catch(q){l="Rangy init listener threw an exception. Continuing. Detail: "+k(q),g(l)}}}function m(a,b,c){c&&(a+=" in module "+c.name),H.warn("DEPRECATED: "+a+" is deprecated. Please use "+b+" instead.")}function n(a,b,c,d){a[b]=function(){return m(b,c,d),a[c].apply(a,G.toArray(arguments))}}function o(a){a=a||window,l();for(var b=0,c=L.length;c>b;++b)L[b](a)}function p(a,b,c){this.name=a,this.dependencies=b,this.initialized=!1,this.supported=!1,this.initializer=c}function q(a,b,c){var d=new p(a,b,function(b){if(!b.initialized){b.initialized=!0;try{c(H,b),b.supported=!0}catch(d){var e="Module '"+a+"' failed to load: "+k(d);g(e),d.stack&&g(d.stack)}}});return E[a]=d,d}function r(){}function s(){}var t="object",u="function",v="undefined",w=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],x=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],y=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],z=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],A=d(a),B=d(b),C=d(c),D=[].forEach?function(a,b){a.forEach(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)b(a[c],c)},E={},F=typeof window!=v&&typeof document!=v,G={isHostMethod:a,isHostObject:b,isHostProperty:c,areHostMethods:A,areHostObjects:B,areHostProperties:C,isTextRange:e,getBody:f,forEach:D},H={version:"1.3.0",initialized:!1,isBrowser:F,supported:!0,util:G,features:{},modules:E,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==v?!0:rangyAutoInitialize}};H.fail=i,H.warn=j;var I;({}).hasOwnProperty?(G.extend=I=function(a,b,c){var d,e;for(var f in b)b.hasOwnProperty(f)&&(d=a[f],e=b[f],c&&null!==d&&"object"==typeof d&&null!==e&&"object"==typeof e&&I(d,e,!0),a[f]=e);return b.hasOwnProperty("toString")&&(a.toString=b.toString),a},G.createOptions=function(a,b){var c={};return I(c,b),a&&I(c,a),c}):i("hasOwnProperty not supported"),F||i("Rangy can only run in a browser"),function(){var a;if(F){var b=document.createElement("div");b.appendChild(document.createElement("span"));var c=[].slice;try{1==c.call(b.childNodes,0)[0].nodeType&&(a=function(a){return c.call(a,0)})}catch(d){}}a||(a=function(a){for(var b=[],c=0,d=a.length;d>c;++c)b[c]=a[c];return b}),G.toArray=a}();var J;F&&(a(document,"addEventListener")?J=function(a,b,c){a.addEventListener(b,c,!1)}:a(document,"attachEvent")?J=function(a,b,c){a.attachEvent("on"+b,c)}:i("Document does not have required addEventListener or attachEvent method"),G.addListener=J);var K=[];G.deprecationNotice=m,G.createAliasForDeprecatedMethod=n,H.init=l,H.addInitListener=function(a){H.initialized?a(H):K.push(a)};var L=[];H.addShimListener=function(a){L.push(a)},F&&(H.shim=H.createMissingNativeApi=o,n(H,"createMissingNativeApi","shim")),p.prototype={init:function(){for(var a,b,c=this.dependencies||[],d=0,e=c.length;e>d;++d){if(b=c[d],a=E[b],!(a&&a instanceof p))throw new Error("required module '"+b+"' not found");if(a.init(),!a.supported)throw new Error("required module '"+b+"' not supported")}this.initializer(this)},fail:function(a){throw this.initialized=!0,this.supported=!1,new Error(a)},warn:function(a){H.warn("Module "+this.name+": "+a)},deprecationNotice:function(a,b){H.warn("DEPRECATED: "+a+" in module "+this.name+" is deprecated. Please use "+b+" instead")},createError:function(a){return new Error("Error in Rangy "+this.name+" module: "+a)}},H.createModule=function(a){var b,c;2==arguments.length?(b=arguments[1],c=[]):(b=arguments[2],c=arguments[1]);var d=q(a,c,b);H.initialized&&H.supported&&d.init()},H.createCoreModule=function(a,b,c){q(a,b,c)},H.RangePrototype=r,H.rangePrototype=new r,H.selectionPrototype=new s,H.createCoreModule("DomUtil",[],function(a,b){function c(a){var b;return typeof a.namespaceURI==F||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==b}function d(a){var b=a.parentNode;return 1==b.nodeType?b:null}function e(a){for(var b=0;a=a.previousSibling;)++b;return b}function f(a){switch(a.nodeType){case 7:case 10:return 0;case 3:case 8:return a.length;default:return a.childNodes.length}}function g(a,b){var c,d=[];for(c=a;c;c=c.parentNode)d.push(c);for(c=b;c;c=c.parentNode)if(K(d,c))return c;return null}function h(a,b,c){for(var d=c?b:b.parentNode;d;){if(d===a)return!0;d=d.parentNode}return!1}function i(a,b){return h(a,b,!0)}function j(a,b,c){for(var d,e=c?a:a.parentNode;e;){if(d=e.parentNode,d===b)return e;e=d}return null}function k(a){var b=a.nodeType;return 3==b||4==b||8==b}function l(a){if(!a)return!1;var b=a.nodeType;return 3==b||8==b}function m(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a}function n(a,b,c){var d=a.cloneNode(!1);if(d.deleteData(0,b),a.deleteData(b,a.length-b),m(d,a),c)for(var f,g=0;f=c[g++];)f.node==a&&f.offset>b?(f.node=d,f.offset-=b):f.node==a.parentNode&&f.offset>e(a)&&++f.offset;return d}function o(a){if(9==a.nodeType)return a;if(typeof a.ownerDocument!=F)return a.ownerDocument;if(typeof a.document!=F)return a.document;if(a.parentNode)return o(a.parentNode);throw b.createError("getDocument: no document found for node")}function p(a){var c=o(a);if(typeof c.defaultView!=F)return c.defaultView;if(typeof c.parentWindow!=F)return c.parentWindow;throw b.createError("Cannot get a window object for node")}function q(a){if(typeof a.contentDocument!=F)return a.contentDocument;if(typeof a.contentWindow!=F)return a.contentWindow.document;throw b.createError("getIframeDocument: No Document object found for iframe element")}function r(a){if(typeof a.contentWindow!=F)return a.contentWindow;if(typeof a.contentDocument!=F)return a.contentDocument.defaultView;throw b.createError("getIframeWindow: No Window object found for iframe element")}function s(a){return a&&G.isHostMethod(a,"setTimeout")&&G.isHostObject(a,"document")}function t(a,b,c){var d;if(a?G.isHostProperty(a,"nodeType")?d=1==a.nodeType&&"iframe"==a.tagName.toLowerCase()?q(a):o(a):s(a)&&(d=a.document):d=document,!d)throw b.createError(c+"(): Parameter must be a Window object or DOM node");return d}function u(a){for(var b;b=a.parentNode;)a=b;return a}function v(a,c,d,f){var h,i,k,l,m;if(a==d)return c===f?0:f>c?-1:1;if(h=j(d,a,!0))return c<=e(h)?-1:1;if(h=j(a,d,!0))return e(h)[index:"+e(a)+",length:"+a.childNodes.length+"]["+(a.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return a.nodeName}function y(a){for(var b,c=o(a).createDocumentFragment();b=a.firstChild;)c.appendChild(b);return c}function z(a,b,c){var d=H(a),e=a.createElement("div");e.contentEditable=""+!!c,b&&(e.innerHTML=b);var f=d.firstChild;return f?d.insertBefore(e,f):d.appendChild(e),e}function A(a){return a.parentNode.removeChild(a)}function B(a){this.root=a,this._next=a}function C(a){return new B(a)}function D(a,b){this.node=a,this.offset=b}function E(a){this.code=this[a],this.codeName=a,this.message="DOMException: "+this.codeName}var F="undefined",G=a.util,H=G.getBody;G.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method"),G.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var I=document.createElement("div");G.areHostMethods(I,["insertBefore","appendChild","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"]))||b.fail("Incomplete Element implementation"),G.isHostProperty(I,"innerHTML")||b.fail("Element is missing innerHTML property");var J=document.createTextNode("test");G.areHostMethods(J,["splitText","deleteData","insertData","appendData","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"])||!G.areHostProperties(J,["data"]))||b.fail("Incomplete Text Node implementation");var K=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},L=!1;!function(){var b=document.createElement("b");b.innerHTML="1";var c=b.firstChild;b.innerHTML="
    ",L=w(c),a.features.crashyTextNodes=L}();var M;typeof window.getComputedStyle!=F?M=function(a,b){return p(a).getComputedStyle(a,null)[b]}:typeof document.documentElement.currentStyle!=F?M=function(a,b){return a.currentStyle?a.currentStyle[b]:""}:b.fail("No means of obtaining computed style properties found"),B.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a,b,c=this._current=this._next;if(this._current)if(a=c.firstChild)this._next=a;else{for(b=null;c!==this.root&&!(b=c.nextSibling);)c=c.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}},D.prototype={equals:function(a){return!!a&&this.node===a.node&&this.offset==a.offset},inspect:function(){return"[DomPosition("+x(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},E.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},E.prototype.toString=function(){return this.message},a.dom={arrayContains:K,isHtmlNamespace:c,parentElement:d,getNodeIndex:e,getNodeLength:f,getCommonAncestor:g,isAncestorOf:h,isOrIsAncestorOf:i,getClosestAncestorIn:j,isCharacterDataNode:k,isTextOrCommentNode:l,insertAfter:m,splitDataNode:n,getDocument:o,getWindow:p,getIframeWindow:r,getIframeDocument:q,getBody:H,isWindow:s,getContentDocument:t,getRootContainer:u,comparePoints:v,isBrokenNode:w,inspectNode:x,getComputedStyleProperty:M,createTestElement:z,removeNode:A,fragmentFromNodeChildren:y,createIterator:C,DomPosition:D},a.DOMException=E}),H.createCoreModule("DomRange",["DomUtil"],function(a,b){function c(a,b){return 3!=a.nodeType&&(P(a,b.startContainer)||P(a,b.endContainer))}function d(a){return a.document||Q(a.startContainer)}function e(a){return W(a.startContainer)}function f(a){return new L(a.parentNode,O(a))}function g(a){return new L(a.parentNode,O(a)+1)}function h(a,b,c){var d=11==a.nodeType?a.firstChild:a;return N(b)?c==b.length?J.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:S(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]),d}function i(a,b,c){if(z(a),z(b),d(b)!=d(a))throw new M("WRONG_DOCUMENT_ERR");var e=R(a.startContainer,a.startOffset,b.endContainer,b.endOffset),f=R(a.endContainer,a.endOffset,b.startContainer,b.startOffset);return c?0>=e&&f>=0:0>e&&f>0}function j(a){for(var b,c,e,f=d(a.range).createDocumentFragment();c=a.next();){if(b=a.isPartiallySelectedSubtree(),c=c.cloneNode(!b),b&&(e=a.getSubtreeIterator(),c.appendChild(j(e)),e.detach()),10==c.nodeType)throw new M("HIERARCHY_REQUEST_ERR");f.appendChild(c)}return f}function k(a,b,c){var d,e;c=c||{stop:!1};for(var f,g;f=a.next();)if(a.isPartiallySelectedSubtree()){if(b(f)===!1)return void(c.stop=!0);if(g=a.getSubtreeIterator(),k(g,b,c),g.detach(),c.stop)return}else for(d=J.createIterator(f);e=d.next();)if(b(e)===!1)return void(c.stop=!0)}function l(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),l(b),b.detach()):a.remove()}function m(a){for(var b,c,e=d(a.range).createDocumentFragment();b=a.next();){if(a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),c=a.getSubtreeIterator(),b.appendChild(m(c)),c.detach()):a.remove(),10==b.nodeType)throw new M("HIERARCHY_REQUEST_ERR");e.appendChild(b)}return e}function n(a,b,c){var d,e=!(!b||!b.length),f=!!c;e&&(d=new RegExp("^("+b.join("|")+")$"));var g=[];return k(new p(a,!1),function(b){if((!e||d.test(b.nodeType))&&(!f||c(b))){var h=a.startContainer;if(b!=h||!N(h)||a.startOffset!=h.length){var i=a.endContainer;b==i&&N(i)&&0==a.endOffset||g.push(b)}}}),g}function o(a){var b="undefined"==typeof a.getName?"Range":a.getName();return"["+b+"("+J.inspectNode(a.startContainer)+":"+a.startOffset+", "+J.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function p(a,b){if(this.range=a,this.clonePartiallySelectedTextNodes=b,!a.collapsed){this.sc=a.startContainer,this.so=a.startOffset,this.ec=a.endContainer,this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&N(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==c||N(this.sc)?T(this.sc,c,!0):this.sc.childNodes[this.so],this._last=this.ec!==c||N(this.ec)?T(this.ec,c,!0):this.ec.childNodes[this.eo-1])}}function q(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){if(d=e.nodeType,V(a,d))return e;e=e.parentNode}return null}}function r(a,b){if(ea(a,b))throw new M("INVALID_NODE_TYPE_ERR")}function s(a,b){if(!V(b,a.nodeType))throw new M("INVALID_NODE_TYPE_ERR")}function t(a,b){if(0>b||b>(N(a)?a.length:a.childNodes.length))throw new M("INDEX_SIZE_ERR")}function u(a,b){if(ca(a,!0)!==ca(b,!0))throw new M("WRONG_DOCUMENT_ERR")}function v(a){if(da(a,!0))throw new M("NO_MODIFICATION_ALLOWED_ERR")}function w(a,b){if(!a)throw new M(b)}function x(a,b){return b<=(N(a)?a.length:a.childNodes.length)}function y(a){return!!a.startContainer&&!!a.endContainer&&!(X&&(J.isBrokenNode(a.startContainer)||J.isBrokenNode(a.endContainer)))&&W(a.startContainer)==W(a.endContainer)&&x(a.startContainer,a.startOffset)&&x(a.endContainer,a.endOffset)}function z(a){if(!y(a))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+a.inspect()+")")}function A(a,b){z(a);var c=a.startContainer,d=a.startOffset,e=a.endContainer,f=a.endOffset,g=c===e;N(e)&&f>0&&f0&&d=O(c)&&f++,d=0),a.setStartAndEnd(c,d,e,f)}function B(a){z(a);var b=a.commonAncestorContainer.parentNode.cloneNode(!1);return b.appendChild(a.cloneContents()),b.innerHTML}function C(a){a.START_TO_START=ka,a.START_TO_END=la,a.END_TO_END=ma,a.END_TO_START=na,a.NODE_BEFORE=oa,a.NODE_AFTER=pa,a.NODE_BEFORE_AND_AFTER=qa,a.NODE_INSIDE=ra}function D(a){C(a),C(a.prototype)}function E(a,b){return function(){z(this);var c,d,e=this.startContainer,f=this.startOffset,h=this.commonAncestorContainer,i=new p(this,!0);e!==h&&(c=T(e,h,!0),d=g(c),e=d.node,f=d.offset),k(i,v),i.reset();var j=a(i);return i.detach(),b(this,e,f,e,f),j}}function F(b,d){function e(a,b){return function(c){s(c,Z),s(W(c),$);var d=(a?f:g)(c);(b?h:i)(this,d.node,d.offset)}}function h(a,b,c){var e=a.endContainer,f=a.endOffset;(b!==a.startContainer||c!==a.startOffset)&&((W(b)!=W(e)||1==R(b,c,e,f))&&(e=b,f=c),d(a,b,c,e,f))}function i(a,b,c){var e=a.startContainer,f=a.startOffset;(b!==a.endContainer||c!==a.endOffset)&&((W(b)!=W(e)||-1==R(b,c,e,f))&&(e=b,f=c),d(a,e,f,b,c))}var j=function(){};j.prototype=a.rangePrototype,b.prototype=new j,K.extend(b.prototype,{setStart:function(a,b){r(a,!0),t(a,b),h(this,a,b)},setEnd:function(a,b){r(a,!0),t(a,b),i(this,a,b)},setStartAndEnd:function(){var a=arguments,b=a[0],c=a[1],e=b,f=c;switch(a.length){case 3:f=a[2];break;case 4:e=a[2],f=a[3]}d(this,b,c,e,f)},setBoundary:function(a,b,c){this["set"+(c?"Start":"End")](a,b)},setStartBefore:e(!0,!0),setStartAfter:e(!1,!0),setEndBefore:e(!0,!1),setEndAfter:e(!1,!1),collapse:function(a){z(this),a?d(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){r(a,!0),d(this,a,0,a,U(a))},selectNode:function(a){r(a,!1),s(a,Z);var b=f(a),c=g(a);d(this,b.node,b.offset,c.node,c.offset)},extractContents:E(m,d),deleteContents:E(l,d),canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},splitBoundaries:function(){A(this)},splitBoundariesPreservingPositions:function(a){A(this,a)},normalizeBoundaries:function(){z(this);var a,b=this.startContainer,c=this.startOffset,e=this.endContainer,f=this.endOffset,g=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(e=a,f=a.length,a.appendData(b.data),Y(b))},h=function(a){var d=a.previousSibling;if(d&&d.nodeType==a.nodeType){b=a;var g=a.length;if(c=d.length,a.insertData(0,d.data),Y(d),b==e)f+=c,e=b;else if(e==a.parentNode){var h=O(a);f==h?(e=a,f=g):f>h&&f--}}},i=!0;if(N(e))f==e.length?g(e):0==f&&(a=e.previousSibling,a&&a.nodeType==e.nodeType&&(f=a.length,b==e&&(i=!1),a.appendData(e.data),Y(e),e=a));else{if(f>0){var j=e.childNodes[f-1];j&&N(j)&&g(j)}i=!this.collapsed}if(i){if(N(b))0==c?h(b):c==b.length&&(a=b.nextSibling,a&&a.nodeType==b.nodeType&&(e==a&&(e=b,f+=b.length),b.appendData(a.data),Y(a)));else if(cx",ga=3==fa.firstChild.nodeType}catch(ha){}a.features.htmlParsingConforms=ga;var ia=ga?function(a){var b=this.startContainer,c=Q(b);if(!b)throw new M("INVALID_STATE_ERR");var d=null;return 1==b.nodeType?d=b:N(b)&&(d=J.parentElement(b)),d=null===d||"HTML"==d.nodeName&&J.isHtmlNamespace(Q(d).documentElement)&&J.isHtmlNamespace(d)?c.createElement("body"):d.cloneNode(!1),d.innerHTML=a,J.fragmentFromNodeChildren(d)}:function(a){var b=d(this),c=b.createElement("body");return c.innerHTML=a,J.fragmentFromNodeChildren(c)},ja=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ka=0,la=1,ma=2,na=3,oa=0,pa=1,qa=2,ra=3;K.extend(a.rangePrototype,{compareBoundaryPoints:function(a,b){z(this),u(this.startContainer,b.startContainer);var c,d,e,f,g=a==na||a==ka?"start":"end",h=a==la||a==ka?"start":"end";return c=this[g+"Container"],d=this[g+"Offset"],e=b[h+"Container"],f=b[h+"Offset"],R(c,d,e,f)},insertNode:function(a){if(z(this),s(a,aa),v(this.startContainer),P(a,this.startContainer))throw new M("HIERARCHY_REQUEST_ERR");var b=h(a,this.startContainer,this.startOffset);this.setStartBefore(b)},cloneContents:function(){z(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();if(this.startContainer===this.endContainer&&N(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;var c=new p(this,!0);return a=j(c),c.detach(),a},canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},surroundContents:function(a){if(s(a,ba),!this.canSurroundContents())throw new M("INVALID_STATE_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);h(a,this.startContainer,this.startOffset),a.appendChild(b),this.selectNode(a)},cloneRange:function(){z(this);for(var a,b=new I(d(this)),c=ja.length;c--;)a=ja[c],b[a]=this[a];return b},toString:function(){z(this);var a=this.startContainer;if(a===this.endContainer&&N(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],c=new p(this,!0);return k(c,function(a){(3==a.nodeType||4==a.nodeType)&&b.push(a.data)}),c.detach(),b.join("")},compareNode:function(a){z(this);var b=a.parentNode,c=O(a);if(!b)throw new M("NOT_FOUND_ERR");var d=this.comparePoint(b,c),e=this.comparePoint(b,c+1);return 0>d?e>0?qa:oa:e>0?pa:ra},comparePoint:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)<0?-1:R(a,b,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:ia,toHtml:function(){return B(this)},intersectsNode:function(a,b){if(z(this),W(a)!=e(this))return!1;var c=a.parentNode,d=O(a);if(!c)return!0;var f=R(c,d,this.endContainer,this.endOffset),g=R(c,d+1,this.startContainer,this.startOffset);return b?0>=f&&g>=0:0>f&&g>0},isPointInRange:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)>=0&&R(a,b,this.endContainer,this.endOffset)<=0},intersectsRange:function(a){return i(this,a,!1)},intersectsOrTouchesRange:function(a){return i(this,a,!0)},intersection:function(a){if(this.intersectsRange(a)){var b=R(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=R(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();return-1==b&&d.setStart(a.startContainer,a.startOffset),1==c&&d.setEnd(a.endContainer,a.endOffset),d}return null},union:function(a){if(this.intersectsOrTouchesRange(a)){var b=this.cloneRange();return-1==R(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset), +1==R(a.endContainer,a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset),b}throw new M("Ranges do not intersect")},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==ra},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,U(a))<=0},containsRange:function(a){var b=this.intersection(a);return null!==b&&a.equals(b)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);if(c.length>0){b.setStart(c[0],0);var d=c.pop();return b.setEnd(d,d.length),this.containsRange(b)}return this.containsNodeContents(a)},getNodes:function(a,b){return z(this),n(this,a,b)},getDocument:function(){return d(this)},collapseBefore:function(a){this.setEndBefore(a),this.collapse(!1)},collapseAfter:function(a){this.setStartAfter(a),this.collapse(!0)},getBookmark:function(b){var c=d(this),e=a.createRange(c);b=b||J.getBody(c),e.selectNodeContents(b);var f=this.intersection(e),g=0,h=0;return f&&(e.setEnd(f.startContainer,f.startOffset),g=e.toString().length,h=g+f.toString().length),{start:g,end:h,containerNode:b}},moveToBookmark:function(a){var b=a.containerNode,c=0;this.setStart(b,0),this.collapse(!0);for(var d,e,f,g,h=[b],i=!1,j=!1;!j&&(d=h.pop());)if(3==d.nodeType)e=c+d.length,!i&&a.start>=c&&a.start<=e&&(this.setStart(d,a.start-c),i=!0),i&&a.end>=c&&a.end<=e&&(this.setEnd(d,a.end-c),j=!0),c=e;else for(g=d.childNodes,f=g.length;f--;)h.push(g[f])},getName:function(){return"DomRange"},equals:function(a){return I.rangesEqual(this,a)},isValid:function(){return y(this)},inspect:function(){return o(this)},detach:function(){}}),F(I,H),K.extend(I,{rangeProperties:ja,RangeIterator:p,copyComparisonConstants:D,createPrototypeRange:F,inspect:o,toHtml:B,getRangeDocument:d,rangesEqual:function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset}}),a.DomRange=I}),H.createCoreModule("WrappedRange",["DomRange"],function(a,b){var c,d,e=a.dom,f=a.util,g=e.DomPosition,h=a.DomRange,i=e.getBody,j=e.getContentDocument,k=e.isCharacterDataNode;if(a.features.implementsDomRange&&!function(){function d(a){for(var b,c=m.length;c--;)b=m[c],a[b]=a.nativeRange[b];a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset}function g(a,b,c,d,e){var f=a.startContainer!==b||a.startOffset!=c,g=a.endContainer!==d||a.endOffset!=e,h=!a.equals(a.nativeRange);(f||g||h)&&(a.setEnd(d,e),a.setStart(b,c))}var k,l,m=h.rangeProperties;c=function(a){if(!a)throw b.createError("WrappedRange: Range must be specified");this.nativeRange=a,d(this)},h.createPrototypeRange(c,g),k=c.prototype,k.selectNode=function(a){this.nativeRange.selectNode(a),d(this)},k.cloneContents=function(){return this.nativeRange.cloneContents()},k.surroundContents=function(a){this.nativeRange.surroundContents(a),d(this)},k.collapse=function(a){this.nativeRange.collapse(a),d(this)},k.cloneRange=function(){return new c(this.nativeRange.cloneRange())},k.refresh=function(){d(this)},k.toString=function(){return this.nativeRange.toString()};var n=document.createTextNode("test");i(document).appendChild(n);var o=document.createRange();o.setStart(n,0),o.setEnd(n,0);try{o.setStart(n,1),k.setStart=function(a,b){this.nativeRange.setStart(a,b),d(this)},k.setEnd=function(a,b){this.nativeRange.setEnd(a,b),d(this)},l=function(a){return function(b){this.nativeRange[a](b),d(this)}}}catch(p){k.setStart=function(a,b){try{this.nativeRange.setStart(a,b)}catch(c){this.nativeRange.setEnd(a,b),this.nativeRange.setStart(a,b)}d(this)},k.setEnd=function(a,b){try{this.nativeRange.setEnd(a,b)}catch(c){this.nativeRange.setStart(a,b),this.nativeRange.setEnd(a,b)}d(this)},l=function(a,b){return function(c){try{this.nativeRange[a](c)}catch(e){this.nativeRange[b](c),this.nativeRange[a](c)}d(this)}}}k.setStartBefore=l("setStartBefore","setEndBefore"),k.setStartAfter=l("setStartAfter","setEndAfter"),k.setEndBefore=l("setEndBefore","setStartBefore"),k.setEndAfter=l("setEndAfter","setStartAfter"),k.selectNodeContents=function(a){this.setStartAndEnd(a,0,e.getNodeLength(a))},o.selectNodeContents(n),o.setEnd(n,3);var q=document.createRange();q.selectNodeContents(n),q.setEnd(n,4),q.setStart(n,2),-1==o.compareBoundaryPoints(o.START_TO_END,q)&&1==o.compareBoundaryPoints(o.END_TO_START,q)?k.compareBoundaryPoints=function(a,b){return b=b.nativeRange||b,a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&(a=b.START_TO_END),this.nativeRange.compareBoundaryPoints(a,b)}:k.compareBoundaryPoints=function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};var r=document.createElement("div");r.innerHTML="123";var s=r.firstChild,t=i(document);t.appendChild(r),o.setStart(s,1),o.setEnd(s,2),o.deleteContents(),"13"==s.data&&(k.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},k.extractContents=function(){var a=this.nativeRange.extractContents();return d(this),a}),t.removeChild(r),t=null,f.isHostMethod(o,"createContextualFragment")&&(k.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)}),i(document).removeChild(n),k.getName=function(){return"WrappedRange"},a.WrappedRange=c,a.createNativeRange=function(a){return a=j(a,b,"createNativeRange"),a.createRange()}}(),a.features.implementsTextRange){var l=function(a){var b=a.parentElement(),c=a.duplicate();c.collapse(!0);var d=c.parentElement();c=a.duplicate(),c.collapse(!1);var f=c.parentElement(),g=d==f?d:e.getCommonAncestor(d,f);return g==b?g:e.getCommonAncestor(b,g)},m=function(a){return 0==a.compareEndPoints("StartToEnd",a)},n=function(a,b,c,d,f){var h=a.duplicate();h.collapse(c);var i=h.parentElement();if(e.isOrIsAncestorOf(b,i)||(i=b),!i.canHaveHTML){var j=new g(i.parentNode,e.getNodeIndex(i));return{boundaryPosition:j,nodeInfo:{nodeIndex:j.offset,containerElement:j.node}}}var l=e.getDocument(i).createElement("span");l.parentNode&&e.removeNode(l);for(var m,n,o,p,q,r=c?"StartToStart":"StartToEnd",s=f&&f.containerElement==i?f.nodeIndex:0,t=i.childNodes.length,u=t,v=u;;){if(v==t?i.appendChild(l):i.insertBefore(l,i.childNodes[v]),h.moveToElementText(l),m=h.compareEndPoints(r,a),0==m||s==u)break;if(-1==m){if(u==s+1)break;s=v}else u=u==s+1?s:v;v=Math.floor((s+u)/2),i.removeChild(l)}if(q=l.nextSibling,-1==m&&q&&k(q)){h.setEndPoint(c?"EndToStart":"EndToEnd",a);var w;if(/[\r\n]/.test(q.data)){var x=h.duplicate(),y=x.text.replace(/\r\n/g,"\r").length;for(w=x.moveStart("character",y);-1==(m=x.compareEndPoints("StartToEnd",x));)w++,x.moveStart("character",1)}else w=h.text.length;p=new g(q,w)}else n=(d||!c)&&l.previousSibling,o=(d||c)&&l.nextSibling,p=o&&k(o)?new g(o,0):n&&k(n)?new g(n,n.data.length):new g(i,e.getNodeIndex(l));return e.removeNode(l),{boundaryPosition:p,nodeInfo:{nodeIndex:v,containerElement:i}}},o=function(a,b){var c,d,f,g,h=a.offset,j=e.getDocument(a.node),l=i(j).createTextRange(),m=k(a.node);return m?(c=a.node,d=c.parentNode):(g=a.node.childNodes,c=hb;++b)if(!C.isAncestorOf(a[0],a[b]))return!1;return!0}function m(a){var c=a.getNodes();if(!l(c))throw b.createError("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return c[0]}function n(a){return!!a&&"undefined"!=typeof a.text}function o(a,b){var c=new G(b);a._ranges=[c],h(a,c,!1),a.rangeCount=1,a.isCollapsed=c.collapsed}function p(b){if(b._ranges.length=0,"None"==b.docSelection.type)j(b);else{var c=b.docSelection.createRange();if(n(c))o(b,c);else{b.rangeCount=c.length;for(var d,e=L(c.item(0)),f=0;fh;++h)g.add(d.item(h));try{g.add(e)}catch(j){throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}g.select(),p(a)}function r(a,b,c){this.nativeSelection=a,this.docSelection=b,this._ranges=[],this.win=c,this.refresh()}function s(a){a.win=a.anchorNode=a.focusNode=a._ranges=null,a.rangeCount=a.anchorOffset=a.focusOffset=0,a.detached=!0}function t(a,b){for(var c,d,e=ba.length;e--;)if(c=ba[e],d=c.selection,"deleteAll"==b)s(d);else if(c.win==a)return"delete"==b?(ba.splice(e,1),!0):d;return"deleteAll"==b&&(ba.length=0),null}function u(a,c){for(var d,e=L(c[0].startContainer),f=M(e).createControlRange(),g=0,h=c.length;h>g;++g){d=m(c[g]);try{f.add(d)}catch(i){throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}f.select(),p(a)}function v(a,b){if(a.win.document!=L(b))throw new H("WRONG_DOCUMENT_ERR")}function w(b){return function(c,d){var e;this.rangeCount?(e=this.getRangeAt(0),e["set"+(b?"Start":"End")](c,d)):(e=a.createRange(this.win.document),e.setStartAndEnd(c,d)),this.setSingleRange(e,this.isBackward())}}function x(a){var b=[],c=new I(a.anchorNode,a.anchorOffset),d=new I(a.focusNode,a.focusOffset),e="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var f=0,g=a.rangeCount;g>f;++f)b[f]=F.inspect(a.getRangeAt(f));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}a.config.checkSelectionRanges=!0;var y,z,A="boolean",B="number",C=a.dom,D=a.util,E=D.isHostMethod,F=a.DomRange,G=a.WrappedRange,H=a.DOMException,I=C.DomPosition,J=a.features,K="Control",L=C.getDocument,M=C.getBody,N=F.rangesEqual,O=E(window,"getSelection"),P=D.isHostObject(document,"selection");J.implementsWinGetSelection=O,J.implementsDocSelection=P;var Q=P&&(!O||a.config.preferTextRange);if(Q)y=f,a.isSelectionValid=function(a){var b=d(a,"isSelectionValid").document,c=b.selection;return"None"!=c.type||L(c.createRange().parentElement())==b};else{if(!O)return b.fail("Neither document.selection or window.getSelection() detected."),!1;y=e,a.isSelectionValid=function(){return!0}}a.getNativeSelection=y;var R=y();if(!R)return b.fail("Native selection was null (possibly issue 138?)"),!1;var S=a.createNativeRange(document),T=M(document),U=D.areHostProperties(R,["anchorNode","focusNode","anchorOffset","focusOffset"]);J.selectionHasAnchorAndFocus=U;var V=E(R,"extend");J.selectionHasExtend=V;var W=typeof R.rangeCount==B;J.selectionHasRangeCount=W;var X=!1,Y=!0,Z=V?function(b,c){var d=F.getRangeDocument(c),e=a.createRange(d);e.collapseToPoint(c.endContainer,c.endOffset),b.addRange(k(e)),b.extend(c.startContainer,c.startOffset)}:null;D.areHostMethods(R,["addRange","getRangeAt","removeAllRanges"])&&typeof R.rangeCount==B&&J.implementsDomRange&&!function(){var b=window.getSelection();if(b){for(var c=b.rangeCount,d=c>1,e=[],f=g(b),h=0;c>h;++h)e[h]=b.getRangeAt(h);var i=C.createTestElement(document,"",!1),j=i.appendChild(document.createTextNode("   ")),k=document.createRange();if(k.setStart(j,1),k.collapse(!0),b.removeAllRanges(),b.addRange(k),Y=1==b.rangeCount,b.removeAllRanges(),!d){var l=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(l&&parseInt(l[1])>=36)X=!1;else{var m=k.cloneRange();k.setStart(j,0),m.setEnd(j,3),m.setStart(j,2),b.addRange(k),b.addRange(m),X=2==b.rangeCount}}for(C.removeNode(i),b.removeAllRanges(),h=0;c>h;++h)0==h&&f?Z?Z(b,e[h]):(a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),b.addRange(e[h])):b.addRange(e[h])}}(),J.selectionSupportsMultipleRanges=X,J.collapsedNonEditableSelectionsSupported=Y;var $,_=!1;T&&E(T,"createControlRange")&&($=T.createControlRange(),D.areHostProperties($,["item","add"])&&(_=!0)),J.implementsControlRange=_,z=U?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var aa;E(R,"getRangeAt")?aa=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:U&&(aa=function(b){var c=L(b.anchorNode),d=a.createRange(c);return d.setStartAndEnd(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),d.collapsed!==this.isCollapsed&&d.setStartAndEnd(b.focusNode,b.focusOffset,b.anchorNode,b.anchorOffset),d}),r.prototype=a.selectionPrototype;var ba=[],ca=function(a){if(a&&a instanceof r)return a.refresh(),a;a=d(a,"getNativeSelection");var b=t(a),c=y(a),e=P?f(a):null;return b?(b.nativeSelection=c,b.docSelection=e,b.refresh()):(b=new r(c,e,a),ba.push({win:a,selection:b})),b};a.getSelection=ca,D.createAliasForDeprecatedMethod(a,"getIframeSelection","getSelection");var da=r.prototype;if(!Q&&U&&D.areHostMethods(R,["removeAllRanges","addRange"])){da.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),j(this)};var ea=function(a,b){Z(a.nativeSelection,b),a.refresh()};W?da.addRange=function(b,d){if(_&&P&&this.docSelection.type==K)q(this,b);else if(c(d)&&V)ea(this,b);else{var e;X?e=this.rangeCount:(this.removeAllRanges(),e=0);var f=k(b).cloneRange();try{this.nativeSelection.addRange(f)}catch(g){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==e+1){if(a.config.checkSelectionRanges){var i=aa(this.nativeSelection,this.rangeCount-1);i&&!N(i,b)&&(b=new G(i))}this._ranges[this.rangeCount-1]=b,h(this,b,ha(this.nativeSelection)),this.isCollapsed=z(this)}else this.refresh()}}:da.addRange=function(a,b){c(b)&&V?ea(this,a):(this.nativeSelection.addRange(k(a)),this.refresh())},da.setRanges=function(a){if(_&&P&&a.length>1)u(this,a);else{this.removeAllRanges();for(var b=0,c=a.length;c>b;++b)this.addRange(a[b])}}}else{if(!(E(R,"empty")&&E(S,"select")&&_&&Q))return b.fail("No means of selecting a Range or TextRange was found"),!1;da.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var a;if(this.anchorNode)a=L(this.anchorNode);else if(this.docSelection.type==K){var b=this.docSelection.createRange();b.length&&(a=L(b.item(0)))}if(a){var c=M(a).createTextRange();c.select(),this.docSelection.empty()}}}catch(d){}j(this)},da.addRange=function(b){this.docSelection.type==K?q(this,b):(a.WrappedTextRange.rangeToTextRange(b).select(),this._ranges[0]=b,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,h(this,b,!1))},da.setRanges=function(a){this.removeAllRanges();var b=a.length;b>1?u(this,a):b&&this.addRange(a[0])}}da.getRangeAt=function(a){if(0>a||a>=this.rangeCount)throw new H("INDEX_SIZE_ERR");return this._ranges[a].cloneRange()};var fa;if(Q)fa=function(b){var c;a.isSelectionValid(b.win)?c=b.docSelection.createRange():(c=M(b.win.document).createTextRange(),c.collapse(!0)),b.docSelection.type==K?p(b):n(c)?o(b,c):j(b)};else if(E(R,"getRangeAt")&&typeof R.rangeCount==B)fa=function(b){if(_&&P&&b.docSelection.type==K)p(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,b.rangeCount){for(var c=0,d=b.rangeCount;d>c;++c)b._ranges[c]=new a.WrappedRange(b.nativeSelection.getRangeAt(c));h(b,b._ranges[b.rangeCount-1],ha(b.nativeSelection)),b.isCollapsed=z(b)}else j(b)};else{if(!U||typeof R.isCollapsed!=A||typeof S.collapsed!=A||!J.implementsDomRange)return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;fa=function(a){var b,c=a.nativeSelection;c.anchorNode?(b=aa(c,0),a._ranges=[b],a.rangeCount=1,i(a),a.isCollapsed=z(a)):j(a)}}da.refresh=function(a){var b=a?this._ranges.slice(0):null,c=this.anchorNode,d=this.anchorOffset;if(fa(this),a){var e=b.length;if(e!=this._ranges.length)return!0;if(this.anchorNode!=c||this.anchorOffset!=d)return!0;for(;e--;)if(!N(b[e],this._ranges[e]))return!0;return!1}};var ga=function(a,b){var c=a.getAllRanges();a.removeAllRanges();for(var d=0,e=c.length;e>d;++d)N(b,c[d])||a.addRange(c[d]);a.rangeCount||j(a)};_&&P?da.removeRange=function(a){if(this.docSelection.type==K){for(var b,c=this.docSelection.createRange(),d=m(a),e=L(c.item(0)),f=M(e).createControlRange(),g=!1,h=0,i=c.length;i>h;++h)b=c.item(h),b!==d||g?f.add(c.item(h)):g=!0;f.select(),p(this)}else ga(this,a)}:da.removeRange=function(a){ga(this,a)};var ha;!Q&&U&&J.implementsDomRange?(ha=g,da.isBackward=function(){return ha(this)}):ha=da.isBackward=function(){return!1},da.isBackwards=da.isBackward,da.toString=function(){for(var a=[],b=0,c=this.rangeCount;c>b;++b)a[b]=""+this._ranges[b];return a.join("")},da.collapse=function(b,c){v(this,b);var d=a.createRange(b);d.collapseToPoint(b,c),this.setSingleRange(d),this.isCollapsed=!0},da.collapseToStart=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)},da.collapseToEnd=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)},da.selectAllChildren=function(b){v(this,b);var c=a.createRange(b);c.selectNodeContents(b),this.setSingleRange(c)},da.deleteFromDocument=function(){if(_&&P&&this.docSelection.type==K){for(var a,b=this.docSelection.createRange();b.length;)a=b.item(0),b.remove(a),C.removeNode(a);this.refresh()}else if(this.rangeCount){var c=this.getAllRanges();if(c.length){this.removeAllRanges();for(var d=0,e=c.length;e>d;++d)c[d].deleteContents();this.addRange(c[e-1])}}},da.eachRange=function(a,b){for(var c=0,d=this._ranges.length;d>c;++c)if(a(this.getRangeAt(c)))return b},da.getAllRanges=function(){var a=[];return this.eachRange(function(b){a.push(b)}),a},da.setSingleRange=function(a,b){this.removeAllRanges(),this.addRange(a,b)},da.callMethodOnEachRange=function(a,b){var c=[];return this.eachRange(function(d){c.push(d[a].apply(d,b||[]))}),c},da.setStart=w(!0),da.setEnd=w(!1),a.rangePrototype.select=function(a){ca(this.getDocument()).setSingleRange(this,a)},da.changeEachRange=function(a){var b=[],c=this.isBackward();this.eachRange(function(c){a(c),b.push(c)}),this.removeAllRanges(),c&&1==b.length?this.addRange(b[0],"backward"):this.setRanges(b)},da.containsNode=function(a,b){return this.eachRange(function(c){return c.containsNode(a,b)},!0)||!1},da.getBookmark=function(a){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[a])}},da.moveToBookmark=function(b){for(var c,d,e=[],f=0;c=b.rangeBookmarks[f++];)d=a.createRange(this.win),d.moveToBookmark(c),e.push(d);b.backward?this.setSingleRange(e[0],"backward"):this.setRanges(e)},da.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},da.restoreRanges=function(a){this.removeAllRanges();for(var b,c=0;b=a.ranges[c];++c)this.addRange(b,a.backward&&0==c)},da.toHtml=function(){var a=[];return this.eachRange(function(b){a.push(F.toHtml(b))}),a.join("")},J.implementsTextRange&&(da.getNativeTextRange=function(){var c;if(c=this.docSelection){var d=c.createRange();if(n(d))return d;throw b.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return a.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw b.createError("getNativeTextRange: selection contains no range")}),da.getName=function(){return"WrappedSelection"},da.inspect=function(){return x(this)},da.detach=function(){t(this.win,"delete"),s(this)},r.detachAll=function(){t(null,"deleteAll")},r.inspect=x,r.isDirectionBackward=c,a.Selection=r,a.selectionPrototype=da,a.addShimListener(function(a){"undefined"==typeof a.getSelection&&(a.getSelection=function(){return ca(a)}),a=null})});var M=!1,N=function(a){M||(M=!0,!H.initialized&&H.config.autoInitialize&&l())};return F&&("complete"==document.readyState?N():(a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",N,!1),J(window,"load",N))),H},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("TextRange",["WrappedSelection"],function(a,b){function c(a,b){function c(a,b,c){h.push({start:a,end:b,isWord:c})}for(var d,e,f,g=a.join(""),h=[],i=0;d=b.wordRegex.exec(g);){if(e=d.index,f=e+d[0].length,e>i&&c(i,e,!1),b.includeTrailingSpace)for(;$.test(a[f]);)++f;c(e,f,!0),i=f}return ie;++e)c[e].token=d;return d}function e(a,b,c){for(var e,f=c(a,b),g=[],h=0;e=f[h++];)g.push(d(a,e));return g}function f(a){var b=a||"",c="string"==typeof b?b.split(""):b;return c.sort(function(a,b){return a.charCodeAt(0)-b.charCodeAt(0)}),c.join("").replace(/(.)\1+/g,"$1")}function g(a){var b,c;return a?(b=a.language||_,c={},U(c,ia[b]||ia[_]),U(c,a),c):ia[_]}function h(a,b){var c=V(a,b);return b.hasOwnProperty("wordOptions")&&(c.wordOptions=g(c.wordOptions)),b.hasOwnProperty("characterOptions")&&(c.characterOptions=V(c.characterOptions,ga)),c}function i(a,b){var c=na(a,"display",b),d=a.tagName.toLowerCase();return"block"==c&&fa&&oa.hasOwnProperty(d)?oa[d]:c}function j(a){for(var b=o(a),c=0,d=b.length;d>c;++c)if(1==b[c].nodeType&&"none"==i(b[c]))return!0;return!1}function k(a){var b;return 3==a.nodeType&&(b=a.parentNode)&&"hidden"==na(b,"visibility")}function l(a){return a&&(1==a.nodeType&&!/^(inline(-block|-table)?|none)$/.test(i(a))||9==a.nodeType||11==a.nodeType)}function m(a){return S.isCharacterDataNode(a)||!/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i.test(a.nodeName)}function n(a){for(var b=[];a.parentNode;)b.unshift(a.parentNode),a=a.parentNode;return b}function o(a){return n(a).concat([a])}function p(a){for(;a&&!a.nextSibling;)a=a.parentNode;return a?a.nextSibling:null}function q(a,b){return!b&&a.hasChildNodes()?a.firstChild:p(a)}function r(a){var b=a.previousSibling;if(b){for(a=b;a.hasChildNodes();)a=a.lastChild;return a}var c=a.parentNode;return c&&1==c.nodeType?c:null}function s(a){if(!a||3!=a.nodeType)return!1;var b=a.data;if(""===b)return!0;var c=a.parentNode;if(!c||1!=c.nodeType)return!1;var d=na(a.parentNode,"whiteSpace");return/^[\t\n\r ]+$/.test(b)&&/^(normal|nowrap)$/.test(d)||/^[\t\r ]+$/.test(b)&&"pre-line"==d}function t(a){if(""===a.data)return!0;if(!s(a))return!1;var b=a.parentNode;return b?j(a)?!0:!1:!0}function u(a){var b=a.nodeType;return 7==b||8==b||j(a)||/^(script|style)$/i.test(a.nodeName)||k(a)||t(a)}function v(a,b){var c=a.nodeType;return 7==c||8==c||1==c&&"none"==i(a,b)}function w(){this.store={}}function x(a,b,c){return function(d){var e=this.cache;if(e.hasOwnProperty(a))return pa++,e[a];qa++;var f=b.call(this,c?this[c]:this,d);return e[a]=f,f}}function y(a,b){this.node=a,this.session=b,this.cache=new w,this.positions=new w}function z(a,b){this.offset=b,this.nodeWrapper=a,this.node=a.node,this.session=a.session,this.cache=new w}function A(){return"[Position("+S.inspectNode(this.node)+":"+this.offset+")]"}function B(){return D(),Da=new Ea}function C(){return Da||B()}function D(){Da&&Da.detach(),Da=null}function E(a,c,d,e){function f(){var a=null;return c?(a=h,i||(h=h.previousVisible(),i=!h||d&&h.equals(d))):i||(a=h=h.nextVisible(),i=!h||d&&h.equals(d)),i&&(h=null),a}d&&(c?u(d.node)&&(d=a.previousVisible()):u(d.node)&&(d=d.nextVisible()));var g,h=a,i=!1,j=!1;return{next:function(){if(j)return j=!1,g;for(var a,b;a=f();)if(b=a.getCharacter(e))return g=a,a;return null},rewind:function(){if(!g)throw b.createError("createCharacterIterator: cannot rewind. Only one position can be rewound.");j=!0},dispose:function(){a=d=null}}}function F(a,b,c){function d(a){for(var b,c,d=[],e=a?f:g,h=!1,i=!1;b=e.next();){if(c=b.character,Z.test(c))i&&(i=!1,h=!0);else{if(h){e.rewind();break}i=!0}d.push(b)}return d}var f=E(a,!1,null,b),g=E(a,!0,null,b),h=c.tokenizer,i=d(!0),j=d(!1).reverse(),k=e(j.concat(i),c,h),l=i.length?k.slice(Fa(k,i[0].token)):[],m=j.length?k.slice(0,Fa(k,j.pop().token)+1):[];return{nextEndToken:function(){for(var a,b;1==l.length&&!(a=l[0]).isWord&&(b=d(!0)).length>0;)l=e(a.chars.concat(b),c,h);return l.shift()},previousStartToken:function(){for(var a,b;1==m.length&&!(a=m[0]).isWord&&(b=d(!1)).length>0;)m=e(b.reverse().concat(a.chars),c,h);return m.pop()},dispose:function(){f.dispose(),g.dispose(),l=m=null}}}function G(a,b,c,d,e){var f,g,h,i,j=0,k=a,l=Math.abs(c);if(0!==c){var m=0>c;switch(b){case Q:for(g=E(a,m,null,d);(f=g.next())&&l>j;)++j,k=f;h=f,g.dispose();break;case R:for(var n=F(a,d,e),o=m?n.previousStartToken:n.nextEndToken;(i=o())&&l>j;)i.isWord&&(++j,k=m?i.chars[0]:i.chars[i.chars.length-1]);break;default:throw new Error("movePositionBy: unit '"+b+"' not implemented")}m?(k=k.previousVisible(),j=-j):k&&k.isLeadingSpace&&!k.isTrailingSpace&&(b==R&&(g=E(a,!1,null,d),h=g.next(),g.dispose()),h&&(k=h.previousVisible()))}return{position:k,unitsMoved:j}}function H(a,b,c,d){var e=a.getRangeBoundaryPosition(b,!0),f=a.getRangeBoundaryPosition(b,!1),g=d?f:e,h=d?e:f;return E(g,!!d,h,c)}function I(a,b,c){for(var d,e=[],f=H(a,b,c);d=f.next();)e.push(d);return f.dispose(),e}function J(b,c,d){var e=a.createRange(b.node);return e.setStartAndEnd(b.node,b.offset,c.node,c.offset),!e.expand("word",{wordOptions:d})}function K(a,b,c,d,e){function f(a,b){var c=p[a].previousVisible(),d=p[b-1],f=!e.wholeWordsOnly||J(c,d,e.wordOptions);return{startPos:c,endPos:d,valid:f}}for(var g,h,i,j,k,l,m=aa(e.direction),n=E(a,m,a.session.getRangeBoundaryPosition(d,m),e.characterOptions),o="",p=[],q=null;g=n.next();)if(h=g.character,c||e.caseSensitive||(h=h.toLowerCase()),m?(p.unshift(g),o=h+o):(p.push(g),o+=h),c){if(k=b.exec(o))if(i=k.index,j=i+k[0].length,l){if(!m&&j0){q=f(i,j);break}}else l=!0}else if(-1!=(i=o.indexOf(b))){q=f(i,i+b.length);break}return l&&(q=f(i,j)),n.dispose(),q}function L(a){return function(){var b=!!Da,c=C(),d=[c].concat(T.toArray(arguments)),e=a.apply(this,d);return b||D(),e}}function M(a,b){return L(function(c,d,e,f){typeof e==P&&(e=d,d=Q),f=h(f,ka);var g=a;b&&(g=e>=0,this.collapse(!g));var i=G(c.getRangeBoundaryPosition(this,g),d,e,f.characterOptions,f.wordOptions),j=i.position;return this[g?"setStart":"setEnd"](j.node,j.offset),i.unitsMoved})}function N(a){return L(function(b,c){c=V(c,ga);for(var d,e=H(b,this,c,!a),f=0;(d=e.next())&&Z.test(d.character);)++f;e.dispose();var g=f>0;return g&&this[a?"moveStart":"moveEnd"]("character",a?f:-f,{characterOptions:c}),g})}function O(a){return L(function(b,c){var d=!1;return this.changeEachRange(function(b){d=b[a](c)||d}),d})}var P="undefined",Q="character",R="word",S=a.dom,T=a.util,U=T.extend,V=T.createOptions,W=S.getBody,X=/^[ \t\f\r\n]+$/,Y=/^[ \t\f\r]+$/,Z=/^[\t-\r \u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/,$=/^[\t \u00A0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000]+$/,_="en",aa=a.Selection.isDirectionBackward,ba=!1,ca=!1,da=!1,ea=!0;!function(){var b=S.createTestElement(document,"

    1

    ",!0),c=b.firstChild,d=a.getSelection();d.collapse(c.lastChild,2),d.setStart(c.firstChild,0),ba=1==(""+d).length,b.innerHTML="1
    ",d.collapse(b,2),d.setStart(b.firstChild,0),ca=1==(""+d).length,b.innerHTML="1

    1

    ",d.collapse(b,2),d.setStart(b.firstChild,0),da=1==(""+d).length,S.removeNode(b),d.removeAllRanges()}();var fa,ga={includeBlockContentTrailingSpace:!0,includeSpaceBeforeBr:!0,includeSpaceBeforeBlock:!0,includePreLineTrailingSpace:!0,ignoreCharacters:""},ha={includeBlockContentTrailingSpace:!ea,includeSpaceBeforeBr:!ca,includeSpaceBeforeBlock:!da,includePreLineTrailingSpace:!0},ia={en:{wordRegex:/[a-z0-9]+('[a-z0-9]+)*/gi,includeTrailingSpace:!1,tokenizer:c}},ja={caseSensitive:!1,withinRange:null,wholeWordsOnly:!1,wrap:!1,direction:"forward",wordOptions:null,characterOptions:null},ka={wordOptions:null,characterOptions:null},la={wordOptions:null,characterOptions:null,trim:!1,trimStart:!0,trimEnd:!0},ma={wordOptions:null,characterOptions:null,direction:"forward"},na=S.getComputedStyleProperty;!function(){var a=document.createElement("table"),b=W(document);b.appendChild(a),fa="block"==na(a,"display"),b.removeChild(a)}();var oa={table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell"};w.prototype={get:function(a){return this.store.hasOwnProperty(a)?this.store[a]:null},set:function(a,b){return this.store[a]=b}};var pa=0,qa=0,ra={getPosition:function(a){var b=this.positions;return b.get(a)||b.set(a,new z(this,a))},toString:function(){return"[NodeWrapper("+S.inspectNode(this.node)+")]"}};y.prototype=ra;var sa="EMPTY",ta="NON_SPACE",ua="UNCOLLAPSIBLE_SPACE",va="COLLAPSIBLE_SPACE",wa="TRAILING_SPACE_BEFORE_BLOCK",xa="TRAILING_SPACE_IN_BLOCK",ya="TRAILING_SPACE_BEFORE_BR",za="PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK",Aa="TRAILING_LINE_BREAK_AFTER_BR",Ba="INCLUDED_TRAILING_LINE_BREAK_AFTER_BR";U(ra,{isCharacterDataNode:x("isCharacterDataNode",S.isCharacterDataNode,"node"),getNodeIndex:x("nodeIndex",S.getNodeIndex,"node"),getLength:x("nodeLength",S.getNodeLength,"node"), +containsPositions:x("containsPositions",m,"node"),isWhitespace:x("isWhitespace",s,"node"),isCollapsedWhitespace:x("isCollapsedWhitespace",t,"node"),getComputedDisplay:x("computedDisplay",i,"node"),isCollapsed:x("collapsed",u,"node"),isIgnored:x("ignored",v,"node"),next:x("nextPos",q,"node"),previous:x("previous",r,"node"),getTextNodeInfo:x("textNodeInfo",function(a){var b=null,c=!1,d=na(a.parentNode,"whiteSpace"),e="pre-line"==d;return e?(b=Y,c=!0):("normal"==d||"nowrap"==d)&&(b=X,c=!0),{node:a,text:a.data,spaceRegex:b,collapseSpaces:c,preLine:e}},"node"),hasInnerText:x("hasInnerText",function(a,b){for(var c=this.session,d=c.getPosition(a.parentNode,this.getNodeIndex()+1),e=c.getPosition(a,0),f=b?d:e,g=b?e:d;f!==g;){if(f.prepopulateChar(),f.isDefinitelyNonEmpty())return!0;f=b?f.previousVisible():f.nextVisible()}return!1},"node"),isRenderedBlock:x("isRenderedBlock",function(a){for(var b=a.getElementsByTagName("br"),c=0,d=b.length;d>c;++c)if(!u(b[c]))return!0;return this.hasInnerText()},"node"),getTrailingSpace:x("trailingSpace",function(a){if("br"==a.tagName.toLowerCase())return"";switch(this.getComputedDisplay()){case"inline":for(var b=a.lastChild;b;){if(!v(b))return 1==b.nodeType?this.session.getNodeWrapper(b).getTrailingSpace():"";b=b.previousSibling}break;case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":break;case"table-cell":return" ";default:return this.isRenderedBlock(!0)?"\n":""}return""},"node"),getLeadingSpace:x("leadingSpace",function(a){switch(this.getComputedDisplay()){case"inline":case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":case"table-cell":break;default:return this.isRenderedBlock(!1)?"\n":""}return""},"node")});var Ca={character:"",characterType:sa,isBr:!1,prepopulateChar:function(){var a=this;if(!a.prepopulatedChar){var b=a.node,c=a.offset,d="",e=sa,f=!1;if(c>0)if(3==b.nodeType){var g=b.data,h=g.charAt(c-1),i=a.nodeWrapper.getTextNodeInfo(),j=i.spaceRegex;i.collapseSpaces?j.test(h)?c>1&&j.test(g.charAt(c-2))||(i.preLine&&"\n"===g.charAt(c)?(d=" ",e=za):(d=" ",e=va)):(d=h,e=ta,f=!0):(d=h,e=ua,f=!0)}else{var k=b.childNodes[c-1];if(k&&1==k.nodeType&&!u(k)&&("br"==k.tagName.toLowerCase()?(d="\n",a.isBr=!0,e=va,f=!1):a.checkForTrailingSpace=!0),!d){var l=b.childNodes[c];l&&1==l.nodeType&&!u(l)&&(a.checkForLeadingSpace=!0)}}a.prepopulatedChar=!0,a.character=d,a.characterType=e,a.isCharInvariant=f}},isDefinitelyNonEmpty:function(){var a=this.characterType;return a==ta||a==ua},resolveLeadingAndTrailingSpaces:function(){if(this.prepopulatedChar||this.prepopulateChar(),this.checkForTrailingSpace){var a=this.session.getNodeWrapper(this.node.childNodes[this.offset-1]).getTrailingSpace();a&&(this.isTrailingSpace=!0,this.character=a,this.characterType=va),this.checkForTrailingSpace=!1}if(this.checkForLeadingSpace){var b=this.session.getNodeWrapper(this.node.childNodes[this.offset]).getLeadingSpace();b&&(this.isLeadingSpace=!0,this.character=b,this.characterType=va),this.checkForLeadingSpace=!1}},getPrecedingUncollapsedPosition:function(a){for(var b,c=this;c=c.previousVisible();)if(b=c.getCharacter(a),""!==b)return c;return null},getCharacter:function(a){function b(){return n||(k=o.getPrecedingUncollapsedPosition(a),n=!0),k}this.resolveLeadingAndTrailingSpaces();var c,d=this.character,e=f(a.ignoreCharacters),g=""!==d&&e.indexOf(d)>-1;if(this.isCharInvariant)return c=g?"":d;var h=["character",a.includeSpaceBeforeBr,a.includeBlockContentTrailingSpace,a.includePreLineTrailingSpace,e].join("_"),i=this.cache.get(h);if(null!==i)return i;var j,k,l="",m=this.characterType==va,n=!1,o=this;return m&&(this.type==Ba?l="\n":" "==d&&(!b()||k.isTrailingSpace||"\n"==k.character||" "==k.character&&k.characterType==va)||("\n"==d&&this.isLeadingSpace?b()&&"\n"!=k.character&&(l="\n"):(j=this.nextUncollapsed(),j&&(j.isBr?this.type=ya:j.isTrailingSpace&&"\n"==j.character?this.type=xa:j.isLeadingSpace&&"\n"==j.character&&(this.type=wa),"\n"==j.character?(this.type!=ya||a.includeSpaceBeforeBr)&&(this.type!=wa||a.includeSpaceBeforeBlock)&&(this.type==xa&&j.isTrailingSpace&&!a.includeBlockContentTrailingSpace||(this.type!=za||j.type!=ta||a.includePreLineTrailingSpace)&&("\n"==d?j.isTrailingSpace?this.isTrailingSpace||this.isBr&&(j.type=Aa,b()&&k.isLeadingSpace&&!k.isTrailingSpace&&"\n"==k.character?j.character="":j.type=Ba):l="\n":" "==d&&(l=" "))):l=d)))),e.indexOf(l)>-1&&(l=""),this.cache.set(h,l),l},equals:function(a){return!!a&&this.node===a.node&&this.offset===a.offset},inspect:A,toString:function(){return this.character}};z.prototype=Ca,U(Ca,{next:x("nextPos",function(a){var b=a.nodeWrapper,c=a.node,d=a.offset,e=b.session;if(!c)return null;var f,g,h;return d==b.getLength()?(f=c.parentNode,g=f?b.getNodeIndex()+1:0):b.isCharacterDataNode()?(f=c,g=d+1):(h=c.childNodes[d],e.getNodeWrapper(h).containsPositions()?(f=h,g=0):(f=c,g=d+1)),f?e.getPosition(f,g):null}),previous:x("previous",function(a){var b,c,d,e=a.nodeWrapper,f=a.node,g=a.offset,h=e.session;return 0==g?(b=f.parentNode,c=b?e.getNodeIndex():0):e.isCharacterDataNode()?(b=f,c=g-1):(d=f.childNodes[g-1],h.getNodeWrapper(d).containsPositions()?(b=d,c=S.getNodeLength(d)):(b=f,c=g-1)),b?h.getPosition(b,c):null}),nextVisible:x("nextVisible",function(a){var b=a.next();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex()+1)),e}),nextUncollapsed:x("nextUncollapsed",function(a){for(var b=a;b=b.nextVisible();)if(b.resolveLeadingAndTrailingSpaces(),""!==b.character)return b;return null}),previousVisible:x("previousVisible",function(a){var b=a.previous();if(!b)return null;var c=b.nodeWrapper,d=b.node,e=b;return c.isCollapsed()&&(e=c.session.getPosition(d.parentNode,c.getNodeIndex())),e})});var Da=null,Ea=function(){function a(a){var b=new w;return{get:function(c){var d=b.get(c[a]);if(d)for(var e,f=0;e=d[f++];)if(e.node===c)return e;return null},set:function(c){var d=c.node[a],e=b.get(d)||b.set(d,[]);e.push(c)}}}function b(){this.initCaches()}var c=T.isHostProperty(document.documentElement,"uniqueID");return b.prototype={initCaches:function(){this.elementCache=c?function(){var a=new w;return{get:function(b){return a.get(b.uniqueID)},set:function(b){a.set(b.node.uniqueID,b)}}}():a("tagName"),this.textNodeCache=a("data"),this.otherNodeCache=a("nodeName")},getNodeWrapper:function(a){var b;switch(a.nodeType){case 1:b=this.elementCache;break;case 3:b=this.textNodeCache;break;default:b=this.otherNodeCache}var c=b.get(a);return c||(c=new y(a,this),b.set(c)),c},getPosition:function(a,b){return this.getNodeWrapper(a).getPosition(b)},getRangeBoundaryPosition:function(a,b){var c=b?"start":"end";return this.getPosition(a[c+"Container"],a[c+"Offset"])},detach:function(){this.elementCache=this.textNodeCache=this.otherNodeCache=null}},b}();U(S,{nextNode:q,previousNode:r});var Fa=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;++c)if(a[c]===b)return c;return-1};U(a.rangePrototype,{moveStart:M(!0,!1),moveEnd:M(!1,!1),move:M(!0,!0),trimStart:N(!0),trimEnd:N(!1),trim:L(function(a,b){var c=this.trimStart(b),d=this.trimEnd(b);return c||d}),expand:L(function(a,b,c){var d=!1;c=h(c,la);var e=c.characterOptions;if(b||(b=Q),b==R){var f,g,i=c.wordOptions,j=a.getRangeBoundaryPosition(this,!0),k=a.getRangeBoundaryPosition(this,!1),l=F(j,e,i),m=l.nextEndToken(),n=m.chars[0].previousVisible();if(this.collapsed)f=m;else{var o=F(k,e,i);f=o.previousStartToken()}return g=f.chars[f.chars.length-1],n.equals(j)||(this.setStart(n.node,n.offset),d=!0),g&&!g.equals(k)&&(this.setEnd(g.node,g.offset),d=!0),c.trim&&(c.trimStart&&(d=this.trimStart(e)||d),c.trimEnd&&(d=this.trimEnd(e)||d)),d}return this.moveEnd(Q,1,c)}),text:L(function(a,b){return this.collapsed?"":I(a,this,V(b,ga)).join("")}),selectCharacters:L(function(a,b,c,d,e){var f={characterOptions:e};b||(b=W(this.getDocument())),this.selectNodeContents(b),this.collapse(!0),this.moveStart("character",c,f),this.collapse(!0),this.moveEnd("character",d-c,f)}),toCharacterRange:L(function(a,b,c){b||(b=W(this.getDocument()));var d,e,f=b.parentNode,g=S.getNodeIndex(b),h=-1==S.comparePoints(this.startContainer,this.endContainer,f,g),i=this.cloneRange();return h?(i.setStartAndEnd(this.startContainer,this.startOffset,f,g),d=-i.text(c).length):(i.setStartAndEnd(f,g,this.startContainer,this.startOffset),d=i.text(c).length),e=d+this.text(c).length,{start:d,end:e}}),findText:L(function(b,c,d){d=h(d,ja),d.wholeWordsOnly&&(d.wordOptions.includeTrailingSpace=!1);var e=aa(d.direction),f=d.withinRange;f||(f=a.createRange(),f.selectNodeContents(this.getDocument()));var g=c,i=!1;"string"==typeof g?d.caseSensitive||(g=g.toLowerCase()):i=!0;var j=b.getRangeBoundaryPosition(this,!e),k=f.comparePoint(j.node,j.offset);-1===k?j=b.getRangeBoundaryPosition(f,!0):1===k&&(j=b.getRangeBoundaryPosition(f,!1));for(var l,m=j,n=!1;;)if(l=K(m,g,i,f,d)){if(l.valid)return this.setStartAndEnd(l.startPos.node,l.startPos.offset,l.endPos.node,l.endPos.offset),!0;m=e?l.startPos:l.endPos}else{if(!d.wrap||n)return!1;f=f.cloneRange(),m=b.getRangeBoundaryPosition(f,!e),f.setBoundary(j.node,j.offset,e),n=!0}}),pasteHtml:function(a){if(this.deleteContents(),a){var b=this.createContextualFragment(a),c=b.lastChild;this.insertNode(b),this.collapseAfter(c)}}}),U(a.selectionPrototype,{expand:L(function(a,b,c){this.changeEachRange(function(a){a.expand(b,c)})}),move:L(function(a,b,c,d){var e=0;if(this.focusNode){this.collapse(this.focusNode,this.focusOffset);var f=this.getRangeAt(0);d||(d={}),d.characterOptions=V(d.characterOptions,ha),e=f.move(b,c,d),this.setSingleRange(f)}return e}),trimStart:O("trimStart"),trimEnd:O("trimEnd"),trim:O("trim"),selectCharacters:L(function(b,c,d,e,f,g){var h=a.createRange(c);h.selectCharacters(c,d,e,g),this.setSingleRange(h,f)}),saveCharacterRanges:L(function(a,b,c){for(var d=this.getAllRanges(),e=d.length,f=[],g=1==e&&this.isBackward(),h=0,i=d.length;i>h;++h)f[h]={characterRange:d[h].toCharacterRange(b,c),backward:g,characterOptions:c};return f}),restoreCharacterRanges:L(function(b,c,d){this.removeAllRanges();for(var e,f,g,h=0,i=d.length;i>h;++h)f=d[h],g=f.characterRange,e=a.createRange(c),e.selectCharacters(c,g.start,g.end,f.characterOptions),this.addRange(e,f.backward)}),text:L(function(a,b){for(var c=[],d=0,e=this.rangeCount;e>d;++d)c[d]=this.getRangeAt(d).text(b);return c.join("")})}),a.innerText=function(b,c){var d=a.createRange(b);d.selectNodeContents(b);var e=d.text(c);return e},a.createWordIterator=function(a,b,c){var d=C();c=h(c,ma);var e=d.getPosition(a,b),f=F(e,c.characterOptions,c.wordOptions),g=aa(c.direction);return{next:function(){return g?f.previousStartToken():f.nextEndToken()},dispose:function(){f.dispose(),this.next=function(){}}}},a.noMutation=function(a){var b=C();a(b),D()},a.noMutation.createEntryPointFunction=L,a.textRange={isBlockNode:l,isCollapsedWhitespaceNode:t,createPosition:L(function(a,b,c){return a.getPosition(b,c)})}}),a},this),function(a,b){"function"==typeof define&&define.amd?define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?module.exports=a(require("rangy")):a(b.rangy)}(function(a){return a.createModule("SaveRestore",["WrappedRange"],function(a,b){function c(a,b){return(b||document).getElementById(a)}function d(a,b){var c,d="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),e=o.getDocument(a.startContainer),f=a.cloneRange();return f.collapse(b),c=e.createElement("span"),c.id=d,c.style.lineHeight="0",c.style.display="none",c.className="rangySelectionBoundary",c.appendChild(e.createTextNode(r)),f.insertNode(c),c}function e(a,d,e,f){var g=c(e,a);g?(d[f?"setStartBefore":"setEndBefore"](g),p(g)):b.warn("Marker element has been removed. Cannot restore selection.")}function f(a,b){return b.compareBoundaryPoints(a.START_TO_START,a)}function g(b,c){var e,f,g=a.DomRange.getRangeDocument(b),h=b.toString(),i=q(c);return b.collapsed?(f=d(b,!1),{document:g,markerId:f.id,collapsed:!0}):(f=d(b,!1),e=d(b,!0),{document:g,startMarkerId:e.id,endMarkerId:f.id,collapsed:!1,backward:i,toString:function(){return"original text: '"+h+"', new text: '"+b.toString()+"'"}})}function h(d,f){var g=d.document;"undefined"==typeof f&&(f=!0);var h=a.createRange(g);if(d.collapsed){var i=c(d.markerId,g);if(i){i.style.display="inline";var j=i.previousSibling;j&&3==j.nodeType?(p(i),h.collapseToPoint(j,j.length)):(h.collapseBefore(i),p(i))}else b.warn("Marker element has been removed. Cannot restore selection.")}else e(g,h,d.startMarkerId,!0),e(g,h,d.endMarkerId,!1);return f&&h.normalizeBoundaries(),h}function i(b,d){var e,h,i=[],j=q(d);b=b.slice(0),b.sort(f);for(var k=0,l=b.length;l>k;++k)i[k]=g(b[k],j);for(k=l-1;k>=0;--k)e=b[k],h=a.DomRange.getRangeDocument(e),e.collapsed?e.collapseAfter(c(i[k].markerId,h)):(e.setEndBefore(c(i[k].endMarkerId,h)),e.setStartAfter(c(i[k].startMarkerId,h)));return i}function j(c){if(!a.isSelectionValid(c))return b.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var d=a.getSelection(c),e=d.getAllRanges(),f=1==e.length&&d.isBackward(),g=i(e,f);return f?d.setSingleRange(e[0],f):d.setRanges(e),{win:c,rangeInfos:g,restored:!1}}function k(a){for(var b=[],c=a.length,d=c-1;d>=0;d--)b[d]=h(a[d],!0);return b}function l(b,c){if(!b.restored){var d=b.rangeInfos,e=a.getSelection(b.win),f=k(d),g=d.length;1==g&&c&&a.features.selectionHasExtend&&d[0].backward?(e.removeAllRanges(),e.addRange(f[0],!0)):e.setRanges(f),b.restored=!0}}function m(a,b){var d=c(b,a);d&&p(d)}function n(a){for(var b,c=a.rangeInfos,d=0,e=c.length;e>d;++d)b=c[d],b.collapsed?m(a.doc,b.markerId):(m(a.doc,b.startMarkerId),m(a.doc,b.endMarkerId))}var o=a.dom,p=o.removeNode,q=a.Selection.isDirectionBackward,r="\ufeff";a.util.extend(a,{saveRange:g,restoreRange:h,saveRanges:i,restoreRanges:k,saveSelection:j,restoreSelection:l,removeMarkerElement:m,removeMarkers:n})}),a},this);var b=function(){};b.extend=function(a,c){var d=b.prototype.extend;b._prototyping=!0;var e=new this;d.call(e,a),e.base=function(){},delete b._prototyping;var f=e.constructor,g=e.constructor=function(){if(!b._prototyping)if(this._constructing||this.constructor==g)this._constructing=!0,f.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||d).call(arguments[0],e)};return g.ancestor=this,g.extend=this.extend,g.forEach=this.forEach,g.implement=this.implement,g.prototype=e,g.toString=this.toString,g.valueOf=function(a){return"object"==a?g:f.valueOf()},d.call(g,c),"function"==typeof g.init&&g.init(),g},b.prototype={extend:function(a,c){if(arguments.length>1){var d=this[a];if(d&&"function"==typeof c&&(!d.valueOf||d.valueOf()!=c.valueOf())&&/\bbase\b/.test(c)){var e=c.valueOf();c=function(){var a=this.base||b.prototype.base;this.base=d;var c=e.apply(this,arguments);return this.base=a,c},c.valueOf=function(a){return"object"==a?c:e},c.toString=b.toString}this[a]=c}else if(a){var f=b.prototype.extend;b._prototyping||"function"==typeof this||(f=this.extend||f);for(var g={toSource:null},h=["constructor","toString","valueOf"],i=b._prototyping?0:1;j=h[i++];)a[j]!=g[j]&&f.call(this,j,a[j]);for(var j in a)g[j]||f.call(this,j,a[j])}return this}},b=b.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(a,b,c){for(var d in a)void 0===this.prototype[d]&&b.call(c,a[d],d,a)},implement:function(){for(var a=0;a-1?c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"):/Edge\/(\d+)./i.test(navigator.userAgent)&&(c=/Edge\/(\d+)./i)),c&&null!=c.exec(navigator.userAgent)&&(d=parseFloat(RegExp.$1)),-1===d?!1:a?b?"<"===b?d>a:">"===b?a>d:"<="===b?d>=a:">="===b?a>=d:void 0:a===d:!0}var d=navigator.userAgent,e=document.createElement("div"),f=-1!==d.indexOf("Gecko")&&-1===d.indexOf("KHTML")&&!c(),g=-1!==d.indexOf("AppleWebKit/")&&!c(),h=-1!==d.indexOf("Chrome/")&&!c(),i=-1!==d.indexOf("Opera/")&&!c();return{USER_AGENT:d,supported:function(){var c=this.USER_AGENT.toLowerCase(),d="contentEditable"in e,f=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,g=document.querySelector&&document.querySelectorAll,h=this.isIos()&&a(c)<5||this.isAndroid()&&b(c)<4||-1!==c.indexOf("opera mobi")||-1!==c.indexOf("hpwos/");return d&&f&&g&&!h},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){return/ipad|iphone|ipod/i.test(this.USER_AGENT)},isAndroid:function(){return-1!==this.USER_AGENT.indexOf("Android")},supportsSandboxedIframes:function(){return c()},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return c(12,">")},hasCurrentStyleProperty:function(){return"currentStyle"in e},insertsLineBreaksOnReturn:function(){return f},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){return"on"+a in e||function(){return e.setAttribute("on"+a,"return;"),"function"==typeof e["on"+a]}()},supportsEventsInIframeCorrectly:function(){return!i},supportsHTML5Tags:function(a){var b=a.createElement("div"),c="
    foo
    ";return b.innerHTML=c,b.innerHTML.toLowerCase()===c},supportsCommand:function(){var a={formatBlock:c(10,"<="),insertUnorderedList:c(),insertOrderedList:c()},b={insertHTML:f};return function(c,d){var e=a[d];if(!e){try{return c.queryCommandSupported(d)}catch(f){}try{return c.queryCommandEnabled(d)}catch(g){return!!b[d]}}return!1}}(),doesAutoLinkingInContentEditable:function(){return c()},canDisableAutoLinking:function(){return this.supportsCommand(document,"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return f||i||g},supportsGetAttributeCorrectly:function(){var a=document.createElement("td");return"1"!=a.getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return f||c()||i},autoScrollsToCaret:function(){return!g},autoClosesUnclosedTags:function(){var a,b,c=e.cloneNode(!1);return c.innerHTML="

    ",b=c.innerHTML.toLowerCase(),a="

    "===b||"

    "===b,this.autoClosesUnclosedTags=function(){return a},a},supportsNativeGetElementsByClassName:function(){return-1!==String(document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},needsSpaceAfterLineBreak:function(){return i},supportsSpeechApiOn:function(a){var b=d.match(/Chrome\/(\d+)/)||[void 0,0];return b[1]>=11&&("onwebkitspeechchange"in a||"speech"in a)},crashesWhenDefineProperty:function(a){return c(9)&&("XMLHttpRequest"===a||"XDomainRequest"===a)},doesAsyncFocus:function(){return c(12,">")},hasProblemsSettingCaretAfterImg:function(){return c()},hasLiDeletingProblem:function(){return c()},hasUndoInContextMenu:function(){return f||h||i},hasInsertNodeIssue:function(){return i},hasIframeFocusIssue:function(){return c()},createsNestedInvalidMarkupAfterPaste:function(){return g},hasCaretBlockElementIssue:function(){return g},supportsMutationEvents:function(){return"MutationEvent"in window},supportsModernPaste:function(){return!c()},fixStyleKey:function(a){return"cssFloat"===a?"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat":a},usesControlRanges:function(){return document.body&&"createControlRange"in document.body}}}(),a.lang.array=function(b){return{contains:function(c){if(Array.isArray(c)){for(var d=c.length;d--;)if(-1!==a.lang.array(b).indexOf(c[d]))return!0;return!1}return-1!==a.lang.array(b).indexOf(c)},indexOf:function(a){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;d>c;c++)if(b[c]===a)return c;return-1},without:function(c){c=a.lang.array(c);for(var d=[],e=0,f=b.length;f>e;e++)c.contains(b[e])||d.push(b[e]);return d},get:function(){for(var a=0,c=b.length,d=[];c>a;a++)d.push(b[a]);return d},map:function(a,c){if(Array.prototype.map)return b.map(a,c);for(var d=b.length>>>0,e=new Array(d),f=0;d>f;f++)e[f]=a.call(c,b[f],f,b);return e},unique:function(){for(var c=[],d=b.length,e=0;d>e;)a.lang.array(c).contains(b[e])||c.push(b[e]),e++;return c}}},a.lang.Dispatcher=b.extend({on:function(a,b){return this.events=this.events||{},this.events[a]=this.events[a]||[],this.events[a].push(b),this},off:function(a,b){this.events=this.events||{};var c,d,e=0;if(a){for(c=this.events[a]||[],d=[];e\t"]/g,e={"&":"&","<":"<",">":">",'"':"""," ":"  "};a.lang.string=function(a){return a=String(a),{trim:function(){return a.replace(b,"").replace(c,"")},interpolate:function(b){for(var c in b)a=this.replace("#{"+c+"}").by(b[c]);return a},replace:function(b){return{by:function(c){return a.split(b).join(c)}}},escapeHTML:function(b,c){var f=a.replace(d,function(a){return e[a]});return b&&(f=f.replace(/(?:\r\n|\r|\n)/g,"
    ")),c&&(f=f.replace(/ /gi,"  ")),f}}}}(),function(a){function b(a,b){return f(a,b)?a:(a===a.ownerDocument.documentElement&&(a=a.ownerDocument.body),g(a,b))}function c(a){return a.replace(i,function(a,b){var c=(b.match(j)||[])[1]||"",d=l[c];b=b.replace(j,""),b.split(d).length>b.split(c).length&&(b+=c,c="");var e=b,f=b;return b.length>k&&(f=f.substr(0,k)+"..."),"www."===e.substr(0,4)&&(e="http://"+e),''+f+""+c})}function d(a){var b=a._wysihtml5_tempElement;return b||(b=a._wysihtml5_tempElement=a.createElement("div")),b}function e(b){var e=b.parentNode,f=a.lang.string(b.data).escapeHTML(),g=d(e.ownerDocument);for(g.innerHTML=""+c(f),g.removeChild(g.firstChild);g.firstChild;)e.insertBefore(g.firstChild,b);e.removeChild(b)}function f(b,c){for(var d;b.parentNode;){if(b=b.parentNode,d=b.nodeName,b.className&&a.lang.array(b.className.split(" ")).contains(c))return!0;if(h.contains(d))return!0;if("body"===d)return!1}return!1}function g(b,c){if(!(h.contains(b.nodeName)||b.className&&a.lang.array(b.className.split(" ")).contains(c))){if(b.nodeType===a.TEXT_NODE&&b.data.match(i))return void e(b);for(var d=a.lang.array(b.childNodes).get(),f=d.length,j=0;f>j;j++)g(d[j],c);return b}}var h=a.lang.array(["CODE","PRE","A","SCRIPT","HEAD","TITLE","STYLE"]),i=/((https?:\/\/|www\.)[^\s<]{3,})/gi,j=/([^\w\/\-](,?))$/i,k=100,l={")":"(","]":"[","}":"{"};a.dom.autoLink=b,a.dom.autoLink.URL_REG_EXP=i}(a),function(a){var b=a.dom;b.addClass=function(a,c){var d=a.classList;return d?d.add(c):void(b.hasClass(a,c)||(a.className+=" "+c))},b.removeClass=function(a,b){var c=a.classList;return c?c.remove(b):void(a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," "))},b.hasClass=function(a,b){var c=a.classList;if(c)return c.contains(b);var d=a.className;return d.length>0&&(d==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(d))}}(a),a.dom.contains=function(){var b=document.documentElement;return b.contains?function(b,c){if(c.nodeType!==a.ELEMENT_NODE){if(c.parentNode===b)return!0;c=c.parentNode}return b!==c&&b.contains(c)}:b.compareDocumentPosition?function(a,b){return!!(16&a.compareDocumentPosition(b))}:void 0}(),a.dom.convertToList=function(){function b(a,b){var c=a.createElement("li");return b.appendChild(c),c}function c(a,b){return a.createElement(b)}function d(d,e,f){if("UL"===d.nodeName||"OL"===d.nodeName||"MENU"===d.nodeName)return d;var g,h,i,j,k,l,m,n,o,p=d.ownerDocument,q=c(p,e),r=d.querySelectorAll("br"),s=r.length;for(o=0;s>o;o++)for(j=r[o];(k=j.parentNode)&&k!==d&&k.lastChild===j;){if("block"===a.dom.getStyle("display").from(k)){k.removeChild(j);break}a.dom.insert(j).after(j.parentNode)}for(g=a.lang.array(d.childNodes).get(),h=g.length,o=0;h>o;o++)n=n||b(p,q),i=g[o],l="block"===a.dom.getStyle("display").from(i),m="BR"===i.nodeName,!l||f&&a.dom.hasClass(i,f)?m?n=n.firstChild?null:n:n.appendChild(i):(n=n.firstChild?b(p,q):n,n.appendChild(i),n=null);return 0===g.length&&b(p,q),d.parentNode.replaceChild(q,d),q}return d}(),a.dom.copyAttributes=function(a){return{from:function(b){return{to:function(c){for(var d,e=0,f=a.length;f>e;e++)d=a[e],"undefined"!=typeof b[d]&&""!==b[d]&&(c[d]=b[d]);return{andTo:arguments.callee}}}}}},function(b){var c=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],d=function(a){return e(a)?parseInt(b.getStyle("width").from(a),10)d;d++)if("border-box"===b.getStyle(c[d]).from(a))return c[d]};b.copyStyles=function(e){return{from:function(f){d(f)&&(e=a.lang.array(e).without(c));for(var g,h="",i=e.length,j=0;i>j;j++)g=e[j],h+=g+":"+b.getStyle(g).from(f)+";";return{to:function(a){return b.setStyles(h).on(a),{andTo:arguments.callee}}}}}}}(a.dom),function(a){a.dom.delegate=function(a,b,c,d){var e=function(c){for(var e=c.target,f=3===e.nodeType?e.parentNode:e,g=a.querySelectorAll(b),h=0,i=g.length;i>h;h++)g[h].contains(f)&&d.call(g[h],c)};return a.addEventListener(c,e,!1),{stop:function(){a.removeEventListener(c,e,!1)}}}}(a),function(a){function b(a,b){for(var c=[a],d=a;b&&d&&d!==b||!b&&d;)c.unshift(d),d=d.parentNode;return c}a.dom.domNode=function(c){var d=[a.ELEMENT_NODE,a.TEXT_NODE];return{is:{emptyTextNode:function(b){var d=b?/^\s*$/g:/^[\r\n]*$/g;return c&&c.nodeType===a.TEXT_NODE&&d.test(c.data)},rangyBookmark:function(){return c&&1===c.nodeType&&c.classList.contains("rangySelectionBoundary")},visible:function(){var b=!/^\s*$/g.test(a.dom.getTextContent(c));return b||1===c.nodeType&&c.querySelector("img, br, hr, object, embed, canvas, input, textarea")&&(b=!0),b},lineBreak:function(){return c&&1===c.nodeType&&"BR"===c.nodeName},block:function(){return c&&1===c.nodeType&&"block"===c.ownerDocument.defaultView.getComputedStyle(c).display},voidElement:function(){return a.dom.domNode(c).test({query:a.VOID_ELEMENTS})}},prev:function(b){var e=c.previousSibling,f=b&&b.nodeTypes?b.nodeTypes:d;return e?a.dom.domNode(e).is.rangyBookmark()||!a.lang.array(f).contains(e.nodeType)||b&&b.ignoreBlankTexts&&a.dom.domNode(e).is.emptyTextNode(!0)?a.dom.domNode(e).prev(b):e:null},next:function(b){var e=c.nextSibling,f=b&&b.nodeTypes?b.nodeTypes:d;return e?a.dom.domNode(e).is.rangyBookmark()||!a.lang.array(f).contains(e.nodeType)||b&&b.ignoreBlankTexts&&a.dom.domNode(e).is.emptyTextNode(!0)?a.dom.domNode(e).next(b):e:null},commonAncestor:function(a,d){var e=b(c,d),f=b(a,d);if(e[0]!=f[0])return null;for(var g=0;g0)for(var f=!1,g=Array.isArray(b.styleProperty)?b.styleProperty:[b.styleProperty],h=0,i=g.length;i>h;h++){if(d=a.browser.fixStyleKey(g[h]),c.style[d]){if(!b.styleValue){f=!0;break}if(b.styleValue instanceof RegExp){if(c.style[d].trim().match(b.styleValue).length>0){f=!0;break}}else if(Array.isArray(b.styleValue)){if(b.styleValue.indexOf(c.style[d].trim())){f=!0;break}}else if(b.styleValue===c.style[d].trim().replace(/, /g,",")){f=!0;break}}if(!f)return!1}if(b.attribute){var j=a.dom.getAttributes(c),k=[],l=!1;Array.isArray(b.attribute)?k=b.attribute:k[b.attribute]=b.attributeValue;for(var m in k)if(k.hasOwnProperty(m))if("undefined"==typeof k[m]){if("undefined"!=typeof j[m]){l=!0;break}}else if(j[m]===k[m]){l=!0;break}if(!l)return!1}return!0}}}}(a),a.dom.getAsDom=function(){var b=function(a,b){var c=b.createElement("div");c.style.display="none",b.body.appendChild(c);try{c.innerHTML=a}catch(d){}return b.body.removeChild(c),c},c=function(a){if(!a._wysihtml5_supportsHTML5Tags){for(var b=0,c=d.length;c>b;b++)a.createElement(d[b]);a._wysihtml5_supportsHTML5Tags=!0}},d=["abbr","article","aside","audio","bdi","canvas","command","datalist","details","figcaption","figure","footer","header","hgroup","keygen","mark","meter","nav","output","progress","rp","rt","ruby","svg","section","source","summary","time","track","video","wbr"];return function(d,e){e=e||document;var f;return"object"==typeof d&&d.nodeType?(f=e.createElement("div"),f.appendChild(d)):a.browser.supportsHTML5Tags(e)?(f=e.createElement("div"),f.innerHTML=d):(c(e),f=b(d,e)),f}}(),a.dom.getParentElement=function(){return function(b,c,d,e){for(d=d||50;d--&&b&&"BODY"!==b.nodeName&&(!e||b!==e);){if(a.dom.domNode(b).test(c))return b;b=b.parentNode}return null}}(),a.dom.getStyle=function(){function b(a){return a.replace(d,function(a){return a.charAt(1).toUpperCase()})}var c={"float":"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat" +},d=/\-[a-z]/g;return function(d){return{from:function(e){if(e.nodeType===a.ELEMENT_NODE){var f=e.ownerDocument,g=c[d]||b(d),h=e.style,i=e.currentStyle,j=h[g];if(j)return j;if(i)try{return i[g]}catch(k){}var l,m,n=f.defaultView||f.parentWindow,o=("height"===d||"width"===d)&&"TEXTAREA"===e.nodeName;return n.getComputedStyle?(o&&(l=h.overflow,h.overflow="hidden"),m=n.getComputedStyle(e,null).getPropertyValue(d),o&&(h.overflow=l||""),m):void 0}}}}}(),a.dom.getTextNodes=function(b,c){var d=[];for(b=b.firstChild;b;b=b.nextSibling)3==b.nodeType?c&&/^\s*$/.test(b.innerText||b.textContent)||d.push(b):d=d.concat(a.dom.getTextNodes(b,c));return d},a.dom.hasElementWithTagName=function(){function a(a){return a._wysihtml5_identifier||(a._wysihtml5_identifier=c++)}var b={},c=1;return function(c,d){var e=a(c)+":"+d,f=b[e];return f||(f=b[e]=c.getElementsByTagName(d)),f.length>0}}(),function(a){function b(a){return a._wysihtml5_identifier||(a._wysihtml5_identifier=d++)}var c={},d=1;a.dom.hasElementWithClassName=function(d,e){if(!a.browser.supportsNativeGetElementsByClassName())return!!d.querySelector("."+e);var f=b(d)+":"+e,g=c[f];return g||(g=c[f]=d.getElementsByClassName(e)),g.length>0}}(a),a.dom.insert=function(a){return{after:function(b){b.parentNode.insertBefore(a,b.nextSibling)},before:function(b){b.parentNode.insertBefore(a,b)},into:function(b){b.appendChild(a)}}},a.dom.insertCSS=function(a){return a=a.join("\n"),{into:function(b){var c=b.createElement("style");c.type="text/css",c.styleSheet?c.styleSheet.cssText=a:c.appendChild(b.createTextNode(a));var d=b.querySelector("head link");if(d)return void d.parentNode.insertBefore(c,d);var e=b.querySelector("head");e&&e.appendChild(c)}}},function(a){a.dom.lineBreaks=function(b){function c(a){return"BR"===a.nodeName}function d(b){return c(b)?!0:"block"===a.dom.getStyle("display").from(b)?!0:!1}return{add:function(c){var e=b.ownerDocument,f=a.dom.domNode(b).next({ignoreBlankTexts:!0}),g=a.dom.domNode(b).prev({ignoreBlankTexts:!0});f&&!d(f)&&a.dom.insert(e.createElement("br")).after(b),g&&!d(g)&&a.dom.insert(e.createElement("br")).before(b)},remove:function(d){var e=a.dom.domNode(b).next({ignoreBlankTexts:!0}),f=a.dom.domNode(b).prev({ignoreBlankTexts:!0});e&&c(e)&&e.parentNode.removeChild(e),f&&c(f)&&f.parentNode.removeChild(f)}}}}(a),a.dom.observe=function(a,b,c){b="string"==typeof b?[b]:b;for(var d,e,f=0,g=b.length;g>f;f++)e=b[f],a.addEventListener?a.addEventListener(e,c,!1):(d=function(b){"target"in b||(b.target=b.srcElement),b.preventDefault=b.preventDefault||function(){this.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){this.cancelBubble=!0},c.call(a,b)},a.attachEvent("on"+e,d));return{stop:function(){for(var e,f=0,g=b.length;g>f;f++)e=b[f],a.removeEventListener?a.removeEventListener(e,c,!1):a.detachEvent("on"+e,d)}}},a.dom.parse=function(b,c){function d(b,c){a.lang.object(u).merge(t).merge(c.rules).get();var d,g,h,i=c.context||b.ownerDocument||document,j=i.createDocumentFragment(),k="string"==typeof b,l=!1;for(c.clearInternals===!0&&(l=!0),d=k?a.dom.getAsDom(b,i):b,u.selectors&&f(d,u.selectors);d.firstChild;)h=d.firstChild,g=e(h,c.cleanUp,l,c.uneditableClass),g&&j.appendChild(g),h!==g&&d.removeChild(h);if(c.unjoinNbsps)for(var m=a.dom.getTextNodes(j),n=m.length;n--;)m[n].nodeValue=m[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi,"$1 ");return d.innerHTML="",d.appendChild(j),k?a.quirks.getCorrectInnerHTML(d):d}function e(b,c,d,f){var g,h,i,j,k=b.nodeType,l=b.childNodes,m=l.length,n=q[k],o=0;if(f&&1===k&&a.dom.hasClass(b,f))return b;if(h=n&&n(b,d),!h){if(h===!1){for(g=b.ownerDocument.createDocumentFragment(),o=m;o--;)l[o]&&(i=e(l[o],c,d,f),i&&(l[o]===i&&o--,g.insertBefore(i,g.firstChild)));return j=a.dom.getStyle("display").from(b),""===j&&(j=a.lang.array(v).contains(b.tagName)?"block":""),a.lang.array(["block","flex","table"]).contains(j)&&g.appendChild(b.ownerDocument.createElement("br")),a.lang.array(["div","pre","p","table","td","th","ul","ol","li","dd","dl","footer","header","section","h1","h2","h3","h4","h5","h6"]).contains(b.nodeName.toLowerCase())&&b.parentNode.lastChild!==b&&(b.nextSibling&&3===b.nextSibling.nodeType&&/^\s/.test(b.nextSibling.nodeValue)||g.appendChild(b.ownerDocument.createTextNode(" "))),g.normalize&&g.normalize(),g}return null}for(o=0;m>o;o++)l[o]&&(i=e(l[o],c,d,f),i&&(l[o]===i&&o--,h.appendChild(i)));if(c&&h.nodeName.toLowerCase()===r&&(!h.childNodes.length||/^\s*$/gi.test(h.innerHTML)&&(d||"_wysihtml5-temp-placeholder"!==b.className&&"rangySelectionBoundary"!==b.className)||!h.attributes.length)){for(g=h.ownerDocument.createDocumentFragment();h.firstChild;)g.appendChild(h.firstChild);return g.normalize&&g.normalize(),g}return h.normalize&&h.normalize(),h}function f(b,c){var d,e,f;for(d in c)if(c.hasOwnProperty(d)){a.lang.object(c[d]).isFunction()?e=c[d]:"string"==typeof c[d]&&A[c[d]]&&(e=A[c[d]]),f=b.querySelectorAll(d);for(var g=f.length;g--;)e(f[g])}}function g(b,c){var d,e,f,g=u.tags,i=b.nodeName.toLowerCase(),k=b.scopeName;if(b._wysihtml5)return null;if(b._wysihtml5=1,"wysihtml5-temp"===b.className)return null;if(k&&"HTML"!=k&&(i=k+":"+i),"outerHTML"in b&&(a.browser.autoClosesUnclosedTags()||"P"!==b.nodeName||"

    "===b.outerHTML.slice(-4).toLowerCase()||(i="div")),i in g){if(d=g[i],!d||d.remove)return null;if(d.unwrap)return!1;d="string"==typeof d?{rename_tag:d}:d}else{if(!b.firstChild)return null;d={rename_tag:r}}if(d.one_of_type&&!h(b,u,d.one_of_type,c)){if(!d.remove_action)return null;if("unwrap"===d.remove_action)return!1;if("rename"!==d.remove_action)return null;f=d.remove_action_rename_to||r}return e=b.ownerDocument.createElement(f||d.rename_tag||i),n(b,e,d,c),j(b,e,d),b=null,e.normalize&&e.normalize(),e}function h(a,b,c,d){var e,f;if("SPAN"===a.nodeName&&!d&&("_wysihtml5-temp-placeholder"===a.className||"rangySelectionBoundary"===a.className))return!0;for(f in c)if(c.hasOwnProperty(f)&&b.type_definitions&&b.type_definitions[f]&&(e=b.type_definitions[f],i(a,e)))return!0;return!1}function i(b,c){var d,e,f,g,h,i=b.getAttribute("class"),j=b.getAttribute("style");if(c.methods)for(var k in c.methods)if(c.methods.hasOwnProperty(k)&&z[k]&&z[k](b))return!0;if(i&&c.classes){i=i.replace(/^\s+/g,"").replace(/\s+$/g,"").split(s),d=i.length;for(var l=0;d>l;l++)if(c.classes[i[l]])return!0}if(j&&c.styles){j=j.split(";");for(e in c.styles)if(c.styles.hasOwnProperty(e))for(var m=j.length;m--;)if(h=j[m].split(":"),h[0].replace(/\s/g,"").toLowerCase()===e&&(c.styles[e]===!0||1===c.styles[e]||a.lang.array(c.styles[e]).contains(h[1].replace(/\s/g,"").toLowerCase())))return!0}if(c.attrs)for(f in c.attrs)if(c.attrs.hasOwnProperty(f)&&(g=a.dom.getAttribute(b,f),"string"==typeof g&&g.search(c.attrs[f])>-1))return!0;return!1}function j(a,b,c){var d,e;if(c&&c.keep_styles)for(d in c.keep_styles)if(c.keep_styles.hasOwnProperty(d)){if(e="float"===d?a.style.styleFloat||a.style.cssFloat:a.style[d],c.keep_styles[d]instanceof RegExp&&!c.keep_styles[d].test(e))continue;"float"===d?b.style[a.style.styleFloat?"styleFloat":"cssFloat"]=e:a.style[d]&&(b.style[d]=e)}}function k(a,b){var c=[];for(var d in b)b.hasOwnProperty(d)&&0===d.indexOf(a)&&c.push(d);return c}function l(b,c,d,e){var f,g=a.lang.object(d).isFunction()?d:w[d];return g&&(f=g(c,e),"string"==typeof f)?f:!1}function m(b,c){var d,e,f,g=a.lang.object(u.attributes||{}).clone(),h=a.lang.object(g).merge(a.lang.object(c||{}).clone()).get(),i={},j=a.dom.getAttributes(b);for(d in h)if(/\*$/.test(d)){f=k(d.slice(0,-1),j);for(var m=0,n=f.length;n>m;m++)e=l(f[m],j[f[m]],h[d],b.nodeName),e!==!1&&(i[f[m]]=e)}else e=l(d,j[d],h[d],b.nodeName),e!==!1&&(i[d]=e);return i}function n(b,c,d,e){var f,g,h,i,j,k={},l=d.set_class,n=d.add_class,o=d.add_style,p=d.set_attributes,q=u.classes,r=0,t=[],v=[],w=[],z=[];if(p&&(k=a.lang.object(p).clone()),k=a.lang.object(k).merge(m(b,d.check_attributes)).get(),l&&t.push(l),n)for(i in n)j=y[n[i]],j&&(h=j(a.dom.getAttribute(b,i)),"string"==typeof h&&t.push(h));if(o)for(i in o)j=x[o[i]],j&&(newStyle=j(a.dom.getAttribute(b,i)),"string"==typeof newStyle&&v.push(newStyle));if("string"==typeof q&&"any"===q)if(b.getAttribute("class"))if(u.classes_blacklist){for(z=b.getAttribute("class"),z&&(t=t.concat(z.split(s))),f=t.length;f>r;r++)g=t[r],u.classes_blacklist[g]||w.push(g);w.length&&(k["class"]=a.lang.array(w).unique().join(" "))}else k["class"]=b.getAttribute("class");else t&&t.length>0&&(k["class"]=a.lang.array(t).unique().join(" "));else{for(e||(q["_wysihtml5-temp-placeholder"]=1,q._rangySelectionBoundary=1,q["wysiwyg-tmp-selected-cell"]=1),z=b.getAttribute("class"),z&&(t=t.concat(z.split(s))),f=t.length;f>r;r++)g=t[r],q[g]&&w.push(g);w.length&&(k["class"]=a.lang.array(w).unique().join(" "))}k["class"]&&e&&(k["class"]=k["class"].replace("wysiwyg-tmp-selected-cell",""),/^\s*$/g.test(k["class"])&&delete k["class"]),v.length&&(k.style=a.lang.array(v).unique().join(" "));for(i in k)try{c.setAttribute(i,k[i])}catch(A){}k.src&&("undefined"!=typeof k.width&&c.setAttribute("width",k.width),"undefined"!=typeof k.height&&c.setAttribute("height",k.height))}function o(b){var c=b.nextSibling;if(!c||c.nodeType!==a.TEXT_NODE){var d=b.data.replace(a.INVISIBLE_SPACE_REG_EXP,"");return b.ownerDocument.createTextNode(d)}c.data=b.data.replace(a.INVISIBLE_SPACE_REG_EXP,"")+c.data.replace(a.INVISIBLE_SPACE_REG_EXP,"")}function p(a){return u.comments?a.ownerDocument.createComment(a.nodeValue):void 0}var q={1:g,3:o,8:p},r="span",s=/\s+/,t={tags:{},classes:{}},u={},v=["ADDRESS","BLOCKQUOTE","CENTER","DIR","DIV","DL","FIELDSET","FORM","H1","H2","H3","H4","H5","H6","ISINDEX","MENU","NOFRAMES","NOSCRIPT","OL","P","PRE","TABLE","UL"],w={url:function(){var a=/^https?:\/\//i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),src:function(){var a=/^(\/|https?:\/\/)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),href:function(){var a=/^(#|\/|https?:\/\/|mailto:|tel:)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),alt:function(){var a=/[^ a-z0-9_\-]/gi;return function(b,c){return b?b.replace(a,""):"IMG"===c?"":null}}(),numbers:function(){var a=/\D/g;return function(b){return b=(b||"").replace(a,""),b||null}}(),dimension:function(){var a=/\D*(\d+)(\.\d+)?\s?(%)?\D*/;return function(b){return b=(b||"").replace(a,"$1$2$3"),b||null}}(),any:function(){return function(a){return a?a:null}}()},x={align_text:function(){var a={left:"text-align: left;",right:"text-align: right;",center:"text-align: center;"};return function(b){return a[String(b).toLowerCase()]}}()},y={align_img:function(){var a={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(b){return a[String(b).toLowerCase()]}}(),align_text:function(){var a={left:"wysiwyg-text-align-left",right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(b){return a[String(b).toLowerCase()]}}(),clear_br:function(){var a={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(b){return a[String(b).toLowerCase()]}}(),size_font:function(){var a={1:"wysiwyg-font-size-xx-small",2:"wysiwyg-font-size-small",3:"wysiwyg-font-size-medium",4:"wysiwyg-font-size-large",5:"wysiwyg-font-size-x-large",6:"wysiwyg-font-size-xx-large",7:"wysiwyg-font-size-xx-large","-":"wysiwyg-font-size-smaller","+":"wysiwyg-font-size-larger"};return function(b){return a[String(b).charAt(0)]}}()},z={has_visible_contet:function(){var a,b=["img","video","picture","br","script","noscript","style","table","iframe","object","embed","audio","svg","input","button","select","textarea","canvas"];return function(c){if(a=(c.innerText||c.textContent).replace(/\s/g,""),a&&a.length>0)return!0;for(var d=b.length;d--;)if(c.querySelector(b[d]))return!0;return c.offsetWidth&&c.offsetWidth>0&&c.offsetHeight&&c.offsetHeight>0?!0:!1}}()},A={unwrap:function(b){a.dom.unwrap(b)},remove:function(a){a.parentNode.removeChild(a)}};return d(b,c)},a.dom.removeEmptyTextNodes=function(b){for(var c,d=a.lang.array(b.childNodes).get(),e=d.length,f=0;e>f;f++)c=d[f],c.nodeType===a.TEXT_NODE&&/^[\n\r]*$/.test(c.data)&&c.parentNode.removeChild(c)},a.dom.renameElement=function(b,c){for(var d,e=b.ownerDocument.createElement(c);d=b.firstChild;)e.appendChild(d);return a.dom.copyAttributes(["align","className"]).from(b).to(e),b.parentNode&&b.parentNode.replaceChild(e,b),e},a.dom.replaceWithChildNodes=function(a){if(a.parentNode){for(;a.firstChild;)a.parentNode.insertBefore(a.firstChild,a);a.parentNode.removeChild(a)}},function(b){function c(a){return"block"===b.getStyle("display").from(a)}function d(a){return"BR"===a.nodeName}function e(a){var b=a.ownerDocument.createElement("br");a.appendChild(b)}function f(b,f){if(b.nodeName.match(/^(MENU|UL|OL)$/)){var g,h,i,j,k,l,m,n=b.ownerDocument,o=n.createDocumentFragment(),p=a.dom.domNode(b).prev({ignoreBlankTexts:!0}),q=a.dom.domNode(b).next({ignoreBlankTexts:!0}),r=b.lastElementChild||b.lastChild;if(f)for(!p||c(p)||d(p)||e(o);l=b.firstElementChild||b.firstChild;){for(h=l.lastChild,m=l===r;g=l.firstChild;)i=g===h,j=(!m||q&&!c(q))&&i&&!c(g)&&!d(g),o.appendChild(g),j&&e(o);l.parentNode.removeChild(l)}else for(;l=b.firstElementChild||b.firstChild;){if(l.querySelector&&l.querySelector("div, p, ul, ol, menu, blockquote, h1, h2, h3, h4, h5, h6"))for(;g=l.firstChild;)o.appendChild(g);else{for(k=n.createElement("p");g=l.firstChild;)k.appendChild(g);o.appendChild(k)}l.parentNode.removeChild(l)}b.parentNode.replaceChild(o,b)}}b.resolveList=f}(a.dom),function(a){var c=document,d=["parent","top","opener","frameElement","frames","localStorage","globalStorage","sessionStorage","indexedDB"],e=["open","close","openDialog","showModalDialog","alert","confirm","prompt","openDatabase","postMessage","XMLHttpRequest","XDomainRequest"],f=["referrer","write","open","close"];a.dom.Sandbox=b.extend({constructor:function(b,c){this.callback=b||a.EMPTY_FUNCTION,this.config=a.lang.object({}).merge(c).get(),this.config.className||(this.config.className="wysihtml5-sandbox"),this.editableArea=this._createIframe()},insertInto:function(a){"string"==typeof a&&(a=c.getElementById(a)),a.appendChild(this.editableArea)},getIframe:function(){return this.editableArea},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var a=this.getIframe();a.parentNode.removeChild(a)},_readyError:function(){throw new Error("wysihtml.Sandbox: Sandbox iframe isn't loaded yet")},_createIframe:function(){var b=this,d=c.createElement("iframe");return d.className=this.config.className,a.dom.setAttributes({security:"restricted",allowtransparency:"true",frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(d),a.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()&&(d.src="javascript:''"),d.onload=function(){d.onreadystatechange=d.onload=null,b._onLoadIframe(d)},d.onreadystatechange=function(){/loaded|complete/.test(d.readyState)&&(d.onreadystatechange=d.onload=null,b._onLoadIframe(d))},d},_onLoadIframe:function(b){if(a.dom.contains(c.documentElement,b)){var g=this,h=b.contentWindow,i=b.contentWindow.document,j=c.characterSet||c.charset||"utf-8",k=this._getHtml({charset:j,stylesheets:this.config.stylesheets});if(i.open("text/html","replace"),i.write(k),i.close(),this.getWindow=function(){return b.contentWindow},this.getDocument=function(){return b.contentWindow.document},h.onerror=function(a,b,c){throw new Error("wysihtml.Sandbox: "+a,b,c)},!a.browser.supportsSandboxedIframes()){var l,m;for(l=0,m=d.length;m>l;l++)this._unset(h,d[l]);for(l=0,m=e.length;m>l;l++)this._unset(h,e[l],a.EMPTY_FUNCTION);for(l=0,m=f.length;m>l;l++)this._unset(i,f[l]);this._unset(i,"cookie","",!0)}a.polyfills&&a.polyfills(h,i),this.loaded=!0,setTimeout(function(){g.callback(g)},0)}},_getHtml:function(b){var c,d=b.stylesheets,e="",f=0;if(d="string"==typeof d?[d]:d)for(c=d.length;c>f;f++)e+='';return b.stylesheets=e,a.lang.string('#{stylesheets}').interpolate(b)},_unset:function(b,c,d,e){try{b[c]=d}catch(f){}try{b.__defineGetter__(c,function(){return d})}catch(f){}if(e)try{b.__defineSetter__(c,function(){})}catch(f){}if(!a.browser.crashesWhenDefineProperty(c))try{var g={get:function(){return d}};e&&(g.set=function(){}),Object.defineProperty(b,c,g)}catch(f){}}})}(a),function(a){var c=document;a.dom.ContentEditableArea=b.extend({getContentEditable:function(){return this.element},getWindow:function(){return this.element.ownerDocument.defaultView||this.element.ownerDocument.parentWindow},getDocument:function(){return this.element.ownerDocument},constructor:function(b,c,d){this.callback=b||a.EMPTY_FUNCTION,this.config=a.lang.object({}).merge(c).get(),this.config.className||(this.config.className="wysihtml5-sandbox"),d?this.element=this._bindElement(d):this.element=this._createElement()},destroy:function(){},_createElement:function(){var a=c.createElement("div");return a.className=this.config.className,this._loadElement(a),a},_bindElement:function(a){return a.className=a.className?a.className+" wysihtml5-sandbox":"wysihtml5-sandbox",this._loadElement(a,!0),a},_loadElement:function(a,b){var c=this;if(!b){var d=this._getHtml();a.innerHTML=d}this.loaded=!0,setTimeout(function(){c.callback(c)},0)},_getHtml:function(a){return""}})}(a),function(){var b={className:"class"};a.dom.setAttributes=function(a){return{on:function(c){for(var d in a)c.setAttribute(b[d]||d,a[d])}}}}(),a.dom.setStyles=function(a){return{on:function(b){var c=b.style;if("string"==typeof a)return void(c.cssText+=";"+a);for(var d in a)"float"===d?(c.cssFloat=a[d],c.styleFloat=a[d]):c[d]=a[d]}}},function(a){a.simulatePlaceholder=function(b,c,d,e){var f=e||"wysihtml5-placeholder",g=function(){var b=c.element.offsetWidth>0&&c.element.offsetHeight>0;c.hasPlaceholderSet()&&(c.clear(),c.element.focus(),b&&setTimeout(function(){var a=c.selection.getSelection();a.focusNode&&a.anchorNode||c.selection.selectNode(c.element.firstChild||c.element)},0)),c.placeholderSet=!1,a.removeClass(c.element,f)},h=function(){c.isEmpty()&&!c.placeholderSet&&(c.placeholderSet=!0,c.setValue(d,!1),a.addClass(c.element,f))};b.on("set_placeholder",h).on("unset_placeholder",g).on("focus:composer",g).on("paste:composer",g).on("blur:composer",h),h()}}(a.dom),function(a){var b=document.documentElement;"textContent"in b?(a.setTextContent=function(a,b){a.textContent=b},a.getTextContent=function(a){return a.textContent}):"innerText"in b?(a.setTextContent=function(a,b){a.innerText=b},a.getTextContent=function(a){return a.innerText}):(a.setTextContent=function(a,b){a.nodeValue=b},a.getTextContent=function(a){return a.nodeValue})}(a.dom),a.dom.getAttribute=function(b,c){var d=!a.browser.supportsGetAttributeCorrectly();c=c.toLowerCase();var e=b.nodeName;if("IMG"==e&&"src"==c&&a.dom.isLoadedImage(b)===!0)return b.src;if(d&&"outerHTML"in b){var f=b.outerHTML.toLowerCase(),g=-1!=f.indexOf(" "+c+"=");return g?b.getAttribute(c):null}return b.getAttribute(c)},a.dom.getAttributes=function(b){var c,d=!a.browser.supportsGetAttributeCorrectly(),e=b.nodeName,f=[];for(c in b.attributes)(b.attributes.hasOwnProperty&&b.attributes.hasOwnProperty(c)||!b.attributes.hasOwnProperty&&Object.prototype.hasOwnProperty.call(b.attributes,c))&&b.attributes[c].specified&&("IMG"==e&&"src"==b.attributes[c].name.toLowerCase()&&a.dom.isLoadedImage(b)===!0?f.src=b.src:a.lang.array(["rowspan","colspan"]).contains(b.attributes[c].name.toLowerCase())&&d?1!==b.attributes[c].value&&(f[b.attributes[c].name]=b.attributes[c].value):f[b.attributes[c].name]=b.attributes[c].value);return f},a.dom.isLoadedImage=function(a){try{return a.complete&&!a.mozMatchesSelector(":-moz-broken")}catch(b){if(a.complete&&"complete"===a.readyState)return!0}},function(a){function b(a,b){for(var c,d=[],e=0,f=a.length;f>e;e++)if(c=a[e].querySelectorAll(b))for(var g=c.length;g--;d.unshift(c[g]));return d}function d(a){a.parentNode.removeChild(a)}function e(a,b){a.parentNode.insertBefore(b,a.nextSibling)}function f(a,b){for(var c=a.nextSibling;1!=c.nodeType;)if(c=c.nextSibling,!b||b==c.tagName.toLowerCase())return c;return null}var g=a.dom,h=function(a){this.el=a,this.isColspan=!1,this.isRowspan=!1,this.firstCol=!0,this.lastCol=!0,this.firstRow=!0,this.lastRow=!0,this.isReal=!0,this.spanCollection=[],this.modified=!1},i=function(a,b){a?(this.cell=a,this.table=g.getParentElement(a,{query:"table"})):b&&(this.table=b,this.cell=this.table.querySelectorAll("th, td")[0])};i.prototype={addSpannedCellToMap:function(a,b,c,d,e,f){for(var g=[],i=c+(f?parseInt(f,10)-1:0),j=d+(e?parseInt(e,10)-1:0),k=c;i>=k;k++){"undefined"==typeof b[k]&&(b[k]=[]);for(var l=d;j>=l;l++)b[k][l]=new h(a),b[k][l].isColspan=e&&parseInt(e,10)>1,b[k][l].isRowspan=f&&parseInt(f,10)>1,b[k][l].firstCol=l==d,b[k][l].lastCol=l==j,b[k][l].firstRow=k==c,b[k][l].lastRow=k==i,b[k][l].isReal=l==d&&k==c,b[k][l].spanCollection=g,g.push(b[k][l])}},setCellAsModified:function(a){if(a.modified=!0,a.spanCollection.length>0)for(var b=0,c=a.spanCollection.length;c>b;b++)a.spanCollection[b].modified=!0},setTableMap:function(){var a,b,c,d,e,f,i,j,k=[],l=this.getTableRows();for(a=0;a0?a.lang.array(f).without(e):f;return g},getTableRows:function(){var c=this.table.querySelectorAll("table"),d=c?b(c,"tr"):[],e=this.table.querySelectorAll("tr"),f=d.length>0?a.lang.array(e).without(d):e;return f},getMapIndex:function(a){for(var b=this.map.length,c=this.map&&this.map[0]?this.map[0].length:0,d=0;b>d;d++)for(var e=0;c>e;e++)if(this.map[d][e].el===a)return{row:d,col:e};return!1},getElementAtIndex:function(a){return this.setTableMap(),this.map[a.row]&&this.map[a.row][a.col]&&this.map[a.row][a.col].el?this.map[a.row][a.col].el:null},getMapElsTo:function(a){var b=[];if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(a),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var c=this.idx_start;this.idx_start=this.idx_end,this.idx_end=c}if(this.idx_start.col>this.idx_end.col){var d=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=d}if(null!=this.idx_start&&null!=this.idx_end)for(var e=this.idx_start.row,f=this.idx_end.row;f>=e;e++)for(var g=this.idx_start.col,h=this.idx_end.col;h>=g;g++)b.push(this.map[e][g].el);return b},orderSelectionEnds:function(a){if(this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(a),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var b=this.idx_start;this.idx_start=this.idx_end,this.idx_end=b}if(this.idx_start.col>this.idx_end.col){var c=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=c}return{start:this.map[this.idx_start.row][this.idx_start.col].el,end:this.map[this.idx_end.row][this.idx_end.col].el}},createCells:function(a,b,c){for(var d,e=this.table.ownerDocument,f=e.createDocumentFragment(),g=0;b>g;g++){if(d=e.createElement(a),c)for(var h in c)c.hasOwnProperty(h)&&d.setAttribute(h,c[h]);d.appendChild(document.createTextNode(" ")),f.appendChild(d)}return f},correctColIndexForUnreals:function(a,b){for(var c=this.map[b],d=-1,e=0;a>e;e++)c[e].isReal&&d++;return d},getLastNewCellOnRow:function(a,b){for(var c,d,e=this.getRowCells(a),f=0,g=e.length;g>f;f++)if(c=e[f],d=this.getMapIndex(c),d===!1||"undefined"!=typeof b&&d.row!=b)return c;return null},removeEmptyTable:function(){var a=this.table.querySelectorAll("td, th");return a&&0!=a.length?!1:(d(this.table),!0)},splitRowToCells:function(a){if(a.isColspan){var b=parseInt(g.getAttribute(a.el,"colspan")||1,10),c=a.el.tagName.toLowerCase();if(b>1){var d=this.createCells(c,b-1);e(a.el,d)}a.el.removeAttribute("colspan")}},getRealRowEl:function(a,b){var c=null,d=null;b=b||this.idx;for(var e=0,f=this.map[b.row].length;f>e;e++)if(d=this.map[b.row][e],d.isReal&&(c=g.getParentElement(d.el,{query:"tr"})))return c;return null===c&&a&&(c=g.getParentElement(this.map[b.row][b.col].el,{query:"tr"})||null),c},injectRowAt:function(a,b,c,d,f){var h=this.getRealRowEl(!1,{row:a,col:b}),i=this.createCells(d,c);if(h){var j=this.correctColIndexForUnreals(b,a);j>=0?e(this.getRowCells(h)[j],i):h.insertBefore(i,h.firstChild)}else{var k=this.table.ownerDocument.createElement("tr");k.appendChild(i),e(g.getParentElement(f.el,{query:"tr"}),k)}},canMerge:function(a){if(this.to=a,this.setTableMap(),this.idx_start=this.getMapIndex(this.cell),this.idx_end=this.getMapIndex(this.to),this.idx_start.row>this.idx_end.row||this.idx_start.row==this.idx_end.row&&this.idx_start.col>this.idx_end.col){var b=this.idx_start;this.idx_start=this.idx_end,this.idx_end=b}if(this.idx_start.col>this.idx_end.col){var c=this.idx_start.col;this.idx_start.col=this.idx_end.col,this.idx_end.col=c}for(var d=this.idx_start.row,e=this.idx_end.row;e>=d;d++)for(var f=this.idx_start.col,g=this.idx_end.col;g>=f;f++)if(this.map[d][f].isColspan||this.map[d][f].isRowspan)return!1;return!0},decreaseCellSpan:function(a,b){var c=parseInt(g.getAttribute(a.el,b),10)-1;c>=1?a.el.setAttribute(b,c):(a.el.removeAttribute(b),"colspan"==b&&(a.isColspan=!1),"rowspan"==b&&(a.isRowspan=!1),a.firstCol=!0,a.lastCol=!0,a.firstRow=!0,a.lastRow=!0,a.isReal=!0)},removeSurplusLines:function(){var a,b,c,e,f,h,i;if(this.setTableMap(),this.map){for(c=0,e=this.map.length;e>c;c++){for(a=this.map[c],i=!0,f=0,h=a.length;h>f;f++)if(b=a[f],!(g.getAttribute(b.el,"rowspan")&&parseInt(g.getAttribute(b.el,"rowspan"),10)>1&&b.firstRow!==!0)){i=!1;break}if(i)for(f=0;h>f;f++)this.decreaseCellSpan(a[f],"rowspan")}var j=this.getTableRows();for(c=0,e=j.length;e>c;c++)a=j[c],0==a.childNodes.length&&/^\s*$/.test(a.textContent||a.innerText)&&d(a)}},fillMissingCells:function(){var a=0,b=0,c=null;if(this.setTableMap(),this.map){a=this.map.length;for(var d=0;a>d;d++)this.map[d].length>b&&(b=this.map[d].length);for(var f=0;a>f;f++)for(var g=0;b>g;g++)this.map[f]&&!this.map[f][g]&&g>0&&(this.map[f][g]=new h(this.createCells("td",1)),c=this.map[f][g-1],c&&c.el&&c.el.parent&&e(this.map[f][g-1].el,this.map[f][g].el))}},rectify:function(){return this.removeEmptyTable()?!1:(this.removeSurplusLines(),this.fillMissingCells(),!0)},unmerge:function(){if(this.rectify()&&(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx)){var a=this.map[this.idx.row][this.idx.col],b=g.getAttribute(a.el,"colspan")?parseInt(g.getAttribute(a.el,"colspan"),10):1,c=a.el.tagName.toLowerCase();if(a.isRowspan){var d=parseInt(g.getAttribute(a.el,"rowspan"),10);if(d>1)for(var e=1,f=d-1;f>=e;e++)this.injectRowAt(this.idx.row+e,this.idx.col,b,c,a);a.el.removeAttribute("rowspan")}this.splitRowToCells(a)}},merge:function(a){if(this.rectify())if(this.canMerge(a)){for(var b=this.idx_end.row-this.idx_start.row+1,c=this.idx_end.col-this.idx_start.col+1,e=this.idx_start.row,f=this.idx_end.row;f>=e;e++)for(var g=this.idx_start.col,h=this.idx_end.col;h>=g;g++)e==this.idx_start.row&&g==this.idx_start.col?(b>1&&this.map[e][g].el.setAttribute("rowspan",b),c>1&&this.map[e][g].el.setAttribute("colspan",c)):(/^\s*\s*$/.test(this.map[e][g].el.innerHTML.toLowerCase())||(this.map[this.idx_start.row][this.idx_start.col].el.innerHTML+=" "+this.map[e][g].el.innerHTML),d(this.map[e][g].el));this.rectify()}else window.console&&console.log("Do not know how to merge allready merged cells.")},collapseCellToNextRow:function(a){var b=this.getMapIndex(a.el),c=b.row+1,d={row:c,col:b.col};if(c=0)e(this.getRowCells(f)[h],a.el);else{var i=this.getLastNewCellOnRow(f,c);null!==i?e(i,a.el):f.insertBefore(a.el,f.firstChild)}parseInt(g.getAttribute(a.el,"rowspan"),10)>2?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)-1):a.el.removeAttribute("rowspan")}}},removeRowCell:function(a){a.isReal?a.isRowspan?this.collapseCellToNextRow(a):d(a.el):parseInt(g.getAttribute(a.el,"rowspan"),10)>2?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)-1):a.el.removeAttribute("rowspan")},getRowElementsByCell:function(){var a=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=this.map[this.idx.row],c=0,d=b.length;d>c;c++)b[c].isReal&&a.push(b[c].el);return a},getColumnElementsByCell:function(){var a=[];if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=0,c=this.map.length;c>b;b++)this.map[b][this.idx.col]&&this.map[b][this.idx.col].isReal&&a.push(this.map[b][this.idx.col].el);return a},removeRow:function(){var a=g.getParentElement(this.cell,{query:"tr"});if(a){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var b=this.map[this.idx.row],c=0,e=b.length;e>c;c++)b[c].modified||(this.setCellAsModified(b[c]),this.removeRowCell(b[c]));d(a)}},removeColCell:function(a){a.isColspan?parseInt(g.getAttribute(a.el,"colspan"),10)>2?a.el.setAttribute("colspan",parseInt(g.getAttribute(a.el,"colspan"),10)-1):a.el.removeAttribute("colspan"):a.isReal&&d(a.el)},removeColumn:function(){if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),this.idx!==!1)for(var a=0,b=this.map.length;b>a;a++)this.map[a][this.idx.col].modified||(this.setCellAsModified(this.map[a][this.idx.col]),this.removeColCell(this.map[a][this.idx.col]))},remove:function(a){if(this.rectify()){switch(a){case"row":this.removeRow();break;case"column":this.removeColumn()}this.rectify()}},addRow:function(a){var b=this.table.ownerDocument;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"below"==a&&g.getAttribute(this.cell,"rowspan")&&(this.idx.row=this.idx.row+parseInt(g.getAttribute(this.cell,"rowspan"),10)-1),this.idx!==!1){for(var c=this.map[this.idx.row],d=b.createElement("tr"),f=0,h=c.length;h>f;f++)c[f].modified||(this.setCellAsModified(c[f]),this.addRowCell(c[f],d,a));switch(a){case"below":e(this.getRealRowEl(!0),d);break;case"above":var i=g.getParentElement(this.map[this.idx.row][this.idx.col].el,{query:"tr"});i&&i.parentNode.insertBefore(d,i)}}},addRowCell:function(a,b,d){var e=a.isColspan?{colspan:g.getAttribute(a.el,"colspan")}:null;a.isReal?"above"!=d&&a.isRowspan?a.el.setAttribute("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)+1):b.appendChild(this.createCells("td",1,e)):"above"!=d&&a.isRowspan&&a.lastRow?b.appendChild(this.createCells("td",1,e)):c.isRowspan&&a.el.attr("rowspan",parseInt(g.getAttribute(a.el,"rowspan"),10)+1)},add:function(a){this.rectify()&&(("below"==a||"above"==a)&&this.addRow(a),("before"==a||"after"==a)&&this.addColumn(a))},addColCell:function(a,b,c){var d,f=a.el.tagName.toLowerCase();switch(c){case"before":d=!a.isColspan||a.firstCol;break;case"after":d=!a.isColspan||a.lastCol||a.isColspan&&a.el==this.cell}if(d){switch(c){case"before":a.el.parentNode.insertBefore(this.createCells(f,1),a.el);break;case"after":e(a.el,this.createCells(f,1))}a.isRowspan&&this.handleCellAddWithRowspan(a,b+1,c)}else a.el.setAttribute("colspan",parseInt(g.getAttribute(a.el,"colspan"),10)+1)},addColumn:function(a){var b,c;if(this.setTableMap(),this.idx=this.getMapIndex(this.cell),"after"==a&&g.getAttribute(this.cell,"colspan")&&(this.idx.col=this.idx.col+parseInt(g.getAttribute(this.cell,"colspan"),10)-1),this.idx!==!1)for(var d=0,e=this.map.length;e>d;d++)b=this.map[d],b[this.idx.col]&&(c=b[this.idx.col],c.modified||(this.setCellAsModified(c),this.addColCell(c,d,a)))},handleCellAddWithRowspan:function(a,b,c){for(var d,h,i,j=parseInt(g.getAttribute(this.cell,"rowspan"),10)-1,k=g.getParentElement(a.el,{ +query:"tr"}),l=a.el.tagName.toLowerCase(),m=this.table.ownerDocument,n=0;j>n;n++)if(d=this.correctColIndexForUnreals(this.idx.col,b+n),k=f(k,"tr"))if(d>0)switch(c){case"before":h=this.getRowCells(k),d>0&&this.map[b+n][this.idx.col].el!=h[d]&&d==h.length-1?e(h[d],this.createCells(l,1)):h[d].parentNode.insertBefore(this.createCells(l,1),h[d]);break;case"after":e(this.getRowCells(k)[d],this.createCells(l,1))}else k.insertBefore(this.createCells(l,1),k.firstChild);else i=m.createElement("tr"),i.appendChild(this.createCells(l,1)),this.table.appendChild(i)}},g.table={getCellsBetween:function(a,b){var c=new i(a);return c.getMapElsTo(b)},addCells:function(a,b){var c=new i(a);c.add(b)},removeCells:function(a,b){var c=new i(a);c.remove(b)},mergeCellsBetween:function(a,b){var c=new i(a);c.merge(b)},unmergeCell:function(a){var b=new i(a);b.unmerge()},orderSelectionEnds:function(a,b){var c=new i(a);return c.orderSelectionEnds(b)},indexOf:function(a){var b=new i(a);return b.setTableMap(),b.getMapIndex(a)},findCell:function(a,b){var c=new i(null,a);return c.getElementAtIndex(b)},findRowByCell:function(a){var b=new i(a);return b.getRowElementsByCell()},findColumnByCell:function(a){var b=new i(a);return b.getColumnElementsByCell()},canMerge:function(a,b){var c=new i(a);return c.canMerge(b)}}}(a),a.dom.query=function(a,b){var c,d=[];a.nodeType&&(a=[a]);for(var e=0,f=a.length;f>e;e++)if(c=a[e].querySelectorAll(b))for(var g=c.length;g--;d.unshift(c[g]));return d},a.dom.compareDocumentPosition=function(){var b=document.documentElement;return b.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)}:function(b,c){var d,e;if(d=9===b.nodeType?b:b.ownerDocument,e=9===c.nodeType?c:c.ownerDocument,b===c)return 0;if(b===c.ownerDocument)return 20;if(b.ownerDocument===c)return 10;if(d!==e)return 1;if(2===b.nodeType&&b.childNodes&&-1!==a.lang.array(b.childNodes).indexOf(c))return 20;if(2===c.nodeType&&c.childNodes&&-1!==a.lang.array(c.childNodes).indexOf(b))return 10;for(var f=b,g=[],h=null;f;){if(f==c)return 10;g.push(f),f=f.parentNode}for(f=c,h=null;f;){if(f==b)return 20;var i=a.lang.array(g).indexOf(f);if(-1!==i){var j=g[i],k=a.lang.array(j.childNodes).indexOf(g[i-1]),l=a.lang.array(j.childNodes).indexOf(h);return k>l?2:4}h=f,f=f.parentNode}return 1}}(),a.dom.unwrap=function(b){var c=[];if(b.parentNode){for(;b.lastChild;)c.unshift(b.lastChild),a.dom.insert(b.lastChild).after(b);b.parentNode.removeChild(b)}return c},a.dom.getPastedHtml=function(b){var c;return a.browser.supportsModernPaste()&&b.clipboardData&&(a.lang.array(b.clipboardData.types).contains("text/html")?c=b.clipboardData.getData("text/html"):a.lang.array(b.clipboardData.types).contains("text/plain")&&(c=a.lang.string(b.clipboardData.getData("text/plain")).escapeHTML(!0,!0))),c},a.dom.getPastedHtmlWithDiv=function(a,b){var c=a.selection.getBookmark(),d=a.element.ownerDocument,e=d.createElement("DIV"),f=a.getScrollPos();d.body.appendChild(e),e.style.width="1px",e.style.height="1px",e.style.overflow="hidden",e.style.position="absolute",e.style.top=f.y+"px",e.style.left=f.x+"px",e.setAttribute("contenteditable","true"),e.focus(),setTimeout(function(){var d;a.selection.setBookmark(c),d=e.innerHTML,d&&/^$/i.test(d.trim())&&(d=!1),b(d),e.parentNode.removeChild(e)},0)},a.dom.removeInvisibleSpaces=function(b){for(var c=a.dom.getTextNodes(b),d=c.length;d--;)c[d].nodeValue=c[d].nodeValue.replace(a.INVISIBLE_SPACE_REG_EXP,"")},a.quirks.cleanPastedHTML=function(){var b=function(b){var c=a.lang.string(b).trim(),d=c.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");return new RegExp("^((?!^"+d+"$).)*$","i")},c=function(c,d){var e,f,g=a.lang.object(c).clone(!0);for(e in g.tags)if(g.tags.hasOwnProperty(e)&&g.tags[e].keep_styles)for(f in g.tags[e].keep_styles)g.tags[e].keep_styles.hasOwnProperty(f)&&d[f]&&(g.tags[e].keep_styles[f]=b(d[f]));return g},d=function(a,b){var c;if(!a)return null;for(var d=0,e=a.length;e>d;d++)if(a[d].condition||(c=a[d].set),a[d].condition&&a[d].condition.test(b))return a[d].set;return c};return function(b,e){var f,g={color:a.dom.getStyle("color").from(e.referenceNode),fontSize:a.dom.getStyle("font-size").from(e.referenceNode)},h=c(d(e.rules,b)||{},g);return f=a.dom.parse(b,{rules:h,cleanUp:!0,context:e.referenceNode.ownerDocument,uneditableClass:e.uneditableClass,clearInternals:!0,unjoinNbsps:!0})}}(),a.quirks.ensureProperClearing=function(){var b=function(){var a=this;setTimeout(function(){var b=a.innerHTML.toLowerCase();("

     

    "==b||"

     

     

    "==b)&&(a.innerHTML="")},0)};return function(c){a.dom.observe(c.element,["cut","keydown"],b)}}(),function(a){var b="%7E";a.quirks.getCorrectInnerHTML=function(c){var d=c.innerHTML;if(-1===d.indexOf(b))return d;var e,f,g,h,i=c.querySelectorAll("[href*='~'], [src*='~']");for(h=0,g=i.length;g>h;h++)e=i[h].href||i[h].src,f=a.lang.string(e).replace("~").by(b),d=a.lang.string(d).replace(f).by(e);return d}}(a),function(a){var b="wysihtml5-quirks-redraw";a.quirks.redraw=function(c){a.dom.addClass(c,b),a.dom.removeClass(c,b);try{var d=c.ownerDocument;d.execCommand("italic",!1,null),d.execCommand("italic",!1,null)}catch(e){}}}(a),a.quirks.tableCellsSelection=function(b,c){function d(){return b.addEventListener("mousedown",o),m}function e(a){m.start=a,m.end=a,m.cells=[a],m.table=l.getParentElement(m.start,{query:"table"},!1,b),m.table&&(f(),l.addClass(a,n),b.addEventListener("mousemove",h),b.addEventListener("mouseup",i),c.fire("tableselectstart").fire("tableselectstart:composer"))}function f(){if(b){var a=b.querySelectorAll("."+n);if(a.length>0)for(var c=0;c1&&c.composer.selection.deselect(),g(m.cells),m.end!==d&&c.fire("tableselectchange").fire("tableselectchange:composer")))}function i(a){b.removeEventListener("mousemove",h),b.removeEventListener("mouseup",i),c.fire("tableselect").fire("tableselect:composer"),setTimeout(function(){j()},0)}function j(){b.ownerDocument.addEventListener("click",p)}function k(a,d){m.start=a,m.end=d,m.table=l.getParentElement(m.start,{query:"table"},!1,b),selectedCells=l.table.getCellsBetween(m.start,m.end),g(selectedCells),j(),c.fire("tableselect").fire("tableselect:composer")}var l=a.dom,m={table:null,start:null,end:null,cells:null,select:k},n="wysiwyg-tmp-selected-cell",o=function(c){var d=a.dom.getParentElement(c.target,{query:"td, th"},!1,b);d&&e(d)},p=function(a){b.ownerDocument.removeEventListener("click",p),l.getParentElement(a.target,{query:"table"},!1,b)!=m.table&&(f(),m.table=null,m.start=null,m.end=null,c.fire("tableunselect").fire("tableunselect:composer"))};return d()},function(a){function b(a){var b,c;for(b in d)if(d.hasOwnProperty(b)&&(c=d[b],c.regex.test(a)))return c}function c(a){var c=b(a);return c?c.name:void 0}var d={rgba:{regex:/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]+)\s*\)/i,name:"rgba"},rgb:{regex:/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i,name:"rgb"},hex6:{regex:/^#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])/i,name:"hex",radix:16},hex3:{regex:/^#([0-9a-f])([0-9a-f])([0-9a-f])/i,name:"hex",radix:16}},e=function(a){return new RegExp("(^|\\s|;)"+a+"\\s*:\\s*[^;$]+","gi")};a.quirks.styleParser={getColorParseMethod:b,getColorFormat:c,parseColor:function(c,f){var g,h,i,j,k,l=c;if(f){if(g=e(f),!(h=c.match(g)))return!1;h=h.pop().split(":")[1],l=a.lang.string(h).trim()}return(i=b(l))&&(j=l.match(i.regex))?(k=i.radix||10,i===d.hex3?(j.shift(),j.push(1),a.lang.array(j).map(function(a,b){return 3>b?parseInt(a,k)*k+parseInt(a,k):parseFloat(a)})):(j.shift(),j[3]||j.push(1),a.lang.array(j).map(function(a,b){return 3>b?parseInt(a,k):parseFloat(a)}))):!1},unparseColor:function(a,b){var c=16;return"hex"===b?(a[0].toString(c)+a[1].toString(c)+a[2].toString(c)).toUpperCase():"hash"===b?"#"+(a[0].toString(c)+a[1].toString(c)+a[2].toString(c)).toUpperCase():"rgb"===b?"rgb("+a[0]+","+a[1]+","+a[2]+")":"rgba"===b?"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")":"csv"===b?a[0]+","+a[1]+","+a[2]+","+a[3]:a[3]&&1!==a[3]?"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")":"rgb("+a[0]+","+a[1]+","+a[2]+")"},parseFontSize:function(b){var c=b.match(e("font-size"));return c?a.lang.string(c[c.length-1].split(":")[1]).trim():!1}}}(a),function(a){function c(a){var b=0;if(a.parentNode)do b+=a.offsetTop||0,a=a.offsetParent;while(a);return b}function d(a,b){for(var c=0;b!==a;)if(c++,b=b.parentNode,!b)throw new Error("not a descendant of ancestor!");return c}function e(a,b){return 3===a.nodeType?a:a.childNodes[b]||a}function f(b){var c=document.createElement("span"),d=function(a){b.removeEventListener("mouseup",d),b.removeEventListener("keydown",d),b.removeEventListener("touchstart",d),b.removeEventListener("focus",d),b.removeEventListener("blur",d),b.removeEventListener("paste",e),b.removeEventListener("drop",e),b.removeEventListener("beforepaste",e),c&&c.parentNode&&c.parentNode.removeChild(c)},e=function(a){c&&c.parentNode&&setTimeout(d,0)};return c.appendChild(b.ownerDocument.createTextNode(a.INVISIBLE_SPACE)),c.className="_wysihtml5-temp-caret-fix",c.style.display="block",c.style.minWidth="1px",c.style.height="0px",b.addEventListener("mouseup",d),b.addEventListener("keydown",d),b.addEventListener("touchstart",d),b.addEventListener("focus",d),b.addEventListener("blur",d),b.addEventListener("paste",e),b.addEventListener("drop",e),b.addEventListener("beforepaste",e),c}function g(a){if(!a.canSurroundContents())for(var b=a.commonAncestorContainer,c=d(b,a.startContainer),e=d(b,a.endContainer);!a.canSurroundContents();)c>e?(a.setStartBefore(a.startContainer),c=d(b,a.startContainer)):(a.setEndAfter(a.endContainer),e=d(b,a.endContainer))}var h=a.dom;a.Selection=b.extend({constructor:function(a,b,c){rangy.init(),this.editor=a,this.composer=a.composer,this.doc=this.composer.doc,this.win=this.composer.win,this.contain=b,this.unselectableClass=c||!1},getBookmark:function(){var a=this.getRange();return a&&a.cloneRange()},setBookmark:function(a){a&&this.setSelection(a)},setBefore:function(a){var b=rangy.createRange(this.doc);return b.setStartBefore(a),b.setEndBefore(a),this.setSelection(b)},createTemporaryCaretSpaceAfter:function(b){var c=this.doc.createElement("span"),d=this.doc.createTextNode(a.INVISIBLE_SPACE),e=function(b){var d;this.contain.removeEventListener("mouseup",e),this.contain.removeEventListener("keydown",g),this.contain.removeEventListener("touchstart",e),this.contain.removeEventListener("focus",e),this.contain.removeEventListener("blur",e),this.contain.removeEventListener("paste",f),this.contain.removeEventListener("drop",f),this.contain.removeEventListener("beforepaste",f),c&&c.parentNode&&(c.innerHTML=c.innerHTML.replace(a.INVISIBLE_SPACE_REG_EXP,""),/[^\s]+/.test(c.innerHTML)?(d=c.lastChild,a.dom.unwrap(c),this.setAfter(d)):c.parentNode.removeChild(c))}.bind(this),f=function(a){c&&c.parentNode&&setTimeout(e,0)},g=function(a){8===a.which||91===a.which||17===a.which||86===a.which&&(a.ctrlKey||a.metaKey)||e()};return c.className="_wysihtml5-temp-caret-fix",c.style.position="absolute",c.style.display="block",c.style.minWidth="1px",c.style.zIndex="99999",c.appendChild(d),b.parentNode.insertBefore(c,b.nextSibling),this.setBefore(d),this.contain.addEventListener("mouseup",e),this.contain.addEventListener("keydown",g),this.contain.addEventListener("touchstart",e),this.contain.addEventListener("focus",e),this.contain.addEventListener("blur",e),this.contain.addEventListener("paste",f),this.contain.addEventListener("drop",f),this.contain.addEventListener("beforepaste",f),c},setAfter:function(b,c,d){var e,f=this.win,g=rangy.createRange(this.doc),h=function(){var d=b.parentNode,g=d?d.childNodes[d.childNodes.length-1]:null;if(!e||g===b&&1===b.nodeType&&"block"===f.getComputedStyle(b).display)if(c){var h=this.doc.createTextNode(a.INVISIBLE_SPACE);b.parentNode.insertBefore(h,b.nextSibling),this.selectNode(h),setTimeout(function(){h&&h.parentNode&&h.parentNode.removeChild(h)},0)}else this.createTemporaryCaretSpaceAfter(b)}.bind(this);if(g.setStartAfter(b),g.setEndAfter(b),document.activeElement&&document.activeElement===this.composer.element)e=this.setSelection(g),h(),d&&d(e);else{var i=this.composer.getScrollPos();this.composer.element.focus(),this.composer.setScrollPos(i),setTimeout(function(){e=this.setSelection(g),h(),d&&d(e)}.bind(this),0)}},selectNode:function(b,c){var d=rangy.createRange(this.doc),e=b.nodeType===a.ELEMENT_NODE,f="canHaveHTML"in b?b.canHaveHTML:"IMG"!==b.nodeName,g=e?b.innerHTML:b.data,i=""===g||g===a.INVISIBLE_SPACE,j=h.getStyle("display").from(b),k="block"===j||"list-item"===j;if(i&&e&&f&&!c)try{b.innerHTML=a.INVISIBLE_SPACE}catch(l){}f?d.selectNodeContents(b):d.selectNode(b),f&&i&&e?d.collapse(k):f&&i&&(d.setStartAfter(b),d.setEndAfter(b)),this.setSelection(d)},getSelectedNode:function(a){var b,c;return a&&this.doc.selection&&"Control"===this.doc.selection.type&&(c=this.doc.selection.createRange(),c&&c.length)?c.item(0):(b=this.getSelection(this.doc),b.focusNode===b.anchorNode?b.focusNode:(c=this.getRange(this.doc),c?c.commonAncestorContainer:this.doc.body))},fixSelBorders:function(){var a=this.getRange();g(a),this.setSelection(a)},getSelectedOwnNodes:function(a){for(var b=this.getOwnRanges(),c=[],d=0,e=b.length;e>d;d++)c.push(b[d].commonAncestorContainer||this.doc.body);return c},findNodesInSelection:function(b){for(var c,d=this.getOwnRanges(),e=[],f=0,g=d.length;g>f;f++)c=d[f].getNodes([1],function(c){return a.lang.array(b).contains(c.nodeName)}),e=e.concat(c);return e},filterElements:function(a){for(var b,c=this.getOwnRanges(),d=[],e=0,f=c.length;f>e;e++)b=c[e].getNodes([1],function(b){return a(b,c[e])}),d=d.concat(b);return d},containsUneditable:function(){for(var a=this.getOwnUneditables(),b=this.getSelection(),c=0,d=a.length;d>c;c++)if(b.containsNode(a[c]))return!0;return!1},deleteContents:function(){var a=this.getRange();this.deleteRangeContents(a),this.setSelection(a)},deleteRangeContents:function(b){var c,d,e,f;if(this.unselectableClass){(c=a.dom.getParentElement(b.startContainer,{query:"."+this.unselectableClass},!1,this.contain))&&b.setStartBefore(c),(d=a.dom.getParentElement(b.endContainer,{query:"."+this.unselectableClass},!1,this.contain))&&b.setEndAfter(d),e=b.getNodes([1],function(b){return a.dom.hasClass(b,this.unselectableClass)}.bind(this));for(var g=e.length;g--;)try{f=new CustomEvent("wysihtml5:uneditable:delete"),e[g].dispatchEvent(f)}catch(h){}}b.deleteContents()},getCaretNode:function(){var a=this.getSelection();return a&&a.anchorNode?e(a.anchorNode,a.anchorOffset):null},getPreviousNode:function(b,c){var d;if(!b){var f=this.getSelection();b=f&&f.anchorNode?e(f.anchorNode,f.anchorOffset):null}if(b===this.contain)return!1;var g,h=b.previousSibling;return h===this.contain?!1:(h&&3!==h.nodeType&&1!==h.nodeType?h=this.getPreviousNode(h,c):h&&3===h.nodeType&&/^\s*$/.test(h.textContent)?h=this.getPreviousNode(h,c):c&&h&&1===h.nodeType?(d=a.dom.getStyle("display").from(h),a.lang.array(["BR","HR","IMG"]).contains(h.nodeName)||a.lang.array(["block","inline-block","flex","list-item","table"]).contains(d)||!/^[\s]*$/.test(h.innerHTML)||(h=this.getPreviousNode(h,c))):h||b===this.contain||(g=b.parentNode,g!==this.contain&&(h=this.getPreviousNode(g,c))),h!==this.contain?h:!1)},getNodesNearCaret:function(){if(!this.isCollapsed())throw"Selection must be caret when using selection.getNodesNearCaret()";var a,b,c,d,e=this.getOwnRanges();return e&&e.length>0?(1===e[0].startContainer.nodeType?(a=e[0].startContainer.childNodes[e[0].startOffset-1],a||0!==e[0].startOffset?a&&(b=a.previousSibling,c=a.nextSibling):c=e[0].startContainer.childNodes[0]):(0===e[0].startOffset&&e[0].startContainer.previousSibling?(a=e[0].startContainer.previousSibling,3===a.nodeType&&(d=a.data.length)):(a=e[0].startContainer,d=e[0].startOffset),b=a.previousSibling,c=a.nextSibling),{caretNode:a,prevNode:b,nextNode:c,textOffset:d}):null},getSelectionParentsByTag:function(b){for(var c,d=this.getSelectedOwnNodes(),e=[],f=0,g=d.length;g>f;f++)c=d[f].nodeName&&"LI"===d[f].nodeName?d[f]:a.dom.getParentElement(d[f],{query:"li"},!1,this.contain),c&&e.push(c);return e.length?e:null},getRangeToNodeEnd:function(){if(this.isCollapsed()){var a=this.getRange(),b=a.startContainer,c=a.startOffset,d=rangy.createRange(this.doc);return d.selectNodeContents(b),d.setStart(b,c),d}},caretIsLastInSelection:function(){var a=(rangy.createRange(this.doc),this.getSelection(),this.getRangeToNodeEnd().cloneContents()),b=a.textContent;return/^\s*$/.test(b)},caretIsFirstInSelection:function(b){var c=rangy.createRange(this.doc),d=this.getSelection(),f=this.getRange(),g=e(f.startContainer,f.startOffset);if(g){if(g.nodeType===a.TEXT_NODE){if(!g.parentNode)return!1;if(!this.isCollapsed()||g.parentNode.firstChild!==g&&!a.dom.domNode(g.previousSibling).is.block())return!1;var h=this.win.getComputedStyle(g.parentNode).whiteSpace;return"pre"===h||"pre-wrap"===h?0===f.startOffset:/^\s*$/.test(g.data.substr(0,f.startOffset))}return b&&a.dom.domNode(g).is.lineBreak()?!0:(c.selectNodeContents(this.getRange().commonAncestorContainer),c.collapse(!0),this.isCollapsed()&&(c.startContainer===d.anchorNode||c.endContainer===d.anchorNode)&&c.startOffset===d.anchorOffset)}},caretIsInTheBeginnig:function(b){var c=this.getSelection(),d=c.anchorNode,e=c.anchorOffset;return b&&d?0===e&&(d.nodeName&&d.nodeName===b.toUpperCase()||a.dom.getParentElement(d.parentNode,{query:b},1)):d?0===e&&!this.getPreviousNode(d,!0):void 0},getBeforeSelection:function(b){var c,d,e=this.getSelection(),f=e.isBackwards()?e.focusNode:e.anchorNode,g=e.isBackwards()?e.focusOffset:e.anchorOffset,h=this.createRange();if(f&&3===f.nodeType&&/^\s*$/.test(f.data.slice(0,g))&&(g=0),d=a.dom.getParentElement(f,{query:"._wysihtml5-temp-caret-fix"},1),d&&(f=d.parentNode,g=Array.prototype.indexOf.call(f.childNodes,d)),f){if(g>0)return 3===f.nodeType?(h.setStart(f,0),h.setEnd(f,g),{type:"text",range:h,offset:g,node:f}):(h.setStartBefore(f.childNodes[0]),c=f.childNodes[g-1],h.setEndAfter(c),{type:"element",range:h,offset:g,node:c});if(h.setStartAndEnd(f,0),b){var i=this.getPreviousNode(f,!0),j=null;if(i&&(j=1===i.nodeType&&a.dom.hasClass(i,this.unselectableClass)?i:a.dom.domNode(i).lastLeafNode()),j)return{type:"leafnode",range:h,offset:g,node:j}}return{type:"none",range:h,offset:g,node:f}}return null},executeAndRestoreRangy:function(a,b){var c=rangy.saveSelection(this.win);if(c)try{a()}catch(d){setTimeout(function(){throw d},0)}else a();rangy.restoreSelection(c)},executeAndRestore:function(b,c){var d,e,f,g,i,j,k,l,m=this.doc.body,n=c&&m.scrollTop,o=c&&m.scrollLeft,p="_wysihtml5-temp-placeholder",q=''+a.INVISIBLE_SPACE+"",r=this.getRange(!0);if(!r)return void b(m,m);r.collapsed||(k=r.cloneRange(),j=k.createContextualFragment(q),k.collapse(!1),k.insertNode(j),k.detach()),i=r.createContextualFragment(q),r.insertNode(i),j&&(d=this.contain.querySelectorAll("."+p),r.setStartBefore(d[0]),r.setEndAfter(d[d.length-1])),this.setSelection(r);try{b(r.startContainer,r.endContainer)}catch(s){setTimeout(function(){throw s},0)}if(d=this.contain.querySelectorAll("."+p),d&&d.length){l=rangy.createRange(this.doc),f=d[0].nextSibling,d.length>1&&(g=d[d.length-1].previousSibling),g&&f?(l.setStartBefore(f),l.setEndAfter(g)):(e=this.doc.createTextNode(a.INVISIBLE_SPACE),h.insert(e).after(d[0]),l.setStartBefore(e),l.setEndAfter(e)),this.setSelection(l);for(var t=d.length;t--;)d[t].parentNode.removeChild(d[t])}else this.contain.focus();c&&(m.scrollTop=n,m.scrollLeft=o);try{d.parentNode.removeChild(d)}catch(u){}},set:function(a,b){var c=rangy.createRange(this.doc);c.setStart(a,b||0),this.setSelection(c)},insertHTML:function(a){var b,c,d=this.getRange(),e=this.doc.createElement("DIV"),f=this.doc.createDocumentFragment();if(d){for(d.deleteContents(),e.innerHTML=a,b=e.lastChild;e.firstChild;)f.appendChild(e.firstChild);for(d.insertNode(f),c=this.contain.lastChild;c&&3===c.nodeType&&c.previousSibling&&/^\s*$/.test(c.data);)c=c.previousSibling;b&&(c&&b===c&&1===b.nodeType&&this.contain.appendChild(this.doc.createElement("br")),this.setAfter(b))}},insertNode:function(a){var b=this.getRange();b&&b.insertNode(a)},canAppendChild:function(a){var b,c,d=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],e=this.getRange();return b=a||e.startContainer,b&&(c=(b.tagName||b.nodeName).toLowerCase()),-1===d.indexOf(c)},splitElementAtCaret:function(b,c){var d,e,f,g,h,i=this.getSelection();if(i.rangeCount>0){d=i.getRangeAt(0).cloneRange(),d.setEndAfter(b),e=d.extractContents(),h=e.childNodes;for(var j=h.length;j--;)a.dom.domNode(h[j]).is.visible()||e.removeChild(h[j]);b.parentNode.insertBefore(e,b.nextSibling),c?(f=c.firstChild||c,g=c.lastChild||c,b.parentNode.insertBefore(c,b.nextSibling),f&&g&&(d.setStartBefore(f),d.setEndAfter(g),this.setSelection(d))):(d.setStartAfter(b),d.setEndAfter(b)),a.dom.domNode(b).is.visible()||(""===a.dom.getTextContent(b)?b.parentNode.removeChild(b):b.parentNode.replaceChild(this.doc.createTextNode(" "),b))}},surround:function(a){var b,c=this.getOwnRanges(),d=[];if(0==c.length)return d;for(var e=c.length;e--;){b=this.doc.createElement(a.nodeName),d.push(b),a.className&&(b.className=a.className),a.cssStyle&&b.setAttribute("style",a.cssStyle);try{c[e].surroundContents(b),this.selectNode(b)}catch(f){b.appendChild(c[e].extractContents()),c[e].insertNode(b)}}return d},scrollIntoView:function(){var b,d=this.doc,e=5,f=d.documentElement.scrollHeight>d.documentElement.offsetHeight,g=d._wysihtml5ScrollIntoViewElement=d._wysihtml5ScrollIntoViewElement||function(){var b=d.createElement("span");return b.innerHTML=a.INVISIBLE_SPACE,b}();f&&(this.insertNode(g),b=c(g),g.parentNode.removeChild(g),b>=d.body.scrollTop+d.documentElement.offsetHeight-e&&(d.body.scrollTop=b))},selectLine:function(){var b=rangy.createRange();a.browser.supportsSelectionModify()?this._selectLine_W3C():b.nativeRange&&b.nativeRange.getBoundingClientRect&&this._selectLineUniversal()},includeRangyRangeHelpers:function(){var a=this.getSelection(),b=a.getRangeAt(0),c=function(a){return a&&1===a.nodeType&&a.classList.contains("rangySelectionBoundary")},d=function(a){return 1===a.nodeType?a.childNodes&&a.childNodes.length||0:a.data&&a.data.length||0},e=1===a.anchorNode.nodeType?a.anchorNode.childNodes[a.anchorOffset]:a.anchorNode,f=1===a.focusNode.nodeType?a.focusNode.childNodes[a.focusOffset]:a.focusNode;f&&a.focusOffset===d(f)&&f.nextSibling&&c(f.nextSibling)&&b.setEndAfter(f.nextSibling),e&&0===a.anchorOffset&&e.previousSibling&&c(e.previousSibling)&&b.setStartBefore(e.previousSibling),b.select()},_selectLine_W3C:function(){var a=this.win.getSelection(),b=[a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset];a.modify("move","left","lineboundary"),a.modify("extend","right","lineboundary"),a.anchorNode===b[0]&&a.anchorOffset===b[1]&&a.focusNode===b[2]&&a.focusOffset===b[3]?this._selectLineUniversal():this.includeRangyRangeHelpers()},toLineBoundary:function(b,c){if(c="undefined"==typeof c?!1:c,a.browser.supportsSelectionModify()){var d=this.win.getSelection();d.modify("extend",b,"lineboundary"),c&&("left"===b?d.collapseToStart():"right"===b&&d.collapseToEnd())}},getRangeRect:function(a){var b,c=(this.doc.createTextNode("i"),this.doc.createTextNode("i"));return a.collapsed?(a.insertNode(c),a.selectNode(c),b=a.nativeRange.getBoundingClientRect(),a.deleteContents()):b=a.nativeRange.getBoundingClientRect(),b},_selectLineUniversal:function(){var b,c,d,e,f,g,h=this.getSelection(),i=h.getRangeAt(0),j=0,k=this,l=function(b){return b&&1===b.nodeType&&("block"===k.win.getComputedStyle(b).display||a.lang.array(["BR","HR"]).contains(b.nodeName))},m=function(a){var b=a;if(b)for(;b&&(1===b.nodeType&&b.classList.contains("rangySelectionBoundary")||3===b.nodeType&&/^\s*$/.test(b.data));)b=b.previousSibling;return b};c=i.cloneRange(),d=i.cloneRange(),i.collapsed&&(3===i.startContainer.nodeType&&i.startOffset0?i.moveEnd("character",1):i.startOffset>0&&(3===i.startContainer.nodeType||1===i.startContainer.nodeType&&!l(m(i.startContainer.childNodes[i.startOffset-1])))&&i.moveStart("character",-1)),i.collapsed||i.insertNode(this.doc.createTextNode(a.INVISIBLE_SPACE)),b=i.nativeRange.getBoundingClientRect();do e=i.moveStart("character",-1),f=i.nativeRange.getBoundingClientRect(),f&&Math.floor(f.top)===Math.floor(b.top)||(i.moveStart("character",1),g=!0),j++;while(0!==e&&!g&&2e3>j);if(j=0,g=!1,b=i.nativeRange.getBoundingClientRect(),i.endContainer!==this.contain||this.contain.lastChild&&this.contain.childNodes[i.endOffset]!==this.contain.lastChild)do e=i.moveEnd("character",1),f=i.nativeRange.getBoundingClientRect(),f&&Math.floor(f.bottom)===Math.floor(b.bottom)||(i.moveEnd("character",-1),i.endContainer&&1===i.endContainer.nodeType&&i.endContainer.childNodes[i.endOffset]&&1===i.endContainer.childNodes[i.endOffset].nodeType&&"BR"===i.endContainer.childNodes[i.endOffset].nodeName&&i.endContainer.childNodes[i.endOffset].previousSibling&&(1===i.endContainer.childNodes[i.endOffset].previousSibling.nodeType?i.setEnd(i.endContainer.childNodes[i.endOffset].previousSibling,i.endContainer.childNodes[i.endOffset].previousSibling.childNodes.length):3===i.endContainer.childNodes[i.endOffset].previousSibling.nodeType&&i.setEnd(i.endContainer.childNodes[i.endOffset].previousSibling,i.endContainer.childNodes[i.endOffset].previousSibling.data.length)),g=!0),j++;while(0!==e&&!g&&2e3>j);i.select(),this.includeRangyRangeHelpers()},getText:function(){var a=this.getSelection();return a?a.toString():""},getNodes:function(a,b){var c=this.getRange();return c?c.getNodes(Array.isArray(a)?a:[a],b):[]},getOwnNodes:function(a,b,c){for(var d=this.getOwnRanges(),e=[],f=0,g=d.length;g>f;f++)d[f]&&(c&&d[f].splitBoundaries(),e=e.concat(d[f].getNodes(Array.isArray(a)?a:[a],b)));return e},fixRangeOverflow:function(a){if(this.contain&&this.contain.firstChild&&a){var b=a.compareNode(this.contain);if(2!==b)1===b&&a.setStartBefore(this.contain.firstChild),0===b&&a.setEndAfter(this.contain.lastChild),3===b&&(a.setStartBefore(this.contain.firstChild),a.setEndAfter(this.contain.lastChild));else if(this._detectInlineRangeProblems(a)){var c=a.endContainer.previousElementSibling;c&&a.setEnd(c,this._endOffsetForNode(c))}}},_endOffsetForNode:function(a){var b=document.createRange();return b.selectNodeContents(a),b.endOffset},_detectInlineRangeProblems:function(a){var b=h.compareDocumentPosition(a.startContainer,a.endContainer);return 0==a.endOffset&&4&b},getRange:function(a){var b=this.getSelection(),c=b&&b.rangeCount&&b.getRangeAt(0);return a!==!0&&this.fixRangeOverflow(c),c},getOwnUneditables:function(){var b=h.query(this.contain,"."+this.unselectableClass),c=h.query(b,"."+this.unselectableClass);return a.lang.array(b).without(c)},getOwnRanges:function(){var a,b=[],c=this.getRange();if(c&&b.push(c),this.unselectableClass&&this.contain&&c){var d,e=this.getOwnUneditables();if(e.length>0)for(var f=0,g=e.length;g>f;f++){a=[];for(var h=0,i=b.length;i>h;h++){if(b[h])switch(b[h].compareNode(e[f])){case 2:break;case 3:d=b[h].cloneRange(),d.setEndBefore(e[f]),a.push(d),d=b[h].cloneRange(),d.setStartAfter(e[f]),a.push(d);break;default:a.push(b[h])}b=a}}}return b},getSelection:function(){return rangy.getSelection(this.win)},setSelection:function(a){var b=rangy.getSelection(this.win);return b.setSingleRange(a),b&&b.anchorNode&&b.focusNode?b:null},selectAll:function(){var b,c=this.createRange(),d=this.composer,e=this,g=f(this.composer.element),h=f(this.composer.element),i=function(){c.setStart(d.element,0),c.setEnd(d.element,d.element.childNodes.length),b=e.setSelection(c)},j=function(){return!b||b.nativeSelection&&b.nativeSelection.type&&("Caret"===b.nativeSelection.type||"None"===b.nativeSelection.type)};a.dom.removeInvisibleSpaces(this.composer.element),i(),this.composer.element.firstChild&&j()&&(this.composer.element.appendChild(g),i(),j()&&(g.parentNode.removeChild(g),this.composer.element.insertBefore(h,this.composer.element.firstChild),i(),j()&&(this.composer.element.appendChild(g),i())))},createRange:function(){return rangy.createRange(this.doc)},isCollapsed:function(){return this.getSelection().isCollapsed},getHtml:function(){return this.getSelection().toHtml()},getPlainText:function(){return this.getSelection().toString()},isEndToEndInNode:function(b){var c=this.getRange(),d=c.commonAncestorContainer,e=c.startContainer,f=c.endContainer;if(d.nodeType===a.TEXT_NODE&&(d=d.parentNode),e.nodeType===a.TEXT_NODE&&!/^\s*$/.test(e.data.substr(c.startOffset)))return!1;if(f.nodeType===a.TEXT_NODE&&!/^\s*$/.test(f.data.substr(c.endOffset)))return!1;for(;e&&e!==d;){if(e.nodeType!==a.TEXT_NODE&&!a.dom.contains(d,e))return!1;if(a.dom.domNode(e).prev({ignoreBlankTexts:!0}))return!1;e=e.parentNode}for(;f&&f!==d;){if(f.nodeType!==a.TEXT_NODE&&!a.dom.contains(d,f))return!1;if(a.dom.domNode(f).next({ignoreBlankTexts:!0}))return!1;f=f.parentNode}return a.lang.array(b).contains(d.nodeName)?d:!1},isInThisEditable:function(){var b=this.getSelection(),c=b.focusNode,d=b.anchorNode;return c&&1!==c.nodeType&&(c=c.parentNode),d&&1!==d.nodeType&&(d=d.parentNode),d&&c&&(a.dom.contains(this.composer.element,c)||this.composer.element===c)&&(a.dom.contains(this.composer.element,d)||this.composer.element===d)},deselect:function(){var a=this.getSelection();a&&a.removeAllRanges()}})}(a),a.Commands=b.extend({constructor:function(a){this.editor=a,this.composer=a.composer,this.doc=this.composer.doc},support:function(b){return a.browser.supportsCommand(this.doc,b)},exec:function(b,c){var d=a.commands[b],e=a.lang.array(arguments).get(),f=d&&d.exec,g=null;if(this.composer.hasPlaceholderSet()&&!a.lang.array(["styleWithCSS","enableObjectResizing","enableInlineTableEditing"]).contains(b)&&(this.composer.element.innerHTML="",this.composer.selection.selectNode(this.composer.element)),this.editor.fire("beforecommand:composer"),f)e.unshift(this.composer),g=f.apply(d,e);else try{g=this.doc.execCommand(b,!1,c)}catch(h){}return this.editor.fire("aftercommand:composer"),g},remove:function(b,c){var d=a.commands[b],e=a.lang.array(arguments).get(),f=d&&d.remove;return f?(e.unshift(this.composer),f.apply(d,e)):void 0},state:function(b,c){var d=a.commands[b],e=a.lang.array(arguments).get(),f=d&&d.state;if(f)return e.unshift(this.composer),f.apply(d,e);try{return this.doc.queryCommandState(b)}catch(g){return!1}},stateValue:function(b){var c=a.commands[b],d=a.lang.array(arguments).get(),e=c&&c.stateValue;return e?(d.unshift(this.composer),e.apply(c,d)):!1}}),function(a){function b(b){return a.lang.object({}).merge(c).merge({attribute:b}).get()}var c={nodeName:"A",toggle:!1};a.commands.createLink={exec:function(c,d,e){var f=b(e);if(c.selection.isCollapsed()&&!this.state(c,d)){var g=c.doc.createTextNode(f.attribute.href);c.selection.insertNode(g),c.selection.selectNode(g)}a.commands.formatInline.exec(c,d,f)},state:function(b,d){return a.commands.formatInline.state(b,d,c)}}}(a),function(a){var b={nodeName:"A"};a.commands.removeLink={exec:function(c,d){a.commands.formatInline.remove(c,d,b)},state:function(c,d){return a.commands.formatInline.state(c,d,b)}}}(a),function(a){function b(a){return{nodeName:a.nodeName||null,className:a.classRegExp?null:a.className||null,classRegExp:a.classRegExp||null,styleProperty:a.styleProperty||null}}function c(a,b){return 3===a.nodeType?a:a.childNodes[b]||a}function d(a){return a&&1===a.nodeType&&"BR"===a.nodeName}function e(a,b){return a&&1===a.nodeType&&"block"===b.win.getComputedStyle(a).display}function f(a){ +return a&&1===a.nodeType&&a.classList.contains("rangySelectionBoundary")}function g(a,b){return d(a)||e(a,b)}function h(b,c){a.dom.removeInvisibleSpaces(b.element);for(var d,e=b.element,f=e.querySelectorAll(E),g=b.config.classNames.uneditableContainer+[""].concat(E.split(",")).join(", "+b.config.classNames.uneditableContainer+" "),h=e.querySelectorAll(g),i=a.lang.array(f).without(h),j=i.length;j--;)""!==i[j].innerHTML.replace(/[\uFEFF]/g,"")||0!==c.length&&i[j]===c[c.length-1]||(d=a.lang.array(c).indexOf(i[j]),d>-1&&c.splice(d,1),i[j].parentNode.removeChild(i[j]));return c}function i(a){return a.config.useLineBreaks?"DIV":"P"}function j(a,b,c){for(var d=a,e=null;d&&b&&d!==b;)1===d.nodeType&&d.matches(c?E:D)&&(e=d),d=d.parentNode;return e}function k(a,b){for(var c,d,e,f=a,g=null;f&&b&&f!==b;)1===f.nodeType&&f.matches(F)&&(d=f,null===g?(g=f.cloneNode(!1),c=g):(e=f.cloneNode(!1),e.appendChild(g),g=e)),f=f.parentNode;return{parent:d,outerNode:g,innerNode:c}}function l(b,c,d){return b||(b=d.doc.createElement(c.nodeName||i(d)),b.appendChild(d.doc.createTextNode(a.INVISIBLE_SPACE))),c.nodeName&&b.nodeName!==c.nodeName&&(b=C.renameElement(b,c.nodeName)),c.classRegExp&&(b.className=b.className.replace(c.classRegExp,"")),c.className&&b.classList.add(c.className),c.styleProperty&&"undefined"!=typeof c.styleValue&&(b.style[a.browser.fixStyleKey(c.styleProperty)]=c.styleValue),b}function m(b,c,d){var e,f=b.previousSibling,g=b.nextSibling,h=!1;c.styleProperty&&(b.style[a.browser.fixStyleKey(c.styleProperty)]=""),c.className&&b.classList.remove(c.className),c.classRegExp&&(b.className=b.className.replace(c.classRegExp,"")),null!==b.getAttribute("class")&&""===b.getAttribute("class").trim()&&b.removeAttribute("class"),c.nodeName&&b.nodeName.toLowerCase()===c.nodeName.toLowerCase()&&(e=b.getAttribute("style"),e&&""!==e.trim()?b=C.renameElement(b,i(d)):(C.unwrap(b),h=!0)),null!==b.getAttribute("style")&&""===b.getAttribute("style").trim()&&b.removeAttribute("style"),h&&u(f,g,d)}function n(b){for(var c,d,e=b.querySelectorAll(E)||[],f=e.length;f--;)c=a.dom.domNode(e[f]).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),d=a.dom.domNode(e[f]).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),c&&1!==c.nodeType&&"BR"!==c.nodeName&&""!==(e[f].innerHTML||e[f].nodeValue||"").trim()&&e[f].parentNode.insertBefore(e[f].ownerDocument.createElement("BR"),c),c&&1!==c.nodeType&&"BR"!==c.nodeName&&""!==(e[f].innerHTML||e[f].nodeValue||"").trim()&&e[f].parentNode.insertBefore(e[f].ownerDocument.createElement("BR"),c),a.dom.unwrap(e[f])}function o(a,b){var c,d=a.startContainer,e=a.endContainer;return d&&1===d.nodeType&&d===e?void(d.firstChild===d.lastChild&&1===a.endOffset&&d!==b.element&&"LI"!==d.nodeName&&"TD"!==d.nodeName&&(a.setStartBefore(d),a.setEndAfter(e))):d&&1===d.nodeType&&3===e.nodeType?void(d.firstChild===e&&a.endOffset===e.data.length&&d!==b.element&&"LI"!==d.nodeName&&"TD"!==d.nodeName&&a.setEndAfter(d)):e&&1===e.nodeType&&3===d.nodeType?void(e.firstChild===d&&0===a.startOffset&&e!==b.element&&"LI"!==e.nodeName&&"TD"!==e.nodeName&&a.setStartBefore(e)):d&&3===d.nodeType&&d===e&&1===d.parentNode.childNodes.length?void(a.endOffset==e.data.length&&0===a.startOffset&&(c=d.parentNode,c!==b.element&&"LI"!==c.nodeName&&"TD"!==c.nodeName&&(a.setStartBefore(c),a.setEndAfter(c)))):void 0}function p(b){for(var c,d,e,f,g,h,i=[],j=0,k=b.length;k>j;j++)if(1===b[j].startContainer.nodeType&&b[j].startContainer.matches("ul, ol")&&b[j].setStart(b[j].startContainer.childNodes[b[j].startOffset],0),1===b[j].endContainer.nodeType&&b[j].endContainer.matches("ul, ol")&&(h=b[j].endContainer.childNodes[Math.max(b[j].endOffset-1,0)],h.childNodes&&b[j].setEnd(h,h.childNodes.length)),c=b[j].getNodes([1],function(a){return"LI"===a.nodeName}),c.length>0){for(d=0,e=c.length;e>d;d++)g=b[j].compareNode(c[d]),(g===b[j].NODE_AFTER||g===b[j].NODE_INSIDE)&&(f=b[j].cloneRange(),h=a.dom.domNode(c[d]).prev({nodeTypes:[1]}),h?f.setEnd(h,h.childNodes.length):c[d].closest("ul, ol")?f.setEndBefore(c[d].closest("ul, ol")):f.setEndBefore(c[d]),i.push(f),b[j].setStart(c[d],0)),(g===b[j].NODE_BEFORE||g===b[j].NODE_INSIDE)&&(f=b[j].cloneRange(),f.setEnd(c[d],c[d].childNodes.length),i.push(f),h=a.dom.domNode(c[d]).next({nodeTypes:[1]}),h?b[j].setStart(h,0):c[d].closest("ul, ol")?b[j].setStartAfter(c[d].closest("ul, ol")):b[j].setStartAfter(c[d]));i.push(b[j])}else i.push(b[j]);return i}function q(b,c,d){var e=b?a.lang.object(b).clone(!0):null;return e&&(e.nodeName=e.nodeName||c||i(d)),e}function r(b,c,d,e){var f,h,i,l,m,n=c.startContainer,e=e||j(n,d.element,!0);if(e)h=b.firstChild,i=b.lastChild,d.selection.splitElementAtCaret(e,b),m=a.dom.domNode(i).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),l=a.dom.domNode(h).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),h&&!g(h,d)&&l&&!g(l,d)&&h.parentNode.insertBefore(d.doc.createElement("br"),h),i&&!g(i,d)&&m&&!g(m,d)&&m.parentNode.insertBefore(d.doc.createElement("br"),m);else if(f=k(n,d.element),f.outerNode&&f.innerNode&&f.parent){if(1===b.childNodes.length){for(;b.firstChild.firstChild;)f.innerNode.appendChild(b.firstChild.firstChild);b.firstChild.appendChild(f.outerNode)}d.selection.splitElementAtCaret(f.parent,b)}else{var o=b.firstChild,p=b.lastChild;c.insertNode(b),c.setStartBefore(o),c.setEndAfter(p)}}function s(b,d,e){for(var f,h,i=b.cloneRange(),j=c(i.startContainer,i.startOffset).previousSibling,k=c(i.endContainer,i.endOffset).nextSibling,l=i.extractContents(),m=e.doc.createDocumentFragment(),o=!0;l.firstChild;){if(1===l.firstChild.nodeType&&l.firstChild.matches(E)){n(l.firstChild),f=a.dom.unwrap(l.firstChild),f.length>0&&(m.lastChild&&(1!==m.lastChild.nodeType||!g(m.lastChild,e))||!m.lastChild&&j&&(1!==j.nodeType||g(j,e)))&&m.appendChild(e.doc.createElement("BR"));for(var p=0,q=f.length;q>p;p++)m.appendChild(f[p]);f.length>0&&(1===m.lastChild.nodeType&&g(m.lastChild,e)||(k||m.lastChild!==l.lastChild)&&m.appendChild(e.doc.createElement("BR")))}else m.appendChild(l.firstChild);o=!1}return h=a.lang.array(m.childNodes).get(),r(m,i,e),h}function t(b,c,e){var f=b&&a.dom.domNode(b).prev({nodeTypes:[1,3],ignoreBlankTexts:!0});d(c)&&c.parentNode.removeChild(c),!d(b)||f&&1===f.nodeType&&"block"===e.win.getComputedStyle(f).display||b.parentNode.removeChild(b)}function u(a,b,c){var e;a&&f(a)&&(a=a.previousSibling),b&&f(b)&&(b=b.nextSibling),e=a&&a.previousSibling,a&&(1!==a.nodeType||"block"!==c.win.getComputedStyle(a).display&&!d(a))&&a.parentNode&&a.parentNode.insertBefore(c.doc.createElement("br"),a.nextSibling),b&&(1!==b.nodeType||"block"!==c.win.getComputedStyle(b).display)&&b.parentNode&&b.parentNode.insertBefore(c.doc.createElement("br"),b)}function v(d,e,f,g){var h,i,k=e?b(e):null,m=d.cloneRange(),o=m.startContainer,p=c(m.startContainer,m.startOffset),s=c(m.endContainer,m.endOffset),u=m.startContainer!==p||3!==p.nodeType||G(p,m.startOffset)?a.dom.domNode(p).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}):p,v=1===m.endContainer.nodeType&&m.endContainer.childNodes[m.endOffset]===s&&(1===s.nodeType||!H(s,m.endOffset)&&!a.dom.domNode(s).is.rangyBookmark())||m.endContainer===s&&3===s.nodeType&&!H(s,m.endOffset)?s:a.dom.domNode(s).next({nodeTypes:[1,3],ignoreBlankTexts:!0}),w=m.extractContents(),x=g.doc.createDocumentFragment(),y=k?a.dom.getParentElement(o,k,null,g.element):null,z=!f||!e||"BLOCKQUOTE"===e.nodeName&&"BLOCKQUOTE"===f,A=y||j(o,g.element,z);if(a.dom.domNode(v).is.rangyBookmark()&&(s=v,v=s.nextSibling),I(w),e&&"BLOCKQUOTE"===e.nodeName){var B=l(null,e,g);B.appendChild(w),x.appendChild(B),i=[B]}else{if(w.firstChild)for(;w.firstChild;)if(1==w.firstChild.nodeType&&w.firstChild.matches(E))l(w.firstChild,e,g),w.firstChild.matches(D)&&n(w.firstChild),x.appendChild(w.firstChild);else{for(h=l(null,q(e,f,g),g);w.firstChild&&(1!==w.firstChild.nodeType||!w.firstChild.matches(E));)1==w.firstChild.nodeType&&h.matches(D)&&n(w.firstChild),h.appendChild(w.firstChild);x.appendChild(h)}else x.appendChild(l(null,e,g));i=a.lang.array(x.childNodes).get()}return r(x,m,g,A),t(u,v,g),i.length>0&&("undefined"==typeof i[i.length-1].lastChild||a.dom.domNode(i[i.length-1].lastChild).is.rangyBookmark())&&i[i.length-1].appendChild(g.doc.createElement("br")),i}function w(b,c){var d=a.dom.getParentElement(b,{query:E},null,c.element);return d?d.nodeName:null}function x(b,c){var d,e=a.dom.getParentElement(b.selection.getOwnRanges()[0].startContainer,{query:D+", "+(c?c.toLowerCase():"div")},null,b.element);e?(d=b.selection.createRange(),d.selectNode(e),b.selection.setSelection(d)):b.isEmpty()||b.selection.selectLine()}function y(a,b){var c=b.selection.createRange(),d=a[a.length-1],e=1===d.nodeType&&d.childNodes?0|d.childNodes.length:d.length||0;c.setStart(a[0],0),c.setEnd(d,e),c.select()}function z(a,b,c){var d,e=b.selection.getOwnRanges(),f=[];e=p(e);for(var g=e.length;g--;)o(e[g],b),d=w(e[g].startContainer,b),f="remove"===a?f.concat(s(e[g],d,b)):f.concat(v(e[g],c,d,b));return f}function A(a){return"string"==typeof a&&(a={nodeName:a.toUpperCase()}),a}function B(b){var c;return b.selection.isCollapsed()&&(c=b.selection.getNodesNearCaret(),c&&c.caretNode&&(a.dom.domNode(c.caretNode).is.lineBreak()||3===c.caretNode.nodeType&&0===c.textOffset&&(!c.prevNode||a.dom.domNode(c.prevNode).is.lineBreak())||1===c.caretNode.nodeType&&c.caretNode.classList.contains("rangySelectionBoundary")&&(!c.prevNode||a.dom.domNode(c.prevNode).is.lineBreak()||a.dom.domNode(c.prevNode).is.block())&&(!c.nextNode||a.dom.domNode(c.nextNode).is.lineBreak()||a.dom.domNode(c.nextNode).is.block())))?!0:!1}var C=a.dom,D="h1, h2, h3, h4, h5, h6, p, pre",E="h1, h2, h3, h4, h5, h6, p, pre, div, blockquote",F="b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",G=function(a,b){var c=a.data?a.data.slice(0,b):"";return/^\s*$/.test(c)},H=function(a,b){var c=a.data?a.data.slice(b):"";return/^\s*$/.test(c)},I=function(a){if(a){for(;a.firstChild&&3===a.firstChild.nodeType&&/^\s*$/.test(a.firstChild.data)&&a.lastChild!==a.firstChild;)a.removeChild(a.firstChild);for(;a.lastChild&&3===a.lastChild.nodeType&&/^\s*$/.test(a.lastChild.data)&&a.lastChild!==a.firstChild;)a.removeChild(a.lastChild);a.firstChild&&1===a.firstChild.nodeType&&"BR"===a.firstChild.nodeName&&a.lastChild!==a.firstChild&&a.removeChild(a.firstChild),a.lastChild&&1===a.lastChild.nodeType&&"BR"===a.lastChild.nodeName&&a.lastChild!==a.firstChild&&a.removeChild(a.lastChild)}};a.commands.formatBlock={exec:function(a,b,c){c=A(c);var d,e,f=[];if(c&&c.toggle&&(e=this.state(a,b,c)),e){d=rangy.saveSelection(a.win);for(var g=0,i=e.length;i>g;g++)m(e[g],c,a)}else a.selection.isCollapsed()&&(d=rangy.saveSelection(a.win),B(a)?a.selection.selectLine():x(a,c&&c.nodeName?c.nodeName.toUpperCase():void 0)),f=c?z("apply",a,c):z("remove",a);f=h(a,f),d?rangy.restoreSelection(d):y(f,a)},remove:function(a,b,c){c=A(c);var d,e;a.selection.isCollapsed()&&(e=rangy.saveSelection(a.win),x(a,c&&c.nodeName?c.nodeName.toUpperCase():void 0)),d=z("remove",a),d=h(a,d),e?rangy.restoreSelection(e):y(d,a)},state:function(b,c,d){d=A(d);for(var e,f=b.selection.filterElements(function(b){return a.dom.domNode(b).test(d||{query:E})}.bind(this)),g=b.selection.getSelectedOwnNodes(),h=0,i=g.length;i>h;h++)e=C.getParentElement(g[h],d||{query:E},null,b.element),e&&-1===f.indexOf(e)&&f.push(e);return 0===f.length?!1:f}}}(a),function(a){function b(a){return/^\s*$/.test(a.className)}function c(a){return!a.getAttribute("style")||/^\s*$/.test(a.getAttribute("style"))}function d(b){var c=a.dom.getAttributes(b);return a.lang.object(c).isEmpty()}function e(b,c){var d,e,f,g;return 1!==b.nodeType||1!==c.nodeType?!1:b.nodeName!==c.nodeName?!1:(d=b.className.trim().replace(/\s+/g," ").split(" "),e=c.className.trim().replace(/\s+/g," ").split(" "),a.lang.array(d).without(e).length>0?!1:(f=a.dom.getAttributes(b),g=a.dom.getAttributes(c),f.length===g.length&&a.lang.object(a.lang.object(f).difference(g)).isEmpty()?!0:!1))}function f(b,c){var d=c&&c.nodeName||F,e=b.ownerDocument.createElement(d);if(c.classRegExp&&(e.className=e.className.replace(c.classRegExp,"")),c.className&&e.classList.add(c.className),c.styleProperty&&"undefined"!=typeof c.styleValue&&(e.style[a.browser.fixStyleKey(c.styleProperty)]=c.styleValue),c.attribute)if("object"==typeof c.attribute)for(var f in c.attribute)c.attribute.hasOwnProperty(f)&&e.setAttribute(f,c.attribute[f]);else"undefined"!=typeof c.attributeValue&&e.setAttribute(c.attribute,c.attributeValue);return e}function g(a,b){for(var c in a)if(a.hasOwnProperty(c)&&(void 0===typeof b[c]||b[c]!==a[c]))return!1;return!0}function h(b,c,d){var e,f=a.dom.getAttributes(b),h=g(c,f);a.lang.object(f).difference(c);if(h&&d!==!1)for(e in c)c.hasOwnProperty(e)&&b.removeAttribute(e);else for(e in c)c.hasOwnProperty(e)&&b.setAttribute(e,c[e])}function i(e,f){var g,i,j;f.className&&(f.toggle!==!1&&e.classList.contains(f.className)?e.classList.remove(f.className):(f.classRegExp&&(e.className=e.className.replace(f.classRegExp,"")),e.classList.add(f.className)),b(e)&&e.removeAttribute("class")),f.styleProperty&&(f.toggle!==!1&&e.style[a.browser.fixStyleKey(f.styleProperty)].trim().replace(/, /g,",")===f.styleValue?e.style[a.browser.fixStyleKey(f.styleProperty)]="":e.style[a.browser.fixStyleKey(f.styleProperty)]=f.styleValue),c(e)&&e.removeAttribute("style"),f.attribute&&("object"==typeof f.attribute?g=f.attribute:(g={},g[f.attribute]=f.attributeValue||""),h(e,g,f.toggle)),i=f.nodeName?H[f.nodeName.toLowerCase()]||f.nodeName.toLowerCase():null,j=i?a.dom.domNode(e).test({query:i}):!1,(!f.nodeName||f.nodeName===F||j)&&(f.toggle!==!1&&j||!f.nodeName&&e.nodeName===F)&&b(e)&&c(e)&&d(e)&&a.dom.unwrap(e)}function j(b,c){var d=[];return b.isCollapsed()||(d=d.concat(b.getOwnNodes([3],function(b){return!a.dom.domNode(b).is.emptyTextNode()},c))),d}function k(a,b,c,d){var e=a,f=d?b:l(b);do{if(1===e.nodeType&&m(e,f))return e;e=e.parentNode}while(e&&e!==c);return null}function l(a){return{nodeName:a.nodeName||null,className:a.classRegExp?null:a.className||null,classRegExp:a.classRegExp||null,styleProperty:a.styleProperty||null}}function m(b,c){var d;if(c.nodeName){var e=H[c.nodeName.toLowerCase()]||c.nodeName.toLowerCase();return a.dom.domNode(b).test({query:e})}return d=a.lang.object(c).clone(),d.query=G,a.dom.domNode(b).test(d)}function n(b,c){var d=document.documentElement||document.body,e=d.scrollTop,f=d.scrollLeft;rangy.getSelection(b.win);rangy.getSelection(b.win).removeAllRanges();try{rangy.getSelection(b.win).addRange(c)}catch(g){}b.doc.activeElement&&a.dom.contains(b.element,b.doc.activeElement)||(b.element.focus(),d.scrollTop=e,d.scrollLeft=f,rangy.getSelection(b.win).addRange(c))}function o(a,b){var c=rangy.createRange(b.doc),d=a[a.length-1];a[0]&&d&&(c.setStart(a[0],0),c.setEnd(d,d.length),n(b,c))}function p(a,b,c,d){var e=rangy.createRange(a.doc);b&&(e.setStart(b,c),e.setEnd(b,"undefined"!=typeof d?d:c),n(a,e))}function q(a,b,c){var d,e,f,g=j(a.selection),h=[],i=!1;if(a.selection.isInThisEditable()){if(0===g.length&&a.selection.isCollapsed()){if(f=a.selection.getSelection().anchorNode,!f)return{nodes:[],partial:!1};3===f.nodeType&&(g=[f])}g.length||(e=a.selection.getOwnRanges()[0],e&&(g=[e.endContainer]));for(var l=0,m=g.length;m>l;l++)d=k(g[l],b,a.element,c),d?h.push(d):i=!0}return{nodes:h,partial:i}}function r(a){var b,c,d,e;return a&&(b=a.anchorNode,c=a.anchorOffset,b&&3===b.nodeType&&c>0&&c0&&/\w/.test(c.data[g-1]);)g--;for(;h0&&o(b,a),u(q(a,c).nodes),b.length>0&&o(b,a)}function w(a,b,c,d){p(a,b,c),u(q(a,d).nodes),p(a,b,c)}function x(a,b){var c=f(a,b);a.parentNode.insertBefore(c,a),c.appendChild(a)}function y(b,c,d){var e,f=c.element,g=k(b,d,f);g&&(e=g.cloneNode(!1),a.dom.domNode(b).escapeParent(g,e),i(e,d))}function z(b,c,d){var e=c.element,f=k(b,d,e);f&&a.dom.domNode(b).escapeParent(f)}function A(a,b,c){var d=f(a.endContainer,c);a.surroundContents(d),b.selection.selectNode(d)}function B(b,c,d,e){var f,g,h,j,l=q(b,e,!0),m=b.selection.getSelection();if(c.length){if(l.partial||e.toggle===!1)for(j=c.length;j--;)k(c[j],e,b.element)&&y(c[j],b,e),k(c[j],e,b.element)||x(c[j],e);else for(j=c.length;j--;)y(c[j],b,e);v(b,c,e)}else if(e.toggle!==!1)if(r(m))f=s(m),g=f.textNode,y(f.textNode,b,e),w(b,f.textNode,f.wordOffset,e);else{g=b.doc.createTextNode(a.INVISIBLE_SPACE),h=d.nodes[0].cloneNode(!1),h.appendChild(g),b.selection.splitElementAtCaret(d.nodes[0],h),i(h,e),v(b,[g],e);var n=b.selection.getSelection();if(n.anchorNode&&n.focusNode)try{n.collapseToEnd()}catch(o){}}else for(j=d.nodes.length;j--;)i(d.nodes[j],e)}function C(b,c,d,e){var f,g,h,i=b.selection.getSelection();if(c.length){for(h=c.length;h--;)z(c[h],b,e);v(b,c,e)}else{for(f=i.anchorNode,g=i.anchorOffset,h=d.nodes.length;h--;)a.dom.unwrap(d.nodes[h]);w(b,f,g,e)}}function D(a,b,c){var d,e,f=a.selection.getSelection();if(b.length){for(e=b.length;e--;)x(b[e],c);v(a,b,c)}else if(r(f))d=s(f),x(d.textNode,c),w(a,d.textNode,d.wordOffset,c);else{var g=a.selection.getOwnRanges()[0];g&&A(g,a,c)}}function E(a){return a="string"==typeof a?{nodeName:a}:a,a.nodeName&&(a.nodeName=a.nodeName.toUpperCase()),a}var F="SPAN",G="b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",H={b:"b, strong",strong:"b, strong",em:"em, i",i:"em, i"};a.commands.formatInline={exec:function(a,b,c){c=E(c),a.element.normalize();var d=j(a.selection,!0),e=q(a,c);e.nodes.length>0?B(a,d,e,c):D(a,d,c),a.element.normalize()},remove:function(a,b,c){c=E(c),a.element.normalize();var d=j(a.selection,!0),e=q(a,c);e.nodes.length>0&&C(a,d,e,c),a.element.normalize()},state:function(a,b,c){c=E(c);var d=q(a,c,!0).nodes;return 0===d.length?!1:d}}}(a),function(a){a.commands.insertHTML={exec:function(a,b,c){a.selection.insertHTML(c)},state:function(){return!1}}}(a),function(a){var b="
    "+(a.browser.needsSpaceAfterLineBreak()?" ":"");a.commands.insertLineBreak={exec:function(a,c){a.selection.insertHTML(b)},state:function(){return!1}}}(a),a.commands.insertList=function(a){var b=function(a,b){if(a&&a.nodeName){"string"==typeof b&&(b=[b]);for(var c=b.length;c--;)if(a.nodeName===b[c])return!0}return!1},c=function(c,d,e){var f={el:null,other:!1};if(c){var g=a.dom.getParentElement(c,{query:"li"},!1,e.element),h="UL"===d?"OL":"UL";b(c,d)?f.el=c:b(c,h)?f={el:c,other:!0}:g&&(b(g.parentNode,d)?f.el=g.parentNode:b(g.parentNode,h)&&(f={el:g.parentNode,other:!0}))}return f.el&&!e.element.contains(f.el)&&(f.el=null),f},d=function(b,c,d){var e,g,h="UL"===c?"OL":"UL";d.selection.executeAndRestoreRangy(function(){if(e=f(h,d),e.length)for(var i=e.length;i--;)a.dom.renameElement(e[i],c.toLowerCase());else{g=f(["OL","UL"],d);for(var j=g.length;j--;)a.dom.resolveList(g[j],d.config.useLineBreaks);0===g.length&&a.dom.resolveList(b,d.config.useLineBreaks)}})},e=function(b,c,d){var e="UL"===c?"OL":"UL";d.selection.executeAndRestoreRangy(function(){for(var g=[b].concat(f(e,d)),h=g.length;h--;)a.dom.renameElement(g[h],c.toLowerCase())})},f=function(a,c){for(var d=c.selection.getOwnRanges(),e=[],f=d.length;f--;)e=e.concat(d[f].getNodes([1],function(c){return b(c,a)}));return e},g=function(b,c){var d,e,f=rangy.saveSelection(c.win),g="_wysihtml5-temp-"+(new Date).getTime();c.commands.exec("formatBlock",{nodeName:"div",className:g});var h=c.element.querySelector("."+g);h.innerHTML=h.innerHTML.replace(a.INVISIBLE_SPACE_REG_EXP,""),h&&(d=/^(\s|(
    ))+$/i.test(h.innerHTML),e=a.dom.convertToList(h,b.toLowerCase(),c.parent.config.classNames.uneditableContainer),f&&rangy.restoreSelection(f),d&&c.selection.selectNode(e.querySelector("li"),!0))};return{exec:function(b,f,h){var i,j,k=b.doc,l="OL"===h?"insertOrderedList":"insertUnorderedList",m=b.selection.getSelection(),n=1===m.anchorNode.nodeType&&m.anchorNode.firstChild?m.anchorNode.childNodes[m.anchorOffset]:m.anchorNode,o=1===m.focusNode.nodeType&&m.focusNode.firstChild?m.focusNode.childNodes[m.focusOffset]||m.focusNode.lastChild:m.focusNode;m.isBackwards()&&(n=[o,o=n][0]),a.dom.domNode(o).is.emptyTextNode(!0)&&o&&(o=a.dom.domNode(o).prev({nodeTypes:[1,3],ignoreBlankTexts:!0})),a.dom.domNode(n).is.emptyTextNode(!0)&&n&&(n=a.dom.domNode(n).next({nodeTypes:[1,3],ignoreBlankTexts:!0})),i=n&&o?n===o?n:a.dom.domNode(n).commonAncestor(o,b.element):b.selection.getSelectedNode(),j=c(i,h,b),j.el?j.other?e(j.el,h,b):d(j.el,h,b):b.commands.support(l)?k.execCommand(l,!1,null):g(h,b)},state:function(a,b,d){var e=a.selection.getSelectedNode(),f=c(e,d,a);return f.el&&!f.other?f.el:!1}}}(a),function(a){a.commands.redo={exec:function(a){return a.undoManager.redo()},state:function(a){return!1}}}(a),function(a){a.commands.undo={exec:function(a){return a.undoManager.undo()},state:function(a){return!1}}}(a),function(a){a.commands.createTable={exec:function(a,b,c){var d,e,f;if(c&&c.cols&&c.rows&&parseInt(c.cols,10)>0&&parseInt(c.rows,10)>0){for(f=c.tableStyle?'':"
    ",f+="",e=0;e",d=0;d
    ";f+=""}f+="
    ",a.commands.exec("insertHTML",f)}},state:function(a,b){return!1}}}(a),function(a){a.commands.mergeTableCells={exec:function(b,c){b.tableSelection&&b.tableSelection.start&&b.tableSelection.end&&(this.state(b,c)?a.dom.table.unmergeCell(b.tableSelection.start):a.dom.table.mergeCellsBetween(b.tableSelection.start,b.tableSelection.end))},state:function(b,c){if(b.tableSelection){var d=b.tableSelection.start,e=b.tableSelection.end;if(d&&e&&d==e&&(a.dom.getAttribute(d,"colspan")&&parseInt(a.dom.getAttribute(d,"colspan"),10)>1||a.dom.getAttribute(d,"rowspan")&&parseInt(a.dom.getAttribute(d,"rowspan"),10)>1))return[d]}return!1}}}(a),function(a){a.commands.addTableCells={exec:function(b,c,d){if(b.tableSelection&&b.tableSelection.start&&b.tableSelection.end){var e=a.dom.table.orderSelectionEnds(b.tableSelection.start,b.tableSelection.end);"before"==d||"above"==d?a.dom.table.addCells(e.start,d):("after"==d||"below"==d)&&a.dom.table.addCells(e.end,d),setTimeout(function(){b.tableSelection.select(e.start,e.end)},0)}},state:function(a,b){return!1}}}(a),function(a){a.commands.deleteTableCells={exec:function(b,c,d){if(b.tableSelection&&b.tableSelection.start&&b.tableSelection.end){var e,f=a.dom.table.orderSelectionEnds(b.tableSelection.start,b.tableSelection.end),g=a.dom.table.indexOf(f.start),h=b.tableSelection.table;a.dom.table.removeCells(f.start,d),setTimeout(function(){e=a.dom.table.findCell(h,g),e||("row"==d&&(e=a.dom.table.findCell(h,{row:g.row-1,col:g.col})),"column"==d&&(e=a.dom.table.findCell(h,{row:g.row,col:g.col-1}))),e&&b.tableSelection.select(e,e)},0)}},state:function(a,b){return!1}}}(a),function(a){a.commands.indentList={exec:function(a,b,c){var d=a.selection.getSelectionParentsByTag("LI");return d?this.tryToPushLiLevel(d,a.selection):!1},state:function(a,b){return!1},tryToPushLiLevel:function(b,c){var d,e,f,g,h,i=!1;return c.executeAndRestoreRangy(function(){for(var c=b.length;c--;)g=b[c],d="OL"===g.parentNode.nodeName?"OL":"UL",e=g.ownerDocument.createElement(d),f=a.dom.domNode(g).prev({nodeTypes:[a.ELEMENT_NODE]}),h=f?f.querySelector("ul, ol"):null,f&&(h?h.appendChild(g):(e.appendChild(g),f.appendChild(e)),i=!0)}),i}}}(a),function(a){a.commands.outdentList={exec:function(a,b,c){var d=a.selection.getSelectionParentsByTag("LI");return d?this.tryToPullLiLevel(d,a):!1},state:function(a,b){return!1},tryToPullLiLevel:function(b,c){var d,e,f,g,h,i=!1,j=this;return c.selection.executeAndRestoreRangy(function(){for(var k=b.length;k--;)if(g=b[k],g.parentNode&&(d=g.parentNode,"OL"===d.tagName||"UL"===d.tagName)){if(i=!0,e=a.dom.getParentElement(d.parentNode,{query:"ol, ul"},!1,c.element),f=a.dom.getParentElement(d.parentNode,{query:"li"},!1,c.element),e&&f)g.nextSibling&&(h=j.getAfterList(d,g),g.appendChild(h)),e.insertBefore(g,f.nextSibling);else{g.nextSibling&&(h=j.getAfterList(d,g),g.appendChild(h));for(var l=g.childNodes.length;l--;)d.parentNode.insertBefore(g.childNodes[l],d.nextSibling);d.parentNode.insertBefore(document.createElement("br"),d.nextSibling),g.parentNode.removeChild(g)}0===d.childNodes.length&&d.parentNode.removeChild(d)}}),i},getAfterList:function(a,b){for(var c=a.nodeName,d=document.createElement(c);b.nextSibling;)d.appendChild(b.nextSibling);return d}}}(a),function(a){var b=90,c=89,d=8,e=46,f=25,g="data-wysihtml5-selection-node",h="data-wysihtml5-selection-offset",i=(''+a.INVISIBLE_SPACE+"",''+a.INVISIBLE_SPACE+"",a.dom);a.UndoManager=a.lang.Dispatcher.extend({constructor:function(a){this.editor=a,this.composer=a.composer,this.element=this.composer.element,this.position=0,this.historyStr=[],this.historyDom=[],this.transact(),this._observe()},_observe:function(){var a,f=this;this.composer.sandbox.getDocument();i.observe(this.element,"keydown",function(a){if(!a.altKey&&(a.ctrlKey||a.metaKey)){var d=a.keyCode,e=d===b&&!a.shiftKey,g=d===b&&a.shiftKey||d===c;e?(f.undo(),a.preventDefault()):g&&(f.redo(),a.preventDefault())}}),i.observe(this.element,"keydown",function(b){var c=b.keyCode;c!==a&&(a=c,(c===d||c===e)&&f.transact())}),this.editor.on("newword:composer",function(){f.transact()}).on("beforecommand:composer",function(){f.transact()})},transact:function(){var b,c,d,e,i,j=this.historyStr[this.position-1],k=this.composer.getValue(!1,!1),l=this.element.offsetWidth>0&&this.element.offsetHeight>0;if(k!==j){var m=this.historyStr.length=this.historyDom.length=this.position;m>f&&(this.historyStr.shift(),this.historyDom.shift(),this.position--),this.position++,l&&(b=this.composer.selection.getRange(),c=b&&b.startContainer?b.startContainer:this.element,d=b&&b.startOffset?b.startOffset:0,c.nodeType===a.ELEMENT_NODE?e=c:(e=c.parentNode,i=this.getChildNodeIndex(e,c)),e.setAttribute(h,d),"undefined"!=typeof i&&e.setAttribute(g,i));var n=this.element.cloneNode(!!k);this.historyDom.push(n),this.historyStr.push(k),e&&(e.removeAttribute(h),e.removeAttribute(g))}},undo:function(){this.transact(),this.undoPossible()&&(this.set(this.historyDom[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.redoPossible()&&(this.set(this.historyDom[++this.position-1]),this.editor.fire("redo:composer"))},undoPossible:function(){return this.position>1},redoPossible:function(){return this.positionb;b++)this.element.appendChild(c[b].cloneNode(!0));var e,f,i;a.hasAttribute(h)?(e=a.getAttribute(h),i=a.getAttribute(g),f=this.element):(f=this.element.querySelector("["+h+"]")||this.element,e=f.getAttribute(h),i=f.getAttribute(g),f.removeAttribute(h),f.removeAttribute(g)),null!==i&&(f=this.getChildNodeByIndex(f,+i)),this.composer.selection.set(f,e)},getChildNodeIndex:function(a,b){for(var c=0,d=a.childNodes,e=d.length;e>c;c++)if(d[c]===b)return c},getChildNodeByIndex:function(a,b){return a.childNodes[b]}})}(a),a.views.View=b.extend({constructor:function(a,b,c){this.parent=a,this.element=b,this.config=c,this.config.noTextarea||this._observeViewChange()},_observeViewChange:function(){var a=this;this.parent.on("beforeload",function(){a.parent.on("change_view",function(b){b===a.name?(a.parent.currentView=a,a.show(),setTimeout(function(){a.focus()},0)):a.hide()})})},focus:function(){if(!this.element||!this.element.ownerDocument||this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element&&this.element.focus()}catch(a){}},hide:function(){this.element.style.display="none"},show:function(){this.element.style.display=""},disable:function(){this.element.setAttribute("disabled","disabled")},enable:function(){this.element.removeAttribute("disabled")}}),function(a){var b=a.dom,c=a.browser;a.views.Composer=a.views.View.extend({name:"composer",constructor:function(a,b,c){this.base(a,b,c),this.config.noTextarea?this.editableArea=b:this.textarea=this.parent.textarea,this.config.contentEditableMode?this._initContentEditableArea():this._initSandbox()},clear:function(){this.element.innerHTML=c.displaysCaretInEmptyContentEditableCorrectly()?"":"
    "},getValue:function(b,c){var d=this.isEmpty()?"":a.quirks.getCorrectInnerHTML(this.element);return b!==!1&&(d=this.parent.parse(d,c===!1?!1:!0)),d},setValue:function(a,b){b!==!1&&(a=this.parent.parse(a));try{this.element.innerHTML=a}catch(c){this.element.innerText=a}},cleanUp:function(a){var b;this.selection&&this.selection.isInThisEditable()&&(b=rangy.saveSelection(this.win)),this.parent.parse(this.element,void 0,a),b&&rangy.restoreSelection(b)},show:function(){this.editableArea.style.display=this._displayStyle||"",this.config.noTextarea||this.textarea.element.disabled||(this.disable(),this.enable())},hide:function(){this._displayStyle=b.getStyle("display").from(this.editableArea),"none"===this._displayStyle&&(this._displayStyle=null),this.editableArea.style.display="none"},disable:function(){this.parent.fire("disable:composer"),this.element.removeAttribute("contentEditable")},enable:function(){this.parent.fire("enable:composer"),this.element.setAttribute("contentEditable","true")},focus:function(b){a.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear(),this.base();var c=this.element.lastChild;b&&c&&this.selection&&("BR"===c.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getScrollPos:function(){if(this.doc&&this.win){var a={};return"undefined"!=typeof this.win.pageYOffset?a.y=this.win.pageYOffset:a.y=(this.doc.documentElement||this.doc.body.parentNode||this.doc.body).scrollTop,"undefined"!=typeof this.win.pageXOffset?a.x=this.win.pageXOffset:a.x=(this.doc.documentElement||this.doc.body.parentNode||this.doc.body).scrollLeft,a}},setScrollPos:function(a){a&&"undefined"!=typeof a.x&&"undefined"!=typeof a.y&&this.win.scrollTo(a.x,a.y)},getTextContent:function(){return b.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==(this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder"))&&this.placeholderSet},isEmpty:function(){var a=this.element.innerHTML.toLowerCase();return/^(\s|
    |<\/br>|

    |<\/p>)*$/i.test(a)||""===a||"
    "===a||"

    "===a||"


    "===a||this.hasPlaceholderSet()},_initContentEditableArea:function(){var a=this;this.config.noTextarea?this.sandbox=new b.ContentEditableArea(function(){a._create()},{className:this.config.classNames.sandbox},this.editableArea):(this.sandbox=new b.ContentEditableArea(function(){a._create()},{className:this.config.classNames.sandbox}),this.editableArea=this.sandbox.getContentEditable(),b.insert(this.editableArea).after(this.textarea.element),this._createWysiwygFormField())},_initSandbox:function(){var a=this;this.sandbox=new b.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets,className:this.config.classNames.sandbox}),this.editableArea=this.sandbox.getIframe();var c=this.textarea.element;b.insert(this.editableArea).after(c),this._createWysiwygFormField()},_createWysiwygFormField:function(){if(this.textarea.element.form){var a=document.createElement("input");a.type="hidden",a.name="_wysihtml5_mode",a.value=1,b.insert(a).after(this.textarea.element); +}},_create:function(){var d=this;this.doc=this.sandbox.getDocument(),this.win=this.sandbox.getWindow(),this.element=this.config.contentEditableMode?this.sandbox.getContentEditable():this.doc.body,this.config.noTextarea?this.cleanUp():(this.textarea=this.parent.textarea,this.element.innerHTML=this.textarea.getValue(!0,!1)),this.selection=new a.Selection(this.parent,this.element,this.config.classNames.uneditableContainer),this.commands=new a.Commands(this.parent),this.config.noTextarea||b.copyAttributes(["className","spellcheck","title","lang","dir","accessKey"]).from(this.textarea.element).to(this.element),this._initAutoLinking(),b.addClass(this.element,this.config.classNames.composer),this.config.style&&!this.config.contentEditableMode&&this.style(),this.observe();var e=this.config.name;e&&(b.addClass(this.element,e),this.config.contentEditableMode||b.addClass(this.editableArea,e)),this.enable(),!this.config.noTextarea&&this.textarea.element.disabled&&this.disable();var f="string"==typeof this.config.placeholder?this.config.placeholder:this.config.noTextarea?this.editableArea.getAttribute("data-placeholder"):this.textarea.element.getAttribute("placeholder");f&&b.simulatePlaceholder(this.parent,this,f,this.config.classNames.placeholder),this.commands.exec("styleWithCSS",!1),this._initObjectResizing(),this._initUndoManager(),this._initLineBreaking(),this.config.noTextarea||!this.textarea.element.hasAttribute("autofocus")&&document.querySelector(":focus")!=this.textarea.element||c.isIos()||setTimeout(function(){d.focus(!0)},100),c.clearsContentEditableCorrectly()||a.quirks.ensureProperClearing(this),this.initSync&&this.config.sync&&this.initSync(),this.config.noTextarea||this.textarea.hide(),this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var d=this,e=c.canDisableAutoLinking(),f=c.doesAutoLinkingInContentEditable();if(e&&this.commands.exec("AutoUrlDetect",!1,!1),this.config.autoLink){(!f||f&&e)&&(this.parent.on("newword:composer",function(){if(b.getTextContent(d.element).match(b.autoLink.URL_REG_EXP)){for(var c=d.selection.getSelectedNode(),e=d.element.querySelectorAll("."+d.config.classNames.uneditableContainer),f=!1,g=e.length;g--;)a.dom.contains(e[g],c)&&(f=!0);f||b.autoLink(c,[d.config.classNames.uneditableContainer])}}),b.observe(this.element,"blur",function(){b.autoLink(d.element,[d.config.classNames.uneditableContainer])}));var g=this.sandbox.getDocument().getElementsByTagName("a"),h=b.autoLink.URL_REG_EXP,i=function(c){var d=a.lang.string(b.getTextContent(c)).trim();return"www."===d.substr(0,4)&&(d="http://"+d),d};b.observe(this.element,"keydown",function(a){if(g.length){var c,e=d.selection.getSelectedNode(a.target.ownerDocument),f=b.getParentElement(e,{query:"a"},4);f&&(c=i(f),setTimeout(function(){var a=i(f);a!==c&&a.match(h)&&f.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){if(this.commands.exec("enableObjectResizing",!0),c.supportsEvent("resizeend")){var d=["width","height"],e=d.length,f=this.element;b.observe(f,"resizeend",function(b){var c,g=b.target||b.srcElement,h=g.style,i=0;if("IMG"===g.nodeName){for(;e>i;i++)c=d[i],h[c]&&(g.setAttribute(c,parseInt(h[c],10)),h[c]="");a.quirks.redraw(f)}})}},_initUndoManager:function(){this.undoManager=new a.UndoManager(this.parent)},_initLineBreaking:function(){function d(a){var c=b.getParentElement(a,{query:"p, div"},2);c&&b.contains(e.element,c)&&e.selection.executeAndRestoreRangy(function(){e.config.useLineBreaks?((!c.firstChild||c.firstChild===c.lastChild&&1===c.firstChild.nodeType&&c.firstChild.classList.contains("rangySelectionBoundary"))&&c.appendChild(e.doc.createElement("br")),b.replaceWithChildNodes(c)):"P"!==c.nodeName&&b.renameElement(c,"p")})}var e=this,f="li, p, h1, h2, h3, h4, h5, h6",g="ul, ol, menu";this.config.useLineBreaks||b.observe(this.element,["focus"],function(){e.isEmpty()&&setTimeout(function(){var a=e.doc.createElement("P");e.element.innerHTML="",e.element.appendChild(a),c.displaysCaretInEmptyContentEditableCorrectly()?e.selection.selectNode(a,!0):(a.innerHTML="
    ",e.selection.setBefore(a.firstChild))},0)}),b.observe(this.element,"keydown",function(c){var h=c.keyCode;if(!(c.shiftKey||c.ctrlKey||c.defaultPrevented||h!==a.ENTER_KEY&&h!==a.BACKSPACE_KEY)){var i=b.getParentElement(e.selection.getSelectedNode(),{query:f},4);return i?void setTimeout(function(){var c,f=e.selection.getSelectedNode();if("LI"===i.nodeName){if(!f)return;c=b.getParentElement(f,{query:g},2),c||d(f)}h===a.ENTER_KEY&&i.nodeName.match(/^H[1-6]$/)&&d(f)},0):void(e.config.useLineBreaks&&h===a.ENTER_KEY&&!a.browser.insertsLineBreaksOnReturn()&&(c.preventDefault(),e.commands.exec("insertLineBreak")))}})}})}(a),function(a){var b=a.dom,c=document,d=window,e=c.createElement("div"),f=["background-color","color","cursor","font-family","font-size","font-style","font-variant","font-weight","line-height","letter-spacing","text-align","text-decoration","text-indent","text-rendering","word-break","word-wrap","word-spacing"],g=["background-color","border-collapse","border-bottom-color","border-bottom-style","border-bottom-width","border-left-color","border-left-style","border-left-width","border-right-color","border-right-style","border-right-width","border-top-color","border-top-style","border-top-width","clear","display","float","margin-bottom","margin-left","margin-right","margin-top","outline-color","outline-offset","outline-width","outline-style","padding-left","padding-right","padding-top","padding-bottom","position","top","left","right","bottom","z-index","vertical-align","text-align","-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing","-webkit-box-shadow","-moz-box-shadow","-ms-box-shadow","box-shadow","-webkit-border-top-right-radius","-moz-border-radius-topright","border-top-right-radius","-webkit-border-bottom-right-radius","-moz-border-radius-bottomright","border-bottom-right-radius","-webkit-border-bottom-left-radius","-moz-border-radius-bottomleft","border-bottom-left-radius","-webkit-border-top-left-radius","-moz-border-radius-topleft","border-top-left-radius","width","height"],h=["html { height: 100%; }","body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }","body > p:first-child { margin-top: 0; }","._wysihtml5-temp { display: none; }",a.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],i=function(a){if(a.setActive)try{a.setActive()}catch(e){}else{var f=a.style,g=c.documentElement.scrollTop||c.body.scrollTop,h=c.documentElement.scrollLeft||c.body.scrollLeft,i={position:f.position,top:f.top,left:f.left,WebkitUserSelect:f.WebkitUserSelect};b.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(a),a.focus(),b.setStyles(i).on(a),d.scrollTo&&d.scrollTo(h,g)}};a.views.Composer.prototype.style=function(){var d,j=this,k=c.querySelector(":focus"),l=this.textarea.element,m=l.hasAttribute("placeholder"),n=m&&l.getAttribute("placeholder"),o=l.style.display,p=l.disabled;this.focusStylesHost=e.cloneNode(!1),this.blurStylesHost=e.cloneNode(!1),this.disabledStylesHost=e.cloneNode(!1),m&&l.removeAttribute("placeholder"),l===k&&l.blur(),l.disabled=!1,l.style.display=d="none",(l.getAttribute("rows")&&"auto"===b.getStyle("height").from(l)||l.getAttribute("cols")&&"auto"===b.getStyle("width").from(l))&&(l.style.display=d=o),b.copyStyles(g).from(l).to(this.editableArea).andTo(this.blurStylesHost),b.copyStyles(f).from(l).to(this.element).andTo(this.blurStylesHost),b.insertCSS(h).into(this.element.ownerDocument),l.disabled=!0,b.copyStyles(g).from(l).to(this.disabledStylesHost),b.copyStyles(f).from(l).to(this.disabledStylesHost),l.disabled=p,l.style.display=o,i(l),l.style.display=d,b.copyStyles(g).from(l).to(this.focusStylesHost),b.copyStyles(f).from(l).to(this.focusStylesHost),l.style.display=o,b.copyStyles(["display"]).from(l).to(this.editableArea);var q=a.lang.array(g).without(["display"]);return k?k.focus():l.blur(),m&&l.setAttribute("placeholder",n),this.parent.on("focus:composer",function(){b.copyStyles(q).from(j.focusStylesHost).to(j.editableArea),b.copyStyles(f).from(j.focusStylesHost).to(j.element)}),this.parent.on("blur:composer",function(){b.copyStyles(q).from(j.blurStylesHost).to(j.editableArea),b.copyStyles(f).from(j.blurStylesHost).to(j.element)}),this.parent.observe("disable:composer",function(){b.copyStyles(q).from(j.disabledStylesHost).to(j.editableArea),b.copyStyles(f).from(j.disabledStylesHost).to(j.element)}),this.parent.observe("enable:composer",function(){b.copyStyles(q).from(j.blurStylesHost).to(j.editableArea),b.copyStyles(f).from(j.blurStylesHost).to(j.element)}),this}}(a),function(a){var b=a.dom,c=b.domNode,d=a.browser,e={66:"bold",73:"italic",85:"underline"},f={addListeners:function(a,b,c){for(var d=0,e=b.length;e>d;d++)a.addEventListener(b[d],c,!1)},removeListeners:function(a,b,c){for(var d=0,e=b.length;e>d;d++)a.removeEventListener(b[d],c,!1)},fixLastBrDeletionInTable:function(b,c){if(b.selection.caretIsLastInSelection()){var d=b.selection.getSelection(),e=d.anchorNode;if(e&&1===e.nodeType&&(a.dom.getParentElement(e,{query:"td, th"},!1,b.element)||c)){var f=e.childNodes[d.anchorOffset];if(f&&1===f.nodeType&"BR"===f.nodeName)return f.parentNode.removeChild(f),!0}}return!1},handleUneditableDeletion:function(a){var b=a.selection.getBeforeSelection(!0);if(b&&("element"===b.type||"leafnode"===b.type)&&1===b.node.nodeType&&b.node.classList.contains(a.config.classNames.uneditableContainer)){if(f.fixLastBrDeletionInTable(a,!0))return!0;try{var c=new CustomEvent("wysihtml5:uneditable:delete",{bubbles:!0,cancelable:!1});b.node.dispatchEvent(c)}catch(d){}return b.node.parentNode.removeChild(b.node),!0}return!1},fixDeleteInTheBeginningOfBlock:function(b){var d=b.selection,e=d.getPreviousNode();if(d.caretIsFirstInSelection(a.browser.usesControlRanges())&&e&&1===e.nodeType&&a.dom.domNode(e).is.block()&&!c(e).test({query:"ol, ul, table, tr, dl"})){if(/^\s*$/.test(e.textContent||e.innerText))return e.parentNode.removeChild(e),!0;if(e.lastChild){var f=e.lastChild,g=d.getSelectedNode(),h=c(e).commonAncestor(g,b.element),i=a.dom.getParentElement(g,{query:"h1, h2, h3, h4, h5, h6, p, pre, div, blockquote"},!1,h||b.element);if(i)return c(i).transferContentTo(e,!0),d.setAfter(f),!0;if(a.browser.usesControlRanges())return g=d.getCaretNode(),c(g).transferContentTo(e,!0),d.setAfter(f),!0}}return!1},fixDeleteInTheBeginningOfLi:function(b){if(a.browser.hasLiDeletingProblem()){var d,e,f=b.selection.getSelection(),g=f.anchorNode,h=b.selection.caretIsFirstInSelection();if(3===g.nodeType&&0===f.anchorOffset&&g===g.parentNode.firstChild&&(g=g.parentNode,h=!0),h&&g&&1===g.nodeType&&"LI"===g.nodeName&&(d=c(g).prev({nodeTypes:[1,3],ignoreBlankTexts:!0}),d||!g.parentNode||"UL"!==g.parentNode.nodeName&&"OL"!==g.parentNode.nodeName||(d=c(g.parentNode).prev({nodeTypes:[1,3],ignoreBlankTexts:!0})),d))return e=g.firstChild,c(g).transferContentTo(d,!0),e?b.selection.setBefore(e):d&&(1===d.nodeType?d.lastChild?b.selection.setAfter(d.lastChild):b.selection.selectNode(d):b.selection.setAfter(d)),!0}return!1},fixDeleteInTheBeginningOfControlSelection:function(a){var b,d=a.selection,e=d.getPreviousNode(),f=d.getSelectedNode();return d.caretIsFirstInSelection()?(3===f.nodeType&&(f=f.parentNode),b=f.firstChild,c(f).transferContentTo(e,!0),b&&a.selection.setBefore(b),!0):!1},initTableHandling:function(){var b=function(){window.removeEventListener("load",b),this.doc.execCommand("enableObjectResizing",!1,"false"),this.doc.execCommand("enableInlineTableEditing",!1,"false")}.bind(this),c=function(){b.call(this),f.removeListeners(this.sandbox.getIframe(),["focus","mouseup","mouseover"],c)}.bind(this);this.doc.execCommand&&a.browser.supportsCommand(this.doc,"enableObjectResizing")&&a.browser.supportsCommand(this.doc,"enableInlineTableEditing")&&(this.sandbox.getIframe?f.addListeners(this.sandbox.getIframe(),["focus","mouseup","mouseover"],c):window.addEventListener("load",b)),this.tableSelection=a.quirks.tableCellsSelection(this.element,this.parent)},doLineBreaksModeEnterWithCaret:function(d){var e,f,g="p, pre, div, blockquote",h=!1;if(e=d.selection.getNodesNearCaret(),e&&((e.caretNode||e.nextNode)&&(f=b.getParentElement(e.caretNode||e.nextNode,{query:g},2),f===d.element&&(f=void 0)),f&&e.caretNode))if(c(e.caretNode).is.lineBreak()){if(d.config.doubleLineBreakEscapesBlock){h=!0,e.caretNode.parentNode.removeChild(e.caretNode),c(e.nextNode).is.lineBreak()&&e.nextNode.parentNode.removeChild(e.nextNode);var i=d.doc.createElement("br");c(e.nextNode).is.lineBreak()&&e.nextNode===f.lastChild?f.parentNode.insertBefore(i,f.nextSibling):d.selection.splitElementAtCaret(f,i),e.nextNode&&3===e.nextNode.nodeType&&(e.nextNode.data=e.nextNode.data.replace(/^ *[\r\n]+/,"")),d.selection.setBefore(i)}}else if(3===e.caretNode.nodeType&&a.browser.hasCaretBlockElementIssue()&&e.textOffset===e.caretNode.data.length&&!e.nextNode){h=!0;var j=d.doc.createElement("br"),k=d.doc.createElement("br"),l=d.doc.createDocumentFragment();l.appendChild(j),l.appendChild(k),d.selection.insertNode(l),d.selection.setBefore(k)}return h}},g=function(b,c){var d=c.selection;c.element;if(d.isCollapsed()){if(c.isEmpty()&&!c.config.useLineBreaks)return void b.preventDefault();if(f.handleUneditableDeletion(c))return void b.preventDefault();if(f.fixDeleteInTheBeginningOfLi(c))return void b.preventDefault();if(f.fixDeleteInTheBeginningOfBlock(c))return void b.preventDefault();if(f.fixLastBrDeletionInTable(c))return void b.preventDefault();if(a.browser.usesControlRanges()&&f.fixDeleteInTheBeginningOfControlSelection(c))return void b.preventDefault()}else d.containsUneditable()&&(b.preventDefault(),d.deleteContents())},h=function(a,b){if(b.config.useLineBreaks&&!a.shiftKey&&!a.ctrlKey){b.selection.isCollapsed()&&f.doLineBreaksModeEnterWithCaret(b)&&a.preventDefault()}},i=function(a,b,c){if(a.selection.isCollapsed()){if(a.selection.caretIsInTheBeginnig("li"))if(c){if(a.commands.exec("outdentList"))return}else if(a.commands.exec("indentList"))return}else a.selection.deleteContents();a.commands.exec("insertHTML"," ")},j=function(a){this.domNodeRemovedInterval&&clearInterval(domNodeRemovedInterval),this.parent.fire("destroy:composer")},k=function(a){this.parent.fire("beforeinteraction",a).fire("beforeinteraction:composer",a),setTimeout(function(){this.parent.fire("interaction",a).fire("interaction:composer",a)}.bind(this),0)},l=function(a){this.parent.fire("focus",a).fire("focus:composer",a),setTimeout(function(){this.focusState=this.getValue(!1,!1)}.bind(this),0)},m=function(a){if(this.focusState!==this.getValue(!1,!1)){var b=a;"function"==typeof Object.create&&(b=Object.create(a,{type:{value:"change"}})),this.parent.fire("change",b).fire("change:composer",b)}this.parent.fire("blur",a).fire("blur:composer",a)},n=function(a){this.parent.fire(a.type,a).fire(a.type+":composer",a),"paste"===a.type&&setTimeout(function(){this.parent.fire("newword:composer")}.bind(this),0)},o=function(b){this.config.copyedFromMarking&&(a.browser.supportsModernPaste()&&(b.clipboardData.setData("text/html",this.config.copyedFromMarking+this.selection.getHtml()),b.clipboardData.setData("text/plain",this.selection.getPlainText()),b.preventDefault()),this.parent.fire(b.type,b).fire(b.type+":composer",b))},p=function(b){var c=b.keyCode;(c===a.SPACE_KEY||c===a.ENTER_KEY)&&this.parent.fire("newword:composer")},q=function(b){if(!d.canSelectImagesInContentEditable()){var c=b.target,e=this.element.querySelectorAll("img"),f=this.element.querySelectorAll("."+this.config.classNames.uneditableContainer+" img"),g=a.lang.array(e).without(f);"IMG"===c.nodeName&&a.lang.array(g).contains(c)&&this.selection.selectNode(c)}a.browser.usesControlRanges()&&(this.selection.lastMouseDownPos={x:b.clientX,y:b.clientY},setTimeout(function(){delete this.selection.lastMouseDownPos}.bind(this),0))},r=function(a){var b=(a.target,this.selection.lastMouseDownPos);if(b){var c=document.body.createTextRange();setTimeout(function(){try{c.moveToPoint(b.x,b.y),c.select()}catch(a){}}.bind(this),0)}},s=function(b){if(this.config.classNames.uneditableContainer){var c=a.dom.getParentElement(b.target,{query:"."+this.config.classNames.uneditableContainer},!1,this.element);c&&this.selection.setAfter(c)}},t=function(a){d.canSelectImagesInContentEditable()||setTimeout(function(){this.selection.getSelection().removeAllRanges()}.bind(this),0)},u=function(b){var c,d,f=b.keyCode,j=e[f];return!b.ctrlKey&&!b.metaKey||b.altKey||65!==f?((b.ctrlKey||b.metaKey)&&!b.altKey&&j&&(this.commands.exec(j),b.preventDefault()),f===a.BACKSPACE_KEY&&g(b,this),(f===a.BACKSPACE_KEY||f===a.DELETE_KEY)&&(c=this.selection.getSelectedNode(!0),c&&"IMG"===c.nodeName&&(b.preventDefault(),d=c.parentNode,d.removeChild(c),"A"!==d.nodeName||d.firstChild||d.parentNode.removeChild(d),setTimeout(function(){a.quirks.redraw(this.element)}.bind(this),0))),this.config.handleTabKey&&f===a.TAB_KEY&&(b.preventDefault(),i(this,this.element,b.shiftKey)),void(f===a.ENTER_KEY&&h(b,this))):(this.selection.selectAll(),void b.preventDefault())};a.views.Composer.prototype.observeActions=f,a.views.Composer.prototype.observe=function(){var c=this.sandbox.getIframe?this.sandbox.getIframe():this.sandbox.getContentEditable(),e=(this.element,d.supportsEventsInIframeCorrectly()||this.sandbox.getContentEditable?this.element:this.sandbox.getWindow());this.focusState=this.getValue(!1,!1),c.addEventListener(["DOMNodeRemoved"],j.bind(this),!1),d.supportsMutationEvents()||(this.domNodeRemovedInterval=setInterval(function(){b.contains(document.documentElement,c)||j.call(this)},250)),this.config.handleTables&&f.initTableHandling.call(this),f.addListeners(e,["drop","paste","mouseup","focus","keyup"],k.bind(this)),e.addEventListener("focus",l.bind(this),!1),e.addEventListener("blur",m.bind(this),!1),f.addListeners(this.element,["drop","paste","beforepaste"],n.bind(this),!1),this.element.addEventListener("copy",o.bind(this),!1),this.element.addEventListener("mousedown",q.bind(this),!1),this.element.addEventListener("click",s.bind(this),!1),this.element.addEventListener("drop",t.bind(this),!1),this.element.addEventListener("keyup",p.bind(this),!1),this.element.addEventListener("keydown",u.bind(this),!1),a.browser.usesControlRanges()&&this.element.addEventListener("mscontrolselect",r.bind(this),!1),this.element.addEventListener("dragenter",function(){this.parent.fire("unset_placeholder")}.bind(this),!1)}}(a),function(a){var c=400;a.views.Synchronizer=b.extend({constructor:function(a,b,c){this.editor=a,this.textarea=b,this.composer=c,this._observe()},fromComposerToTextarea:function(b){this.textarea.setValue(a.lang.string(this.composer.getValue(!1,!1)).trim(),b)},fromTextareaToComposer:function(a){var b=this.textarea.getValue(!1,!1);b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(a){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(a):this.fromComposerToTextarea(a)},_observe:function(){var b,d=this,e=this.textarea.element.form,f=function(){b=setInterval(function(){d.fromComposerToTextarea()},c)},g=function(){clearInterval(b),b=null};f(),e&&(a.dom.observe(e,"submit",function(){d.sync(!0)}),a.dom.observe(e,"reset",function(){setTimeout(function(){d.fromTextareaToComposer()},0)})),this.editor.on("change_view",function(a){"composer"!==a||b?"textarea"===a&&(d.fromComposerToTextarea(!0),g()):(d.fromTextareaToComposer(!0),f())}),this.editor.on("destroy:composer",g)}})}(a),function(a){a.views.SourceView=b.extend({constructor:function(a,b){this.editor=a,this.composer=b,this._observe()},switchToTextarea:function(a){var b=this.composer.win.getComputedStyle(this.composer.element),c=parseFloat(b.width),d=Math.max(parseFloat(b.height),100);this.textarea||(this.textarea=this.composer.doc.createElement("textarea"),this.textarea.className="wysihtml5-source-view"),this.textarea.style.width=c+"px",this.textarea.style.height=d+"px",this.textarea.value=this.editor.getValue(a,!0),this.composer.element.parentNode.insertBefore(this.textarea,this.composer.element),this.editor.currentView="source",this.composer.element.style.display="none"},switchToComposer:function(a){var b=this.textarea.value;b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder")),this.textarea.parentNode.removeChild(this.textarea),this.editor.currentView=this.composer,this.composer.element.style.display=""},_observe:function(){this.editor.on("change_view",function(a){"composer"===a?this.switchToComposer(!0):"textarea"===a&&this.switchToTextarea(!0)}.bind(this))}})}(a),a.views.Textarea=a.views.View.extend({name:"textarea",constructor:function(a,b,c){this.base(a,b,c),this._observe()},clear:function(){this.element.value=""},getValue:function(a){var b=this.isEmpty()?"":this.element.value;return a!==!1&&(b=this.parent.parse(b)),b},setValue:function(a,b){b!==!1&&(a=this.parent.parse(a)),this.element.value=a},cleanUp:function(a){var b=this.parent.parse(this.element.value,void 0,a);this.element.value=b},hasPlaceholderSet:function(){var b=a.browser.supportsPlaceholderAttributeOn(this.element),c=this.element.getAttribute("placeholder")||null,d=this.element.value,e=!d;return b&&e||d===c},isEmpty:function(){return!a.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var b=this.element,c=this.parent,d={focusin:"focus",focusout:"blur"},e=a.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];c.on("beforeload",function(){a.dom.observe(b,e,function(a){var b=d[a.type]||a.type;c.fire(b).fire(b+":textarea")}),a.dom.observe(b,["paste","drop"],function(){setTimeout(function(){c.fire("paste").fire("paste:textarea")},0)})})}}),function(a){var b,c={name:b,style:!0,toolbar:b,showToolbarAfterInit:!0,showToolbarDialogsOnSelection:!0,autoLink:!0,handleTables:!0,handleTabKey:!0,parserRules:{tags:{br:{},span:{},div:{},p:{},b:{},i:{},u:{}},classes:{}},pasteParserRulesets:null,parser:a.dom.parse,useLineBreaks:!0,doubleLineBreakEscapesBlock:!0,stylesheets:[],placeholderText:b,supportTouchDevices:!0,cleanUp:!0,contentEditableMode:!1,classNames:{composer:"wysihtml5-editor",body:"wysihtml5-supported",sandbox:"wysihtml5-sandbox",placeholder:"wysihtml5-placeholder",uneditableContainer:"wysihtml5-uneditable-container"},copyedFromMarking:''};a.Editor=a.lang.Dispatcher.extend({constructor:function(b,d){if(this.editableElement="string"==typeof b?document.getElementById(b):b,this.config=a.lang.object({}).merge(c).merge(d).get(),this._isCompatible=a.browser.supported(),d&&d.classNames&&a.lang.object(this.config.classNames).merge(d.classNames),"textarea"!=this.editableElement.nodeName.toLowerCase()&&(this.config.contentEditableMode=!0,this.config.noTextarea=!0),this.config.noTextarea||(this.textarea=new a.views.Textarea(this,this.editableElement,this.config),this.currentView=this.textarea),!this._isCompatible||!this.config.supportTouchDevices&&a.browser.isTouchDevice()){var e=this;return void setTimeout(function(){e.fire("beforeload").fire("load")},0)}a.dom.addClass(document.body,this.config.classNames.body),this.composer=new a.views.Composer(this,this.editableElement,this.config),this.currentView=this.composer,"function"==typeof this.config.parser&&this._initParser(),this.on("beforeload",this.handleBeforeLoad)},handleBeforeLoad:function(){if(this.config.noTextarea?this.sourceView=new a.views.SourceView(this,this.composer):this.synchronizer=new a.views.Synchronizer(this,this.textarea,this.composer),this.config.toolbar){if("undefined"==typeof a.toolbar)throw Error("Toolbar not found. Make sure you're loading wysihtml-toolbar.js or wysihtml-toolbar.min.js");this.toolbar=new a.toolbar.Toolbar(this,this.config.toolbar,this.config.showToolbarAfterInit)}},isCompatible:function(){return this._isCompatible},clear:function(){return this.currentView.clear(),this},getValue:function(a,b){return this.currentView.getValue(a,b)},setValue:function(a,b){return this.fire("unset_placeholder"),a?(this.currentView.setValue(a,b),this):this.clear()},cleanUp:function(a){this.currentView.cleanUp(a)},focus:function(a){return this.currentView.focus(a),this},disable:function(){return this.currentView.disable(),this},enable:function(){return this.currentView.enable(),this},isEmpty:function(){return this.currentView.isEmpty()},hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},destroy:function(){this.composer&&this.composer.sandbox&&this.composer.sandbox.destroy(),this.toolbar&&this.toolbar.destroy(),this.off()},parse:function(b,c,d){var e=this.config.contentEditableMode?document:this.composer?this.composer.sandbox.getDocument():null,f=this.config.parser(b,{rules:d||this.config.parserRules,cleanUp:this.config.cleanUp,context:e,uneditableClass:this.config.classNames.uneditableContainer,clearInternals:c});return"object"==typeof b&&a.quirks.redraw(b),f},_initParser:function(){var b;a.browser.supportsModernPaste()?this.on("paste:composer",function(c){c.preventDefault(),b=a.dom.getPastedHtml(c),b&&this._cleanAndPaste(b)}.bind(this)):this.on("beforepaste:composer",function(b){b.preventDefault();var c=this.composer.getScrollPos();a.dom.getPastedHtmlWithDiv(this.composer,function(a){a&&this._cleanAndPaste(a),this.composer.setScrollPos(c)}.bind(this))}.bind(this))},_cleanAndPaste:function(b){var c=a.quirks.cleanPastedHTML(b,{referenceNode:this.composer.element,rules:this.config.pasteParserRulesets||[{set:this.config.parserRules}],uneditableClass:this.config.classNames.uneditableContainer});this.composer.selection.deleteContents(),this.composer.selection.insertHTML(c)}})}(a)}); //# sourceMappingURL=wysihtml.min.map \ No newline at end of file diff --git a/dist/wysihtml.min.map b/dist/wysihtml.min.map index f632a9d..220c026 100644 --- a/dist/wysihtml.min.map +++ b/dist/wysihtml.min.map @@ -1 +1 @@ -{"version":3,"file":"wysihtml.min.js","sources":["wysihtml.js"],"names":["wysihtml5","version","commands","dom","quirks","toolbar","lang","selection","views","INVISIBLE_SPACE","INVISIBLE_SPACE_REG_EXP","VOID_ELEMENTS","EMPTY_FUNCTION","ELEMENT_NODE","TEXT_NODE","BACKSPACE_KEY","ENTER_KEY","ESCAPE_KEY","SPACE_KEY","TAB_KEY","DELETE_KEY","polyfills","win","doc","nativeCustomEventSupported","p","CustomEvent","detail","foo","type","e","String","prototype","trim","rtrim","this","replace","s_add","s_rem","Element","on","fn","self","attachEvent","event","target","srcElement","preventDefault","returnValue","stopPropagation","cancelBubble","which","button","keyCode","call","detachEvent","Object","defineProperty","getOwnPropertyDescriptor","get","innerText","set","s","Array","isArray","arg","toString","indexOf","a","f","c","length","r","d","Function","bind","oThis","TypeError","aArgs","slice","arguments","fToBind","fNOP","fBound","apply","concat","ELEMENT","matches","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","selector","element","elements","document","ownerDocument","querySelectorAll","index","closest","parentElement","createElement","testElement","classList","add","contains","createMethod","method","original","DOMTokenList","token","i","len","toggle","_toggle","force","view","classListProp","protoProp","elemCtrProto","objCtr","strTrim","arrIndexOf","item","DOMEx","message","name","code","DOMException","checkTokenAndGetIndex","test","ClassList","elem","trimmedClasses","getAttribute","classes","split","push","_updateClassName","setAttribute","classListProto","classListGetter","Error","tokens","l","updated","remove","splice","result","join","classListPropDesc","enumerable","configurable","ex","number","__defineGetter__","normalizeHasCaretError","window","ret","t1","createTextNode","t2","t3","createRange","appendChild","body","setStart","setEnd","getSelection","removeAllRanges","addRange","normalize","childNodes","anchorNode","firstChild","anchorOffset","parentNode","removeChild","getTextNodes","node","all","nextSibling","nodeType","isInDom","n","normalizeFix","nf","Node","texts","defaultView","anode","aoffset","aelement","undefined","fnode","focusNode","foffset","focusOffset","felement","prevTxt","shift","curText","nodeValue","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","previousSibling","F","removeEventListener","readyState","addEventListener","customEventSupported","params","bubbles","cancelable","evt","createEvent","initCustomEvent","Event","factory","root","define","amd","module","exports","rangy","isHostMethod","o","t","FUNCTION","OBJECT","isHostObject","isHostProperty","UNDEFINED","createMultiplePropertyTest","testFunc","props","isTextRange","range","areHostMethods","textRangeMethods","areHostProperties","textRangeProperties","getBody","getElementsByTagName","consoleLog","msg","console","log","alertOrLog","shouldAlert","isBrowser","alert","fail","reason","api","initialized","supported","config","alertOnFail","warn","alertOnWarn","getErrorDesc","description","init","testRange","implementsDomRange","implementsTextRange","domRangeMethods","domRangeProperties","nodeName","toLowerCase","createTextRange","features","errorMessage","moduleName","modules","Module","initListeners","deprecationNotice","deprecated","replacement","createAliasForDeprecatedMethod","owner","util","toArray","shim","shimListeners","dependencies","initializer","createModule","initFunc","newModule","stack","RangePrototype","SelectionPrototype","areHostObjects","forEach","arr","func","preferTextRange","autoInitialize","rangyAutoInitialize","extend","hasOwnProperty","obj","deep","createOptions","optionsParam","defaults","options","el","arrayLike","addListener","eventType","listener","addInitListener","addShimListener","createMissingNativeApi","requiredModule","requiredModuleNames","createError","createCoreModule","rangePrototype","selectionPrototype","isHtmlNamespace","ns","namespaceURI","UNDEF","parent","getNodeIndex","getNodeLength","getCommonAncestor","node1","node2","ancestors","arrayContains","isAncestorOf","ancestor","descendant","selfIsAncestor","isOrIsAncestorOf","getClosestAncestorIn","isCharacterDataNode","isTextOrCommentNode","insertAfter","precedingNode","nextNode","insertBefore","splitDataNode","positionsToPreserve","newNode","cloneNode","deleteData","position","offset","getDocument","getWindow","parentWindow","getIframeDocument","iframeEl","contentDocument","contentWindow","getIframeWindow","isWindow","getContentDocument","methodName","tagName","getRootContainer","comparePoints","nodeA","offsetA","nodeB","offsetB","nodeC","childA","childB","isBrokenNode","inspectNode","crashyTextNodes","data","idAttr","id","innerHTML","fragmentFromNodeChildren","child","fragment","createDocumentFragment","createTestElement","html","contentEditable","bodyFirstChild","removeNode","NodeIterator","_next","createIterator","DomPosition","codeName","textNode","val","getComputedStyleProperty","getComputedStyle","propName","documentElement","currentStyle","_current","hasNext","next","detach","equals","pos","inspect","INDEX_SIZE_ERR","HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INVALID_STATE_ERR","INVALID_NODE_TYPE_ERR","isNonTextPartiallySelected","startContainer","endContainer","getRangeDocument","getRangeRoot","getBoundaryBeforeNode","getBoundaryAfterNode","insertNodeAtPosition","firstNodeInserted","rangesIntersect","rangeA","rangeB","touchingIsIntersecting","assertRangeValid","startComparison","startOffset","endOffset","endComparison","cloneSubtree","iterator","partiallySelected","subIterator","frag","isPartiallySelectedSubtree","getSubtreeIterator","iterateSubtree","rangeIterator","iteratorState","it","stop","subRangeIterator","deleteSubtree","extractSubtree","getNodesInRange","nodeTypes","filter","regex","filterNodeTypes","filterExists","RegExp","nodes","RangeIterator","sc","ec","getName","clonePartiallySelectedTextNodes","collapsed","so","eo","commonAncestorContainer","isSingleCharacterDataNode","_first","_last","createAncestorFinder","assertNoDocTypeNotationEntityAncestor","allowSelf","getDocTypeNotationEntityAncestor","assertValidNodeType","invalidTypes","assertValidOffset","assertSameDocumentOrFragment","getDocumentOrFragmentContainer","assertNodeNotReadOnly","getReadonlyAncestor","assertNode","isValidOffset","isRangeValid","splitRangeBoundaries","startEndSame","setStartAndEnd","rangeToHtml","container","cloneContents","copyComparisonConstantsToObject","START_TO_START","s2s","START_TO_END","s2e","END_TO_END","e2e","END_TO_START","e2s","NODE_BEFORE","n_b","NODE_AFTER","n_a","NODE_BEFORE_AND_AFTER","n_b_a","NODE_INSIDE","n_i","copyComparisonConstants","constructor","createRangeContentRemover","remover","boundaryUpdater","boundary","reset","createPrototypeRange","createBeforeAfterNodeSetter","isBefore","isStart","beforeAfterNodeTypes","rootContainerNodeTypes","setRangeStart","setRangeEnd","args","setBoundary","setStartBefore","setStartAfter","setEndBefore","setEndAfter","collapse","selectNodeContents","selectNode","start","end","extractContents","deleteContents","canSurroundContents","boundariesInvalid","splitBoundaries","splitBoundariesPreservingPositions","normalizeBoundaries","sibling","mergeForward","appendData","mergeBackward","nodeLength","insertData","nodeIndex","normalizeStart","endNode","startNode","collapseToPoint","updateCollapsedAndCommonAncestor","updateBoundaries","Range","current","subRange","cloneRange","readonlyNodeTypes","insertableNodeTypes","surroundNodeTypes","styleEl","htmlParsingConforms","createContextualFragment","fragmentStr","rangeProperties","compareBoundaryPoints","how","prefixA","prefixB","insertNode","clone","surroundContents","content","hasChildNodes","lastChild","prop","textParts","compareNode","comparePoint","toHtml","intersectsNode","isPointInRange","intersectsRange","intersectsOrTouchesRange","intersection","intersectionRange","union","unionRange","containsNode","allowPartial","containsNodeContents","containsRange","containsNodeText","nodeRange","textNodes","getNodes","lastTextNode","pop","collapseBefore","collapseAfter","getBookmark","containerNode","preSelectionRange","moveToBookmark","bookmark","charIndex","nextCharIndex","nodeStack","foundStart","rangesEqual","isValid","r1","r2","DomRange","WrappedRange","WrappedTextRange","updateRangeProperties","nativeRange","updateNativeRange","startMoved","endMoved","nativeRangeDifferent","rangeProto","refresh","testTextNode","oppositeName","range2","createNativeRange","getTextRangeContainerElement","textRange","parentEl","duplicate","startEl","endEl","startEndContainer","textRangeIsCollapsed","compareEndPoints","getTextRangeBoundaryPosition","wholeRangeContainerElement","isCollapsed","startInfo","workingRange","containerElement","canHaveHTML","boundaryPosition","nodeInfo","workingNode","comparison","previousNode","boundaryNode","workingComparisonType","childNodeCount","moveToElementText","Math","floor","setEndPoint","tempRange","rangeLength","text","moveStart","createBoundaryTextRange","boundaryParent","boundaryOffset","nodeIsDataNode","startBoundary","rangeContainerElement","rangeToTextRange","startRange","endRange","toTextRange","globalObj","createRangyRange","isDirectionBackward","dir","WrappedSelection","getWinSelection","winParam","getDocSelection","winSelectionIsBackward","sel","backward","updateAnchorAndFocusFromRange","anchorPrefix","focusPrefix","updateAnchorAndFocusFromNativeSelection","nativeSel","nativeSelection","updateEmptySelection","rangeCount","_ranges","getNativeRange","rangeContainsSingleElement","rangeNodes","getSingleElementFromRange","updateFromTextRange","wrappedRange","updateControlSelection","docSelection","controlRange","addRangeToControlSelection","rangeElement","newControlRange","createControlRange","select","deleteProperties","detached","actOnCachedSelection","action","cached","cachedRangySelections","createControlSelection","ranges","assertNodeInSameDocument","createStartOrEndSetter","getRangeAt","setSingleRange","isBackward","rangeInspects","anchor","focus","checkSelectionRanges","getNativeSelection","selectionIsCollapsed","BOOLEAN","NUMBER","CONTROL","implementsWinGetSelection","implementsDocSelection","useDocumentSelection","isSelectionValid","testSelection","selectionHasAnchorAndFocus","selectionHasExtend","selectionHasRangeCount","selectionSupportsMultipleRanges","collapsedNonEditableSelectionsSupported","addRangeBackwardToNative","originalSelectionRangeCount","selectionHasMultipleRanges","originalSelectionRanges","originalSelectionBackward","testEl","chromeMatch","navigator","appVersion","match","parseInt","testControlRange","implementsControlRange","getSelectionRangeAt","docSel","selProto","addRangeBackward","direction","previousRangeCount","clonedNativeRange","selectionIsBackward","setRanges","empty","refreshSelection","checkForChanges","oldRanges","oldAnchorNode","oldAnchorOffset","removeRangeManually","getAllRanges","removeRange","removed","isBackwards","rangeTexts","collapseToStart","collapseToEnd","selectAllChildren","deleteFromDocument","eachRange","callMethodOnEachRange","results","changeEachRange","rangeBookmarks","rangeBookmark","selRanges","saveRanges","restoreRanges","rangeHtmls","getNativeTextRange","detachAll","Selection","docReady","loadHandler","require","defaultTokenizer","chars","wordOptions","createTokenRange","isWord","tokenRanges","wordStart","wordEnd","word","lastWordEnd","wordRegex","exec","includeTrailingSpace","nonLineBreakWhiteSpaceRegex","convertCharRangeToToken","tokenRange","tokenChars","tokenize","tokenizer","normalizeIgnoredCharacters","ignoredCharacters","ignoredChars","ignoredCharsArray","sort","char1","char2","charCodeAt","createWordOptions","language","defaultLanguage","defaultWordOptions","createNestedOptions","characterOptions","defaultCharacterOptions","getComputedDisplay","display","tableCssDisplayBlock","defaultDisplayValueForTag","isHidden","getAncestorsAndSelf","isVisibilityHiddenTextNode","isBlockNode","containsPositions","getAncestors","unshift","nextNodeDescendants","excludeChildren","previous","isWhitespaceNode","computedWhiteSpace","isCollapsedWhitespaceNode","isCollapsedNode","isIgnoredNode","Cache","store","createCachingGetter","objProperty","cache","cachedCount","uncachedCount","value","NodeWrapper","session","positions","Position","nodeWrapper","inspectPosition","startSession","endSession","currentSession","Session","getSession","createCharacterIterator","startPos","endPos","charPos","finished","previousVisible","nextVisible","previousTextPos","returnPreviousTextPos","character","getCharacter","rewind","dispose","createTokenizedTextProvider","consumeWord","forward","textChar","newChars","forwardIterator","backwardIterator","passedWordBoundary","insideWord","allWhiteSpaceRegex","forwardChars","backwardChars","reverse","forwardTokensBuffer","arrayIndexOf","backwardTokensBuffer","nextEndToken","lastToken","previousStartToken","movePositionBy","unit","count","currentPos","charIterator","nextPos","unitsMoved","newPos","absCount","abs","CHARACTER","WORD","tokenizedTextProvider","isLeadingSpace","isTrailingSpace","createRangeCharacterIterator","rangeStart","getRangeBoundaryPosition","rangeEnd","itStart","itEnd","getRangeCharacters","isWholeWord","expand","findTextFromPosition","initialPos","searchTerm","isRegex","searchScopeRange","findOptions","handleMatch","startIndex","endIndex","valid","wholeWordsOnly","currentChar","matchStartIndex","matchEndIndex","insideRegexMatch","caseSensitive","createEntryPointFunction","sessionRunning","createRangeBoundaryMover","moveOptions","defaultMoveOptions","boundaryIsStart","moveResult","createRangeTrimmer","trimCharCount","trimmed","createSelectionTrimmer","spacesRegex","spacesMinusLineBreaksRegex","trailingSpaceInBlockCollapses","trailingSpaceBeforeBrCollapses","trailingSpaceBeforeBlockCollapses","trailingSpaceBeforeLineBreakInPreLineCollapses","includeBlockContentTrailingSpace","includeSpaceBeforeBr","includeSpaceBeforeBlock","includePreLineTrailingSpace","ignoreCharacters","defaultCaretCharacterOptions","en","defaultFindOptions","withinRange","wrap","defaultExpandOptions","trimStart","trimEnd","defaultWordIteratorOptions","table","caption","colgroup","col","thead","tbody","tfoot","tr","td","th","key","nodeProto","getPosition","EMPTY","NON_SPACE","UNCOLLAPSIBLE_SPACE","COLLAPSIBLE_SPACE","TRAILING_SPACE_BEFORE_BLOCK","TRAILING_SPACE_IN_BLOCK","TRAILING_SPACE_BEFORE_BR","PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK","TRAILING_LINE_BREAK_AFTER_BR","INCLUDED_TRAILING_LINE_BREAK_AFTER_BR","getLength","isWhitespace","isCollapsedWhitespace","isIgnored","getTextNodeInfo","spaceRegex","collapseSpaces","cssWhitespace","preLine","hasInnerText","posAfterEl","firstPosInEl","prepopulateChar","isDefinitelyNonEmpty","isRenderedBlock","brs","getTrailingSpace","getNodeWrapper","getLeadingSpace","positionProto","characterType","isBr","prepopulatedChar","visibleChar","charType","finalizedChar","charAt","nodePassed","checkForTrailingSpace","checkForLeadingSpace","isCharInvariant","resolveLeadingAndTrailingSpaces","trailingSpace","leadingSpace","getPrecedingUncollapsedPosition","getPreviousPos","gotPreviousPos","previousPos","returnChar","thisChar","isIgnoredCharacter","cacheKey","cachedChar","collapsible","nextUncollapsed","nextOffset","previousOffset","createWrapperCache","nodeProperty","wrappersByProperty","wrapper","property","initCaches","uniqueIDSupported","elementCache","elementsCache","uniqueID","elWrapper","textNodeCache","otherNodeCache","wrapperCache","prefix","moveEnd","move","startTrimmed","endTrimmed","expandOptions","moved","endToken","newEndPos","startTokenizedTextProvider","startToken","newStartPos","endTokenizedTextProvider","selectCharacters","toCharacterRange","rangeStartsBeforeNode","rangeBetween","findText","searchTermParam","findResult","wrappedAround","pasteHtml","saveCharacterRanges","rangeInfos","characterRange","restoreCharacterRanges","saved","rangeInfo","createWordIterator","iteratorOptions","noMutation","createPosition","gEBI","getElementById","insertRangeBoundaryMarker","atStart","markerEl","markerId","Date","random","boundaryRange","style","lineHeight","className","markerTextChar","setRangeBoundary","compareRanges","saveRange","startMarkerId","endMarkerId","restoreRange","saveSelection","restored","restoreSelection","savedSelection","preserveDirection","removeMarkerElement","removeMarkers","Base","_instance","_static","_prototyping","proto","base","klass","_constructing","implement","valueOf","source","toSource","hidden","object","block","context","browser","iosVersion","userAgent","androidVersion","isIE","equation","re","rv","appName","parseFloat","$1","isGecko","isWebKit","isChrome","isOpera","USER_AGENT","hasContentEditableSupport","hasEditingApiSupport","execCommand","queryCommandSupported","queryCommandState","hasQuerySelectorSupport","querySelector","isIncompatibleMobileBrowser","isIos","isAndroid","isTouchDevice","supportsEvent","supportsSandboxedIframes","throwsMixedContentWarningWhenIframeSrcIsEmpty","displaysCaretInEmptyContentEditableCorrectly","hasCurrentStyleProperty","insertsLineBreaksOnReturn","supportsPlaceholderAttributeOn","eventName","supportsEventsInIframeCorrectly","supportsHTML5Tags","html5","supportsCommand","buggyCommands","formatBlock","insertUnorderedList","insertOrderedList","insertHTML","command","isBuggy","e1","queryCommandEnabled","e2","doesAutoLinkingInContentEditable","canDisableAutoLinking","clearsContentEditableCorrectly","supportsGetAttributeCorrectly","canSelectImagesInContentEditable","autoScrollsToCaret","autoClosesUnclosedTags","clonedTestElement","supportsNativeGetElementsByClassName","getElementsByClassName","supportsSelectionModify","needsSpaceAfterLineBreak","supportsSpeechApiOn","input","chromeVersion","crashesWhenDefineProperty","doesAsyncFocus","hasProblemsSettingCaretAfterImg","hasLiDeletingProblem","hasUndoInContextMenu","hasInsertNodeIssue","hasIframeFocusIssue","createsNestedInvalidMarkupAfterPaste","hasCaretBlockElementIssue","supportsMutationEvents","supportsModernPaste","fixStyleKey","usesControlRanges","array","needle","without","arrayToSubstract","newArr","newArray","map","callback","thisArg","A","unique","vals","max","idx","Dispatcher","handler","events","off","handlers","newHandlers","fire","payload","observe","stopObserving","merge","otherObj","isPlainObject","difference","diffObj","newObj","isFunction","Text","isEmpty","WHITE_SPACE_START","WHITE_SPACE_END","ENTITY_REG_EXP","ENTITY_MAP","&","<",">","\"","\t","string","str","interpolate","vars","by","search","escapeHTML","linebreaks","convertSpaces","autoLink","ignoreInClasses","_hasParentThatShouldBeIgnored","_parseNode","_convertUrlsToLinks","URL_REG_EXP","url","punctuation","TRAILING_CHAR_REG_EXP","opening","BRACKETS","realUrl","displayUrl","MAX_DISPLAY_LENGTH","substr","_getTempElement","tempElement","_wysihtml5_tempElement","_wrapMatchesInNode","IGNORE_URLS_IN","childNodesLength",")","]","}","addClass","hasClass","removeClass","elementClassName","convertToList","_createListItem","list","listItem","_createList","listType","uneditableClass","childNode","lineBreak","isBlockElement","isLineBreak","currentListItem","lineBreaks","lineBreaksLength","getStyle","from","insert","after","replaceChild","copyAttributes","attributesToCopy","elementToCopyFrom","to","elementToCopyTo","attribute","andTo","callee","BOX_SIZING_PROPERTIES","shouldIgnoreBoxSizingBorderBox","hasBoxSizingBorderBox","offsetWidth","copyStyles","stylesToCopy","cssText","setStyles","delegate","parents","domNode","defaultNodeTypes","is","emptyTextNode","ignoreWhitespace","regx","rangyBookmark","visible","isVisible","getTextContent","voidElement","query","prev","prevNode","types","ignoreBlankTexts","commonAncestor","parents1","parents2","lastLeafNode","leafClasses","escapeParent","newWrapper","split2","nodeWrap","curNode","transferContentTo","targetNode","removeOldWrapper","properties","classRegExp","styleProperty","hasOneStyle","styles","j","maxStyleP","styleValue","attr","getAttributes","attrList","hasOneAttribute","attributeValue","getAsDom","_innerHTMLShiv","_ensureHTML5Compatibility","_wysihtml5_supportsHTML5Tags","HTML5_ELEMENTS","getParentElement","levels","camelize","REG_EXP_CAMELIZE","toUpperCase","stylePropertyMapping","float","camelizedProperty","originalOverflow","needsOverflowReset","overflow","getPropertyValue","ingoreEmpty","textContent","hasElementWithTagName","_getDocumentIdentifier","_wysihtml5_identifier","DOCUMENT_IDENTIFIER","LIVE_CACHE","cacheEntry","hasElementWithClassName","elementToInsert","before","into","insertCSS","rules","styleElement","styleSheet","link","head","_isLineBreak","_isLineBreakOrBlockElement","eventNames","handlerWrapper","parse","elementOrHtml_current","config_current","elementOrHtml","currentRules","defaultRules","isString","clearInternals","selectors","_applySelectorRules","_convert","cleanUp","unjoinNbsps","txtnodes","getCorrectInnerHTML","oldNode","newChild","nodeDisplay","oldNodeType","oldChilds","oldChildsLength","NODE_TYPE_MAPPING","blockElements","DEFAULT_NODE_NAME","attributes","selectorRules","els","elementHandlingMethods","_handleElement","rule","renameTag","tagRules","tags","scopeName","_wysihtml5","outerHTML","unwrap","rename_tag","one_of_type","_testTypes","remove_action","remove_action_rename_to","_handleAttributes","_handleStyles","definition","type_definitions","_testType","classesLength","styleProp","nodeClasses","nodeStyles","methods","m","typeCeckMethods","WHITE_SPACE_REG_EXP","sp","attrs","v","keep_styles","styleFloat","cssFloat","_getAttributesBeginningWith","beginning","returnAttributes","_checkAttribute","attributeName","newAttributeValue","attributeCheckMethods","_checkAttributes","local_attributes","newValue","matchingAttributes","globalAttributes","checkAttributes","oldAttributes","imax","currentClass","newClass","setClass","set_class","add_class","addStyle","add_style","setAttributes","set_attributes","allowedClasses","newClasses","oldClasses","check_attributes","addClassMethods","addStyleMethods","newStyle","classes_blacklist","src","width","height","_handleText","_handleComment","comments","createComment","1","3","8","REG_EXP","href","alt","numbers","dimension","any","align_text","mapping","left","right","center","align_img","justify","clear_br","both","size_font","2","4","5","6","7","-","+","has_visible_contet","txt","visibleElements","offsetHeight","removeEmptyTextNodes","renameElement","newNodeName","newElement","replaceWithChildNodes","_isBlockElement","_appendLineBreak","resolveList","useLineBreaks","isLastChild","shouldAppendLineBreak","paragraph","isLastItem","lastListItem","lastElementChild","firstElementChild","windowProperties","windowProperties2","documentProperties","Sandbox","readyCallback","editableArea","_createIframe","insertInto","getIframe","_readyError","destroy","iframe","that","security","allowtransparency","frameborder","marginwidth","marginheight","onload","onreadystatechange","_onLoadIframe","iframeWindow","iframeDocument","charset","characterSet","sandboxHtml","_getHtml","stylesheets","open","write","close","onerror","fileName","lineNumber","_unset","loaded","setTimeout","templateVars","setter","__defineSetter__","ContentEditableArea","getContentEditable","_bindElement","_createElement","_loadElement","contentExists","innerHtml","simulatePlaceholder","editor","placeholderText","placeholderClassName","CLASS_NAME","unset","composerIsVisible","hasPlaceholderSet","clear","placeholderSet","setValue","setTextContent","HAS_GET_ATTRIBUTE_BUG","isLoadedImage","hasAttribute","specified","complete","queryInList","q","removeElement","referenceNode","tag","MapCell","cell","isColspan","isRowspan","firstCol","lastCol","firstRow","lastRow","isReal","spanCollection","modified","TableModifyerByCell","addSpannedCellToMap","cspan","rspan","spanCollect","rmax","cmax","rr","cc","setCellAsModified","smax","setTableMap","ridx","row","cells","cidx","tableRows","getTableRows","getRowCells","inlineTables","inlineCells","allCells","tableCells","inlineRows","allRows","getMapIndex","r_length","c_length","r_idx","c_idx","getElementAtIndex","getMapElsTo","to_cell","idx_start","idx_end","temp_idx","temp_cidx","maxr","maxc","orderSelectionEnds","secondcell","createCells","nr","correctColIndexForUnreals","corrIdx","getLastNewCellOnRow","rowLimit","removeEmptyTable","splitRowToCells","colspan","cType","newCells","removeAttribute","getRealRowEl","injectRowAt","new_cells","n_cidx","canMerge","decreaseCellSpan","span","removeSurplusLines","allRowspan","fillMissingCells","r_max","c_max","prevcell","rectify","unmerge","thisCell","rowspan","collapseCellToNextRow","cellIdx","newRowIdx","newIdx","lastCell","removeRowCell","getRowElementsByCell","modRow","getColumnElementsByCell","removeRow","oldRow","removeColCell","removeColumn","what","addRow","where","newRow","addRowCell","cr","colSpanAttr","addColumn","addColCell","doAdd","handleCellAddWithRowspan","modCell","temp_r_cells","nrow","addRowsNr","crow","getCellsBetween","cell1","cell2","c1","addCells","removeCells","mergeCellsBetween","unmergeCell","findCell","findRowByCell","findColumnByCell","thisOwner","otherOwner","point","location_index","smallest_common_ancestor","this_index","other_index","children","getPastedHtml","clipboardData","getData","getPastedHtmlWithDiv","composer","selBookmark","cleanerDiv","scrollPos","getScrollPos","top","y","x","setBookmark","removeInvisibleSpaces","cleanPastedHTML","styleToRegex","styleStr","trimmedStr","escapedStr","extendRulesWithStyleExceptions","exceptStyles","newRules","pickRuleset","ruleset","defaultSet","condition","newHtml","color","fontSize","ensureProperClearing","clearIfNecessary","TILDE_ESCAPED","urlToSearch","elementsWithTilde","redraw","tableCellsSelection","editable","handleMouseDown","handleSelectionMousedown","removeCellSelections","selection_class","handleMouseMove","handleMouseUp","selectedCells","addSelections","oldEnd","curTable","deselect","bindSideclick","sideClickHandler","selectCells","getColorParseMethod","colorStr","colorTypeConf","colorParseMethods","getColorFormat","rgba","rgb","hex6","radix","hex3","makeParamRegExp","styleParser","parseColor","stylesStr","paramName","paramsRegex","colorType","colorMatch","unparseColor","colorFormat","hexRadix","parseFontSize","_getCumulativeOffsetTop","offsetTop","offsetParent","getDepth","getRangeNode","getWebkitSelectionFixNode","blankNode","placeholderRemover","delayedPlaceholderRemover","minWidth","expandRangeToSurround","common","start_depth","end_depth","contain","unselectableClass","getRange","setSelection","setBefore","createTemporaryCaretSpaceAfter","caretPlaceholder","caretPlaceholderText","keyDownHandler","setAfter","ctrlKey","metaKey","zIndex","notVisual","fixWebkitSelection","lastSibling","activeElement","setScrollPos","avoidInvisibleSpace","isElement","displayStyle","getSelectedNode","fixSelBorders","getSelectedOwnNodes","getOwnRanges","ownNodes","maxi","findNodesInSelection","curNodes","filterElements","containsUneditable","uneditables","getOwnUneditables","deleteRangeContents","startParent","endParent","ev","dispatchEvent","err","getCaretNode","getPreviousNode","ignoreEmpty","getNodesNearCaret","caretNode","textOffset","getSelectionParentsByTag","curEl","getRangeToNodeEnd","sNode","lastR","caretIsLastInSelection","endc","endtxt","caretIsFirstInSelection","includeLineBreaks","ws","whiteSpace","caretIsInTheBeginnig","ofNode","getBeforeSelection","includePrevLeaves","inTmpCaret","rng","prevLeaf","executeAndRestoreRangy","restoreScrollPosition","executeAndRestore","newCaretPlaceholder","prevSibling","newRange","oldScrollTop","scrollTop","oldScrollLeft","scrollLeft","placeholderHtml","lastEditorElement","canAppendChild","anchorNodeTagNameLower","voidElements","splitElementAtCaret","contentAfterRangeStart","surround","nodeOptions","cssStyle","scrollIntoView","tolerance","hasScrollBars","scrollHeight","_wysihtml5ScrollIntoViewElement","selectLine","_selectLine_W3C","getBoundingClientRect","_selectLineUniversal","includeRangyRangeHelpers","isHelperNode","initialBoundry","modify","toLineBoundary","location","getRangeRect","rect","testNode","amount","testRect","found","isLineBreakingElement","pnode","bottom","getText","getOwnNodes","splitBounds","fixRangeOverflow","containment","_detectInlineRangeProblems","previousElementSibling","_endOffsetForNode","dontFix","allUneditables","deepUneditables","tmpRanges","tmpRange","jmax","selectAll","blankEndNode","blankStartNode","doSelect","notSelected","getHtml","getPlainText","isEndToEndInNode","nodeNames","isInThisEditable","cssClass","regExp","matchingClassNames","hasStyleAttr","removeStyle","s2","getMatchingStyleRegexp","regexes","sSplit","elStyle","isMatchingAllready","areMatchingAllready","removeOrChangeStyle","exactRegex","hasSameClasses","el1","el2","REG_EXP_WHITE_SPACE","replaceWithOwnChildren","elementsHaveSameNonClassAttributes","attr1","attr2","getNamedItem","isSplitPoint","splitNodeAt","descendantNode","descendantOffset","Merge","firstNode","isElementMerge","firstTextNode","HTMLApplier","tagNames","similarClassRegExp","similarStyleRegExp","defaultTagName","applyToAnyTagName","doMerge","textBits","getAncestorWithClass","cssClassMatch","getAncestorWithStyle","cssStyleMatch","getMatchingAncestor","matchType","postApply","currentMerge","precedingTextNode","lastNode","merges","rangeStartNode","rangeEndNode","rangeStartOffset","rangeEndOffset","getAdjacentMergeableTextNode","nextTextNode","adjacentNode","isTextNode","areElementsMergeable","createContainer","applyToTextNode","isRemovable","undoToTextNode","ancestorWithClass","ancestorWithStyle","styleMode","styleChanged","ancestorRange","applyToRange","ri","undoToRange","getTextSelectedByRange","isAppliedToRange","appliedType","coverage","selectedText","toggleRange","parentsExactMatch","isApplied","Commands","support","commandValue","state","stateValue","bold","formatInline","getOptions","createLink","opts","removeLink","size","fontSizeStyle","st","foreColor","foreColorStyle","colorVals","colString","bgColorStyle","correctOptionsForSimilarityCheck","isBlock","isBookmark","isLineBreaking","cleanup","newBlockElements","nbIdx","allElements","BLOCK_ELEMENTS","noEditQuery","classNames","uneditableContainer","defaultNodeName","findOuterBlock","allBlocks","UNNESTABLE_BLOCK_ELEMENTS","cloneOuterInlines","innerNode","INLINE_ELEMENTS","outerNode","applyOptionsToElement","removeOptionsFromElement","unwrapped","applySurroundingLineBreaks","unwrapBlocksFromContent","nextEl","prevEl","blocks","fixRangeCoverage","fixNotPermittedInsertionPoints","lis","maxj","rangePos","closestLI","newRanges","getOptionsWithNodename","defaultName","correctedOptions","injectFragmentToRange","firstOuterBlock","outerInlines","first","last","rangeStartContainer","fc","lc","clearRangeBlockFromating","closestBlockName","removeSurroundingLineBreaks","prevPrev","wrapRangeWithElement","similarOptions","isWhitespaceBefore","isWhitespaceAfter","similarOuterBlock","splitAllBlocks","trimBlankTextsAndBreaks","tmpEl","getParentBlockNodeName","expandCaretToBlock","insertingNodeName","selectElements","lastEl","lastOffset","formatSelection","parseOptions","caretIsOnEmptyLine","caretInfo","parentNodes","formatCode","classname","selectedNodes","pre","selectedNode","hasNoClass","hasNoStyle","hasNoAttributes","isSameNode","element1","element2","classes1","classes2","createWrapNode","defaultTag","containsSameAttributes","updateElementAttributes","newAttributes","fullContain","updateFormatOfElement","nodeNameQuery","nodeQueryMatch","queryAliasMap","getSelectedTextNodes","findSimilarTextNodeWrapper","exact","isSimilarNode","selectRange","selectTextNodes","lastText","selectTextNode","getState","searchNodes","partial","caretIsInsideWord","beforeChar","afterChar","getRangeForWord","offsetStart","offsetEnd","txtNodes","wordOffset","mergeContents","mergeConsequentSimilarElements","cleanupAndSetSelection","cleanupAndSetCaret","formatTextNode","wrapNode","unformatTextNode","newWrapNode","removeFormatFromTextNode","formatTextRange","updateFormat","wordObj","exactState","removeFormat","applyFormat","fixOptions","b","strong","em","insertBlockQuote","NODE_NAME","insertImage","image","imagesInSelection","LINE_BREAK","insertLineBreak","insertList","isNode","findListEl","other","parentLi","otherNodeName","handleSameTypeList","otherLists","innerLists","getListsInSelection","handleOtherTypeList","renameLists","createListFallback","tempClassName","getTime","cmd","italic","justifyCenter","justifyLeft","justifyRight","justifyFull","alignRightStyle","alignLeftStyle","alignCenterStyle","alignJustifyStyle","redo","undoManager","underline","undo","createTable","cols","rows","tableStyle","mergeTableCells","tableSelection","addTableCells","tableSelect","deleteTableCells","selCell","indentList","listEls","tryToPushLiLevel","liNodes","listTag","prevLi","liNode","prevLiList","outdentList","tryToPullLiLevel","listNode","outerListNode","outerLiNode","afterList","getAfterList","newList","subscript","superscript","Z_KEY","Y_KEY","MAX_HISTORY_ENTRIES","DATA_ATTR_NODE","DATA_ATTR_OFFSET","UndoManager","historyStr","historyDom","transact","_observe","lastKey","sandbox","altKey","isUndo","shiftKey","isRedo","previousHtml","currentHtml","getValue","getChildNodeIndex","undoPossible","redoPossible","historyEntry","getChildNodeByIndex","View","textareaElement","noTextarea","_observeViewChange","currentView","show","hide","disable","enable","Composer","editableElement","textarea","contentEditableMode","_initContentEditableArea","_initSandbox","_displayStyle","disabled","setToEnd","pageYOffset","pageXOffset","scrollTo","_create","_createWysiwygFormField","form","hiddenField","_initAutoLinking","placeholder","_initObjectResizing","_initUndoManager","_initLineBreaking","initSync","sync","supportsDisablingOfAutoLinking","supportsAutoLinking","nodeWithSelection","isInUneditable","links","urlRegExp","newTextContent","propertiesLength","adjust","USE_NATIVE_LINE_BREAK_INSIDE_TAGS","LIST_TAGS","defaultPrevented","blockElement","HOST_TEMPLATE","TEXT_FORMATTING","BOX_FORMATTING","ADDITIONAL_CSS_RULES","focusWithoutScrolling","setActive","elementStyle","originalScrollTop","originalScrollLeft","originalStyles","WebkitUserSelect","displayValueForCopying","originalActiveElement","hasPlaceholder","originalPlaceholder","originalDisplayValue","originalDisabled","focusStylesHost","blurStylesHost","disabledStylesHost","blur","boxFormattingStyles","shortcuts","66","73","85","actions","addListeners","removeListeners","fixLastBrDeletionInTable","aNode","handleUneditableDeletion","fixDeleteInTheBeginningOfBlock","selNode","commonAncestorNode","fixDeleteInTheBeginningOfLi","isInBeginnig","fixDeleteInTheBeginningOfControlSelection","afterCaretNode","initTableHandling","hideHandlers","iframeInitiator","doLineBreaksModeEnterWithCaret","breakNodes","doubleLineBreakEscapesBlock","brNode","br1","br2","handleDeleteKeyPress","handleEnterKeyPress","handleTabKeyDown","handleDomNodeRemoved","domNodeRemovedInterval","clearInterval","handleUserInteraction","handleFocus","focusState","handleBlur","changeevent","create","handlePaste","handleCopy","copyedFromMarking","setData","handleKeyUp","allImages","notMyImages","myImages","lastMouseDownPos","clientX","clientY","handleIEControlSelect","caretPosition","moveToPoint","handleClick","uneditable","handleDrop","handleKeyDown","handleTabKey","observeActions","focusBlurElement","setInterval","handleTables","INTERVAL","Synchronizer","fromComposerToTextarea","shouldParseHtml","fromTextareaToComposer","textareaValue","interval","startInterval","stopInterval","SourceView","switchToTextarea","composerStyles","switchToComposer","Textarea","supportsPlaceholder","eventMapping","focusin","focusout","undef","defaultConfig","showToolbarAfterInit","showToolbarDialogsOnSelection","parserRules","br","div","u","pasteParserRulesets","parser","supportTouchDevices","Editor","_isCompatible","_initParser","handleBeforeLoad","sourceView","synchronizer","Toolbar","isCompatible","htmlOrElement","customRules","parseContext","oldHtml","_cleanAndPaste","pastedHTML","cleanHtml"],"mappings":";;AAWA,GAAIA,YACFC,QAAS,QAGTC,YACAC,OACAC,UACAC,WACAC,QACAC,aACAC,SAEAC,gBAAiB,SACjBC,wBAAyB,UAEzBC,cAAe,4FAEfC,eAAgB,aAEhBC,aAAc,EACdC,UAAc,EAEdC,cAAgB,EAChBC,UAAgB,GAChBC,WAAgB,GAChBC,UAAgB,GAChBC,QAAgB,EAChBC,WAAgB,GAEjBpB,WAAUqB,UAAY,SAASC,EAAKC,GAkenC,QAASC,KACP,IACE,GAAIC,GAAI,GAAIC,aAAY,OAAQC,QAASC,IAAK,QAC9C,OAAQ,QAAUH,EAAEI,MAAQ,QAAUJ,EAAEE,OAAOC,IAC/C,MAAOE,IACT,OAAO,EA/dJC,OAAOC,UAAUC,OACpB,WAEE,GAAIC,GAAQ,oCACZH,QAAOC,UAAUC,KAAO,WACtB,MAAOE,MAAKC,QAAQF,EAAO,QAMjC,WACE,GAAIG,GAAQ,mBACRC,EAAQ,qBACRf,GAAIc,KACRf,EAAIiB,QAAQP,UAAWK,GAAUf,EAAKe,GAAUd,EAAKc,GAAU,SAAUG,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AAOioC,QACvB9R,QAAWyyC,EACXtoC,gBAAmBruC,KAAK+N,OAAOqxD,WAAWC,oBAC1CzpB,eAAmBA,GAKrB,OAH8B,gBAApB,IACR/3C,EAAUI,OAAO8uD,OAAO0pB,GAEnB51E,GAOTs1E,YAAa,WACX,GAAIS,EAEA/4E,GAAUsmC,QAAQ0E,sBACpB7oC,KAAKK,GAAG,iBAAkB,SAASI,GACjCA,EAAMG,iBACNg2E,EAAU/4E,EAAUG,IAAI6sD,cAAcpqD,GAClCm2E,GACF52E,KAAK62E,eAAeD,IAEtBp0E,KAAKxC,OAGPA,KAAKK,GAAG,uBAAwB,SAASI,GACvCA,EAAMG,gBACN,IAAIwqD,GAAYprD,KAAKirD,SAASI,cAE9BxtD,GAAUG,IAAIgtD,qBAAqBhrD,KAAKirD,SAAU,SAAS6rB,GACrDA,GACF92E,KAAK62E,eAAeC,GAEtB92E,KAAKirD,SAASoG,aAAajG,IAC3B5oD,KAAKxC,QAEPwC,KAAKxC,QAIX62E,eAAgB,SAAUD,GACxB,GAAIG,GAAYl5E,EAAUI,OAAO0tD,gBAAgBirB,GAC/Cl0B,cAAiB1iD,KAAKirD,SAASvnD,QAC/BkxC,MAAS50C,KAAK+N,OAAO+nE,uBAAyBp0E,IAAO1B,KAAK+N,OAAO2nE,cACjErnC,gBAAmBruC,KAAK+N,OAAOqxD,WAAWC,qBAE5Cr/D,MAAKirD,SAAS7sD,UAAUkhB,iBACxBtf,KAAKirD,SAAS7sD,UAAU0oC,WAAWiwC,OAGtCl5E"} \ No newline at end of file +{"version":3,"file":"wysihtml.min.js","sources":["wysihtml.js"],"names":["root","factory","define","amd","module","exports","this","wysihtml","version","commands","dom","quirks","toolbar","lang","selection","views","INVISIBLE_SPACE","INVISIBLE_SPACE_REG_EXP","VOID_ELEMENTS","EMPTY_FUNCTION","ELEMENT_NODE","TEXT_NODE","BACKSPACE_KEY","ENTER_KEY","ESCAPE_KEY","SPACE_KEY","TAB_KEY","DELETE_KEY","polyfills","win","doc","nativeCustomEventSupported","p","CustomEvent","detail","foo","type","e","String","prototype","trim","rtrim","replace","s_add","s_rem","Element","on","fn","self","attachEvent","event","target","srcElement","preventDefault","returnValue","stopPropagation","cancelBubble","which","button","keyCode","call","detachEvent","Object","defineProperty","getOwnPropertyDescriptor","get","innerText","set","s","Array","isArray","arg","toString","indexOf","a","f","c","length","r","d","Function","bind","oThis","TypeError","aArgs","slice","arguments","fToBind","fNOP","fBound","apply","concat","ELEMENT","matches","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","selector","element","elements","document","ownerDocument","querySelectorAll","index","closest","parentElement","createElement","testElement","classList","add","contains","createMethod","method","original","DOMTokenList","token","i","len","toggle","_toggle","force","view","classListProp","protoProp","elemCtrProto","objCtr","strTrim","arrIndexOf","item","DOMEx","message","name","code","DOMException","checkTokenAndGetIndex","test","ClassList","elem","trimmedClasses","getAttribute","classes","split","push","_updateClassName","setAttribute","classListProto","classListGetter","Error","tokens","l","updated","remove","splice","result","join","classListPropDesc","enumerable","configurable","ex","number","__defineGetter__","normalizeHasCaretError","window","ret","t1","createTextNode","t2","t3","createRange","appendChild","body","setStart","setEnd","getSelection","removeAllRanges","addRange","normalize","childNodes","anchorNode","firstChild","anchorOffset","parentNode","removeChild","getTextNodes","node","all","nextSibling","nodeType","isInDom","n","normalizeFix","nf","Node","texts","defaultView","anode","aoffset","aelement","undefined","fnode","focusNode","foffset","focusOffset","felement","prevTxt","shift","curText","nodeValue","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","previousSibling","F","removeEventListener","readyState","addEventListener","customEventSupported","params","bubbles","cancelable","evt","createEvent","initCustomEvent","Event","rangy","isHostMethod","o","t","FUNCTION","OBJECT","isHostObject","isHostProperty","UNDEFINED","createMultiplePropertyTest","testFunc","props","isTextRange","range","areHostMethods","textRangeMethods","areHostProperties","textRangeProperties","getBody","getElementsByTagName","consoleLog","msg","console","log","alertOrLog","shouldAlert","isBrowser","alert","fail","reason","api","initialized","supported","config","alertOnFail","warn","alertOnWarn","getErrorDesc","description","init","testRange","implementsDomRange","implementsTextRange","domRangeMethods","domRangeProperties","nodeName","toLowerCase","createTextRange","features","errorMessage","moduleName","modules","Module","initListeners","deprecationNotice","deprecated","replacement","createAliasForDeprecatedMethod","owner","util","toArray","shim","shimListeners","dependencies","initializer","createModule","initFunc","newModule","stack","RangePrototype","SelectionPrototype","areHostObjects","forEach","arr","func","preferTextRange","autoInitialize","rangyAutoInitialize","extend","hasOwnProperty","obj","deep","createOptions","optionsParam","defaults","options","el","arrayLike","addListener","eventType","listener","addInitListener","addShimListener","createMissingNativeApi","requiredModule","requiredModuleNames","createError","createCoreModule","rangePrototype","selectionPrototype","isHtmlNamespace","ns","namespaceURI","UNDEF","parent","getNodeIndex","getNodeLength","getCommonAncestor","node1","node2","ancestors","arrayContains","isAncestorOf","ancestor","descendant","selfIsAncestor","isOrIsAncestorOf","getClosestAncestorIn","isCharacterDataNode","isTextOrCommentNode","insertAfter","precedingNode","nextNode","insertBefore","splitDataNode","positionsToPreserve","newNode","cloneNode","deleteData","position","offset","getDocument","getWindow","parentWindow","getIframeDocument","iframeEl","contentDocument","contentWindow","getIframeWindow","isWindow","getContentDocument","methodName","tagName","getRootContainer","comparePoints","nodeA","offsetA","nodeB","offsetB","nodeC","childA","childB","isBrokenNode","inspectNode","crashyTextNodes","data","idAttr","id","innerHTML","fragmentFromNodeChildren","child","fragment","createDocumentFragment","createTestElement","html","contentEditable","bodyFirstChild","removeNode","NodeIterator","_next","createIterator","DomPosition","codeName","textNode","val","getComputedStyleProperty","getComputedStyle","propName","documentElement","currentStyle","_current","hasNext","next","detach","equals","pos","inspect","INDEX_SIZE_ERR","HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INVALID_STATE_ERR","INVALID_NODE_TYPE_ERR","isNonTextPartiallySelected","startContainer","endContainer","getRangeDocument","getRangeRoot","getBoundaryBeforeNode","getBoundaryAfterNode","insertNodeAtPosition","firstNodeInserted","rangesIntersect","rangeA","rangeB","touchingIsIntersecting","assertRangeValid","startComparison","startOffset","endOffset","endComparison","cloneSubtree","iterator","partiallySelected","subIterator","frag","isPartiallySelectedSubtree","getSubtreeIterator","iterateSubtree","rangeIterator","iteratorState","it","stop","subRangeIterator","deleteSubtree","extractSubtree","getNodesInRange","nodeTypes","filter","regex","filterNodeTypes","filterExists","RegExp","nodes","RangeIterator","sc","ec","getName","clonePartiallySelectedTextNodes","collapsed","so","eo","commonAncestorContainer","isSingleCharacterDataNode","_first","_last","createAncestorFinder","assertNoDocTypeNotationEntityAncestor","allowSelf","getDocTypeNotationEntityAncestor","assertValidNodeType","invalidTypes","assertValidOffset","assertSameDocumentOrFragment","getDocumentOrFragmentContainer","assertNodeNotReadOnly","getReadonlyAncestor","assertNode","isValidOffset","isRangeValid","splitRangeBoundaries","startEndSame","setStartAndEnd","rangeToHtml","container","cloneContents","copyComparisonConstantsToObject","START_TO_START","s2s","START_TO_END","s2e","END_TO_END","e2e","END_TO_START","e2s","NODE_BEFORE","n_b","NODE_AFTER","n_a","NODE_BEFORE_AND_AFTER","n_b_a","NODE_INSIDE","n_i","copyComparisonConstants","constructor","createRangeContentRemover","remover","boundaryUpdater","boundary","reset","createPrototypeRange","createBeforeAfterNodeSetter","isBefore","isStart","beforeAfterNodeTypes","rootContainerNodeTypes","setRangeStart","setRangeEnd","args","setBoundary","setStartBefore","setStartAfter","setEndBefore","setEndAfter","collapse","selectNodeContents","selectNode","start","end","extractContents","deleteContents","canSurroundContents","boundariesInvalid","splitBoundaries","splitBoundariesPreservingPositions","normalizeBoundaries","sibling","mergeForward","appendData","mergeBackward","nodeLength","insertData","nodeIndex","normalizeStart","endNode","startNode","collapseToPoint","updateCollapsedAndCommonAncestor","updateBoundaries","Range","current","subRange","cloneRange","readonlyNodeTypes","insertableNodeTypes","surroundNodeTypes","styleEl","htmlParsingConforms","createContextualFragment","fragmentStr","rangeProperties","compareBoundaryPoints","how","prefixA","prefixB","insertNode","clone","surroundContents","content","hasChildNodes","lastChild","prop","textParts","compareNode","comparePoint","toHtml","intersectsNode","isPointInRange","intersectsRange","intersectsOrTouchesRange","intersection","intersectionRange","union","unionRange","containsNode","allowPartial","containsNodeContents","containsRange","containsNodeText","nodeRange","textNodes","getNodes","lastTextNode","pop","collapseBefore","collapseAfter","getBookmark","containerNode","preSelectionRange","moveToBookmark","bookmark","charIndex","nextCharIndex","nodeStack","foundStart","rangesEqual","isValid","r1","r2","DomRange","WrappedRange","WrappedTextRange","updateRangeProperties","nativeRange","updateNativeRange","startMoved","endMoved","nativeRangeDifferent","rangeProto","refresh","testTextNode","oppositeName","range2","createNativeRange","getTextRangeContainerElement","textRange","parentEl","duplicate","startEl","endEl","startEndContainer","textRangeIsCollapsed","compareEndPoints","getTextRangeBoundaryPosition","wholeRangeContainerElement","isCollapsed","startInfo","workingRange","containerElement","canHaveHTML","boundaryPosition","nodeInfo","workingNode","comparison","previousNode","boundaryNode","workingComparisonType","childNodeCount","moveToElementText","Math","floor","setEndPoint","tempRange","rangeLength","text","moveStart","createBoundaryTextRange","boundaryParent","boundaryOffset","nodeIsDataNode","startBoundary","rangeContainerElement","rangeToTextRange","startRange","endRange","toTextRange","globalObj","createRangyRange","isDirectionBackward","dir","WrappedSelection","getWinSelection","winParam","getDocSelection","winSelectionIsBackward","sel","backward","updateAnchorAndFocusFromRange","anchorPrefix","focusPrefix","updateAnchorAndFocusFromNativeSelection","nativeSel","nativeSelection","updateEmptySelection","rangeCount","_ranges","getNativeRange","rangeContainsSingleElement","rangeNodes","getSingleElementFromRange","updateFromTextRange","wrappedRange","updateControlSelection","docSelection","controlRange","addRangeToControlSelection","rangeElement","newControlRange","createControlRange","select","deleteProperties","detached","actOnCachedSelection","action","cached","cachedRangySelections","createControlSelection","ranges","assertNodeInSameDocument","createStartOrEndSetter","getRangeAt","setSingleRange","isBackward","rangeInspects","anchor","focus","checkSelectionRanges","getNativeSelection","selectionIsCollapsed","BOOLEAN","NUMBER","CONTROL","implementsWinGetSelection","implementsDocSelection","useDocumentSelection","isSelectionValid","testSelection","selectionHasAnchorAndFocus","selectionHasExtend","selectionHasRangeCount","selectionSupportsMultipleRanges","collapsedNonEditableSelectionsSupported","addRangeBackwardToNative","originalSelectionRangeCount","selectionHasMultipleRanges","originalSelectionRanges","originalSelectionBackward","testEl","chromeMatch","navigator","appVersion","match","parseInt","testControlRange","implementsControlRange","getSelectionRangeAt","docSel","selProto","addRangeBackward","direction","previousRangeCount","clonedNativeRange","selectionIsBackward","setRanges","empty","refreshSelection","checkForChanges","oldRanges","oldAnchorNode","oldAnchorOffset","removeRangeManually","getAllRanges","removeRange","removed","isBackwards","rangeTexts","collapseToStart","collapseToEnd","selectAllChildren","deleteFromDocument","eachRange","callMethodOnEachRange","results","changeEachRange","rangeBookmarks","rangeBookmark","selRanges","saveRanges","restoreRanges","rangeHtmls","getNativeTextRange","detachAll","Selection","docReady","loadHandler","require","defaultTokenizer","chars","wordOptions","createTokenRange","isWord","tokenRanges","wordStart","wordEnd","word","lastWordEnd","wordRegex","exec","includeTrailingSpace","nonLineBreakWhiteSpaceRegex","convertCharRangeToToken","tokenRange","tokenChars","tokenize","tokenizer","normalizeIgnoredCharacters","ignoredCharacters","ignoredChars","ignoredCharsArray","sort","char1","char2","charCodeAt","createWordOptions","language","defaultLanguage","defaultWordOptions","createNestedOptions","characterOptions","defaultCharacterOptions","getComputedDisplay","display","tableCssDisplayBlock","defaultDisplayValueForTag","isHidden","getAncestorsAndSelf","isVisibilityHiddenTextNode","isBlockNode","containsPositions","getAncestors","unshift","nextNodeDescendants","excludeChildren","previous","isWhitespaceNode","computedWhiteSpace","isCollapsedWhitespaceNode","isCollapsedNode","isIgnoredNode","Cache","store","createCachingGetter","objProperty","cache","cachedCount","uncachedCount","value","NodeWrapper","session","positions","Position","nodeWrapper","inspectPosition","startSession","endSession","currentSession","Session","getSession","createCharacterIterator","startPos","endPos","charPos","finished","previousVisible","nextVisible","previousTextPos","returnPreviousTextPos","character","getCharacter","rewind","dispose","createTokenizedTextProvider","consumeWord","forward","textChar","newChars","forwardIterator","backwardIterator","passedWordBoundary","insideWord","allWhiteSpaceRegex","forwardChars","backwardChars","reverse","forwardTokensBuffer","arrayIndexOf","backwardTokensBuffer","nextEndToken","lastToken","previousStartToken","movePositionBy","unit","count","currentPos","charIterator","nextPos","unitsMoved","newPos","absCount","abs","CHARACTER","WORD","tokenizedTextProvider","isLeadingSpace","isTrailingSpace","createRangeCharacterIterator","rangeStart","getRangeBoundaryPosition","rangeEnd","itStart","itEnd","getRangeCharacters","isWholeWord","expand","findTextFromPosition","initialPos","searchTerm","isRegex","searchScopeRange","findOptions","handleMatch","startIndex","endIndex","valid","wholeWordsOnly","currentChar","matchStartIndex","matchEndIndex","insideRegexMatch","caseSensitive","createEntryPointFunction","sessionRunning","createRangeBoundaryMover","moveOptions","defaultMoveOptions","boundaryIsStart","moveResult","createRangeTrimmer","trimCharCount","trimmed","createSelectionTrimmer","spacesRegex","spacesMinusLineBreaksRegex","trailingSpaceInBlockCollapses","trailingSpaceBeforeBrCollapses","trailingSpaceBeforeBlockCollapses","trailingSpaceBeforeLineBreakInPreLineCollapses","includeBlockContentTrailingSpace","includeSpaceBeforeBr","includeSpaceBeforeBlock","includePreLineTrailingSpace","ignoreCharacters","defaultCaretCharacterOptions","en","defaultFindOptions","withinRange","wrap","defaultExpandOptions","trimStart","trimEnd","defaultWordIteratorOptions","table","caption","colgroup","col","thead","tbody","tfoot","tr","td","th","key","nodeProto","getPosition","EMPTY","NON_SPACE","UNCOLLAPSIBLE_SPACE","COLLAPSIBLE_SPACE","TRAILING_SPACE_BEFORE_BLOCK","TRAILING_SPACE_IN_BLOCK","TRAILING_SPACE_BEFORE_BR","PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK","TRAILING_LINE_BREAK_AFTER_BR","INCLUDED_TRAILING_LINE_BREAK_AFTER_BR","getLength","isWhitespace","isCollapsedWhitespace","isIgnored","getTextNodeInfo","spaceRegex","collapseSpaces","cssWhitespace","preLine","hasInnerText","posAfterEl","firstPosInEl","prepopulateChar","isDefinitelyNonEmpty","isRenderedBlock","brs","getTrailingSpace","getNodeWrapper","getLeadingSpace","positionProto","characterType","isBr","prepopulatedChar","visibleChar","charType","finalizedChar","charAt","nodePassed","checkForTrailingSpace","checkForLeadingSpace","isCharInvariant","resolveLeadingAndTrailingSpaces","trailingSpace","leadingSpace","getPrecedingUncollapsedPosition","getPreviousPos","gotPreviousPos","previousPos","returnChar","thisChar","isIgnoredCharacter","cacheKey","cachedChar","collapsible","nextUncollapsed","nextOffset","previousOffset","createWrapperCache","nodeProperty","wrappersByProperty","wrapper","property","initCaches","uniqueIDSupported","elementCache","elementsCache","uniqueID","elWrapper","textNodeCache","otherNodeCache","wrapperCache","prefix","moveEnd","move","startTrimmed","endTrimmed","expandOptions","moved","endToken","newEndPos","startTokenizedTextProvider","startToken","newStartPos","endTokenizedTextProvider","selectCharacters","toCharacterRange","rangeStartsBeforeNode","rangeBetween","findText","searchTermParam","findResult","wrappedAround","pasteHtml","saveCharacterRanges","rangeInfos","characterRange","restoreCharacterRanges","saved","rangeInfo","createWordIterator","iteratorOptions","noMutation","createPosition","gEBI","getElementById","insertRangeBoundaryMarker","atStart","markerEl","markerId","Date","random","boundaryRange","style","lineHeight","className","markerTextChar","setRangeBoundary","compareRanges","saveRange","startMarkerId","endMarkerId","restoreRange","saveSelection","restored","restoreSelection","savedSelection","preserveDirection","removeMarkerElement","removeMarkers","Base","_instance","_static","_prototyping","proto","base","klass","_constructing","implement","valueOf","source","toSource","hidden","object","block","context","browser","iosVersion","userAgent","androidVersion","isIE","equation","re","rv","appName","parseFloat","$1","isGecko","isWebKit","isChrome","isOpera","USER_AGENT","hasContentEditableSupport","hasEditingApiSupport","execCommand","queryCommandSupported","queryCommandState","hasQuerySelectorSupport","querySelector","isIncompatibleMobileBrowser","isIos","isAndroid","isTouchDevice","supportsEvent","supportsSandboxedIframes","throwsMixedContentWarningWhenIframeSrcIsEmpty","displaysCaretInEmptyContentEditableCorrectly","hasCurrentStyleProperty","insertsLineBreaksOnReturn","supportsPlaceholderAttributeOn","eventName","supportsEventsInIframeCorrectly","supportsHTML5Tags","html5","supportsCommand","buggyCommands","formatBlock","insertUnorderedList","insertOrderedList","insertHTML","command","isBuggy","e1","queryCommandEnabled","e2","doesAutoLinkingInContentEditable","canDisableAutoLinking","clearsContentEditableCorrectly","supportsGetAttributeCorrectly","canSelectImagesInContentEditable","autoScrollsToCaret","autoClosesUnclosedTags","clonedTestElement","supportsNativeGetElementsByClassName","getElementsByClassName","supportsSelectionModify","needsSpaceAfterLineBreak","supportsSpeechApiOn","input","chromeVersion","crashesWhenDefineProperty","doesAsyncFocus","hasProblemsSettingCaretAfterImg","hasLiDeletingProblem","hasUndoInContextMenu","hasInsertNodeIssue","hasIframeFocusIssue","createsNestedInvalidMarkupAfterPaste","hasCaretBlockElementIssue","supportsMutationEvents","supportsModernPaste","fixStyleKey","usesControlRanges","array","needle","without","arrayToSubstract","newArr","newArray","map","callback","thisArg","A","unique","vals","max","idx","Dispatcher","handler","events","off","handlers","newHandlers","fire","payload","observe","stopObserving","merge","otherObj","isPlainObject","difference","diffObj","newObj","isFunction","Text","isEmpty","WHITE_SPACE_START","WHITE_SPACE_END","ENTITY_REG_EXP","ENTITY_MAP","&","<",">","\"","\t","string","str","interpolate","vars","by","search","escapeHTML","linebreaks","convertSpaces","autoLink","ignoreInClasses","_hasParentThatShouldBeIgnored","_parseNode","_convertUrlsToLinks","URL_REG_EXP","url","punctuation","TRAILING_CHAR_REG_EXP","opening","BRACKETS","realUrl","displayUrl","MAX_DISPLAY_LENGTH","substr","_getTempElement","tempElement","_wysihtml5_tempElement","_wrapMatchesInNode","IGNORE_URLS_IN","childNodesLength",")","]","}","addClass","hasClass","removeClass","elementClassName","convertToList","_createListItem","list","listItem","_createList","listType","uneditableClass","childNode","lineBreak","isBlockElement","isLineBreak","currentListItem","lineBreaks","lineBreaksLength","getStyle","from","insert","after","replaceChild","copyAttributes","attributesToCopy","elementToCopyFrom","to","elementToCopyTo","attribute","andTo","callee","BOX_SIZING_PROPERTIES","shouldIgnoreBoxSizingBorderBox","hasBoxSizingBorderBox","offsetWidth","copyStyles","stylesToCopy","cssText","setStyles","delegate","parents","domNode","defaultNodeTypes","is","emptyTextNode","ignoreWhitespace","regx","rangyBookmark","visible","isVisible","getTextContent","voidElement","query","prev","prevNode","types","ignoreBlankTexts","commonAncestor","parents1","parents2","lastLeafNode","leafClasses","escapeParent","newWrapper","split2","nodeWrap","curNode","transferContentTo","targetNode","removeOldWrapper","properties","classRegExp","styleProperty","hasOneStyle","styles","j","maxStyleP","styleValue","attr","getAttributes","attrList","hasOneAttribute","attributeValue","getAsDom","_innerHTMLShiv","_ensureHTML5Compatibility","_wysihtml5_supportsHTML5Tags","HTML5_ELEMENTS","getParentElement","levels","camelize","REG_EXP_CAMELIZE","toUpperCase","stylePropertyMapping","float","camelizedProperty","originalOverflow","needsOverflowReset","overflow","getPropertyValue","ingoreEmpty","textContent","hasElementWithTagName","_getDocumentIdentifier","_wysihtml5_identifier","DOCUMENT_IDENTIFIER","LIVE_CACHE","cacheEntry","hasElementWithClassName","elementToInsert","before","into","insertCSS","rules","styleElement","styleSheet","link","head","_isLineBreak","_isLineBreakOrBlockElement","eventNames","handlerWrapper","parse","elementOrHtml_current","config_current","elementOrHtml","currentRules","defaultRules","isString","clearInternals","selectors","_applySelectorRules","_convert","cleanUp","unjoinNbsps","txtnodes","getCorrectInnerHTML","oldNode","newChild","nodeDisplay","oldNodeType","oldChilds","oldChildsLength","NODE_TYPE_MAPPING","blockElements","DEFAULT_NODE_NAME","attributes","selectorRules","els","elementHandlingMethods","_handleElement","rule","renameTag","tagRules","tags","scopeName","_wysihtml5","outerHTML","unwrap","rename_tag","one_of_type","_testTypes","remove_action","remove_action_rename_to","_handleAttributes","_handleStyles","definition","type_definitions","_testType","classesLength","styleProp","nodeClasses","nodeStyles","methods","m","typeCeckMethods","WHITE_SPACE_REG_EXP","sp","attrs","v","keep_styles","styleFloat","cssFloat","_getAttributesBeginningWith","beginning","returnAttributes","_checkAttribute","attributeName","newAttributeValue","attributeCheckMethods","_checkAttributes","local_attributes","newValue","matchingAttributes","globalAttributes","checkAttributes","oldAttributes","imax","currentClass","newClass","setClass","set_class","add_class","addStyle","add_style","setAttributes","set_attributes","allowedClasses","newClasses","oldClasses","check_attributes","addClassMethods","addStyleMethods","newStyle","classes_blacklist","src","width","height","_handleText","_handleComment","comments","createComment","1","3","8","REG_EXP","href","alt","numbers","dimension","any","align_text","mapping","left","right","center","align_img","justify","clear_br","both","size_font","2","4","5","6","7","-","+","has_visible_contet","txt","visibleElements","offsetHeight","removeEmptyTextNodes","renameElement","newNodeName","newElement","replaceWithChildNodes","_isBlockElement","_appendLineBreak","resolveList","useLineBreaks","isLastChild","shouldAppendLineBreak","paragraph","isLastItem","lastListItem","lastElementChild","firstElementChild","windowProperties","windowProperties2","documentProperties","Sandbox","readyCallback","editableArea","_createIframe","insertInto","getIframe","_readyError","destroy","iframe","that","security","allowtransparency","frameborder","marginwidth","marginheight","onload","onreadystatechange","_onLoadIframe","iframeWindow","iframeDocument","charset","characterSet","sandboxHtml","_getHtml","stylesheets","open","write","close","onerror","fileName","lineNumber","_unset","loaded","setTimeout","templateVars","setter","__defineSetter__","ContentEditableArea","getContentEditable","_bindElement","_createElement","_loadElement","contentExists","innerHtml","simulatePlaceholder","editor","placeholderText","placeholderClassName","CLASS_NAME","unset","composerIsVisible","hasPlaceholderSet","clear","placeholderSet","setValue","setTextContent","HAS_GET_ATTRIBUTE_BUG","isLoadedImage","hasAttribute","specified","complete","queryInList","q","removeElement","referenceNode","tag","MapCell","cell","isColspan","isRowspan","firstCol","lastCol","firstRow","lastRow","isReal","spanCollection","modified","TableModifyerByCell","addSpannedCellToMap","cspan","rspan","spanCollect","rmax","cmax","rr","cc","setCellAsModified","smax","setTableMap","ridx","row","cells","cidx","tableRows","getTableRows","getRowCells","inlineTables","inlineCells","allCells","tableCells","inlineRows","allRows","getMapIndex","r_length","c_length","r_idx","c_idx","getElementAtIndex","getMapElsTo","to_cell","idx_start","idx_end","temp_idx","temp_cidx","maxr","maxc","orderSelectionEnds","secondcell","createCells","nr","correctColIndexForUnreals","corrIdx","getLastNewCellOnRow","rowLimit","removeEmptyTable","splitRowToCells","colspan","cType","newCells","removeAttribute","getRealRowEl","injectRowAt","new_cells","n_cidx","canMerge","decreaseCellSpan","span","removeSurplusLines","allRowspan","fillMissingCells","r_max","c_max","prevcell","rectify","unmerge","thisCell","rowspan","collapseCellToNextRow","cellIdx","newRowIdx","newIdx","lastCell","removeRowCell","getRowElementsByCell","modRow","getColumnElementsByCell","removeRow","oldRow","removeColCell","removeColumn","what","addRow","where","newRow","addRowCell","cr","colSpanAttr","addColumn","addColCell","doAdd","handleCellAddWithRowspan","modCell","temp_r_cells","nrow","addRowsNr","crow","getCellsBetween","cell1","cell2","c1","addCells","removeCells","mergeCellsBetween","unmergeCell","findCell","findRowByCell","findColumnByCell","thisOwner","otherOwner","point","location_index","smallest_common_ancestor","this_index","other_index","children","getPastedHtml","clipboardData","getData","getPastedHtmlWithDiv","composer","selBookmark","cleanerDiv","scrollPos","getScrollPos","top","y","x","setBookmark","removeInvisibleSpaces","cleanPastedHTML","styleToRegex","styleStr","trimmedStr","escapedStr","extendRulesWithStyleExceptions","exceptStyles","newRules","pickRuleset","ruleset","defaultSet","condition","newHtml","color","fontSize","ensureProperClearing","clearIfNecessary","TILDE_ESCAPED","urlToSearch","elementsWithTilde","redraw","tableCellsSelection","editable","handleMouseDown","handleSelectionMousedown","removeCellSelections","selection_class","handleMouseMove","handleMouseUp","selectedCells","addSelections","oldEnd","curTable","deselect","bindSideclick","sideClickHandler","selectCells","getColorParseMethod","colorStr","colorTypeConf","colorParseMethods","getColorFormat","rgba","rgb","hex6","radix","hex3","makeParamRegExp","styleParser","parseColor","stylesStr","paramName","paramsRegex","colorType","colorMatch","unparseColor","colorFormat","hexRadix","parseFontSize","_getCumulativeOffsetTop","offsetTop","offsetParent","getDepth","getRangeNode","getWebkitSelectionFixNode","blankNode","placeholderRemover","delayedPlaceholderRemover","minWidth","expandRangeToSurround","common","start_depth","end_depth","contain","unselectableClass","getRange","setSelection","setBefore","createTemporaryCaretSpaceAfter","caretPlaceholder","caretPlaceholderText","keyDownHandler","setAfter","ctrlKey","metaKey","zIndex","notVisual","fixWebkitSelection","lastSibling","activeElement","setScrollPos","avoidInvisibleSpace","isElement","displayStyle","getSelectedNode","fixSelBorders","getSelectedOwnNodes","getOwnRanges","ownNodes","maxi","findNodesInSelection","curNodes","filterElements","containsUneditable","uneditables","getOwnUneditables","deleteRangeContents","startParent","endParent","ev","dispatchEvent","err","getCaretNode","getPreviousNode","ignoreEmpty","getNodesNearCaret","caretNode","textOffset","getSelectionParentsByTag","curEl","getRangeToNodeEnd","sNode","lastR","caretIsLastInSelection","endc","endtxt","caretIsFirstInSelection","includeLineBreaks","ws","whiteSpace","caretIsInTheBeginnig","ofNode","getBeforeSelection","includePrevLeaves","inTmpCaret","rng","prevLeaf","executeAndRestoreRangy","restoreScrollPosition","executeAndRestore","newCaretPlaceholder","prevSibling","newRange","oldScrollTop","scrollTop","oldScrollLeft","scrollLeft","placeholderHtml","lastEditorElement","canAppendChild","anchorNodeTagNameLower","voidElements","splitElementAtCaret","contentAfterRangeStart","surround","nodeOptions","cssStyle","scrollIntoView","tolerance","hasScrollBars","scrollHeight","_wysihtml5ScrollIntoViewElement","selectLine","_selectLine_W3C","getBoundingClientRect","_selectLineUniversal","includeRangyRangeHelpers","isHelperNode","initialBoundry","modify","toLineBoundary","location","getRangeRect","rect","testNode","amount","testRect","found","isLineBreakingElement","pnode","bottom","getText","getOwnNodes","splitBounds","fixRangeOverflow","containment","_detectInlineRangeProblems","previousElementSibling","_endOffsetForNode","dontFix","allUneditables","deepUneditables","tmpRanges","tmpRange","jmax","selectAll","blankEndNode","blankStartNode","doSelect","notSelected","getHtml","getPlainText","isEndToEndInNode","nodeNames","isInThisEditable","Commands","support","commandValue","state","stateValue","getOptions","createLink","opts","formatInline","removeLink","correctOptionsForSimilarityCheck","isBlock","isBookmark","isLineBreaking","cleanup","newBlockElements","nbIdx","allElements","BLOCK_ELEMENTS","noEditQuery","classNames","uneditableContainer","defaultNodeName","findOuterBlock","allBlocks","UNNESTABLE_BLOCK_ELEMENTS","cloneOuterInlines","innerNode","el2","INLINE_ELEMENTS","outerNode","applyOptionsToElement","removeOptionsFromElement","unwrapped","applySurroundingLineBreaks","unwrapBlocksFromContent","nextEl","prevEl","blocks","fixRangeCoverage","fixNotPermittedInsertionPoints","lis","maxj","rangePos","closestLI","newRanges","getOptionsWithNodename","defaultName","correctedOptions","injectFragmentToRange","firstOuterBlock","outerInlines","first","last","rangeStartContainer","fc","lc","clearRangeBlockFromating","closestBlockName","removeSurroundingLineBreaks","prevPrev","wrapRangeWithElement","similarOptions","isWhitespaceBefore","isWhitespaceAfter","similarOuterBlock","splitAllBlocks","trimBlankTextsAndBreaks","tmpEl","getParentBlockNodeName","expandCaretToBlock","insertingNodeName","selectElements","lastEl","lastOffset","formatSelection","parseOptions","caretIsOnEmptyLine","caretInfo","parentNodes","hasNoClass","hasNoStyle","hasNoAttributes","isSameNode","element1","element2","classes1","classes2","attr1","attr2","createWrapNode","defaultTag","containsSameAttributes","updateElementAttributes","newAttributes","fullContain","updateFormatOfElement","nodeNameQuery","nodeQueryMatch","queryAliasMap","getSelectedTextNodes","findSimilarTextNodeWrapper","exact","isSimilarNode","selectRange","selectTextNodes","lastText","selectTextNode","getState","searchNodes","partial","caretIsInsideWord","beforeChar","afterChar","getRangeForWord","offsetStart","offsetEnd","txtNodes","wordOffset","mergeContents","mergeConsequentSimilarElements","cleanupAndSetSelection","cleanupAndSetCaret","formatTextNode","wrapNode","unformatTextNode","newWrapNode","removeFormatFromTextNode","formatTextRange","updateFormat","wordObj","exactState","removeFormat","applyFormat","fixOptions","b","strong","em","LINE_BREAK","insertLineBreak","insertList","isNode","findListEl","other","parentLi","otherNodeName","handleSameTypeList","otherLists","innerLists","getListsInSelection","handleOtherTypeList","renameLists","createListFallback","tempClassName","getTime","selectedNode","cmd","redo","undoManager","undo","createTable","cols","rows","tableStyle","mergeTableCells","tableSelection","addTableCells","tableSelect","deleteTableCells","selCell","indentList","listEls","tryToPushLiLevel","liNodes","listTag","prevLi","liNode","prevLiList","outdentList","tryToPullLiLevel","listNode","outerListNode","outerLiNode","afterList","getAfterList","newList","Z_KEY","Y_KEY","MAX_HISTORY_ENTRIES","DATA_ATTR_NODE","DATA_ATTR_OFFSET","UndoManager","historyStr","historyDom","transact","_observe","lastKey","sandbox","altKey","isUndo","shiftKey","isRedo","previousHtml","currentHtml","getValue","getChildNodeIndex","undoPossible","redoPossible","historyEntry","getChildNodeByIndex","View","textareaElement","noTextarea","_observeViewChange","currentView","show","hide","disable","enable","Composer","editableElement","textarea","contentEditableMode","_initContentEditableArea","_initSandbox","_displayStyle","disabled","setToEnd","pageYOffset","pageXOffset","scrollTo","_create","_createWysiwygFormField","form","hiddenField","_initAutoLinking","placeholder","_initObjectResizing","_initUndoManager","_initLineBreaking","initSync","sync","supportsDisablingOfAutoLinking","supportsAutoLinking","nodeWithSelection","isInUneditable","links","urlRegExp","newTextContent","propertiesLength","adjust","USE_NATIVE_LINE_BREAK_INSIDE_TAGS","LIST_TAGS","defaultPrevented","blockElement","HOST_TEMPLATE","TEXT_FORMATTING","BOX_FORMATTING","ADDITIONAL_CSS_RULES","focusWithoutScrolling","setActive","elementStyle","originalScrollTop","originalScrollLeft","originalStyles","WebkitUserSelect","displayValueForCopying","originalActiveElement","hasPlaceholder","originalPlaceholder","originalDisplayValue","originalDisabled","focusStylesHost","blurStylesHost","disabledStylesHost","blur","boxFormattingStyles","shortcuts","66","73","85","actions","addListeners","removeListeners","fixLastBrDeletionInTable","aNode","handleUneditableDeletion","fixDeleteInTheBeginningOfBlock","selNode","commonAncestorNode","fixDeleteInTheBeginningOfLi","firstNode","isInBeginnig","fixDeleteInTheBeginningOfControlSelection","afterCaretNode","initTableHandling","hideHandlers","iframeInitiator","doLineBreaksModeEnterWithCaret","breakNodes","doubleLineBreakEscapesBlock","brNode","br1","br2","handleDeleteKeyPress","handleEnterKeyPress","handleTabKeyDown","handleDomNodeRemoved","domNodeRemovedInterval","clearInterval","handleUserInteraction","handleFocus","focusState","handleBlur","changeevent","create","handlePaste","handleCopy","copyedFromMarking","setData","handleKeyUp","allImages","notMyImages","myImages","lastMouseDownPos","clientX","clientY","handleIEControlSelect","caretPosition","moveToPoint","handleClick","uneditable","handleDrop","handleKeyDown","handleTabKey","observeActions","focusBlurElement","setInterval","handleTables","INTERVAL","Synchronizer","fromComposerToTextarea","shouldParseHtml","fromTextareaToComposer","textareaValue","interval","startInterval","stopInterval","SourceView","switchToTextarea","composerStyles","switchToComposer","Textarea","supportsPlaceholder","eventMapping","focusin","focusout","undef","defaultConfig","showToolbarAfterInit","showToolbarDialogsOnSelection","parserRules","br","div","u","pasteParserRulesets","parser","supportTouchDevices","Editor","_isCompatible","_initParser","handleBeforeLoad","sourceView","synchronizer","Toolbar","isCompatible","htmlOrElement","customRules","parseContext","oldHtml","_cleanAndPaste","pastedHTML","cleanHtml"],"mappings":";;CAAA,SAAWA,EAAMC,GACI,kBAAXC,SAAyBA,OAAOC,IACxCD,OAAOD,GACmB,gBAAXG,SAAuBA,OAAOC,QAC7CD,OAAOC,QAAUJ,IAEjBA,KAECK,KAAM,WAaT,GAAIC,IACFC,QAAS,QAGTC,YACAC,OACAC,UACAC,WACAC,QACAC,aACAC,SAEAC,gBAAiB,SACjBC,wBAAyB,UAEzBC,cAAe,4FAEfC,eAAgB,aAEhBC,aAAc,EACdC,UAAc,EAEdC,cAAgB,EAChBC,UAAgB,GAChBC,WAAgB,GAChBC,UAAgB,GAChBC,QAAgB,EAChBC,WAAgB,GAEjBpB,GAASqB,UAAY,SAASC,EAAKC,GAkelC,QAASC,KACP,IACE,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,cAAc9pD,GACjCovE,GACFhyE,KAAKiyE,eAAeD,IAEtBrtE,KAAK3E,OAGPA,KAAKwC,GAAG,uBAAwB,SAASI,GACvCA,EAAMG,gBACN,IAAIkqD,GAAYjtD,KAAK8sD,SAASI,cAE9BjtD,GAASG,IAAIysD,qBAAqB7sD,KAAK8sD,SAAU,SAASolB,GACpDA,GACFlyE,KAAKiyE,eAAeC,GAEtBlyE,KAAK8sD,SAASoG,aAAajG,IAC3BtoD,KAAK3E,QAEP2E,KAAK3E,QAIXiyE,eAAgB,SAAUD,GACxB,GAAIG,GAAYlyE,EAASI,OAAOmtD,gBAAgBwkB,GAC9CztB,cAAiBvkD,KAAK8sD,SAASjnD,QAC/B4wC,MAASz2C,KAAK4P,OAAOshE,uBAAyBrtE,IAAO7D,KAAK4P,OAAOkhE,cACjE5gC,gBAAmBlwC,KAAK4P,OAAO6rD,WAAWC,qBAE5C17D,MAAK8sD,SAAStsD,UAAU2gB,iBACxBnhB,KAAK8sD,SAAStsD,UAAUmoC,WAAWwpC,OAGtClyE"} \ No newline at end of file diff --git a/src/assert/html_equal.js b/src/assert/html_equal.js index 8402367..9697479 100644 --- a/src/assert/html_equal.js +++ b/src/assert/html_equal.js @@ -1,18 +1,18 @@ var wysihtml5 = wysihtml5 || {}; -wysihtml5.assert = wysihtml5.assert || {}; +wysihtml.assert = wysihtml.assert || {}; /** * Compare html strings without stumbling upon browser misbehaviors * Uses and takes the same parameters as QUnit's equal method * * @example - * wysihtml5.assert.htmlEqual( + * wysihtml.assert.htmlEqual( * removeAttributes('

    foo

    '), * '

    foo

    ', * 'Removed align attribute on

    ' * ); */ -wysihtml5.assert.htmlEqual = (function() { +wysihtml.assert.htmlEqual = (function() { var htmlHost = document.createElement("div"); /** @@ -75,15 +75,15 @@ wysihtml5.assert.htmlEqual = (function() { var removeWhiteSpace = (function() { var REG_EXP = /(>)(\s*?)(<)/gm; return function(html) { - return wysihtml5.lang.string(html.replace(REG_EXP, "$1$3")).trim(); + return wysihtml.lang.string(html.replace(REG_EXP, "$1$3")).trim(); }; })(); return function(actual, expected, message, config) { config = config || {}; if (NEEDS_TO_BE_PREPARSED) { - actual = wysihtml5.dom.getAsDom(actual).innerHTML; - expected = wysihtml5.dom.getAsDom(expected).innerHTML; + actual = wysihtml.dom.getAsDom(actual).innerHTML; + expected = wysihtml.dom.getAsDom(expected).innerHTML; } if (config.normalizeWhiteSpace || DOESNT_PRESERVE_WHITE_SPACE) { diff --git a/src/browser.js b/src/browser.js index b495158..77866f0 100644 --- a/src/browser.js +++ b/src/browser.js @@ -1,7 +1,7 @@ /** * Detect browser support for specific features */ -wysihtml5.browser = (function() { +wysihtml.browser = (function() { var userAgent = navigator.userAgent, testElement = document.createElement("div"), // Browser sniffing is unfortunately needed since some behaviors are impossible to feature detect @@ -156,7 +156,7 @@ wysihtml5.browser = (function() { * @param {Object} context The document object on which to check HTML5 support * * @example - * wysihtml5.browser.supportsHTML5Tags(document); + * wysihtml.browser.supportsHTML5Tags(document); */ supportsHTML5Tags: function(context) { var element = context.createElement("div"), @@ -175,7 +175,7 @@ wysihtml5.browser = (function() { * @return {Boolean} * * @example - * wysihtml5.browser.supportsCommand(document, "bold"); + * wysihtml.browser.supportsCommand(document, "bold"); */ supportsCommand: (function() { // Following commands are supported but contain bugs in some browsers @@ -312,7 +312,7 @@ wysihtml5.browser = (function() { * * @example * var input = document.createElement("input"); - * if (wysihtml5.browser.supportsSpeechApiOn(input)) { + * if (wysihtml.browser.supportsSpeechApiOn(input)) { * // ... * } */ diff --git a/src/commands.js b/src/commands.js index b50ad0d..f694f3b 100644 --- a/src/commands.js +++ b/src/commands.js @@ -2,10 +2,10 @@ * Rich Text Query/Formatting Commands * * @example - * var commands = new wysihtml5.Commands(editor); + * var commands = new wysihtml.Commands(editor); */ -wysihtml5.Commands = Base.extend( - /** @scope wysihtml5.Commands.prototype */ { +wysihtml.Commands = Base.extend( + /** @scope wysihtml.Commands.prototype */ { constructor: function(editor) { this.editor = editor; this.composer = editor.composer; @@ -20,7 +20,7 @@ wysihtml5.Commands = Base.extend( * commands.supports("createLink"); */ support: function(command) { - return wysihtml5.browser.supportsCommand(this.doc, command); + return wysihtml.browser.supportsCommand(this.doc, command); }, /** @@ -32,14 +32,14 @@ wysihtml5.Commands = Base.extend( * commands.exec("insertImage", "http://a1.twimg.com/profile_images/113868655/schrei_twitter_reasonably_small.jpg"); */ exec: function(command, value) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), method = obj && obj.exec, result = null; // If composer ahs placeholder unset it before command // Do not apply on commands that are behavioral - if (this.composer.hasPlaceholderSet() && !wysihtml5.lang.array(['styleWithCSS', 'enableObjectResizing', 'enableInlineTableEditing']).contains(command)) { + if (this.composer.hasPlaceholderSet() && !wysihtml.lang.array(['styleWithCSS', 'enableObjectResizing', 'enableInlineTableEditing']).contains(command)) { this.composer.element.innerHTML = ""; this.composer.selection.selectNode(this.composer.element); } @@ -61,8 +61,8 @@ wysihtml5.Commands = Base.extend( }, remove: function(command, commandValue) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), method = obj && obj.remove; if (method) { args.unshift(this.composer); @@ -81,8 +81,8 @@ wysihtml5.Commands = Base.extend( * var isCurrentSelectionBold = commands.state("bold"); */ state: function(command, commandValue) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), method = obj && obj.state; if (method) { args.unshift(this.composer); @@ -99,8 +99,8 @@ wysihtml5.Commands = Base.extend( /* Get command state parsed value if command has stateValue parsing function */ stateValue: function(command) { - var obj = wysihtml5.commands[command], - args = wysihtml5.lang.array(arguments).get(), + var obj = wysihtml.commands[command], + args = wysihtml.lang.array(arguments).get(), method = obj && obj.stateValue; if (method) { args.unshift(this.composer); diff --git a/src/commands/addTableCells.js b/src/commands/addTableCells.js index a2a11f9..0eac66f 100644 --- a/src/commands/addTableCells.js +++ b/src/commands/addTableCells.js @@ -1,14 +1,14 @@ -(function(wysihtml5){ - wysihtml5.commands.addTableCells = { +(function(wysihtml){ + wysihtml.commands.addTableCells = { exec: function(composer, command, value) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { // switches start and end if start is bigger than end (reverse selection) - var tableSelect = wysihtml5.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end); + var tableSelect = wysihtml.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end); if (value == "before" || value == "above") { - wysihtml5.dom.table.addCells(tableSelect.start, value); + wysihtml.dom.table.addCells(tableSelect.start, value); } else if (value == "after" || value == "below") { - wysihtml5.dom.table.addCells(tableSelect.end, value); + wysihtml.dom.table.addCells(tableSelect.end, value); } setTimeout(function() { composer.tableSelection.select(tableSelect.start, tableSelect.end); @@ -20,4 +20,4 @@ return false; } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/commands/alignCenterStyle.js b/src/commands/alignCenterStyle.js deleted file mode 100644 index 9555640..0000000 --- a/src/commands/alignCenterStyle.js +++ /dev/null @@ -1,19 +0,0 @@ -(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "center", - toggle: true - }; - - wysihtml5.commands.alignCenterStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); diff --git a/src/commands/alignJustifyStyle.js b/src/commands/alignJustifyStyle.js deleted file mode 100644 index 65a7140..0000000 --- a/src/commands/alignJustifyStyle.js +++ /dev/null @@ -1,18 +0,0 @@ -(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "justify", - toggle: true - }; - - wysihtml5.commands.alignJustifyStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); diff --git a/src/commands/alignLeftStyle.js b/src/commands/alignLeftStyle.js deleted file mode 100644 index fd0b1c7..0000000 --- a/src/commands/alignLeftStyle.js +++ /dev/null @@ -1,19 +0,0 @@ -(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "left", - toggle: true - }; - - wysihtml5.commands.alignLeftStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); diff --git a/src/commands/alignRightStyle.js b/src/commands/alignRightStyle.js deleted file mode 100644 index 41f71d7..0000000 --- a/src/commands/alignRightStyle.js +++ /dev/null @@ -1,18 +0,0 @@ -(function(wysihtml5) { - - var nodeOptions = { - styleProperty: "textAlign", - styleValue: "right", - toggle: true - }; - - wysihtml5.commands.alignRightStyle = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; -})(wysihtml5); diff --git a/src/commands/bgColorStyle.js b/src/commands/bgColorStyle.js deleted file mode 100644 index b69024b..0000000 --- a/src/commands/bgColorStyle.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Sets text background color by inline styles - */ -(function(wysihtml5) { - - wysihtml5.commands.bgColorStyle = { - exec: function(composer, command, color) { - var colorVals = wysihtml5.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color"), - colString; - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); - } - }, - - state: function(composer, command, color) { - var colorVals = color ? wysihtml5.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color") : null, - colString; - - - if (colorVals) { - colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; - } - - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); - }, - - remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: 'backgroundColor'}); - }, - - stateValue: function(composer, command, props) { - var st = this.state(composer, command), - colorStr, - val = false; - - if (st && wysihtml5.lang.object(st).isArray()) { - st = st[0]; - } - - if (st) { - colorStr = st.getAttribute('style'); - if (colorStr) { - val = wysihtml5.quirks.styleParser.parseColor(colorStr, "background-color"); - return wysihtml5.quirks.styleParser.unparseColor(val, props); - } - } - return false; - } - - }; -})(wysihtml5); diff --git a/src/commands/bold.js b/src/commands/bold.js deleted file mode 100644 index e4e8df5..0000000 --- a/src/commands/bold.js +++ /dev/null @@ -1,18 +0,0 @@ -(function(wysihtml5) { - - var nodeOptions = { - nodeName: "B", - toggle: true - }; - - wysihtml5.commands.bold = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); diff --git a/src/commands/createLink.js b/src/commands/createLink.js index 9e48495..000ac61 100644 --- a/src/commands/createLink.js +++ b/src/commands/createLink.js @@ -1,4 +1,4 @@ -(function(wysihtml5) { +(function(wysihtml) { var nodeOptions = { nodeName: "A", @@ -7,10 +7,10 @@ function getOptions(value) { var options = typeof value === 'object' ? value : {'href': value}; - return wysihtml5.lang.object({}).merge(nodeOptions).merge({'attribute': value}).get(); + return wysihtml.lang.object({}).merge(nodeOptions).merge({'attribute': value}).get(); } - wysihtml5.commands.createLink = { + wysihtml.commands.createLink = { exec: function(composer, command, value) { var opts = getOptions(value); @@ -19,12 +19,12 @@ composer.selection.insertNode(textNode); composer.selection.selectNode(textNode); } - wysihtml5.commands.formatInline.exec(composer, command, opts); + wysihtml.commands.formatInline.exec(composer, command, opts); }, state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); } }; -})(wysihtml5); +})(wysihtml); diff --git a/src/commands/createTable.js b/src/commands/createTable.js index d829a24..b384344 100644 --- a/src/commands/createTable.js +++ b/src/commands/createTable.js @@ -1,5 +1,5 @@ -(function(wysihtml5){ - wysihtml5.commands.createTable = { +(function(wysihtml){ + wysihtml.commands.createTable = { exec: function(composer, command, value) { var col, row, html; if (value && value.cols && value.rows && parseInt(value.cols, 10) > 0 && parseInt(value.rows, 10) > 0) { @@ -27,4 +27,4 @@ } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/commands/deleteTableCells.js b/src/commands/deleteTableCells.js index e68c263..a75b668 100644 --- a/src/commands/deleteTableCells.js +++ b/src/commands/deleteTableCells.js @@ -1,27 +1,27 @@ -(function(wysihtml5){ - wysihtml5.commands.deleteTableCells = { +(function(wysihtml){ + wysihtml.commands.deleteTableCells = { exec: function(composer, command, value) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { - var tableSelect = wysihtml5.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end), - idx = wysihtml5.dom.table.indexOf(tableSelect.start), + var tableSelect = wysihtml.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end), + idx = wysihtml.dom.table.indexOf(tableSelect.start), selCell, table = composer.tableSelection.table; - wysihtml5.dom.table.removeCells(tableSelect.start, value); + wysihtml.dom.table.removeCells(tableSelect.start, value); setTimeout(function() { // move selection to next or previous if not present - selCell = wysihtml5.dom.table.findCell(table, idx); + selCell = wysihtml.dom.table.findCell(table, idx); if (!selCell){ if (value == "row") { - selCell = wysihtml5.dom.table.findCell(table, { + selCell = wysihtml.dom.table.findCell(table, { "row": idx.row - 1, "col": idx.col }); } if (value == "column") { - selCell = wysihtml5.dom.table.findCell(table, { + selCell = wysihtml.dom.table.findCell(table, { "row": idx.row, "col": idx.col - 1 }); @@ -38,4 +38,4 @@ return false; } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/commands/fontSize.js b/src/commands/fontSize.js deleted file mode 100644 index 0fe9c5c..0000000 --- a/src/commands/fontSize.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Set font size css class - */ -(function(wysihtml5) { - var REG_EXP = /wysiwyg-font-size-[0-9a-z\-]+/g; - - wysihtml5.commands.fontSize = { - exec: function(composer, command, size) { - wysihtml5.commands.formatInline.exec(composer, command, {className: "wysiwyg-font-size-" + size, classRegExp: REG_EXP, toggle: true}); - }, - - state: function(composer, command, size) { - return wysihtml5.commands.formatInline.state(composer, command, {className: "wysiwyg-font-size-" + size}); - } - }; -})(wysihtml5); diff --git a/src/commands/fontSizeStyle.js b/src/commands/fontSizeStyle.js deleted file mode 100644 index 81980a0..0000000 --- a/src/commands/fontSizeStyle.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Set font size by inline style - */ -(function(wysihtml5) { - - wysihtml5.commands.fontSizeStyle = { - exec: function(composer, command, size) { - size = size.size || size; - if (!(/^\s*$/).test(size)) { - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: "fontSize", styleValue: size, toggle: false}); - } - }, - - state: function(composer, command, size) { - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: "fontSize", styleValue: size || undefined}); - }, - - remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: "fontSize"}); - }, - - stateValue: function(composer, command) { - var styleStr, - st = this.state(composer, command); - - if (st && wysihtml5.lang.object(st).isArray()) { - st = st[0]; - } - if (st) { - styleStr = st.getAttribute("style"); - if (styleStr) { - return wysihtml5.quirks.styleParser.parseFontSize(styleStr); - } - } - return false; - } - }; -})(wysihtml5); diff --git a/src/commands/foreColor.js b/src/commands/foreColor.js deleted file mode 100644 index c2283ea..0000000 --- a/src/commands/foreColor.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Set color css class - */ -(function(wysihtml5) { - var REG_EXP = /wysiwyg-color-[0-9a-z]+/g; - - wysihtml5.commands.foreColor = { - exec: function(composer, command, color) { - wysihtml5.commands.formatInline.exec(composer, command, {className: "wysiwyg-color-" + color, classRegExp: REG_EXP, toggle: true}); - }, - - state: function(composer, command, color) { - return wysihtml5.commands.formatInline.state(composer, command, {className: "wysiwyg-color-" + color}); - } - }; -})(wysihtml5); diff --git a/src/commands/formatBlock.js b/src/commands/formatBlock.js index 0ff05d6..f73cf80 100644 --- a/src/commands/formatBlock.js +++ b/src/commands/formatBlock.js @@ -3,9 +3,9 @@ * It tries to solve the case that some block elements should not contain other block level elements (h1-6, p, ...) * */ -(function(wysihtml5) { +(function(wysihtml) { - var dom = wysihtml5.dom, + var dom = wysihtml.dom, // When the caret is within a H1 and the H4 is invoked, the H1 should turn into H4 // instead of creating a H4 within a H1 which would result in semantically invalid html UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre", @@ -51,18 +51,18 @@ // Removes empty block level elements function cleanup(composer, newBlockElements) { - wysihtml5.dom.removeInvisibleSpaces(composer.element); + wysihtml.dom.removeInvisibleSpaces(composer.element); var container = composer.element, allElements = container.querySelectorAll(BLOCK_ELEMENTS), noEditQuery = composer.config.classNames.uneditableContainer + ([""]).concat(BLOCK_ELEMENTS.split(',')).join(", " + composer.config.classNames.uneditableContainer + ' '), uneditables = container.querySelectorAll(noEditQuery), - elements = wysihtml5.lang.array(allElements).without(uneditables), // Lets not touch uneditable elements and their contents + elements = wysihtml.lang.array(allElements).without(uneditables), // Lets not touch uneditable elements and their contents nbIdx; for (var i = elements.length; i--;) { if (elements[i].innerHTML.replace(/[\uFEFF]/g, '') === "" && (newBlockElements.length === 0 || elements[i] !== newBlockElements[newBlockElements.length - 1])) { // If cleanup removes some new block elements. remove them from newblocks array too - nbIdx = wysihtml5.lang.array(newBlockElements).indexOf(elements[i]); + nbIdx = wysihtml.lang.array(newBlockElements).indexOf(elements[i]); if (nbIdx > -1) { newBlockElements.splice(nbIdx, 1); } @@ -131,7 +131,7 @@ if (!element) { element = composer.doc.createElement(options.nodeName || defaultNodeName(composer)); // Add invisible space as otherwise webkit cannot set selection or range to it correctly - element.appendChild(composer.doc.createTextNode(wysihtml5.INVISIBLE_SPACE)); + element.appendChild(composer.doc.createTextNode(wysihtml.INVISIBLE_SPACE)); } if (options.nodeName && element.nodeName !== options.nodeName) { @@ -147,7 +147,7 @@ } if (options.styleProperty && typeof options.styleValue !== "undefined") { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } return element; @@ -162,7 +162,7 @@ unwrapped = false; if (options.styleProperty) { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = ''; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = ''; } if (options.className) { element.classList.remove(options.className); @@ -204,8 +204,8 @@ nextEl, prevEl; for (var i = blocks.length; i--;) { - nextEl = wysihtml5.dom.domNode(blocks[i]).next({nodeTypes: [1,3], ignoreBlankTexts: true}), - prevEl = wysihtml5.dom.domNode(blocks[i]).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + nextEl = wysihtml.dom.domNode(blocks[i]).next({nodeTypes: [1,3], ignoreBlankTexts: true}), + prevEl = wysihtml.dom.domNode(blocks[i]).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (nextEl && nextEl.nodeType !== 1 && nextEl.nodeName !== 'BR') { if ((blocks[i].innerHTML || blocks[i].nodeValue || '').trim() !== '') { @@ -217,7 +217,7 @@ blocks[i].parentNode.insertBefore(blocks[i].ownerDocument.createElement('BR'), nextEl); } } - wysihtml5.dom.unwrap(blocks[i]); + wysihtml.dom.unwrap(blocks[i]); } } @@ -309,7 +309,7 @@ // Range starts before and ends inside the node tmpRange = ranges[i].cloneRange(); - closestLI = wysihtml5.dom.domNode(lis[j]).prev({nodeTypes: [1]}); + closestLI = wysihtml.dom.domNode(lis[j]).prev({nodeTypes: [1]}); if (closestLI) { tmpRange.setEnd(closestLI, closestLI.childNodes.length); @@ -331,7 +331,7 @@ newRanges.push(tmpRange); // Find next LI in list and if present set range to it, else - closestLI = wysihtml5.dom.domNode(lis[j]).next({nodeTypes: [1]}); + closestLI = wysihtml.dom.domNode(lis[j]).next({nodeTypes: [1]}); if (closestLI) { ranges[i].setStart(closestLI, 0); } else if (lis[j].closest('ul, ol')) { @@ -352,7 +352,7 @@ // Return options object with nodeName set if original did not have any // Node name is set to local or global default function getOptionsWithNodename(options, defaultName, composer) { - var correctedOptions = (options) ? wysihtml5.lang.object(options).clone(true) : null; + var correctedOptions = (options) ? wysihtml.lang.object(options).clone(true) : null; if (correctedOptions) { correctedOptions.nodeName = correctedOptions.nodeName || defaultName || defaultNodeName(composer); } @@ -374,8 +374,8 @@ composer.selection.splitElementAtCaret(firstOuterBlock, fragment); - next = wysihtml5.dom.domNode(last).next({nodeTypes: [1,3], ignoreBlankTexts: true}); - prev = wysihtml5.dom.domNode(first).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + next = wysihtml.dom.domNode(last).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + prev = wysihtml.dom.domNode(first).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (first && !isLineBreaking(first, composer) && prev && !isLineBreaking(prev, composer)) { first.parentNode.insertBefore(composer.doc.createElement('br'), first); @@ -425,7 +425,7 @@ // Split block formating and add new block to wrap caret unwrapBlocksFromContent(content.firstChild); - children = wysihtml5.dom.unwrap(content.firstChild); + children = wysihtml.dom.unwrap(content.firstChild); // Add line break before if needed if (children.length > 0) { @@ -456,14 +456,14 @@ first = false; } - blocks = wysihtml5.lang.array(fragment.childNodes).get(); + blocks = wysihtml.lang.array(fragment.childNodes).get(); injectFragmentToRange(fragment, r, composer); return blocks; } // When block node is inserted, look surrounding nodes and remove surplous linebreak tags (as block format breaks line itself) function removeSurroundingLineBreaks(prevNode, nextNode, composer) { - var prevPrev = prevNode && wysihtml5.dom.domNode(prevNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + var prevPrev = prevNode && wysihtml.dom.domNode(prevNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); if (isBr(nextNode)) { nextNode.parentNode.removeChild(nextNode); } @@ -531,7 +531,7 @@ rangeStartContainer = r.startContainer, startNode = getRangeNode(r.startContainer, r.startOffset), endNode = getRangeNode(r.endContainer, r.endOffset), - prevNode = (r.startContainer === startNode && startNode.nodeType === 3 && !isWhitespaceBefore(startNode, r.startOffset)) ? startNode : wysihtml5.dom.domNode(startNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}), + prevNode = (r.startContainer === startNode && startNode.nodeType === 3 && !isWhitespaceBefore(startNode, r.startOffset)) ? startNode : wysihtml.dom.domNode(startNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}), nextNode = ( ( r.endContainer.nodeType === 1 && @@ -539,23 +539,23 @@ ( endNode.nodeType === 1 || !isWhitespaceAfter(endNode, r.endOffset) && - !wysihtml5.dom.domNode(endNode).is.rangyBookmark() + !wysihtml.dom.domNode(endNode).is.rangyBookmark() ) ) || ( r.endContainer === endNode && endNode.nodeType === 3 && !isWhitespaceAfter(endNode, r.endOffset) ) - ) ? endNode : wysihtml5.dom.domNode(endNode).next({nodeTypes: [1,3], ignoreBlankTexts: true}), + ) ? endNode : wysihtml.dom.domNode(endNode).next({nodeTypes: [1,3], ignoreBlankTexts: true}), content = r.extractContents(), fragment = composer.doc.createDocumentFragment(), - similarOuterBlock = similarOptions ? wysihtml5.dom.getParentElement(rangeStartContainer, similarOptions, null, composer.element) : null, + similarOuterBlock = similarOptions ? wysihtml.dom.getParentElement(rangeStartContainer, similarOptions, null, composer.element) : null, splitAllBlocks = !closestBlockName || !options || (options.nodeName === "BLOCKQUOTE" && closestBlockName === "BLOCKQUOTE"), firstOuterBlock = similarOuterBlock || findOuterBlock(rangeStartContainer, composer.element, splitAllBlocks), // The outermost un-nestable block element parent of selection start wrapper, blocks, children, firstc, lastC; - if (wysihtml5.dom.domNode(nextNode).is.rangyBookmark()) { + if (wysihtml.dom.domNode(nextNode).is.rangyBookmark()) { endNode = nextNode; nextNode = endNode.nextSibling; } @@ -605,7 +605,7 @@ } } - blocks = wysihtml5.lang.array(fragment.childNodes).get(); + blocks = wysihtml.lang.array(fragment.childNodes).get(); } injectFragmentToRange(fragment, r, composer, firstOuterBlock); removeSurroundingLineBreaks(prevNode, nextNode, composer); @@ -614,7 +614,7 @@ // (if it contains rangy bookmark, so selection can be restored later correctly) if (blocks.length > 0 && ( - typeof blocks[blocks.length - 1].lastChild === "undefined" || wysihtml5.dom.domNode(blocks[blocks.length - 1].lastChild).is.rangyBookmark() + typeof blocks[blocks.length - 1].lastChild === "undefined" || wysihtml.dom.domNode(blocks[blocks.length - 1].lastChild).is.rangyBookmark() ) ) { blocks[blocks.length - 1].appendChild(composer.doc.createElement('br')); @@ -624,7 +624,7 @@ // Find closest block level element function getParentBlockNodeName(element, composer) { - var parentNode = wysihtml5.dom.getParentElement(element, { + var parentNode = wysihtml.dom.getParentElement(element, { query: BLOCK_ELEMENTS }, null, composer.element); @@ -639,7 +639,7 @@ // // If nothing found selects the current line function expandCaretToBlock(composer, insertingNodeName) { - var parent = wysihtml5.dom.getParentElement(composer.selection.getOwnRanges()[0].startContainer, { + var parent = wysihtml.dom.getParentElement(composer.selection.getOwnRanges()[0].startContainer, { query: UNNESTABLE_BLOCK_ELEMENTS + ', ' + (insertingNodeName ? insertingNodeName.toLowerCase() : 'div'), }, null, composer.element), range; @@ -705,13 +705,13 @@ if (caretInfo && caretInfo.caretNode) { if ( // caret is allready breaknode - wysihtml5.dom.domNode(caretInfo.caretNode).is.lineBreak() || + wysihtml.dom.domNode(caretInfo.caretNode).is.lineBreak() || // caret is textnode - (caretInfo.caretNode.nodeType === 3 && caretInfo.textOffset === 0 && (!caretInfo.prevNode || wysihtml5.dom.domNode(caretInfo.prevNode).is.lineBreak())) || + (caretInfo.caretNode.nodeType === 3 && caretInfo.textOffset === 0 && (!caretInfo.prevNode || wysihtml.dom.domNode(caretInfo.prevNode).is.lineBreak())) || // Caret is temprorary rangy selection marker (caretInfo.caretNode.nodeType === 1 && caretInfo.caretNode.classList.contains('rangySelectionBoundary') && - (!caretInfo.prevNode || wysihtml5.dom.domNode(caretInfo.prevNode).is.lineBreak() || wysihtml5.dom.domNode(caretInfo.prevNode).is.block()) && - (!caretInfo.nextNode || wysihtml5.dom.domNode(caretInfo.nextNode).is.lineBreak() || wysihtml5.dom.domNode(caretInfo.nextNode).is.block()) + (!caretInfo.prevNode || wysihtml.dom.domNode(caretInfo.prevNode).is.lineBreak() || wysihtml.dom.domNode(caretInfo.prevNode).is.block()) && + (!caretInfo.nextNode || wysihtml.dom.domNode(caretInfo.nextNode).is.lineBreak() || wysihtml.dom.domNode(caretInfo.nextNode).is.block()) ) ) { return true; @@ -721,7 +721,7 @@ return false; } - wysihtml5.commands.formatBlock = { + wysihtml.commands.formatBlock = { exec: function(composer, command, options) { options = parseOptions(options); var newBlockElements = [], @@ -797,7 +797,7 @@ options = parseOptions(options); var nodes = composer.selection.filterElements((function (element) { // Finds matching elements inside selection - return wysihtml5.dom.domNode(element).test(options || { query: BLOCK_ELEMENTS }); + return wysihtml.dom.domNode(element).test(options || { query: BLOCK_ELEMENTS }); }).bind(this)), parentNodes = composer.selection.getSelectedOwnNodes(), parent; @@ -814,4 +814,4 @@ } }; -})(wysihtml5); +})(wysihtml); diff --git a/src/commands/formatInline.js b/src/commands/formatInline.js index 1768a0b..f476fc6 100644 --- a/src/commands/formatInline.js +++ b/src/commands/formatInline.js @@ -3,7 +3,7 @@ * See https://github.com/Voog/wysihtml/pull/169 for specification of action */ -(function(wysihtml5) { +(function(wysihtml) { var defaultTag = "SPAN", INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u", @@ -25,8 +25,8 @@ // Associative arrays in javascript are really objects and do not have length defined // Thus have to check emptyness in a different way function hasNoAttributes(element) { - var attr = wysihtml5.dom.getAttributes(element); - return wysihtml5.lang.object(attr).isEmpty(); + var attr = wysihtml.dom.getAttributes(element); + return wysihtml.lang.object(attr).isEmpty(); } // compares two nodes if they are semantically the same @@ -45,14 +45,14 @@ classes1 = element1.className.trim().replace(/\s+/g, ' ').split(' '); classes2 = element2.className.trim().replace(/\s+/g, ' ').split(' '); - if (wysihtml5.lang.array(classes1).without(classes2).length > 0) { + if (wysihtml.lang.array(classes1).without(classes2).length > 0) { return false; } - attr1 = wysihtml5.dom.getAttributes(element1); - attr2 = wysihtml5.dom.getAttributes(element2); + attr1 = wysihtml.dom.getAttributes(element1); + attr2 = wysihtml.dom.getAttributes(element2); - if (attr1.length !== attr2.length || !wysihtml5.lang.object(wysihtml5.lang.object(attr1).difference(attr2)).isEmpty()) { + if (attr1.length !== attr2.length || !wysihtml.lang.object(wysihtml.lang.object(attr1).difference(attr2)).isEmpty()) { return false; } @@ -73,7 +73,7 @@ } if (options.styleProperty && typeof options.styleValue !== "undefined") { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } if (options.attribute) { @@ -107,9 +107,9 @@ // If attrbutes and values are the same > remove // if attributes or values function updateElementAttributes(element, newAttributes, toggle) { - var attr = wysihtml5.dom.getAttributes(element), + var attr = wysihtml.dom.getAttributes(element), fullContain = containsSameAttributes(newAttributes, attr), - attrDifference = wysihtml5.lang.object(attr).difference(newAttributes), + attrDifference = wysihtml.lang.object(attr).difference(newAttributes), a, b; if (fullContain && toggle !== false) { @@ -120,7 +120,7 @@ } } else { - /*if (!wysihtml5.lang.object(attrDifference).isEmpty()) { + /*if (!wysihtml.lang.object(attrDifference).isEmpty()) { for (b in attrDifference) { if (attrDifference.hasOwnProperty(b)) { element.removeAttribute(b); @@ -155,10 +155,10 @@ // change/remove style if (options.styleProperty) { - if (options.toggle !== false && element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)].trim().replace(/, /g, ",") === options.styleValue) { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = ''; + if (options.toggle !== false && element.style[wysihtml.browser.fixStyleKey(options.styleProperty)].trim().replace(/, /g, ",") === options.styleValue) { + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = ''; } else { - element.style[wysihtml5.browser.fixStyleKey(options.styleProperty)] = options.styleValue; + element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; } } if (hasNoStyle(element)) { @@ -178,7 +178,7 @@ // Handle similar semantically same elements (queryAliasMap) nodeNameQuery = options.nodeName ? queryAliasMap[options.nodeName.toLowerCase()] || options.nodeName.toLowerCase() : null; - nodeQueryMatch = nodeNameQuery ? wysihtml5.dom.domNode(element).test({ query: nodeNameQuery }) : false; + nodeQueryMatch = nodeNameQuery ? wysihtml.dom.domNode(element).test({ query: nodeNameQuery }) : false; // Unwrap element if no attributes present and node name given // or no attributes and if no nodename set but node is the default @@ -187,7 +187,7 @@ ((options.toggle !== false && nodeQueryMatch) || (!options.nodeName && element.nodeName === defaultTag)) && hasNoClass(element) && hasNoStyle(element) && hasNoAttributes(element) ) { - wysihtml5.dom.unwrap(element); + wysihtml.dom.unwrap(element); } } @@ -201,7 +201,7 @@ if (!selection.isCollapsed()) { textNodes = textNodes.concat(selection.getOwnNodes([3], function(node) { // Exclude empty nodes except caret node - return (!wysihtml5.dom.domNode(node).is.emptyTextNode()); + return (!wysihtml.dom.domNode(node).is.emptyTextNode()); }, splitBounds)); } @@ -237,11 +237,11 @@ var o; if (options.nodeName) { var query = queryAliasMap[options.nodeName.toLowerCase()] || options.nodeName.toLowerCase(); - return wysihtml5.dom.domNode(node).test({ query: query }); + return wysihtml.dom.domNode(node).test({ query: query }); } else { - o = wysihtml5.lang.object(options).clone(); + o = wysihtml.lang.object(options).clone(); o.query = INLINE_ELEMENTS; // make sure only inline elements with styles and classes are counted - return wysihtml5.dom.domNode(node).test(o); + return wysihtml.dom.domNode(node).test(o); } } @@ -257,7 +257,7 @@ try { rangy.getSelection(composer.win).addRange(range); } catch (e) {} - if (!composer.doc.activeElement || !wysihtml5.dom.contains(composer.element, composer.doc.activeElement)) { + if (!composer.doc.activeElement || !wysihtml.dom.contains(composer.element, composer.doc.activeElement)) { composer.element.focus(); d.scrollTop = oldScrollTop; d.scrollLeft = oldScrollLeft; @@ -374,7 +374,7 @@ range.setStartAndEnd(anchor, offsetStart, offsetEnd); range.splitBoundaries(); txtNodes = range.getNodes([3], function(node) { - return (!wysihtml5.dom.domNode(node).is.emptyTextNode()); + return (!wysihtml.dom.domNode(node).is.emptyTextNode()); }); return { @@ -446,7 +446,7 @@ if (wrapNode) { newWrapNode = wrapNode.cloneNode(false); - wysihtml5.dom.domNode(textNode).escapeParent(wrapNode, newWrapNode); + wysihtml.dom.domNode(textNode).escapeParent(wrapNode, newWrapNode); updateFormatOfElement(newWrapNode, options); } } @@ -457,7 +457,7 @@ wrapNode = findSimilarTextNodeWrapper(textNode, options, container); if (wrapNode) { - wysihtml5.dom.domNode(textNode).escapeParent(wrapNode); + wysihtml.dom.domNode(textNode).escapeParent(wrapNode); } } @@ -491,7 +491,7 @@ } else { // Escape caret out of format - textNode = composer.doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + textNode = composer.doc.createTextNode(wysihtml.INVISIBLE_SPACE); newNode = state.nodes[0].cloneNode(false); newNode.appendChild(textNode); composer.selection.splitElementAtCaret(state.nodes[0], newNode); @@ -556,7 +556,7 @@ textOffset = selection.anchorOffset; for (i = state.nodes.length; i--;) { - wysihtml5.dom.unwrap(state.nodes[i]); + wysihtml.dom.unwrap(state.nodes[i]); } cleanupAndSetCaret(composer, textNode, textOffset, options); @@ -604,7 +604,7 @@ return options; } - wysihtml5.commands.formatInline = { + wysihtml.commands.formatInline = { // Basics: // In case of plain text or inline state not set wrap all non-empty textnodes with @@ -650,4 +650,4 @@ } }; -})(wysihtml5); +})(wysihtml); diff --git a/src/commands/indentList.js b/src/commands/indentList.js index 2195fb9..96e326d 100644 --- a/src/commands/indentList.js +++ b/src/commands/indentList.js @@ -1,5 +1,5 @@ -(function(wysihtml5){ - wysihtml5.commands.indentList = { +(function(wysihtml){ + wysihtml.commands.indentList = { exec: function(composer, command, value) { var listEls = composer.selection.getSelectionParentsByTag('LI'); if (listEls) { @@ -22,7 +22,7 @@ liNode = liNodes[i]; listTag = (liNode.parentNode.nodeName === 'OL') ? 'OL' : 'UL'; list = liNode.ownerDocument.createElement(listTag); - prevLi = wysihtml5.dom.domNode(liNode).prev({nodeTypes: [wysihtml5.ELEMENT_NODE]}); + prevLi = wysihtml.dom.domNode(liNode).prev({nodeTypes: [wysihtml.ELEMENT_NODE]}); prevLiList = (prevLi) ? prevLi.querySelector('ul, ol') : null; if (prevLi) { @@ -40,4 +40,4 @@ return found; } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/commands/insertBlockQuote.js b/src/commands/insertBlockQuote.js deleted file mode 100644 index 4ebf31f..0000000 --- a/src/commands/insertBlockQuote.js +++ /dev/null @@ -1,18 +0,0 @@ -(function(wysihtml5) { - - var nodeOptions = { - nodeName: "BLOCKQUOTE", - toggle: true - }; - - wysihtml5.commands.insertBlockQuote = { - exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); - } - }; - -})(wysihtml5); diff --git a/src/commands/insertHTML.js b/src/commands/insertHTML.js index 63faf47..89727a0 100644 --- a/src/commands/insertHTML.js +++ b/src/commands/insertHTML.js @@ -1,5 +1,5 @@ -(function(wysihtml5){ - wysihtml5.commands.insertHTML = { +(function(wysihtml){ + wysihtml.commands.insertHTML = { exec: function(composer, command, html) { composer.selection.insertHTML(html); }, @@ -8,4 +8,4 @@ return false; } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/commands/insertLineBreak.js b/src/commands/insertLineBreak.js index 4ec9d48..f595460 100644 --- a/src/commands/insertLineBreak.js +++ b/src/commands/insertLineBreak.js @@ -1,7 +1,7 @@ -(function(wysihtml5) { - var LINE_BREAK = "
    " + (wysihtml5.browser.needsSpaceAfterLineBreak() ? " " : ""); +(function(wysihtml) { + var LINE_BREAK = "
    " + (wysihtml.browser.needsSpaceAfterLineBreak() ? " " : ""); - wysihtml5.commands.insertLineBreak = { + wysihtml.commands.insertLineBreak = { exec: function(composer, command) { composer.selection.insertHTML(LINE_BREAK); }, @@ -10,4 +10,4 @@ return false; } }; -})(wysihtml5); +})(wysihtml); diff --git a/src/commands/insertList.js b/src/commands/insertList.js index 0d5109c..2a1847c 100644 --- a/src/commands/insertList.js +++ b/src/commands/insertList.js @@ -1,4 +1,4 @@ -wysihtml5.commands.insertList = (function(wysihtml5) { +wysihtml.commands.insertList = (function(wysihtml) { var isNode = function(node, name) { if (node && node.nodeName) { @@ -21,7 +21,7 @@ wysihtml5.commands.insertList = (function(wysihtml5) { }; if (node) { - var parentLi = wysihtml5.dom.getParentElement(node, { query: "li" }, false, composer.element), + var parentLi = wysihtml.dom.getParentElement(node, { query: "li" }, false, composer.element), otherNodeName = (nodeName === "UL") ? "OL" : "UL"; if (isNode(node, nodeName)) { @@ -63,15 +63,15 @@ wysihtml5.commands.insertList = (function(wysihtml5) { otherLists = getListsInSelection(otherNodeName, composer); if (otherLists.length) { for (var l = otherLists.length; l--;) { - wysihtml5.dom.renameElement(otherLists[l], nodeName.toLowerCase()); + wysihtml.dom.renameElement(otherLists[l], nodeName.toLowerCase()); } } else { innerLists = getListsInSelection(['OL', 'UL'], composer); for (var i = innerLists.length; i--;) { - wysihtml5.dom.resolveList(innerLists[i], composer.config.useLineBreaks); + wysihtml.dom.resolveList(innerLists[i], composer.config.useLineBreaks); } if (innerLists.length === 0) { - wysihtml5.dom.resolveList(el, composer.config.useLineBreaks); + wysihtml.dom.resolveList(el, composer.config.useLineBreaks); } } }); @@ -89,7 +89,7 @@ wysihtml5.commands.insertList = (function(wysihtml5) { // All selection inner lists get renamed too for (var l = renameLists.length; l--;) { - wysihtml5.dom.renameElement(renameLists[l], nodeName.toLowerCase()); + wysihtml.dom.renameElement(renameLists[l], nodeName.toLowerCase()); } }); }; @@ -123,10 +123,10 @@ wysihtml5.commands.insertList = (function(wysihtml5) { // This space causes new lists to never break on enter var INVISIBLE_SPACE_REG_EXP = /\uFEFF/g; - tempElement.innerHTML = tempElement.innerHTML.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + tempElement.innerHTML = tempElement.innerHTML.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); if (tempElement) { isEmpty = (/^(\s|(
    ))+$/i).test(tempElement.innerHTML); - list = wysihtml5.dom.convertToList(tempElement, nodeName.toLowerCase(), composer.parent.config.classNames.uneditableContainer); + list = wysihtml.dom.convertToList(tempElement, nodeName.toLowerCase(), composer.parent.config.classNames.uneditableContainer); if (sel) { rangy.restoreSelection(sel); } @@ -150,18 +150,18 @@ wysihtml5.commands.insertList = (function(wysihtml5) { anode = [fnode, fnode = anode][0]; } - if (wysihtml5.dom.domNode(fnode).is.emptyTextNode(true) && fnode) { - fnode = wysihtml5.dom.domNode(fnode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + if (wysihtml.dom.domNode(fnode).is.emptyTextNode(true) && fnode) { + fnode = wysihtml.dom.domNode(fnode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); } - if (wysihtml5.dom.domNode(anode).is.emptyTextNode(true) && anode) { - anode = wysihtml5.dom.domNode(anode).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + if (wysihtml.dom.domNode(anode).is.emptyTextNode(true) && anode) { + anode = wysihtml.dom.domNode(anode).next({nodeTypes: [1,3], ignoreBlankTexts: true}); } if (anode && fnode) { if (anode === fnode) { selectedNode = anode; } else { - selectedNode = wysihtml5.dom.domNode(anode).commonAncestor(fnode, composer.element); + selectedNode = wysihtml.dom.domNode(anode).commonAncestor(fnode, composer.element); } } else { selectedNode = composer.selection.getSelectedNode(); @@ -190,4 +190,4 @@ wysihtml5.commands.insertList = (function(wysihtml5) { } }; -})(wysihtml5); +})(wysihtml); diff --git a/src/commands/insertOrderedList.js b/src/commands/insertOrderedList.js deleted file mode 100644 index c365b8a..0000000 --- a/src/commands/insertOrderedList.js +++ /dev/null @@ -1,11 +0,0 @@ -(function(wysihtml5){ - wysihtml5.commands.insertOrderedList = { - exec: function(composer, command) { - wysihtml5.commands.insertList.exec(composer, command, "OL"); - }, - - state: function(composer, command) { - return wysihtml5.commands.insertList.state(composer, command, "OL"); - } - }; -}(wysihtml5)); diff --git a/src/commands/insertUnorderedList.js b/src/commands/insertUnorderedList.js deleted file mode 100644 index 1c550a4..0000000 --- a/src/commands/insertUnorderedList.js +++ /dev/null @@ -1,11 +0,0 @@ -(function(wysihtml5){ - wysihtml5.commands.insertUnorderedList = { - exec: function(composer, command) { - wysihtml5.commands.insertList.exec(composer, command, "UL"); - }, - - state: function(composer, command) { - return wysihtml5.commands.insertList.state(composer, command, "UL"); - } - }; -}(wysihtml5)); diff --git a/src/commands/italic.js b/src/commands/italic.js deleted file mode 100644 index acdfb6d..0000000 --- a/src/commands/italic.js +++ /dev/null @@ -1,18 +0,0 @@ -(function(wysihtml5){ - - var nodeOptions = { - nodeName: "I", - toggle: true - }; - - wysihtml5.commands.italic = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); diff --git a/src/commands/mergeTableCells.js b/src/commands/mergeTableCells.js index 3801125..6060767 100644 --- a/src/commands/mergeTableCells.js +++ b/src/commands/mergeTableCells.js @@ -1,11 +1,11 @@ -(function(wysihtml5){ - wysihtml5.commands.mergeTableCells = { +(function(wysihtml){ + wysihtml.commands.mergeTableCells = { exec: function(composer, command) { if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { if (this.state(composer, command)) { - wysihtml5.dom.table.unmergeCell(composer.tableSelection.start); + wysihtml.dom.table.unmergeCell(composer.tableSelection.start); } else { - wysihtml5.dom.table.mergeCellsBetween(composer.tableSelection.start, composer.tableSelection.end); + wysihtml.dom.table.mergeCellsBetween(composer.tableSelection.start, composer.tableSelection.end); } } }, @@ -16,11 +16,11 @@ end = composer.tableSelection.end; if (start && end && start == end && (( - wysihtml5.dom.getAttribute(start, "colspan") && - parseInt(wysihtml5.dom.getAttribute(start, "colspan"), 10) > 1 + wysihtml.dom.getAttribute(start, "colspan") && + parseInt(wysihtml.dom.getAttribute(start, "colspan"), 10) > 1 ) || ( - wysihtml5.dom.getAttribute(start, "rowspan") && - parseInt(wysihtml5.dom.getAttribute(start, "rowspan"), 10) > 1 + wysihtml.dom.getAttribute(start, "rowspan") && + parseInt(wysihtml.dom.getAttribute(start, "rowspan"), 10) > 1 )) ) { return [start]; @@ -29,4 +29,4 @@ return false; } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/commands/outdentList.js b/src/commands/outdentList.js index 33d1bbf..fbc11e3 100644 --- a/src/commands/outdentList.js +++ b/src/commands/outdentList.js @@ -1,6 +1,6 @@ -(function(wysihtml5){ +(function(wysihtml){ - wysihtml5.commands.outdentList = { + wysihtml.commands.outdentList = { exec: function(composer, command, value) { var listEls = composer.selection.getSelectionParentsByTag('LI'); if (listEls) { @@ -28,8 +28,8 @@ if (listNode.tagName === 'OL' || listNode.tagName === 'UL') { found = true; - outerListNode = wysihtml5.dom.getParentElement(listNode.parentNode, { query: 'ol, ul' }, false, composer.element); - outerLiNode = wysihtml5.dom.getParentElement(listNode.parentNode, { query: 'li' }, false, composer.element); + outerListNode = wysihtml.dom.getParentElement(listNode.parentNode, { query: 'ol, ul' }, false, composer.element); + outerLiNode = wysihtml.dom.getParentElement(listNode.parentNode, { query: 'li' }, false, composer.element); if (outerListNode && outerLiNode) { @@ -78,4 +78,4 @@ } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/commands/redo.js b/src/commands/redo.js index ab87aa6..38657d9 100644 --- a/src/commands/redo.js +++ b/src/commands/redo.js @@ -1,5 +1,5 @@ -(function(wysihtml5){ - wysihtml5.commands.redo = { +(function(wysihtml){ + wysihtml.commands.redo = { exec: function(composer) { return composer.undoManager.redo(); }, @@ -8,4 +8,4 @@ return false; } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/commands/removeLink.js b/src/commands/removeLink.js index 6543cc7..9092b16 100644 --- a/src/commands/removeLink.js +++ b/src/commands/removeLink.js @@ -1,17 +1,17 @@ -(function(wysihtml5) { +(function(wysihtml) { var nodeOptions = { nodeName: "A" }; - wysihtml5.commands.removeLink = { + wysihtml.commands.removeLink = { exec: function(composer, command) { - wysihtml5.commands.formatInline.remove(composer, command, nodeOptions); + wysihtml.commands.formatInline.remove(composer, command, nodeOptions); }, state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); } }; -})(wysihtml5); +})(wysihtml); diff --git a/src/commands/subscript.js b/src/commands/subscript.js deleted file mode 100644 index ff2ebf1..0000000 --- a/src/commands/subscript.js +++ /dev/null @@ -1,17 +0,0 @@ -(function(wysihtml5){ - - var nodeOptions = { - nodeName: "SUB", - toggle: true - }; - - wysihtml5.commands.subscript = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; -}(wysihtml5)); diff --git a/src/commands/superscript.js b/src/commands/superscript.js deleted file mode 100644 index 6192d4c..0000000 --- a/src/commands/superscript.js +++ /dev/null @@ -1,17 +0,0 @@ -(function(wysihtml5) { - - var nodeOptions = { - nodeName: "SUP", - toggle: true - }; - - wysihtml5.commands.superscript = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; -}(wysihtml5)); diff --git a/src/commands/underline.js b/src/commands/underline.js deleted file mode 100644 index 6b1adb5..0000000 --- a/src/commands/underline.js +++ /dev/null @@ -1,18 +0,0 @@ -(function(wysihtml5){ - - var nodeOptions = { - nodeName: "U", - toggle: true - }; - - wysihtml5.commands.underline = { - exec: function(composer, command) { - wysihtml5.commands.formatInline.exec(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml5.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -}(wysihtml5)); diff --git a/src/commands/undo.js b/src/commands/undo.js index 14c7e13..6feb69b 100644 --- a/src/commands/undo.js +++ b/src/commands/undo.js @@ -1,5 +1,5 @@ -(function(wysihtml5){ - wysihtml5.commands.undo = { +(function(wysihtml){ + wysihtml.commands.undo = { exec: function(composer) { return composer.undoManager.undo(); }, @@ -8,4 +8,4 @@ return false; } }; -}(wysihtml5)); +}(wysihtml)); diff --git a/src/dom/auto_link.js b/src/dom/auto_link.js index 2d013ea..328951d 100644 --- a/src/dom/auto_link.js +++ b/src/dom/auto_link.js @@ -6,13 +6,13 @@ * * @example *

    Please click here: www.google.com
    - * + * */ -(function(wysihtml5) { +(function(wysihtml) { var /** * Don't auto-link urls that are contained in the following elements: */ - IGNORE_URLS_IN = wysihtml5.lang.array(["CODE", "PRE", "A", "SCRIPT", "HEAD", "TITLE", "STYLE"]), + IGNORE_URLS_IN = wysihtml.lang.array(["CODE", "PRE", "A", "SCRIPT", "HEAD", "TITLE", "STYLE"]), /** * revision 1: * /(\S+\.{1}[^\s\,\.\!]+)/g @@ -85,7 +85,7 @@ */ function _wrapMatchesInNode(textNode) { var parentNode = textNode.parentNode, - nodeValue = wysihtml5.lang.string(textNode.data).escapeHTML(), + nodeValue = wysihtml.lang.string(textNode.data).escapeHTML(), tempElement = _getTempElement(parentNode.ownerDocument); // We need to insert an empty/temporary to fix IE quirks @@ -105,7 +105,7 @@ while (node.parentNode) { node = node.parentNode; nodeName = node.nodeName; - if (node.className && wysihtml5.lang.array(node.className.split(' ')).contains(ignoreInClasses)) { + if (node.className && wysihtml.lang.array(node.className.split(' ')).contains(ignoreInClasses)) { return true; } if (IGNORE_URLS_IN.contains(nodeName)) { @@ -122,16 +122,16 @@ return; } - if (element.className && wysihtml5.lang.array(element.className.split(' ')).contains(ignoreInClasses)) { + if (element.className && wysihtml.lang.array(element.className.split(' ')).contains(ignoreInClasses)) { return; } - if (element.nodeType === wysihtml5.TEXT_NODE && element.data.match(URL_REG_EXP)) { + if (element.nodeType === wysihtml.TEXT_NODE && element.data.match(URL_REG_EXP)) { _wrapMatchesInNode(element); return; } - var childNodes = wysihtml5.lang.array(element.childNodes).get(), + var childNodes = wysihtml.lang.array(element.childNodes).get(), childNodesLength = childNodes.length, i = 0; @@ -142,8 +142,8 @@ return element; } - wysihtml5.dom.autoLink = autoLink; + wysihtml.dom.autoLink = autoLink; // Reveal url reg exp to the outside - wysihtml5.dom.autoLink.URL_REG_EXP = URL_REG_EXP; -})(wysihtml5); + wysihtml.dom.autoLink.URL_REG_EXP = URL_REG_EXP; +})(wysihtml); diff --git a/src/dom/class.js b/src/dom/class.js index 06510c2..ff8f293 100644 --- a/src/dom/class.js +++ b/src/dom/class.js @@ -1,5 +1,5 @@ -(function(wysihtml5) { - var api = wysihtml5.dom; +(function(wysihtml) { + var api = wysihtml.dom; api.addClass = function(element, className) { var classList = element.classList; @@ -30,4 +30,4 @@ var elementClassName = element.className; return (elementClassName.length > 0 && (elementClassName == className || new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); }; -})(wysihtml5); +})(wysihtml); diff --git a/src/dom/compare_document_position.js b/src/dom/compare_document_position.js index a5172fd..5933e58 100644 --- a/src/dom/compare_document_position.js +++ b/src/dom/compare_document_position.js @@ -1,4 +1,4 @@ -wysihtml5.dom.compareDocumentPosition = (function() { +wysihtml.dom.compareDocumentPosition = (function() { var documentElement = document.documentElement; if (documentElement.compareDocumentPosition) { return function(container, element) { @@ -25,10 +25,10 @@ wysihtml5.dom.compareDocumentPosition = (function() { if( thisOwner !== otherOwner ) return 1; // Node.DOCUMENT_POSITION_DISCONNECTED; // Text nodes for attributes does not have a _parentNode. So we need to find them as attribute child. - if( container.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && container.childNodes && wysihtml5.lang.array(container.childNodes).indexOf( element ) !== -1) + if( container.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && container.childNodes && wysihtml.lang.array(container.childNodes).indexOf( element ) !== -1) return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - if( element.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && element.childNodes && wysihtml5.lang.array(element.childNodes).indexOf( container ) !== -1) + if( element.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && element.childNodes && wysihtml.lang.array(element.childNodes).indexOf( container ) !== -1) return 2 + 8; //Node.DOCUMENT_POSITION_PRECEDING + Node.DOCUMENT_POSITION_CONTAINS; var point = container; @@ -43,11 +43,11 @@ wysihtml5.dom.compareDocumentPosition = (function() { previous = null; while( point ) { if( point == container ) return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - var location_index = wysihtml5.lang.array(parents).indexOf( point ); + var location_index = wysihtml.lang.array(parents).indexOf( point ); if( location_index !== -1) { var smallest_common_ancestor = parents[ location_index ]; - var this_index = wysihtml5.lang.array(smallest_common_ancestor.childNodes).indexOf( parents[location_index - 1]);//smallest_common_ancestor.childNodes.toArray().indexOf( parents[location_index - 1] ); - var other_index = wysihtml5.lang.array(smallest_common_ancestor.childNodes).indexOf( previous ); //smallest_common_ancestor.childNodes.toArray().indexOf( previous ); + var this_index = wysihtml.lang.array(smallest_common_ancestor.childNodes).indexOf( parents[location_index - 1]);//smallest_common_ancestor.childNodes.toArray().indexOf( parents[location_index - 1] ); + var other_index = wysihtml.lang.array(smallest_common_ancestor.childNodes).indexOf( previous ); //smallest_common_ancestor.childNodes.toArray().indexOf( previous ); if( this_index > other_index ) { return 2; //Node.DOCUMENT_POSITION_PRECEDING; } diff --git a/src/dom/contains.js b/src/dom/contains.js index 94ea5ba..a02a073 100644 --- a/src/dom/contains.js +++ b/src/dom/contains.js @@ -1,8 +1,8 @@ -wysihtml5.dom.contains = (function() { +wysihtml.dom.contains = (function() { var documentElement = document.documentElement; if (documentElement.contains) { return function(container, element) { - if (element.nodeType !== wysihtml5.ELEMENT_NODE) { + if (element.nodeType !== wysihtml.ELEMENT_NODE) { if (element.parentNode === container) { return true; } diff --git a/src/dom/contenteditable_area.js b/src/dom/contenteditable_area.js index a9862dc..78c4a85 100644 --- a/src/dom/contenteditable_area.js +++ b/src/dom/contenteditable_area.js @@ -1,6 +1,6 @@ -(function(wysihtml5) { +(function(wysihtml) { var doc = document; - wysihtml5.dom.ContentEditableArea = Base.extend({ + wysihtml.dom.ContentEditableArea = Base.extend({ getContentEditable: function() { return this.element; }, @@ -14,8 +14,8 @@ }, constructor: function(readyCallback, config, contentEditable) { - this.callback = readyCallback || wysihtml5.EMPTY_FUNCTION; - this.config = wysihtml5.lang.object({}).merge(config).get(); + this.callback = readyCallback || wysihtml.EMPTY_FUNCTION; + this.config = wysihtml.lang.object({}).merge(config).get(); if (!this.config.className) { this.config.className = "wysihtml5-sandbox"; } @@ -63,4 +63,4 @@ } }); -})(wysihtml5); +})(wysihtml); diff --git a/src/dom/convert_to_list.js b/src/dom/convert_to_list.js index 36ea3f2..c08be1d 100644 --- a/src/dom/convert_to_list.js +++ b/src/dom/convert_to_list.js @@ -14,7 +14,7 @@ * * * * * @@ -24,7 +24,7 @@ *
  • 50 Cent
  • * */ -wysihtml5.dom.convertToList = (function() { +wysihtml.dom.convertToList = (function() { function _createListItem(doc, list) { var listItem = doc.createElement("li"); list.appendChild(listItem); @@ -59,25 +59,25 @@ wysihtml5.dom.convertToList = (function() { for (i=0; i if empty, otherwise create a new one currentListItem = currentListItem.firstChild ? _createListItem(doc, list) : currentListItem; currentListItem.appendChild(childNode); diff --git a/src/dom/copy_attributes.js b/src/dom/copy_attributes.js index a5b7f17..d50399c 100644 --- a/src/dom/copy_attributes.js +++ b/src/dom/copy_attributes.js @@ -10,10 +10,10 @@ * var textarea = document.querySelector("textarea"), * div = document.querySelector("div[contenteditable=true]"), * anotherDiv = document.querySelector("div.preview"); - * wysihtml5.dom.copyAttributes(["spellcheck", "value", "placeholder"]).from(textarea).to(div).andTo(anotherDiv); + * wysihtml.dom.copyAttributes(["spellcheck", "value", "placeholder"]).from(textarea).to(div).andTo(anotherDiv); * */ -wysihtml5.dom.copyAttributes = function(attributesToCopy) { +wysihtml.dom.copyAttributes = function(attributesToCopy) { return { from: function(elementToCopyFrom) { return { diff --git a/src/dom/copy_styles.js b/src/dom/copy_styles.js index 678373c..c5e5930 100644 --- a/src/dom/copy_styles.js +++ b/src/dom/copy_styles.js @@ -14,7 +14,7 @@ * var textarea = document.querySelector("textarea"), * div = document.querySelector("div[contenteditable=true]"), * anotherDiv = document.querySelector("div.preview"); - * wysihtml5.dom.copyStyles(["overflow-y", "width", "height"]).from(textarea).to(div).andTo(anotherDiv); + * wysihtml.dom.copyStyles(["overflow-y", "width", "height"]).from(textarea).to(div).andTo(anotherDiv); * */ (function(dom) { @@ -49,7 +49,7 @@ return { from: function(element) { if (shouldIgnoreBoxSizingBorderBox(element)) { - stylesToCopy = wysihtml5.lang.array(stylesToCopy).without(BOX_SIZING_PROPERTIES); + stylesToCopy = wysihtml.lang.array(stylesToCopy).without(BOX_SIZING_PROPERTIES); } var cssText = "", @@ -70,4 +70,4 @@ } }; }; -})(wysihtml5.dom); +})(wysihtml.dom); diff --git a/src/dom/delegate.js b/src/dom/delegate.js index e19bf72..7232cd8 100644 --- a/src/dom/delegate.js +++ b/src/dom/delegate.js @@ -2,12 +2,12 @@ * Event Delegation * * @example - * wysihtml5.dom.delegate(document.body, "a", "click", function() { + * wysihtml.dom.delegate(document.body, "a", "click", function() { * // foo * }); */ -(function(wysihtml5) { - wysihtml5.dom.delegate = function(container, selector, eventName, handler) { +(function(wysihtml) { + wysihtml.dom.delegate = function(container, selector, eventName, handler) { var callback = function(event) { var target = event.target, element = (target.nodeType === 3) ? target.parentNode : target, // IE has .contains only seeing elements not textnodes @@ -27,4 +27,4 @@ } }; }; -})(wysihtml5); +})(wysihtml); diff --git a/src/dom/dom_node.js b/src/dom/dom_node.js index cf77e13..14053a8 100644 --- a/src/dom/dom_node.js +++ b/src/dom/dom_node.js @@ -1,5 +1,5 @@ // TODO: Refactor dom tree traversing here -(function(wysihtml5) { +(function(wysihtml) { // Finds parents of a node, returning the outermost node first in Array // if contain node is given parents search is stopped at the container @@ -14,15 +14,15 @@ return nodes; } - wysihtml5.dom.domNode = function(node) { - var defaultNodeTypes = [wysihtml5.ELEMENT_NODE, wysihtml5.TEXT_NODE]; + wysihtml.dom.domNode = function(node) { + var defaultNodeTypes = [wysihtml.ELEMENT_NODE, wysihtml.TEXT_NODE]; return { is: { emptyTextNode: function(ignoreWhitespace) { var regx = ignoreWhitespace ? (/^\s*$/g) : (/^[\r\n]*$/g); - return node && node.nodeType === wysihtml5.TEXT_NODE && (regx).test(node.data); + return node && node.nodeType === wysihtml.TEXT_NODE && (regx).test(node.data); }, // Returns if node is the rangy selection bookmark element (that must not be taken into account in most situatons and is removed on selection restoring) @@ -31,7 +31,7 @@ }, visible: function() { - var isVisible = !(/^\s*$/g).test(wysihtml5.dom.getTextContent(node)); + var isVisible = !(/^\s*$/g).test(wysihtml.dom.getTextContent(node)); if (!isVisible) { if (node.nodeType === 1 && node.querySelector('img, br, hr, object, embed, canvas, input, textarea')) { @@ -50,13 +50,13 @@ // In most cases browsers should solve the cases for you when you try to insert content into those, // but IE does not and it is not nice to do so anyway. voidElement: function() { - return wysihtml5.dom.domNode(node).test({ - query: wysihtml5.VOID_ELEMENTS + return wysihtml.dom.domNode(node).test({ + query: wysihtml.VOID_ELEMENTS }); } }, - // var node = wysihtml5.dom.domNode(element).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); + // var node = wysihtml.dom.domNode(element).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); prev: function(options) { var prevNode = node.previousSibling, types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes; @@ -66,17 +66,17 @@ } if ( - wysihtml5.dom.domNode(prevNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) - (!wysihtml5.lang.array(types).contains(prevNode.nodeType)) || // nodeTypes check. - (options && options.ignoreBlankTexts && wysihtml5.dom.domNode(prevNode).is.emptyTextNode(true)) // Blank text nodes bypassed if set + wysihtml.dom.domNode(prevNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) + (!wysihtml.lang.array(types).contains(prevNode.nodeType)) || // nodeTypes check. + (options && options.ignoreBlankTexts && wysihtml.dom.domNode(prevNode).is.emptyTextNode(true)) // Blank text nodes bypassed if set ) { - return wysihtml5.dom.domNode(prevNode).prev(options); + return wysihtml.dom.domNode(prevNode).prev(options); } return prevNode; }, - // var node = wysihtml5.dom.domNode(element).next({nodeTypes: [1,3], ignoreBlankTexts: true}); + // var node = wysihtml.dom.domNode(element).next({nodeTypes: [1,3], ignoreBlankTexts: true}); next: function(options) { var nextNode = node.nextSibling, types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes; @@ -86,11 +86,11 @@ } if ( - wysihtml5.dom.domNode(nextNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) - (!wysihtml5.lang.array(types).contains(nextNode.nodeType)) || // nodeTypes check. - (options && options.ignoreBlankTexts && wysihtml5.dom.domNode(nextNode).is.emptyTextNode(true)) // blank text nodes bypassed if set + wysihtml.dom.domNode(nextNode).is.rangyBookmark() || // is Rangy temporary boomark element (bypass) + (!wysihtml.lang.array(types).contains(nextNode.nodeType)) || // nodeTypes check. + (options && options.ignoreBlankTexts && wysihtml.dom.domNode(nextNode).is.emptyTextNode(true)) // blank text nodes bypassed if set ) { - return wysihtml5.dom.domNode(nextNode).next(options); + return wysihtml.dom.domNode(nextNode).next(options); } return nextNode; @@ -99,7 +99,7 @@ // Finds the common acnestor container of two nodes // If container given stops search at the container // If no common ancestor found returns null - // var node = wysihtml5.dom.domNode(element).commonAncestor(node2, container); + // var node = wysihtml.dom.domNode(element).commonAncestor(node2, container); commonAncestor: function(node2, container) { var parents1 = parents(node, container), parents2 = parents(node2, container); @@ -140,24 +140,24 @@ // Returns if element is of of options.leafClasses leaf if (options && options.leafClasses) { for (var i = options.leafClasses.length; i--;) { - if (wysihtml5.dom.hasClass(node, options.leafClasses[i])) { + if (wysihtml.dom.hasClass(node, options.leafClasses[i])) { return node; } } } - return wysihtml5.dom.domNode(lastChild).lastLeafNode(options); + return wysihtml.dom.domNode(lastChild).lastLeafNode(options); }, // Splits element at childnode and extracts the childNode out of the element context // Example: - // var node = wysihtml5.dom.domNode(node).escapeParent(parentNode); + // var node = wysihtml.dom.domNode(node).escapeParent(parentNode); escapeParent: function(element, newWrapper) { var parent, split2, nodeWrap, curNode = node; // Stop if node is not a descendant of element - if (!wysihtml5.dom.contains(element, node)) { + if (!wysihtml.dom.contains(element, node)) { throw new Error("Child is not a descendant of node."); } @@ -212,7 +212,7 @@ transferContentTo: function(targetNode, removeOldWrapper) { if (node.nodeType === 1) { - if (wysihtml5.dom.domNode(targetNode).is.voidElement() || targetNode.nodeType === 3) { + if (wysihtml.dom.domNode(targetNode).is.voidElement() || targetNode.nodeType === 3) { while (node.lastChild) { targetNode.parentNode.insertBefore(node.lastChild, targetNode.nextSibling); } @@ -225,7 +225,7 @@ node.parentNode.removeChild(node); } } else if (node.nodeType === 3 || node.nodeType === 8){ - if (wysihtml5.dom.domNode(targetNode).is.voidElement()) { + if (wysihtml.dom.domNode(targetNode).is.voidElement()) { targetNode.parentNode.insertBefore(node, targetNode.nextSibling); } else { targetNode.appendChild(node); @@ -250,7 +250,7 @@ } Example: - var node = wysihtml5.dom.domNode(element).test({}) + var node = wysihtml.dom.domNode(element).test({}) */ test: function(properties) { var prop; @@ -293,7 +293,7 @@ styles = (Array.isArray(properties.styleProperty)) ? properties.styleProperty : [properties.styleProperty]; for (var j = 0, maxStyleP = styles.length; j < maxStyleP; j++) { // Some old IE-s have different property name for cssFloat - prop = wysihtml5.browser.fixStyleKey(styles[j]); + prop = wysihtml.browser.fixStyleKey(styles[j]); if (node.style[prop]) { if (properties.styleValue) { // Style value as additional parameter @@ -328,7 +328,7 @@ } if (properties.attribute) { - var attr = wysihtml5.dom.getAttributes(node), + var attr = wysihtml.dom.getAttributes(node), attrList = [], hasOneAttribute = false; @@ -363,4 +363,4 @@ }; }; -})(wysihtml5); +})(wysihtml); diff --git a/src/dom/get_as_dom.js b/src/dom/get_as_dom.js index aec4b6b..da1967f 100644 --- a/src/dom/get_as_dom.js +++ b/src/dom/get_as_dom.js @@ -8,9 +8,9 @@ * @param {Obejct} [context] Document object of the context the html belongs to * * @example - * wysihtml5.dom.getAsDom("
    foo
    "); + * wysihtml.dom.getAsDom("
    foo
    "); */ -wysihtml5.dom.getAsDom = (function() { +wysihtml.dom.getAsDom = (function() { var _innerHTMLShiv = function(html, context) { var tempElement = context.createElement("div"); @@ -52,7 +52,7 @@ wysihtml5.dom.getAsDom = (function() { if (typeof(html) === "object" && html.nodeType) { tempElement = context.createElement("div"); tempElement.appendChild(html); - } else if (wysihtml5.browser.supportsHTML5Tags(context)) { + } else if (wysihtml.browser.supportsHTML5Tags(context)) { tempElement = context.createElement("div"); tempElement.innerHTML = html; } else { diff --git a/src/dom/get_attribute.js b/src/dom/get_attribute.js index f40539d..f671b5d 100644 --- a/src/dom/get_attribute.js +++ b/src/dom/get_attribute.js @@ -8,11 +8,11 @@ * Therefore we have to check the element's outerHTML for the attribute */ -wysihtml5.dom.getAttribute = function(node, attributeName) { - var HAS_GET_ATTRIBUTE_BUG = !wysihtml5.browser.supportsGetAttributeCorrectly(); +wysihtml.dom.getAttribute = function(node, attributeName) { + var HAS_GET_ATTRIBUTE_BUG = !wysihtml.browser.supportsGetAttributeCorrectly(); attributeName = attributeName.toLowerCase(); var nodeName = node.nodeName; - if (nodeName == "IMG" && attributeName == "src" && wysihtml5.dom.isLoadedImage(node) === true) { + if (nodeName == "IMG" && attributeName == "src" && wysihtml.dom.isLoadedImage(node) === true) { // Get 'src' attribute value via object property since this will always contain the // full absolute url (http://...) // this fixes a very annoying bug in firefox (ver 3.6 & 4) and IE 8 where images copied from the same host diff --git a/src/dom/get_attributes.js b/src/dom/get_attributes.js index 8ecec1d..54820e3 100644 --- a/src/dom/get_attributes.js +++ b/src/dom/get_attributes.js @@ -8,8 +8,8 @@ * Therefore we have to check the element's outerHTML for the attribute */ -wysihtml5.dom.getAttributes = function(node) { - var HAS_GET_ATTRIBUTE_BUG = !wysihtml5.browser.supportsGetAttributeCorrectly(), +wysihtml.dom.getAttributes = function(node) { + var HAS_GET_ATTRIBUTE_BUG = !wysihtml.browser.supportsGetAttributeCorrectly(), nodeName = node.nodeName, attributes = [], attr; @@ -17,9 +17,9 @@ wysihtml5.dom.getAttributes = function(node) { for (attr in node.attributes) { if ((node.attributes.hasOwnProperty && node.attributes.hasOwnProperty(attr)) || (!node.attributes.hasOwnProperty && Object.prototype.hasOwnProperty.call(node.attributes, attr))) { if (node.attributes[attr].specified) { - if (nodeName == "IMG" && node.attributes[attr].name.toLowerCase() == "src" && wysihtml5.dom.isLoadedImage(node) === true) { + if (nodeName == "IMG" && node.attributes[attr].name.toLowerCase() == "src" && wysihtml.dom.isLoadedImage(node) === true) { attributes['src'] = node.src; - } else if (wysihtml5.lang.array(['rowspan', 'colspan']).contains(node.attributes[attr].name.toLowerCase()) && HAS_GET_ATTRIBUTE_BUG) { + } else if (wysihtml.lang.array(['rowspan', 'colspan']).contains(node.attributes[attr].name.toLowerCase()) && HAS_GET_ATTRIBUTE_BUG) { if (node.attributes[attr].value !== 1) { attributes[node.attributes[attr].name] = node.attributes[attr].value; } diff --git a/src/dom/get_parent_element.js b/src/dom/get_parent_element.js index 8c5abe6..171a1c6 100644 --- a/src/dom/get_parent_element.js +++ b/src/dom/get_parent_element.js @@ -15,12 +15,12 @@ * @return {null|Element} Returns the first element that matched the desiredNodeName(s) */ -wysihtml5.dom.getParentElement = (function() { +wysihtml.dom.getParentElement = (function() { return function(node, properties, levels, container) { levels = levels || 50; while (levels-- && node && node.nodeName !== "BODY" && (!container || node !== container)) { - if (wysihtml5.dom.domNode(node).test(properties)) { + if (wysihtml.dom.domNode(node).test(properties)) { return node; } node = node.parentNode; diff --git a/src/dom/get_pasted_html.js b/src/dom/get_pasted_html.js index 4007dc0..166bd53 100644 --- a/src/dom/get_pasted_html.js +++ b/src/dom/get_pasted_html.js @@ -6,20 +6,20 @@ * Advantage is that it does not have to loose selection or modify dom to catch the data. * IE does not support though. **/ -wysihtml5.dom.getPastedHtml = function(event) { +wysihtml.dom.getPastedHtml = function(event) { var html; - if (wysihtml5.browser.supportsModernPaste() && event.clipboardData) { - if (wysihtml5.lang.array(event.clipboardData.types).contains('text/html')) { + if (wysihtml.browser.supportsModernPaste() && event.clipboardData) { + if (wysihtml.lang.array(event.clipboardData.types).contains('text/html')) { html = event.clipboardData.getData('text/html'); - } else if (wysihtml5.lang.array(event.clipboardData.types).contains('text/plain')) { - html = wysihtml5.lang.string(event.clipboardData.getData('text/plain')).escapeHTML(true, true); + } else if (wysihtml.lang.array(event.clipboardData.types).contains('text/plain')) { + html = wysihtml.lang.string(event.clipboardData.getData('text/plain')).escapeHTML(true, true); } } return html; }; /* Older temprorary contenteditable as paste source catcher method for fallbacks */ -wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) { +wysihtml.dom.getPastedHtmlWithDiv = function (composer, f) { var selBookmark = composer.selection.getBookmark(), doc = composer.element.ownerDocument, cleanerDiv = doc.createElement('DIV'), diff --git a/src/dom/get_style.js b/src/dom/get_style.js index 2ccbe6d..504d09e 100644 --- a/src/dom/get_style.js +++ b/src/dom/get_style.js @@ -5,10 +5,10 @@ * @param {String} property The CSS property to retrieve ("float", "display", "text-align", ...) * * @example - * wysihtml5.dom.getStyle("display").from(document.body); + * wysihtml.dom.getStyle("display").from(document.body); * // => "block" */ -wysihtml5.dom.getStyle = (function() { +wysihtml.dom.getStyle = (function() { var stylePropertyMapping = { "float": ("styleFloat" in document.createElement("div").style) ? "styleFloat" : "cssFloat" }, @@ -23,7 +23,7 @@ wysihtml5.dom.getStyle = (function() { return function(property) { return { from: function(element) { - if (element.nodeType !== wysihtml5.ELEMENT_NODE) { + if (element.nodeType !== wysihtml.ELEMENT_NODE) { return; } diff --git a/src/dom/get_textnodes.js b/src/dom/get_textnodes.js index dc5ecae..66cb42d 100644 --- a/src/dom/get_textnodes.js +++ b/src/dom/get_textnodes.js @@ -1,4 +1,4 @@ -wysihtml5.dom.getTextNodes = function(node, ingoreEmpty){ +wysihtml.dom.getTextNodes = function(node, ingoreEmpty){ var all = []; for (node=node.firstChild;node;node=node.nextSibling){ if (node.nodeType == 3) { @@ -6,7 +6,7 @@ wysihtml5.dom.getTextNodes = function(node, ingoreEmpty){ all.push(node); } } else { - all = all.concat(wysihtml5.dom.getTextNodes(node, ingoreEmpty)); + all = all.concat(wysihtml.dom.getTextNodes(node, ingoreEmpty)); } } return all; diff --git a/src/dom/has_element_with_class_name.js b/src/dom/has_element_with_class_name.js index 9149d0c..6de6c04 100644 --- a/src/dom/has_element_with_class_name.js +++ b/src/dom/has_element_with_class_name.js @@ -6,9 +6,9 @@ * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @example - * wysihtml5.dom.hasElementWithClassName(document, "foobar"); + * wysihtml.dom.hasElementWithClassName(document, "foobar"); */ -(function(wysihtml5) { +(function(wysihtml) { var LIVE_CACHE = {}, DOCUMENT_IDENTIFIER = 1; @@ -16,10 +16,10 @@ return doc._wysihtml5_identifier || (doc._wysihtml5_identifier = DOCUMENT_IDENTIFIER++); } - wysihtml5.dom.hasElementWithClassName = function(doc, className) { + wysihtml.dom.hasElementWithClassName = function(doc, className) { // getElementsByClassName is not supported by IE<9 // but is sometimes mocked via library code (which then doesn't return live node lists) - if (!wysihtml5.browser.supportsNativeGetElementsByClassName()) { + if (!wysihtml.browser.supportsNativeGetElementsByClassName()) { return !!doc.querySelector("." + className); } @@ -31,4 +31,4 @@ return cacheEntry.length > 0; }; -})(wysihtml5); +})(wysihtml); diff --git a/src/dom/has_element_with_tag_name.js b/src/dom/has_element_with_tag_name.js index 01e5934..e8d2952 100644 --- a/src/dom/has_element_with_tag_name.js +++ b/src/dom/has_element_with_tag_name.js @@ -6,9 +6,9 @@ * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @example - * wysihtml5.dom.hasElementWithTagName(document, "IMG"); + * wysihtml.dom.hasElementWithTagName(document, "IMG"); */ -wysihtml5.dom.hasElementWithTagName = (function() { +wysihtml.dom.hasElementWithTagName = (function() { var LIVE_CACHE = {}, DOCUMENT_IDENTIFIER = 1; diff --git a/src/dom/insert.js b/src/dom/insert.js index 470fd2f..eebae89 100644 --- a/src/dom/insert.js +++ b/src/dom/insert.js @@ -1,4 +1,4 @@ -wysihtml5.dom.insert = function(elementToInsert) { +wysihtml.dom.insert = function(elementToInsert) { return { after: function(element) { element.parentNode.insertBefore(elementToInsert, element.nextSibling); diff --git a/src/dom/insert_css.js b/src/dom/insert_css.js index 65087ad..c21b8ee 100644 --- a/src/dom/insert_css.js +++ b/src/dom/insert_css.js @@ -1,4 +1,4 @@ -wysihtml5.dom.insertCSS = function(rules) { +wysihtml.dom.insertCSS = function(rules) { rules = rules.join("\n"); return { diff --git a/src/dom/is_loaded_image.js b/src/dom/is_loaded_image.js index 05f5552..481f2c6 100644 --- a/src/dom/is_loaded_image.js +++ b/src/dom/is_loaded_image.js @@ -3,7 +3,7 @@ * FIXME: Returns undefined when unknown (Chrome, Safari) */ -wysihtml5.dom.isLoadedImage = function (node) { +wysihtml.dom.isLoadedImage = function (node) { try { return node.complete && !node.mozMatchesSelector(":-moz-broken"); } catch(e) { diff --git a/src/dom/line_breaks.js b/src/dom/line_breaks.js index 7960920..6c23656 100644 --- a/src/dom/line_breaks.js +++ b/src/dom/line_breaks.js @@ -1,6 +1,6 @@ // TODO: Refactor dom tree traversing here -(function(wysihtml5) { - wysihtml5.dom.lineBreaks = function(node) { +(function(wysihtml) { + wysihtml.dom.lineBreaks = function(node) { function _isLineBreak(n) { return n.nodeName === "BR"; @@ -15,7 +15,7 @@ return true; } - if (wysihtml5.dom.getStyle("display").from(element) === "block") { + if (wysihtml.dom.getStyle("display").from(element) === "block") { return true; } @@ -24,31 +24,31 @@ return { - /* wysihtml5.dom.lineBreaks(element).add(); + /* wysihtml.dom.lineBreaks(element).add(); * * Adds line breaks before and after the given node if the previous and next siblings * aren't already causing a visual line break (block element or
    ) */ add: function(options) { var doc = node.ownerDocument, - nextSibling = wysihtml5.dom.domNode(node).next({ignoreBlankTexts: true}), - previousSibling = wysihtml5.dom.domNode(node).prev({ignoreBlankTexts: true}); + nextSibling = wysihtml.dom.domNode(node).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(node).prev({ignoreBlankTexts: true}); if (nextSibling && !_isLineBreakOrBlockElement(nextSibling)) { - wysihtml5.dom.insert(doc.createElement("br")).after(node); + wysihtml.dom.insert(doc.createElement("br")).after(node); } if (previousSibling && !_isLineBreakOrBlockElement(previousSibling)) { - wysihtml5.dom.insert(doc.createElement("br")).before(node); + wysihtml.dom.insert(doc.createElement("br")).before(node); } }, - /* wysihtml5.dom.lineBreaks(element).remove(); + /* wysihtml.dom.lineBreaks(element).remove(); * * Removes line breaks before and after the given node */ remove: function(options) { - var nextSibling = wysihtml5.dom.domNode(node).next({ignoreBlankTexts: true}), - previousSibling = wysihtml5.dom.domNode(node).prev({ignoreBlankTexts: true}); + var nextSibling = wysihtml.dom.domNode(node).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(node).prev({ignoreBlankTexts: true}); if (nextSibling && _isLineBreak(nextSibling)) { nextSibling.parentNode.removeChild(nextSibling); @@ -59,4 +59,4 @@ } }; }; -})(wysihtml5); \ No newline at end of file +})(wysihtml); \ No newline at end of file diff --git a/src/dom/observe.js b/src/dom/observe.js index 3e3a2ac..f457231 100644 --- a/src/dom/observe.js +++ b/src/dom/observe.js @@ -2,9 +2,9 @@ * Method to set dom events * * @example - * wysihtml5.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); + * wysihtml.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); */ -wysihtml5.dom.observe = function(element, eventNames, handler) { +wysihtml.dom.observe = function(element, eventNames, handler) { eventNames = typeof(eventNames) === "string" ? [eventNames] : eventNames; var handlerWrapper, diff --git a/src/dom/parse.js b/src/dom/parse.js index 6358922..b6edd61 100644 --- a/src/dom/parse.js +++ b/src/dom/parse.js @@ -12,7 +12,7 @@ * * @example * var userHTML = '

    foo

    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * tags { * p: "div", // Rename p tags to div tags * font: "span" // Rename font tags to span tags @@ -23,11 +23,11 @@ * // =>
    foo bar
    * * var userHTML = '
    I'm a table!
    '; - * wysihtml5.dom.parse(userHTML); + * wysihtml.dom.parse(userHTML); * // => 'I'm a table!' * * var userHTML = '
    foobar
    foobar
    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * tags: { * div: undefined, * br: true @@ -36,7 +36,7 @@ * // => '' * * var userHTML = '
    foo
    bar
    '; - * wysihtml5.dom.parse(userHTML, { + * wysihtml.dom.parse(userHTML, { * classes: { * red: 1, * green: 1 @@ -50,7 +50,7 @@ * // => '

    foo

    bar

    ' */ -wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { +wysihtml.dom.parse = function(elementOrHtml_current, config_current) { /* TODO: Currently escaped module pattern as otherwise folloowing default swill be shared among multiple editors. * Refactor whole code as this method while workind is kind of awkward too */ @@ -80,7 +80,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { * which later replaces the entire body content */ function parse(elementOrHtml, config) { - wysihtml5.lang.object(currentRules).merge(defaultRules).merge(config.rules).get(); + wysihtml.lang.object(currentRules).merge(defaultRules).merge(config.rules).get(); var context = config.context || elementOrHtml.ownerDocument || document, fragment = context.createDocumentFragment(), @@ -95,7 +95,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (isString) { - element = wysihtml5.dom.getAsDom(elementOrHtml, context); + element = wysihtml.dom.getAsDom(elementOrHtml, context); } else { element = elementOrHtml; } @@ -117,7 +117,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (config.unjoinNbsps) { // replace joined non-breakable spaces with unjoined - var txtnodes = wysihtml5.dom.getTextNodes(fragment); + var txtnodes = wysihtml.dom.getTextNodes(fragment); for (var n = txtnodes.length; n--;) { txtnodes[n].nodeValue = txtnodes[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi, "$1 "); } @@ -129,7 +129,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { // Insert new DOM tree element.appendChild(fragment); - return isString ? wysihtml5.quirks.getCorrectInnerHTML(element) : element; + return isString ? wysihtml.quirks.getCorrectInnerHTML(element) : element; } function _convert(oldNode, cleanUp, clearInternals, uneditableClass) { @@ -144,7 +144,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { nodeDisplay; // Passes directly elemets with uneditable class - if (uneditableClass && oldNodeType === 1 && wysihtml5.dom.hasClass(oldNode, uneditableClass)) { + if (uneditableClass && oldNodeType === 1 && wysihtml.dom.hasClass(oldNode, uneditableClass)) { return oldNode; } @@ -168,18 +168,18 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } } - nodeDisplay = wysihtml5.dom.getStyle("display").from(oldNode); + nodeDisplay = wysihtml.dom.getStyle("display").from(oldNode); if (nodeDisplay === '') { // Handle display style when element not in dom - nodeDisplay = wysihtml5.lang.array(blockElements).contains(oldNode.tagName) ? "block" : ""; + nodeDisplay = wysihtml.lang.array(blockElements).contains(oldNode.tagName) ? "block" : ""; } - if (wysihtml5.lang.array(["block", "flex", "table"]).contains(nodeDisplay)) { + if (wysihtml.lang.array(["block", "flex", "table"]).contains(nodeDisplay)) { fragment.appendChild(oldNode.ownerDocument.createElement("br")); } // TODO: try to minimize surplus spaces - if (wysihtml5.lang.array([ + if (wysihtml.lang.array([ "div", "pre", "p", "table", "td", "th", "ul", "ol", "li", @@ -244,7 +244,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { for (sel in selectorRules) { if (selectorRules.hasOwnProperty(sel)) { - if (wysihtml5.lang.object(selectorRules[sel]).isFunction()) { + if (wysihtml.lang.object(selectorRules[sel]).isFunction()) { method = selectorRules[sel]; } else if (typeof(selectorRules[sel]) === "string" && elementHandlingMethods[selectorRules[sel]]) { method = elementHandlingMethods[selectorRules[sel]]; @@ -293,7 +293,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { * A

    doesn't need to be closed according HTML4-5 spec, we simply replace it with a

    to preserve its content and layout */ if ("outerHTML" in oldNode) { - if (!wysihtml5.browser.autoClosesUnclosedTags() && + if (!wysihtml.browser.autoClosesUnclosedTags() && oldNode.nodeName === "P" && oldNode.outerHTML.slice(-4).toLowerCase() !== "

    ") { nodeName = "div"; @@ -408,7 +408,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { styleProp = nodeStyles[sp].split(':'); if (styleProp[0].replace(/\s/g, '').toLowerCase() === s) { - if (definition.styles[s] === true || definition.styles[s] === 1 || wysihtml5.lang.array(definition.styles[s]).contains(styleProp[1].replace(/\s/g, '').toLowerCase()) ) { + if (definition.styles[s] === true || definition.styles[s] === 1 || wysihtml.lang.array(definition.styles[s]).contains(styleProp[1].replace(/\s/g, '').toLowerCase()) ) { return true; } } @@ -421,7 +421,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (definition.attrs) { for (a in definition.attrs) { if (definition.attrs.hasOwnProperty(a)) { - attr = wysihtml5.dom.getAttribute(oldNode, a); + attr = wysihtml.dom.getAttribute(oldNode, a); if (typeof(attr) === "string") { if (attr.search(definition.attrs[a]) > -1) { return true; @@ -465,7 +465,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } function _checkAttribute(attributeName, attributeValue, methodName, nodeName) { - var method = wysihtml5.lang.object(methodName).isFunction() ? methodName : attributeCheckMethods[methodName], + var method = wysihtml.lang.object(methodName).isFunction() ? methodName : attributeCheckMethods[methodName], newAttributeValue; if (method) { @@ -479,10 +479,10 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } function _checkAttributes(oldNode, local_attributes) { - var globalAttributes = wysihtml5.lang.object(currentRules.attributes || {}).clone(), // global values for check/convert values of attributes - checkAttributes = wysihtml5.lang.object(globalAttributes).merge( wysihtml5.lang.object(local_attributes || {}).clone()).get(), + var globalAttributes = wysihtml.lang.object(currentRules.attributes || {}).clone(), // global values for check/convert values of attributes + checkAttributes = wysihtml.lang.object(globalAttributes).merge( wysihtml.lang.object(local_attributes || {}).clone()).get(), attributes = {}, - oldAttributes = wysihtml5.dom.getAttributes(oldNode), + oldAttributes = wysihtml.dom.getAttributes(oldNode), attributeName, newValue, matchingAttributes; for (attributeName in checkAttributes) { @@ -528,11 +528,11 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { method; if (setAttributes) { - attributes = wysihtml5.lang.object(setAttributes).clone(); + attributes = wysihtml.lang.object(setAttributes).clone(); } // check/convert values of attributes - attributes = wysihtml5.lang.object(attributes).merge(_checkAttributes(oldNode, rule.check_attributes)).get(); + attributes = wysihtml.lang.object(attributes).merge(_checkAttributes(oldNode, rule.check_attributes)).get(); if (setClass) { classes.push(setClass); @@ -544,7 +544,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { if (!method) { continue; } - newClass = method(wysihtml5.dom.getAttribute(oldNode, attributeName)); + newClass = method(wysihtml.dom.getAttribute(oldNode, attributeName)); if (typeof(newClass) === "string") { classes.push(newClass); } @@ -558,7 +558,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { continue; } - newStyle = method(wysihtml5.dom.getAttribute(oldNode, attributeName)); + newStyle = method(wysihtml.dom.getAttribute(oldNode, attributeName)); if (typeof(newStyle) === "string") { styles.push(newStyle); } @@ -583,7 +583,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (newClasses.length) { - attributes["class"] = wysihtml5.lang.array(newClasses).unique().join(" "); + attributes["class"] = wysihtml.lang.array(newClasses).unique().join(" "); } } else { @@ -591,7 +591,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } } else { if(classes && classes.length > 0) { - attributes["class"] = wysihtml5.lang.array(classes).unique().join(" "); + attributes["class"] = wysihtml.lang.array(classes).unique().join(" "); } } } else { @@ -616,7 +616,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (newClasses.length) { - attributes["class"] = wysihtml5.lang.array(newClasses).unique().join(" "); + attributes["class"] = wysihtml.lang.array(newClasses).unique().join(" "); } } @@ -629,7 +629,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { } if (styles.length) { - attributes["style"] = wysihtml5.lang.array(styles).unique().join(" "); + attributes["style"] = wysihtml.lang.array(styles).unique().join(" "); } // set attributes on newNode @@ -656,12 +656,12 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { function _handleText(oldNode) { var nextSibling = oldNode.nextSibling; - if (nextSibling && nextSibling.nodeType === wysihtml5.TEXT_NODE) { + if (nextSibling && nextSibling.nodeType === wysihtml.TEXT_NODE) { // Concatenate text nodes - nextSibling.data = oldNode.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, "") + nextSibling.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + nextSibling.data = oldNode.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, "") + nextSibling.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); } else { - // \uFEFF = wysihtml5.INVISIBLE_SPACE (used as a hack in certain rich text editing situations) - var data = oldNode.data.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + // \uFEFF = wysihtml.INVISIBLE_SPACE (used as a hack in certain rich text editing situations) + var data = oldNode.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); return oldNode.ownerDocument.createTextNode(data); } } @@ -856,7 +856,7 @@ wysihtml5.dom.parse = function(elementOrHtml_current, config_current) { var elementHandlingMethods = { unwrap: function (element) { - wysihtml5.dom.unwrap(element); + wysihtml.dom.unwrap(element); }, remove: function (element) { diff --git a/src/dom/query.js b/src/dom/query.js index 2aad7ca..84fabca 100644 --- a/src/dom/query.js +++ b/src/dom/query.js @@ -1,5 +1,5 @@ // does a selector query on element or array of elements -wysihtml5.dom.query = function(elements, query) { +wysihtml.dom.query = function(elements, query) { var ret = [], q; diff --git a/src/dom/remove_empty_text_nodes.js b/src/dom/remove_empty_text_nodes.js index 4d75b38..0ee82e8 100644 --- a/src/dom/remove_empty_text_nodes.js +++ b/src/dom/remove_empty_text_nodes.js @@ -3,17 +3,17 @@ * * @param {Element} node The element in which to cleanup * @example - * wysihtml5.dom.removeEmptyTextNodes(element); + * wysihtml.dom.removeEmptyTextNodes(element); */ -wysihtml5.dom.removeEmptyTextNodes = function(node) { +wysihtml.dom.removeEmptyTextNodes = function(node) { var childNode, - childNodes = wysihtml5.lang.array(node.childNodes).get(), + childNodes = wysihtml.lang.array(node.childNodes).get(), childNodesLength = childNodes.length, i = 0; for (; i * * * * @@ -23,13 +23,13 @@ *
  • 50 Cent
  • * */ -wysihtml5.dom.renameElement = function(element, newNodeName) { +wysihtml.dom.renameElement = function(element, newNodeName) { var newElement = element.ownerDocument.createElement(newNodeName), firstChild; while (firstChild = element.firstChild) { newElement.appendChild(firstChild); } - wysihtml5.dom.copyAttributes(["align", "className"]).from(element).to(newElement); + wysihtml.dom.copyAttributes(["align", "className"]).from(element).to(newElement); if (element.parentNode) { element.parentNode.replaceChild(newElement, element); diff --git a/src/dom/replace_with_child_nodes.js b/src/dom/replace_with_child_nodes.js index b6fc283..ee46fc3 100644 --- a/src/dom/replace_with_child_nodes.js +++ b/src/dom/replace_with_child_nodes.js @@ -8,10 +8,10 @@ *
    * */ -wysihtml5.dom.replaceWithChildNodes = function(node) { +wysihtml.dom.replaceWithChildNodes = function(node) { if (!node.parentNode) { return; } diff --git a/src/dom/resolve_list.js b/src/dom/resolve_list.js index a91b7d6..4bce349 100644 --- a/src/dom/resolve_list.js +++ b/src/dom/resolve_list.js @@ -12,7 +12,7 @@ * * * * * @@ -41,8 +41,8 @@ var doc = list.ownerDocument, fragment = doc.createDocumentFragment(), - previousSibling = wysihtml5.dom.domNode(list).prev({ignoreBlankTexts: true}), - nextSibling = wysihtml5.dom.domNode(list).next({ignoreBlankTexts: true}), + previousSibling = wysihtml.dom.domNode(list).prev({ignoreBlankTexts: true}), + nextSibling = wysihtml.dom.domNode(list).next({ignoreBlankTexts: true}), firstChild, lastChild, isLastChild, @@ -94,4 +94,4 @@ } dom.resolveList = resolveList; -})(wysihtml5.dom); +})(wysihtml.dom); diff --git a/src/dom/sandbox.js b/src/dom/sandbox.js index 3b55eec..29405c5 100644 --- a/src/dom/sandbox.js +++ b/src/dom/sandbox.js @@ -16,11 +16,11 @@ * @param {Object} [config] Optional parameters * * @example - * new wysihtml5.dom.Sandbox(function(sandbox) { + * new wysihtml.dom.Sandbox(function(sandbox) { * sandbox.getWindow().document.body.innerHTML = ''; * }); */ -(function(wysihtml5) { +(function(wysihtml) { var /** * Default configuration */ @@ -49,12 +49,12 @@ "write", "open", "close" ]; - wysihtml5.dom.Sandbox = Base.extend( - /** @scope wysihtml5.dom.Sandbox.prototype */ { + wysihtml.dom.Sandbox = Base.extend( + /** @scope wysihtml.dom.Sandbox.prototype */ { constructor: function(readyCallback, config) { - this.callback = readyCallback || wysihtml5.EMPTY_FUNCTION; - this.config = wysihtml5.lang.object({}).merge(config).get(); + this.callback = readyCallback || wysihtml.EMPTY_FUNCTION; + this.config = wysihtml.lang.object({}).merge(config).get(); if (!this.config.className) { this.config.className = "wysihtml5-sandbox"; } @@ -87,7 +87,7 @@ }, _readyError: function() { - throw new Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet"); + throw new Error("wysihtml.Sandbox: Sandbox iframe isn't loaded yet"); }, /** @@ -113,7 +113,7 @@ var that = this, iframe = doc.createElement("iframe"); iframe.className = this.config.className; - wysihtml5.dom.setAttributes({ + wysihtml.dom.setAttributes({ "security": "restricted", "allowtransparency": "true", "frameborder": 0, @@ -124,7 +124,7 @@ }).on(iframe); // Setting the src like this prevents ssl warnings in IE6 - if (wysihtml5.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()) { + if (wysihtml.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()) { iframe.src = "javascript:''"; } @@ -148,7 +148,7 @@ */ _onLoadIframe: function(iframe) { // don't resume when the iframe got unloaded (eg. by removing it from the dom) - if (!wysihtml5.dom.contains(doc.documentElement, iframe)) { + if (!wysihtml.dom.contains(doc.documentElement, iframe)) { return; } @@ -173,10 +173,10 @@ // addEventListener("error") doesn't work properly in some browsers // TODO: apparently this doesn't work in IE9! iframeWindow.onerror = function(errorMessage, fileName, lineNumber) { - throw new Error("wysihtml5.Sandbox: " + errorMessage, fileName, lineNumber); + throw new Error("wysihtml.Sandbox: " + errorMessage, fileName, lineNumber); }; - if (!wysihtml5.browser.supportsSandboxedIframes()) { + if (!wysihtml.browser.supportsSandboxedIframes()) { // Unset a bunch of sensitive variables // Please note: This isn't hack safe! // It more or less just takes care of basic attacks and prevents accidental theft of sensitive information @@ -188,7 +188,7 @@ this._unset(iframeWindow, windowProperties[i]); } for (i=0, length=windowProperties2.length; i' + '#{stylesheets}' + '' @@ -243,7 +243,7 @@ try { object.__defineSetter__(property, function() {}); } catch(e) {} } - if (!wysihtml5.browser.crashesWhenDefineProperty(property)) { + if (!wysihtml.browser.crashesWhenDefineProperty(property)) { try { var config = { get: function() { return value; } @@ -256,4 +256,4 @@ } } }); -})(wysihtml5); +})(wysihtml); diff --git a/src/dom/set_attributes.js b/src/dom/set_attributes.js index 718cbe1..99983c4 100644 --- a/src/dom/set_attributes.js +++ b/src/dom/set_attributes.js @@ -2,7 +2,7 @@ var mapping = { "className": "class" }; - wysihtml5.dom.setAttributes = function(attributes) { + wysihtml.dom.setAttributes = function(attributes) { return { on: function(element) { for (var i in attributes) { diff --git a/src/dom/set_styles.js b/src/dom/set_styles.js index 86a5174..b8c4a4e 100644 --- a/src/dom/set_styles.js +++ b/src/dom/set_styles.js @@ -1,4 +1,4 @@ -wysihtml5.dom.setStyles = function(styles) { +wysihtml.dom.setStyles = function(styles) { return { on: function(element) { var style = element.style; diff --git a/src/dom/simulate_placeholder.js b/src/dom/simulate_placeholder.js index 1a52563..320db83 100644 --- a/src/dom/simulate_placeholder.js +++ b/src/dom/simulate_placeholder.js @@ -5,8 +5,8 @@ * - div[contentEditable] elements don't support it * - older browsers (such as IE8 and Firefox 3.6) don't support it at all * - * @param {Object} parent Instance of main wysihtml5.Editor class - * @param {Element} view Instance of wysihtml5.views.* class + * @param {Object} parent Instance of main wysihtml.Editor class + * @param {Element} view Instance of wysihtml.views.* class * @param {String} placeholderText * * @example @@ -49,4 +49,4 @@ set(); }; -})(wysihtml5.dom); +})(wysihtml.dom); diff --git a/src/dom/table.js b/src/dom/table.js index d3cb426..7bfc3e7 100644 --- a/src/dom/table.js +++ b/src/dom/table.js @@ -1,6 +1,6 @@ -(function(wysihtml5) { +(function(wysihtml) { - var api = wysihtml5.dom; + var api = wysihtml.dom; var MapCell = function(cell) { this.el = cell; @@ -129,7 +129,7 @@ var inlineTables = this.table.querySelectorAll('table'), inlineCells = (inlineTables) ? queryInList(inlineTables, 'th, td') : [], allCells = row.querySelectorAll('th, td'), - tableCells = (inlineCells.length > 0) ? wysihtml5.lang.array(allCells).without(inlineCells) : allCells; + tableCells = (inlineCells.length > 0) ? wysihtml.lang.array(allCells).without(inlineCells) : allCells; return tableCells; }, @@ -138,7 +138,7 @@ var inlineTables = this.table.querySelectorAll('table'), inlineRows = (inlineTables) ? queryInList(inlineTables, 'tr') : [], allRows = this.table.querySelectorAll('tr'), - tableRows = (inlineRows.length > 0) ? wysihtml5.lang.array(allRows).without(inlineRows) : allRows; + tableRows = (inlineRows.length > 0) ? wysihtml.lang.array(allRows).without(inlineRows) : allRows; return tableRows; }, @@ -873,4 +873,4 @@ } }; -})(wysihtml5); +})(wysihtml); diff --git a/src/dom/text_content.js b/src/dom/text_content.js index 0eb7120..183dc42 100644 --- a/src/dom/text_content.js +++ b/src/dom/text_content.js @@ -25,4 +25,4 @@ return element.nodeValue; }; } -})(wysihtml5.dom); +})(wysihtml.dom); diff --git a/src/dom/unwrap.js b/src/dom/unwrap.js index f8f7022..e030a24 100644 --- a/src/dom/unwrap.js +++ b/src/dom/unwrap.js @@ -1,15 +1,15 @@ /* Unwraps element and returns list of childNodes that the node contained. * * Example: - * var childnodes = wysihtml5.dom.unwrap(document.querySelector('.unwrap-me')); + * var childnodes = wysihtml.dom.unwrap(document.querySelector('.unwrap-me')); */ -wysihtml5.dom.unwrap = function(node) { +wysihtml.dom.unwrap = function(node) { var children = []; if (node.parentNode) { while (node.lastChild) { children.unshift(node.lastChild); - wysihtml5.dom.insert(node.lastChild).after(node); + wysihtml.dom.insert(node.lastChild).after(node); } node.parentNode.removeChild(node); } diff --git a/src/editor.js b/src/editor.js index e4df2fc..379b61e 100644 --- a/src/editor.js +++ b/src/editor.js @@ -29,7 +29,7 @@ * disable:composer * change_view */ -(function(wysihtml5) { +(function(wysihtml) { var undef; var defaultConfig = { @@ -56,7 +56,7 @@ // Object which includes parser when the user inserts content via copy & paste. If null parserRules will be used instead pasteParserRulesets: null, // Parser method to use when the user inserts content - parser: wysihtml5.dom.parse, + parser: wysihtml.dom.parse, // By default wysihtml5 will insert a
    for line breaks, set this to false to use

    useLineBreaks: true, // Double enter (enter on blank line) exits block element in useLineBreaks mode. @@ -91,16 +91,16 @@ copyedFromMarking: '' }; - wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend( - /** @scope wysihtml5.Editor.prototype */ { + wysihtml.Editor = wysihtml.lang.Dispatcher.extend( + /** @scope wysihtml.Editor.prototype */ { constructor: function(editableElement, config) { this.editableElement = typeof(editableElement) === "string" ? document.getElementById(editableElement) : editableElement; - this.config = wysihtml5.lang.object({}).merge(defaultConfig).merge(config).get(); - this._isCompatible = wysihtml5.browser.supported(); + this.config = wysihtml.lang.object({}).merge(defaultConfig).merge(config).get(); + this._isCompatible = wysihtml.browser.supported(); // merge classNames if (config && config.classNames) { - wysihtml5.lang.object(this.config.classNames).merge(config.classNames); + wysihtml.lang.object(this.config.classNames).merge(config.classNames); } if (this.editableElement.nodeName.toLowerCase() != "textarea") { @@ -108,21 +108,21 @@ this.config.noTextarea = true; } if (!this.config.noTextarea) { - this.textarea = new wysihtml5.views.Textarea(this, this.editableElement, this.config); + this.textarea = new wysihtml.views.Textarea(this, this.editableElement, this.config); this.currentView = this.textarea; } // Sort out unsupported/unwanted browsers here - if (!this._isCompatible || (!this.config.supportTouchDevices && wysihtml5.browser.isTouchDevice())) { + if (!this._isCompatible || (!this.config.supportTouchDevices && wysihtml.browser.isTouchDevice())) { var that = this; setTimeout(function() { that.fire("beforeload").fire("load"); }, 0); return; } // Add class name to body, to indicate that the editor is supported - wysihtml5.dom.addClass(document.body, this.config.classNames.body); + wysihtml.dom.addClass(document.body, this.config.classNames.body); - this.composer = new wysihtml5.views.Composer(this, this.editableElement, this.config); + this.composer = new wysihtml.views.Composer(this, this.editableElement, this.config); this.currentView = this.composer; if (typeof(this.config.parser) === "function") { @@ -134,15 +134,15 @@ handleBeforeLoad: function() { if (!this.config.noTextarea) { - this.synchronizer = new wysihtml5.views.Synchronizer(this, this.textarea, this.composer); + this.synchronizer = new wysihtml.views.Synchronizer(this, this.textarea, this.composer); } else { - this.sourceView = new wysihtml5.views.SourceView(this, this.composer); + this.sourceView = new wysihtml.views.SourceView(this, this.composer); } if (this.config.toolbar) { - if (typeof wysihtml5.toolbar === "undefined") { + if (typeof wysihtml.toolbar === "undefined") { throw Error("Toolbar not found. Make sure you're loading wysihtml-toolbar.js or wysihtml-toolbar.min.js"); } - this.toolbar = new wysihtml5.toolbar.Toolbar(this, this.config.toolbar, this.config.showToolbarAfterInit); + this.toolbar = new wysihtml.toolbar.Toolbar(this, this.config.toolbar, this.config.showToolbarAfterInit); } }, @@ -223,7 +223,7 @@ "clearInternals" : clearInternals }); if (typeof(htmlOrElement) === "object") { - wysihtml5.quirks.redraw(htmlOrElement); + wysihtml.quirks.redraw(htmlOrElement); } return returnValue; }, @@ -235,10 +235,10 @@ _initParser: function() { var oldHtml; - if (wysihtml5.browser.supportsModernPaste()) { + if (wysihtml.browser.supportsModernPaste()) { this.on("paste:composer", function(event) { event.preventDefault(); - oldHtml = wysihtml5.dom.getPastedHtml(event); + oldHtml = wysihtml.dom.getPastedHtml(event); if (oldHtml) { this._cleanAndPaste(oldHtml); } @@ -249,7 +249,7 @@ event.preventDefault(); var scrollPos = this.composer.getScrollPos(); - wysihtml5.dom.getPastedHtmlWithDiv(this.composer, function(pastedHTML) { + wysihtml.dom.getPastedHtmlWithDiv(this.composer, function(pastedHTML) { if (pastedHTML) { this._cleanAndPaste(pastedHTML); } @@ -261,7 +261,7 @@ }, _cleanAndPaste: function (oldHtml) { - var cleanHtml = wysihtml5.quirks.cleanPastedHTML(oldHtml, { + var cleanHtml = wysihtml.quirks.cleanPastedHTML(oldHtml, { "referenceNode": this.composer.element, "rules": this.config.pasteParserRulesets || [{"set": this.config.parserRules}], "uneditableClass": this.config.classNames.uneditableContainer @@ -270,4 +270,4 @@ this.composer.selection.insertHTML(cleanHtml); } }); -})(wysihtml5); +})(wysihtml); diff --git a/src/commands/formatCode.js b/src/extensions/command_formatCode.js similarity index 85% rename from src/commands/formatCode.js rename to src/extensions/command_formatCode.js index 22a419a..32a3681 100644 --- a/src/commands/formatCode.js +++ b/src/extensions/command_formatCode.js @@ -5,10 +5,8 @@ * * editorInstance.composer.commands.exec("formatCode", "language-html"); */ - -(function(wysihtml5){ - wysihtml5.commands.formatCode = { - +wysihtml.commands.formatCode = (function() { + return { exec: function(composer, command, classname) { var pre = this.state(composer)[0], code, range, selectedNodes; @@ -17,9 +15,9 @@ // caret is already within a

    ...
    composer.selection.executeAndRestore(function() { code = pre.querySelector("code"); - wysihtml5.dom.replaceWithChildNodes(pre); + wysihtml.dom.replaceWithChildNodes(pre); if (code) { - wysihtml5.dom.replaceWithChildNodes(code); + wysihtml.dom.replaceWithChildNodes(code); } }); } else { @@ -46,9 +44,9 @@ selectedNode.firstChild && selectedNode.firstChild.nodeName && selectedNode.firstChild.nodeName == "CODE") { return [selectedNode]; } else { - node = wysihtml5.dom.getParentElement(selectedNode, { query: "pre code" }); + node = wysihtml.dom.getParentElement(selectedNode, { query: "pre code" }); return node ? [node.parentNode] : false; } } }; -}(wysihtml5)); +})(); diff --git a/src/commands/insertImage.js b/src/extensions/command_insertImage.js similarity index 69% rename from src/commands/insertImage.js rename to src/extensions/command_insertImage.js index bdf0886..7e2bdbe 100644 --- a/src/commands/insertImage.js +++ b/src/extensions/command_insertImage.js @@ -1,17 +1,16 @@ -(function(wysihtml5) { +/** + * Inserts an + * If selection is already an image link, it removes it + * + * @example + * // either ... + * wysihtml.commands.insertImage.exec(composer, "insertImage", "http://www.google.de/logo.jpg"); + * // ... or ... + * wysihtml.commands.insertImage.exec(composer, "insertImage", { src: "http://www.google.de/logo.jpg", title: "foo" }); + */ +wysihtml.commands.insertImage = (function() { var NODE_NAME = "IMG"; - - wysihtml5.commands.insertImage = { - /** - * Inserts an - * If selection is already an image link, it removes it - * - * @example - * // either ... - * wysihtml5.commands.insertImage.exec(composer, "insertImage", "http://www.google.de/logo.jpg"); - * // ... or ... - * wysihtml5.commands.insertImage.exec(composer, "insertImage", { src: "http://www.google.de/logo.jpg", title: "foo" }); - */ + return { exec: function(composer, command, value) { value = typeof(value) === "object" ? value : { src: value }; @@ -27,14 +26,14 @@ parent.removeChild(image); // and it's parent too if it hasn't got any other relevant child nodes - wysihtml5.dom.removeEmptyTextNodes(parent); + wysihtml.dom.removeEmptyTextNodes(parent); if (parent.nodeName === "A" && !parent.firstChild) { composer.selection.setAfter(parent); parent.parentNode.removeChild(parent); } // firefox and ie sometimes don't remove the image handles, even though the image got removed - wysihtml5.quirks.redraw(composer.element); + wysihtml.quirks.redraw(composer.element); return; } @@ -56,8 +55,8 @@ } composer.selection.insertNode(image); - if (wysihtml5.browser.hasProblemsSettingCaretAfterImg()) { - textNode = doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + if (wysihtml.browser.hasProblemsSettingCaretAfterImg()) { + textNode = doc.createTextNode(wysihtml.INVISIBLE_SPACE); composer.selection.insertNode(textNode); composer.selection.setAfter(textNode); } else { @@ -71,7 +70,7 @@ text, imagesInSelection; - if (!wysihtml5.dom.hasElementWithTagName(doc, NODE_NAME)) { + if (!wysihtml.dom.hasElementWithTagName(doc, NODE_NAME)) { return false; } @@ -85,17 +84,17 @@ return selectedNode; } - if (selectedNode.nodeType !== wysihtml5.ELEMENT_NODE) { + if (selectedNode.nodeType !== wysihtml.ELEMENT_NODE) { return false; } text = composer.selection.getText(); - text = wysihtml5.lang.string(text).trim(); + text = wysihtml.lang.string(text).trim(); if (text) { return false; } - imagesInSelection = composer.selection.getNodes(wysihtml5.ELEMENT_NODE, function(node) { + imagesInSelection = composer.selection.getNodes(wysihtml.ELEMENT_NODE, function(node) { return node.nodeName === "IMG"; }); @@ -106,4 +105,4 @@ return imagesInSelection[0]; } }; -})(wysihtml5); +})(); diff --git a/src/extensions/commands_basic/bold.js b/src/extensions/commands_basic/bold.js new file mode 100644 index 0000000..0577877 --- /dev/null +++ b/src/extensions/commands_basic/bold.js @@ -0,0 +1,16 @@ +wysihtml.commands.bold = (function() { + var nodeOptions = { + nodeName: "B", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; +})(); diff --git a/src/extensions/commands_basic/insertBlockQuote.js b/src/extensions/commands_basic/insertBlockQuote.js new file mode 100644 index 0000000..d5f4d31 --- /dev/null +++ b/src/extensions/commands_basic/insertBlockQuote.js @@ -0,0 +1,16 @@ +wysihtml.commands.insertBlockQuote = (function() { + var nodeOptions = { + nodeName: "BLOCKQUOTE", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); diff --git a/src/extensions/commands_basic/insertOrderedList.js b/src/extensions/commands_basic/insertOrderedList.js new file mode 100644 index 0000000..7c39d2c --- /dev/null +++ b/src/extensions/commands_basic/insertOrderedList.js @@ -0,0 +1,11 @@ +wysihtml.commands.insertOrderedList = (function() { + return { + exec: function(composer, command) { + wysihtml.commands.insertList.exec(composer, command, "OL"); + }, + + state: function(composer, command) { + return wysihtml.commands.insertList.state(composer, command, "OL"); + } + }; +})(); diff --git a/src/extensions/commands_basic/insertUnorderedList.js b/src/extensions/commands_basic/insertUnorderedList.js new file mode 100644 index 0000000..55b0ae7 --- /dev/null +++ b/src/extensions/commands_basic/insertUnorderedList.js @@ -0,0 +1,11 @@ +wysihtml.commands.insertUnorderedList = (function() { + return { + exec: function(composer, command) { + wysihtml.commands.insertList.exec(composer, command, "UL"); + }, + + state: function(composer, command) { + return wysihtml.commands.insertList.state(composer, command, "UL"); + } + }; +})(); diff --git a/src/extensions/commands_basic/italic.js b/src/extensions/commands_basic/italic.js new file mode 100644 index 0000000..756b237 --- /dev/null +++ b/src/extensions/commands_basic/italic.js @@ -0,0 +1,17 @@ +wysihtml.commands.italic = (function() { + var nodeOptions = { + nodeName: "I", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; + +})(); diff --git a/src/extensions/commands_basic/subscript.js b/src/extensions/commands_basic/subscript.js new file mode 100644 index 0000000..9f19310 --- /dev/null +++ b/src/extensions/commands_basic/subscript.js @@ -0,0 +1,17 @@ +wysihtml.commands.subscript = (function() { + var nodeOptions = { + nodeName: "SUB", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; + +})(); diff --git a/src/extensions/commands_basic/superscript.js b/src/extensions/commands_basic/superscript.js new file mode 100644 index 0000000..fbfe90a --- /dev/null +++ b/src/extensions/commands_basic/superscript.js @@ -0,0 +1,17 @@ +wysihtml.commands.superscript = (function() { + var nodeOptions = { + nodeName: "SUP", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; + +})(); diff --git a/src/extensions/commands_basic/underline.js b/src/extensions/commands_basic/underline.js new file mode 100644 index 0000000..e62cd0a --- /dev/null +++ b/src/extensions/commands_basic/underline.js @@ -0,0 +1,17 @@ +wysihtml.commands.underline = (function() { + var nodeOptions = { + nodeName: "U", + toggle: true + }; + + return { + exec: function(composer, command) { + wysihtml.commands.formatInline.exec(composer, command, nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatInline.state(composer, command, nodeOptions); + } + }; + +})(); diff --git a/src/extensions/commands_format_by_class/fontSize.js b/src/extensions/commands_format_by_class/fontSize.js new file mode 100644 index 0000000..80aff16 --- /dev/null +++ b/src/extensions/commands_format_by_class/fontSize.js @@ -0,0 +1,13 @@ +wysihtml.commands.fontSize = (function() { + var REG_EXP = /wysiwyg-font-size-[0-9a-z\-]+/g; + + return { + exec: function(composer, command, size) { + wysihtml.commands.formatInline.exec(composer, command, {className: "wysiwyg-font-size-" + size, classRegExp: REG_EXP, toggle: true}); + }, + + state: function(composer, command, size) { + return wysihtml.commands.formatInline.state(composer, command, {className: "wysiwyg-font-size-" + size}); + } + }; +})(); diff --git a/src/extensions/commands_format_by_class/foreColor.js b/src/extensions/commands_format_by_class/foreColor.js new file mode 100644 index 0000000..80bf9f1 --- /dev/null +++ b/src/extensions/commands_format_by_class/foreColor.js @@ -0,0 +1,13 @@ +wysihtml.commands.foreColor = (function() { + var REG_EXP = /wysiwyg-color-[0-9a-z]+/g; + + return { + exec: function(composer, command, color) { + wysihtml.commands.formatInline.exec(composer, command, {className: "wysiwyg-color-" + color, classRegExp: REG_EXP, toggle: true}); + }, + + state: function(composer, command, color) { + return wysihtml.commands.formatInline.state(composer, command, {className: "wysiwyg-color-" + color}); + } + }; +})(); diff --git a/src/commands/justifyCenter.js b/src/extensions/commands_format_by_class/justifyCenter.js similarity index 53% rename from src/commands/justifyCenter.js rename to src/extensions/commands_format_by_class/justifyCenter.js index c00984d..26ed0fa 100644 --- a/src/commands/justifyCenter.js +++ b/src/extensions/commands_format_by_class/justifyCenter.js @@ -1,19 +1,18 @@ -(function(wysihtml5) { - +wysihtml.commands.justifyCenter = (function() { var nodeOptions = { className: "wysiwyg-text-align-center", classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, toggle: true }; - wysihtml5.commands.justifyCenter = { + return { exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); }, state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); } }; -})(wysihtml5); +})(); diff --git a/src/commands/justifyFull.js b/src/extensions/commands_format_by_class/justifyFull.js similarity index 53% rename from src/commands/justifyFull.js rename to src/extensions/commands_format_by_class/justifyFull.js index f85a4f2..f157df4 100644 --- a/src/commands/justifyFull.js +++ b/src/extensions/commands_format_by_class/justifyFull.js @@ -1,18 +1,17 @@ -(function(wysihtml5) { - +wysihtml.commands.justifyFull = (function() { var nodeOptions = { className: "wysiwyg-text-align-justify", classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, toggle: true }; - wysihtml5.commands.justifyFull = { + return { exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); }, state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); } }; -})(wysihtml5); +})(); diff --git a/src/commands/justifyLeft.js b/src/extensions/commands_format_by_class/justifyLeft.js similarity index 53% rename from src/commands/justifyLeft.js rename to src/extensions/commands_format_by_class/justifyLeft.js index 7dbf845..3818349 100644 --- a/src/commands/justifyLeft.js +++ b/src/extensions/commands_format_by_class/justifyLeft.js @@ -1,18 +1,17 @@ -(function(wysihtml5) { - +wysihtml.commands.justifyLeft = (function() { var nodeOptions = { className: "wysiwyg-text-align-left", classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, toggle: true }; - wysihtml5.commands.justifyLeft = { + return { exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); }, state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); } }; -})(wysihtml5); +})(); diff --git a/src/commands/justifyRight.js b/src/extensions/commands_format_by_class/justifyRight.js similarity index 53% rename from src/commands/justifyRight.js rename to src/extensions/commands_format_by_class/justifyRight.js index 91d5406..d00a364 100644 --- a/src/commands/justifyRight.js +++ b/src/extensions/commands_format_by_class/justifyRight.js @@ -1,18 +1,17 @@ -(function(wysihtml5) { - +wysihtml.commands.justifyRight = (function() { var nodeOptions = { className: "wysiwyg-text-align-right", classRegExp: /wysiwyg-text-align-[0-9a-z]+/g, toggle: true }; - wysihtml5.commands.justifyRight = { + return { exec: function(composer, command) { - return wysihtml5.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); }, state: function(composer, command) { - return wysihtml5.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); } }; -})(wysihtml5); +})(); diff --git a/src/extensions/commands_format_by_style/alignCenterStyle.js b/src/extensions/commands_format_by_style/alignCenterStyle.js new file mode 100644 index 0000000..1dc3959 --- /dev/null +++ b/src/extensions/commands_format_by_style/alignCenterStyle.js @@ -0,0 +1,17 @@ +wysihtml.commands.alignCenterStyle = (function() { + var nodeOptions = { + styleProperty: "textAlign", + styleValue: "center", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); diff --git a/src/extensions/commands_format_by_style/alignJustifyStyle.js b/src/extensions/commands_format_by_style/alignJustifyStyle.js new file mode 100644 index 0000000..f88b05c --- /dev/null +++ b/src/extensions/commands_format_by_style/alignJustifyStyle.js @@ -0,0 +1,17 @@ +wysihtml.commands.alignJustifyStyle = (function() { + var nodeOptions = { + styleProperty: "textAlign", + styleValue: "justify", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); diff --git a/src/extensions/commands_format_by_style/alignLeftStyle.js b/src/extensions/commands_format_by_style/alignLeftStyle.js new file mode 100644 index 0000000..0828540 --- /dev/null +++ b/src/extensions/commands_format_by_style/alignLeftStyle.js @@ -0,0 +1,17 @@ +wysihtml.commands.alignLeftStyle = (function() { + var nodeOptions = { + styleProperty: "textAlign", + styleValue: "left", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); diff --git a/src/extensions/commands_format_by_style/alignRightStyle.js b/src/extensions/commands_format_by_style/alignRightStyle.js new file mode 100644 index 0000000..7bf0e69 --- /dev/null +++ b/src/extensions/commands_format_by_style/alignRightStyle.js @@ -0,0 +1,17 @@ +wysihtml.commands.alignRightStyle = (function() { + var nodeOptions = { + styleProperty: "textAlign", + styleValue: "right", + toggle: true + }; + + return { + exec: function(composer, command) { + return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions); + }, + + state: function(composer, command) { + return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions); + } + }; +})(); diff --git a/src/extensions/commands_format_by_style/bgColorStyle.js b/src/extensions/commands_format_by_style/bgColorStyle.js new file mode 100644 index 0000000..cf48bf3 --- /dev/null +++ b/src/extensions/commands_format_by_style/bgColorStyle.js @@ -0,0 +1,48 @@ +/* Sets text background color by inline styles */ +wysihtml.commands.bgColorStyle = (function() { + return { + exec: function(composer, command, color) { + var colorVals = wysihtml.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color"), + colString; + + if (colorVals) { + colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; + wysihtml.commands.formatInline.exec(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); + } + }, + + state: function(composer, command, color) { + var colorVals = color ? wysihtml.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color") : null, + colString; + + if (colorVals) { + colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')'; + } + + return wysihtml.commands.formatInline.state(composer, command, {styleProperty: 'backgroundColor', styleValue: colString}); + }, + + remove: function(composer, command) { + return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: 'backgroundColor'}); + }, + + stateValue: function(composer, command, props) { + var st = this.state(composer, command), + colorStr, + val = false; + + if (st && wysihtml.lang.object(st).isArray()) { + st = st[0]; + } + + if (st) { + colorStr = st.getAttribute('style'); + if (colorStr) { + val = wysihtml.quirks.styleParser.parseColor(colorStr, "background-color"); + return wysihtml.quirks.styleParser.unparseColor(val, props); + } + } + return false; + } + }; +})(); diff --git a/src/extensions/commands_format_by_style/fontSizeStyle.js b/src/extensions/commands_format_by_style/fontSizeStyle.js new file mode 100644 index 0000000..004f2df --- /dev/null +++ b/src/extensions/commands_format_by_style/fontSizeStyle.js @@ -0,0 +1,35 @@ +/* Set font size by inline style */ +wysihtml.commands.fontSizeStyle = (function() { + return { + exec: function(composer, command, size) { + size = size.size || size; + if (!(/^\s*$/).test(size)) { + wysihtml.commands.formatInline.exec(composer, command, {styleProperty: "fontSize", styleValue: size, toggle: false}); + } + }, + + state: function(composer, command, size) { + return wysihtml.commands.formatInline.state(composer, command, {styleProperty: "fontSize", styleValue: size || undefined}); + }, + + remove: function(composer, command) { + return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: "fontSize"}); + }, + + stateValue: function(composer, command) { + var styleStr, + st = this.state(composer, command); + + if (st && wysihtml.lang.object(st).isArray()) { + st = st[0]; + } + if (st) { + styleStr = st.getAttribute("style"); + if (styleStr) { + return wysihtml.quirks.styleParser.parseFontSize(styleStr); + } + } + return false; + } + }; +})(); diff --git a/src/commands/foreColorStyle.js b/src/extensions/commands_format_by_style/foreColorStyle.js similarity index 50% rename from src/commands/foreColorStyle.js rename to src/extensions/commands_format_by_style/foreColorStyle.js index c02fd7d..74e0844 100644 --- a/src/commands/foreColorStyle.js +++ b/src/extensions/commands_format_by_style/foreColorStyle.js @@ -1,24 +1,21 @@ -/** - * Sets text color by inline styles - */ -(function(wysihtml5) { - - wysihtml5.commands.foreColorStyle = { +/* Sets text color by inline styles */ +wysihtml.commands.foreColorStyle = (function() { + return { exec: function(composer, command, color) { var colorVals, colString; if (!color) { return; } - colorVals = wysihtml5.quirks.styleParser.parseColor("color:" + (color.color || color), "color"); + colorVals = wysihtml.quirks.styleParser.parseColor("color:" + (color.color || color), "color"); if (colorVals) { colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')'; - wysihtml5.commands.formatInline.exec(composer, command, {styleProperty: "color", styleValue: colString}); + wysihtml.commands.formatInline.exec(composer, command, {styleProperty: "color", styleValue: colString}); } }, state: function(composer, command, color) { - var colorVals = color ? wysihtml5.quirks.styleParser.parseColor("color:" + (color.color || color), "color") : null, + var colorVals = color ? wysihtml.quirks.styleParser.parseColor("color:" + (color.color || color), "color") : null, colString; @@ -26,11 +23,11 @@ colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')'; } - return wysihtml5.commands.formatInline.state(composer, command, {styleProperty: "color", styleValue: colString}); + return wysihtml.commands.formatInline.state(composer, command, {styleProperty: "color", styleValue: colString}); }, remove: function(composer, command) { - return wysihtml5.commands.formatInline.remove(composer, command, {styleProperty: "color"}); + return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: "color"}); }, stateValue: function(composer, command, props) { @@ -38,19 +35,18 @@ colorStr, val = false; - if (st && wysihtml5.lang.object(st).isArray()) { + if (st && wysihtml.lang.object(st).isArray()) { st = st[0]; } if (st) { colorStr = st.getAttribute("style"); if (colorStr) { - val = wysihtml5.quirks.styleParser.parseColor(colorStr, "color"); - return wysihtml5.quirks.styleParser.unparseColor(val, props); + val = wysihtml.quirks.styleParser.parseColor(colorStr, "color"); + return wysihtml.quirks.styleParser.unparseColor(val, props); } } return false; } - }; -})(wysihtml5); +})(); diff --git a/src/lang/array.js b/src/lang/array.js index dc2df28..cc37489 100644 --- a/src/lang/array.js +++ b/src/lang/array.js @@ -1,10 +1,10 @@ -wysihtml5.lang.array = function(arr) { +wysihtml.lang.array = function(arr) { return { /** * Check whether a given object exists in an array * * @example - * wysihtml5.lang.array([1, 2]).contains(1); + * wysihtml.lang.array([1, 2]).contains(1); * // => true * * Can be used to match array with array. If intersection is found true is returned @@ -12,13 +12,13 @@ wysihtml5.lang.array = function(arr) { contains: function(needle) { if (Array.isArray(needle)) { for (var i = needle.length; i--;) { - if (wysihtml5.lang.array(arr).indexOf(needle[i]) !== -1) { + if (wysihtml.lang.array(arr).indexOf(needle[i]) !== -1) { return true; } } return false; } else { - return wysihtml5.lang.array(arr).indexOf(needle) !== -1; + return wysihtml.lang.array(arr).indexOf(needle) !== -1; } }, @@ -27,7 +27,7 @@ wysihtml5.lang.array = function(arr) { * If no elelemt found returns -1 * * @example - * wysihtml5.lang.array([1, 2]).indexOf(2); + * wysihtml.lang.array([1, 2]).indexOf(2); * // => 1 */ indexOf: function(needle) { @@ -45,11 +45,11 @@ wysihtml5.lang.array = function(arr) { * Substract one array from another * * @example - * wysihtml5.lang.array([1, 2, 3, 4]).without([3, 4]); + * wysihtml.lang.array([1, 2, 3, 4]).without([3, 4]); * // => [1, 2] */ without: function(arrayToSubstract) { - arrayToSubstract = wysihtml5.lang.array(arrayToSubstract); + arrayToSubstract = wysihtml.lang.array(arrayToSubstract); var newArr = [], i = 0, length = arr.length; @@ -66,7 +66,7 @@ wysihtml5.lang.array = function(arr) { * * Following will convert a Live NodeList to a proper Array * @example - * var childNodes = wysihtml5.lang.array(document.body.childNodes).get(); + * var childNodes = wysihtml.lang.array(document.body.childNodes).get(); */ get: function() { var i = 0, @@ -83,7 +83,7 @@ wysihtml5.lang.array = function(arr) { * optionally this can be provided as second argument * * @example - * var childNodes = wysihtml5.lang.array([1,2,3,4]).map(function (value, index, array) { + * var childNodes = wysihtml.lang.array([1,2,3,4]).map(function (value, index, array) { return value * 2; * }); * // => [2,4,6,8] @@ -105,7 +105,7 @@ wysihtml5.lang.array = function(arr) { /* ReturnS new array without duplicate entries * * @example - * var uniq = wysihtml5.lang.array([1,2,3,2,1,4]).unique(); + * var uniq = wysihtml.lang.array([1,2,3,2,1,4]).unique(); * // => [1,2,3,4] */ unique: function() { @@ -114,7 +114,7 @@ wysihtml5.lang.array = function(arr) { idx = 0; while (idx < max) { - if (!wysihtml5.lang.array(vals).contains(arr[idx])) { + if (!wysihtml.lang.array(vals).contains(arr[idx])) { vals.push(arr[idx]); } idx++; diff --git a/src/lang/dispatcher.js b/src/lang/dispatcher.js index 36f6d0d..5775015 100644 --- a/src/lang/dispatcher.js +++ b/src/lang/dispatcher.js @@ -1,5 +1,5 @@ -wysihtml5.lang.Dispatcher = Base.extend( - /** @scope wysihtml5.lang.Dialog.prototype */ { +wysihtml.lang.Dispatcher = Base.extend( + /** @scope wysihtml.lang.Dialog.prototype */ { on: function(eventName, handler) { this.events = this.events || {}; this.events[eventName] = this.events[eventName] || []; diff --git a/src/lang/object.js b/src/lang/object.js index fd8378f..68eb6d2 100644 --- a/src/lang/object.js +++ b/src/lang/object.js @@ -1,20 +1,20 @@ -wysihtml5.lang.object = function(obj) { +wysihtml.lang.object = function(obj) { return { /** * @example - * wysihtml5.lang.object({ foo: 1, bar: 1 }).merge({ bar: 2, baz: 3 }).get(); + * wysihtml.lang.object({ foo: 1, bar: 1 }).merge({ bar: 2, baz: 3 }).get(); * // => { foo: 1, bar: 2, baz: 3 } */ merge: function(otherObj, deep) { for (var i in otherObj) { - if (deep && wysihtml5.lang.object(otherObj[i]).isPlainObject() && (typeof obj[i] === "undefined" || wysihtml5.lang.object(obj[i]).isPlainObject())) { + if (deep && wysihtml.lang.object(otherObj[i]).isPlainObject() && (typeof obj[i] === "undefined" || wysihtml.lang.object(obj[i]).isPlainObject())) { if (typeof obj[i] === "undefined") { - obj[i] = wysihtml5.lang.object(otherObj[i]).clone(true); + obj[i] = wysihtml.lang.object(otherObj[i]).clone(true); } else { - wysihtml5.lang.object(obj[i]).merge(wysihtml5.lang.object(otherObj[i]).clone(true)); + wysihtml.lang.object(obj[i]).merge(wysihtml.lang.object(otherObj[i]).clone(true)); } } else { - obj[i] = wysihtml5.lang.object(otherObj[i]).isPlainObject() ? wysihtml5.lang.object(otherObj[i]).clone(true) : otherObj[i]; + obj[i] = wysihtml.lang.object(otherObj[i]).isPlainObject() ? wysihtml.lang.object(otherObj[i]).clone(true) : otherObj[i]; } } return this; @@ -49,23 +49,23 @@ wysihtml5.lang.object = function(obj) { /** * @example - * wysihtml5.lang.object({ foo: 1 }).clone(); + * wysihtml.lang.object({ foo: 1 }).clone(); * // => { foo: 1 } * - * v0.4.14 adds options for deep clone : wysihtml5.lang.object({ foo: 1 }).clone(true); + * v0.4.14 adds options for deep clone : wysihtml.lang.object({ foo: 1 }).clone(true); */ clone: function(deep) { var newObj = {}, i; - if (obj === null || !wysihtml5.lang.object(obj).isPlainObject()) { + if (obj === null || !wysihtml.lang.object(obj).isPlainObject()) { return obj; } for (i in obj) { if(obj.hasOwnProperty(i)) { if (deep) { - newObj[i] = wysihtml5.lang.object(obj[i]).clone(deep); + newObj[i] = wysihtml.lang.object(obj[i]).clone(deep); } else { newObj[i] = obj[i]; } @@ -76,7 +76,7 @@ wysihtml5.lang.object = function(obj) { /** * @example - * wysihtml5.lang.object([]).isArray(); + * wysihtml.lang.object([]).isArray(); * // => true */ isArray: function() { @@ -85,7 +85,7 @@ wysihtml5.lang.object = function(obj) { /** * @example - * wysihtml5.lang.object(function() {}).isFunction(); + * wysihtml.lang.object(function() {}).isFunction(); * // => true */ isFunction: function() { @@ -98,7 +98,7 @@ wysihtml5.lang.object = function(obj) { /** * @example - * wysihtml5.lang.object({}).isEmpty(); + * wysihtml.lang.object({}).isEmpty(); * // => true */ isEmpty: function() { diff --git a/src/lang/string.js b/src/lang/string.js index 7b2e334..bd7ec3b 100644 --- a/src/lang/string.js +++ b/src/lang/string.js @@ -9,12 +9,12 @@ '"': """, '\t':"  " }; - wysihtml5.lang.string = function(str) { + wysihtml.lang.string = function(str) { str = String(str); return { /** * @example - * wysihtml5.lang.string(" foo ").trim(); + * wysihtml.lang.string(" foo ").trim(); * // => "foo" */ trim: function() { @@ -23,7 +23,7 @@ /** * @example - * wysihtml5.lang.string("Hello #{name}").interpolate({ name: "Christopher" }); + * wysihtml.lang.string("Hello #{name}").interpolate({ name: "Christopher" }); * // => "Hello Christopher" */ interpolate: function(vars) { @@ -35,7 +35,7 @@ /** * @example - * wysihtml5.lang.string("Hello Tom").replace("Tom").with("Hans"); + * wysihtml.lang.string("Hello Tom").replace("Tom").with("Hans"); * // => "Hello Hans" */ replace: function(search) { @@ -48,7 +48,7 @@ /** * @example - * wysihtml5.lang.string("hello
    ").escapeHTML(); + * wysihtml.lang.string("hello
    ").escapeHTML(); * // => "hello<br>" */ escapeHTML: function(linebreaks, convertSpaces) { diff --git a/src/polyfills.js b/src/polyfills.js index afc1c7c..4f866d8 100644 --- a/src/polyfills.js +++ b/src/polyfills.js @@ -1,4 +1,4 @@ -wysihtml5.polyfills = function(win, doc) { +wysihtml.polyfills = function(win, doc) { // TODO: in future try to replace most inline compability checks with polyfills for code readability @@ -505,4 +505,4 @@ wysihtml5.polyfills = function(win, doc) { })(); }; -wysihtml5.polyfills(window, document); +wysihtml.polyfills(window, document); diff --git a/src/quirks/clean_pasted_html.js b/src/quirks/clean_pasted_html.js index f47e59a..af7d502 100644 --- a/src/quirks/clean_pasted_html.js +++ b/src/quirks/clean_pasted_html.js @@ -4,17 +4,17 @@ * * @author Christopher Blum */ -wysihtml5.quirks.cleanPastedHTML = (function() { +wysihtml.quirks.cleanPastedHTML = (function() { var styleToRegex = function (styleStr) { - var trimmedStr = wysihtml5.lang.string(styleStr).trim(), + var trimmedStr = wysihtml.lang.string(styleStr).trim(), escapedStr = trimmedStr.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); return new RegExp("^((?!^" + escapedStr + "$).)*$", "i"); }; var extendRulesWithStyleExceptions = function (rules, exceptStyles) { - var newRules = wysihtml5.lang.object(rules).clone(true), + var newRules = wysihtml.lang.object(rules).clone(true), tag, style; for (tag in newRules.tags) { @@ -56,13 +56,13 @@ wysihtml5.quirks.cleanPastedHTML = (function() { return function(html, options) { var exceptStyles = { - 'color': wysihtml5.dom.getStyle("color").from(options.referenceNode), - 'fontSize': wysihtml5.dom.getStyle("font-size").from(options.referenceNode) + 'color': wysihtml.dom.getStyle("color").from(options.referenceNode), + 'fontSize': wysihtml.dom.getStyle("font-size").from(options.referenceNode) }, rules = extendRulesWithStyleExceptions(pickRuleset(options.rules, html) || {}, exceptStyles), newHtml; - newHtml = wysihtml5.dom.parse(html, { + newHtml = wysihtml.dom.parse(html, { "rules": rules, "cleanUp": true, // elements, empty or without attributes, should be removed/replaced with their content "context": options.referenceNode.ownerDocument, diff --git a/src/quirks/ensure_proper_clearing.js b/src/quirks/ensure_proper_clearing.js index 9e548d6..bc7ceab 100644 --- a/src/quirks/ensure_proper_clearing.js +++ b/src/quirks/ensure_proper_clearing.js @@ -3,9 +3,9 @@ * * @param {Object} contentEditableElement The contentEditable element to observe for clearing events * @exaple - * wysihtml5.quirks.ensureProperClearing(myContentEditableElement); + * wysihtml.quirks.ensureProperClearing(myContentEditableElement); */ -wysihtml5.quirks.ensureProperClearing = (function() { +wysihtml.quirks.ensureProperClearing = (function() { var clearIfNecessary = function() { var element = this; setTimeout(function() { @@ -18,6 +18,6 @@ wysihtml5.quirks.ensureProperClearing = (function() { }; return function(composer) { - wysihtml5.dom.observe(composer.element, ["cut", "keydown"], clearIfNecessary); + wysihtml.dom.observe(composer.element, ["cut", "keydown"], clearIfNecessary); }; })(); diff --git a/src/quirks/get_correct_inner_html.js b/src/quirks/get_correct_inner_html.js index 4973e70..312b847 100644 --- a/src/quirks/get_correct_inner_html.js +++ b/src/quirks/get_correct_inner_html.js @@ -7,9 +7,9 @@ // will result in: //
    // which is wrong -(function(wysihtml5) { +(function(wysihtml) { var TILDE_ESCAPED = "%7E"; - wysihtml5.quirks.getCorrectInnerHTML = function(element) { + wysihtml.quirks.getCorrectInnerHTML = function(element) { var innerHTML = element.innerHTML; if (innerHTML.indexOf(TILDE_ESCAPED) === -1) { return innerHTML; @@ -22,9 +22,9 @@ i; for (i=0, length=elementsWithTilde.length; i 0;) { - if (!(/^\s*$/).test(sSplit[i])) { - regexes.push(new RegExp("(^|\\s|;)" + sSplit[i].replace(/\s/gi, '').replace(/([\(\)])/gi, "\\$1").toLowerCase().replace(";", ";?").replace(/rgb\\\((\d+),(\d+),(\d+)\\\)/gi, "\\s?rgb\\($1,\\s?$2,\\s?$3\\)"), "gi")); - } - } - for (var j = 0, jmax = regexes.length; j < jmax; j++) { - if (elStyle.match(regexes[j])) { - return regexes[j]; - } - } - } - - return false; - } - - function isMatchingAllready(node, tags, style, className) { - if (style) { - return getMatchingStyleRegexp(node, style); - } else if (className) { - return wysihtml5.dom.hasClass(node, className); - } else { - return rangy.dom.arrayContains(tags, node.tagName.toLowerCase()); - } - } - - function areMatchingAllready(nodes, tags, style, className) { - for (var i = nodes.length; i--;) { - if (!isMatchingAllready(nodes[i], tags, style, className)) { - return false; - } - } - return nodes.length ? true : false; - } - - function removeOrChangeStyle(el, style, regExp) { - - var exactRegex = getMatchingStyleRegexp(el, style); - if (exactRegex) { - // adding same style value on property again removes style - removeStyle(el, exactRegex); - return "remove"; - } else { - // adding new style value changes value - addStyle(el, style, regExp); - return "change"; - } - } - - function hasSameClasses(el1, el2) { - return el1.className.replace(REG_EXP_WHITE_SPACE, " ") == el2.className.replace(REG_EXP_WHITE_SPACE, " "); - } - - function replaceWithOwnChildren(el) { - var parent = el.parentNode; - while (el.firstChild) { - parent.insertBefore(el.firstChild, el); - } - parent.removeChild(el); - } - - function elementsHaveSameNonClassAttributes(el1, el2) { - if (el1.attributes.length != el2.attributes.length) { - return false; - } - for (var i = 0, len = el1.attributes.length, attr1, attr2, name; i < len; ++i) { - attr1 = el1.attributes[i]; - name = attr1.name; - if (name != "class") { - attr2 = el2.attributes.getNamedItem(name); - if (attr1.specified != attr2.specified) { - return false; - } - if (attr1.specified && attr1.nodeValue !== attr2.nodeValue) { - return false; - } - } - } - return true; - } - - function isSplitPoint(node, offset) { - if (rangy.dom.isCharacterDataNode(node)) { - if (offset == 0) { - return !!node.previousSibling; - } else if (offset == node.length) { - return !!node.nextSibling; - } else { - return true; - } - } - - return offset > 0 && offset < node.childNodes.length; - } - - function splitNodeAt(node, descendantNode, descendantOffset, container) { - var newNode; - if (rangy.dom.isCharacterDataNode(descendantNode)) { - if (descendantOffset == 0) { - descendantOffset = rangy.dom.getNodeIndex(descendantNode); - descendantNode = descendantNode.parentNode; - } else if (descendantOffset == descendantNode.length) { - descendantOffset = rangy.dom.getNodeIndex(descendantNode) + 1; - descendantNode = descendantNode.parentNode; - } else { - newNode = rangy.dom.splitDataNode(descendantNode, descendantOffset); - } - } - if (!newNode) { - if (!container || descendantNode !== container) { - - newNode = descendantNode.cloneNode(false); - if (newNode.id) { - newNode.removeAttribute("id"); - } - var child; - while ((child = descendantNode.childNodes[descendantOffset])) { - newNode.appendChild(child); - } - rangy.dom.insertAfter(newNode, descendantNode); - - } - } - return (descendantNode == node) ? newNode : splitNodeAt(node, newNode.parentNode, rangy.dom.getNodeIndex(newNode), container); - } - - function Merge(firstNode) { - this.isElementMerge = (firstNode.nodeType == wysihtml5.ELEMENT_NODE); - this.firstTextNode = this.isElementMerge ? firstNode.lastChild : firstNode; - this.textNodes = [this.firstTextNode]; - } - - Merge.prototype = { - doMerge: function() { - var textBits = [], textNode, parent, text; - for (var i = 0, len = this.textNodes.length; i < len; ++i) { - textNode = this.textNodes[i]; - parent = textNode.parentNode; - textBits[i] = textNode.data; - if (i) { - parent.removeChild(textNode); - if (!parent.hasChildNodes()) { - parent.parentNode.removeChild(parent); - } - } - } - this.firstTextNode.data = text = textBits.join(""); - return text; - }, - - getLength: function() { - var i = this.textNodes.length, len = 0; - while (i--) { - len += this.textNodes[i].length; - } - return len; - }, - - toString: function() { - var textBits = []; - for (var i = 0, len = this.textNodes.length; i < len; ++i) { - textBits[i] = "'" + this.textNodes[i].data + "'"; - } - return "[Merge(" + textBits.join(",") + ")]"; - } - }; - - function HTMLApplier(tagNames, cssClass, similarClassRegExp, normalize, cssStyle, similarStyleRegExp, container) { - this.tagNames = tagNames || [defaultTagName]; - this.cssClass = cssClass || ((cssClass === false) ? false : ""); - this.similarClassRegExp = similarClassRegExp; - this.cssStyle = cssStyle || ""; - this.similarStyleRegExp = similarStyleRegExp; - this.normalize = normalize; - this.applyToAnyTagName = false; - this.container = container; - } - - HTMLApplier.prototype = { - getAncestorWithClass: function(node) { - var cssClassMatch; - while (node) { - cssClassMatch = this.cssClass ? hasClass(node, this.cssClass, this.similarClassRegExp) : (this.cssStyle !== "") ? false : true; - if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssClassMatch) { - return node; - } - node = node.parentNode; - } - return false; - }, - - // returns parents of node with given style attribute - getAncestorWithStyle: function(node) { - var cssStyleMatch; - while (node) { - cssStyleMatch = this.cssStyle ? hasStyleAttr(node, this.similarStyleRegExp) : false; - - if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssStyleMatch) { - return node; - } - node = node.parentNode; - } - return false; - }, - - getMatchingAncestor: function(node) { - var ancestor = this.getAncestorWithClass(node), - matchType = false; - - if (!ancestor) { - ancestor = this.getAncestorWithStyle(node); - if (ancestor) { - matchType = "style"; - } - } else { - if (this.cssStyle) { - matchType = "class"; - } - } - - return { - "element": ancestor, - "type": matchType - }; - }, - - // Normalizes nodes after applying a CSS class to a Range. - postApply: function(textNodes, range) { - var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1]; - - var merges = [], currentMerge; - - var rangeStartNode = firstNode, rangeEndNode = lastNode; - var rangeStartOffset = 0, rangeEndOffset = lastNode.length; - - var textNode, precedingTextNode; - - for (var i = 0, len = textNodes.length; i < len; ++i) { - textNode = textNodes[i]; - precedingTextNode = null; - if (textNode && textNode.parentNode) { - precedingTextNode = this.getAdjacentMergeableTextNode(textNode.parentNode, false); - } - if (precedingTextNode) { - if (!currentMerge) { - currentMerge = new Merge(precedingTextNode); - merges.push(currentMerge); - } - currentMerge.textNodes.push(textNode); - if (textNode === firstNode) { - rangeStartNode = currentMerge.firstTextNode; - rangeStartOffset = rangeStartNode.length; - } - if (textNode === lastNode) { - rangeEndNode = currentMerge.firstTextNode; - rangeEndOffset = currentMerge.getLength(); - } - } else { - currentMerge = null; - } - } - // Test whether the first node after the range needs merging - if(lastNode && lastNode.parentNode) { - var nextTextNode = this.getAdjacentMergeableTextNode(lastNode.parentNode, true); - if (nextTextNode) { - if (!currentMerge) { - currentMerge = new Merge(lastNode); - merges.push(currentMerge); - } - currentMerge.textNodes.push(nextTextNode); - } - } - // Do the merges - if (merges.length) { - for (i = 0, len = merges.length; i < len; ++i) { - merges[i].doMerge(); - } - // Set the range boundaries - range.setStart(rangeStartNode, rangeStartOffset); - range.setEnd(rangeEndNode, rangeEndOffset); - } - }, - - getAdjacentMergeableTextNode: function(node, forward) { - var isTextNode = (node.nodeType == wysihtml5.TEXT_NODE); - var el = isTextNode ? node.parentNode : node; - var adjacentNode; - var propName = forward ? "nextSibling" : "previousSibling"; - if (isTextNode) { - // Can merge if the node's previous/next sibling is a text node - adjacentNode = node[propName]; - if (adjacentNode && adjacentNode.nodeType == wysihtml5.TEXT_NODE) { - return adjacentNode; - } - } else { - // Compare element with its sibling - adjacentNode = el[propName]; - if (adjacentNode && this.areElementsMergeable(node, adjacentNode)) { - return adjacentNode[forward ? "firstChild" : "lastChild"]; - } - } - return null; - }, - - areElementsMergeable: function(el1, el2) { - return rangy.dom.arrayContains(this.tagNames, (el1.tagName || "").toLowerCase()) - && rangy.dom.arrayContains(this.tagNames, (el2.tagName || "").toLowerCase()) - && hasSameClasses(el1, el2) - && elementsHaveSameNonClassAttributes(el1, el2); - }, - - createContainer: function(doc) { - var el = doc.createElement(this.tagNames[0]); - if (this.cssClass) { - el.className = this.cssClass; - } - if (this.cssStyle) { - el.setAttribute('style', this.cssStyle); - } - return el; - }, - - applyToTextNode: function(textNode) { - var parent = textNode.parentNode; - if (parent.childNodes.length == 1 && rangy.dom.arrayContains(this.tagNames, parent.tagName.toLowerCase())) { - - if (this.cssClass) { - addClass(parent, this.cssClass, this.similarClassRegExp); - } - if (this.cssStyle) { - addStyle(parent, this.cssStyle, this.similarStyleRegExp); - } - } else { - var el = this.createContainer(rangy.dom.getDocument(textNode)); - textNode.parentNode.insertBefore(el, textNode); - el.appendChild(textNode); - } - }, - - isRemovable: function(el) { - return rangy.dom.arrayContains(this.tagNames, el.tagName.toLowerCase()) && - wysihtml5.lang.string(el.className).trim() === "" && - ( - !el.getAttribute('style') || - wysihtml5.lang.string(el.getAttribute('style')).trim() === "" - ); - }, - - undoToTextNode: function(textNode, range, ancestorWithClass, ancestorWithStyle) { - var styleMode = (ancestorWithClass) ? false : true, - ancestor = ancestorWithClass || ancestorWithStyle, - styleChanged = false; - if (!range.containsNode(ancestor)) { - // Split out the portion of the ancestor from which we can remove the CSS class - var ancestorRange = range.cloneRange(); - ancestorRange.selectNode(ancestor); - - if (ancestorRange.isPointInRange(range.endContainer, range.endOffset) && isSplitPoint(range.endContainer, range.endOffset)) { - splitNodeAt(ancestor, range.endContainer, range.endOffset, this.container); - range.setEndAfter(ancestor); - } - if (ancestorRange.isPointInRange(range.startContainer, range.startOffset) && isSplitPoint(range.startContainer, range.startOffset)) { - ancestor = splitNodeAt(ancestor, range.startContainer, range.startOffset, this.container); - } - } - - if (!styleMode && this.similarClassRegExp) { - removeClass(ancestor, this.similarClassRegExp); - } - - if (styleMode && this.similarStyleRegExp) { - styleChanged = (removeOrChangeStyle(ancestor, this.cssStyle, this.similarStyleRegExp) === "change"); - } - if (this.isRemovable(ancestor) && !styleChanged) { - replaceWithOwnChildren(ancestor); - } - }, - - applyToRange: function(range) { - var textNodes; - for (var ri = range.length; ri--;) { - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - - if (!textNodes.length) { - try { - var node = this.createContainer(range[ri].endContainer.ownerDocument); - range[ri].surroundContents(node); - this.selectNode(range[ri], node); - return; - } catch(e) {} - } - - range[ri].splitBoundaries(); - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (textNodes.length) { - var textNode; - - for (var i = 0, len = textNodes.length; i < len; ++i) { - textNode = textNodes[i]; - if (!this.getMatchingAncestor(textNode).element) { - this.applyToTextNode(textNode); - } - } - - range[ri].setStart(textNodes[0], 0); - textNode = textNodes[textNodes.length - 1]; - range[ri].setEnd(textNode, textNode.length); - - if (this.normalize) { - this.postApply(textNodes, range[ri]); - } - } - - } - }, - - undoToRange: function(range) { - var textNodes, textNode, ancestorWithClass, ancestorWithStyle, ancestor; - for (var ri = range.length; ri--;) { - - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (textNodes.length) { - range[ri].splitBoundaries(); - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - } else { - var doc = range[ri].endContainer.ownerDocument, - node = doc.createTextNode(wysihtml5.INVISIBLE_SPACE); - range[ri].insertNode(node); - range[ri].selectNode(node); - textNodes = [node]; - } - - for (var i = 0, len = textNodes.length; i < len; ++i) { - if (range[ri].isValid()) { - textNode = textNodes[i]; - - ancestor = this.getMatchingAncestor(textNode); - if (ancestor.type === "style") { - this.undoToTextNode(textNode, range[ri], false, ancestor.element); - } else if (ancestor.element) { - this.undoToTextNode(textNode, range[ri], ancestor.element); - } - } - } - - if (len == 1) { - this.selectNode(range[ri], textNodes[0]); - } else { - range[ri].setStart(textNodes[0], 0); - textNode = textNodes[textNodes.length - 1]; - range[ri].setEnd(textNode, textNode.length); - - if (this.normalize) { - this.postApply(textNodes, range[ri]); - } - } - - } - }, - - selectNode: function(range, node) { - var isElement = node.nodeType === wysihtml5.ELEMENT_NODE, - canHaveHTML = "canHaveHTML" in node ? node.canHaveHTML : true, - content = isElement ? node.innerHTML : node.data, - isEmpty = (content === "" || content === wysihtml5.INVISIBLE_SPACE); - - if (isEmpty && isElement && canHaveHTML) { - // Make sure that caret is visible in node by inserting a zero width no breaking space - try { node.innerHTML = wysihtml5.INVISIBLE_SPACE; } catch(e) {} - } - range.selectNodeContents(node); - if (isEmpty && isElement) { - range.collapse(false); - } else if (isEmpty) { - range.setStartAfter(node); - range.setEndAfter(node); - } - }, - - getTextSelectedByRange: function(textNode, range) { - var textRange = range.cloneRange(); - textRange.selectNodeContents(textNode); - - var intersectionRange = textRange.intersection(range); - var text = intersectionRange ? intersectionRange.toString() : ""; - textRange.detach(); - - return text; - }, - - isAppliedToRange: function(range) { - var ancestors = [], - appliedType = "full", - ancestor, styleAncestor, textNodes; - - for (var ri = range.length; ri--;) { - - textNodes = range[ri].getNodes([wysihtml5.TEXT_NODE]); - if (!textNodes.length) { - ancestor = this.getMatchingAncestor(range[ri].startContainer).element; - - return (ancestor) ? { - "elements": [ancestor], - "coverage": appliedType - } : false; - } - - for (var i = 0, len = textNodes.length, selectedText; i < len; ++i) { - selectedText = this.getTextSelectedByRange(textNodes[i], range[ri]); - ancestor = this.getMatchingAncestor(textNodes[i]).element; - if (ancestor && selectedText != "") { - ancestors.push(ancestor); - - if (wysihtml5.dom.getTextNodes(ancestor, true).length === 1) { - appliedType = "full"; - } else if (appliedType === "full") { - appliedType = "inline"; - } - } else if (!ancestor) { - appliedType = "partial"; - } - } - - } - - return (ancestors.length) ? { - "elements": ancestors, - "coverage": appliedType - } : false; - }, - - toggleRange: function(range) { - var isApplied = this.isAppliedToRange(range), - parentsExactMatch; - - if (isApplied) { - if (isApplied.coverage === "full") { - this.undoToRange(range); - } else if (isApplied.coverage === "inline") { - parentsExactMatch = areMatchingAllready(isApplied.elements, this.tagNames, this.cssStyle, this.cssClass); - this.undoToRange(range); - if (!parentsExactMatch) { - this.applyToRange(range); - } - } else { - // partial - if (!areMatchingAllready(isApplied.elements, this.tagNames, this.cssStyle, this.cssClass)) { - this.undoToRange(range); - } - this.applyToRange(range); - } - } else { - this.applyToRange(range); - } - } - }; - - wysihtml5.selection.HTMLApplier = HTMLApplier; - -})(wysihtml5, rangy); diff --git a/src/selection/selection.js b/src/selection/selection.js index 002639d..587bddf 100644 --- a/src/selection/selection.js +++ b/src/selection/selection.js @@ -2,10 +2,10 @@ * Selection API * * @example - * var selection = new wysihtml5.Selection(editor); + * var selection = new wysihtml.Selection(editor); */ -(function(wysihtml5) { - var dom = wysihtml5.dom; +(function(wysihtml) { + var dom = wysihtml.dom; function _getCumulativeOffsetTop(element) { var top = 0; @@ -64,7 +64,7 @@ } }; - blankNode.appendChild(container.ownerDocument.createTextNode(wysihtml5.INVISIBLE_SPACE)); + blankNode.appendChild(container.ownerDocument.createTextNode(wysihtml.INVISIBLE_SPACE)); blankNode.className = '_wysihtml5-temp-caret-fix'; blankNode.style.display = 'block'; blankNode.style.minWidth = '1px'; @@ -104,8 +104,8 @@ } } - wysihtml5.Selection = Base.extend( - /** @scope wysihtml5.Selection.prototype */ { + wysihtml.Selection = Base.extend( + /** @scope wysihtml.Selection.prototype */ { constructor: function(editor, contain, unselectableClass) { // Make sure that our external range library is initialized rangy.init(); @@ -129,7 +129,7 @@ }, /** - * Restore a selection retrieved via wysihtml5.Selection.prototype.getBookmark + * Restore a selection retrieved via wysihtml.Selection.prototype.getBookmark * * @param {Object} bookmark An object that represents the current selection */ @@ -159,7 +159,7 @@ // Webkit has an issue with placing caret into places where there are no textnodes near by. createTemporaryCaretSpaceAfter: function (node) { var caretPlaceholder = this.doc.createElement('span'), - caretPlaceholderText = this.doc.createTextNode(wysihtml5.INVISIBLE_SPACE), + caretPlaceholderText = this.doc.createTextNode(wysihtml.INVISIBLE_SPACE), placeholderRemover = (function(event) { // Self-destructs the caret and keeps the text inserted into it by user var lastChild; @@ -176,10 +176,10 @@ // If user inserted sth it is in the placeholder and sgould be unwrapped and stripped of invisible whitespace hack // Otherwise the wrapper can just be removed if (caretPlaceholder && caretPlaceholder.parentNode) { - caretPlaceholder.innerHTML = caretPlaceholder.innerHTML.replace(wysihtml5.INVISIBLE_SPACE_REG_EXP, ""); + caretPlaceholder.innerHTML = caretPlaceholder.innerHTML.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); if ((/[^\s]+/).test(caretPlaceholder.innerHTML)) { lastChild = caretPlaceholder.lastChild; - wysihtml5.dom.unwrap(caretPlaceholder); + wysihtml.dom.unwrap(caretPlaceholder); this.setAfter(lastChild); } else { caretPlaceholder.parentNode.removeChild(caretPlaceholder); @@ -242,7 +242,7 @@ if (notVisual) { // If setAfter is used as internal between actions, self-removing caretPlaceholder has simpler implementation // and remove itself in call stack end instead on user interaction - var caretPlaceholder = this.doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + var caretPlaceholder = this.doc.createTextNode(wysihtml.INVISIBLE_SPACE); node.parentNode.insertBefore(caretPlaceholder, node.nextSibling); this.selectNode(caretPlaceholder); setTimeout(function() { @@ -291,16 +291,16 @@ */ selectNode: function(node, avoidInvisibleSpace) { var range = rangy.createRange(this.doc), - isElement = node.nodeType === wysihtml5.ELEMENT_NODE, + isElement = node.nodeType === wysihtml.ELEMENT_NODE, canHaveHTML = "canHaveHTML" in node ? node.canHaveHTML : (node.nodeName !== "IMG"), content = isElement ? node.innerHTML : node.data, - isEmpty = (content === "" || content === wysihtml5.INVISIBLE_SPACE), + isEmpty = (content === "" || content === wysihtml.INVISIBLE_SPACE), displayStyle = dom.getStyle("display").from(node), isBlockElement = (displayStyle === "block" || displayStyle === "list-item"); if (isEmpty && isElement && canHaveHTML && !avoidInvisibleSpace) { // Make sure that caret is visible in node by inserting a zero width no breaking space - try { node.innerHTML = wysihtml5.INVISIBLE_SPACE; } catch(e) {} + try { node.innerHTML = wysihtml.INVISIBLE_SPACE; } catch(e) {} } if (canHaveHTML) { range.selectNodeContents(node); @@ -368,7 +368,7 @@ nodes = [], curNodes; for (var i = 0, maxi = ranges.length; i < maxi; i++) { curNodes = ranges[i].getNodes([1], function(node) { - return wysihtml5.lang.array(nodeTypes).contains(node.nodeName); + return wysihtml.lang.array(nodeTypes).contains(node.nodeName); }); nodes = nodes.concat(curNodes); } @@ -414,16 +414,16 @@ var startParent, endParent, uneditables, ev; if (this.unselectableClass) { - if ((startParent = wysihtml5.dom.getParentElement(range.startContainer, { query: "." + this.unselectableClass }, false, this.contain))) { + if ((startParent = wysihtml.dom.getParentElement(range.startContainer, { query: "." + this.unselectableClass }, false, this.contain))) { range.setStartBefore(startParent); } - if ((endParent = wysihtml5.dom.getParentElement(range.endContainer, { query: "." + this.unselectableClass }, false, this.contain))) { + if ((endParent = wysihtml.dom.getParentElement(range.endContainer, { query: "." + this.unselectableClass }, false, this.contain))) { range.setEndAfter(endParent); } // If customevents present notify uneditable elements of being deleted uneditables = range.getNodes([1], (function (node) { - return wysihtml5.dom.hasClass(node, this.unselectableClass); + return wysihtml.dom.hasClass(node, this.unselectableClass); }).bind(this)); for (var i = uneditables.length; i--;) { try { @@ -467,10 +467,10 @@ } else if (ignoreEmpty && ret && ret.nodeType === 1) { // Do not count empty nodes if param set. // Contenteditable tends to bypass and delete these silently when deleting with caret when element is inline-like - displayStyle = wysihtml5.dom.getStyle("display").from(ret); + displayStyle = wysihtml.dom.getStyle("display").from(ret); if ( - !wysihtml5.lang.array(["BR", "HR", "IMG"]).contains(ret.nodeName) && - !wysihtml5.lang.array(["block", "inline-block", "flex", "list-item", "table"]).contains(displayStyle) && + !wysihtml.lang.array(["BR", "HR", "IMG"]).contains(ret.nodeName) && + !wysihtml.lang.array(["block", "inline-block", "flex", "list-item", "table"]).contains(displayStyle) && (/^[\s]*$/).test(ret.innerHTML) ) { ret = this.getPreviousNode(ret, ignoreEmpty); @@ -534,7 +534,7 @@ curEl, parents = []; for (var i = 0, maxi = nodes.length; i < maxi; i++) { - curEl = (nodes[i].nodeName && nodes[i].nodeName === 'LI') ? nodes[i] : wysihtml5.dom.getParentElement(nodes[i], { query: 'li'}, false, this.contain); + curEl = (nodes[i].nodeName && nodes[i].nodeName === 'LI') ? nodes[i] : wysihtml.dom.getParentElement(nodes[i], { query: 'li'}, false, this.contain); if (curEl) { parents.push(curEl); } @@ -571,16 +571,16 @@ startNode = getRangeNode(range.startContainer, range.startOffset); if (startNode) { - if (startNode.nodeType === wysihtml5.TEXT_NODE) { + if (startNode.nodeType === wysihtml.TEXT_NODE) { if (!startNode.parentNode) { return false; } - if (!this.isCollapsed() || (startNode.parentNode.firstChild !== startNode && !wysihtml5.dom.domNode(startNode.previousSibling).is.block())) { + if (!this.isCollapsed() || (startNode.parentNode.firstChild !== startNode && !wysihtml.dom.domNode(startNode.previousSibling).is.block())) { return false; } var ws = this.win.getComputedStyle(startNode.parentNode).whiteSpace; return (ws === "pre" || ws === "pre-wrap") ? range.startOffset === 0 : (/^\s*$/).test(startNode.data.substr(0,range.startOffset)); - } else if (includeLineBreaks && wysihtml5.dom.domNode(startNode).is.lineBreak()) { + } else if (includeLineBreaks && wysihtml.dom.domNode(startNode).is.lineBreak()) { return true; } else { r.selectNodeContents(this.getRange().commonAncestorContainer); @@ -595,7 +595,7 @@ node = selection.anchorNode, offset = selection.anchorOffset; if (ofNode && node) { - return (offset === 0 && (node.nodeName && node.nodeName === ofNode.toUpperCase() || wysihtml5.dom.getParentElement(node.parentNode, { query: ofNode }, 1))); + return (offset === 0 && (node.nodeName && node.nodeName === ofNode.toUpperCase() || wysihtml.dom.getParentElement(node.parentNode, { query: ofNode }, 1))); } else if (node) { return (offset === 0 && !this.getPreviousNode(node, true)); } @@ -615,7 +615,7 @@ } // Escape temproray helper nodes if selection in them - inTmpCaret = wysihtml5.dom.getParentElement(startNode, { query: '._wysihtml5-temp-caret-fix' }, 1); + inTmpCaret = wysihtml.dom.getParentElement(startNode, { query: '._wysihtml5-temp-caret-fix' }, 1); if (inTmpCaret) { startNode = inTmpCaret.parentNode; startOffset = Array.prototype.indexOf.call(startNode.childNodes, inTmpCaret); @@ -651,10 +651,10 @@ prevLeaf = null; if(prevNode) { - if (prevNode.nodeType === 1 && wysihtml5.dom.hasClass(prevNode, this.unselectableClass)) { + if (prevNode.nodeType === 1 && wysihtml.dom.hasClass(prevNode, this.unselectableClass)) { prevLeaf = prevNode; } else { - prevLeaf = wysihtml5.dom.domNode(prevNode).lastLeafNode(); + prevLeaf = wysihtml.dom.domNode(prevNode).lastLeafNode(); } } @@ -700,7 +700,7 @@ oldScrollTop = restoreScrollPosition && body.scrollTop, oldScrollLeft = restoreScrollPosition && body.scrollLeft, className = "_wysihtml5-temp-placeholder", - placeholderHtml = '' + wysihtml5.INVISIBLE_SPACE + '', + placeholderHtml = '' + wysihtml.INVISIBLE_SPACE + '', range = this.getRange(true), caretPlaceholder, newCaretPlaceholder, @@ -749,7 +749,7 @@ newRange.setStartBefore(nextSibling); newRange.setEndAfter(prevSibling); } else { - newCaretPlaceholder = this.doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + newCaretPlaceholder = this.doc.createTextNode(wysihtml.INVISIBLE_SPACE); dom.insert(newCaretPlaceholder).after(caretPlaceholder[0]); newRange.setStartBefore(newCaretPlaceholder); newRange.setEndAfter(newCaretPlaceholder); @@ -863,7 +863,7 @@ // Empty elements are cleaned up from extracted content for (var i = childNodes.length; i --;) { - if (!wysihtml5.dom.domNode(childNodes[i]).is.visible()) { + if (!wysihtml.dom.domNode(childNodes[i]).is.visible()) { contentAfterRangeStart.removeChild(childNodes[i]); } } @@ -887,8 +887,8 @@ range.setEndAfter(element); } - if (!wysihtml5.dom.domNode(element).is.visible()) { - if (wysihtml5.dom.getTextContent(element) === '') { + if (!wysihtml.dom.domNode(element).is.visible()) { + if (wysihtml.dom.getTextContent(element) === '') { element.parentNode.removeChild(element); } else { element.parentNode.replaceChild(this.doc.createTextNode(" "), element); @@ -947,7 +947,7 @@ tempElement = doc._wysihtml5ScrollIntoViewElement = doc._wysihtml5ScrollIntoViewElement || (function() { var element = doc.createElement("span"); // The element needs content in order to be able to calculate it's position properly - element.innerHTML = wysihtml5.INVISIBLE_SPACE; + element.innerHTML = wysihtml.INVISIBLE_SPACE; return element; })(), offsetTop; @@ -967,7 +967,7 @@ */ selectLine: function() { var r = rangy.createRange(); - if (wysihtml5.browser.supportsSelectionModify()) { + if (wysihtml.browser.supportsSelectionModify()) { this._selectLine_W3C(); } else if (r.nativeRange && r.nativeRange.getBoundingClientRect) { // For IE Edge as it ditched the old api and did not fully implement the new one (as expected) @@ -1025,7 +1025,7 @@ // collapses selection to current line beginning or end toLineBoundary: function (location, collapse) { collapse = (typeof collapse === 'undefined') ? false : collapse; - if (wysihtml5.browser.supportsSelectionModify()) { + if (wysihtml.browser.supportsSelectionModify()) { var selection = this.win.getSelection(); selection.modify("extend", location, "lineboundary"); @@ -1073,7 +1073,7 @@ amount, testRect, found, that = this, isLineBreakingElement = function(el) { - return el && el.nodeType === 1 && (that.win.getComputedStyle(el).display === "block" || wysihtml5.lang.array(['BR', 'HR']).contains(el.nodeName)); + return el && el.nodeType === 1 && (that.win.getComputedStyle(el).display === "block" || wysihtml.lang.array(['BR', 'HR']).contains(el.nodeName)); }, prevNode = function(node) { var pnode = node; @@ -1109,7 +1109,7 @@ } } if (!r.collapsed) { - r.insertNode(this.doc.createTextNode(wysihtml5.INVISIBLE_SPACE)); + r.insertNode(this.doc.createTextNode(wysihtml.INVISIBLE_SPACE)); } // Is probably just empty line as can not be expanded @@ -1238,7 +1238,7 @@ var allUneditables = dom.query(this.contain, '.' + this.unselectableClass), deepUneditables = dom.query(allUneditables, '.' + this.unselectableClass); - return wysihtml5.lang.array(allUneditables).without(deepUneditables); + return wysihtml.lang.array(allUneditables).without(deepUneditables); }, // Returns an array of ranges that belong only to this editable @@ -1320,7 +1320,7 @@ return !s || (s.nativeSelection && s.nativeSelection.type && (s.nativeSelection.type === "Caret" || s.nativeSelection.type === "None")); } - wysihtml5.dom.removeInvisibleSpaces(this.composer.element); + wysihtml.dom.removeInvisibleSpaces(this.composer.element); doSelect(); if (this.composer.element.firstChild && notSelected()) { @@ -1368,39 +1368,39 @@ endNode = range.endContainer; - if (parentElement.nodeType === wysihtml5.TEXT_NODE) { + if (parentElement.nodeType === wysihtml.TEXT_NODE) { parentElement = parentElement.parentNode; } - if (startNode.nodeType === wysihtml5.TEXT_NODE && !(/^\s*$/).test(startNode.data.substr(range.startOffset))) { + if (startNode.nodeType === wysihtml.TEXT_NODE && !(/^\s*$/).test(startNode.data.substr(range.startOffset))) { return false; } - if (endNode.nodeType === wysihtml5.TEXT_NODE && !(/^\s*$/).test(endNode.data.substr(range.endOffset))) { + if (endNode.nodeType === wysihtml.TEXT_NODE && !(/^\s*$/).test(endNode.data.substr(range.endOffset))) { return false; } while (startNode && startNode !== parentElement) { - if (startNode.nodeType !== wysihtml5.TEXT_NODE && !wysihtml5.dom.contains(parentElement, startNode)) { + if (startNode.nodeType !== wysihtml.TEXT_NODE && !wysihtml.dom.contains(parentElement, startNode)) { return false; } - if (wysihtml5.dom.domNode(startNode).prev({ignoreBlankTexts: true})) { + if (wysihtml.dom.domNode(startNode).prev({ignoreBlankTexts: true})) { return false; } startNode = startNode.parentNode; } while (endNode && endNode !== parentElement) { - if (endNode.nodeType !== wysihtml5.TEXT_NODE && !wysihtml5.dom.contains(parentElement, endNode)) { + if (endNode.nodeType !== wysihtml.TEXT_NODE && !wysihtml.dom.contains(parentElement, endNode)) { return false; } - if (wysihtml5.dom.domNode(endNode).next({ignoreBlankTexts: true})) { + if (wysihtml.dom.domNode(endNode).next({ignoreBlankTexts: true})) { return false; } endNode = endNode.parentNode; } - return (wysihtml5.lang.array(nodeNames).contains(parentElement.nodeName)) ? parentElement : false; + return (wysihtml.lang.array(nodeNames).contains(parentElement.nodeName)) ? parentElement : false; }, isInThisEditable: function() { @@ -1418,8 +1418,8 @@ } return anode && fnode && - (wysihtml5.dom.contains(this.composer.element, fnode) || this.composer.element === fnode) && - (wysihtml5.dom.contains(this.composer.element, anode) || this.composer.element === anode); + (wysihtml.dom.contains(this.composer.element, fnode) || this.composer.element === fnode) && + (wysihtml.dom.contains(this.composer.element, anode) || this.composer.element === anode); }, deselect: function() { @@ -1428,4 +1428,4 @@ } }); -})(wysihtml5); +})(wysihtml); diff --git a/src/toolbar/dialog.js b/src/toolbar/dialog.js index 00f4020..67491eb 100644 --- a/src/toolbar/dialog.js +++ b/src/toolbar/dialog.js @@ -19,7 +19,7 @@ * * * */ -(function(wysihtml5) { - var dom = wysihtml5.dom, +(function(wysihtml) { + var dom = wysihtml.dom, CLASS_NAME_OPENED = "wysihtml5-command-dialog-opened", SELECTOR_FORM_ELEMENTS = "input, select, textarea", SELECTOR_FIELDS = "[data-wysihtml5-dialog-field]", ATTRIBUTE_FIELDS = "data-wysihtml5-dialog-field"; - wysihtml5.toolbar.Dialog = wysihtml5.lang.Dispatcher.extend( - /** @scope wysihtml5.toolbar.Dialog.prototype */ { + wysihtml.toolbar.Dialog = wysihtml.lang.Dispatcher.extend( + /** @scope wysihtml.toolbar.Dialog.prototype */ { constructor: function(link, container) { this.link = link; this.container = container; @@ -65,10 +65,10 @@ dom.observe(this.container, "keydown", function(event) { var keyCode = event.keyCode; - if (keyCode === wysihtml5.ENTER_KEY) { + if (keyCode === wysihtml.ENTER_KEY) { callbackWrapper(event); } - if (keyCode === wysihtml5.ESCAPE_KEY) { + if (keyCode === wysihtml.ESCAPE_KEY) { that.cancel(); } }); @@ -192,4 +192,4 @@ this.fire("cancel"); } }); -})(wysihtml5); //jshint ignore:line +})(wysihtml); //jshint ignore:line diff --git a/src/toolbar/dialog_bgColorStyle.js b/src/toolbar/dialog_bgColorStyle.js index e5e099e..8f787e0 100644 --- a/src/toolbar/dialog_bgColorStyle.js +++ b/src/toolbar/dialog_bgColorStyle.js @@ -1,9 +1,9 @@ -(function(wysihtml5) { - var dom = wysihtml5.dom, +(function(wysihtml) { + var dom = wysihtml.dom, SELECTOR_FIELDS = "[data-wysihtml5-dialog-field]", ATTRIBUTE_FIELDS = "data-wysihtml5-dialog-field"; - wysihtml5.toolbar.Dialog_bgColorStyle = wysihtml5.toolbar.Dialog.extend({ + wysihtml.toolbar.Dialog_bgColorStyle = wysihtml.toolbar.Dialog.extend({ multiselect: true, _serialize: function() { @@ -26,9 +26,9 @@ fields = this.container.querySelectorAll(SELECTOR_FIELDS), length = fields.length, i = 0, - firstElement = (this.elementToChange) ? ((wysihtml5.lang.object(this.elementToChange).isArray()) ? this.elementToChange[0] : this.elementToChange) : null, + firstElement = (this.elementToChange) ? ((wysihtml.lang.object(this.elementToChange).isArray()) ? this.elementToChange[0] : this.elementToChange) : null, colorStr = (firstElement) ? firstElement.getAttribute('style') : null, - color = (colorStr) ? wysihtml5.quirks.styleParser.parseColor(colorStr, "background-color") : null; + color = (colorStr) ? wysihtml.quirks.styleParser.parseColor(colorStr, "background-color") : null; for (; i * * */ -(function(wysihtml5) { +(function(wysihtml) { var CLASS_NAME_COMMAND_DISABLED = "wysihtml5-command-disabled", CLASS_NAME_COMMANDS_DISABLED = "wysihtml5-commands-disabled", CLASS_NAME_COMMAND_ACTIVE = "wysihtml5-command-active", CLASS_NAME_ACTION_ACTIVE = "wysihtml5-action-active", - dom = wysihtml5.dom; + dom = wysihtml.dom; - wysihtml5.toolbar.Toolbar = Base.extend( - /** @scope wysihtml5.toolbar.Toolbar.prototype */ { + wysihtml.toolbar.Toolbar = Base.extend( + /** @scope wysihtml.toolbar.Toolbar.prototype */ { constructor: function(editor, container, showOnInit) { this.editor = editor; this.container = typeof(container) === "string" ? document.getElementById(container) : container; @@ -51,12 +51,12 @@ length = speechInputLinks.length, i = 0; for (; i element or wrap current selection in
    * toolbar.execCommand("formatBlock", "blockquote"); */ @@ -224,7 +224,7 @@ }); this._ownerDocumentClick = function(event) { - if (!wysihtml5.dom.contains(that.container, event.target) && !wysihtml5.dom.contains(that.composer.element, event.target)) { + if (!wysihtml.dom.contains(that.container, event.target) && !wysihtml.dom.contains(that.composer.element, event.target)) { that._updateLinkStates(); that._preventInstantFocus(); } @@ -380,11 +380,11 @@ // to avoid showing a dialog for multiple selected elements which may have different attributes // eg. when two links with different href are selected, the state will be an array consisting of both link elements // but the dialog interface can only update one - if (!command.dialog.multiselect && wysihtml5.lang.object(state).isArray()) { + if (!command.dialog.multiselect && wysihtml.lang.object(state).isArray()) { state = state.length === 1 ? state[0] : true; } return state; } -})(wysihtml5); +})(wysihtml); diff --git a/src/undo_manager.js b/src/undo_manager.js index baf622c..825f465 100644 --- a/src/undo_manager.js +++ b/src/undo_manager.js @@ -2,7 +2,7 @@ * Undo Manager for wysihtml5 * slightly inspired by http://rniwa.com/editing/undomanager.html#the-undomanager-interface */ -(function(wysihtml5) { +(function(wysihtml) { var Z_KEY = 90, Y_KEY = 89, BACKSPACE_KEY = 8, @@ -10,9 +10,9 @@ MAX_HISTORY_ENTRIES = 25, DATA_ATTR_NODE = "data-wysihtml5-selection-node", DATA_ATTR_OFFSET = "data-wysihtml5-selection-offset", - UNDO_HTML = '' + wysihtml5.INVISIBLE_SPACE + '', - REDO_HTML = '' + wysihtml5.INVISIBLE_SPACE + '', - dom = wysihtml5.dom; + UNDO_HTML = '' + wysihtml.INVISIBLE_SPACE + '', + REDO_HTML = '' + wysihtml.INVISIBLE_SPACE + '', + dom = wysihtml.dom; function cleanTempElements(doc) { var tempElement; @@ -21,8 +21,8 @@ } } - wysihtml5.UndoManager = wysihtml5.lang.Dispatcher.extend( - /** @scope wysihtml5.UndoManager.prototype */ { + wysihtml.UndoManager = wysihtml.lang.Dispatcher.extend( + /** @scope wysihtml.UndoManager.prototype */ { constructor: function(editor) { this.editor = editor; this.composer = editor.composer; @@ -110,7 +110,7 @@ node = (range && range.startContainer) ? range.startContainer : this.element; offset = (range && range.startOffset) ? range.startOffset : 0; - if (node.nodeType === wysihtml5.ELEMENT_NODE) { + if (node.nodeType === wysihtml.ELEMENT_NODE) { element = node; } else { element = node.parentNode; @@ -212,4 +212,4 @@ return parent.childNodes[index]; } }); -})(wysihtml5); +})(wysihtml); diff --git a/src/views/composer.js b/src/views/composer.js index 59abc05..db48454 100644 --- a/src/views/composer.js +++ b/src/views/composer.js @@ -1,9 +1,9 @@ -(function(wysihtml5) { - var dom = wysihtml5.dom, - browser = wysihtml5.browser; +(function(wysihtml) { + var dom = wysihtml.dom, + browser = wysihtml.browser; - wysihtml5.views.Composer = wysihtml5.views.View.extend( - /** @scope wysihtml5.views.Composer.prototype */ { + wysihtml.views.Composer = wysihtml.views.View.extend( + /** @scope wysihtml.views.Composer.prototype */ { name: "composer", constructor: function(parent, editableElement, config) { @@ -25,7 +25,7 @@ }, getValue: function(parse, clearInternals) { - var value = this.isEmpty() ? "" : wysihtml5.quirks.getCorrectInnerHTML(this.element); + var value = this.isEmpty() ? "" : wysihtml.quirks.getCorrectInnerHTML(this.element); if (parse !== false) { value = this.parent.parse(value, (clearInternals === false) ? false : true); } @@ -87,7 +87,7 @@ // IE 8 fires the focus event after .focus() // This is needed by our simulate_placeholder.js to work // therefore we clear it ourselves this time - if (wysihtml5.browser.doesAsyncFocus() && this.hasPlaceholderSet()) { + if (wysihtml.browser.doesAsyncFocus() && this.hasPlaceholderSet()) { this.clear(); } @@ -207,10 +207,10 @@ } // Make sure our selection handler is ready - this.selection = new wysihtml5.Selection(this.parent, this.element, this.config.classNames.uneditableContainer); + this.selection = new wysihtml.Selection(this.parent, this.element, this.config.classNames.uneditableContainer); // Make sure commands dispatcher is ready - this.commands = new wysihtml5.Commands(this.parent); + this.commands = new wysihtml.Commands(this.parent); if (!this.config.noTextarea) { dom.copyAttributes([ @@ -264,7 +264,7 @@ // IE sometimes leaves a single paragraph, which can't be removed by the user if (!browser.clearsContentEditableCorrectly()) { - wysihtml5.quirks.ensureProperClearing(this); + wysihtml.quirks.ensureProperClearing(this); } // Set up a sync that makes sure that textarea and editor have the same content @@ -302,7 +302,7 @@ isInUneditable = false; for (var i = uneditables.length; i--;) { - if (wysihtml5.dom.contains(uneditables[i], nodeWithSelection)) { + if (wysihtml.dom.contains(uneditables[i], nodeWithSelection)) { isInUneditable = true; } } @@ -325,7 +325,7 @@ // The autoLink helper method reveals a reg exp to detect correct urls urlRegExp = dom.autoLink.URL_REG_EXP, getTextContent = function(element) { - var textContent = wysihtml5.lang.string(dom.getTextContent(element)).trim(); + var textContent = wysihtml.lang.string(dom.getTextContent(element)).trim(); if (textContent.substr(0, 4) === "www.") { textContent = "http://" + textContent; } @@ -392,13 +392,13 @@ } // After resizing IE sometimes forgets to remove the old resize handles - wysihtml5.quirks.redraw(element); + wysihtml.quirks.redraw(element); }); } }, _initUndoManager: function() { - this.undoManager = new wysihtml5.UndoManager(this.parent); + this.undoManager = new wysihtml.UndoManager(this.parent); }, _initLineBreaking: function() { @@ -448,7 +448,7 @@ return; } - if (keyCode !== wysihtml5.ENTER_KEY && keyCode !== wysihtml5.BACKSPACE_KEY) { + if (keyCode !== wysihtml.ENTER_KEY && keyCode !== wysihtml.BACKSPACE_KEY) { return; } var blockElement = dom.getParentElement(that.selection.getSelectedNode(), { query: USE_NATIVE_LINE_BREAK_INSIDE_TAGS }, 4); @@ -470,17 +470,17 @@ } } - if (keyCode === wysihtml5.ENTER_KEY && blockElement.nodeName.match(/^H[1-6]$/)) { + if (keyCode === wysihtml.ENTER_KEY && blockElement.nodeName.match(/^H[1-6]$/)) { adjust(selectedNode); } }, 0); return; } - if (that.config.useLineBreaks && keyCode === wysihtml5.ENTER_KEY && !wysihtml5.browser.insertsLineBreaksOnReturn()) { + if (that.config.useLineBreaks && keyCode === wysihtml.ENTER_KEY && !wysihtml.browser.insertsLineBreaksOnReturn()) { event.preventDefault(); that.commands.exec("insertLineBreak"); } }); } }); -})(wysihtml5); +})(wysihtml); diff --git a/src/views/composer.observe.js b/src/views/composer.observe.js index 869368d..612c7f7 100644 --- a/src/views/composer.observe.js +++ b/src/views/composer.observe.js @@ -6,10 +6,10 @@ * - Dispatch proprietary newword:composer event * - Keyboard shortcuts */ -(function(wysihtml5) { - var dom = wysihtml5.dom, +(function(wysihtml) { + var dom = wysihtml.dom, domNode = dom.domNode, - browser = wysihtml5.browser, + browser = wysihtml.browser, /** * Map keyCodes to query commands */ @@ -22,7 +22,7 @@ var actions = { // Adds multiple eventlisteners to target, bound to one callback - // TODO: If needed elsewhere make it part of wysihtml5.dom or sth + // TODO: If needed elsewhere make it part of wysihtml.dom or sth addListeners: function (target, events, callback) { for(var i = 0, max = events.length; i < max; i++) { target.addEventListener(events[i], callback, false); @@ -30,7 +30,7 @@ }, // Removes multiple eventlisteners from target, bound to one callback - // TODO: If needed elsewhere make it part of wysihtml5.dom or sth + // TODO: If needed elsewhere make it part of wysihtml.dom or sth removeListeners: function (target, events, callback) { for(var i = 0, max = events.length; i < max; i++) { target.removeEventListener(events[i], callback, false); @@ -42,7 +42,7 @@ if (composer.selection.caretIsLastInSelection()) { var sel = composer.selection.getSelection(), aNode = sel.anchorNode; - if (aNode && aNode.nodeType === 1 && (wysihtml5.dom.getParentElement(aNode, {query: 'td, th'}, false, composer.element) || force)) { + if (aNode && aNode.nodeType === 1 && (wysihtml.dom.getParentElement(aNode, {query: 'td, th'}, false, composer.element) || force)) { var nextNode = aNode.childNodes[sel.anchorOffset]; if (nextNode && nextNode.nodeType === 1 & nextNode.nodeName === "BR") { nextNode.parentNode.removeChild(nextNode); @@ -76,9 +76,9 @@ var selection = composer.selection, prevNode = selection.getPreviousNode(); - if (selection.caretIsFirstInSelection(wysihtml5.browser.usesControlRanges()) && prevNode) { + if (selection.caretIsFirstInSelection(wysihtml.browser.usesControlRanges()) && prevNode) { if (prevNode.nodeType === 1 && - wysihtml5.dom.domNode(prevNode).is.block() && + wysihtml.dom.domNode(prevNode).is.block() && !domNode(prevNode).test({ query: "ol, ul, table, tr, dl" }) @@ -92,7 +92,7 @@ var selNode = prevNode.lastChild, selectedNode = selection.getSelectedNode(), commonAncestorNode = domNode(prevNode).commonAncestor(selectedNode, composer.element), - curNode = wysihtml5.dom.getParentElement(selectedNode, { + curNode = wysihtml.dom.getParentElement(selectedNode, { query: "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote" }, false, commonAncestorNode || composer.element); @@ -100,7 +100,7 @@ domNode(curNode).transferContentTo(prevNode, true); selection.setAfter(selNode); return true; - } else if (wysihtml5.browser.usesControlRanges()) { + } else if (wysihtml.browser.usesControlRanges()) { selectedNode = selection.getCaretNode(); domNode(selectedNode).transferContentTo(prevNode, true); selection.setAfter(selNode); @@ -116,7 +116,7 @@ /* In IE when deleting with caret at the begining of LI, list gets broken into half instead of merging the LI with previous */ /* This does not match other browsers an is less intuitive from UI standpoint, thus has to be fixed */ fixDeleteInTheBeginningOfLi: function(composer) { - if (wysihtml5.browser.hasLiDeletingProblem()) { + if (wysihtml.browser.hasLiDeletingProblem()) { var selection = composer.selection.getSelection(), aNode = selection.anchorNode, listNode, prevNode, firstNode, @@ -190,8 +190,8 @@ }).bind(this); if( this.doc.execCommand && - wysihtml5.browser.supportsCommand(this.doc, "enableObjectResizing") && - wysihtml5.browser.supportsCommand(this.doc, "enableInlineTableEditing")) + wysihtml.browser.supportsCommand(this.doc, "enableObjectResizing") && + wysihtml.browser.supportsCommand(this.doc, "enableInlineTableEditing")) { if (this.sandbox.getIframe) { actions.addListeners(this.sandbox.getIframe(), ["focus", "mouseup", "mouseover"], iframeInitiator); @@ -199,7 +199,7 @@ window.addEventListener('load', hideHandlers); } } - this.tableSelection = wysihtml5.quirks.tableCellsSelection(this.element, this.parent); + this.tableSelection = wysihtml.quirks.tableCellsSelection(this.element, this.parent); }, // Fixes some misbehaviours of enters in linebreaks mode (natively a bit unsupported feature) @@ -247,7 +247,7 @@ composer.selection.setBefore(brNode); } - } else if (caretInfo.caretNode.nodeType === 3 && wysihtml5.browser.hasCaretBlockElementIssue() && caretInfo.textOffset === caretInfo.caretNode.data.length && !caretInfo.nextNode) { + } else if (caretInfo.caretNode.nodeType === 3 && wysihtml.browser.hasCaretBlockElementIssue() && caretInfo.textOffset === caretInfo.caretNode.data.length && !caretInfo.nextNode) { // This fixes annoying webkit issue when you press enter at the end of a block then seemingly nothing happens. // in reality one line break is generated and cursor is reported after it, but when entering something cursor jumps before the br @@ -296,7 +296,7 @@ event.preventDefault(); return; } - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { if (actions.fixDeleteInTheBeginningOfControlSelection(composer)) { event.preventDefault(); return; @@ -390,7 +390,7 @@ if (this.config.copyedFromMarking) { // If supported the copied source can be based directly on selection // Very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection. - if (wysihtml5.browser.supportsModernPaste()) { + if (wysihtml.browser.supportsModernPaste()) { event.clipboardData.setData("text/html", this.config.copyedFromMarking + this.selection.getHtml()); event.clipboardData.setData("text/plain", this.selection.getPlainText()); event.preventDefault(); @@ -401,7 +401,7 @@ var handleKeyUp = function(event) { var keyCode = event.keyCode; - if (keyCode === wysihtml5.SPACE_KEY || keyCode === wysihtml5.ENTER_KEY) { + if (keyCode === wysihtml.SPACE_KEY || keyCode === wysihtml.ENTER_KEY) { this.parent.fire("newword:composer"); } }; @@ -412,15 +412,15 @@ var target = event.target, allImages = this.element.querySelectorAll('img'), notMyImages = this.element.querySelectorAll('.' + this.config.classNames.uneditableContainer + ' img'), - myImages = wysihtml5.lang.array(allImages).without(notMyImages); + myImages = wysihtml.lang.array(allImages).without(notMyImages); - if (target.nodeName === "IMG" && wysihtml5.lang.array(myImages).contains(target)) { + if (target.nodeName === "IMG" && wysihtml.lang.array(myImages).contains(target)) { this.selection.selectNode(target); } } // Saves mousedown position for IE controlSelect fix - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { this.selection.lastMouseDownPos = {x: event.clientX, y: event.clientY}; setTimeout(function() { delete this.selection.lastMouseDownPos; @@ -448,7 +448,7 @@ if (this.config.classNames.uneditableContainer) { // If uneditables is configured, makes clicking on uneditable move caret after clicked element (so it can be deleted like text) // If uneditable needs text selection itself event.stopPropagation can be used to prevent this behaviour - var uneditable = wysihtml5.dom.getParentElement(event.target, { query: "." + this.config.classNames.uneditableContainer }, false, this.element); + var uneditable = wysihtml.dom.getParentElement(event.target, { query: "." + this.config.classNames.uneditableContainer }, false, this.element); if (uneditable) { this.selection.setAfter(uneditable); } @@ -482,13 +482,13 @@ event.preventDefault(); } - if (keyCode === wysihtml5.BACKSPACE_KEY) { + if (keyCode === wysihtml.BACKSPACE_KEY) { // Delete key override for special cases handleDeleteKeyPress(event, this); } // Make sure that when pressing backspace/delete on selected images deletes the image and it's anchor - if (keyCode === wysihtml5.BACKSPACE_KEY || keyCode === wysihtml5.DELETE_KEY) { + if (keyCode === wysihtml.BACKSPACE_KEY || keyCode === wysihtml.DELETE_KEY) { target = this.selection.getSelectedNode(true); if (target && target.nodeName === "IMG") { event.preventDefault(); @@ -499,18 +499,18 @@ parent.parentNode.removeChild(parent); } setTimeout((function() { - wysihtml5.quirks.redraw(this.element); + wysihtml.quirks.redraw(this.element); }).bind(this), 0); } } - if (this.config.handleTabKey && keyCode === wysihtml5.TAB_KEY) { + if (this.config.handleTabKey && keyCode === wysihtml.TAB_KEY) { // TAB key handling event.preventDefault(); handleTabKeyDown(this, this.element, event.shiftKey); } - if (keyCode === wysihtml5.ENTER_KEY) { + if (keyCode === wysihtml.ENTER_KEY) { handleEnterKeyPress(event, this); } @@ -531,9 +531,9 @@ }; // Testing requires actions to be accessible from out of scope - wysihtml5.views.Composer.prototype.observeActions = actions; + wysihtml.views.Composer.prototype.observeActions = actions; - wysihtml5.views.Composer.prototype.observe = function() { + wysihtml.views.Composer.prototype.observe = function() { var that = this, container = (this.sandbox.getIframe) ? this.sandbox.getIframe() : this.sandbox.getContentEditable(), element = this.element, @@ -573,7 +573,7 @@ this.element.addEventListener("keydown", handleKeyDown.bind(this), false); // IE controlselect madness fix - if (wysihtml5.browser.usesControlRanges()) { + if (wysihtml.browser.usesControlRanges()) { this.element.addEventListener('mscontrolselect', handleIEControlSelect.bind(this), false); } @@ -582,4 +582,4 @@ }).bind(this), false); }; -})(wysihtml5); +})(wysihtml); diff --git a/src/views/composer.style.js b/src/views/composer.style.js index 60d53b9..d9c91c1 100644 --- a/src/views/composer.style.js +++ b/src/views/composer.style.js @@ -1,5 +1,5 @@ -(function(wysihtml5) { - var dom = wysihtml5.dom, +(function(wysihtml) { + var dom = wysihtml.dom, doc = document, win = window, HOST_TEMPLATE = doc.createElement("div"), @@ -43,7 +43,7 @@ "body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }", "body > p:first-child { margin-top: 0; }", "._wysihtml5-temp { display: none; }", - wysihtml5.browser.isGecko ? + wysihtml.browser.isGecko ? "body.placeholder { color: graytext !important; }" : "body.placeholder { color: #a9a9a9 !important; }", // Ensure that user see's broken images and can delete them @@ -96,7 +96,7 @@ }; - wysihtml5.views.Composer.prototype.style = function() { + wysihtml.views.Composer.prototype.style = function() { var that = this, originalActiveElement = doc.querySelector(":focus"), textareaElement = this.textarea.element, @@ -161,7 +161,7 @@ // Make sure that we don't change the display style of the iframe when copying styles oblur/onfocus // this is needed for when the change_view event is fired where the iframe is hidden and then // the blur event fires and re-displays it - var boxFormattingStyles = wysihtml5.lang.array(BOX_FORMATTING).without(["display"]); + var boxFormattingStyles = wysihtml.lang.array(BOX_FORMATTING).without(["display"]); // --------- restore focus --------- if (originalActiveElement) { @@ -198,4 +198,4 @@ return this; }; -})(wysihtml5); +})(wysihtml); diff --git a/src/views/sourceview.js b/src/views/sourceview.js index 1f16827..a2ae08c 100644 --- a/src/views/sourceview.js +++ b/src/views/sourceview.js @@ -1,7 +1,7 @@ -(function(wysihtml5) { +(function(wysihtml) { - wysihtml5.views.SourceView = Base.extend( - /** @scope wysihtml5.views.SourceView.prototype */ { + wysihtml.views.SourceView = Base.extend( + /** @scope wysihtml.views.SourceView.prototype */ { constructor: function(editor, composer) { this.editor = editor; @@ -52,4 +52,4 @@ }); -})(wysihtml5); +})(wysihtml); diff --git a/src/views/synchronizer.js b/src/views/synchronizer.js index d8d86f0..5256a6e 100644 --- a/src/views/synchronizer.js +++ b/src/views/synchronizer.js @@ -1,11 +1,11 @@ /** * Class that takes care that the value of the composer and the textarea is always in sync */ -(function(wysihtml5) { +(function(wysihtml) { var INTERVAL = 400; - wysihtml5.views.Synchronizer = Base.extend( - /** @scope wysihtml5.views.Synchronizer.prototype */ { + wysihtml.views.Synchronizer = Base.extend( + /** @scope wysihtml.views.Synchronizer.prototype */ { constructor: function(editor, textarea, composer) { this.editor = editor; @@ -21,7 +21,7 @@ * @param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the textarea */ fromComposerToTextarea: function(shouldParseHtml) { - this.textarea.setValue(wysihtml5.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml); + this.textarea.setValue(wysihtml.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml); }, /** @@ -73,10 +73,10 @@ if (form) { // If the textarea is in a form make sure that after onreset and onsubmit the composer // has the correct state - wysihtml5.dom.observe(form, "submit", function() { + wysihtml.dom.observe(form, "submit", function() { that.sync(true); }); - wysihtml5.dom.observe(form, "reset", function() { + wysihtml.dom.observe(form, "reset", function() { setTimeout(function() { that.fromTextareaToComposer(); }, 0); }); } @@ -94,4 +94,4 @@ this.editor.on("destroy:composer", stopInterval); } }); -})(wysihtml5); +})(wysihtml); diff --git a/src/views/textarea.js b/src/views/textarea.js index 328d4e2..65b9e1b 100644 --- a/src/views/textarea.js +++ b/src/views/textarea.js @@ -1,5 +1,5 @@ -wysihtml5.views.Textarea = wysihtml5.views.View.extend( - /** @scope wysihtml5.views.Textarea.prototype */ { +wysihtml.views.Textarea = wysihtml.views.View.extend( + /** @scope wysihtml.views.Textarea.prototype */ { name: "textarea", constructor: function(parent, textareaElement, config) { @@ -33,7 +33,7 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend( }, hasPlaceholderSet: function() { - var supportsPlaceholder = wysihtml5.browser.supportsPlaceholderAttributeOn(this.element), + var supportsPlaceholder = wysihtml.browser.supportsPlaceholderAttributeOn(this.element), placeholderText = this.element.getAttribute("placeholder") || null, value = this.element.value, isEmpty = !value; @@ -41,7 +41,7 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend( }, isEmpty: function() { - return !wysihtml5.lang.string(this.element.value).trim() || this.hasPlaceholderSet(); + return !wysihtml.lang.string(this.element.value).trim() || this.hasPlaceholderSet(); }, _observe: function() { @@ -55,15 +55,15 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend( * Calling focus() or blur() on an element doesn't synchronously trigger the attached focus/blur events * This is the case for focusin and focusout, so let's use them whenever possible, kkthxbai */ - events = wysihtml5.browser.supportsEvent("focusin") ? ["focusin", "focusout", "change"] : ["focus", "blur", "change"]; + events = wysihtml.browser.supportsEvent("focusin") ? ["focusin", "focusout", "change"] : ["focus", "blur", "change"]; parent.on("beforeload", function() { - wysihtml5.dom.observe(element, events, function(event) { + wysihtml.dom.observe(element, events, function(event) { var eventName = eventMapping[event.type] || event.type; parent.fire(eventName).fire(eventName + ":textarea"); }); - wysihtml5.dom.observe(element, ["paste", "drop"], function() { + wysihtml.dom.observe(element, ["paste", "drop"], function() { setTimeout(function() { parent.fire("paste").fire("paste:textarea"); }, 0); }); }); diff --git a/src/views/view.js b/src/views/view.js index e00a8e6..1595f44 100644 --- a/src/views/view.js +++ b/src/views/view.js @@ -1,8 +1,8 @@ /** * TODO: the following methods still need unit test coverage */ -wysihtml5.views.View = Base.extend( - /** @scope wysihtml5.views.View.prototype */ { +wysihtml.views.View = Base.extend( + /** @scope wysihtml.views.View.prototype */ { constructor: function(parent, textareaElement, config) { this.parent = parent; this.element = textareaElement; diff --git a/src/wysihtml5.js b/src/wysihtml.js similarity index 97% rename from src/wysihtml5.js rename to src/wysihtml.js index 29c0ea3..ba29740 100644 --- a/src/wysihtml5.js +++ b/src/wysihtml.js @@ -9,7 +9,7 @@ * Licensed under the MIT license (MIT) * */ -var wysihtml5 = { +var wysihtml = { version: "@VERSION", // namespaces diff --git a/test/browser_test.js b/test/browser_test.js index 0f55026..78c16e6 100644 --- a/test/browser_test.js +++ b/test/browser_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.browser", { +module("wysihtml.browser", { userAgents: { iPad_iOS3: "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10", iPhone_iOS3: "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3", @@ -14,14 +14,14 @@ module("wysihtml5.browser", { }, setup: function() { - this.originalUserAgent = wysihtml5.browser.USER_AGENT; + this.originalUserAgent = wysihtml.browser.USER_AGENT; this.originalExecCommand = document.execCommand; this.originalQuerySelector = document.querySelector; this.originalQuerySelectorAll = document.querySelectorAll; }, teardown: function() { - wysihtml5.browser.USER_AGENT = this.originalUserAgent; + wysihtml.browser.USER_AGENT = this.originalUserAgent; document.execCommand = this.originalExecCommand; document.querySelector = this.originalQuerySelector; document.querySelectorAll = this.originalQuerySelectorAll; @@ -32,54 +32,54 @@ module("wysihtml5.browser", { test("Check mobile contentEditable support", function() { document.querySelector = document.querySelectorAll = function() {}; - wysihtml5.browser.USER_AGENT = this.userAgents.iPad_iOS3; - ok(!wysihtml5.browser.supported(), "iPad iOS 3 is correctly unsupported"); + wysihtml.browser.USER_AGENT = this.userAgents.iPad_iOS3; + ok(!wysihtml.browser.supported(), "iPad iOS 3 is correctly unsupported"); - wysihtml5.browser.USER_AGENT = this.userAgents.iPhone_iOS3; - ok(!wysihtml5.browser.supported(), "iPhone iOS 3 is correctly unsupported"); + wysihtml.browser.USER_AGENT = this.userAgents.iPhone_iOS3; + ok(!wysihtml.browser.supported(), "iPhone iOS 3 is correctly unsupported"); - wysihtml5.browser.USER_AGENT = this.userAgents.iPad_iOS5; - ok(wysihtml5.browser.supported(), "iPad iOS 5 is correctly supported"); + wysihtml.browser.USER_AGENT = this.userAgents.iPad_iOS5; + ok(wysihtml.browser.supported(), "iPad iOS 5 is correctly supported"); - wysihtml5.browser.USER_AGENT = this.userAgents.Android2; - ok(!wysihtml5.browser.supported(), "Android 2 is correctly unsupported"); + wysihtml.browser.USER_AGENT = this.userAgents.Android2; + ok(!wysihtml.browser.supported(), "Android 2 is correctly unsupported"); - wysihtml5.browser.USER_AGENT = this.userAgents.Android4; - ok(wysihtml5.browser.supported(), "Android 4 is correctly supported"); + wysihtml.browser.USER_AGENT = this.userAgents.Android4; + ok(wysihtml.browser.supported(), "Android 4 is correctly supported"); - wysihtml5.browser.USER_AGENT = this.userAgents.OperaMobile; - ok(!wysihtml5.browser.supported(), "Opera Mobile is correctly unsupported"); + wysihtml.browser.USER_AGENT = this.userAgents.OperaMobile; + ok(!wysihtml.browser.supported(), "Opera Mobile is correctly unsupported"); }); test("Check with missing document.execCommand", function() { document.execCommand = null; // I've no idea why this test fails in Opera... (if you run the test alone, everything works) - ok(!wysihtml5.browser.supported(), "Missing document.execCommand causes editor to be unsupported"); + ok(!wysihtml.browser.supported(), "Missing document.execCommand causes editor to be unsupported"); }); test("Check IE support", function() { - wysihtml5.browser.USER_AGENT = this.userAgents.IE6; + wysihtml.browser.USER_AGENT = this.userAgents.IE6; document.querySelector = document.querySelectorAll = null; - ok(!wysihtml5.browser.supported(), "IE6 is correctly unsupported"); + ok(!wysihtml.browser.supported(), "IE6 is correctly unsupported"); - wysihtml5.browser.USER_AGENT = this.userAgents.IE7; + wysihtml.browser.USER_AGENT = this.userAgents.IE7; document.querySelector = document.querySelectorAll = null; - ok(!wysihtml5.browser.supported(), "IE7 is correctly unsupported"); + ok(!wysihtml.browser.supported(), "IE7 is correctly unsupported"); - wysihtml5.browser.USER_AGENT = this.userAgents.IE8; + wysihtml.browser.USER_AGENT = this.userAgents.IE8; document.querySelector = document.querySelectorAll = function() {}; - ok(wysihtml5.browser.supported(), "IE8 is correctly supported"); + ok(wysihtml.browser.supported(), "IE8 is correctly supported"); - wysihtml5.browser.USER_AGENT = this.userAgents.IE9; + wysihtml.browser.USER_AGENT = this.userAgents.IE9; document.querySelector = document.querySelectorAll = function() {}; - ok(wysihtml5.browser.supported(), "IE9 is correctly supported"); + ok(wysihtml.browser.supported(), "IE9 is correctly supported"); }); test("Check placeholder support", function() { var pseudoElement = document.createElement("div"); pseudoElement.placeholder = ""; - ok(wysihtml5.browser.supportsPlaceholderAttributeOn(pseudoElement)); + ok(wysihtml.browser.supportsPlaceholderAttributeOn(pseudoElement)); }); \ No newline at end of file diff --git a/test/commands/formatBlock_test.js b/test/commands/formatBlock_test.js index d97b215..1f0bad0 100644 --- a/test/commands/formatBlock_test.js +++ b/test/commands/formatBlock_test.js @@ -1,5 +1,5 @@ -if (wysihtml5.browser.supported()) { - module("wysihtml5.Editor.commands.formatBlock", { +if (wysihtml.browser.supported()) { + module("wysihtml.Editor.commands.formatBlock", { setup: function() { @@ -55,7 +55,7 @@ if (wysihtml5.browser.supported()) { br: true } }, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: parserRules }), text = "once upon a time
    there was an unformated text
    spanning many lines."; @@ -185,7 +185,7 @@ if (wysihtml5.browser.supported()) { li: true } }, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: parserRules }); @@ -246,7 +246,7 @@ if (wysihtml5.browser.supported()) { br: true } }, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: parserRules }); @@ -304,7 +304,7 @@ if (wysihtml5.browser.supported()) { br: true } }, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: parserRules }); @@ -325,7 +325,7 @@ if (wysihtml5.browser.supported()) { asyncTest("Create blockquote", function() { expect(4); var that = this, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: { tags: { h1: true, diff --git a/test/commands/formatInline_test.js b/test/commands/formatInline_test.js index ed1ef16..5dd8339 100644 --- a/test/commands/formatInline_test.js +++ b/test/commands/formatInline_test.js @@ -1,5 +1,5 @@ -if (wysihtml5.browser.supported()) { - module("wysihtml5.Editor.commands.formatInline", { +if (wysihtml.browser.supported()) { + module("wysihtml.Editor.commands.formatInline", { setup: function() { @@ -61,7 +61,7 @@ if (wysihtml5.browser.supported()) { strong: 1 } }, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: parserRules }); @@ -192,7 +192,7 @@ if (wysihtml5.browser.supported()) { b: true } }, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: parserRules }); @@ -276,7 +276,7 @@ if (wysihtml5.browser.supported()) { } } }, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: parserRules }); diff --git a/test/dom/auto_link_test.js b/test/dom/auto_link_test.js index 1448b3e..945d781 100644 --- a/test/dom/auto_link_test.js +++ b/test/dom/auto_link_test.js @@ -1,17 +1,17 @@ -module("wysihtml5.dom.autoLink", { +module("wysihtml.dom.autoLink", { equal: function(actual, expected, message) { return QUnit.assert.htmlEqual(actual, expected, message); }, autoLink: function(html) { - var container = wysihtml5.dom.getAsDom(html); - return wysihtml5.dom.autoLink(container).innerHTML; + var container = wysihtml.dom.getAsDom(html); + return wysihtml.dom.autoLink(container).innerHTML; } }); test("Basic test", function() { - ok(wysihtml5.dom.autoLink.URL_REG_EXP, "URL reg exp is revealed to be access globally"); + ok(wysihtml.dom.autoLink.URL_REG_EXP, "URL reg exp is revealed to be access globally"); this.equal( this.autoLink("hey check out this search engine http://www.google.com"), diff --git a/test/dom/compare_document_position_test.js b/test/dom/compare_document_position_test.js index d981c95..bc5c641 100644 --- a/test/dom/compare_document_position_test.js +++ b/test/dom/compare_document_position_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.compareDocumentPosition", { +module("wysihtml.dom.compareDocumentPosition", { setup: function() { this.container = document.createElement("div"); this.child1 = document.createElement("div"); @@ -15,7 +15,7 @@ module("wysihtml5.dom.compareDocumentPosition", { test("Basic test", function() { - strictEqual(wysihtml5.dom.compareDocumentPosition(this.container, this.child1), 20, 'compareDocumentPosition of nested element'); - strictEqual(wysihtml5.dom.compareDocumentPosition(this.child1, this.child2), 4, 'compareDocumentPosition of sibling element'); - strictEqual(wysihtml5.dom.compareDocumentPosition(this.child1, this.container), 10, 'compareDocumentPosition of parent element'); + strictEqual(wysihtml.dom.compareDocumentPosition(this.container, this.child1), 20, 'compareDocumentPosition of nested element'); + strictEqual(wysihtml.dom.compareDocumentPosition(this.child1, this.child2), 4, 'compareDocumentPosition of sibling element'); + strictEqual(wysihtml.dom.compareDocumentPosition(this.child1, this.container), 10, 'compareDocumentPosition of parent element'); }); diff --git a/test/dom/contains_test.js b/test/dom/contains_test.js index f7f730e..4a3f82d 100644 --- a/test/dom/contains_test.js +++ b/test/dom/contains_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.contains", { +module("wysihtml.dom.contains", { setup: function() { this.container = document.createElement("div"); this.textnode = document.createTextNode("TEST"); @@ -13,9 +13,9 @@ module("wysihtml5.dom.contains", { test("Basic test", function() { - ok(wysihtml5.dom.contains(document.documentElement, document.body)); - ok(wysihtml5.dom.contains(document.body, this.container)); - ok(wysihtml5.dom.contains(this.container, this.textnode)); - ok(!wysihtml5.dom.contains(this.container, document.body)); - ok(!wysihtml5.dom.contains(document.body, document.body)); + ok(wysihtml.dom.contains(document.documentElement, document.body)); + ok(wysihtml.dom.contains(document.body, this.container)); + ok(wysihtml.dom.contains(this.container, this.textnode)); + ok(!wysihtml.dom.contains(this.container, document.body)); + ok(!wysihtml.dom.contains(document.body, document.body)); }); diff --git a/test/dom/convert_to_list_test.js b/test/dom/convert_to_list_test.js index 6775d1a..a5181de 100644 --- a/test/dom/convert_to_list_test.js +++ b/test/dom/convert_to_list_test.js @@ -1,12 +1,12 @@ -module("wysihtml5.dom.convertToList", { +module("wysihtml.dom.convertToList", { equal: function(actual, expected, message) { return QUnit.assert.htmlEqual(actual, expected, message); }, convertToList: function(html, type) { - var container = wysihtml5.dom.getAsDom(html); + var container = wysihtml.dom.getAsDom(html); document.body.appendChild(container); - wysihtml5.dom.convertToList(container.firstChild, type); + wysihtml.dom.convertToList(container.firstChild, type); var innerHTML = container.innerHTML; container.parentNode.removeChild(container); return innerHTML; diff --git a/test/dom/copy_attributes_test.js b/test/dom/copy_attributes_test.js index 9a0465f..c3260f2 100644 --- a/test/dom/copy_attributes_test.js +++ b/test/dom/copy_attributes_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.copyAttributes", { +module("wysihtml.dom.copyAttributes", { setup: function() { this.div = document.createElement("div"); this.span = document.createElement("span"); @@ -17,8 +17,8 @@ module("wysihtml5.dom.copyAttributes", { test("Basic Tests", function() { var attributes = { title: "foobar", lang: "en", className: "foo bar" }; - wysihtml5.dom.setAttributes(attributes).on(this.div); - wysihtml5.dom.copyAttributes(["title", "lang", "className"]).from(this.div).to(this.span); + wysihtml.dom.setAttributes(attributes).on(this.div); + wysihtml.dom.copyAttributes(["title", "lang", "className"]).from(this.div).to(this.span); equal(this.span.title, attributes.title, "Title correctly copied"); equal(this.span.lang, attributes.lang, "Lang correctly copied"); @@ -39,7 +39,7 @@ asyncTest("Test copying attributes from one element to another element which is iframeDocument.body.appendChild(iframeElement); that.span.title = "heya!"; - wysihtml5.dom + wysihtml.dom .copyAttributes(["title"]) .from(that.span) .to(iframeElement); diff --git a/test/dom/copy_styles_test.js b/test/dom/copy_styles_test.js index 17e80c4..610e3da 100644 --- a/test/dom/copy_styles_test.js +++ b/test/dom/copy_styles_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.copyStyles", { +module("wysihtml.dom.copyStyles", { setup: function() { this.div = document.createElement("div"); this.span = document.createElement("span"); @@ -26,19 +26,19 @@ module("wysihtml5.dom.copyStyles", { test("Basic Tests", function() { this.div.style.cssText = "width: 400px; height: 200px; text-align: right; float: left;"; - wysihtml5.dom.copyStyles(["width", "height", "text-align", "float"]).from(this.div).to(this.span); + wysihtml.dom.copyStyles(["width", "height", "text-align", "float"]).from(this.div).to(this.span); - equal(wysihtml5.dom.getStyle("width") .from(this.span), "400px", "Width correctly copied"); - equal(wysihtml5.dom.getStyle("height") .from(this.span), "200px", "Height correctly copied"); - equal(wysihtml5.dom.getStyle("text-align") .from(this.span), "right", "Text-align correctly copied"); - equal(wysihtml5.dom.getStyle("float") .from(this.span), "left", "Float correctly copied"); + equal(wysihtml.dom.getStyle("width") .from(this.span), "400px", "Width correctly copied"); + equal(wysihtml.dom.getStyle("height") .from(this.span), "200px", "Height correctly copied"); + equal(wysihtml.dom.getStyle("text-align") .from(this.span), "right", "Text-align correctly copied"); + equal(wysihtml.dom.getStyle("float") .from(this.span), "left", "Float correctly copied"); }); test("Whether it copies native user agent styles", function() { - wysihtml5.dom.copyStyles(["display"]).from(this.span).to(this.div); + wysihtml.dom.copyStyles(["display"]).from(this.span).to(this.div); - equal(wysihtml5.dom.getStyle("display").from(this.div), "inline", "Display correctly copied"); + equal(wysihtml.dom.getStyle("display").from(this.div), "inline", "Display correctly copied"); }); @@ -46,7 +46,7 @@ test("Advanced tests", function() { this.span.style.cssText = "color: rgb(255, 0, 0); -moz-border-radius: 5px 5px 5px 5px;"; this.div.style.cssText = "color: rgb(0, 255, 0); text-decoration: underline;"; - wysihtml5.dom + wysihtml.dom .copyStyles(["color", "-moz-border-radius", "unknown-style"]) .from(this.span) .to(this.div) @@ -54,17 +54,17 @@ test("Advanced tests", function() { // Opera and IE internally convert color values either to rgb or hexcode, and some version of IE either // strip or add white spaces between rgb values - var divColor = wysihtml5.dom.getStyle("color").from(this.div).replace(/\s+/g, ""); + var divColor = wysihtml.dom.getStyle("color").from(this.div).replace(/\s+/g, ""); ok(divColor == "rgb(255,0,0)" || divColor == "#ff0000", "First div has correct color"); - var anotherDivColor = wysihtml5.dom.getStyle("color").from(this.anotherDiv).replace(/\s+/g, ""); + var anotherDivColor = wysihtml.dom.getStyle("color").from(this.anotherDiv).replace(/\s+/g, ""); ok(anotherDivColor == "rgb(255,0,0)" || anotherDivColor == "#ff0000", "Second div has correct color"); - equal(wysihtml5.dom.getStyle("text-decoration").from(this.div), "underline", "Text-decoration hasn't been overwritten"); + equal(wysihtml.dom.getStyle("text-decoration").from(this.div), "underline", "Text-decoration hasn't been overwritten"); if ("MozBorderRadius" in this.div.style) { - equal(wysihtml5.dom.getStyle("-moz-border-radius").from(this.div), "5px 5px 5px 5px", "First div has correct border-radius"); - equal(wysihtml5.dom.getStyle("-moz-border-radius").from(this.anotherDiv), "5px 5px 5px 5px", "Second div has correct border-radius"); + equal(wysihtml.dom.getStyle("-moz-border-radius").from(this.div), "5px 5px 5px 5px", "First div has correct border-radius"); + equal(wysihtml.dom.getStyle("-moz-border-radius").from(this.anotherDiv), "5px 5px 5px 5px", "Second div has correct border-radius"); } }); @@ -82,7 +82,7 @@ asyncTest("Test copying styles from one element to another element which is in a iframeDocument.body.appendChild(iframeElement); that.span.style.cssText = "float: left;"; - wysihtml5.dom + wysihtml.dom .copyStyles(["float"]) .from(that.span) .to(iframeElement); @@ -95,16 +95,16 @@ asyncTest("Test copying styles from one element to another element which is in a test("Test copying styles that were set via style element", function() { - wysihtml5.dom + wysihtml.dom .insertCSS(["span#wysihtml5-test-span { font-size: 16px; }"]) .into(document); - wysihtml5.dom + wysihtml.dom .copyStyles(["font-size"]) .from(this.span) .to(this.div); equal( - wysihtml5.dom.getStyle("font-size").from(this.div), "16px", "Font-size correctly copied" + wysihtml.dom.getStyle("font-size").from(this.div), "16px", "Font-size correctly copied" ); }); \ No newline at end of file diff --git a/test/dom/delegate_test.js b/test/dom/delegate_test.js index d548205..ab41e78 100644 --- a/test/dom/delegate_test.js +++ b/test/dom/delegate_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.delegate", { +module("wysihtml.dom.delegate", { setup: function() { this.container = document.createElement("div"); this.link1 = document.createElement("a"); @@ -22,7 +22,7 @@ test("Basic test", function() { var that = this; - wysihtml5.dom.delegate(this.container, "a", "click", function(event) { + wysihtml.dom.delegate(this.container, "a", "click", function(event) { ok(true, "Callback handler executed"); equal(this, that.link1, "Callback handler executed in correct scope"); ok(event.stopPropagation && event.preventDefault, "Parameter passed into callback handler is a proper event object"); @@ -36,7 +36,7 @@ test("Click on nested element works as well", function() { var that = this; - wysihtml5.dom.delegate(this.container, "a", "click", function(event) { + wysihtml.dom.delegate(this.container, "a", "click", function(event) { ok(true, "Callback handler executed"); equal(this, that.link2, "Callback handler executed in correct scope"); ok(event.stopPropagation && event.preventDefault, "Parameter passed into callback handler is a proper event object"); @@ -48,7 +48,7 @@ test("Click on nested element works as well", function() { test("Delegation on the body", function() { expect(1); - var delegater = wysihtml5.dom.delegate(document.body, ".delegation-test", "mousedown", function() { + var delegater = wysihtml.dom.delegate(document.body, ".delegation-test", "mousedown", function() { ok(true, "Callback handler executed"); }); diff --git a/test/dom/dom_node_test.js b/test/dom/dom_node_test.js index 115aeba..23d1e19 100644 --- a/test/dom/dom_node_test.js +++ b/test/dom/dom_node_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.domNode", { +module("wysihtml.dom.domNode", { setup: function() { this.container = document.createElement("div"); } @@ -8,71 +8,71 @@ test("Simple .prev() test", function() { this.container.innerHTML = "
    "; var lastItem = this.container.querySelector("div"), firstItem = this.container.querySelector("span"); - equal(wysihtml5.dom.domNode(lastItem).prev(), firstItem); + equal(wysihtml.dom.domNode(lastItem).prev(), firstItem); }); test(".prev() test with textnode in between", function() { this.container.innerHTML = " confusing text node
    "; var lastItem = this.container.querySelector("div"), firstItem = this.container.querySelector("span"); - equal(wysihtml5.dom.domNode(lastItem).prev({nodeTypes: [1]}), firstItem); + equal(wysihtml.dom.domNode(lastItem).prev({nodeTypes: [1]}), firstItem); }); test(".prev() test if no prev element exists", function() { this.container.innerHTML = "
    "; var lastItem = this.container.querySelector("div"); - equal(wysihtml5.dom.domNode(lastItem).prev(), null); + equal(wysihtml.dom.domNode(lastItem).prev(), null); }); test(".prev() test if no prev element exists with textnode", function() { this.container.innerHTML = "confusing text node
    "; var lastItem = this.container.querySelector("div"); - equal(wysihtml5.dom.domNode(lastItem).prev({nodeTypes: [1]}), null); + equal(wysihtml.dom.domNode(lastItem).prev({nodeTypes: [1]}), null); }); test(".prev() test with empty textnode in between and ignoreBlankTexts", function() { this.container.innerHTML = "
    "; var lastItem = this.container.querySelector("div"), firstItem = this.container.querySelector("span"); - equal(wysihtml5.dom.domNode(lastItem).prev({ignoreBlankTexts: true}), firstItem); + equal(wysihtml.dom.domNode(lastItem).prev({ignoreBlankTexts: true}), firstItem); }); test("Simple .next() test", function() { this.container.innerHTML = "
    "; var firstItem = this.container.querySelector("div"), lastItem = this.container.querySelector("span"); - equal(wysihtml5.dom.domNode(firstItem).next(), lastItem); + equal(wysihtml.dom.domNode(firstItem).next(), lastItem); }); test(".next() test with textnode in between", function() { this.container.innerHTML = "
    confusing text node "; var firstItem = this.container.querySelector("div"), lastItem = this.container.querySelector("span"); - equal(wysihtml5.dom.domNode(firstItem).next({nodeTypes: [1]}), lastItem); + equal(wysihtml.dom.domNode(firstItem).next({nodeTypes: [1]}), lastItem); }); test(".next() test if no next element exists", function() { this.container.innerHTML = "
    "; var lastItem = this.container.querySelector("div"); - equal(wysihtml5.dom.domNode(lastItem).next(), null); + equal(wysihtml.dom.domNode(lastItem).next(), null); }); test(".next() test if no next element exists with textnode", function() { this.container.innerHTML = "
    confusing text node "; var lastItem = this.container.querySelector("div"); - equal(wysihtml5.dom.domNode(lastItem).next({nodeTypes: [1]}), null); + equal(wysihtml.dom.domNode(lastItem).next({nodeTypes: [1]}), null); }); test(".next() test with empty textnode in between and ignoreBlankTexts", function() { this.container.innerHTML = "
    "; var firstItem = this.container.querySelector("div"), lastItem = this.container.querySelector("span"); - equal(wysihtml5.dom.domNode(firstItem).next({ignoreBlankTexts: true}), lastItem); + equal(wysihtml.dom.domNode(firstItem).next({ignoreBlankTexts: true}), lastItem); }); test(".lastLeafNode() test for element that is last leaf itself", function () { this.container.innerHTML = ""; - equal(wysihtml5.dom.domNode(this.container).lastLeafNode(), this.container); + equal(wysihtml.dom.domNode(this.container).lastLeafNode(), this.container); }); test(".lastLeafNode() test for inner elements traversing", function () { @@ -83,16 +83,16 @@ test(".lastLeafNode() test for inner elements traversing", function () { this.container.innerHTML = ""; this.container.appendChild(txtNode); - equal(wysihtml5.dom.domNode(this.container).lastLeafNode(), txtNode, "Found last only child textnode"); + equal(wysihtml.dom.domNode(this.container).lastLeafNode(), txtNode, "Found last only child textnode"); this.container.appendChild(elementNode); - equal(wysihtml5.dom.domNode(this.container).lastLeafNode(), elementNode, "Found last div element"); + equal(wysihtml.dom.domNode(this.container).lastLeafNode(), elementNode, "Found last div element"); elementNode.appendChild(innerElementNode); - equal(wysihtml5.dom.domNode(this.container).lastLeafNode(), innerElementNode, "Found last wrapped div element"); + equal(wysihtml.dom.domNode(this.container).lastLeafNode(), innerElementNode, "Found last wrapped div element"); this.container.insertBefore(elementNode, txtNode); - equal(wysihtml5.dom.domNode(this.container).lastLeafNode(), txtNode, "Found last textnode after reordering elements"); + equal(wysihtml.dom.domNode(this.container).lastLeafNode(), txtNode, "Found last textnode after reordering elements"); }); test(".lastLeafNode() test for leafClasses option", function () { @@ -105,8 +105,8 @@ test(".lastLeafNode() test for leafClasses option", function () { elementNode.appendChild(innerElementNode); this.container.appendChild(elementNode); - equal(wysihtml5.dom.domNode(this.container).lastLeafNode(), innerElementNode, "Wihout leafClasses option finds inner element node"); - equal(wysihtml5.dom.domNode(this.container).lastLeafNode({leafClasses: ['forced-leaf']}), elementNode, "With leafClasses option, stops search and returns the element with leafClass"); + equal(wysihtml.dom.domNode(this.container).lastLeafNode(), innerElementNode, "Wihout leafClasses option finds inner element node"); + equal(wysihtml.dom.domNode(this.container).lastLeafNode({leafClasses: ['forced-leaf']}), elementNode, "With leafClasses option, stops search and returns the element with leafClass"); }); @@ -128,7 +128,7 @@ test(".escapeParent()", function() { bold.appendChild(underline); this.container.appendChild(bold); - wysihtml5.dom.domNode(text2).escapeParent(bold); + wysihtml.dom.domNode(text2).escapeParent(bold); equal(this.container.innerHTML, "text1text2text3", "Parent split and node with parents escaped correctly"); diff --git a/test/dom/get_as_dom_test.js b/test/dom/get_as_dom_test.js index 420b45d..b615dc3 100644 --- a/test/dom/get_as_dom_test.js +++ b/test/dom/get_as_dom_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.getAsDom", { +module("wysihtml.dom.getAsDom", { teardown: function() { var iframe; while (iframe = document.querySelector("iframe.wysihtml5-sandbox")) { @@ -10,7 +10,7 @@ module("wysihtml5.dom.getAsDom", { test("Basic test", function() { var result; - result = wysihtml5.dom.getAsDom('foo'); + result = wysihtml.dom.getAsDom('foo'); equal(result.nodeName, "DIV"); equal(result.ownerDocument, document); equal(result.firstChild.nodeName, "SPAN"); @@ -18,10 +18,10 @@ test("Basic test", function() { equal(result.firstChild.innerHTML, "foo"); ok(!document.getElementById("get-in-dom-element-test")); - result = wysihtml5.dom.getAsDom("1 2"); + result = wysihtml.dom.getAsDom("1 2"); equal(result.childNodes.length, 3); - result = wysihtml5.dom.getAsDom(document.createElement("div")); + result = wysihtml.dom.getAsDom(document.createElement("div")); equal(result.innerHTML.toLowerCase(), "
    "); }); @@ -29,11 +29,11 @@ test("Basic test", function() { test("HTML5 elements", function() { var result; - result = wysihtml5.dom.getAsDom("
    foo
    "); + result = wysihtml.dom.getAsDom("
    foo
    "); equal(result.firstChild.nodeName.toLowerCase(), "article"); equal(result.firstChild.innerHTML.toLowerCase(), "foo"); - result = wysihtml5.dom.getAsDom("foo"); + result = wysihtml.dom.getAsDom("foo"); equal(result.innerHTML.toLowerCase(), "foo"); }); @@ -41,13 +41,13 @@ test("HTML5 elements", function() { asyncTest("Different document context", function() { expect(2); - new wysihtml5.dom.Sandbox(function(sandbox) { + new wysihtml.dom.Sandbox(function(sandbox) { var result; - result = wysihtml5.dom.getAsDom("
    hello
    ", sandbox.getDocument()); + result = wysihtml.dom.getAsDom("
    hello
    ", sandbox.getDocument()); equal(result.firstChild.ownerDocument, sandbox.getDocument()); - result = wysihtml5.dom.getAsDom("
    hello
    ", sandbox.getDocument()); + result = wysihtml.dom.getAsDom("
    hello
    ", sandbox.getDocument()); equal(result.innerHTML.toLowerCase(), "
    hello
    "); start(); diff --git a/test/dom/get_parent_element_test.js b/test/dom/get_parent_element_test.js index 99d01b2..b9e1db7 100644 --- a/test/dom/get_parent_element_test.js +++ b/test/dom/get_parent_element_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.getParentElement", { +module("wysihtml.dom.getParentElement", { setup: function() { this.container = document.createElement("div"); } @@ -11,12 +11,12 @@ test("Basic test - nodeName only", function() { var listItem = this.container.querySelector("li"), textNode = listItem.firstChild, list = this.container.querySelector("ul"); - equal(wysihtml5.dom.getParentElement(listItem, { query: "li" }), listItem); - equal(wysihtml5.dom.getParentElement(listItem, { query: "li, ul" }), listItem); - equal(wysihtml5.dom.getParentElement(listItem, { query: "ul" }), list); - equal(wysihtml5.dom.getParentElement(listItem, { nodeName: "UL" }), list); - equal(wysihtml5.dom.getParentElement(textNode, { query: "ul" }), list); - equal(wysihtml5.dom.getParentElement(listItem, { query: "span" }), null); + equal(wysihtml.dom.getParentElement(listItem, { query: "li" }), listItem); + equal(wysihtml.dom.getParentElement(listItem, { query: "li, ul" }), listItem); + equal(wysihtml.dom.getParentElement(listItem, { query: "ul" }), list); + equal(wysihtml.dom.getParentElement(listItem, { nodeName: "UL" }), list); + equal(wysihtml.dom.getParentElement(textNode, { query: "ul" }), list); + equal(wysihtml.dom.getParentElement(listItem, { query: "span" }), null); }); @@ -25,8 +25,8 @@ test("Check 'levels' param - nodeName only", function() { var listItem = this.container.querySelector("li"), nestedDiv = this.container.querySelector("div").querySelector("div"); - equal(wysihtml5.dom.getParentElement(listItem, { nodeName: "DIV" }, 2), null); - equal(wysihtml5.dom.getParentElement(listItem, { nodeName: "DIV" }, 3), nestedDiv); + equal(wysihtml.dom.getParentElement(listItem, { nodeName: "DIV" }, 2), null); + equal(wysihtml.dom.getParentElement(listItem, { nodeName: "DIV" }, 3), nestedDiv); }); @@ -38,42 +38,42 @@ test("Basic test - nodeName + className", function() { textNode = this.container.firstChild.firstChild, result; - result = wysihtml5.dom.getParentElement(textNode, { + result = wysihtml.dom.getParentElement(textNode, { nodeName: "SPAN", className: "wysiwyg-color-green", classRegExp: /wysiwyg-color-[a-z]+/g }); equal(result, spanElement); - result = wysihtml5.dom.getParentElement(textNode, { + result = wysihtml.dom.getParentElement(textNode, { query: "strong, span", className: "wysiwyg-color-green", classRegExp: /wysiwyg-color-[a-z]+/g }); equal(result, spanElement); - result = wysihtml5.dom.getParentElement(textNode, { + result = wysihtml.dom.getParentElement(textNode, { nodeName: "STRONG", className: "wysiwyg-color-green", classRegExp: /wysiwyg-color-[a-z]+/g }); equal(result, null); - result = wysihtml5.dom.getParentElement(textNode, { + result = wysihtml.dom.getParentElement(textNode, { nodeName: "DIV", className: "wysiwyg-color-green", classRegExp: /wysiwyg-color-[a-z]+/g }); equal(result, null); - result = wysihtml5.dom.getParentElement(textNode, { + result = wysihtml.dom.getParentElement(textNode, { nodeName: "SPAN", className: "wysiwyg-color-blue", classRegExp: /wysiwyg-color-[a-z]+/g }); equal(result, null); - result = wysihtml5.dom.getParentElement(spanElement, { + result = wysihtml.dom.getParentElement(spanElement, { nodeName: "SPAN", className: "wysiwyg-color-green", classRegExp: /wysiwyg-color-[a-z]+/g @@ -90,14 +90,14 @@ test("Check 'levels' param - nodeName + className", function() { nestedDiv = this.container.querySelector("div").querySelector("div"), result; - result = wysihtml5.dom.getParentElement(listItem, { + result = wysihtml.dom.getParentElement(listItem, { nodeName: "DIV", className: "wysiwyg-color-green", classRegExp: /wysiwyg-color-[a-z]+/g }, 2); equal(result, null); - result = wysihtml5.dom.getParentElement(listItem, { + result = wysihtml.dom.getParentElement(listItem, { nodeName: "DIV", className: "wysiwyg-color-green", classRegExp: /wysiwyg-color-[a-z]+/g @@ -113,7 +113,7 @@ test("Check - no nodeName", function() { alignedDiv = this.container.querySelector("div").querySelector("div"), result; - result = wysihtml5.dom.getParentElement(spanElement, { + result = wysihtml.dom.getParentElement(spanElement, { className: "wysiwyg-text-align-right", classRegExp: /wysiwyg-text-align-[a-z]+/g }); @@ -127,7 +127,7 @@ test("Test - with no nodeName", function() { alignedDiv = this.container.querySelector("div").querySelector("div"), result; - result = wysihtml5.dom.getParentElement(spanElement, { + result = wysihtml.dom.getParentElement(spanElement, { className: "wysiwyg-text-align-right", classRegExp: /wysiwyg-text-align-[a-z]+/g }); @@ -141,7 +141,7 @@ test("Test - with only a classRegExp", function() { alignedDiv = this.container.querySelector("div").querySelector("div"), result; - result = wysihtml5.dom.getParentElement(spanElement, { + result = wysihtml.dom.getParentElement(spanElement, { classRegExp: /wysiwyg-text-align-[a-z]+/g }); equal(result, alignedDiv); @@ -154,7 +154,7 @@ test("Test - with only a className", function() { alignedDiv = this.container.querySelector("div").querySelector("div"), result; - result = wysihtml5.dom.getParentElement(spanElement, { + result = wysihtml.dom.getParentElement(spanElement, { className: "wysiwyg-text-align-right" }); equal(result, alignedDiv); @@ -168,7 +168,7 @@ test("Test with parent container limit", function() { nestedDiv = this.container.querySelector("div").querySelector("div"), result; - result = wysihtml5.dom.getParentElement(spanElement, { + result = wysihtml.dom.getParentElement(spanElement, { nodeName: "DIV" }, false, limitEl); diff --git a/test/dom/get_style_test.js b/test/dom/get_style_test.js index ffc13d4..d9de4d9 100644 --- a/test/dom/get_style_test.js +++ b/test/dom/get_style_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.getStyle", { +module("wysihtml.dom.getStyle", { setup: function() { this.container = document.createElement("div"); document.body.appendChild(this.container); @@ -11,7 +11,7 @@ module("wysihtml5.dom.getStyle", { test("Basic test", function() { - wysihtml5.dom.insertCSS([ + wysihtml.dom.insertCSS([ ".test-element-2 { position: absolute }" ]).into(document); @@ -21,22 +21,22 @@ test("Basic test", function() { this.container.innerHTML += '
    '; equal( - wysihtml5.dom.getStyle("float").from(this.container.getElementsByTagName("span")[0]), + wysihtml.dom.getStyle("float").from(this.container.getElementsByTagName("span")[0]), "left" ); equal( - wysihtml5.dom.getStyle("position").from(this.container.getElementsByTagName("span")[1]), + wysihtml.dom.getStyle("position").from(this.container.getElementsByTagName("span")[1]), "absolute" ); equal( - wysihtml5.dom.getStyle("display").from(this.container.getElementsByTagName("div")[0]), + wysihtml.dom.getStyle("display").from(this.container.getElementsByTagName("div")[0]), "block" ); equal( - wysihtml5.dom.getStyle("display").from(this.container.getElementsByTagName("i")[0]), + wysihtml.dom.getStyle("display").from(this.container.getElementsByTagName("i")[0]), "inline" ); }); @@ -49,6 +49,6 @@ test("Textarea width/height when value causes overflow", function() { textarea.value = Array(500).join("Lorem ipsum dolor foo bar"); this.container.appendChild(textarea); - equal(wysihtml5.dom.getStyle("width") .from(textarea), "500px"); - equal(wysihtml5.dom.getStyle("height") .from(textarea), "200px"); + equal(wysihtml.dom.getStyle("width") .from(textarea), "500px"); + equal(wysihtml.dom.getStyle("height") .from(textarea), "200px"); }); \ No newline at end of file diff --git a/test/dom/has_element_with_class_name_test.js b/test/dom/has_element_with_class_name_test.js index 9832565..8b41cfd 100644 --- a/test/dom/has_element_with_class_name_test.js +++ b/test/dom/has_element_with_class_name_test.js @@ -1,5 +1,5 @@ -if ("querySelector" in document || wysihtml5.browser.supportsNativeGetElementsByClassName()) { - module("wysihtml5.dom.hasElementWithClassName", { +if ("querySelector" in document || wysihtml.browser.supportsNativeGetElementsByClassName()) { + module("wysihtml.dom.hasElementWithClassName", { teardown: function() { var iframe; while (iframe = document.querySelector("iframe.wysihtml5-sandbox")) { @@ -12,16 +12,16 @@ if ("querySelector" in document || wysihtml5.browser.supportsNativeGetElementsBy asyncTest("Basic test", function() { expect(3); - new wysihtml5.dom.Sandbox(function(sandbox) { + new wysihtml.dom.Sandbox(function(sandbox) { var doc = sandbox.getDocument(), tempElement = doc.createElement("i"); tempElement.className = "wysiwyg-color-aqua"; - ok(!wysihtml5.dom.hasElementWithClassName(doc, "wysiwyg-color-aqua")); + ok(!wysihtml.dom.hasElementWithClassName(doc, "wysiwyg-color-aqua")); doc.body.appendChild(tempElement); - ok(wysihtml5.dom.hasElementWithClassName(doc, "wysiwyg-color-aqua")); + ok(wysihtml.dom.hasElementWithClassName(doc, "wysiwyg-color-aqua")); tempElement.parentNode.removeChild(tempElement); - ok(!wysihtml5.dom.hasElementWithClassName(doc, "wysiwyg-color-aqua")); + ok(!wysihtml.dom.hasElementWithClassName(doc, "wysiwyg-color-aqua")); start(); }).insertInto(document.body); diff --git a/test/dom/has_element_with_tag_name_test.js b/test/dom/has_element_with_tag_name_test.js index 806c451..53cae5a 100644 --- a/test/dom/has_element_with_tag_name_test.js +++ b/test/dom/has_element_with_tag_name_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.hasElementWithTagName", { +module("wysihtml.dom.hasElementWithTagName", { teardown: function() { var iframe; while (iframe = document.querySelector("iframe.wysihtml5-sandbox")) { @@ -11,14 +11,14 @@ module("wysihtml5.dom.hasElementWithTagName", { asyncTest("Basic test", function() { expect(3); - new wysihtml5.dom.Sandbox(function(sandbox) { + new wysihtml.dom.Sandbox(function(sandbox) { var doc = sandbox.getDocument(), tempElement = doc.createElement("i"); - ok(!wysihtml5.dom.hasElementWithTagName(doc, "I")); + ok(!wysihtml.dom.hasElementWithTagName(doc, "I")); doc.body.appendChild(tempElement); - ok(wysihtml5.dom.hasElementWithTagName(doc, "I")); + ok(wysihtml.dom.hasElementWithTagName(doc, "I")); tempElement.parentNode.removeChild(tempElement); - ok(!wysihtml5.dom.hasElementWithTagName(doc, "I")); + ok(!wysihtml.dom.hasElementWithTagName(doc, "I")); start(); }).insertInto(document.body); diff --git a/test/dom/insert_css_test.js b/test/dom/insert_css_test.js index a900ec4..b69d68c 100644 --- a/test/dom/insert_css_test.js +++ b/test/dom/insert_css_test.js @@ -1,6 +1,6 @@ -if (wysihtml5.browser.supported()) { +if (wysihtml.browser.supported()) { - module("wysihtml5.dom.insertCSS", { + module("wysihtml.dom.insertCSS", { teardown: function() { var iframe; while (iframe = document.querySelector("iframe.wysihtml5-sandbox")) { @@ -12,21 +12,21 @@ if (wysihtml5.browser.supported()) { asyncTest("Basic Tests", function() { expect(3); - new wysihtml5.dom.Sandbox(function(sandbox) { + new wysihtml.dom.Sandbox(function(sandbox) { var doc = sandbox.getDocument(), body = doc.body, element = doc.createElement("sub"); body.appendChild(element); - wysihtml5.dom.insertCSS([ + wysihtml.dom.insertCSS([ "sub { display: block; text-align: right; }", "body { text-indent: 50px; }" ]).into(doc); - equal(wysihtml5.dom.getStyle("display") .from(element), "block"); - equal(wysihtml5.dom.getStyle("text-align") .from(element), "right"); - equal(wysihtml5.dom.getStyle("text-indent").from(element), "50px"); + equal(wysihtml.dom.getStyle("display") .from(element), "block"); + equal(wysihtml.dom.getStyle("text-align") .from(element), "right"); + equal(wysihtml.dom.getStyle("text-indent").from(element), "50px"); start(); }).insertInto(document.body); @@ -35,10 +35,10 @@ if (wysihtml5.browser.supported()) { asyncTest("Check whether CSS is inserted before any loaded stylesheets", function() { expect(1); - new wysihtml5.dom.Sandbox(function(sandbox) { + new wysihtml.dom.Sandbox(function(sandbox) { var doc = sandbox.getDocument(); - wysihtml5.dom.insertCSS([".foo {}"]).into(doc); + wysihtml.dom.insertCSS([".foo {}"]).into(doc); ok(doc.querySelector("style[type='text/css'] + link[rel=stylesheet]"), "CSS has been inserted before any included stylesheet"); diff --git a/test/dom/observe_test.js b/test/dom/observe_test.js index 9ab0bf1..9233f25 100644 --- a/test/dom/observe_test.js +++ b/test/dom/observe_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.observe", { +module("wysihtml.dom.observe", { setup: function() { this.container = document.createElement("div"); this.element = document.createElement("textarea"); @@ -22,11 +22,11 @@ test("Basic test", function() { var element = this.element; - wysihtml5.dom.observe(element, ["mouseover", "mouseout"], function(event) { + wysihtml.dom.observe(element, ["mouseover", "mouseout"], function(event) { ok(true, "'" + event.type + "' correctly fired"); }); - wysihtml5.dom.observe(element, "click", function(event) { + wysihtml.dom.observe(element, "click", function(event) { equal(event.target, element, "event.target or event.srcElement are set"); ok(true, "'click' correctly fired"); }); @@ -41,11 +41,11 @@ test("Test stopPropagation and scope of event handler", function(event) { expect(2); var element = this.element; - wysihtml5.dom.observe(this.container, "click", function(event) { + wysihtml.dom.observe(this.container, "click", function(event) { ok(false, "The event shouldn't have been bubbled!"); }); - wysihtml5.dom.observe(this.element, "click", function(event) { + wysihtml.dom.observe(this.element, "click", function(event) { event.stopPropagation(); equal(this, element, "Event handler bound to correct scope"); ok(true, "stopPropagation correctly fired"); @@ -56,7 +56,7 @@ test("Test stopPropagation and scope of event handler", function(event) { test("Test detaching events", function() { expect(0); - var eventListener = wysihtml5.dom.observe(this.element, "click", function() { + var eventListener = wysihtml.dom.observe(this.element, "click", function() { ok(false, "This should not be triggered"); }); @@ -67,10 +67,10 @@ test("Test detaching events", function() { asyncTest("Advanced test observing within a sandboxed iframe", function() { expect(2); - var sandbox = new wysihtml5.dom.Sandbox(function() { + var sandbox = new wysihtml.dom.Sandbox(function() { var element = sandbox.getDocument().createElement("div"); sandbox.getDocument().body.appendChild(element); - wysihtml5.dom.observe(element, ["click", "mousedown"], function(event) { + wysihtml.dom.observe(element, ["click", "mousedown"], function(event) { ok(true, "'" + event.type + "' correctly fired"); }); happen.click(element); diff --git a/test/dom/parse_test.js b/test/dom/parse_test.js index 7c5bb52..2329132 100644 --- a/test/dom/parse_test.js +++ b/test/dom/parse_test.js @@ -1,8 +1,8 @@ -if (wysihtml5.browser.supported()) { +if (wysihtml.browser.supported()) { - module("wysihtml5.dom.parse", { + module("wysihtml.dom.parse", { sanitize: function(html, rules, context, cleanUp, uneditableClass) { - return wysihtml5.dom.parse(html, { + return wysihtml.dom.parse(html, { "rules": rules, "cleanUp": cleanUp, "context": context, diff --git a/test/dom/rename_element_test.js b/test/dom/rename_element_test.js index e02e893..f1880ef 100644 --- a/test/dom/rename_element_test.js +++ b/test/dom/rename_element_test.js @@ -1,11 +1,11 @@ -module("wysihtml5.dom.renameElement", { +module("wysihtml.dom.renameElement", { equal: function(actual, expected, message) { return QUnit.assert.htmlEqual(actual, expected, message); }, renameElement: function(html, newNodeName) { - var container = wysihtml5.dom.getAsDom(html); - wysihtml5.dom.renameElement(container.firstChild, newNodeName); + var container = wysihtml.dom.getAsDom(html); + wysihtml.dom.renameElement(container.firstChild, newNodeName); return container.innerHTML; } }); diff --git a/test/dom/resolve_list_test.js b/test/dom/resolve_list_test.js index 3f76aad..b9fd456 100644 --- a/test/dom/resolve_list_test.js +++ b/test/dom/resolve_list_test.js @@ -1,12 +1,12 @@ -module("wysihtml5.dom.resolveList", { +module("wysihtml.dom.resolveList", { equal: function(actual, expected, message) { return QUnit.assert.htmlEqual(actual, expected, message); }, resolveList: function(html, useLineBreaks) { - var container = wysihtml5.dom.getAsDom(html); + var container = wysihtml.dom.getAsDom(html); document.body.appendChild(container); - wysihtml5.dom.resolveList(container.firstChild, useLineBreaks); + wysihtml.dom.resolveList(container.firstChild, useLineBreaks); var innerHTML = container.innerHTML; container.parentNode.removeChild(container); return innerHTML; diff --git a/test/dom/sandbox_test.js b/test/dom/sandbox_test.js index 9a63657..d8d8eff 100644 --- a/test/dom/sandbox_test.js +++ b/test/dom/sandbox_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.Sandbox", { +module("wysihtml.dom.Sandbox", { teardown: function() { var iframe; while (iframe = document.querySelector("iframe.wysihtml5-sandbox")) { @@ -24,7 +24,7 @@ module("wysihtml5.dom.Sandbox", { isUnset: function(evalCode, iframeWindow) { var value = this.eval(iframeWindow, evalCode); - return !value || value == wysihtml5.EMPTY_FUNCTION; + return !value || value == wysihtml.EMPTY_FUNCTION; } }); @@ -32,7 +32,7 @@ module("wysihtml5.dom.Sandbox", { asyncTest("Basic Test", function() { expect(8); - var sandbox = new wysihtml5.dom.Sandbox(function(param) { + var sandbox = new wysihtml.dom.Sandbox(function(param) { equal(param, sandbox, "The parameter passed into the readyCallback is the sandbox instance"); var iframes = document.querySelectorAll("iframe.wysihtml5-sandbox"); @@ -46,12 +46,12 @@ asyncTest("Basic Test", function() { ok(isSandboxed, "iFrame is sandboxed"); var isWindowObject = sandbox.getWindow().setInterval && sandbox.getWindow().clearInterval; - ok(isWindowObject, "wysihtml5.Sandbox.prototype.getWindow() works properly"); + ok(isWindowObject, "wysihtml.Sandbox.prototype.getWindow() works properly"); var isDocumentObject = sandbox.getDocument().appendChild && sandbox.getDocument().body; - ok(isDocumentObject, "wysihtml5.Sandbox.prototype.getDocument() works properly"); + ok(isDocumentObject, "wysihtml.Sandbox.prototype.getDocument() works properly"); - equal(sandbox.getIframe(), iframe, "wysihtml5.Sandbox.prototype.getIframe() returns the iframe correctly"); + equal(sandbox.getIframe(), iframe, "wysihtml.Sandbox.prototype.getIframe() returns the iframe correctly"); equal(typeof(sandbox.getWindow().onerror), "function", "window.onerror is set"); start(); @@ -66,10 +66,10 @@ asyncTest("Security test #1", function() { var that = this; - var sandbox = new wysihtml5.dom.Sandbox(function() { + var sandbox = new wysihtml.dom.Sandbox(function() { var iframeWindow = sandbox.getWindow(); - var isSafari = wysihtml5.browser.USER_AGENT.indexOf("Safari") !== -1 && wysihtml5.browser.USER_AGENT.indexOf("Chrome") === 1; + var isSafari = wysihtml.browser.USER_AGENT.indexOf("Safari") !== -1 && wysihtml.browser.USER_AGENT.indexOf("Chrome") === 1; if (isSafari) { // This test fails in Safari 5, as it's impossible to unset a cookie there @@ -102,7 +102,7 @@ asyncTest("Security test #1", function() { asyncTest("Security test #2", function() { expect(2); - var sandbox = new wysihtml5.dom.Sandbox(function() { + var sandbox = new wysihtml.dom.Sandbox(function() { var html = ''; sandbox.getDocument().body.innerHTML = html; @@ -123,7 +123,7 @@ asyncTest("Check charset & doctype", function() { var that = this; - var sandbox = new wysihtml5.dom.Sandbox(function() { + var sandbox = new wysihtml.dom.Sandbox(function() { var iframeDocument = sandbox.getDocument(), isQuirksMode = iframeDocument.compatMode == "BackCompat"; @@ -145,7 +145,7 @@ asyncTest("Check charset & doctype", function() { asyncTest("Check insertion of single stylesheet", function() { expect(1); - new wysihtml5.dom.Sandbox(function(sandbox) { + new wysihtml.dom.Sandbox(function(sandbox) { var doc = sandbox.getDocument(); equal(doc.getElementsByTagName("link").length, 1, "Correct amount of stylesheets inserted into the dom tree"); start(); @@ -158,7 +158,7 @@ asyncTest("Check insertion of single stylesheet", function() { asyncTest("Check insertion of multiple stylesheets", function() { expect(1); - new wysihtml5.dom.Sandbox(function(sandbox) { + new wysihtml.dom.Sandbox(function(sandbox) { var doc = sandbox.getDocument(); equal(doc.getElementsByTagName("link").length, 2, "Correct amount of stylesheets inserted into the dom tree"); start(); @@ -174,7 +174,7 @@ asyncTest("Check insertion of multiple stylesheets", function() { asyncTest("Check X-UA-Compatible", function() { expect(1); - new wysihtml5.dom.Sandbox(function(sandbox) { + new wysihtml.dom.Sandbox(function(sandbox) { var doc = sandbox.getDocument(), docMode = doc.documentMode; diff --git a/test/dom/set_attributes_test.js b/test/dom/set_attributes_test.js index e0c9e8e..01bf8e7 100644 --- a/test/dom/set_attributes_test.js +++ b/test/dom/set_attributes_test.js @@ -1,11 +1,11 @@ -module("wysihtml5.dom.setAttributes", { +module("wysihtml.dom.setAttributes", { setup: function() { this.element = document.createElement("div"); } }); test("Basic test", function() { - wysihtml5.dom.setAttributes({ + wysihtml.dom.setAttributes({ id: "foo", "class": "bar" }).on(this.element); diff --git a/test/dom/set_styles_test.js b/test/dom/set_styles_test.js index be7ed56..18ca7b8 100644 --- a/test/dom/set_styles_test.js +++ b/test/dom/set_styles_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.setStyles", { +module("wysihtml.dom.setStyles", { setup: function() { this.element = document.createElement("div"); document.body.appendChild(this.element); @@ -10,10 +10,10 @@ module("wysihtml5.dom.setStyles", { }); test("Basic test", function() { - wysihtml5.dom.setStyles("text-align: right; float: left").on(this.element); - equal(wysihtml5.dom.getStyle("text-align").from(this.element), "right"); - equal(wysihtml5.dom.getStyle("float").from(this.element), "left"); + wysihtml.dom.setStyles("text-align: right; float: left").on(this.element); + equal(wysihtml.dom.getStyle("text-align").from(this.element), "right"); + equal(wysihtml.dom.getStyle("float").from(this.element), "left"); - wysihtml5.dom.setStyles({ "float": "right" }).on(this.element); - equal(wysihtml5.dom.getStyle("float").from(this.element), "right"); + wysihtml.dom.setStyles({ "float": "right" }).on(this.element); + equal(wysihtml.dom.getStyle("float").from(this.element), "right"); }); \ No newline at end of file diff --git a/test/dom/table_test.js b/test/dom/table_test.js index 561d534..2318c68 100644 --- a/test/dom/table_test.js +++ b/test/dom/table_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.table", { +module("wysihtml.dom.table", { setup: function() { var row, cell; @@ -37,7 +37,7 @@ test("getCellsBetween", function() { secondCell = cells[1], beforeLastCell = cells[cells.length - 2], secondRowFirstCell = cells[4], - between = wysihtml5.dom.table.getCellsBetween(cellFirst, cellLast); + between = wysihtml.dom.table.getCellsBetween(cellFirst, cellLast); equal(between.length, 4*4, "All 16 cells are in list of selection from first to last cell"); equal(between[0], cellFirst, "First cell of selection in list and first"); @@ -59,7 +59,7 @@ test("getCellsBetween", function() { } ok(inList1 && inList2 && inList3, "First, last and second row first cell are in list"); - between = wysihtml5.dom.table.getCellsBetween(secondCell, beforeLastCell); + between = wysihtml.dom.table.getCellsBetween(secondCell, beforeLastCell); equal(between.length, 2*4, "List is 8 cells long if selections is moved from second cell to before last (first and last column not selected)"); var notInList = true; @@ -70,7 +70,7 @@ test("getCellsBetween", function() { } ok(notInList, "First, last and second row first cell are not in list anymore"); - between = wysihtml5.dom.table.getCellsBetween(secondCell, secondCell); + between = wysihtml.dom.table.getCellsBetween(secondCell, secondCell); equal(between.length, 1, "List collapses to one cell if start and end cell are the same"); equal(between[0], secondCell, "The element in list is correct"); }); @@ -82,7 +82,7 @@ test("addCells (above/below)", function() { cellLast = cells[cells.length - 1], startRowsNr = rows.length; - wysihtml5.dom.table.addCells(cellLast,"below"); + wysihtml.dom.table.addCells(cellLast,"below"); equal(this.getTable().querySelectorAll('tr').length, startRowsNr + 1, "One row added successfully to table location below"); var newrows = this.getTable().querySelectorAll('tr'), @@ -91,15 +91,15 @@ test("addCells (above/below)", function() { equal(lasCellOfBSrow, cellLast, "Row added correctly below cell and original DOM object is intact"); - wysihtml5.dom.table.addCells(cellLast,"below"); + wysihtml.dom.table.addCells(cellLast,"below"); equal(this.getTable().querySelectorAll('tr').length, startRowsNr + 2, "One row added successfully to table location belown (last to second row)"); equal(this.getTable().querySelectorAll('td')[15], cellLast, "Row added correctly below cell and original DOM object is intact"); - wysihtml5.dom.table.addCells(cellFirst,"above"); + wysihtml.dom.table.addCells(cellFirst,"above"); equal(this.getTable().querySelectorAll('tr').length, startRowsNr + 3, "One row added successfully to table location above"); equal(this.getTable().querySelectorAll('td')[4], cellFirst, "Row added correctly above cell and original DOM object is intact"); - wysihtml5.dom.table.addCells(cellFirst,"above"); + wysihtml.dom.table.addCells(cellFirst,"above"); equal(this.getTable().querySelectorAll('tr').length, startRowsNr + 4, "One row added successfully to table location above (on second row)"); equal(this.getTable().querySelectorAll('td')[8], cellFirst, "Row added correctly above cell and original DOM object is intact"); }); @@ -110,19 +110,19 @@ test("addCells (before/after)", function() { cellFirst = cells[0], cellLast = cells[cells.length - 1]; - wysihtml5.dom.table.addCells(cellFirst, "before"); + wysihtml.dom.table.addCells(cellFirst, "before"); equal(this.getTable().querySelectorAll('td').length, cells.length + (1 * nr_rows), "One column added successfully to table location before"); equal(this.getTable().querySelectorAll('td')[1], cellFirst, "Row added correctly before cell and original DOM object is intact"); - wysihtml5.dom.table.addCells(cellFirst, "before"); + wysihtml.dom.table.addCells(cellFirst, "before"); equal(this.getTable().querySelectorAll('td').length, cells.length + (2 * nr_rows), "One column added successfully to table location before (on second column)"); equal(this.getTable().querySelectorAll('td')[2], cellFirst, "Row added correctly before cell and original DOM object is intact"); - wysihtml5.dom.table.addCells(cellLast, "after"); + wysihtml.dom.table.addCells(cellLast, "after"); equal(this.getTable().querySelectorAll('td').length, cells.length + (3 * nr_rows), "One column added successfully to table location after"); equal(this.getTable().querySelectorAll('td')[this.getTable().querySelectorAll('td').length - 2], cellLast, "Row added correctly after cell and original DOM object is intact"); - wysihtml5.dom.table.addCells(cellLast, "after"); + wysihtml.dom.table.addCells(cellLast, "after"); equal(this.getTable().querySelectorAll('td').length, cells.length + (4 * nr_rows), "One column added successfully to table location after (on last to second column)"); equal(this.getTable().querySelectorAll('td')[this.getTable().querySelectorAll('td').length - 3], cellLast, "Row added correctly after cell and original DOM object is intact"); }); @@ -141,9 +141,9 @@ test("merge/unmerge", function() { cells[5].appendChild(txt3); // merge - equal(wysihtml5.dom.table.canMerge(cells[0], cells[9]), true , "canMerge returns true correctly for unmerged selection"); + equal(wysihtml.dom.table.canMerge(cells[0], cells[9]), true , "canMerge returns true correctly for unmerged selection"); - wysihtml5.dom.table.mergeCellsBetween(cells[0], cells[9]); + wysihtml.dom.table.mergeCellsBetween(cells[0], cells[9]); equal(this.getTable().querySelectorAll('td').length, nr_cells - 5, "Top left corner (6 cells) correctly merged"); equal(this.getTable().querySelectorAll('td')[0].getAttribute('colspan'), 2, "Colspan attribute added correctly"); equal(this.getTable().querySelectorAll('td')[0].getAttribute('rowspan'), 3, "Rowspan attribute added correctly"); @@ -152,9 +152,9 @@ test("merge/unmerge", function() { var cells_m1 = this.getTable().querySelectorAll('td'); - equal(wysihtml5.dom.table.canMerge(cells_m1[0], cells_m1[1]), false , "canMerge returns false correctly for selection containing merged cells"); + equal(wysihtml.dom.table.canMerge(cells_m1[0], cells_m1[1]), false , "canMerge returns false correctly for selection containing merged cells"); - wysihtml5.dom.table.mergeCellsBetween(cells_m1[cells_m1.length - 6], cells_m1[cells_m1.length - 1]); + wysihtml.dom.table.mergeCellsBetween(cells_m1[cells_m1.length - 6], cells_m1[cells_m1.length - 1]); equal(this.getTable().querySelectorAll('td').length, nr_cells - 8, "Bottom right corner (4 cells) correctly merged"); var cells_m2 = this.getTable().querySelectorAll('td'); @@ -164,7 +164,7 @@ test("merge/unmerge", function() { var nr_cells_m2 = cells_m2.length; // should not merge - wysihtml5.dom.table.mergeCellsBetween(cells_m2[0], cells_m2[cells_m2.length - 1]); + wysihtml.dom.table.mergeCellsBetween(cells_m2[0], cells_m2[cells_m2.length - 1]); equal(this.getTable().querySelectorAll('td').length, nr_cells_m2, "Correctly refuses to merge allready merged cells"); // unmerge @@ -173,7 +173,7 @@ test("merge/unmerge", function() { equal(umerge_cell1.getAttribute('colspan'), 2, "Colspan attribute is set before unmerge (Bottom right corner)"); equal(umerge_cell1.getAttribute('rowspan'), 2, "Rowspan attribute is set before unmerge (Bottom right corner)"); - wysihtml5.dom.table.unmergeCell(umerge_cell1); + wysihtml.dom.table.unmergeCell(umerge_cell1); equal(this.getTable().querySelectorAll('td').length, nr_cells - 5, "Bottom right corner (4 cells) correctly unmerged"); var cells_m3 = this.getTable().querySelectorAll('td'); @@ -184,7 +184,7 @@ test("merge/unmerge", function() { equal(cells_m3[0].getAttribute('colspan') , 2, "Colspan of top right corner is untouched"); equal(cells_m3[0].getAttribute('rowspan'), 3, "Rowspan of top right corner is untouched"); - wysihtml5.dom.table.unmergeCell(cells_m3[0]); + wysihtml.dom.table.unmergeCell(cells_m3[0]); equal(this.getTable().querySelectorAll('td').length, nr_cells, "Top right unmerged correctly, table is back at start layout"); @@ -199,22 +199,22 @@ test("removeCells", function() { nr_rows = this.getTable().querySelectorAll('tr').length, nr_cols = this.getTable().querySelectorAll('tr')[0].querySelectorAll('td').length; - wysihtml5.dom.table.removeCells(cells[1], "column"); + wysihtml.dom.table.removeCells(cells[1], "column"); equal(this.getTable().querySelectorAll('tr')[0].querySelectorAll('td').length, nr_cols - 1, "One column removed successfully"); equal(this.getTable().querySelectorAll('tr').length, nr_rows, "Rows untouched"); - wysihtml5.dom.table.removeCells(this.getTable().querySelectorAll('td')[4], "row"); + wysihtml.dom.table.removeCells(this.getTable().querySelectorAll('td')[4], "row"); equal(this.getTable().querySelectorAll('tr')[0].querySelectorAll('td').length, nr_cols - 1, "Columns untouched"); equal(this.getTable().querySelectorAll('tr').length, nr_rows -1, "One row removed successfully"); var cells1 = this.getTable().querySelectorAll('td'); - wysihtml5.dom.table.mergeCellsBetween(cells1[0], cells1[4]); + wysihtml.dom.table.mergeCellsBetween(cells1[0], cells1[4]); equal(this.getTable().querySelectorAll('td')[0].getAttribute('rowspan'), 2, "One cell merged for testing, rowspan 2"); equal(this.getTable().querySelectorAll('td')[0].getAttribute('colspan'), 2, "One cell merged for testing, colspan 2"); - wysihtml5.dom.table.removeCells(this.getTable().querySelectorAll('tr')[1].querySelectorAll('td')[0], "row"); + wysihtml.dom.table.removeCells(this.getTable().querySelectorAll('tr')[1].querySelectorAll('td')[0], "row"); equal(this.getTable().querySelectorAll('td')[0].getAttribute('rowspan'), null, "Meged cell rowspan removed correlctly"); equal(this.getTable().querySelectorAll('td')[0].getAttribute('colspan'), 2, "Colspan remained correct"); @@ -222,15 +222,15 @@ test("removeCells", function() { equal(this.getTable().querySelectorAll('tr')[1].querySelectorAll('td').length, nr_cols - 1, "Nr of columns correct"); equal(this.getTable().querySelectorAll('tr').length, nr_rows -2, "Nr of rows correct"); - wysihtml5.dom.table.removeCells(this.getTable().querySelectorAll('td')[3], "column"); + wysihtml.dom.table.removeCells(this.getTable().querySelectorAll('td')[3], "column"); equal(this.getTable().querySelectorAll('tr')[0].querySelectorAll('td').length, nr_cols - 2, "Nr of columns correct afrer merged column removed"); equal(this.getTable().querySelectorAll('td')[0].getAttribute('colspan'), null, "Meged cell colspan removed correlctly"); - wysihtml5.dom.table.removeCells(this.getTable().querySelectorAll('td')[0], "column"); - wysihtml5.dom.table.removeCells(this.getTable().querySelectorAll('td')[0], "row"); - wysihtml5.dom.table.removeCells(this.getTable().querySelectorAll('td')[0], "column"); + wysihtml.dom.table.removeCells(this.getTable().querySelectorAll('td')[0], "column"); + wysihtml.dom.table.removeCells(this.getTable().querySelectorAll('td')[0], "row"); + wysihtml.dom.table.removeCells(this.getTable().querySelectorAll('td')[0], "column"); equal(this.getTable().parentNode, null, "Table remove table from dom when last cell removed"); @@ -241,18 +241,18 @@ test("orderSelectionEnds", function() { cellFirst = cells[0], cellLast = cells[cells.length - 1]; - var ends = wysihtml5.dom.table.orderSelectionEnds(cellLast, cellFirst); + var ends = wysihtml.dom.table.orderSelectionEnds(cellLast, cellFirst); ok(ends.end == cellLast && ends.start == cellFirst, "Given cells ordered correctly"); }); test("indexOf/findCell", function() { - wysihtml5.dom.table.mergeCellsBetween(this.getTable().querySelectorAll('td')[1], this.getTable().querySelectorAll('td')[6]); + wysihtml.dom.table.mergeCellsBetween(this.getTable().querySelectorAll('td')[1], this.getTable().querySelectorAll('td')[6]); var cell = this.getTable().querySelectorAll('td')[4], - idx = wysihtml5.dom.table.indexOf(cell); + idx = wysihtml.dom.table.indexOf(cell); ok(idx.row == 1 && idx.col == 3, "Index gets position correctly in table with merged cell"); - equal(wysihtml5.dom.table.findCell(this.getTable(), idx), cell, "Cell element got correctly by index"); + equal(wysihtml.dom.table.findCell(this.getTable(), idx), cell, "Cell element got correctly by index"); }); diff --git a/test/dom/unwrap_test.js b/test/dom/unwrap_test.js index 768104d..d66ad50 100644 --- a/test/dom/unwrap_test.js +++ b/test/dom/unwrap_test.js @@ -1,4 +1,4 @@ -module("wysihtml5.dom.unwrap", { +module("wysihtml.dom.unwrap", { setup: function() { this.inner = "test

    tes2

    "; this.container = document.createElement("div"); @@ -9,6 +9,6 @@ module("wysihtml5.dom.unwrap", { }); test("Basic test", function() { - wysihtml5.dom.unwrap(this.containerInner); + wysihtml.dom.unwrap(this.containerInner); equal(this.container.innerHTML, this.inner, "Unwrapping element works splendid."); }); diff --git a/test/editor_commands_test.js b/test/editor_commands_test.js index 00ce9f2..b16e85f 100644 --- a/test/editor_commands_test.js +++ b/test/editor_commands_test.js @@ -1,5 +1,5 @@ -if (wysihtml5.browser.supported()) { - module("wysihtml5.Editor.commands", { +if (wysihtml.browser.supported()) { + module("wysihtml.Editor.commands", { setup: function() { this.editableArea1 = document.createElement("div"); @@ -54,7 +54,7 @@ if (wysihtml5.browser.supported()) { u: true } }, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: parserRules }); @@ -106,7 +106,7 @@ if (wysihtml5.browser.supported()) { asyncTest("Format code", function() { expect(2); var that = this, - editor = new wysihtml5.Editor(this.editableArea1), + editor = new wysihtml.Editor(this.editableArea1), text = "once upon a time there was an unformated text."; editor.on("load", function() { @@ -129,7 +129,7 @@ if (wysihtml5.browser.supported()) { expect(5); var that = this, - editor = new wysihtml5.Editor(this.editableArea1), + editor = new wysihtml.Editor(this.editableArea1), text = "text"; editor.on("load", function() { @@ -183,7 +183,7 @@ if (wysihtml5.browser.supported()) { asyncTest("Create table", function() { expect(1); var that = this, - editor = new wysihtml5.Editor(this.editableArea1), + editor = new wysihtml.Editor(this.editableArea1), text = "test"; editor.on("load", function() { @@ -217,7 +217,7 @@ if (wysihtml5.browser.supported()) { asyncTest("Create lists", function() { expect(7); var that = this, - editor = new wysihtml5.Editor(this.editableArea1), + editor = new wysihtml.Editor(this.editableArea1), text = ""; editor.on("load", function() { @@ -266,7 +266,7 @@ if (wysihtml5.browser.supported()) { asyncTest("Create subscript / superscript", function() { expect(2); var that = this, - editor = new wysihtml5.Editor(this.editableArea1, { + editor = new wysihtml.Editor(this.editableArea1, { parserRules: { tags: { sub: true, diff --git a/test/editor_contenteditablemode_test.js b/test/editor_contenteditablemode_test.js index cb499a9..0df22dc 100644 --- a/test/editor_contenteditablemode_test.js +++ b/test/editor_contenteditablemode_test.js @@ -1,7 +1,7 @@ -if (wysihtml5.browser.supported()) { - module("wysihtml5.Editor contenteditable mode", { +if (wysihtml.browser.supported()) { + module("wysihtml.Editor contenteditable mode", { setup: function() { - wysihtml5.dom.insertCSS([ + wysihtml.dom.insertCSS([ "#wysihtml5-test-editable { width: 50%; height: 100px; margin-top: 5px; font-style: italic; border: 2px solid red; border-radius: 2px; }", "#wysihtml5-test-editable:focus { margin-top: 10px; }", "#wysihtml5-test-editable:disabled { margin-top: 20px; }" @@ -34,14 +34,14 @@ if (wysihtml5.browser.supported()) { asyncTest("Basic test", function() { expect(14); var that = this; - var editor = new wysihtml5.Editor(this.editableArea); + var editor = new wysihtml.Editor(this.editableArea); editor.on("load", function() { var editableElement = that.editableArea; ok(true, "Load callback triggered"); - ok(wysihtml5.dom.hasClass(document.body, "wysihtml5-supported"), " received correct class name"); - ok(wysihtml5.dom.hasClass(editableElement, "wysihtml5-test-class"), "editable kept its original class name"); - ok(wysihtml5.dom.hasClass(editableElement, "wysihtml5-sandbox"), "editable added its own sandbox class name"); + ok(wysihtml.dom.hasClass(document.body, "wysihtml5-supported"), " received correct class name"); + ok(wysihtml.dom.hasClass(editableElement, "wysihtml5-test-class"), "editable kept its original class name"); + ok(wysihtml.dom.hasClass(editableElement, "wysihtml5-sandbox"), "editable added its own sandbox class name"); equal(editor.config.contentEditableMode, true, "contentEditableMode deduced correctly as editable is initiated on non textarea"); equal(editor.config.noTextarea, true, "noTextarea mode deduced correctly as editable is initiated on non textarea"); @@ -51,7 +51,7 @@ if (wysihtml5.browser.supported()) { equal(typeof editor.textarea, "undefined", "Textarea correctly not available on editor instance"); equal(editor.composer.element, editableElement, "contentEditable element available on editor instance"); equal(editableElement.innerHTML.toLowerCase(), "hey tiff, what's up?", "Initial value preserved in editor"); - ok(wysihtml5.dom.hasClass(editableElement, "wysihtml5-editor"), "Editor element has correct class name"); + ok(wysihtml.dom.hasClass(editableElement, "wysihtml5-editor"), "Editor element has correct class name"); equal(typeof editor.synchronizer, "undefined", "Syncronizer correctly not initiated in contenteditable mode"); start(); @@ -63,7 +63,7 @@ if (wysihtml5.browser.supported()) { expect(17); var that = this; - var editor = new wysihtml5.Editor(this.editableArea); + var editor = new wysihtml.Editor(this.editableArea); editor.on("beforeload", function() { ok(true, "'beforeload' event correctly fired"); @@ -108,7 +108,7 @@ if (wysihtml5.browser.supported()) { happen.once(composerElement, {type: "blur"}); happen.once(composerElement, {type: "focusout"}); - equal(wysihtml5.dom.getStyle("margin-top").from(composerElement), "5px", ":focus styles are correctly unset"); + equal(wysihtml.dom.getStyle("margin-top").from(composerElement), "5px", ":focus styles are correctly unset"); editor.fire("custom_event", { type: 'custom_event' }); @@ -121,7 +121,7 @@ if (wysihtml5.browser.supported()) { expect(12); var that = this; - var editor = new wysihtml5.Editor(this.editableArea); + var editor = new wysihtml.Editor(this.editableArea); editor.on("load", function() { var composerElement = that.editableArea; @@ -152,7 +152,7 @@ if (wysihtml5.browser.supported()) { expect(12); var that = this; - var editor = new wysihtml5.Editor(this.editableArea); + var editor = new wysihtml.Editor(this.editableArea); editor.on("load", function() { var composerElement = that.editableArea; @@ -195,32 +195,32 @@ if (wysihtml5.browser.supported()) { this.editableArea.innerHTML = ""; this.editableArea.setAttribute("data-placeholder", "enter text ..."); - var editor = new wysihtml5.Editor(this.editableArea); + var editor = new wysihtml.Editor(this.editableArea); editor.on("load", function() { var composerElement = that.editableArea; - equal(wysihtml5.dom.getTextContent(composerElement), placeholderText, "Placeholder text correctly copied into textarea"); + equal(wysihtml.dom.getTextContent(composerElement), placeholderText, "Placeholder text correctly copied into textarea"); - ok(wysihtml5.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor got 'placeholder' css class"); + ok(wysihtml.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor got 'placeholder' css class"); ok(editor.hasPlaceholderSet(), "'hasPlaceholderSet' returns correct value when placeholder is actually set"); editor.fire("focus:composer"); - equal(wysihtml5.dom.getTextContent(composerElement), "", "Editor is empty after focus"); - ok(!wysihtml5.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); + equal(wysihtml.dom.getTextContent(composerElement), "", "Editor is empty after focus"); + ok(!wysihtml.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); ok(!editor.hasPlaceholderSet(), "'hasPlaceholderSet' returns correct value when placeholder isn't actually set"); editor.fire("blur:composer"); - equal(wysihtml5.dom.getTextContent(composerElement), placeholderText, "Editor restored placeholder text after unfocus"); + equal(wysihtml.dom.getTextContent(composerElement), placeholderText, "Editor restored placeholder text after unfocus"); editor.fire("focus:composer"); - equal(wysihtml5.dom.getTextContent(composerElement), ""); + equal(wysihtml.dom.getTextContent(composerElement), ""); composerElement.innerHTML = "some content"; editor.fire("blur:composer"); - equal(wysihtml5.dom.getTextContent(composerElement), "some content"); - ok(!wysihtml5.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); + equal(wysihtml.dom.getTextContent(composerElement), "some content"); + ok(!wysihtml.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); editor.fire("focus:composer"); // Following html causes innerText and textContent to report an empty string var html = ''; composerElement.innerHTML = html; editor.fire("blur:composer"); equal(composerElement.innerHTML.toLowerCase(), html, "HTML hasn't been cleared even though the innerText and textContent properties indicate empty content."); - ok(!wysihtml5.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); + ok(!wysihtml.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); start(); }); }); @@ -231,7 +231,7 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.editableArea, { + var editor = new wysihtml.Editor(this.editableArea, { parserRules: { tags: { p: { rename_tag: "div" }, "strong": {} } }, classNames: { body: "editor-is-supported", @@ -241,12 +241,12 @@ if (wysihtml5.browser.supported()) { editor.on("load", function() { ok(editor.isCompatible(), "isCompatible() returns correct value"); - ok(wysihtml5.dom.hasClass(document.body, "editor-is-supported"), " received correct class name"); + ok(wysihtml.dom.hasClass(document.body, "editor-is-supported"), " received correct class name"); var composerElement = that.editableArea; editor.clear(); - equal(wysihtml5.dom.getTextContent(composerElement), "", "Editor empty after calling 'clear'"); - ok(wysihtml5.dom.hasClass(composerElement, "editor"), "Composer element has correct class name"); + equal(wysihtml.dom.getTextContent(composerElement), "", "Editor empty after calling 'clear'"); + ok(wysihtml.dom.hasClass(composerElement, "editor"), "Composer element has correct class name"); var html = "hello foo!"; editor.setValue(html); @@ -291,7 +291,7 @@ if (wysihtml5.browser.supported()) { var input = "

    foobar

    ", output = "
    foobar
    "; - var editor = new wysihtml5.Editor(this.editableArea, { + var editor = new wysihtml.Editor(this.editableArea, { parserRules: parserRules }); @@ -318,7 +318,7 @@ if (wysihtml5.browser.supported()) { this.editableArea.innerHTML = input; equal(that.editableArea.innerHTML, input, "Content is set as unclean before editor initiation"); - editor = new wysihtml5.Editor(this.editableArea, { + editor = new wysihtml.Editor(this.editableArea, { parserRules: parserRules }); @@ -340,7 +340,7 @@ if (wysihtml5.browser.supported()) { output = input; - var editor = new wysihtml5.Editor(this.editableArea, { + var editor = new wysihtml.Editor(this.editableArea, { parserRules: parserRules, parser: function(html, config) { if (typeof html !== "string") { @@ -366,7 +366,7 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.editableArea, { + var editor = new wysihtml.Editor(this.editableArea, { parserRules: { tags: { "img": {} } } }); editor.on("load", function() { @@ -401,7 +401,7 @@ if (wysihtml5.browser.supported()) { toolbar.innerHTML = 'bold'; document.body.appendChild(toolbar); - var editor = new wysihtml5.Editor(this.editableArea, { + var editor = new wysihtml.Editor(this.editableArea, { toolbar: toolbar }); @@ -452,7 +452,7 @@ if (wysihtml5.browser.supported()) { asyncTest("If selection borders cross contenteditabel only editable gets modified", function() { expect(3); var that = this, - editor = new wysihtml5.Editor(this.editableArea); + editor = new wysihtml.Editor(this.editableArea); editor.on("load", function() { editor.setValue("foobar", true); @@ -461,8 +461,8 @@ if (wysihtml5.browser.supported()) { window.e = editor; editor.composer.commands.exec('bold'); - ok(wysihtml5.dom.getStyle("font-weight").from(that.editableArea.children[0]) == 700 || wysihtml5.dom.getStyle("font-weight").from(that.editableArea.children[0]) == "bold", "First child has style bold"); - ok(wysihtml5.dom.getStyle("font-weight").from(that.editableArea) == 400 || wysihtml5.dom.getStyle("font-weight").from(that.editableArea) == "normal", "Editable element itself is not bold"); + ok(wysihtml.dom.getStyle("font-weight").from(that.editableArea.children[0]) == 700 || wysihtml.dom.getStyle("font-weight").from(that.editableArea.children[0]) == "bold", "First child has style bold"); + ok(wysihtml.dom.getStyle("font-weight").from(that.editableArea) == 400 || wysihtml.dom.getStyle("font-weight").from(that.editableArea) == "normal", "Editable element itself is not bold"); start(); }); }); diff --git a/test/editor_test.js b/test/editor_test.js index 4be0569..a9c9c4a 100644 --- a/test/editor_test.js +++ b/test/editor_test.js @@ -1,7 +1,7 @@ -if (wysihtml5.browser.supported()) { - module("wysihtml5.Editor", { +if (wysihtml.browser.supported()) { + module("wysihtml.Editor", { setup: function() { - wysihtml5.dom.insertCSS([ + wysihtml.dom.insertCSS([ "#wysihtml5-test-textarea { width: 50%; height: 100px; margin-top: 5px; font-style: italic; border: 2px solid red; border-radius: 2px; }", "#wysihtml5-test-textarea:focus { margin-top: 10px; }", "#wysihtml5-test-textarea:disabled { margin-top: 20px; }" @@ -45,13 +45,13 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("load", function() { var iframeElement = that.getIframeElement(), composerElement = that.getComposerElement(), textareaElement = that.textareaElement; ok(true, "Load callback triggered"); - ok(wysihtml5.dom.hasClass(document.body, "wysihtml5-supported"), " received correct class name"); + ok(wysihtml.dom.hasClass(document.body, "wysihtml5-supported"), " received correct class name"); equal(textareaElement.style.display, "none", "Textarea not visible"); ok(iframeElement.style.display, "", "Editor iFrame is visible"); equal(editor.currentView.name, "composer", "Current view is 'composer'"); @@ -73,17 +73,17 @@ if (wysihtml5.browser.supported()) { equal(composerElement.getAttribute("contentEditable"), "true", "Body element in iframe is editable"); equal(editor.textarea.element, textareaElement, "Textarea correctly available on editor instance"); equal(editor.composer.element, composerElement, "contentEditable element available on editor instance"); - equal(wysihtml5.dom.getStyle("font-style").from(composerElement), "italic", "Correct font-style applied to editor element"); - equal(wysihtml5.dom.getStyle("width").from(iframeElement), "50%", "Correct width applied to iframe"); - equal(wysihtml5.dom.getStyle("height").from(iframeElement), "100px", "Correct height applied to iframe"); + equal(wysihtml.dom.getStyle("font-style").from(composerElement), "italic", "Correct font-style applied to editor element"); + equal(wysihtml.dom.getStyle("width").from(iframeElement), "50%", "Correct width applied to iframe"); + equal(wysihtml.dom.getStyle("height").from(iframeElement), "100px", "Correct height applied to iframe"); if ("borderRadius" in document.createElement("div").style) { expect(19); - ok(wysihtml5.dom.getStyle("border-top-right-radius").from(iframeElement).indexOf("2px") !== -1, "border-radius correctly copied"); + ok(wysihtml.dom.getStyle("border-top-right-radius").from(iframeElement).indexOf("2px") !== -1, "border-radius correctly copied"); } equal(composerElement.innerHTML.toLowerCase(), "hey tiff, what's up?", "Copied the initial textarea value to the editor"); - ok(wysihtml5.dom.hasClass(composerElement, "wysihtml5-editor"), "Editor element has correct class name"); + ok(wysihtml.dom.hasClass(composerElement, "wysihtml5-editor"), "Editor element has correct class name"); start(); }); @@ -97,16 +97,16 @@ if (wysihtml5.browser.supported()) { var that = this, name = "star-wars-input", - editor = new wysihtml5.Editor(this.textareaElement, { name: "star-wars-input" }); + editor = new wysihtml.Editor(this.textareaElement, { name: "star-wars-input" }); editor.on("load", function() { var iframeElement = that.getIframeElement(), composerElement = that.getComposerElement(), textareaElement = that.textareaElement; - ok(wysihtml5.dom.hasClass(iframeElement, name), "iFrame has adopted name as className"); - ok(wysihtml5.dom.hasClass(composerElement, name), "iFrame's body has adopted name as className"); - ok(wysihtml5.dom.hasClass(composerElement, "death-star"), "iFrame's body has adopted the textarea className"); - ok(!wysihtml5.dom.hasClass(textareaElement, name), "Textarea has not adopted name as className"); + ok(wysihtml.dom.hasClass(iframeElement, name), "iFrame has adopted name as className"); + ok(wysihtml.dom.hasClass(composerElement, name), "iFrame's body has adopted name as className"); + ok(wysihtml.dom.hasClass(composerElement, "death-star"), "iFrame's body has adopted the textarea className"); + ok(!wysihtml.dom.hasClass(textareaElement, name), "Textarea has not adopted name as className"); start(); }); }); @@ -117,14 +117,14 @@ if (wysihtml5.browser.supported()) { var that = this; - wysihtml5.dom.setStyles({ + wysihtml.dom.setStyles({ MozBoxSizing: "border-box", WebkitBoxSizing: "border-box", MsBoxSizing: "border-box", boxSizing: "border-box" }).on(this.textareaElement); - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("load", function() { // Make textarea visible for a short amount of time, in order to calculate dimensions properly that.textareaElement.style.display = "block"; @@ -151,7 +151,7 @@ if (wysihtml5.browser.supported()) { this.textareaElement.setAttribute("rows", 20); this.textareaElement.setAttribute("cols", 50); - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("load", function() { ok(that.getIframeElement().style.height.match(/\d+px/), "Rows attribute is correctly converted into a css height"); ok(that.getIframeElement().style.width.match(/\d+px/), "Cols attribute is correctly converted into a css width"); @@ -164,7 +164,7 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("load", function() { equal(that.getComposerElement().title, that.textareaElement.title, "Editor got attributes copied over from textarea"); start(); @@ -177,7 +177,7 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("beforeload", function() { ok(true, "'beforeload' event correctly fired"); @@ -218,7 +218,7 @@ if (wysihtml5.browser.supported()) { composerElement.innerHTML = "foobar"; happen.once(composerElement, {type: "blur"}); happen.once(composerElement, {type: "focusout"}); - equal(wysihtml5.dom.getStyle("margin-top").from(iframeElement), "5px", ":focus styles are correctly unset"); + equal(wysihtml.dom.getStyle("margin-top").from(iframeElement), "5px", ":focus styles are correctly unset"); happen.once(composerElement, {type: "paste"}); happen.once(composerElement, {type: "drop"}); @@ -236,7 +236,7 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("load", function() { var html = "

    hello foobar, what up?

    "; that.getComposerElement().innerHTML = html; @@ -254,7 +254,7 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.textareaElement, { + var editor = new wysihtml.Editor(this.textareaElement, { parserRules: { tags: { "strong": true } } }); @@ -283,7 +283,7 @@ if (wysihtml5.browser.supported()) { // Timeout needed since reset() isn't executed synchronously setTimeout(function() { - equal(wysihtml5.dom.getTextContent(composerElement), "", "Editor is empty after reset"); + equal(wysihtml.dom.getTextContent(composerElement), "", "Editor is empty after reset"); start(); }, 100); @@ -304,38 +304,38 @@ if (wysihtml5.browser.supported()) { this.textareaElement.value = ""; this.textareaElement.setAttribute("placeholder", "enter text ..."); - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("load", function() { var composerElement = that.getComposerElement(); - equal(wysihtml5.dom.getTextContent(composerElement), placeholderText, "Placeholder text correctly copied into textarea"); - ok(wysihtml5.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor got 'placeholder' css class"); + equal(wysihtml.dom.getTextContent(composerElement), placeholderText, "Placeholder text correctly copied into textarea"); + ok(wysihtml.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor got 'placeholder' css class"); ok(editor.hasPlaceholderSet(), "'hasPlaceholderSet' returns correct value when placeholder is actually set"); editor.fire("focus:composer"); - equal(wysihtml5.dom.getTextContent(composerElement), "", "Editor is empty after focus"); - ok(!wysihtml5.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); + equal(wysihtml.dom.getTextContent(composerElement), "", "Editor is empty after focus"); + ok(!wysihtml.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); ok(!editor.hasPlaceholderSet(), "'hasPlaceholderSet' returns correct value when placeholder isn't actually set"); editor.fire("blur:composer"); - equal(wysihtml5.dom.getTextContent(composerElement), placeholderText, "Editor restored placeholder text after unfocus"); + equal(wysihtml.dom.getTextContent(composerElement), placeholderText, "Editor restored placeholder text after unfocus"); editor.fire("focus:composer"); - equal(wysihtml5.dom.getTextContent(composerElement), ""); + equal(wysihtml.dom.getTextContent(composerElement), ""); composerElement.innerHTML = "some content"; editor.fire("blur:composer"); - equal(wysihtml5.dom.getTextContent(composerElement), "some content"); - ok(!wysihtml5.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); + equal(wysihtml.dom.getTextContent(composerElement), "some content"); + ok(!wysihtml.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); editor.fire("focus:composer"); // Following html causes innerText and textContent to report an empty string var html = ''; composerElement.innerHTML = html; editor.fire("blur:composer"); equal(composerElement.innerHTML.toLowerCase(), html, "HTML hasn't been cleared even though the innerText and textContent properties indicate empty content."); - ok(!wysihtml5.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); + ok(!wysihtml.dom.hasClass(composerElement, "wysihtml5-placeholder"), "Editor hasn't got 'placeholder' css class"); setTimeout(function() { that.form.reset(); // Timeout needed since reset() isn't executed synchronously setTimeout(function() { - equal(wysihtml5.dom.getTextContent(composerElement), placeholderText, "After form reset the editor has the placeholder as content"); + equal(wysihtml.dom.getTextContent(composerElement), placeholderText, "After form reset the editor has the placeholder as content"); start(); }, 100); @@ -349,7 +349,7 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.textareaElement, { + var editor = new wysihtml.Editor(this.textareaElement, { parserRules: { tags: { p: { rename_tag: "div" }, "strong": {} } }, classNames: { body: "editor-is-supported", @@ -359,12 +359,12 @@ if (wysihtml5.browser.supported()) { editor.on("load", function() { ok(editor.isCompatible(), "isCompatible() returns correct value"); - ok(wysihtml5.dom.hasClass(document.body, "editor-is-supported"), " received correct class name"); + ok(wysihtml.dom.hasClass(document.body, "editor-is-supported"), " received correct class name"); var composerElement = that.getComposerElement(); editor.clear(); - equal(wysihtml5.dom.getTextContent(composerElement), "", "Editor empty after calling 'clear'"); - ok(wysihtml5.dom.hasClass(composerElement, "editor"), "Composer element has correct class name"); + equal(wysihtml.dom.getTextContent(composerElement), "", "Editor empty after calling 'clear'"); + ok(wysihtml.dom.hasClass(composerElement, "editor"), "Composer element has correct class name"); var html = "hello foo!"; editor.setValue(html); @@ -406,7 +406,7 @@ if (wysihtml5.browser.supported()) { var input = "

    foo

    bar
    ", output = "foo
    bar
    "; - var editor = new wysihtml5.Editor(this.textareaElement, { + var editor = new wysihtml.Editor(this.textareaElement, { parserRules: parserRules }); @@ -437,7 +437,7 @@ if (wysihtml5.browser.supported()) { var input = "

    foobar

    ", output = "
    foobar
    "; - var editor = new wysihtml5.Editor(this.textareaElement, { + var editor = new wysihtml.Editor(this.textareaElement, { parserRules: parserRules }); @@ -458,7 +458,7 @@ if (wysihtml5.browser.supported()) { parserRules = { script: undefined }, input = this.textareaElement.value, output = input; - var editor = new wysihtml5.Editor(this.textareaElement, { + var editor = new wysihtml.Editor(this.textareaElement, { parserRules: parserRules, parser: function(html, config) { equal(html.toLowerCase(), input, "HTML passed into parser is equal to the one which just got inserted"); @@ -485,7 +485,7 @@ if (wysihtml5.browser.supported()) { var that = this; - var editor = new wysihtml5.Editor(this.textareaElement,{ + var editor = new wysihtml.Editor(this.textareaElement,{ parserRules: { tags: { "img": {} } } }); editor.on("load", function() { @@ -519,7 +519,7 @@ if (wysihtml5.browser.supported()) { "http://yui.yahooapis.com/2.8.0/build/reset/reset-min.css" ]; - var editor = new wysihtml5.Editor(this.textareaElement, { + var editor = new wysihtml.Editor(this.textareaElement, { stylesheets: stylesheetUrls }); @@ -542,10 +542,10 @@ if (wysihtml5.browser.supported()) { var that = this; - var originalIsTouchDevice = wysihtml5.browser.isTouchDevice; - wysihtml5.browser.isTouchDevice = function() { return true; }; + var originalIsTouchDevice = wysihtml.browser.isTouchDevice; + wysihtml.browser.isTouchDevice = function() { return true; }; - var editor = new wysihtml5.Editor(this.textareaElement, { + var editor = new wysihtml.Editor(this.textareaElement, { supportTouchDevices: false }); @@ -553,7 +553,7 @@ if (wysihtml5.browser.supported()) { ok(!that.getIframeElement(), "No editor iframe has been inserted"); equal(that.textareaElement.style.display, "", "Textarea is visible"); - wysihtml5.browser.isTouchDevice = originalIsTouchDevice; + wysihtml.browser.isTouchDevice = originalIsTouchDevice; start(); }); @@ -564,7 +564,7 @@ if (wysihtml5.browser.supported()) { var textareaElement = document.createElement("textarea"); document.body.appendChild(textareaElement); - var editor = new wysihtml5.Editor(textareaElement); + var editor = new wysihtml.Editor(textareaElement); var that = this; editor.on("load", function() { @@ -583,12 +583,12 @@ if (wysihtml5.browser.supported()) { this.textareaElement.disabled = true; var that = this; - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("load", function() { var iframeElement = that.getIframeElement(), composerElement = that.getComposerElement(); - equal(wysihtml5.dom.getStyle("margin-top").from(iframeElement), "20px", "Correct :disabled styles applied"); + equal(wysihtml.dom.getStyle("margin-top").from(iframeElement), "20px", "Correct :disabled styles applied"); ok(!composerElement.hasAttribute("contentEditable"), "Editor is unfocusable"); start(); }); diff --git a/test/incompatible_test.js b/test/incompatible_test.js index e36f675..3e9e698 100644 --- a/test/incompatible_test.js +++ b/test/incompatible_test.js @@ -1,14 +1,14 @@ module("wysihtml5 - Incompatible", { setup: function() { - this.originalSupportCheck = wysihtml5.browser.supported; - wysihtml5.browser.supported = function() { return false; }; + this.originalSupportCheck = wysihtml.browser.supported; + wysihtml.browser.supported = function() { return false; }; this.textareaElement = document.createElement("textarea"); document.body.appendChild(this.textareaElement); }, teardown: function() { - wysihtml5.browser.supported = this.originalSupportCheck; + wysihtml.browser.supported = this.originalSupportCheck; this.textareaElement.parentNode.removeChild(this.textareaElement); } }); @@ -23,10 +23,10 @@ asyncTest("Basic test", function() { var oldInputsLength = document.getElementsByTagName("input").length; - var editor = new wysihtml5.Editor(this.textareaElement); + var editor = new wysihtml.Editor(this.textareaElement); editor.on("load", function() { ok(true, "'load' event correctly triggered"); - ok(!wysihtml5.dom.hasClass(document.body, "wysihtml5-supported"), " didn't receive the 'wysihtml5-supported' class"); + ok(!wysihtml.dom.hasClass(document.body, "wysihtml5-supported"), " didn't receive the 'wysihtml5-supported' class"); ok(!editor.isCompatible(), "isCompatible returns false when rich text editing is not correctly supported in the current browser"); equal(that.textareaElement.style.display, "", "Textarea is visible"); ok(!editor.composer, "Composer not initialized"); @@ -54,7 +54,7 @@ asyncTest("Basic test", function() { }); var eventOptions = {}; - eventOptions.type = wysihtml5.browser.supportsEvent("focusin") ? "focusin" : "focus"; + eventOptions.type = wysihtml.browser.supportsEvent("focusin") ? "focusin" : "focus"; happen.once(that.textareaElement, eventOptions); start(); diff --git a/test/index.html b/test/index.html index dd50645..b7cdb95 100644 --- a/test/index.html +++ b/test/index.html @@ -13,7 +13,7 @@ - + @@ -72,34 +72,17 @@ - - + - - - - - - - - - - - - - - - - @@ -107,10 +90,6 @@ - - - - @@ -133,12 +112,21 @@ + + + + + + + + + - */ -(function(wysihtml) { - var /** - * Don't auto-link urls that are contained in the following elements: - */ - IGNORE_URLS_IN = wysihtml.lang.array(["CODE", "PRE", "A", "SCRIPT", "HEAD", "TITLE", "STYLE"]), - /** - * revision 1: - * /(\S+\.{1}[^\s\,\.\!]+)/g - * - * revision 2: - * /(\b(((https?|ftp):\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;\[\]]*[-A-Z0-9+&@#\/%=~_|])/gim - * - * put this in the beginning if you don't wan't to match within a word - * (^|[\>\(\{\[\s\>]) - */ - URL_REG_EXP = /((https?:\/\/|www\.)[^\s<]{3,})/gi, - TRAILING_CHAR_REG_EXP = /([^\w\/\-](,?))$/i, - MAX_DISPLAY_LENGTH = 100, - BRACKETS = { ")": "(", "]": "[", "}": "{" }; - - function autoLink(element, ignoreInClasses) { - if (_hasParentThatShouldBeIgnored(element, ignoreInClasses)) { - return element; - } - - if (element === element.ownerDocument.documentElement) { - element = element.ownerDocument.body; - } - - return _parseNode(element, ignoreInClasses); - } - - /** - * This is basically a rebuild of - * the rails auto_link_urls text helper - */ - function _convertUrlsToLinks(str) { - return str.replace(URL_REG_EXP, function(match, url) { - var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || "", - opening = BRACKETS[punctuation]; - url = url.replace(TRAILING_CHAR_REG_EXP, ""); - - if (url.split(opening).length > url.split(punctuation).length) { - url = url + punctuation; - punctuation = ""; - } - var realUrl = url, - displayUrl = url; - if (url.length > MAX_DISPLAY_LENGTH) { - displayUrl = displayUrl.substr(0, MAX_DISPLAY_LENGTH) + "..."; - } - // Add http prefix if necessary - if (realUrl.substr(0, 4) === "www.") { - realUrl = "http://" + realUrl; - } - - return '' + displayUrl + '' + punctuation; - }); - } - - /** - * Creates or (if already cached) returns a temp element - * for the given document object - */ - function _getTempElement(context) { - var tempElement = context._wysihtml5_tempElement; - if (!tempElement) { - tempElement = context._wysihtml5_tempElement = context.createElement("div"); - } - return tempElement; - } - - /** - * Replaces the original text nodes with the newly auto-linked dom tree - */ - function _wrapMatchesInNode(textNode) { - var parentNode = textNode.parentNode, - nodeValue = wysihtml.lang.string(textNode.data).escapeHTML(), - tempElement = _getTempElement(parentNode.ownerDocument); - - // We need to insert an empty/temporary to fix IE quirks - // Elsewise IE would strip white space in the beginning - tempElement.innerHTML = "" + _convertUrlsToLinks(nodeValue); - tempElement.removeChild(tempElement.firstChild); - - while (tempElement.firstChild) { - // inserts tempElement.firstChild before textNode - parentNode.insertBefore(tempElement.firstChild, textNode); - } - parentNode.removeChild(textNode); - } - - function _hasParentThatShouldBeIgnored(node, ignoreInClasses) { - var nodeName; - while (node.parentNode) { - node = node.parentNode; - nodeName = node.nodeName; - if (node.className && wysihtml.lang.array(node.className.split(' ')).contains(ignoreInClasses)) { - return true; - } - if (IGNORE_URLS_IN.contains(nodeName)) { - return true; - } else if (nodeName === "body") { - return false; - } - } - return false; - } - - function _parseNode(element, ignoreInClasses) { - if (IGNORE_URLS_IN.contains(element.nodeName)) { - return; - } - - if (element.className && wysihtml.lang.array(element.className.split(' ')).contains(ignoreInClasses)) { - return; - } - - if (element.nodeType === wysihtml.TEXT_NODE && element.data.match(URL_REG_EXP)) { - _wrapMatchesInNode(element); - return; - } - - var childNodes = wysihtml.lang.array(element.childNodes).get(), - childNodesLength = childNodes.length, - i = 0; - - for (; i 0 && (elementClassName == className || new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); - }; -})(wysihtml); -;wysihtml.dom.contains = (function() { - var documentElement = document.documentElement; - if (documentElement.contains) { - return function(container, element) { - if (element.nodeType !== wysihtml.ELEMENT_NODE) { - if (element.parentNode === container) { - return true; - } - element = element.parentNode; - } - return container !== element && container.contains(element); - }; - } else if (documentElement.compareDocumentPosition) { - return function(container, element) { - // https://developer.mozilla.org/en/DOM/Node.compareDocumentPosition - return !!(container.compareDocumentPosition(element) & 16); - }; - } -})(); -;/** - * Converts an HTML fragment/element into a unordered/ordered list - * - * @param {Element} element The element which should be turned into a list - * @param {String} listType The list type in which to convert the tree (either "ul" or "ol") - * @return {Element} The created list - * - * @example - * - * - * eminem
    - * dr. dre - *
    50 Cent
    - *
    - * - * - * - * - *
      - *
    • eminem
    • - *
    • dr. dre
    • - *
    • 50 Cent
    • - *
    - */ -wysihtml.dom.convertToList = (function() { - function _createListItem(doc, list) { - var listItem = doc.createElement("li"); - list.appendChild(listItem); - return listItem; - } - - function _createList(doc, type) { - return doc.createElement(type); - } - - function convertToList(element, listType, uneditableClass) { - if (element.nodeName === "UL" || element.nodeName === "OL" || element.nodeName === "MENU") { - // Already a list - return element; - } - - var doc = element.ownerDocument, - list = _createList(doc, listType), - lineBreaks = element.querySelectorAll("br"), - lineBreaksLength = lineBreaks.length, - childNodes, - childNodesLength, - childNode, - lineBreak, - parentNode, - isBlockElement, - isLineBreak, - currentListItem, - i; - - // First find
    at the end of inline elements and move them behind them - for (i=0; i if empty, otherwise create a new one - currentListItem = currentListItem.firstChild ? _createListItem(doc, list) : currentListItem; - currentListItem.appendChild(childNode); - currentListItem = null; - continue; - } - - if (isLineBreak) { - // Only create a new list item in the next iteration when the current one has already content - currentListItem = currentListItem.firstChild ? null : currentListItem; - continue; - } - - currentListItem.appendChild(childNode); - } - - if (childNodes.length === 0) { - _createListItem(doc, list); - } - - element.parentNode.replaceChild(list, element); - return list; - } - - return convertToList; -})(); -;/** - * Copy a set of attributes from one element to another - * - * @param {Array} attributesToCopy List of attributes which should be copied - * @return {Object} Returns an object which offers the "from" method which can be invoked with the element where to - * copy the attributes from., this again returns an object which provides a method named "to" which can be invoked - * with the element where to copy the attributes to (see example) - * - * @example - * var textarea = document.querySelector("textarea"), - * div = document.querySelector("div[contenteditable=true]"), - * anotherDiv = document.querySelector("div.preview"); - * wysihtml.dom.copyAttributes(["spellcheck", "value", "placeholder"]).from(textarea).to(div).andTo(anotherDiv); - * - */ -wysihtml.dom.copyAttributes = function(attributesToCopy) { - return { - from: function(elementToCopyFrom) { - return { - to: function(elementToCopyTo) { - var attribute, - i = 0, - length = attributesToCopy.length; - for (; i 0) { - var hasOneStyle = false, - styles = (Array.isArray(properties.styleProperty)) ? properties.styleProperty : [properties.styleProperty]; - for (var j = 0, maxStyleP = styles.length; j < maxStyleP; j++) { - // Some old IE-s have different property name for cssFloat - prop = wysihtml.browser.fixStyleKey(styles[j]); - if (node.style[prop]) { - if (properties.styleValue) { - // Style value as additional parameter - if (properties.styleValue instanceof RegExp) { - // style value as Regexp - if (node.style[prop].trim().match(properties.styleValue).length > 0) { - hasOneStyle = true; - break; - } - } else if (Array.isArray(properties.styleValue)) { - // style value as array - if (properties.styleValue.indexOf(node.style[prop].trim())) { - hasOneStyle = true; - break; - } - } else { - // style value as string - if (properties.styleValue === node.style[prop].trim().replace(/, /g, ",")) { - hasOneStyle = true; - break; - } - } - } else { - hasOneStyle = true; - break; - } - } - if (!hasOneStyle) { - return false; - } - } - } - - if (properties.attribute) { - var attr = wysihtml.dom.getAttributes(node), - attrList = [], - hasOneAttribute = false; - - if (Array.isArray(properties.attribute)) { - attrList = properties.attribute; - } else { - attrList[properties.attribute] = properties.attributeValue; - } - - for (var a in attrList) { - if (attrList.hasOwnProperty(a)) { - if (typeof attrList[a] === "undefined") { - if (typeof attr[a] !== "undefined") { - hasOneAttribute = true; - break; - } - } else if (attr[a] === attrList[a]) { - hasOneAttribute = true; - break; - } - } - } - - if (!hasOneAttribute) { - return false; - } - - } - - return true; - } - - }; - }; -})(wysihtml); -;/** - * Returns the given html wrapped in a div element - * - * Fixing IE's inability to treat unknown elements (HTML5 section, article, ...) correctly - * when inserted via innerHTML - * - * @param {String} html The html which should be wrapped in a dom element - * @param {Obejct} [context] Document object of the context the html belongs to - * - * @example - * wysihtml.dom.getAsDom("
    foo
    "); - */ -wysihtml.dom.getAsDom = (function() { - - var _innerHTMLShiv = function(html, context) { - var tempElement = context.createElement("div"); - tempElement.style.display = "none"; - context.body.appendChild(tempElement); - // IE throws an exception when trying to insert via innerHTML - try { tempElement.innerHTML = html; } catch(e) {} - context.body.removeChild(tempElement); - return tempElement; - }; - - /** - * Make sure IE supports HTML5 tags, which is accomplished by simply creating one instance of each element - */ - var _ensureHTML5Compatibility = function(context) { - if (context._wysihtml5_supportsHTML5Tags) { - return; - } - for (var i=0, length=HTML5_ELEMENTS.length; i "block" - */ -wysihtml.dom.getStyle = (function() { - var stylePropertyMapping = { - "float": ("styleFloat" in document.createElement("div").style) ? "styleFloat" : "cssFloat" - }, - REG_EXP_CAMELIZE = /\-[a-z]/g; - - function camelize(str) { - return str.replace(REG_EXP_CAMELIZE, function(match) { - return match.charAt(1).toUpperCase(); - }); - } - - return function(property) { - return { - from: function(element) { - if (element.nodeType !== wysihtml.ELEMENT_NODE) { - return; - } - - var doc = element.ownerDocument, - camelizedProperty = stylePropertyMapping[property] || camelize(property), - style = element.style, - currentStyle = element.currentStyle, - styleValue = style[camelizedProperty]; - if (styleValue) { - return styleValue; - } - - // currentStyle is no standard and only supported by Opera and IE but it has one important advantage over the standard-compliant - // window.getComputedStyle, since it returns css property values in their original unit: - // If you set an elements width to "50%", window.getComputedStyle will give you it's current width in px while currentStyle - // gives you the original "50%". - // Opera supports both, currentStyle and window.getComputedStyle, that's why checking for currentStyle should have higher prio - if (currentStyle) { - try { - return currentStyle[camelizedProperty]; - } catch(e) { - //ie will occasionally fail for unknown reasons. swallowing exception - } - } - - var win = doc.defaultView || doc.parentWindow, - needsOverflowReset = (property === "height" || property === "width") && element.nodeName === "TEXTAREA", - originalOverflow, - returnValue; - - if (win.getComputedStyle) { - // Chrome and Safari both calculate a wrong width and height for textareas when they have scroll bars - // therfore we remove and restore the scrollbar and calculate the value in between - if (needsOverflowReset) { - originalOverflow = style.overflow; - style.overflow = "hidden"; - } - returnValue = win.getComputedStyle(element, null).getPropertyValue(property); - if (needsOverflowReset) { - style.overflow = originalOverflow || ""; - } - return returnValue; - } - } - }; - }; -})(); -;wysihtml.dom.getTextNodes = function(node, ingoreEmpty){ - var all = []; - for (node=node.firstChild;node;node=node.nextSibling){ - if (node.nodeType == 3) { - if (!ingoreEmpty || !(/^\s*$/).test(node.innerText || node.textContent)) { - all.push(node); - } - } else { - all = all.concat(wysihtml.dom.getTextNodes(node, ingoreEmpty)); - } - } - return all; -}; -;/** - * High performant way to check whether an element with a specific tag name is in the given document - * Optimized for being heavily executed - * Unleashes the power of live node lists - * - * @param {Object} doc The document object of the context where to check - * @param {String} tagName Upper cased tag name - * @example - * wysihtml.dom.hasElementWithTagName(document, "IMG"); - */ -wysihtml.dom.hasElementWithTagName = (function() { - var LIVE_CACHE = {}, - DOCUMENT_IDENTIFIER = 1; - - function _getDocumentIdentifier(doc) { - return doc._wysihtml5_identifier || (doc._wysihtml5_identifier = DOCUMENT_IDENTIFIER++); - } - - return function(doc, tagName) { - var key = _getDocumentIdentifier(doc) + ":" + tagName, - cacheEntry = LIVE_CACHE[key]; - if (!cacheEntry) { - cacheEntry = LIVE_CACHE[key] = doc.getElementsByTagName(tagName); - } - - return cacheEntry.length > 0; - }; -})(); -;/** - * High performant way to check whether an element with a specific class name is in the given document - * Optimized for being heavily executed - * Unleashes the power of live node lists - * - * @param {Object} doc The document object of the context where to check - * @param {String} tagName Upper cased tag name - * @example - * wysihtml.dom.hasElementWithClassName(document, "foobar"); - */ -(function(wysihtml) { - var LIVE_CACHE = {}, - DOCUMENT_IDENTIFIER = 1; - - function _getDocumentIdentifier(doc) { - return doc._wysihtml5_identifier || (doc._wysihtml5_identifier = DOCUMENT_IDENTIFIER++); - } - - wysihtml.dom.hasElementWithClassName = function(doc, className) { - // getElementsByClassName is not supported by IE<9 - // but is sometimes mocked via library code (which then doesn't return live node lists) - if (!wysihtml.browser.supportsNativeGetElementsByClassName()) { - return !!doc.querySelector("." + className); - } - - var key = _getDocumentIdentifier(doc) + ":" + className, - cacheEntry = LIVE_CACHE[key]; - if (!cacheEntry) { - cacheEntry = LIVE_CACHE[key] = doc.getElementsByClassName(className); - } - - return cacheEntry.length > 0; - }; -})(wysihtml); -;wysihtml.dom.insert = function(elementToInsert) { - return { - after: function(element) { - element.parentNode.insertBefore(elementToInsert, element.nextSibling); - }, - - before: function(element) { - element.parentNode.insertBefore(elementToInsert, element); - }, - - into: function(element) { - element.appendChild(elementToInsert); - } - }; -}; -;wysihtml.dom.insertCSS = function(rules) { - rules = rules.join("\n"); - - return { - into: function(doc) { - var styleElement = doc.createElement("style"); - styleElement.type = "text/css"; - - if (styleElement.styleSheet) { - styleElement.styleSheet.cssText = rules; - } else { - styleElement.appendChild(doc.createTextNode(rules)); - } - - var link = doc.querySelector("head link"); - if (link) { - link.parentNode.insertBefore(styleElement, link); - return; - } else { - var head = doc.querySelector("head"); - if (head) { - head.appendChild(styleElement); - } - } - } - }; -}; -;// TODO: Refactor dom tree traversing here -(function(wysihtml) { - wysihtml.dom.lineBreaks = function(node) { - - function _isLineBreak(n) { - return n.nodeName === "BR"; - } - - /** - * Checks whether the elment causes a visual line break - * (
    or block elements) - */ - function _isLineBreakOrBlockElement(element) { - if (_isLineBreak(element)) { - return true; - } - - if (wysihtml.dom.getStyle("display").from(element) === "block") { - return true; - } - - return false; - } - - return { - - /* wysihtml.dom.lineBreaks(element).add(); - * - * Adds line breaks before and after the given node if the previous and next siblings - * aren't already causing a visual line break (block element or
    ) - */ - add: function(options) { - var doc = node.ownerDocument, - nextSibling = wysihtml.dom.domNode(node).next({ignoreBlankTexts: true}), - previousSibling = wysihtml.dom.domNode(node).prev({ignoreBlankTexts: true}); - - if (nextSibling && !_isLineBreakOrBlockElement(nextSibling)) { - wysihtml.dom.insert(doc.createElement("br")).after(node); - } - if (previousSibling && !_isLineBreakOrBlockElement(previousSibling)) { - wysihtml.dom.insert(doc.createElement("br")).before(node); - } - }, - - /* wysihtml.dom.lineBreaks(element).remove(); - * - * Removes line breaks before and after the given node - */ - remove: function(options) { - var nextSibling = wysihtml.dom.domNode(node).next({ignoreBlankTexts: true}), - previousSibling = wysihtml.dom.domNode(node).prev({ignoreBlankTexts: true}); - - if (nextSibling && _isLineBreak(nextSibling)) { - nextSibling.parentNode.removeChild(nextSibling); - } - if (previousSibling && _isLineBreak(previousSibling)) { - previousSibling.parentNode.removeChild(previousSibling); - } - } - }; - }; -})(wysihtml);;/** - * Method to set dom events - * - * @example - * wysihtml.dom.observe(iframe.contentWindow.document.body, ["focus", "blur"], function() { ... }); - */ -wysihtml.dom.observe = function(element, eventNames, handler) { - eventNames = typeof(eventNames) === "string" ? [eventNames] : eventNames; - - var handlerWrapper, - eventName, - i = 0, - length = eventNames.length; - - for (; i
    foo bar
    - * - * var userHTML = '
    I'm a table!
    '; - * wysihtml.dom.parse(userHTML); - * // => 'I'm a table!' - * - * var userHTML = '
    foobar
    foobar
    '; - * wysihtml.dom.parse(userHTML, { - * tags: { - * div: undefined, - * br: true - * } - * }); - * // => '' - * - * var userHTML = '
    foo
    bar
    '; - * wysihtml.dom.parse(userHTML, { - * classes: { - * red: 1, - * green: 1 - * }, - * tags: { - * div: { - * rename_tag: "p" - * } - * } - * }); - * // => '

    foo

    bar

    ' - */ - -wysihtml.dom.parse = function(elementOrHtml_current, config_current) { - /* TODO: Currently escaped module pattern as otherwise folloowing default swill be shared among multiple editors. - * Refactor whole code as this method while workind is kind of awkward too */ - - /** - * It's not possible to use a XMLParser/DOMParser as HTML5 is not always well-formed XML - * new DOMParser().parseFromString('') will cause a parseError since the - * node isn't closed - * - * Therefore we've to use the browser's ordinary HTML parser invoked by setting innerHTML. - */ - var NODE_TYPE_MAPPING = { - "1": _handleElement, - "3": _handleText, - "8": _handleComment - }, - // Rename unknown tags to this - DEFAULT_NODE_NAME = "span", - WHITE_SPACE_REG_EXP = /\s+/, - defaultRules = { tags: {}, classes: {} }, - currentRules = {}, - blockElements = ["ADDRESS" ,"BLOCKQUOTE" ,"CENTER" ,"DIR" ,"DIV" ,"DL" ,"FIELDSET" , - "FORM", "H1" ,"H2" ,"H3" ,"H4" ,"H5" ,"H6" ,"ISINDEX" ,"MENU", - "NOFRAMES", "NOSCRIPT" ,"OL" ,"P" ,"PRE","TABLE", "UL"]; - - /** - * Iterates over all childs of the element, recreates them, appends them into a document fragment - * which later replaces the entire body content - */ - function parse(elementOrHtml, config) { - wysihtml.lang.object(currentRules).merge(defaultRules).merge(config.rules).get(); - - var context = config.context || elementOrHtml.ownerDocument || document, - fragment = context.createDocumentFragment(), - isString = typeof(elementOrHtml) === "string", - clearInternals = false, - element, - newNode, - firstChild; - - if (config.clearInternals === true) { - clearInternals = true; - } - - if (isString) { - element = wysihtml.dom.getAsDom(elementOrHtml, context); - } else { - element = elementOrHtml; - } - - if (currentRules.selectors) { - _applySelectorRules(element, currentRules.selectors); - } - - while (element.firstChild) { - firstChild = element.firstChild; - newNode = _convert(firstChild, config.cleanUp, clearInternals, config.uneditableClass); - if (newNode) { - fragment.appendChild(newNode); - } - if (firstChild !== newNode) { - element.removeChild(firstChild); - } - } - - if (config.unjoinNbsps) { - // replace joined non-breakable spaces with unjoined - var txtnodes = wysihtml.dom.getTextNodes(fragment); - for (var n = txtnodes.length; n--;) { - txtnodes[n].nodeValue = txtnodes[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi, "$1 "); - } - } - - // Clear element contents - element.innerHTML = ""; - - // Insert new DOM tree - element.appendChild(fragment); - - return isString ? wysihtml.quirks.getCorrectInnerHTML(element) : element; - } - - function _convert(oldNode, cleanUp, clearInternals, uneditableClass) { - var oldNodeType = oldNode.nodeType, - oldChilds = oldNode.childNodes, - oldChildsLength = oldChilds.length, - method = NODE_TYPE_MAPPING[oldNodeType], - i = 0, - fragment, - newNode, - newChild, - nodeDisplay; - - // Passes directly elemets with uneditable class - if (uneditableClass && oldNodeType === 1 && wysihtml.dom.hasClass(oldNode, uneditableClass)) { - return oldNode; - } - - newNode = method && method(oldNode, clearInternals); - - // Remove or unwrap node in case of return value null or false - if (!newNode) { - if (newNode === false) { - // false defines that tag should be removed but contents should remain (unwrap) - fragment = oldNode.ownerDocument.createDocumentFragment(); - - for (i = oldChildsLength; i--;) { - if (oldChilds[i]) { - newChild = _convert(oldChilds[i], cleanUp, clearInternals, uneditableClass); - if (newChild) { - if (oldChilds[i] === newChild) { - i--; - } - fragment.insertBefore(newChild, fragment.firstChild); - } - } - } - - nodeDisplay = wysihtml.dom.getStyle("display").from(oldNode); - - if (nodeDisplay === '') { - // Handle display style when element not in dom - nodeDisplay = wysihtml.lang.array(blockElements).contains(oldNode.tagName) ? "block" : ""; - } - if (wysihtml.lang.array(["block", "flex", "table"]).contains(nodeDisplay)) { - fragment.appendChild(oldNode.ownerDocument.createElement("br")); - } - - // TODO: try to minimize surplus spaces - if (wysihtml.lang.array([ - "div", "pre", "p", - "table", "td", "th", - "ul", "ol", "li", - "dd", "dl", - "footer", "header", "section", - "h1", "h2", "h3", "h4", "h5", "h6" - ]).contains(oldNode.nodeName.toLowerCase()) && oldNode.parentNode.lastChild !== oldNode) { - // add space at first when unwraping non-textflow elements - if (!oldNode.nextSibling || oldNode.nextSibling.nodeType !== 3 || !(/^\s/).test(oldNode.nextSibling.nodeValue)) { - fragment.appendChild(oldNode.ownerDocument.createTextNode(" ")); - } - } - - if (fragment.normalize) { - fragment.normalize(); - } - return fragment; - } else { - // Remove - return null; - } - } - - // Converts all childnodes - for (i=0; i elements - if (cleanUp && - newNode.nodeName.toLowerCase() === DEFAULT_NODE_NAME && - (!newNode.childNodes.length || - ((/^\s*$/gi).test(newNode.innerHTML) && (clearInternals || (oldNode.className !== "_wysihtml5-temp-placeholder" && oldNode.className !== "rangySelectionBoundary"))) || - !newNode.attributes.length) - ) { - fragment = newNode.ownerDocument.createDocumentFragment(); - while (newNode.firstChild) { - fragment.appendChild(newNode.firstChild); - } - if (fragment.normalize) { - fragment.normalize(); - } - return fragment; - } - - if (newNode.normalize) { - newNode.normalize(); - } - return newNode; - } - - function _applySelectorRules (element, selectorRules) { - var sel, method, els; - - for (sel in selectorRules) { - if (selectorRules.hasOwnProperty(sel)) { - if (wysihtml.lang.object(selectorRules[sel]).isFunction()) { - method = selectorRules[sel]; - } else if (typeof(selectorRules[sel]) === "string" && elementHandlingMethods[selectorRules[sel]]) { - method = elementHandlingMethods[selectorRules[sel]]; - } - els = element.querySelectorAll(sel); - for (var i = els.length; i--;) { - method(els[i]); - } - } - } - } - - function _handleElement(oldNode, clearInternals) { - var rule, - newNode, - tagRules = currentRules.tags, - nodeName = oldNode.nodeName.toLowerCase(), - scopeName = oldNode.scopeName, - renameTag; - - /** - * We already parsed that element - * ignore it! (yes, this sometimes happens in IE8 when the html is invalid) - */ - if (oldNode._wysihtml5) { - return null; - } - oldNode._wysihtml5 = 1; - - if (oldNode.className === "wysihtml5-temp") { - return null; - } - - /** - * IE is the only browser who doesn't include the namespace in the - * nodeName, that's why we have to prepend it by ourselves - * scopeName is a proprietary IE feature - * read more here http://msdn.microsoft.com/en-us/library/ms534388(v=vs.85).aspx - */ - if (scopeName && scopeName != "HTML") { - nodeName = scopeName + ":" + nodeName; - } - /** - * Repair node - * IE is a bit bitchy when it comes to invalid nested markup which includes unclosed tags - * A

    doesn't need to be closed according HTML4-5 spec, we simply replace it with a

    to preserve its content and layout - */ - if ("outerHTML" in oldNode) { - if (!wysihtml.browser.autoClosesUnclosedTags() && - oldNode.nodeName === "P" && - oldNode.outerHTML.slice(-4).toLowerCase() !== "

    ") { - nodeName = "div"; - } - } - - if (nodeName in tagRules) { - rule = tagRules[nodeName]; - if (!rule || rule.remove) { - return null; - } else if (rule.unwrap) { - return false; - } - rule = typeof(rule) === "string" ? { rename_tag: rule } : rule; - } else if (oldNode.firstChild) { - rule = { rename_tag: DEFAULT_NODE_NAME }; - } else { - // Remove empty unknown elements - return null; - } - - // tests if type condition is met or node should be removed/unwrapped/renamed - if (rule.one_of_type && !_testTypes(oldNode, currentRules, rule.one_of_type, clearInternals)) { - if (rule.remove_action) { - if (rule.remove_action === "unwrap") { - return false; - } else if (rule.remove_action === "rename") { - renameTag = rule.remove_action_rename_to || DEFAULT_NODE_NAME; - } else { - return null; - } - } else { - return null; - } - } - - newNode = oldNode.ownerDocument.createElement(renameTag || rule.rename_tag || nodeName); - _handleAttributes(oldNode, newNode, rule, clearInternals); - _handleStyles(oldNode, newNode, rule); - - oldNode = null; - - if (newNode.normalize) { newNode.normalize(); } - return newNode; - } - - function _testTypes(oldNode, rules, types, clearInternals) { - var definition, type; - - // do not interfere with placeholder span or pasting caret position is not maintained - if (oldNode.nodeName === "SPAN" && !clearInternals && (oldNode.className === "_wysihtml5-temp-placeholder" || oldNode.className === "rangySelectionBoundary")) { - return true; - } - - for (type in types) { - if (types.hasOwnProperty(type) && rules.type_definitions && rules.type_definitions[type]) { - definition = rules.type_definitions[type]; - if (_testType(oldNode, definition)) { - return true; - } - } - } - return false; - } - - function array_contains(a, obj) { - var i = a.length; - while (i--) { - if (a[i] === obj) { - return true; - } - } - return false; - } - - function _testType(oldNode, definition) { - - var nodeClasses = oldNode.getAttribute("class"), - nodeStyles = oldNode.getAttribute("style"), - classesLength, s, s_corrected, a, attr, currentClass, styleProp; - - // test for methods - if (definition.methods) { - for (var m in definition.methods) { - if (definition.methods.hasOwnProperty(m) && typeCeckMethods[m]) { - - if (typeCeckMethods[m](oldNode)) { - return true; - } - } - } - } - - // test for classes, if one found return true - if (nodeClasses && definition.classes) { - nodeClasses = nodeClasses.replace(/^\s+/g, '').replace(/\s+$/g, '').split(WHITE_SPACE_REG_EXP); - classesLength = nodeClasses.length; - for (var i = 0; i < classesLength; i++) { - if (definition.classes[nodeClasses[i]]) { - return true; - } - } - } - - // test for styles, if one found return true - if (nodeStyles && definition.styles) { - - nodeStyles = nodeStyles.split(';'); - for (s in definition.styles) { - if (definition.styles.hasOwnProperty(s)) { - for (var sp = nodeStyles.length; sp--;) { - styleProp = nodeStyles[sp].split(':'); - - if (styleProp[0].replace(/\s/g, '').toLowerCase() === s) { - if (definition.styles[s] === true || definition.styles[s] === 1 || wysihtml.lang.array(definition.styles[s]).contains(styleProp[1].replace(/\s/g, '').toLowerCase()) ) { - return true; - } - } - } - } - } - } - - // test for attributes in general against regex match - if (definition.attrs) { - for (a in definition.attrs) { - if (definition.attrs.hasOwnProperty(a)) { - attr = wysihtml.dom.getAttribute(oldNode, a); - if (typeof(attr) === "string") { - if (attr.search(definition.attrs[a]) > -1) { - return true; - } - } - } - } - } - return false; - } - - function _handleStyles(oldNode, newNode, rule) { - var s, v; - if(rule && rule.keep_styles) { - for (s in rule.keep_styles) { - if (rule.keep_styles.hasOwnProperty(s)) { - v = (s === "float") ? oldNode.style.styleFloat || oldNode.style.cssFloat : oldNode.style[s]; - // value can be regex and if so should match or style skipped - if (rule.keep_styles[s] instanceof RegExp && !(rule.keep_styles[s].test(v))) { - continue; - } - if (s === "float") { - // IE compability - newNode.style[(oldNode.style.styleFloat) ? 'styleFloat': 'cssFloat'] = v; - } else if (oldNode.style[s]) { - newNode.style[s] = v; - } - } - } - } - }; - - function _getAttributesBeginningWith(beginning, attributes) { - var returnAttributes = []; - for (var attr in attributes) { - if (attributes.hasOwnProperty(attr) && attr.indexOf(beginning) === 0) { - returnAttributes.push(attr); - } - } - return returnAttributes; - } - - function _checkAttribute(attributeName, attributeValue, methodName, nodeName) { - var method = wysihtml.lang.object(methodName).isFunction() ? methodName : attributeCheckMethods[methodName], - newAttributeValue; - - if (method) { - newAttributeValue = method(attributeValue, nodeName); - if (typeof(newAttributeValue) === "string") { - return newAttributeValue; - } - } - - return false; - } - - function _checkAttributes(oldNode, local_attributes) { - var globalAttributes = wysihtml.lang.object(currentRules.attributes || {}).clone(), // global values for check/convert values of attributes - checkAttributes = wysihtml.lang.object(globalAttributes).merge( wysihtml.lang.object(local_attributes || {}).clone()).get(), - attributes = {}, - oldAttributes = wysihtml.dom.getAttributes(oldNode), - attributeName, newValue, matchingAttributes; - - for (attributeName in checkAttributes) { - if ((/\*$/).test(attributeName)) { - - matchingAttributes = _getAttributesBeginningWith(attributeName.slice(0,-1), oldAttributes); - for (var i = 0, imax = matchingAttributes.length; i < imax; i++) { - - newValue = _checkAttribute(matchingAttributes[i], oldAttributes[matchingAttributes[i]], checkAttributes[attributeName], oldNode.nodeName); - if (newValue !== false) { - attributes[matchingAttributes[i]] = newValue; - } - } - } else { - newValue = _checkAttribute(attributeName, oldAttributes[attributeName], checkAttributes[attributeName], oldNode.nodeName); - if (newValue !== false) { - attributes[attributeName] = newValue; - } - } - } - - return attributes; - } - - // TODO: refactor. Too long to read - function _handleAttributes(oldNode, newNode, rule, clearInternals) { - var attributes = {}, // fresh new set of attributes to set on newNode - setClass = rule.set_class, // classes to set - addClass = rule.add_class, // add classes based on existing attributes - addStyle = rule.add_style, // add styles based on existing attributes - setAttributes = rule.set_attributes, // attributes to set on the current node - allowedClasses = currentRules.classes, - i = 0, - classes = [], - styles = [], - newClasses = [], - oldClasses = [], - classesLength, - newClassesLength, - currentClass, - newClass, - attributeName, - method; - - if (setAttributes) { - attributes = wysihtml.lang.object(setAttributes).clone(); - } - - // check/convert values of attributes - attributes = wysihtml.lang.object(attributes).merge(_checkAttributes(oldNode, rule.check_attributes)).get(); - - if (setClass) { - classes.push(setClass); - } - - if (addClass) { - for (attributeName in addClass) { - method = addClassMethods[addClass[attributeName]]; - if (!method) { - continue; - } - newClass = method(wysihtml.dom.getAttribute(oldNode, attributeName)); - if (typeof(newClass) === "string") { - classes.push(newClass); - } - } - } - - if (addStyle) { - for (attributeName in addStyle) { - method = addStyleMethods[addStyle[attributeName]]; - if (!method) { - continue; - } - - newStyle = method(wysihtml.dom.getAttribute(oldNode, attributeName)); - if (typeof(newStyle) === "string") { - styles.push(newStyle); - } - } - } - - - if (typeof(allowedClasses) === "string" && allowedClasses === "any") { - if (oldNode.getAttribute("class")) { - if (currentRules.classes_blacklist) { - oldClasses = oldNode.getAttribute("class"); - if (oldClasses) { - classes = classes.concat(oldClasses.split(WHITE_SPACE_REG_EXP)); - } - - classesLength = classes.length; - for (; i 0) { - attributes["class"] = wysihtml.lang.array(classes).unique().join(" "); - } - } - } else { - // make sure that wysihtml5 temp class doesn't get stripped out - if (!clearInternals) { - allowedClasses["_wysihtml5-temp-placeholder"] = 1; - allowedClasses["_rangySelectionBoundary"] = 1; - allowedClasses["wysiwyg-tmp-selected-cell"] = 1; - } - - // add old classes last - oldClasses = oldNode.getAttribute("class"); - if (oldClasses) { - classes = classes.concat(oldClasses.split(WHITE_SPACE_REG_EXP)); - } - classesLength = classes.length; - for (; i under https when it's new attribute value is non-https - // TODO: Investigate this further and check for smarter handling - try { - newNode.setAttribute(attributeName, attributes[attributeName]); - } catch(e) {} - } - - // IE8 sometimes loses the width/height attributes when those are set before the "src" - // so we make sure to set them again - if (attributes.src) { - if (typeof(attributes.width) !== "undefined") { - newNode.setAttribute("width", attributes.width); - } - if (typeof(attributes.height) !== "undefined") { - newNode.setAttribute("height", attributes.height); - } - } - } - - function _handleText(oldNode) { - var nextSibling = oldNode.nextSibling; - if (nextSibling && nextSibling.nodeType === wysihtml.TEXT_NODE) { - // Concatenate text nodes - nextSibling.data = oldNode.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, "") + nextSibling.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); - } else { - // \uFEFF = wysihtml.INVISIBLE_SPACE (used as a hack in certain rich text editing situations) - var data = oldNode.data.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); - return oldNode.ownerDocument.createTextNode(data); - } - } - - function _handleComment(oldNode) { - if (currentRules.comments) { - return oldNode.ownerDocument.createComment(oldNode.nodeValue); - } - } - - // ------------ attribute checks ------------ \\ - var attributeCheckMethods = { - url: (function() { - var REG_EXP = /^https?:\/\//i; - return function(attributeValue) { - if (!attributeValue || !attributeValue.match(REG_EXP)) { - return null; - } - return attributeValue.replace(REG_EXP, function(match) { - return match.toLowerCase(); - }); - }; - })(), - - src: (function() { - var REG_EXP = /^(\/|https?:\/\/)/i; - return function(attributeValue) { - if (!attributeValue || !attributeValue.match(REG_EXP)) { - return null; - } - return attributeValue.replace(REG_EXP, function(match) { - return match.toLowerCase(); - }); - }; - })(), - - href: (function() { - var REG_EXP = /^(#|\/|https?:\/\/|mailto:|tel:)/i; - return function(attributeValue) { - if (!attributeValue || !attributeValue.match(REG_EXP)) { - return null; - } - return attributeValue.replace(REG_EXP, function(match) { - return match.toLowerCase(); - }); - }; - })(), - - alt: (function() { - var REG_EXP = /[^ a-z0-9_\-]/gi; - return function(attributeValue, nodeName) { - if (!attributeValue) { - if (nodeName === "IMG") { - return ""; - } else { - return null; - } - } - return attributeValue.replace(REG_EXP, ""); - }; - })(), - - // Integers. Does not work with floating point numbers and units - numbers: (function() { - var REG_EXP = /\D/g; - return function(attributeValue) { - attributeValue = (attributeValue || "").replace(REG_EXP, ""); - return attributeValue || null; - }; - })(), - - // Useful for with/height attributes where floating points and percentages are allowed - dimension: (function() { - var REG_EXP = /\D*(\d+)(\.\d+)?\s?(%)?\D*/; - return function(attributeValue) { - attributeValue = (attributeValue || "").replace(REG_EXP, "$1$2$3"); - return attributeValue || null; - }; - })(), - - any: (function() { - return function(attributeValue) { - if (!attributeValue) { - return null; - } - return attributeValue; - }; - })() - }; - - // ------------ style converter (converts an html attribute to a style) ------------ \\ - var addStyleMethods = { - align_text: (function() { - var mapping = { - left: "text-align: left;", - right: "text-align: right;", - center: "text-align: center;" - }; - return function(attributeValue) { - return mapping[String(attributeValue).toLowerCase()]; - }; - })(), - }; - - // ------------ class converter (converts an html attribute to a class name) ------------ \\ - var addClassMethods = { - align_img: (function() { - var mapping = { - left: "wysiwyg-float-left", - right: "wysiwyg-float-right" - }; - return function(attributeValue) { - return mapping[String(attributeValue).toLowerCase()]; - }; - })(), - - align_text: (function() { - var mapping = { - left: "wysiwyg-text-align-left", - right: "wysiwyg-text-align-right", - center: "wysiwyg-text-align-center", - justify: "wysiwyg-text-align-justify" - }; - return function(attributeValue) { - return mapping[String(attributeValue).toLowerCase()]; - }; - })(), - - clear_br: (function() { - var mapping = { - left: "wysiwyg-clear-left", - right: "wysiwyg-clear-right", - both: "wysiwyg-clear-both", - all: "wysiwyg-clear-both" - }; - return function(attributeValue) { - return mapping[String(attributeValue).toLowerCase()]; - }; - })(), - - size_font: (function() { - var mapping = { - "1": "wysiwyg-font-size-xx-small", - "2": "wysiwyg-font-size-small", - "3": "wysiwyg-font-size-medium", - "4": "wysiwyg-font-size-large", - "5": "wysiwyg-font-size-x-large", - "6": "wysiwyg-font-size-xx-large", - "7": "wysiwyg-font-size-xx-large", - "-": "wysiwyg-font-size-smaller", - "+": "wysiwyg-font-size-larger" - }; - return function(attributeValue) { - return mapping[String(attributeValue).charAt(0)]; - }; - })() - }; - - // checks if element is possibly visible - var typeCeckMethods = { - has_visible_contet: (function() { - var txt, - isVisible = false, - visibleElements = ['img', 'video', 'picture', 'br', 'script', 'noscript', - 'style', 'table', 'iframe', 'object', 'embed', 'audio', - 'svg', 'input', 'button', 'select','textarea', 'canvas']; - - return function(el) { - - // has visible innertext. so is visible - txt = (el.innerText || el.textContent).replace(/\s/g, ''); - if (txt && txt.length > 0) { - return true; - } - - // matches list of visible dimensioned elements - for (var i = visibleElements.length; i--;) { - if (el.querySelector(visibleElements[i])) { - return true; - } - } - - // try to measure dimesions in last resort. (can find only of elements in dom) - if (el.offsetWidth && el.offsetWidth > 0 && el.offsetHeight && el.offsetHeight > 0) { - return true; - } - - return false; - }; - })() - }; - - var elementHandlingMethods = { - unwrap: function (element) { - wysihtml.dom.unwrap(element); - }, - - remove: function (element) { - element.parentNode.removeChild(element); - } - }; - - return parse(elementOrHtml_current, config_current); -}; -;/** - * Checks for empty text node childs and removes them - * - * @param {Element} node The element in which to cleanup - * @example - * wysihtml.dom.removeEmptyTextNodes(element); - */ -wysihtml.dom.removeEmptyTextNodes = function(node) { - var childNode, - childNodes = wysihtml.lang.array(node.childNodes).get(), - childNodesLength = childNodes.length, - i = 0; - - for (; i to a

    ) and keeps its childs - * - * @param {Element} element The list element which should be renamed - * @param {Element} newNodeName The desired tag name - * - * @example - * - *

      - *
    • eminem
    • - *
    • dr. dre
    • - *
    • 50 Cent
    • - *
    - * - * - * - * - *
      - *
    1. eminem
    2. - *
    3. dr. dre
    4. - *
    5. 50 Cent
    6. - *
    - */ -wysihtml.dom.renameElement = function(element, newNodeName) { - var newElement = element.ownerDocument.createElement(newNodeName), - firstChild; - while (firstChild = element.firstChild) { - newElement.appendChild(firstChild); - } - wysihtml.dom.copyAttributes(["align", "className"]).from(element).to(newElement); - - if (element.parentNode) { - element.parentNode.replaceChild(newElement, element); - } - - return newElement; -}; -;/** - * Takes an element, removes it and replaces it with it's childs - * - * @param {Object} node The node which to replace with it's child nodes - * @example - *
    - * hello - *
    - * - */ -wysihtml.dom.replaceWithChildNodes = function(node) { - if (!node.parentNode) { - return; - } - - while (node.firstChild) { - node.parentNode.insertBefore(node.firstChild, node); - } - node.parentNode.removeChild(node); -}; -;/** - * Unwraps an unordered/ordered list - * - * @param {Element} element The list element which should be unwrapped - * - * @example - * - *
      - *
    • eminem
    • - *
    • dr. dre
    • - *
    • 50 Cent
    • - *
    - * - * - * - * - * eminem
    - * dr. dre
    - * 50 Cent
    - */ -(function(dom) { - function _isBlockElement(node) { - return dom.getStyle("display").from(node) === "block"; - } - - function _isLineBreak(node) { - return node.nodeName === "BR"; - } - - function _appendLineBreak(element) { - var lineBreak = element.ownerDocument.createElement("br"); - element.appendChild(lineBreak); - } - - function resolveList(list, useLineBreaks) { - if (!list.nodeName.match(/^(MENU|UL|OL)$/)) { - return; - } - - var doc = list.ownerDocument, - fragment = doc.createDocumentFragment(), - previousSibling = wysihtml.dom.domNode(list).prev({ignoreBlankTexts: true}), - nextSibling = wysihtml.dom.domNode(list).next({ignoreBlankTexts: true}), - firstChild, - lastChild, - isLastChild, - shouldAppendLineBreak, - paragraph, - listItem, - lastListItem = list.lastElementChild || list.lastChild, - isLastItem; - - if (useLineBreaks) { - // Insert line break if list is after a non-block element - if (previousSibling && !_isBlockElement(previousSibling) && !_isLineBreak(previousSibling)) { - _appendLineBreak(fragment); - } - - while (listItem = (list.firstElementChild || list.firstChild)) { - lastChild = listItem.lastChild; - isLastItem = listItem === lastListItem; - while (firstChild = listItem.firstChild) { - isLastChild = firstChild === lastChild; - // This needs to be done before appending it to the fragment, as it otherwise will lose style information - shouldAppendLineBreak = (!isLastItem || (nextSibling && !_isBlockElement(nextSibling))) && isLastChild && !_isBlockElement(firstChild) && !_isLineBreak(firstChild); - fragment.appendChild(firstChild); - if (shouldAppendLineBreak) { - _appendLineBreak(fragment); - } - } - - listItem.parentNode.removeChild(listItem); - } - } else { - while (listItem = (list.firstElementChild || list.firstChild)) { - if (listItem.querySelector && listItem.querySelector("div, p, ul, ol, menu, blockquote, h1, h2, h3, h4, h5, h6")) { - while (firstChild = listItem.firstChild) { - fragment.appendChild(firstChild); - } - } else { - paragraph = doc.createElement("p"); - while (firstChild = listItem.firstChild) { - paragraph.appendChild(firstChild); - } - fragment.appendChild(paragraph); - } - listItem.parentNode.removeChild(listItem); - } - } - - list.parentNode.replaceChild(fragment, list); - } - - dom.resolveList = resolveList; -})(wysihtml.dom); -;/** - * Sandbox for executing javascript, parsing css styles and doing dom operations in a secure way - * - * Browser Compatibility: - * - Secure in MSIE 6+, but only when the user hasn't made changes to his security level "restricted" - * - Partially secure in other browsers (Firefox, Opera, Safari, Chrome, ...) - * - * Please note that this class can't benefit from the HTML5 sandbox attribute for the following reasons: - * - sandboxing doesn't work correctly with inlined content (src="javascript:'...'") - * - sandboxing of physical documents causes that the dom isn't accessible anymore from the outside (iframe.contentWindow, ...) - * - setting the "allow-same-origin" flag would fix that, but then still javascript and dom events refuse to fire - * - therefore the "allow-scripts" flag is needed, which then would deactivate any security, as the js executed inside the iframe - * can do anything as if the sandbox attribute wasn't set - * - * @param {Function} [readyCallback] Method that gets invoked when the sandbox is ready - * @param {Object} [config] Optional parameters - * - * @example - * new wysihtml.dom.Sandbox(function(sandbox) { - * sandbox.getWindow().document.body.innerHTML = ''; - * }); - */ -(function(wysihtml) { - var /** - * Default configuration - */ - doc = document, - /** - * Properties to unset/protect on the window object - */ - windowProperties = [ - "parent", "top", "opener", "frameElement", "frames", - "localStorage", "globalStorage", "sessionStorage", "indexedDB" - ], - /** - * Properties on the window object which are set to an empty function - */ - windowProperties2 = [ - "open", "close", "openDialog", "showModalDialog", - "alert", "confirm", "prompt", - "openDatabase", "postMessage", - "XMLHttpRequest", "XDomainRequest" - ], - /** - * Properties to unset/protect on the document object - */ - documentProperties = [ - "referrer", - "write", "open", "close" - ]; - - wysihtml.dom.Sandbox = Base.extend( - /** @scope wysihtml.dom.Sandbox.prototype */ { - - constructor: function(readyCallback, config) { - this.callback = readyCallback || wysihtml.EMPTY_FUNCTION; - this.config = wysihtml.lang.object({}).merge(config).get(); - if (!this.config.className) { - this.config.className = "wysihtml5-sandbox"; - } - this.editableArea = this._createIframe(); - }, - - insertInto: function(element) { - if (typeof(element) === "string") { - element = doc.getElementById(element); - } - - element.appendChild(this.editableArea); - }, - - getIframe: function() { - return this.editableArea; - }, - - getWindow: function() { - this._readyError(); - }, - - getDocument: function() { - this._readyError(); - }, - - destroy: function() { - var iframe = this.getIframe(); - iframe.parentNode.removeChild(iframe); - }, - - _readyError: function() { - throw new Error("wysihtml.Sandbox: Sandbox iframe isn't loaded yet"); - }, - - /** - * Creates the sandbox iframe - * - * Some important notes: - * - We can't use HTML5 sandbox for now: - * setting it causes that the iframe's dom can't be accessed from the outside - * Therefore we need to set the "allow-same-origin" flag which enables accessing the iframe's dom - * But then there's another problem, DOM events (focus, blur, change, keypress, ...) aren't fired. - * In order to make this happen we need to set the "allow-scripts" flag. - * A combination of allow-scripts and allow-same-origin is almost the same as setting no sandbox attribute at all. - * - Chrome & Safari, doesn't seem to support sandboxing correctly when the iframe's html is inlined (no physical document) - * - IE needs to have the security="restricted" attribute set before the iframe is - * inserted into the dom tree - * - Believe it or not but in IE "security" in document.createElement("iframe") is false, even - * though it supports it - * - When an iframe has security="restricted", in IE eval() & execScript() don't work anymore - * - IE doesn't fire the onload event when the content is inlined in the src attribute, therefore we rely - * on the onreadystatechange event - */ - _createIframe: function() { - var that = this, - iframe = doc.createElement("iframe"); - iframe.className = this.config.className; - wysihtml.dom.setAttributes({ - "security": "restricted", - "allowtransparency": "true", - "frameborder": 0, - "width": 0, - "height": 0, - "marginwidth": 0, - "marginheight": 0 - }).on(iframe); - - // Setting the src like this prevents ssl warnings in IE6 - if (wysihtml.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()) { - iframe.src = "javascript:''"; - } - - iframe.onload = function() { - iframe.onreadystatechange = iframe.onload = null; - that._onLoadIframe(iframe); - }; - - iframe.onreadystatechange = function() { - if (/loaded|complete/.test(iframe.readyState)) { - iframe.onreadystatechange = iframe.onload = null; - that._onLoadIframe(iframe); - } - }; - - return iframe; - }, - - /** - * Callback for when the iframe has finished loading - */ - _onLoadIframe: function(iframe) { - // don't resume when the iframe got unloaded (eg. by removing it from the dom) - if (!wysihtml.dom.contains(doc.documentElement, iframe)) { - return; - } - - var that = this, - iframeWindow = iframe.contentWindow, - iframeDocument = iframe.contentWindow.document, - charset = doc.characterSet || doc.charset || "utf-8", - sandboxHtml = this._getHtml({ - charset: charset, - stylesheets: this.config.stylesheets - }); - - // Create the basic dom tree including proper DOCTYPE and charset - iframeDocument.open("text/html", "replace"); - iframeDocument.write(sandboxHtml); - iframeDocument.close(); - - this.getWindow = function() { return iframe.contentWindow; }; - this.getDocument = function() { return iframe.contentWindow.document; }; - - // Catch js errors and pass them to the parent's onerror event - // addEventListener("error") doesn't work properly in some browsers - // TODO: apparently this doesn't work in IE9! - iframeWindow.onerror = function(errorMessage, fileName, lineNumber) { - throw new Error("wysihtml.Sandbox: " + errorMessage, fileName, lineNumber); - }; - - if (!wysihtml.browser.supportsSandboxedIframes()) { - // Unset a bunch of sensitive variables - // Please note: This isn't hack safe! - // It more or less just takes care of basic attacks and prevents accidental theft of sensitive information - // IE is secure though, which is the most important thing, since IE is the only browser, who - // takes over scripts & styles into contentEditable elements when copied from external websites - // or applications (Microsoft Word, ...) - var i, length; - for (i=0, length=windowProperties.length; i'; - } - } - templateVars.stylesheets = html; - - return wysihtml.lang.string( - '' - + '#{stylesheets}' - + '' - ).interpolate(templateVars); - }, - - /** - * Method to unset/override existing variables - * @example - * // Make cookie unreadable and unwritable - * this._unset(document, "cookie", "", true); - */ - _unset: function(object, property, value, setter) { - try { object[property] = value; } catch(e) {} - - try { object.__defineGetter__(property, function() { return value; }); } catch(e) {} - if (setter) { - try { object.__defineSetter__(property, function() {}); } catch(e) {} - } - - if (!wysihtml.browser.crashesWhenDefineProperty(property)) { - try { - var config = { - get: function() { return value; } - }; - if (setter) { - config.set = function() {}; - } - Object.defineProperty(object, property, config); - } catch(e) {} - } - } - }); -})(wysihtml); -;(function(wysihtml) { - var doc = document; - wysihtml.dom.ContentEditableArea = Base.extend({ - getContentEditable: function() { - return this.element; - }, - - getWindow: function() { - return this.element.ownerDocument.defaultView || this.element.ownerDocument.parentWindow; - }, - - getDocument: function() { - return this.element.ownerDocument; - }, - - constructor: function(readyCallback, config, contentEditable) { - this.callback = readyCallback || wysihtml.EMPTY_FUNCTION; - this.config = wysihtml.lang.object({}).merge(config).get(); - if (!this.config.className) { - this.config.className = "wysihtml5-sandbox"; - } - if (contentEditable) { - this.element = this._bindElement(contentEditable); - } else { - this.element = this._createElement(); - } - }, - - destroy: function() { - - }, - - // creates a new contenteditable and initiates it - _createElement: function() { - var element = doc.createElement("div"); - element.className = this.config.className; - this._loadElement(element); - return element; - }, - - // initiates an allready existent contenteditable - _bindElement: function(contentEditable) { - contentEditable.className = contentEditable.className ? contentEditable.className + " wysihtml5-sandbox" : "wysihtml5-sandbox"; - this._loadElement(contentEditable, true); - return contentEditable; - }, - - _loadElement: function(element, contentExists) { - var that = this; - - if (!contentExists) { - var innerHtml = this._getHtml(); - element.innerHTML = innerHtml; - } - - this.loaded = true; - // Trigger the callback - setTimeout(function() { that.callback(that); }, 0); - }, - - _getHtml: function(templateVars) { - return ''; - } - - }); -})(wysihtml); -;(function() { - var mapping = { - "className": "class" - }; - wysihtml.dom.setAttributes = function(attributes) { - return { - on: function(element) { - for (var i in attributes) { - element.setAttribute(mapping[i] || i, attributes[i]); - } - } - }; - }; -})(); -;wysihtml.dom.setStyles = function(styles) { - return { - on: function(element) { - var style = element.style; - if (typeof(styles) === "string") { - style.cssText += ";" + styles; - return; - } - for (var i in styles) { - if (i === "float") { - style.cssFloat = styles[i]; - style.styleFloat = styles[i]; - } else { - style[i] = styles[i]; - } - } - } - }; -}; -;/** - * Simulate HTML5 placeholder attribute - * - * Needed since - * - div[contentEditable] elements don't support it - * - older browsers (such as IE8 and Firefox 3.6) don't support it at all - * - * @param {Object} parent Instance of main wysihtml.Editor class - * @param {Element} view Instance of wysihtml.views.* class - * @param {String} placeholderText - * - * @example - * wysihtml.dom.simulatePlaceholder(this, composer, "Foobar"); - */ -(function(dom) { - dom.simulatePlaceholder = function(editor, view, placeholderText, placeholderClassName) { - var CLASS_NAME = placeholderClassName || "wysihtml5-placeholder", - unset = function() { - var composerIsVisible = view.element.offsetWidth > 0 && view.element.offsetHeight > 0; - if (view.hasPlaceholderSet()) { - view.clear(); - view.element.focus(); - if (composerIsVisible ) { - setTimeout(function() { - var sel = view.selection.getSelection(); - if (!sel.focusNode || !sel.anchorNode) { - view.selection.selectNode(view.element.firstChild || view.element); - } - }, 0); - } - } - view.placeholderSet = false; - dom.removeClass(view.element, CLASS_NAME); - }, - set = function() { - if (view.isEmpty() && !view.placeholderSet) { - view.placeholderSet = true; - view.setValue(placeholderText, false); - dom.addClass(view.element, CLASS_NAME); - } - }; - - editor - .on("set_placeholder", set) - .on("unset_placeholder", unset) - .on("focus:composer", unset) - .on("paste:composer", unset) - .on("blur:composer", set); - - set(); - }; -})(wysihtml.dom); -;(function(dom) { - var documentElement = document.documentElement; - if ("textContent" in documentElement) { - dom.setTextContent = function(element, text) { - element.textContent = text; - }; - - dom.getTextContent = function(element) { - return element.textContent; - }; - } else if ("innerText" in documentElement) { - dom.setTextContent = function(element, text) { - element.innerText = text; - }; - - dom.getTextContent = function(element) { - return element.innerText; - }; - } else { - dom.setTextContent = function(element, text) { - element.nodeValue = text; - }; - - dom.getTextContent = function(element) { - return element.nodeValue; - }; - } -})(wysihtml.dom); -;/** - * Get a set of attribute from one element - * - * IE gives wrong results for hasAttribute/getAttribute, for example: - * var td = document.createElement("td"); - * td.getAttribute("rowspan"); // => "1" in IE - * - * Therefore we have to check the element's outerHTML for the attribute -*/ - -wysihtml.dom.getAttribute = function(node, attributeName) { - var HAS_GET_ATTRIBUTE_BUG = !wysihtml.browser.supportsGetAttributeCorrectly(); - attributeName = attributeName.toLowerCase(); - var nodeName = node.nodeName; - if (nodeName == "IMG" && attributeName == "src" && wysihtml.dom.isLoadedImage(node) === true) { - // Get 'src' attribute value via object property since this will always contain the - // full absolute url (http://...) - // this fixes a very annoying bug in firefox (ver 3.6 & 4) and IE 8 where images copied from the same host - // will have relative paths, which the sanitizer strips out (see attributeCheckMethods.url) - return node.src; - } else if (HAS_GET_ATTRIBUTE_BUG && "outerHTML" in node) { - // Don't trust getAttribute/hasAttribute in IE 6-8, instead check the element's outerHTML - var outerHTML = node.outerHTML.toLowerCase(), - // TODO: This might not work for attributes without value: - hasAttribute = outerHTML.indexOf(" " + attributeName + "=") != -1; - - return hasAttribute ? node.getAttribute(attributeName) : null; - } else{ - return node.getAttribute(attributeName); - } -}; -;/** - * Get all attributes of an element - * - * IE gives wrong results for hasAttribute/getAttribute, for example: - * var td = document.createElement("td"); - * td.getAttribute("rowspan"); // => "1" in IE - * - * Therefore we have to check the element's outerHTML for the attribute -*/ - -wysihtml.dom.getAttributes = function(node) { - var HAS_GET_ATTRIBUTE_BUG = !wysihtml.browser.supportsGetAttributeCorrectly(), - nodeName = node.nodeName, - attributes = [], - attr; - - for (attr in node.attributes) { - if ((node.attributes.hasOwnProperty && node.attributes.hasOwnProperty(attr)) || (!node.attributes.hasOwnProperty && Object.prototype.hasOwnProperty.call(node.attributes, attr))) { - if (node.attributes[attr].specified) { - if (nodeName == "IMG" && node.attributes[attr].name.toLowerCase() == "src" && wysihtml.dom.isLoadedImage(node) === true) { - attributes['src'] = node.src; - } else if (wysihtml.lang.array(['rowspan', 'colspan']).contains(node.attributes[attr].name.toLowerCase()) && HAS_GET_ATTRIBUTE_BUG) { - if (node.attributes[attr].value !== 1) { - attributes[node.attributes[attr].name] = node.attributes[attr].value; - } - } else { - attributes[node.attributes[attr].name] = node.attributes[attr].value; - } - } - } - } - return attributes; -}; -;/** - * Check whether the given node is a proper loaded image - * FIXME: Returns undefined when unknown (Chrome, Safari) -*/ - -wysihtml.dom.isLoadedImage = function (node) { - try { - return node.complete && !node.mozMatchesSelector(":-moz-broken"); - } catch(e) { - if (node.complete && node.readyState === "complete") { - return true; - } - } -}; -;(function(wysihtml) { - - var api = wysihtml.dom; - - var MapCell = function(cell) { - this.el = cell; - this.isColspan= false; - this.isRowspan= false; - this.firstCol= true; - this.lastCol= true; - this.firstRow= true; - this.lastRow= true; - this.isReal= true; - this.spanCollection= []; - this.modified = false; - }; - - var TableModifyerByCell = function (cell, table) { - if (cell) { - this.cell = cell; - this.table = api.getParentElement(cell, { query: "table" }); - } else if (table) { - this.table = table; - this.cell = this.table.querySelectorAll('th, td')[0]; - } - }; - - function queryInList(list, query) { - var ret = [], - q; - for (var e = 0, len = list.length; e < len; e++) { - q = list[e].querySelectorAll(query); - if (q) { - for(var i = q.length; i--; ret.unshift(q[i])); - } - } - return ret; - } - - function removeElement(el) { - el.parentNode.removeChild(el); - } - - function insertAfter(referenceNode, newNode) { - referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); - } - - function nextNode(node, tag) { - var element = node.nextSibling; - while (element.nodeType !=1) { - element = element.nextSibling; - if (!tag || tag == element.tagName.toLowerCase()) { - return element; - } - } - return null; - } - - TableModifyerByCell.prototype = { - - addSpannedCellToMap: function(cell, map, r, c, cspan, rspan) { - var spanCollect = [], - rmax = r + ((rspan) ? parseInt(rspan, 10) - 1 : 0), - cmax = c + ((cspan) ? parseInt(cspan, 10) - 1 : 0); - - for (var rr = r; rr <= rmax; rr++) { - if (typeof map[rr] == "undefined") { map[rr] = []; } - for (var cc = c; cc <= cmax; cc++) { - map[rr][cc] = new MapCell(cell); - map[rr][cc].isColspan = (cspan && parseInt(cspan, 10) > 1); - map[rr][cc].isRowspan = (rspan && parseInt(rspan, 10) > 1); - map[rr][cc].firstCol = cc == c; - map[rr][cc].lastCol = cc == cmax; - map[rr][cc].firstRow = rr == r; - map[rr][cc].lastRow = rr == rmax; - map[rr][cc].isReal = cc == c && rr == r; - map[rr][cc].spanCollection = spanCollect; - - spanCollect.push(map[rr][cc]); - } - } - }, - - setCellAsModified: function(cell) { - cell.modified = true; - if (cell.spanCollection.length > 0) { - for (var s = 0, smax = cell.spanCollection.length; s < smax; s++) { - cell.spanCollection[s].modified = true; - } - } - }, - - setTableMap: function() { - var map = []; - var tableRows = this.getTableRows(), - ridx, row, cells, cidx, cell, - c, - cspan, rspan; - - for (ridx = 0; ridx < tableRows.length; ridx++) { - row = tableRows[ridx]; - cells = this.getRowCells(row); - c = 0; - if (typeof map[ridx] == "undefined") { map[ridx] = []; } - for (cidx = 0; cidx < cells.length; cidx++) { - cell = cells[cidx]; - - // If cell allready set means it is set by col or rowspan, - // so increase cols index until free col is found - while (typeof map[ridx][c] != "undefined") { c++; } - - cspan = api.getAttribute(cell, 'colspan'); - rspan = api.getAttribute(cell, 'rowspan'); - - if (cspan || rspan) { - this.addSpannedCellToMap(cell, map, ridx, c, cspan, rspan); - c = c + ((cspan) ? parseInt(cspan, 10) : 1); - } else { - map[ridx][c] = new MapCell(cell); - c++; - } - } - } - this.map = map; - return map; - }, - - getRowCells: function(row) { - var inlineTables = this.table.querySelectorAll('table'), - inlineCells = (inlineTables) ? queryInList(inlineTables, 'th, td') : [], - allCells = row.querySelectorAll('th, td'), - tableCells = (inlineCells.length > 0) ? wysihtml.lang.array(allCells).without(inlineCells) : allCells; - - return tableCells; - }, - - getTableRows: function() { - var inlineTables = this.table.querySelectorAll('table'), - inlineRows = (inlineTables) ? queryInList(inlineTables, 'tr') : [], - allRows = this.table.querySelectorAll('tr'), - tableRows = (inlineRows.length > 0) ? wysihtml.lang.array(allRows).without(inlineRows) : allRows; - - return tableRows; - }, - - getMapIndex: function(cell) { - var r_length = this.map.length, - c_length = (this.map && this.map[0]) ? this.map[0].length : 0; - - for (var r_idx = 0;r_idx < r_length; r_idx++) { - for (var c_idx = 0;c_idx < c_length; c_idx++) { - if (this.map[r_idx][c_idx].el === cell) { - return {'row': r_idx, 'col': c_idx}; - } - } - } - return false; - }, - - getElementAtIndex: function(idx) { - this.setTableMap(); - if (this.map[idx.row] && this.map[idx.row][idx.col] && this.map[idx.row][idx.col].el) { - return this.map[idx.row][idx.col].el; - } - return null; - }, - - getMapElsTo: function(to_cell) { - var els = []; - this.setTableMap(); - this.idx_start = this.getMapIndex(this.cell); - this.idx_end = this.getMapIndex(to_cell); - - // switch indexes if start is bigger than end - if (this.idx_start.row > this.idx_end.row || (this.idx_start.row == this.idx_end.row && this.idx_start.col > this.idx_end.col)) { - var temp_idx = this.idx_start; - this.idx_start = this.idx_end; - this.idx_end = temp_idx; - } - if (this.idx_start.col > this.idx_end.col) { - var temp_cidx = this.idx_start.col; - this.idx_start.col = this.idx_end.col; - this.idx_end.col = temp_cidx; - } - - if (this.idx_start != null && this.idx_end != null) { - for (var row = this.idx_start.row, maxr = this.idx_end.row; row <= maxr; row++) { - for (var col = this.idx_start.col, maxc = this.idx_end.col; col <= maxc; col++) { - els.push(this.map[row][col].el); - } - } - } - return els; - }, - - orderSelectionEnds: function(secondcell) { - this.setTableMap(); - this.idx_start = this.getMapIndex(this.cell); - this.idx_end = this.getMapIndex(secondcell); - - // switch indexes if start is bigger than end - if (this.idx_start.row > this.idx_end.row || (this.idx_start.row == this.idx_end.row && this.idx_start.col > this.idx_end.col)) { - var temp_idx = this.idx_start; - this.idx_start = this.idx_end; - this.idx_end = temp_idx; - } - if (this.idx_start.col > this.idx_end.col) { - var temp_cidx = this.idx_start.col; - this.idx_start.col = this.idx_end.col; - this.idx_end.col = temp_cidx; - } - - return { - "start": this.map[this.idx_start.row][this.idx_start.col].el, - "end": this.map[this.idx_end.row][this.idx_end.col].el - }; - }, - - createCells: function(tag, nr, attrs) { - var doc = this.table.ownerDocument, - frag = doc.createDocumentFragment(), - cell; - for (var i = 0; i < nr; i++) { - cell = doc.createElement(tag); - - if (attrs) { - for (var attr in attrs) { - if (attrs.hasOwnProperty(attr)) { - cell.setAttribute(attr, attrs[attr]); - } - } - } - - // add non breaking space - cell.appendChild(document.createTextNode("\u00a0")); - frag.appendChild(cell); - } - return frag; - }, - - // Returns next real cell (not part of spanned cell unless first) on row if selected index is not real. I no real cells -1 will be returned - correctColIndexForUnreals: function(col, row) { - var r = this.map[row], - corrIdx = -1; - for (var i = 0, max = col; i < col; i++) { - if (r[i].isReal){ - corrIdx++; - } - } - return corrIdx; - }, - - getLastNewCellOnRow: function(row, rowLimit) { - var cells = this.getRowCells(row), - cell, idx; - - for (var cidx = 0, cmax = cells.length; cidx < cmax; cidx++) { - cell = cells[cidx]; - idx = this.getMapIndex(cell); - if (idx === false || (typeof rowLimit != "undefined" && idx.row != rowLimit)) { - return cell; - } - } - return null; - }, - - removeEmptyTable: function() { - var cells = this.table.querySelectorAll('td, th'); - if (!cells || cells.length == 0) { - removeElement(this.table); - return true; - } else { - return false; - } - }, - - // Splits merged cell on row to unique cells - splitRowToCells: function(cell) { - if (cell.isColspan) { - var colspan = parseInt(api.getAttribute(cell.el, 'colspan') || 1, 10), - cType = cell.el.tagName.toLowerCase(); - if (colspan > 1) { - var newCells = this.createCells(cType, colspan -1); - insertAfter(cell.el, newCells); - } - cell.el.removeAttribute('colspan'); - } - }, - - getRealRowEl: function(force, idx) { - var r = null, - c = null; - - idx = idx || this.idx; - - for (var cidx = 0, cmax = this.map[idx.row].length; cidx < cmax; cidx++) { - c = this.map[idx.row][cidx]; - if (c.isReal) { - r = api.getParentElement(c.el, { query: "tr" }); - if (r) { - return r; - } - } - } - - if (r === null && force) { - r = api.getParentElement(this.map[idx.row][idx.col].el, { query: "tr" }) || null; - } - - return r; - }, - - injectRowAt: function(row, col, colspan, cType, c) { - var r = this.getRealRowEl(false, {'row': row, 'col': col}), - new_cells = this.createCells(cType, colspan); - - if (r) { - var n_cidx = this.correctColIndexForUnreals(col, row); - if (n_cidx >= 0) { - insertAfter(this.getRowCells(r)[n_cidx], new_cells); - } else { - r.insertBefore(new_cells, r.firstChild); - } - } else { - var rr = this.table.ownerDocument.createElement('tr'); - rr.appendChild(new_cells); - insertAfter(api.getParentElement(c.el, { query: "tr" }), rr); - } - }, - - canMerge: function(to) { - this.to = to; - this.setTableMap(); - this.idx_start = this.getMapIndex(this.cell); - this.idx_end = this.getMapIndex(this.to); - - // switch indexes if start is bigger than end - if (this.idx_start.row > this.idx_end.row || (this.idx_start.row == this.idx_end.row && this.idx_start.col > this.idx_end.col)) { - var temp_idx = this.idx_start; - this.idx_start = this.idx_end; - this.idx_end = temp_idx; - } - if (this.idx_start.col > this.idx_end.col) { - var temp_cidx = this.idx_start.col; - this.idx_start.col = this.idx_end.col; - this.idx_end.col = temp_cidx; - } - - for (var row = this.idx_start.row, maxr = this.idx_end.row; row <= maxr; row++) { - for (var col = this.idx_start.col, maxc = this.idx_end.col; col <= maxc; col++) { - if (this.map[row][col].isColspan || this.map[row][col].isRowspan) { - return false; - } - } - } - return true; - }, - - decreaseCellSpan: function(cell, span) { - var nr = parseInt(api.getAttribute(cell.el, span), 10) - 1; - if (nr >= 1) { - cell.el.setAttribute(span, nr); - } else { - cell.el.removeAttribute(span); - if (span == 'colspan') { - cell.isColspan = false; - } - if (span == 'rowspan') { - cell.isRowspan = false; - } - cell.firstCol = true; - cell.lastCol = true; - cell.firstRow = true; - cell.lastRow = true; - cell.isReal = true; - } - }, - - removeSurplusLines: function() { - var row, cell, ridx, rmax, cidx, cmax, allRowspan; - - this.setTableMap(); - if (this.map) { - ridx = 0; - rmax = this.map.length; - for (;ridx < rmax; ridx++) { - row = this.map[ridx]; - allRowspan = true; - cidx = 0; - cmax = row.length; - for (; cidx < cmax; cidx++) { - cell = row[cidx]; - if (!(api.getAttribute(cell.el, "rowspan") && parseInt(api.getAttribute(cell.el, "rowspan"), 10) > 1 && cell.firstRow !== true)) { - allRowspan = false; - break; - } - } - if (allRowspan) { - cidx = 0; - for (; cidx < cmax; cidx++) { - this.decreaseCellSpan(row[cidx], 'rowspan'); - } - } - } - - // remove rows without cells - var tableRows = this.getTableRows(); - ridx = 0; - rmax = tableRows.length; - for (;ridx < rmax; ridx++) { - row = tableRows[ridx]; - if (row.childNodes.length == 0 && (/^\s*$/.test(row.textContent || row.innerText))) { - removeElement(row); - } - } - } - }, - - fillMissingCells: function() { - var r_max = 0, - c_max = 0, - prevcell = null; - - this.setTableMap(); - if (this.map) { - - // find maximal dimensions of broken table - r_max = this.map.length; - for (var ridx = 0; ridx < r_max; ridx++) { - if (this.map[ridx].length > c_max) { c_max = this.map[ridx].length; } - } - - for (var row = 0; row < r_max; row++) { - for (var col = 0; col < c_max; col++) { - if (this.map[row] && !this.map[row][col]) { - if (col > 0) { - this.map[row][col] = new MapCell(this.createCells('td', 1)); - prevcell = this.map[row][col-1]; - if (prevcell && prevcell.el && prevcell.el.parent) { // if parent does not exist element is removed from dom - insertAfter(this.map[row][col-1].el, this.map[row][col].el); - } - } - } - } - } - } - }, - - rectify: function() { - if (!this.removeEmptyTable()) { - this.removeSurplusLines(); - this.fillMissingCells(); - return true; - } else { - return false; - } - }, - - unmerge: function() { - if (this.rectify()) { - this.setTableMap(); - this.idx = this.getMapIndex(this.cell); - - if (this.idx) { - var thisCell = this.map[this.idx.row][this.idx.col], - colspan = (api.getAttribute(thisCell.el, "colspan")) ? parseInt(api.getAttribute(thisCell.el, "colspan"), 10) : 1, - cType = thisCell.el.tagName.toLowerCase(); - - if (thisCell.isRowspan) { - var rowspan = parseInt(api.getAttribute(thisCell.el, "rowspan"), 10); - if (rowspan > 1) { - for (var nr = 1, maxr = rowspan - 1; nr <= maxr; nr++){ - this.injectRowAt(this.idx.row + nr, this.idx.col, colspan, cType, thisCell); - } - } - thisCell.el.removeAttribute('rowspan'); - } - this.splitRowToCells(thisCell); - } - } - }, - - // merges cells from start cell (defined in creating obj) to "to" cell - merge: function(to) { - if (this.rectify()) { - if (this.canMerge(to)) { - var rowspan = this.idx_end.row - this.idx_start.row + 1, - colspan = this.idx_end.col - this.idx_start.col + 1; - - for (var row = this.idx_start.row, maxr = this.idx_end.row; row <= maxr; row++) { - for (var col = this.idx_start.col, maxc = this.idx_end.col; col <= maxc; col++) { - - if (row == this.idx_start.row && col == this.idx_start.col) { - if (rowspan > 1) { - this.map[row][col].el.setAttribute('rowspan', rowspan); - } - if (colspan > 1) { - this.map[row][col].el.setAttribute('colspan', colspan); - } - } else { - // transfer content - if (!(/^\s*\s*$/.test(this.map[row][col].el.innerHTML.toLowerCase()))) { - this.map[this.idx_start.row][this.idx_start.col].el.innerHTML += ' ' + this.map[row][col].el.innerHTML; - } - removeElement(this.map[row][col].el); - } - - } - } - this.rectify(); - } else { - if (window.console) { - console.log('Do not know how to merge allready merged cells.'); - } - } - } - }, - - // Decreases rowspan of a cell if it is done on first cell of rowspan row (real cell) - // Cell is moved to next row (if it is real) - collapseCellToNextRow: function(cell) { - var cellIdx = this.getMapIndex(cell.el), - newRowIdx = cellIdx.row + 1, - newIdx = {'row': newRowIdx, 'col': cellIdx.col}; - - if (newRowIdx < this.map.length) { - - var row = this.getRealRowEl(false, newIdx); - if (row !== null) { - var n_cidx = this.correctColIndexForUnreals(newIdx.col, newIdx.row); - if (n_cidx >= 0) { - insertAfter(this.getRowCells(row)[n_cidx], cell.el); - } else { - var lastCell = this.getLastNewCellOnRow(row, newRowIdx); - if (lastCell !== null) { - insertAfter(lastCell, cell.el); - } else { - row.insertBefore(cell.el, row.firstChild); - } - } - if (parseInt(api.getAttribute(cell.el, 'rowspan'), 10) > 2) { - cell.el.setAttribute('rowspan', parseInt(api.getAttribute(cell.el, 'rowspan'), 10) - 1); - } else { - cell.el.removeAttribute('rowspan'); - } - } - } - }, - - // Removes a cell when removing a row - // If is rowspan cell then decreases the rowspan - // and moves cell to next row if needed (is first cell of rowspan) - removeRowCell: function(cell) { - if (cell.isReal) { - if (cell.isRowspan) { - this.collapseCellToNextRow(cell); - } else { - removeElement(cell.el); - } - } else { - if (parseInt(api.getAttribute(cell.el, 'rowspan'), 10) > 2) { - cell.el.setAttribute('rowspan', parseInt(api.getAttribute(cell.el, 'rowspan'), 10) - 1); - } else { - cell.el.removeAttribute('rowspan'); - } - } - }, - - getRowElementsByCell: function() { - var cells = []; - this.setTableMap(); - this.idx = this.getMapIndex(this.cell); - if (this.idx !== false) { - var modRow = this.map[this.idx.row]; - for (var cidx = 0, cmax = modRow.length; cidx < cmax; cidx++) { - if (modRow[cidx].isReal) { - cells.push(modRow[cidx].el); - } - } - } - return cells; - }, - - getColumnElementsByCell: function() { - var cells = []; - this.setTableMap(); - this.idx = this.getMapIndex(this.cell); - if (this.idx !== false) { - for (var ridx = 0, rmax = this.map.length; ridx < rmax; ridx++) { - if (this.map[ridx][this.idx.col] && this.map[ridx][this.idx.col].isReal) { - cells.push(this.map[ridx][this.idx.col].el); - } - } - } - return cells; - }, - - // Removes the row of selected cell - removeRow: function() { - var oldRow = api.getParentElement(this.cell, { query: "tr" }); - if (oldRow) { - this.setTableMap(); - this.idx = this.getMapIndex(this.cell); - if (this.idx !== false) { - var modRow = this.map[this.idx.row]; - for (var cidx = 0, cmax = modRow.length; cidx < cmax; cidx++) { - if (!modRow[cidx].modified) { - this.setCellAsModified(modRow[cidx]); - this.removeRowCell(modRow[cidx]); - } - } - } - removeElement(oldRow); - } - }, - - removeColCell: function(cell) { - if (cell.isColspan) { - if (parseInt(api.getAttribute(cell.el, 'colspan'), 10) > 2) { - cell.el.setAttribute('colspan', parseInt(api.getAttribute(cell.el, 'colspan'), 10) - 1); - } else { - cell.el.removeAttribute('colspan'); - } - } else if (cell.isReal) { - removeElement(cell.el); - } - }, - - removeColumn: function() { - this.setTableMap(); - this.idx = this.getMapIndex(this.cell); - if (this.idx !== false) { - for (var ridx = 0, rmax = this.map.length; ridx < rmax; ridx++) { - if (!this.map[ridx][this.idx.col].modified) { - this.setCellAsModified(this.map[ridx][this.idx.col]); - this.removeColCell(this.map[ridx][this.idx.col]); - } - } - } - }, - - // removes row or column by selected cell element - remove: function(what) { - if (this.rectify()) { - switch (what) { - case 'row': - this.removeRow(); - break; - case 'column': - this.removeColumn(); - break; - } - this.rectify(); - } - }, - - addRow: function(where) { - var doc = this.table.ownerDocument; - - this.setTableMap(); - this.idx = this.getMapIndex(this.cell); - if (where == "below" && api.getAttribute(this.cell, 'rowspan')) { - this.idx.row = this.idx.row + parseInt(api.getAttribute(this.cell, 'rowspan'), 10) - 1; - } - - if (this.idx !== false) { - var modRow = this.map[this.idx.row], - newRow = doc.createElement('tr'); - - for (var ridx = 0, rmax = modRow.length; ridx < rmax; ridx++) { - if (!modRow[ridx].modified) { - this.setCellAsModified(modRow[ridx]); - this.addRowCell(modRow[ridx], newRow, where); - } - } - - switch (where) { - case 'below': - insertAfter(this.getRealRowEl(true), newRow); - break; - case 'above': - var cr = api.getParentElement(this.map[this.idx.row][this.idx.col].el, { query: "tr" }); - if (cr) { - cr.parentNode.insertBefore(newRow, cr); - } - break; - } - } - }, - - addRowCell: function(cell, row, where) { - var colSpanAttr = (cell.isColspan) ? {"colspan" : api.getAttribute(cell.el, 'colspan')} : null; - if (cell.isReal) { - if (where != 'above' && cell.isRowspan) { - cell.el.setAttribute('rowspan', parseInt(api.getAttribute(cell.el,'rowspan'), 10) + 1); - } else { - row.appendChild(this.createCells('td', 1, colSpanAttr)); - } - } else { - if (where != 'above' && cell.isRowspan && cell.lastRow) { - row.appendChild(this.createCells('td', 1, colSpanAttr)); - } else if (c.isRowspan) { - cell.el.attr('rowspan', parseInt(api.getAttribute(cell.el, 'rowspan'), 10) + 1); - } - } - }, - - add: function(where) { - if (this.rectify()) { - if (where == 'below' || where == 'above') { - this.addRow(where); - } - if (where == 'before' || where == 'after') { - this.addColumn(where); - } - } - }, - - addColCell: function (cell, ridx, where) { - var doAdd, - cType = cell.el.tagName.toLowerCase(); - - // defines add cell vs expand cell conditions - // true means add - switch (where) { - case "before": - doAdd = (!cell.isColspan || cell.firstCol); - break; - case "after": - doAdd = (!cell.isColspan || cell.lastCol || (cell.isColspan && cell.el == this.cell)); - break; - } - - if (doAdd){ - // adds a cell before or after current cell element - switch (where) { - case "before": - cell.el.parentNode.insertBefore(this.createCells(cType, 1), cell.el); - break; - case "after": - insertAfter(cell.el, this.createCells(cType, 1)); - break; - } - - // handles if cell has rowspan - if (cell.isRowspan) { - this.handleCellAddWithRowspan(cell, ridx+1, where); - } - - } else { - // expands cell - cell.el.setAttribute('colspan', parseInt(api.getAttribute(cell.el, 'colspan'), 10) + 1); - } - }, - - addColumn: function(where) { - var row, modCell; - - this.setTableMap(); - this.idx = this.getMapIndex(this.cell); - if (where == "after" && api.getAttribute(this.cell, 'colspan')) { - this.idx.col = this.idx.col + parseInt(api.getAttribute(this.cell, 'colspan'), 10) - 1; - } - - if (this.idx !== false) { - for (var ridx = 0, rmax = this.map.length; ridx < rmax; ridx++ ) { - row = this.map[ridx]; - if (row[this.idx.col]) { - modCell = row[this.idx.col]; - if (!modCell.modified) { - this.setCellAsModified(modCell); - this.addColCell(modCell, ridx , where); - } - } - } - } - }, - - handleCellAddWithRowspan: function (cell, ridx, where) { - var addRowsNr = parseInt(api.getAttribute(this.cell, 'rowspan'), 10) - 1, - crow = api.getParentElement(cell.el, { query: "tr" }), - cType = cell.el.tagName.toLowerCase(), - cidx, temp_r_cells, - doc = this.table.ownerDocument, - nrow; - - for (var i = 0; i < addRowsNr; i++) { - cidx = this.correctColIndexForUnreals(this.idx.col, (ridx + i)); - crow = nextNode(crow, 'tr'); - if (crow) { - if (cidx > 0) { - switch (where) { - case "before": - temp_r_cells = this.getRowCells(crow); - if (cidx > 0 && this.map[ridx + i][this.idx.col].el != temp_r_cells[cidx] && cidx == temp_r_cells.length - 1) { - insertAfter(temp_r_cells[cidx], this.createCells(cType, 1)); - } else { - temp_r_cells[cidx].parentNode.insertBefore(this.createCells(cType, 1), temp_r_cells[cidx]); - } - - break; - case "after": - insertAfter(this.getRowCells(crow)[cidx], this.createCells(cType, 1)); - break; - } - } else { - crow.insertBefore(this.createCells(cType, 1), crow.firstChild); - } - } else { - nrow = doc.createElement('tr'); - nrow.appendChild(this.createCells(cType, 1)); - this.table.appendChild(nrow); - } - } - } - }; - - api.table = { - getCellsBetween: function(cell1, cell2) { - var c1 = new TableModifyerByCell(cell1); - return c1.getMapElsTo(cell2); - }, - - addCells: function(cell, where) { - var c = new TableModifyerByCell(cell); - c.add(where); - }, - - removeCells: function(cell, what) { - var c = new TableModifyerByCell(cell); - c.remove(what); - }, - - mergeCellsBetween: function(cell1, cell2) { - var c1 = new TableModifyerByCell(cell1); - c1.merge(cell2); - }, - - unmergeCell: function(cell) { - var c = new TableModifyerByCell(cell); - c.unmerge(); - }, - - orderSelectionEnds: function(cell, cell2) { - var c = new TableModifyerByCell(cell); - return c.orderSelectionEnds(cell2); - }, - - indexOf: function(cell) { - var c = new TableModifyerByCell(cell); - c.setTableMap(); - return c.getMapIndex(cell); - }, - - findCell: function(table, idx) { - var c = new TableModifyerByCell(null, table); - return c.getElementAtIndex(idx); - }, - - findRowByCell: function(cell) { - var c = new TableModifyerByCell(cell); - return c.getRowElementsByCell(); - }, - - findColumnByCell: function(cell) { - var c = new TableModifyerByCell(cell); - return c.getColumnElementsByCell(); - }, - - canMerge: function(cell1, cell2) { - var c = new TableModifyerByCell(cell1); - return c.canMerge(cell2); - } - }; - -})(wysihtml); -;// does a selector query on element or array of elements -wysihtml.dom.query = function(elements, query) { - var ret = [], - q; - - if (elements.nodeType) { - elements = [elements]; - } - - for (var e = 0, len = elements.length; e < len; e++) { - q = elements[e].querySelectorAll(query); - if (q) { - for(var i = q.length; i--; ret.unshift(q[i])); - } - } - return ret; -}; -;wysihtml.dom.compareDocumentPosition = (function() { - var documentElement = document.documentElement; - if (documentElement.compareDocumentPosition) { - return function(container, element) { - return container.compareDocumentPosition(element); - }; - } else { - return function( container, element ) { - // implementation borrowed from https://github.com/tmpvar/jsdom/blob/681a8524b663281a0f58348c6129c8c184efc62c/lib/jsdom/level3/core.js // MIT license - var thisOwner, otherOwner; - - if( container.nodeType === 9) // Node.DOCUMENT_NODE - thisOwner = container; - else - thisOwner = container.ownerDocument; - - if( element.nodeType === 9) // Node.DOCUMENT_NODE - otherOwner = element; - else - otherOwner = element.ownerDocument; - - if( container === element ) return 0; - if( container === element.ownerDocument ) return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - if( container.ownerDocument === element ) return 2 + 8; //Node.DOCUMENT_POSITION_PRECEDING + Node.DOCUMENT_POSITION_CONTAINS; - if( thisOwner !== otherOwner ) return 1; // Node.DOCUMENT_POSITION_DISCONNECTED; - - // Text nodes for attributes does not have a _parentNode. So we need to find them as attribute child. - if( container.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && container.childNodes && wysihtml.lang.array(container.childNodes).indexOf( element ) !== -1) - return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - - if( element.nodeType === 2 /*Node.ATTRIBUTE_NODE*/ && element.childNodes && wysihtml.lang.array(element.childNodes).indexOf( container ) !== -1) - return 2 + 8; //Node.DOCUMENT_POSITION_PRECEDING + Node.DOCUMENT_POSITION_CONTAINS; - - var point = container; - var parents = [ ]; - var previous = null; - while( point ) { - if( point == element ) return 2 + 8; //Node.DOCUMENT_POSITION_PRECEDING + Node.DOCUMENT_POSITION_CONTAINS; - parents.push( point ); - point = point.parentNode; - } - point = element; - previous = null; - while( point ) { - if( point == container ) return 4 + 16; //Node.DOCUMENT_POSITION_FOLLOWING + Node.DOCUMENT_POSITION_CONTAINED_BY; - var location_index = wysihtml.lang.array(parents).indexOf( point ); - if( location_index !== -1) { - var smallest_common_ancestor = parents[ location_index ]; - var this_index = wysihtml.lang.array(smallest_common_ancestor.childNodes).indexOf( parents[location_index - 1]);//smallest_common_ancestor.childNodes.toArray().indexOf( parents[location_index - 1] ); - var other_index = wysihtml.lang.array(smallest_common_ancestor.childNodes).indexOf( previous ); //smallest_common_ancestor.childNodes.toArray().indexOf( previous ); - if( this_index > other_index ) { - return 2; //Node.DOCUMENT_POSITION_PRECEDING; - } - else { - return 4; //Node.DOCUMENT_POSITION_FOLLOWING; - } - } - previous = point; - point = point.parentNode; - } - return 1; //Node.DOCUMENT_POSITION_DISCONNECTED; - }; - } -})(); -;/* Unwraps element and returns list of childNodes that the node contained. - * - * Example: - * var childnodes = wysihtml.dom.unwrap(document.querySelector('.unwrap-me')); -*/ - -wysihtml.dom.unwrap = function(node) { - var children = []; - if (node.parentNode) { - while (node.lastChild) { - children.unshift(node.lastChild); - wysihtml.dom.insert(node.lastChild).after(node); - } - node.parentNode.removeChild(node); - } - return children; -}; -;/* - * Methods for fetching pasted html before it gets inserted into content -**/ - -/* Modern event.clipboardData driven approach. - * Advantage is that it does not have to loose selection or modify dom to catch the data. - * IE does not support though. -**/ -wysihtml.dom.getPastedHtml = function(event) { - var html; - if (wysihtml.browser.supportsModernPaste() && event.clipboardData) { - if (wysihtml.lang.array(event.clipboardData.types).contains('text/html')) { - html = event.clipboardData.getData('text/html'); - } else if (wysihtml.lang.array(event.clipboardData.types).contains('text/plain')) { - html = wysihtml.lang.string(event.clipboardData.getData('text/plain')).escapeHTML(true, true); - } - } - return html; -}; - -/* Older temprorary contenteditable as paste source catcher method for fallbacks */ -wysihtml.dom.getPastedHtmlWithDiv = function (composer, f) { - var selBookmark = composer.selection.getBookmark(), - doc = composer.element.ownerDocument, - cleanerDiv = doc.createElement('DIV'), - scrollPos = composer.getScrollPos(); - - doc.body.appendChild(cleanerDiv); - - cleanerDiv.style.width = "1px"; - cleanerDiv.style.height = "1px"; - cleanerDiv.style.overflow = "hidden"; - cleanerDiv.style.position = "absolute"; - cleanerDiv.style.top = scrollPos.y + "px"; - cleanerDiv.style.left = scrollPos.x + "px"; - - cleanerDiv.setAttribute('contenteditable', 'true'); - cleanerDiv.focus(); - - setTimeout(function () { - var html; - - composer.selection.setBookmark(selBookmark); - html = cleanerDiv.innerHTML; - if (html && (/^$/i).test(html.trim())) { - html = false; - } - f(html); - cleanerDiv.parentNode.removeChild(cleanerDiv); - }, 0); -}; -;wysihtml.dom.removeInvisibleSpaces = function(node) { - var textNodes = wysihtml.dom.getTextNodes(node); - for (var n = textNodes.length; n--;) { - textNodes[n].nodeValue = textNodes[n].nodeValue.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); - } -}; -;/** - * Fix most common html formatting misbehaviors of browsers implementation when inserting - * content via copy & paste contentEditable - * - * @author Christopher Blum - */ -wysihtml.quirks.cleanPastedHTML = (function() { - - var styleToRegex = function (styleStr) { - var trimmedStr = wysihtml.lang.string(styleStr).trim(), - escapedStr = trimmedStr.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); - - return new RegExp("^((?!^" + escapedStr + "$).)*$", "i"); - }; - - var extendRulesWithStyleExceptions = function (rules, exceptStyles) { - var newRules = wysihtml.lang.object(rules).clone(true), - tag, style; - - for (tag in newRules.tags) { - - if (newRules.tags.hasOwnProperty(tag)) { - if (newRules.tags[tag].keep_styles) { - for (style in newRules.tags[tag].keep_styles) { - if (newRules.tags[tag].keep_styles.hasOwnProperty(style)) { - if (exceptStyles[style]) { - newRules.tags[tag].keep_styles[style] = styleToRegex(exceptStyles[style]); - } - } - } - } - } - } - - return newRules; - }; - - var pickRuleset = function(ruleset, html) { - var pickedSet, defaultSet; - - if (!ruleset) { - return null; - } - - for (var i = 0, max = ruleset.length; i < max; i++) { - if (!ruleset[i].condition) { - defaultSet = ruleset[i].set; - } - if (ruleset[i].condition && ruleset[i].condition.test(html)) { - return ruleset[i].set; - } - } - - return defaultSet; - }; - - return function(html, options) { - var exceptStyles = { - 'color': wysihtml.dom.getStyle("color").from(options.referenceNode), - 'fontSize': wysihtml.dom.getStyle("font-size").from(options.referenceNode) - }, - rules = extendRulesWithStyleExceptions(pickRuleset(options.rules, html) || {}, exceptStyles), - newHtml; - - newHtml = wysihtml.dom.parse(html, { - "rules": rules, - "cleanUp": true, // elements, empty or without attributes, should be removed/replaced with their content - "context": options.referenceNode.ownerDocument, - "uneditableClass": options.uneditableClass, - "clearInternals" : true, // don't paste temprorary selection and other markings - "unjoinNbsps" : true - }); - - return newHtml; - }; - -})(); -;/** - * IE and Opera leave an empty paragraph in the contentEditable element after clearing it - * - * @param {Object} contentEditableElement The contentEditable element to observe for clearing events - * @exaple - * wysihtml.quirks.ensureProperClearing(myContentEditableElement); - */ -wysihtml.quirks.ensureProperClearing = (function() { - var clearIfNecessary = function() { - var element = this; - setTimeout(function() { - var innerHTML = element.innerHTML.toLowerCase(); - if (innerHTML == "

     

    " || - innerHTML == "

     

     

    ") { - element.innerHTML = ""; - } - }, 0); - }; - - return function(composer) { - wysihtml.dom.observe(composer.element, ["cut", "keydown"], clearIfNecessary); - }; -})(); -;// See https://bugzilla.mozilla.org/show_bug.cgi?id=664398 -// -// In Firefox this: -// var d = document.createElement("div"); -// d.innerHTML =''; -// d.innerHTML; -// will result in: -// -// which is wrong -(function(wysihtml) { - var TILDE_ESCAPED = "%7E"; - wysihtml.quirks.getCorrectInnerHTML = function(element) { - var innerHTML = element.innerHTML; - if (innerHTML.indexOf(TILDE_ESCAPED) === -1) { - return innerHTML; - } - - var elementsWithTilde = element.querySelectorAll("[href*='~'], [src*='~']"), - url, - urlToSearch, - length, - i; - for (i=0, length=elementsWithTilde.length; i 0) { - for (var i = 0; i < selectedCells.length; i++) { - dom.removeClass(selectedCells[i], selection_class); - } - } - } - } - - function addSelections (cells) { - for (var i = 0; i < cells.length; i++) { - dom.addClass(cells[i], selection_class); - } - } - - function handleMouseMove (event) { - var curTable = null, - cell = dom.getParentElement(event.target, { query: "td, th" }, false, editable), - oldEnd; - - if (cell && select.table && select.start) { - curTable = dom.getParentElement(cell, { query: "table" }, false, editable); - if (curTable && curTable === select.table) { - removeCellSelections(); - oldEnd = select.end; - select.end = cell; - select.cells = dom.table.getCellsBetween(select.start, cell); - if (select.cells.length > 1) { - editor.composer.selection.deselect(); - } - addSelections(select.cells); - if (select.end !== oldEnd) { - editor.fire("tableselectchange").fire("tableselectchange:composer"); - } - } - } - } - - function handleMouseUp (event) { - editable.removeEventListener("mousemove", handleMouseMove); - editable.removeEventListener("mouseup", handleMouseUp); - editor.fire("tableselect").fire("tableselect:composer"); - setTimeout(function() { - bindSideclick(); - },0); - } - - var sideClickHandler = function(event) { - editable.ownerDocument.removeEventListener("click", sideClickHandler); - if (dom.getParentElement(event.target, { query: "table" }, false, editable) != select.table) { - removeCellSelections(); - select.table = null; - select.start = null; - select.end = null; - editor.fire("tableunselect").fire("tableunselect:composer"); - } - }; - - function bindSideclick () { - editable.ownerDocument.addEventListener("click", sideClickHandler); - } - - function selectCells (start, end) { - select.start = start; - select.end = end; - select.table = dom.getParentElement(select.start, { query: "table" }, false, editable); - selectedCells = dom.table.getCellsBetween(select.start, select.end); - addSelections(selectedCells); - bindSideclick(); - editor.fire("tableselect").fire("tableselect:composer"); - } - - return init(); - -}; -;(function(wysihtml) { - - // List of supported color format parsing methods - // If radix is not defined 10 is expected as default - var colorParseMethods = { - rgba : { - regex: /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]+)\s*\)/i, - name: "rgba" - }, - rgb : { - regex: /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/i, - name: "rgb" - }, - hex6 : { - regex: /^#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])/i, - name: "hex", - radix: 16 - }, - hex3 : { - regex: /^#([0-9a-f])([0-9a-f])([0-9a-f])/i, - name: "hex", - radix: 16 - } - }, - // Takes a style key name as an argument and makes a regex that can be used to the match key:value pair from style string - makeParamRegExp = function (p) { - return new RegExp("(^|\\s|;)" + p + "\\s*:\\s*[^;$]+", "gi"); - }; - - // Takes color string value ("#abc", "rgb(1,2,3)", ...) as an argument and returns suitable parsing method for it - function getColorParseMethod (colorStr) { - var prop, colorTypeConf; - - for (prop in colorParseMethods) { - if (!colorParseMethods.hasOwnProperty(prop)) { continue; } - - colorTypeConf = colorParseMethods[prop]; - - if (colorTypeConf.regex.test(colorStr)) { - return colorTypeConf; - } - } - } - - // Takes color string value ("#abc", "rgb(1,2,3)", ...) as an argument and returns the type of that color format "hex", "rgb", "rgba". - function getColorFormat (colorStr) { - var type = getColorParseMethod(colorStr); - - return type ? type.name : undefined; - } - - // Public API functions for styleParser - wysihtml.quirks.styleParser = { - - // Takes color string value as an argument and returns suitable parsing method for it - getColorParseMethod : getColorParseMethod, - - // Takes color string value as an argument and returns the type of that color format "hex", "rgb", "rgba". - getColorFormat : getColorFormat, - - /* Parses a color string to and array of [red, green, blue, alpha]. - * paramName: optional argument to parse color value directly from style string parameter - * - * Examples: - * var colorArray = wysihtml.quirks.styleParser.parseColor("#ABC"); // [170, 187, 204, 1] - * var colorArray = wysihtml.quirks.styleParser.parseColor("#AABBCC"); // [170, 187, 204, 1] - * var colorArray = wysihtml.quirks.styleParser.parseColor("rgb(1,2,3)"); // [1, 2, 3, 1] - * var colorArray = wysihtml.quirks.styleParser.parseColor("rgba(1,2,3,0.5)"); // [1, 2, 3, 0.5] - * - * var colorArray = wysihtml.quirks.styleParser.parseColor("background-color: #ABC; color: #000;", "background-color"); // [170, 187, 204, 1] - * var colorArray = wysihtml.quirks.styleParser.parseColor("background-color: #ABC; color: #000;", "color"); // [0, 0, 0, 1] - */ - parseColor : function (stylesStr, paramName) { - var paramsRegex, params, colorType, colorMatch, radix, - colorStr = stylesStr; - - if (paramName) { - paramsRegex = makeParamRegExp(paramName); - - if (!(params = stylesStr.match(paramsRegex))) { return false; } - - params = params.pop().split(":")[1]; - colorStr = wysihtml.lang.string(params).trim(); - } - - if (!(colorType = getColorParseMethod(colorStr))) { return false; } - if (!(colorMatch = colorStr.match(colorType.regex))) { return false; } - - radix = colorType.radix || 10; - - if (colorType === colorParseMethods.hex3) { - colorMatch.shift(); - colorMatch.push(1); - return wysihtml.lang.array(colorMatch).map(function(d, idx) { - return (idx < 3) ? (parseInt(d, radix) * radix) + parseInt(d, radix): parseFloat(d); - }); - } - - colorMatch.shift(); - - if (!colorMatch[3]) { - colorMatch.push(1); - } - - return wysihtml.lang.array(colorMatch).map(function(d, idx) { - return (idx < 3) ? parseInt(d, radix): parseFloat(d); - }); - }, - - /* Takes rgba color array [r,g,b,a] as a value and formats it to color string with given format type - * If no format is given, rgba/rgb is returned based on alpha value - * - * Example: - * var colorStr = wysihtml.quirks.styleParser.unparseColor([170, 187, 204, 1], "hash"); // "#AABBCC" - * var colorStr = wysihtml.quirks.styleParser.unparseColor([170, 187, 204, 1], "hex"); // "AABBCC" - * var colorStr = wysihtml.quirks.styleParser.unparseColor([170, 187, 204, 1], "csv"); // "170, 187, 204, 1" - * var colorStr = wysihtml.quirks.styleParser.unparseColor([170, 187, 204, 1], "rgba"); // "rgba(170,187,204,1)" - * var colorStr = wysihtml.quirks.styleParser.unparseColor([170, 187, 204, 1], "rgb"); // "rgb(170,187,204)" - * - * var colorStr = wysihtml.quirks.styleParser.unparseColor([170, 187, 204, 0.5]); // "rgba(170,187,204,0.5)" - * var colorStr = wysihtml.quirks.styleParser.unparseColor([170, 187, 204, 1]); // "rgb(170,187,204)" - */ - unparseColor: function(val, colorFormat) { - var hexRadix = 16; - - if (colorFormat === "hex") { - return (val[0].toString(hexRadix) + val[1].toString(hexRadix) + val[2].toString(hexRadix)).toUpperCase(); - } else if (colorFormat === "hash") { - return "#" + (val[0].toString(hexRadix) + val[1].toString(hexRadix) + val[2].toString(hexRadix)).toUpperCase(); - } else if (colorFormat === "rgb") { - return "rgb(" + val[0] + "," + val[1] + "," + val[2] + ")"; - } else if (colorFormat === "rgba") { - return "rgba(" + val[0] + "," + val[1] + "," + val[2] + "," + val[3] + ")"; - } else if (colorFormat === "csv") { - return val[0] + "," + val[1] + "," + val[2] + "," + val[3]; - } - - if (val[3] && val[3] !== 1) { - return "rgba(" + val[0] + "," + val[1] + "," + val[2] + "," + val[3] + ")"; - } else { - return "rgb(" + val[0] + "," + val[1] + "," + val[2] + ")"; - } - }, - - // Parses font size value from style string - parseFontSize: function(stylesStr) { - var params = stylesStr.match(makeParamRegExp("font-size")); - if (params) { - return wysihtml.lang.string(params[params.length - 1].split(":")[1]).trim(); - } - return false; - } - }; - -})(wysihtml); -;/** - * Selection API - * - * @example - * var selection = new wysihtml.Selection(editor); - */ -(function(wysihtml) { - var dom = wysihtml.dom; - - function _getCumulativeOffsetTop(element) { - var top = 0; - if (element.parentNode) { - do { - top += element.offsetTop || 0; - element = element.offsetParent; - } while (element); - } - return top; - } - - // Provides the depth of ``descendant`` relative to ``ancestor`` - function getDepth(ancestor, descendant) { - var ret = 0; - while (descendant !== ancestor) { - ret++; - descendant = descendant.parentNode; - if (!descendant) - throw new Error("not a descendant of ancestor!"); - } - return ret; - } - - function getRangeNode(node, offset) { - if (node.nodeType === 3) { - return node; - } else { - return node.childNodes[offset] || node; - } - } - - function getWebkitSelectionFixNode(container) { - var blankNode = document.createElement('span'); - - var placeholderRemover = function(event) { - // Self-destructs the caret and keeps the text inserted into it by user - var lastChild; - - container.removeEventListener('mouseup', placeholderRemover); - container.removeEventListener('keydown', placeholderRemover); - container.removeEventListener('touchstart', placeholderRemover); - container.removeEventListener('focus', placeholderRemover); - container.removeEventListener('blur', placeholderRemover); - container.removeEventListener('paste', delayedPlaceholderRemover); - container.removeEventListener('drop', delayedPlaceholderRemover); - container.removeEventListener('beforepaste', delayedPlaceholderRemover); - - if (blankNode && blankNode.parentNode) { - blankNode.parentNode.removeChild(blankNode); - } - }, - delayedPlaceholderRemover = function (event) { - if (blankNode && blankNode.parentNode) { - setTimeout(placeholderRemover, 0); - } - }; - - blankNode.appendChild(container.ownerDocument.createTextNode(wysihtml.INVISIBLE_SPACE)); - blankNode.className = '_wysihtml5-temp-caret-fix'; - blankNode.style.display = 'block'; - blankNode.style.minWidth = '1px'; - blankNode.style.height = '0px'; - - container.addEventListener('mouseup', placeholderRemover); - container.addEventListener('keydown', placeholderRemover); - container.addEventListener('touchstart', placeholderRemover); - container.addEventListener('focus', placeholderRemover); - container.addEventListener('blur', placeholderRemover); - container.addEventListener('paste', delayedPlaceholderRemover); - container.addEventListener('drop', delayedPlaceholderRemover); - container.addEventListener('beforepaste', delayedPlaceholderRemover); - - return blankNode; - } - - // Should fix the obtained ranges that cannot surrond contents normally to apply changes upon - // Being considerate to firefox that sets range start start out of span and end inside on doubleclick initiated selection - function expandRangeToSurround(range) { - if (range.canSurroundContents()) return; - - var common = range.commonAncestorContainer, - start_depth = getDepth(common, range.startContainer), - end_depth = getDepth(common, range.endContainer); - - while(!range.canSurroundContents()) { - // In the following branches, we cannot just decrement the depth variables because the setStartBefore/setEndAfter may move the start or end of the range more than one level relative to ``common``. So we need to recompute the depth. - if (start_depth > end_depth) { - range.setStartBefore(range.startContainer); - start_depth = getDepth(common, range.startContainer); - } - else { - range.setEndAfter(range.endContainer); - end_depth = getDepth(common, range.endContainer); - } - } - } - - wysihtml.Selection = Base.extend( - /** @scope wysihtml.Selection.prototype */ { - constructor: function(editor, contain, unselectableClass) { - // Make sure that our external range library is initialized - rangy.init(); - - this.editor = editor; - this.composer = editor.composer; - this.doc = this.composer.doc; - this.win = this.composer.win; - this.contain = contain; - this.unselectableClass = unselectableClass || false; - }, - - /** - * Get the current selection as a bookmark to be able to later restore it - * - * @return {Object} An object that represents the current selection - */ - getBookmark: function() { - var range = this.getRange(); - return range && range.cloneRange(); - }, - - /** - * Restore a selection retrieved via wysihtml.Selection.prototype.getBookmark - * - * @param {Object} bookmark An object that represents the current selection - */ - setBookmark: function(bookmark) { - if (!bookmark) { - return; - } - - this.setSelection(bookmark); - }, - - /** - * Set the caret in front of the given node - * - * @param {Object} node The element or text node where to position the caret in front of - * @example - * selection.setBefore(myElement); - */ - setBefore: function(node) { - var range = rangy.createRange(this.doc); - range.setStartBefore(node); - range.setEndBefore(node); - return this.setSelection(range); - }, - - // Constructs a self removing whitespace (ain absolute positioned span) for placing selection caret when normal methods fail. - // Webkit has an issue with placing caret into places where there are no textnodes near by. - createTemporaryCaretSpaceAfter: function (node) { - var caretPlaceholder = this.doc.createElement('span'), - caretPlaceholderText = this.doc.createTextNode(wysihtml.INVISIBLE_SPACE), - placeholderRemover = (function(event) { - // Self-destructs the caret and keeps the text inserted into it by user - var lastChild; - - this.contain.removeEventListener('mouseup', placeholderRemover); - this.contain.removeEventListener('keydown', keyDownHandler); - this.contain.removeEventListener('touchstart', placeholderRemover); - this.contain.removeEventListener('focus', placeholderRemover); - this.contain.removeEventListener('blur', placeholderRemover); - this.contain.removeEventListener('paste', delayedPlaceholderRemover); - this.contain.removeEventListener('drop', delayedPlaceholderRemover); - this.contain.removeEventListener('beforepaste', delayedPlaceholderRemover); - - // If user inserted sth it is in the placeholder and sgould be unwrapped and stripped of invisible whitespace hack - // Otherwise the wrapper can just be removed - if (caretPlaceholder && caretPlaceholder.parentNode) { - caretPlaceholder.innerHTML = caretPlaceholder.innerHTML.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); - if ((/[^\s]+/).test(caretPlaceholder.innerHTML)) { - lastChild = caretPlaceholder.lastChild; - wysihtml.dom.unwrap(caretPlaceholder); - this.setAfter(lastChild); - } else { - caretPlaceholder.parentNode.removeChild(caretPlaceholder); - } - - } - }).bind(this), - delayedPlaceholderRemover = function (event) { - if (caretPlaceholder && caretPlaceholder.parentNode) { - setTimeout(placeholderRemover, 0); - } - }, - keyDownHandler = function(event) { - if (event.which !== 8 && event.which !== 91 && event.which !== 17 && (event.which !== 86 || (!event.ctrlKey && !event.metaKey))) { - placeholderRemover(); - } - }; - - caretPlaceholder.className = '_wysihtml5-temp-caret-fix'; - caretPlaceholder.style.position = 'absolute'; - caretPlaceholder.style.display = 'block'; - caretPlaceholder.style.minWidth = '1px'; - caretPlaceholder.style.zIndex = '99999'; - caretPlaceholder.appendChild(caretPlaceholderText); - - node.parentNode.insertBefore(caretPlaceholder, node.nextSibling); - this.setBefore(caretPlaceholderText); - - // Remove the caret fix on any of the following events (some are delayed as content change happens after event) - this.contain.addEventListener('mouseup', placeholderRemover); - this.contain.addEventListener('keydown', keyDownHandler); - this.contain.addEventListener('touchstart', placeholderRemover); - this.contain.addEventListener('focus', placeholderRemover); - this.contain.addEventListener('blur', placeholderRemover); - this.contain.addEventListener('paste', delayedPlaceholderRemover); - this.contain.addEventListener('drop', delayedPlaceholderRemover); - this.contain.addEventListener('beforepaste', delayedPlaceholderRemover); - - return caretPlaceholder; - }, - - /** - * Set the caret after the given node - * - * @param {Object} node The element or text node where to position the caret in front of - * @example - * selection.setBefore(myElement); - * callback is an optional parameter accepting a function to execute when selection ahs been set - */ - setAfter: function(node, notVisual, callback) { - var win = this.win, - range = rangy.createRange(this.doc), - fixWebkitSelection = function() { - // Webkit fails to add selection if there are no textnodes in that region - // (like an uneditable container at the end of content). - var parent = node.parentNode, - lastSibling = parent ? parent.childNodes[parent.childNodes.length - 1] : null; - - if (!sel || (lastSibling === node && node.nodeType === 1 && win.getComputedStyle(node).display === "block")) { - if (notVisual) { - // If setAfter is used as internal between actions, self-removing caretPlaceholder has simpler implementation - // and remove itself in call stack end instead on user interaction - var caretPlaceholder = this.doc.createTextNode(wysihtml.INVISIBLE_SPACE); - node.parentNode.insertBefore(caretPlaceholder, node.nextSibling); - this.selectNode(caretPlaceholder); - setTimeout(function() { - if (caretPlaceholder && caretPlaceholder.parentNode) { - caretPlaceholder.parentNode.removeChild(caretPlaceholder); - } - }, 0); - } else { - this.createTemporaryCaretSpaceAfter(node); - } - } - }.bind(this), - sel; - - range.setStartAfter(node); - range.setEndAfter(node); - - // In IE contenteditable must be focused before we can set selection - // thus setting the focus if activeElement is not this composer - if (!document.activeElement || document.activeElement !== this.composer.element) { - var scrollPos = this.composer.getScrollPos(); - this.composer.element.focus(); - this.composer.setScrollPos(scrollPos); - setTimeout(function() { - sel = this.setSelection(range); - fixWebkitSelection(); - if (callback) { - callback(sel); - } - }.bind(this), 0); - } else { - sel = this.setSelection(range); - fixWebkitSelection(); - if (callback) { - callback(sel); - } - } - }, - - /** - * Ability to select/mark nodes - * - * @param {Element} node The node/element to select - * @example - * selection.selectNode(document.getElementById("my-image")); - */ - selectNode: function(node, avoidInvisibleSpace) { - var range = rangy.createRange(this.doc), - isElement = node.nodeType === wysihtml.ELEMENT_NODE, - canHaveHTML = "canHaveHTML" in node ? node.canHaveHTML : (node.nodeName !== "IMG"), - content = isElement ? node.innerHTML : node.data, - isEmpty = (content === "" || content === wysihtml.INVISIBLE_SPACE), - displayStyle = dom.getStyle("display").from(node), - isBlockElement = (displayStyle === "block" || displayStyle === "list-item"); - - if (isEmpty && isElement && canHaveHTML && !avoidInvisibleSpace) { - // Make sure that caret is visible in node by inserting a zero width no breaking space - try { node.innerHTML = wysihtml.INVISIBLE_SPACE; } catch(e) {} - } - if (canHaveHTML) { - range.selectNodeContents(node); - } else { - range.selectNode(node); - } - - if (canHaveHTML && isEmpty && isElement) { - range.collapse(isBlockElement); - } else if (canHaveHTML && isEmpty) { - range.setStartAfter(node); - range.setEndAfter(node); - } - - this.setSelection(range); - }, - - /** - * Get the node which contains the selection - * - * @param {Boolean} [controlRange] (only IE) Whether it should return the selected ControlRange element when the selection type is a "ControlRange" - * @return {Object} The node that contains the caret - * @example - * var nodeThatContainsCaret = selection.getSelectedNode(); - */ - getSelectedNode: function(controlRange) { - var selection, - range; - - if (controlRange && this.doc.selection && this.doc.selection.type === "Control") { - range = this.doc.selection.createRange(); - if (range && range.length) { - return range.item(0); - } - } - - selection = this.getSelection(this.doc); - if (selection.focusNode === selection.anchorNode) { - return selection.focusNode; - } else { - range = this.getRange(this.doc); - return range ? range.commonAncestorContainer : this.doc.body; - } - }, - - fixSelBorders: function() { - var range = this.getRange(); - expandRangeToSurround(range); - this.setSelection(range); - }, - - getSelectedOwnNodes: function(controlRange) { - var selection, - ranges = this.getOwnRanges(), - ownNodes = []; - - for (var i = 0, maxi = ranges.length; i < maxi; i++) { - ownNodes.push(ranges[i].commonAncestorContainer || this.doc.body); - } - return ownNodes; - }, - - findNodesInSelection: function(nodeTypes) { - var ranges = this.getOwnRanges(), - nodes = [], curNodes; - for (var i = 0, maxi = ranges.length; i < maxi; i++) { - curNodes = ranges[i].getNodes([1], function(node) { - return wysihtml.lang.array(nodeTypes).contains(node.nodeName); - }); - nodes = nodes.concat(curNodes); - } - return nodes; - }, - - filterElements: function(filter) { - var ranges = this.getOwnRanges(), - nodes = [], curNodes; - - for (var i = 0, maxi = ranges.length; i < maxi; i++) { - curNodes = ranges[i].getNodes([1], function(element){ - return filter(element, ranges[i]); - }); - nodes = nodes.concat(curNodes); - } - return nodes; - }, - - containsUneditable: function() { - var uneditables = this.getOwnUneditables(), - selection = this.getSelection(); - - for (var i = 0, maxi = uneditables.length; i < maxi; i++) { - if (selection.containsNode(uneditables[i])) { - return true; - } - } - - return false; - }, - - // Deletes selection contents making sure uneditables/unselectables are not partially deleted - // Triggers wysihtml5:uneditable:delete custom event on all deleted uneditables if customevents suppoorted - deleteContents: function() { - var range = this.getRange(); - this.deleteRangeContents(range); - this.setSelection(range); - }, - - // Makes sure all uneditable sare notified before deleting contents - deleteRangeContents: function (range) { - var startParent, endParent, uneditables, ev; - - if (this.unselectableClass) { - if ((startParent = wysihtml.dom.getParentElement(range.startContainer, { query: "." + this.unselectableClass }, false, this.contain))) { - range.setStartBefore(startParent); - } - if ((endParent = wysihtml.dom.getParentElement(range.endContainer, { query: "." + this.unselectableClass }, false, this.contain))) { - range.setEndAfter(endParent); - } - - // If customevents present notify uneditable elements of being deleted - uneditables = range.getNodes([1], (function (node) { - return wysihtml.dom.hasClass(node, this.unselectableClass); - }).bind(this)); - for (var i = uneditables.length; i--;) { - try { - ev = new CustomEvent("wysihtml5:uneditable:delete"); - uneditables[i].dispatchEvent(ev); - } catch (err) {} - } - } - range.deleteContents(); - }, - - getCaretNode: function () { - var selection = this.getSelection(); - return (selection && selection.anchorNode) ? getRangeNode(selection.anchorNode, selection.anchorOffset) : null; - }, - - getPreviousNode: function(node, ignoreEmpty) { - var displayStyle; - if (!node) { - var selection = this.getSelection(); - node = (selection && selection.anchorNode) ? getRangeNode(selection.anchorNode, selection.anchorOffset) : null; - } - - if (node === this.contain) { - return false; - } - - var ret = node.previousSibling, - parent; - - if (ret === this.contain) { - return false; - } - - if (ret && ret.nodeType !== 3 && ret.nodeType !== 1) { - // do not count comments and other node types - ret = this.getPreviousNode(ret, ignoreEmpty); - } else if (ret && ret.nodeType === 3 && (/^\s*$/).test(ret.textContent)) { - // do not count empty textnodes as previous nodes - ret = this.getPreviousNode(ret, ignoreEmpty); - } else if (ignoreEmpty && ret && ret.nodeType === 1) { - // Do not count empty nodes if param set. - // Contenteditable tends to bypass and delete these silently when deleting with caret when element is inline-like - displayStyle = wysihtml.dom.getStyle("display").from(ret); - if ( - !wysihtml.lang.array(["BR", "HR", "IMG"]).contains(ret.nodeName) && - !wysihtml.lang.array(["block", "inline-block", "flex", "list-item", "table"]).contains(displayStyle) && - (/^[\s]*$/).test(ret.innerHTML) - ) { - ret = this.getPreviousNode(ret, ignoreEmpty); - } - } else if (!ret && node !== this.contain) { - parent = node.parentNode; - if (parent !== this.contain) { - ret = this.getPreviousNode(parent, ignoreEmpty); - } - } - - return (ret !== this.contain) ? ret : false; - }, - - // Gather info about caret location (caret node, previous and next node) - getNodesNearCaret: function() { - if (!this.isCollapsed()) { - throw "Selection must be caret when using selection.getNodesNearCaret()"; - } - - var r = this.getOwnRanges(), - caretNode, prevNode, nextNode, offset; - - if (r && r.length > 0) { - if (r[0].startContainer.nodeType === 1) { - caretNode = r[0].startContainer.childNodes[r[0].startOffset - 1]; - if (!caretNode && r[0].startOffset === 0) { - // Is first position before all nodes - nextNode = r[0].startContainer.childNodes[0]; - } else if (caretNode) { - prevNode = caretNode.previousSibling; - nextNode = caretNode.nextSibling; - } - } else { - if (r[0].startOffset === 0 && r[0].startContainer.previousSibling) { - caretNode = r[0].startContainer.previousSibling; - if (caretNode.nodeType === 3) { - offset = caretNode.data.length; - } - } else { - caretNode = r[0].startContainer; - offset = r[0].startOffset; - } - prevNode = caretNode.previousSibling; - nextNode = caretNode.nextSibling; - } - - return { - "caretNode": caretNode, - "prevNode": prevNode, - "nextNode": nextNode, - "textOffset": offset - }; - } - - return null; - }, - - getSelectionParentsByTag: function(tagName) { - var nodes = this.getSelectedOwnNodes(), - curEl, parents = []; - - for (var i = 0, maxi = nodes.length; i < maxi; i++) { - curEl = (nodes[i].nodeName && nodes[i].nodeName === 'LI') ? nodes[i] : wysihtml.dom.getParentElement(nodes[i], { query: 'li'}, false, this.contain); - if (curEl) { - parents.push(curEl); - } - } - return (parents.length) ? parents : null; - }, - - getRangeToNodeEnd: function() { - if (this.isCollapsed()) { - var range = this.getRange(), - sNode = range.startContainer, - pos = range.startOffset, - lastR = rangy.createRange(this.doc); - - lastR.selectNodeContents(sNode); - lastR.setStart(sNode, pos); - return lastR; - } - }, - - caretIsLastInSelection: function() { - var r = rangy.createRange(this.doc), - s = this.getSelection(), - endc = this.getRangeToNodeEnd().cloneContents(), - endtxt = endc.textContent; - - return (/^\s*$/).test(endtxt); - }, - - caretIsFirstInSelection: function(includeLineBreaks) { - var r = rangy.createRange(this.doc), - s = this.getSelection(), - range = this.getRange(), - startNode = getRangeNode(range.startContainer, range.startOffset); - - if (startNode) { - if (startNode.nodeType === wysihtml.TEXT_NODE) { - if (!startNode.parentNode) { - return false; - } - if (!this.isCollapsed() || (startNode.parentNode.firstChild !== startNode && !wysihtml.dom.domNode(startNode.previousSibling).is.block())) { - return false; - } - var ws = this.win.getComputedStyle(startNode.parentNode).whiteSpace; - return (ws === "pre" || ws === "pre-wrap") ? range.startOffset === 0 : (/^\s*$/).test(startNode.data.substr(0,range.startOffset)); - } else if (includeLineBreaks && wysihtml.dom.domNode(startNode).is.lineBreak()) { - return true; - } else { - r.selectNodeContents(this.getRange().commonAncestorContainer); - r.collapse(true); - return (this.isCollapsed() && (r.startContainer === s.anchorNode || r.endContainer === s.anchorNode) && r.startOffset === s.anchorOffset); - } - } - }, - - caretIsInTheBeginnig: function(ofNode) { - var selection = this.getSelection(), - node = selection.anchorNode, - offset = selection.anchorOffset; - if (ofNode && node) { - return (offset === 0 && (node.nodeName && node.nodeName === ofNode.toUpperCase() || wysihtml.dom.getParentElement(node.parentNode, { query: ofNode }, 1))); - } else if (node) { - return (offset === 0 && !this.getPreviousNode(node, true)); - } - }, - - // Returns object describing node/text before selection - // If includePrevLeaves is true returns also previous last leaf child if selection is in the beginning of current node - getBeforeSelection: function(includePrevLeaves) { - var sel = this.getSelection(), - startNode = (sel.isBackwards()) ? sel.focusNode : sel.anchorNode, - startOffset = (sel.isBackwards()) ? sel.focusOffset : sel.anchorOffset, - rng = this.createRange(), endNode, inTmpCaret; - - // If start is textnode and all is whitespace before caret. Set start offset to 0 - if (startNode && startNode.nodeType === 3 && (/^\s*$/).test(startNode.data.slice(0, startOffset))) { - startOffset = 0; - } - - // Escape temproray helper nodes if selection in them - inTmpCaret = wysihtml.dom.getParentElement(startNode, { query: '._wysihtml5-temp-caret-fix' }, 1); - if (inTmpCaret) { - startNode = inTmpCaret.parentNode; - startOffset = Array.prototype.indexOf.call(startNode.childNodes, inTmpCaret); - } - - if (startNode) { - if (startOffset > 0) { - if (startNode.nodeType === 3) { - rng.setStart(startNode, 0); - rng.setEnd(startNode, startOffset); - return { - type: "text", - range: rng, - offset : startOffset, - node: startNode - }; - } else { - rng.setStartBefore(startNode.childNodes[0]); - endNode = startNode.childNodes[startOffset - 1]; - rng.setEndAfter(endNode); - return { - type: "element", - range: rng, - offset : startOffset, - node: endNode - }; - } - } else { - rng.setStartAndEnd(startNode, 0); - - if (includePrevLeaves) { - var prevNode = this.getPreviousNode(startNode, true), - prevLeaf = null; - - if(prevNode) { - if (prevNode.nodeType === 1 && wysihtml.dom.hasClass(prevNode, this.unselectableClass)) { - prevLeaf = prevNode; - } else { - prevLeaf = wysihtml.dom.domNode(prevNode).lastLeafNode(); - } - } - - if (prevLeaf) { - return { - type: "leafnode", - range: rng, - offset : startOffset, - node: prevLeaf - }; - } - } - - return { - type: "none", - range: rng, - offset : startOffset, - node: startNode - }; - } - } - return null; - }, - - // TODO: Figure out a method from following 2 that would work universally - executeAndRestoreRangy: function(method, restoreScrollPosition) { - var sel = rangy.saveSelection(this.win); - if (!sel) { - method(); - } else { - try { - method(); - } catch(e) { - setTimeout(function() { throw e; }, 0); - } - } - rangy.restoreSelection(sel); - }, - - // TODO: has problems in chrome 12. investigate block level and uneditable area inbetween - executeAndRestore: function(method, restoreScrollPosition) { - var body = this.doc.body, - oldScrollTop = restoreScrollPosition && body.scrollTop, - oldScrollLeft = restoreScrollPosition && body.scrollLeft, - className = "_wysihtml5-temp-placeholder", - placeholderHtml = '' + wysihtml.INVISIBLE_SPACE + '', - range = this.getRange(true), - caretPlaceholder, - newCaretPlaceholder, - nextSibling, prevSibling, - node, node2, range2, - newRange; - - // Nothing selected, execute and say goodbye - if (!range) { - method(body, body); - return; - } - - if (!range.collapsed) { - range2 = range.cloneRange(); - node2 = range2.createContextualFragment(placeholderHtml); - range2.collapse(false); - range2.insertNode(node2); - range2.detach(); - } - - node = range.createContextualFragment(placeholderHtml); - range.insertNode(node); - - if (node2) { - caretPlaceholder = this.contain.querySelectorAll("." + className); - range.setStartBefore(caretPlaceholder[0]); - range.setEndAfter(caretPlaceholder[caretPlaceholder.length -1]); - } - this.setSelection(range); - - // Make sure that a potential error doesn't cause our placeholder element to be left as a placeholder - try { - method(range.startContainer, range.endContainer); - } catch(e) { - setTimeout(function() { throw e; }, 0); - } - caretPlaceholder = this.contain.querySelectorAll("." + className); - if (caretPlaceholder && caretPlaceholder.length) { - newRange = rangy.createRange(this.doc); - nextSibling = caretPlaceholder[0].nextSibling; - if (caretPlaceholder.length > 1) { - prevSibling = caretPlaceholder[caretPlaceholder.length -1].previousSibling; - } - if (prevSibling && nextSibling) { - newRange.setStartBefore(nextSibling); - newRange.setEndAfter(prevSibling); - } else { - newCaretPlaceholder = this.doc.createTextNode(wysihtml.INVISIBLE_SPACE); - dom.insert(newCaretPlaceholder).after(caretPlaceholder[0]); - newRange.setStartBefore(newCaretPlaceholder); - newRange.setEndAfter(newCaretPlaceholder); - } - this.setSelection(newRange); - for (var i = caretPlaceholder.length; i--;) { - caretPlaceholder[i].parentNode.removeChild(caretPlaceholder[i]); - } - - } else { - // fallback for when all hell breaks loose - this.contain.focus(); - } - - if (restoreScrollPosition) { - body.scrollTop = oldScrollTop; - body.scrollLeft = oldScrollLeft; - } - - // Remove it again, just to make sure that the placeholder is definitely out of the dom tree - try { - caretPlaceholder.parentNode.removeChild(caretPlaceholder); - } catch(e2) {} - }, - - set: function(node, offset) { - var newRange = rangy.createRange(this.doc); - newRange.setStart(node, offset || 0); - this.setSelection(newRange); - }, - - /** - * Insert html at the caret or selection position and move the cursor after the inserted html - * Replaces selection content if present - * - * @param {String} html HTML string to insert - * @example - * selection.insertHTML("

    foobar

    "); - */ - insertHTML: function(html) { - var range = this.getRange(), - node = this.doc.createElement('DIV'), - fragment = this.doc.createDocumentFragment(), - lastChild, lastEditorElement; - - if (range) { - range.deleteContents(); - node.innerHTML = html; - lastChild = node.lastChild; - - while (node.firstChild) { - fragment.appendChild(node.firstChild); - } - range.insertNode(fragment); - - lastEditorElement = this.contain.lastChild; - while (lastEditorElement && lastEditorElement.nodeType === 3 && lastEditorElement.previousSibling && (/^\s*$/).test(lastEditorElement.data)) { - lastEditorElement = lastEditorElement.previousSibling; - } - - if (lastChild) { - // fixes some pad cases mostly on webkit where last nr is needed - if (lastEditorElement && lastChild === lastEditorElement && lastChild.nodeType === 1) { - this.contain.appendChild(this.doc.createElement('br')); - } - this.setAfter(lastChild); - } - } - }, - - /** - * Insert a node at the caret position and move the cursor behind it - * - * @param {Object} node HTML string to insert - * @example - * selection.insertNode(document.createTextNode("foobar")); - */ - insertNode: function(node) { - var range = this.getRange(); - if (range) { - range.insertNode(node); - } - }, - - canAppendChild: function (node) { - var anchorNode, anchorNodeTagNameLower, - voidElements = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"], - range = this.getRange(); - - anchorNode = node || range.startContainer; - - if (anchorNode) { - anchorNodeTagNameLower = (anchorNode.tagName || anchorNode.nodeName).toLowerCase(); - } - - return voidElements.indexOf(anchorNodeTagNameLower) === -1; - }, - - splitElementAtCaret: function (element, insertNode) { - var sel = this.getSelection(), - range, contentAfterRangeStart, - firstChild, lastChild, childNodes; - - if (sel.rangeCount > 0) { - range = sel.getRangeAt(0).cloneRange(); // Create a copy of the selection range to work with - - range.setEndAfter(element); // Place the end of the range after the element - contentAfterRangeStart = range.extractContents(); // Extract the contents of the element after the caret into a fragment - - childNodes = contentAfterRangeStart.childNodes; - - // Empty elements are cleaned up from extracted content - for (var i = childNodes.length; i --;) { - if (!wysihtml.dom.domNode(childNodes[i]).is.visible()) { - contentAfterRangeStart.removeChild(childNodes[i]); - } - } - - element.parentNode.insertBefore(contentAfterRangeStart, element.nextSibling); - - if (insertNode) { - firstChild = insertNode.firstChild || insertNode; - lastChild = insertNode.lastChild || insertNode; - - element.parentNode.insertBefore(insertNode, element.nextSibling); - - // Select inserted node contents - if (firstChild && lastChild) { - range.setStartBefore(firstChild); - range.setEndAfter(lastChild); - this.setSelection(range); - } - } else { - range.setStartAfter(element); - range.setEndAfter(element); - } - - if (!wysihtml.dom.domNode(element).is.visible()) { - if (wysihtml.dom.getTextContent(element) === '') { - element.parentNode.removeChild(element); - } else { - element.parentNode.replaceChild(this.doc.createTextNode(" "), element); - } - } - - - } - }, - - /** - * Wraps current selection with the given node - * - * @param {Object} node The node to surround the selected elements with - */ - surround: function(nodeOptions) { - var ranges = this.getOwnRanges(), - node, nodes = []; - if (ranges.length == 0) { - return nodes; - } - - for (var i = ranges.length; i--;) { - node = this.doc.createElement(nodeOptions.nodeName); - nodes.push(node); - if (nodeOptions.className) { - node.className = nodeOptions.className; - } - if (nodeOptions.cssStyle) { - node.setAttribute('style', nodeOptions.cssStyle); - } - try { - // This only works when the range boundaries are not overlapping other elements - ranges[i].surroundContents(node); - this.selectNode(node); - } catch(e) { - // fallback - node.appendChild(ranges[i].extractContents()); - ranges[i].insertNode(node); - } - } - return nodes; - }, - - /** - * Scroll the current caret position into the view - * FIXME: This is a bit hacky, there might be a smarter way of doing this - * - * @example - * selection.scrollIntoView(); - */ - scrollIntoView: function() { - var doc = this.doc, - tolerance = 5, // px - hasScrollBars = doc.documentElement.scrollHeight > doc.documentElement.offsetHeight, - tempElement = doc._wysihtml5ScrollIntoViewElement = doc._wysihtml5ScrollIntoViewElement || (function() { - var element = doc.createElement("span"); - // The element needs content in order to be able to calculate it's position properly - element.innerHTML = wysihtml.INVISIBLE_SPACE; - return element; - })(), - offsetTop; - - if (hasScrollBars) { - this.insertNode(tempElement); - offsetTop = _getCumulativeOffsetTop(tempElement); - tempElement.parentNode.removeChild(tempElement); - if (offsetTop >= (doc.body.scrollTop + doc.documentElement.offsetHeight - tolerance)) { - doc.body.scrollTop = offsetTop; - } - } - }, - - /** - * Select line where the caret is in - */ - selectLine: function() { - var r = rangy.createRange(); - if (wysihtml.browser.supportsSelectionModify()) { - this._selectLine_W3C(); - } else if (r.nativeRange && r.nativeRange.getBoundingClientRect) { - // For IE Edge as it ditched the old api and did not fully implement the new one (as expected) - this._selectLineUniversal(); - } - }, - - includeRangyRangeHelpers: function() { - var s = this.getSelection(), - r = s.getRangeAt(0), - isHelperNode = function(node) { - return (node && node.nodeType === 1 && node.classList.contains('rangySelectionBoundary')); - }, - getNodeLength = function (node) { - if (node.nodeType === 1) { - return node.childNodes && node.childNodes.length || 0; - } else { - return node.data && node.data.length || 0; - } - }, - anode = s.anchorNode.nodeType === 1 ? s.anchorNode.childNodes[s.anchorOffset] : s.anchorNode, - fnode = s.focusNode.nodeType === 1 ? s.focusNode.childNodes[s.focusOffset] : s.focusNode; - - if (fnode && s.focusOffset === getNodeLength(fnode) && fnode.nextSibling && isHelperNode(fnode.nextSibling)) { - r.setEndAfter(fnode.nextSibling); - } - if (anode && s.anchorOffset === 0 && anode.previousSibling && isHelperNode(anode.previousSibling)) { - r.setStartBefore(anode.previousSibling); - } - r.select(); - }, - - /** - * See https://developer.mozilla.org/en/DOM/Selection/modify - */ - _selectLine_W3C: function() { - var selection = this.win.getSelection(), - initialBoundry = [selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset]; - - selection.modify("move", "left", "lineboundary"); - selection.modify("extend", "right", "lineboundary"); - - // IF lineboundary extending did not change selection try universal fallback (FF fails sometimes without a reason) - if (selection.anchorNode === initialBoundry[0] && - selection.anchorOffset === initialBoundry[1] && - selection.focusNode === initialBoundry[2] && - selection.focusOffset === initialBoundry[3] - ) { - this._selectLineUniversal(); - } else { - this.includeRangyRangeHelpers(); - } - }, - - // collapses selection to current line beginning or end - toLineBoundary: function (location, collapse) { - collapse = (typeof collapse === 'undefined') ? false : collapse; - if (wysihtml.browser.supportsSelectionModify()) { - var selection = this.win.getSelection(); - - selection.modify("extend", location, "lineboundary"); - if (collapse) { - if (location === "left") { - selection.collapseToStart(); - } else if (location === "right") { - selection.collapseToEnd(); - } - } - } - }, - - getRangeRect: function(r) { - var textNode = this.doc.createTextNode("i"), - testNode = this.doc.createTextNode("i"), - rect, cr; - - /*testNode.style.visibility = "hidden"; - testNode.style.width = "0px"; - testNode.style.display = "inline-block"; - testNode.style.overflow = "hidden"; - testNode.appendChild(textNode);*/ - - if (r.collapsed) { - r.insertNode(testNode); - r.selectNode(testNode); - rect = r.nativeRange.getBoundingClientRect(); - r.deleteContents(); - - } else { - rect = r.nativeRange.getBoundingClientRect(); - } - - return rect; - - }, - - _selectLineUniversal: function() { - var s = this.getSelection(), - r = s.getRangeAt(0), - rect, - startRange, endRange, testRange, - count = 0, - amount, testRect, found, - that = this, - isLineBreakingElement = function(el) { - return el && el.nodeType === 1 && (that.win.getComputedStyle(el).display === "block" || wysihtml.lang.array(['BR', 'HR']).contains(el.nodeName)); - }, - prevNode = function(node) { - var pnode = node; - if (pnode) { - while (pnode && ((pnode.nodeType === 1 && pnode.classList.contains('rangySelectionBoundary')) || (pnode.nodeType === 3 && (/^\s*$/).test(pnode.data)))) { - pnode = pnode.previousSibling; - } - } - return pnode; - }; - - startRange = r.cloneRange(); - endRange = r.cloneRange(); - - if (r.collapsed) { - // Collapsed state can not have a bounding rect. Thus need to expand it at least by 1 character first while not crossing line boundary - // TODO: figure out a shorter and more readable way - if (r.startContainer.nodeType === 3 && r.startOffset < r.startContainer.data.length) { - r.moveEnd('character', 1); - } else if (r.startContainer.nodeType === 1 && r.startContainer.childNodes[r.startOffset] && r.startContainer.childNodes[r.startOffset].nodeType === 3 && r.startContainer.childNodes[r.startOffset].data.length > 0) { - r.moveEnd('character', 1); - } else if ( - r.startOffset > 0 && - ( - r.startContainer.nodeType === 3 || - ( - r.startContainer.nodeType === 1 && - !isLineBreakingElement(prevNode(r.startContainer.childNodes[r.startOffset - 1])) - ) - ) - ) { - r.moveStart('character', -1); - } - } - if (!r.collapsed) { - r.insertNode(this.doc.createTextNode(wysihtml.INVISIBLE_SPACE)); - } - - // Is probably just empty line as can not be expanded - rect = r.nativeRange.getBoundingClientRect(); - // If startnode is not line break allready move the start position of range by -1 character until clientRect top changes; - do { - amount = r.moveStart('character', -1); - testRect = r.nativeRange.getBoundingClientRect(); - - if (!testRect || Math.floor(testRect.top) !== Math.floor(rect.top)) { - r.moveStart('character', 1); - found = true; - } - count++; - } while (amount !== 0 && !found && count < 2000); - count = 0; - found = false; - rect = r.nativeRange.getBoundingClientRect(); - - if (r.endContainer !== this.contain || (this.contain.lastChild && this.contain.childNodes[r.endOffset] !== this.contain.lastChild)) { - do { - amount = r.moveEnd('character', 1); - testRect = r.nativeRange.getBoundingClientRect(); - if (!testRect || Math.floor(testRect.bottom) !== Math.floor(rect.bottom)) { - r.moveEnd('character', -1); - - // Fix a IE line end marked by linebreak element although caret is before it - // If causes problems should be changed to be applied only to IE - if (r.endContainer && r.endContainer.nodeType === 1 && r.endContainer.childNodes[r.endOffset] && r.endContainer.childNodes[r.endOffset].nodeType === 1 && r.endContainer.childNodes[r.endOffset].nodeName === "BR" && r.endContainer.childNodes[r.endOffset].previousSibling) { - if (r.endContainer.childNodes[r.endOffset].previousSibling.nodeType === 1) { - r.setEnd(r.endContainer.childNodes[r.endOffset].previousSibling, r.endContainer.childNodes[r.endOffset].previousSibling.childNodes.length); - } else if (r.endContainer.childNodes[r.endOffset].previousSibling.nodeType === 3) { - r.setEnd(r.endContainer.childNodes[r.endOffset].previousSibling, r.endContainer.childNodes[r.endOffset].previousSibling.data.length); - } - } - found = true; - } - count++; - } while (amount !== 0 && !found && count < 2000); - } - r.select(); - this.includeRangyRangeHelpers(); - }, - - getText: function() { - var selection = this.getSelection(); - return selection ? selection.toString() : ""; - }, - - getNodes: function(nodeType, filter) { - var range = this.getRange(); - if (range) { - return range.getNodes(Array.isArray(nodeType) ? nodeType : [nodeType], filter); - } else { - return []; - } - }, - - // Gets all the elements in selection with nodeType - // Ignores the elements not belonging to current editable area - // If filter is defined nodes must pass the filter function with true to be included in list - getOwnNodes: function(nodeType, filter, splitBounds) { - var ranges = this.getOwnRanges(), - nodes = []; - for (var r = 0, rmax = ranges.length; r < rmax; r++) { - if (ranges[r]) { - if (splitBounds) { - ranges[r].splitBoundaries(); - } - nodes = nodes.concat(ranges[r].getNodes(Array.isArray(nodeType) ? nodeType : [nodeType], filter)); - } - } - - return nodes; - }, - - fixRangeOverflow: function(range) { - if (this.contain && this.contain.firstChild && range) { - var containment = range.compareNode(this.contain); - if (containment !== 2) { - if (containment === 1) { - range.setStartBefore(this.contain.firstChild); - } - if (containment === 0) { - range.setEndAfter(this.contain.lastChild); - } - if (containment === 3) { - range.setStartBefore(this.contain.firstChild); - range.setEndAfter(this.contain.lastChild); - } - } else if (this._detectInlineRangeProblems(range)) { - var previousElementSibling = range.endContainer.previousElementSibling; - if (previousElementSibling) { - range.setEnd(previousElementSibling, this._endOffsetForNode(previousElementSibling)); - } - } - } - }, - - _endOffsetForNode: function(node) { - var range = document.createRange(); - range.selectNodeContents(node); - return range.endOffset; - }, - - _detectInlineRangeProblems: function(range) { - var position = dom.compareDocumentPosition(range.startContainer, range.endContainer); - return ( - range.endOffset == 0 && - position & 4 //Node.DOCUMENT_POSITION_FOLLOWING - ); - }, - - getRange: function(dontFix) { - var selection = this.getSelection(), - range = selection && selection.rangeCount && selection.getRangeAt(0); - - if (dontFix !== true) { - this.fixRangeOverflow(range); - } - - return range; - }, - - getOwnUneditables: function() { - var allUneditables = dom.query(this.contain, '.' + this.unselectableClass), - deepUneditables = dom.query(allUneditables, '.' + this.unselectableClass); - - return wysihtml.lang.array(allUneditables).without(deepUneditables); - }, - - // Returns an array of ranges that belong only to this editable - // Needed as uneditable block in contenteditabel can split range into pieces - // If manipulating content reverse loop is usually needed as manipulation can shift subsequent ranges - getOwnRanges: function() { - var ranges = [], - r = this.getRange(), - tmpRanges; - - if (r) { ranges.push(r); } - - if (this.unselectableClass && this.contain && r) { - var uneditables = this.getOwnUneditables(), - tmpRange; - if (uneditables.length > 0) { - for (var i = 0, imax = uneditables.length; i < imax; i++) { - tmpRanges = []; - for (var j = 0, jmax = ranges.length; j < jmax; j++) { - if (ranges[j]) { - switch (ranges[j].compareNode(uneditables[i])) { - case 2: - // all selection inside uneditable. remove - break; - case 3: - //section begins before and ends after uneditable. spilt - tmpRange = ranges[j].cloneRange(); - tmpRange.setEndBefore(uneditables[i]); - tmpRanges.push(tmpRange); - - tmpRange = ranges[j].cloneRange(); - tmpRange.setStartAfter(uneditables[i]); - tmpRanges.push(tmpRange); - break; - default: - // in all other cases uneditable does not touch selection. dont modify - tmpRanges.push(ranges[j]); - } - } - ranges = tmpRanges; - } - } - } - } - return ranges; - }, - - getSelection: function() { - return rangy.getSelection(this.win); - }, - - // Sets selection in document to a given range - // Set selection method detects if it fails to set any selection in document and returns null on fail - // (especially needed in webkit where some ranges just can not create selection for no reason) - setSelection: function(range) { - var selection = rangy.getSelection(this.win); - selection.setSingleRange(range); - return (selection && selection.anchorNode && selection.focusNode) ? selection : null; - }, - - - - // Webkit has an ancient error of not selecting all contents when uneditable block element is first or last in editable area - selectAll: function() { - var range = this.createRange(), - composer = this.composer, - that = this, - blankEndNode = getWebkitSelectionFixNode(this.composer.element), - blankStartNode = getWebkitSelectionFixNode(this.composer.element), - s; - - var doSelect = function() { - range.setStart(composer.element, 0); - range.setEnd(composer.element, composer.element.childNodes.length); - s = that.setSelection(range); - }; - - var notSelected = function() { - return !s || (s.nativeSelection && s.nativeSelection.type && (s.nativeSelection.type === "Caret" || s.nativeSelection.type === "None")); - } - - wysihtml.dom.removeInvisibleSpaces(this.composer.element); - doSelect(); - - if (this.composer.element.firstChild && notSelected()) { - // Try fixing end - this.composer.element.appendChild(blankEndNode); - doSelect(); - - if (notSelected()) { - // Remove end fix - blankEndNode.parentNode.removeChild(blankEndNode); - - // Try fixing beginning - this.composer.element.insertBefore(blankStartNode, this.composer.element.firstChild); - doSelect(); - - if (notSelected()) { - // Try fixing both - this.composer.element.appendChild(blankEndNode); - doSelect(); - } - } - } - }, - - createRange: function() { - return rangy.createRange(this.doc); - }, - - isCollapsed: function() { - return this.getSelection().isCollapsed; - }, - - getHtml: function() { - return this.getSelection().toHtml(); - }, - - getPlainText: function () { - return this.getSelection().toString(); - }, - - isEndToEndInNode: function(nodeNames) { - var range = this.getRange(), - parentElement = range.commonAncestorContainer, - startNode = range.startContainer, - endNode = range.endContainer; - - - if (parentElement.nodeType === wysihtml.TEXT_NODE) { - parentElement = parentElement.parentNode; - } - - if (startNode.nodeType === wysihtml.TEXT_NODE && !(/^\s*$/).test(startNode.data.substr(range.startOffset))) { - return false; - } - - if (endNode.nodeType === wysihtml.TEXT_NODE && !(/^\s*$/).test(endNode.data.substr(range.endOffset))) { - return false; - } - - while (startNode && startNode !== parentElement) { - if (startNode.nodeType !== wysihtml.TEXT_NODE && !wysihtml.dom.contains(parentElement, startNode)) { - return false; - } - if (wysihtml.dom.domNode(startNode).prev({ignoreBlankTexts: true})) { - return false; - } - startNode = startNode.parentNode; - } - - while (endNode && endNode !== parentElement) { - if (endNode.nodeType !== wysihtml.TEXT_NODE && !wysihtml.dom.contains(parentElement, endNode)) { - return false; - } - if (wysihtml.dom.domNode(endNode).next({ignoreBlankTexts: true})) { - return false; - } - endNode = endNode.parentNode; - } - - return (wysihtml.lang.array(nodeNames).contains(parentElement.nodeName)) ? parentElement : false; - }, - - isInThisEditable: function() { - var sel = this.getSelection(), - fnode = sel.focusNode, - anode = sel.anchorNode; - - // In IE node contains will not work for textnodes, thus taking parentNode - if (fnode && fnode.nodeType !== 1) { - fnode = fnode.parentNode; - } - - if (anode && anode.nodeType !== 1) { - anode = anode.parentNode; - } - - return anode && fnode && - (wysihtml.dom.contains(this.composer.element, fnode) || this.composer.element === fnode) && - (wysihtml.dom.contains(this.composer.element, anode) || this.composer.element === anode); - }, - - deselect: function() { - var sel = this.getSelection(); - sel && sel.removeAllRanges(); - } - }); - -})(wysihtml); -;/** - * Rich Text Query/Formatting Commands - * - * @example - * var commands = new wysihtml.Commands(editor); - */ -wysihtml.Commands = Base.extend( - /** @scope wysihtml.Commands.prototype */ { - constructor: function(editor) { - this.editor = editor; - this.composer = editor.composer; - this.doc = this.composer.doc; - }, - - /** - * Check whether the browser supports the given command - * - * @param {String} command The command string which to check (eg. "bold", "italic", "insertUnorderedList") - * @example - * commands.supports("createLink"); - */ - support: function(command) { - return wysihtml.browser.supportsCommand(this.doc, command); - }, - - /** - * Check whether the browser supports the given command - * - * @param {String} command The command string which to execute (eg. "bold", "italic", "insertUnorderedList") - * @param {String} [value] The command value parameter, needed for some commands ("createLink", "insertImage", ...), optional for commands that don't require one ("bold", "underline", ...) - * @example - * commands.exec("insertImage", "http://a1.twimg.com/profile_images/113868655/schrei_twitter_reasonably_small.jpg"); - */ - exec: function(command, value) { - var obj = wysihtml.commands[command], - args = wysihtml.lang.array(arguments).get(), - method = obj && obj.exec, - result = null; - - // If composer ahs placeholder unset it before command - // Do not apply on commands that are behavioral - if (this.composer.hasPlaceholderSet() && !wysihtml.lang.array(['styleWithCSS', 'enableObjectResizing', 'enableInlineTableEditing']).contains(command)) { - this.composer.element.innerHTML = ""; - this.composer.selection.selectNode(this.composer.element); - } - - this.editor.fire("beforecommand:composer"); - - if (method) { - args.unshift(this.composer); - result = method.apply(obj, args); - } else { - try { - // try/catch for buggy firefox - result = this.doc.execCommand(command, false, value); - } catch(e) {} - } - - this.editor.fire("aftercommand:composer"); - return result; - }, - - remove: function(command, commandValue) { - var obj = wysihtml.commands[command], - args = wysihtml.lang.array(arguments).get(), - method = obj && obj.remove; - if (method) { - args.unshift(this.composer); - return method.apply(obj, args); - } - }, - - /** - * Check whether the current command is active - * If the caret is within a bold text, then calling this with command "bold" should return true - * - * @param {String} command The command string which to check (eg. "bold", "italic", "insertUnorderedList") - * @param {String} [commandValue] The command value parameter (eg. for "insertImage" the image src) - * @return {Boolean} Whether the command is active - * @example - * var isCurrentSelectionBold = commands.state("bold"); - */ - state: function(command, commandValue) { - var obj = wysihtml.commands[command], - args = wysihtml.lang.array(arguments).get(), - method = obj && obj.state; - if (method) { - args.unshift(this.composer); - return method.apply(obj, args); - } else { - try { - // try/catch for buggy firefox - return this.doc.queryCommandState(command); - } catch(e) { - return false; - } - } - }, - - /* Get command state parsed value if command has stateValue parsing function */ - stateValue: function(command) { - var obj = wysihtml.commands[command], - args = wysihtml.lang.array(arguments).get(), - method = obj && obj.stateValue; - if (method) { - args.unshift(this.composer); - return method.apply(obj, args); - } else { - return false; - } - } -}); -;(function(wysihtml) { - - var nodeOptions = { - nodeName: "A", - toggle: false - }; - - function getOptions(value) { - var options = typeof value === 'object' ? value : {'href': value}; - return wysihtml.lang.object({}).merge(nodeOptions).merge({'attribute': value}).get(); - } - - wysihtml.commands.createLink = { - exec: function(composer, command, value) { - var opts = getOptions(value); - - if (composer.selection.isCollapsed() && !this.state(composer, command)) { - var textNode = composer.doc.createTextNode(opts.attribute.href); - composer.selection.insertNode(textNode); - composer.selection.selectNode(textNode); - } - wysihtml.commands.formatInline.exec(composer, command, opts); - }, - - state: function(composer, command) { - return wysihtml.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -})(wysihtml); -;(function(wysihtml) { - - var nodeOptions = { - nodeName: "A" - }; - - wysihtml.commands.removeLink = { - exec: function(composer, command) { - wysihtml.commands.formatInline.remove(composer, command, nodeOptions); - }, - - state: function(composer, command) { - return wysihtml.commands.formatInline.state(composer, command, nodeOptions); - } - }; - -})(wysihtml); -;/* Formatblock - * Is used to insert block level elements - * It tries to solve the case that some block elements should not contain other block level elements (h1-6, p, ...) - * -*/ -(function(wysihtml) { - - var dom = wysihtml.dom, - // When the caret is within a H1 and the H4 is invoked, the H1 should turn into H4 - // instead of creating a H4 within a H1 which would result in semantically invalid html - UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre", - BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote", - INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u"; - - function correctOptionsForSimilarityCheck(options) { - return { - nodeName: options.nodeName || null, - className: (!options.classRegExp) ? options.className || null : null, - classRegExp: options.classRegExp || null, - styleProperty: options.styleProperty || null - }; - } - - function getRangeNode(node, offset) { - if (node.nodeType === 3) { - return node; - } else { - return node.childNodes[offset] || node; - } - } - - // Returns if node is a line break - function isBr(n) { - return n && n.nodeType === 1 && n.nodeName === "BR"; - } - - // Is block level element - function isBlock(n, composer) { - return n && n.nodeType === 1 && composer.win.getComputedStyle(n).display === "block"; - } - - // Returns if node is the rangy selection bookmark element (that must not be taken into account in most situatons and is removed on selection restoring) - function isBookmark(n) { - return n && n.nodeType === 1 && n.classList.contains('rangySelectionBoundary'); - } - - // Is line breaking node - function isLineBreaking(n, composer) { - return isBr(n) || isBlock(n, composer); - } - - // Removes empty block level elements - function cleanup(composer, newBlockElements) { - wysihtml.dom.removeInvisibleSpaces(composer.element); - var container = composer.element, - allElements = container.querySelectorAll(BLOCK_ELEMENTS), - noEditQuery = composer.config.classNames.uneditableContainer + ([""]).concat(BLOCK_ELEMENTS.split(',')).join(", " + composer.config.classNames.uneditableContainer + ' '), - uneditables = container.querySelectorAll(noEditQuery), - elements = wysihtml.lang.array(allElements).without(uneditables), // Lets not touch uneditable elements and their contents - nbIdx; - - for (var i = elements.length; i--;) { - if (elements[i].innerHTML.replace(/[\uFEFF]/g, '') === "" && (newBlockElements.length === 0 || elements[i] !== newBlockElements[newBlockElements.length - 1])) { - // If cleanup removes some new block elements. remove them from newblocks array too - nbIdx = wysihtml.lang.array(newBlockElements).indexOf(elements[i]); - if (nbIdx > -1) { - newBlockElements.splice(nbIdx, 1); - } - elements[i].parentNode.removeChild(elements[i]); - } - } - - return newBlockElements; - } - - function defaultNodeName(composer) { - return composer.config.useLineBreaks ? "DIV" : "P"; - } - - // The outermost un-nestable block element parent of from node - function findOuterBlock(node, container, allBlocks) { - var n = node, - block = null; - - while (n && container && n !== container) { - if (n.nodeType === 1 && n.matches(allBlocks ? BLOCK_ELEMENTS : UNNESTABLE_BLOCK_ELEMENTS)) { - block = n; - } - n = n.parentNode; - } - - return block; - } - - // Clone for splitting the inner inline element out of its parent inline elements context - // For example if selection is in bold and italic, clone the outer nodes and wrap these around content and return - function cloneOuterInlines(node, container) { - var n = node, - innerNode, - parentNode, - el = null, - el2; - - while (n && container && n !== container) { - if (n.nodeType === 1 && n.matches(INLINE_ELEMENTS)) { - parentNode = n; - if (el === null) { - el = n.cloneNode(false); - innerNode = el; - } else { - el2 = n.cloneNode(false); - el2.appendChild(el); - el = el2; - } - } - n = n.parentNode; - } - - return { - parent: parentNode, - outerNode: el, - innerNode: innerNode - }; - } - - // Formats an element according to options nodeName, className, styleProperty, styleValue - // If element is not defined, creates new element - // if opotions is null, remove format instead - function applyOptionsToElement(element, options, composer) { - - if (!element) { - element = composer.doc.createElement(options.nodeName || defaultNodeName(composer)); - // Add invisible space as otherwise webkit cannot set selection or range to it correctly - element.appendChild(composer.doc.createTextNode(wysihtml.INVISIBLE_SPACE)); - } - - if (options.nodeName && element.nodeName !== options.nodeName) { - element = dom.renameElement(element, options.nodeName); - } - - // Remove similar classes before applying className - if (options.classRegExp) { - element.className = element.className.replace(options.classRegExp, ""); - } - if (options.className) { - element.classList.add(options.className); - } - - if (options.styleProperty && typeof options.styleValue !== "undefined") { - element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; - } - - return element; - } - - // Unsets element properties by options - // If nodename given and matches current element, element is unwrapped or converted to default node (depending on presence of class and style attributes) - function removeOptionsFromElement(element, options, composer) { - var style, classes, - prevNode = element.previousSibling, - nextNode = element.nextSibling, - unwrapped = false; - - if (options.styleProperty) { - element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = ''; - } - if (options.className) { - element.classList.remove(options.className); - } - - if (options.classRegExp) { - element.className = element.className.replace(options.classRegExp, ""); - } - - // Clean up blank class attribute - if (element.getAttribute('class') !== null && element.getAttribute('class').trim() === "") { - element.removeAttribute('class'); - } - - if (options.nodeName && element.nodeName.toLowerCase() === options.nodeName.toLowerCase()) { - style = element.getAttribute('style'); - if (!style || style.trim() === '') { - dom.unwrap(element); - unwrapped = true; - } else { - element = dom.renameElement(element, defaultNodeName(composer)); - } - } - - // Clean up blank style attribute - if (element.getAttribute('style') !== null && element.getAttribute('style').trim() === "") { - element.removeAttribute('style'); - } - - if (unwrapped) { - applySurroundingLineBreaks(prevNode, nextNode, composer); - } - } - - // Unwraps block level elements from inside content - // Useful as not all block level elements can contain other block-levels - function unwrapBlocksFromContent(element) { - var blocks = element.querySelectorAll(BLOCK_ELEMENTS) || [], // Find unnestable block elements in extracted contents - nextEl, prevEl; - - for (var i = blocks.length; i--;) { - nextEl = wysihtml.dom.domNode(blocks[i]).next({nodeTypes: [1,3], ignoreBlankTexts: true}), - prevEl = wysihtml.dom.domNode(blocks[i]).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); - - if (nextEl && nextEl.nodeType !== 1 && nextEl.nodeName !== 'BR') { - if ((blocks[i].innerHTML || blocks[i].nodeValue || '').trim() !== '') { - blocks[i].parentNode.insertBefore(blocks[i].ownerDocument.createElement('BR'), nextEl); - } - } - if (nextEl && nextEl.nodeType !== 1 && nextEl.nodeName !== 'BR') { - if ((blocks[i].innerHTML || blocks[i].nodeValue || '').trim() !== '') { - blocks[i].parentNode.insertBefore(blocks[i].ownerDocument.createElement('BR'), nextEl); - } - } - wysihtml.dom.unwrap(blocks[i]); - } - } - - // Fix ranges that visually cover whole block element to actually cover the block - function fixRangeCoverage(range, composer) { - var node, - start = range.startContainer, - end = range.endContainer; - - // If range has only one childNode and it is end to end the range, extend the range to contain the container element too - // This ensures the wrapper node is modified and optios added to it - if (start && start.nodeType === 1 && start === end) { - if (start.firstChild === start.lastChild && range.endOffset === 1) { - if (start !== composer.element && start.nodeName !== 'LI' && start.nodeName !== 'TD') { - range.setStartBefore(start); - range.setEndAfter(end); - } - } - return; - } - - // If range starts outside of node and ends inside at textrange and covers the whole node visually, extend end to cover the node end too - if (start && start.nodeType === 1 && end.nodeType === 3) { - if (start.firstChild === end && range.endOffset === end.data.length) { - if (start !== composer.element && start.nodeName !== 'LI' && start.nodeName !== 'TD') { - range.setEndAfter(start); - } - } - return; - } - - // If range ends outside of node and starts inside at textrange and covers the whole node visually, extend start to cover the node start too - if (end && end.nodeType === 1 && start.nodeType === 3) { - if (end.firstChild === start && range.startOffset === 0) { - if (end !== composer.element && end.nodeName !== 'LI' && end.nodeName !== 'TD') { - range.setStartBefore(end); - } - } - return; - } - - // If range covers a whole textnode and the textnode is the only child of node, extend range to node - if (start && start.nodeType === 3 && start === end && start.parentNode.childNodes.length === 1) { - if (range.endOffset == end.data.length && range.startOffset === 0) { - node = start.parentNode; - if (node !== composer.element && node.nodeName !== 'LI' && node.nodeName !== 'TD') { - range.setStartBefore(node); - range.setEndAfter(node); - } - } - return; - } - } - - // Scans ranges array for insertion points that are not allowed to insert block tags fixes/splits illegal ranges - // Some places do not allow block level elements inbetween (inside ul and outside li) - // TODO: might need extending for other nodes besides li (maybe dd,dl,dt) - function fixNotPermittedInsertionPoints(ranges) { - var newRanges = [], - lis, j, maxj, tmpRange, rangePos, closestLI; - - for (var i = 0, maxi = ranges.length; i < maxi; i++) { - - // Fixes range start and end positions if inside UL or OL element (outside of LI) - if (ranges[i].startContainer.nodeType === 1 && ranges[i].startContainer.matches('ul, ol')) { - ranges[i].setStart(ranges[i].startContainer.childNodes[ranges[i].startOffset], 0); - } - if (ranges[i].endContainer.nodeType === 1 && ranges[i].endContainer.matches('ul, ol')) { - closestLI = ranges[i].endContainer.childNodes[Math.max(ranges[i].endOffset - 1, 0)]; - if (closestLI.childNodes) { - ranges[i].setEnd(closestLI, closestLI.childNodes.length); - } - } - - // Get all LI eleemnts in selection (fully or partially covered) - // And make sure ranges are either inside LI or outside UL/OL - // Split and add new ranges as needed to cover same range content - // TODO: Needs improvement to accept DL, DD, DT - lis = ranges[i].getNodes([1], function(node) { - return node.nodeName === "LI"; - }); - if (lis.length > 0) { - - for (j = 0, maxj = lis.length; j < maxj; j++) { - rangePos = ranges[i].compareNode(lis[j]); - - // Fixes start of range that crosses LI border - if (rangePos === ranges[i].NODE_AFTER || rangePos === ranges[i].NODE_INSIDE) { - // Range starts before and ends inside the node - - tmpRange = ranges[i].cloneRange(); - closestLI = wysihtml.dom.domNode(lis[j]).prev({nodeTypes: [1]}); - - if (closestLI) { - tmpRange.setEnd(closestLI, closestLI.childNodes.length); - } else if (lis[j].closest('ul, ol')) { - tmpRange.setEndBefore(lis[j].closest('ul, ol')); - } else { - tmpRange.setEndBefore(lis[j]); - } - newRanges.push(tmpRange); - ranges[i].setStart(lis[j], 0); - } - - // Fixes end of range that crosses li border - if (rangePos === ranges[i].NODE_BEFORE || rangePos === ranges[i].NODE_INSIDE) { - // Range starts inside the node and ends after node - - tmpRange = ranges[i].cloneRange(); - tmpRange.setEnd(lis[j], lis[j].childNodes.length); - newRanges.push(tmpRange); - - // Find next LI in list and if present set range to it, else - closestLI = wysihtml.dom.domNode(lis[j]).next({nodeTypes: [1]}); - if (closestLI) { - ranges[i].setStart(closestLI, 0); - } else if (lis[j].closest('ul, ol')) { - ranges[i].setStartAfter(lis[j].closest('ul, ol')); - } else { - ranges[i].setStartAfter(lis[j]); - } - } - } - newRanges.push(ranges[i]); - } else { - newRanges.push(ranges[i]); - } - } - return newRanges; - } - - // Return options object with nodeName set if original did not have any - // Node name is set to local or global default - function getOptionsWithNodename(options, defaultName, composer) { - var correctedOptions = (options) ? wysihtml.lang.object(options).clone(true) : null; - if (correctedOptions) { - correctedOptions.nodeName = correctedOptions.nodeName || defaultName || defaultNodeName(composer); - } - return correctedOptions; - } - - // Injects document fragment to range ensuring outer elements are split to a place where block elements are allowed to be inserted - // Also wraps empty clones of split parent tags around fragment to keep formatting - // If firstOuterBlock is given assume that instead of finding outer (useful for solving cases of some blocks are allowed into others while others are not) - function injectFragmentToRange(fragment, range, composer, firstOuterBlock) { - var rangeStartContainer = range.startContainer, - firstOuterBlock = firstOuterBlock || findOuterBlock(rangeStartContainer, composer.element, true), - outerInlines, first, last, prev, next; - - if (firstOuterBlock) { - // If selection starts inside un-nestable block, split-escape the unnestable point and insert node between - first = fragment.firstChild; - last = fragment.lastChild; - - composer.selection.splitElementAtCaret(firstOuterBlock, fragment); - - next = wysihtml.dom.domNode(last).next({nodeTypes: [1,3], ignoreBlankTexts: true}); - prev = wysihtml.dom.domNode(first).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); - - if (first && !isLineBreaking(first, composer) && prev && !isLineBreaking(prev, composer)) { - first.parentNode.insertBefore(composer.doc.createElement('br'), first); - } - - if (last && !isLineBreaking(last, composer) && next && !isLineBreaking(next, composer)) { - next.parentNode.insertBefore(composer.doc.createElement('br'), next); - } - - } else { - // Ensure node does not get inserted into an inline where it is not allowed - outerInlines = cloneOuterInlines(rangeStartContainer, composer.element); - if (outerInlines.outerNode && outerInlines.innerNode && outerInlines.parent) { - if (fragment.childNodes.length === 1) { - while(fragment.firstChild.firstChild) { - outerInlines.innerNode.appendChild(fragment.firstChild.firstChild); - } - fragment.firstChild.appendChild(outerInlines.outerNode); - } - composer.selection.splitElementAtCaret(outerInlines.parent, fragment); - } else { - var fc = fragment.firstChild, - lc = fragment.lastChild; - - range.insertNode(fragment); - // restore range position as it might get lost in webkit sometimes - range.setStartBefore(fc); - range.setEndAfter(lc); - } - } - } - - // Removes all block formatting from range - function clearRangeBlockFromating(range, closestBlockName, composer) { - var r = range.cloneRange(), - prevNode = getRangeNode(r.startContainer, r.startOffset).previousSibling, - nextNode = getRangeNode(r.endContainer, r.endOffset).nextSibling, - content = r.extractContents(), - fragment = composer.doc.createDocumentFragment(), - children, blocks, - first = true; - - while(content.firstChild) { - // Iterate over all selection content first level childNodes - if (content.firstChild.nodeType === 1 && content.firstChild.matches(BLOCK_ELEMENTS)) { - // If node is a block element - // Split block formating and add new block to wrap caret - - unwrapBlocksFromContent(content.firstChild); - children = wysihtml.dom.unwrap(content.firstChild); - - // Add line break before if needed - if (children.length > 0) { - if ( - (fragment.lastChild && (fragment.lastChild.nodeType !== 1 || !isLineBreaking(fragment.lastChild, composer))) || - (!fragment.lastChild && prevNode && (prevNode.nodeType !== 1 || isLineBreaking(prevNode, composer))) - ){ - fragment.appendChild(composer.doc.createElement('BR')); - } - } - - for (var c = 0, cmax = children.length; c < cmax; c++) { - fragment.appendChild(children[c]); - } - - // Add line break after if needed - if (children.length > 0) { - if (fragment.lastChild.nodeType !== 1 || !isLineBreaking(fragment.lastChild, composer)) { - if (nextNode || fragment.lastChild !== content.lastChild) { - fragment.appendChild(composer.doc.createElement('BR')); - } - } - } - - } else { - fragment.appendChild(content.firstChild); - } - - first = false; - } - blocks = wysihtml.lang.array(fragment.childNodes).get(); - injectFragmentToRange(fragment, r, composer); - return blocks; - } - - // When block node is inserted, look surrounding nodes and remove surplous linebreak tags (as block format breaks line itself) - function removeSurroundingLineBreaks(prevNode, nextNode, composer) { - var prevPrev = prevNode && wysihtml.dom.domNode(prevNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); - if (isBr(nextNode)) { - nextNode.parentNode.removeChild(nextNode); - } - if (isBr(prevNode) && (!prevPrev || prevPrev.nodeType !== 1 || composer.win.getComputedStyle(prevPrev).display !== "block")) { - prevNode.parentNode.removeChild(prevNode); - } - } - - function applySurroundingLineBreaks(prevNode, nextNode, composer) { - var prevPrev; - - if (prevNode && isBookmark(prevNode)) { - prevNode = prevNode.previousSibling; - } - if (nextNode && isBookmark(nextNode)) { - nextNode = nextNode.nextSibling; - } - - prevPrev = prevNode && prevNode.previousSibling; - - if (prevNode && (prevNode.nodeType !== 1 || (composer.win.getComputedStyle(prevNode).display !== "block" && !isBr(prevNode))) && prevNode.parentNode) { - prevNode.parentNode.insertBefore(composer.doc.createElement('br'), prevNode.nextSibling); - } - - if (nextNode && (nextNode.nodeType !== 1 || composer.win.getComputedStyle(nextNode).display !== "block") && nextNode.parentNode) { - nextNode.parentNode.insertBefore(composer.doc.createElement('br'), nextNode); - } - } - - var isWhitespaceBefore = function (textNode, offset) { - var str = textNode.data ? textNode.data.slice(0, offset) : ""; - return (/^\s*$/).test(str); - } - - var isWhitespaceAfter = function (textNode, offset) { - var str = textNode.data ? textNode.data.slice(offset) : ""; - return (/^\s*$/).test(str); - } - - var trimBlankTextsAndBreaks = function(fragment) { - if (fragment) { - while (fragment.firstChild && fragment.firstChild.nodeType === 3 && (/^\s*$/).test(fragment.firstChild.data) && fragment.lastChild !== fragment.firstChild) { - fragment.removeChild(fragment.firstChild); - } - - while (fragment.lastChild && fragment.lastChild.nodeType === 3 && (/^\s*$/).test(fragment.lastChild.data) && fragment.lastChild !== fragment.firstChild) { - fragment.removeChild(fragment.lastChild); - } - - if (fragment.firstChild && fragment.firstChild.nodeType === 1 && fragment.firstChild.nodeName === "BR" && fragment.lastChild !== fragment.firstChild) { - fragment.removeChild(fragment.firstChild); - } - - if (fragment.lastChild && fragment.lastChild.nodeType === 1 && fragment.lastChild.nodeName === "BR" && fragment.lastChild !== fragment.firstChild) { - fragment.removeChild(fragment.lastChild); - } - } - } - - // Wrap the range with a block level element - // If element is one of unnestable block elements (ex: h2 inside h1), split nodes and insert between so nesting does not occur - function wrapRangeWithElement(range, options, closestBlockName, composer) { - var similarOptions = options ? correctOptionsForSimilarityCheck(options) : null, - r = range.cloneRange(), - rangeStartContainer = r.startContainer, - startNode = getRangeNode(r.startContainer, r.startOffset), - endNode = getRangeNode(r.endContainer, r.endOffset), - prevNode = (r.startContainer === startNode && startNode.nodeType === 3 && !isWhitespaceBefore(startNode, r.startOffset)) ? startNode : wysihtml.dom.domNode(startNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}), - nextNode = ( - ( - r.endContainer.nodeType === 1 && - r.endContainer.childNodes[r.endOffset] === endNode && - ( - endNode.nodeType === 1 || - !isWhitespaceAfter(endNode, r.endOffset) && - !wysihtml.dom.domNode(endNode).is.rangyBookmark() - ) - ) || ( - r.endContainer === endNode && - endNode.nodeType === 3 && - !isWhitespaceAfter(endNode, r.endOffset) - ) - ) ? endNode : wysihtml.dom.domNode(endNode).next({nodeTypes: [1,3], ignoreBlankTexts: true}), - content = r.extractContents(), - fragment = composer.doc.createDocumentFragment(), - similarOuterBlock = similarOptions ? wysihtml.dom.getParentElement(rangeStartContainer, similarOptions, null, composer.element) : null, - splitAllBlocks = !closestBlockName || !options || (options.nodeName === "BLOCKQUOTE" && closestBlockName === "BLOCKQUOTE"), - firstOuterBlock = similarOuterBlock || findOuterBlock(rangeStartContainer, composer.element, splitAllBlocks), // The outermost un-nestable block element parent of selection start - wrapper, blocks, children, - firstc, lastC; - - if (wysihtml.dom.domNode(nextNode).is.rangyBookmark()) { - endNode = nextNode; - nextNode = endNode.nextSibling; - } - - trimBlankTextsAndBreaks(content); - - if (options && options.nodeName === "BLOCKQUOTE") { - - // If blockquote is to be inserted no quessing just add it as outermost block on line or selection - var tmpEl = applyOptionsToElement(null, options, composer); - tmpEl.appendChild(content); - fragment.appendChild(tmpEl); - blocks = [tmpEl]; - - } else { - - if (!content.firstChild) { - // IF selection is caret (can happen if line is empty) add format around tag - fragment.appendChild(applyOptionsToElement(null, options, composer)); - } else { - - while(content.firstChild) { - // Iterate over all selection content first level childNodes - - if (content.firstChild.nodeType == 1 && content.firstChild.matches(BLOCK_ELEMENTS)) { - - // If node is a block element - // Escape(split) block formatting at caret - applyOptionsToElement(content.firstChild, options, composer); - if (content.firstChild.matches(UNNESTABLE_BLOCK_ELEMENTS)) { - unwrapBlocksFromContent(content.firstChild); - } - fragment.appendChild(content.firstChild); - - } else { - - // Wrap subsequent non-block nodes inside new block element - wrapper = applyOptionsToElement(null, getOptionsWithNodename(options, closestBlockName, composer), composer); - while(content.firstChild && (content.firstChild.nodeType !== 1 || !content.firstChild.matches(BLOCK_ELEMENTS))) { - if (content.firstChild.nodeType == 1 && wrapper.matches(UNNESTABLE_BLOCK_ELEMENTS)) { - unwrapBlocksFromContent(content.firstChild); - } - wrapper.appendChild(content.firstChild); - } - fragment.appendChild(wrapper); - } - } - } - - blocks = wysihtml.lang.array(fragment.childNodes).get(); - } - injectFragmentToRange(fragment, r, composer, firstOuterBlock); - removeSurroundingLineBreaks(prevNode, nextNode, composer); - - // Fix webkit madness by inserting linebreak rangy after cursor marker to blank last block - // (if it contains rangy bookmark, so selection can be restored later correctly) - if (blocks.length > 0 && - ( - typeof blocks[blocks.length - 1].lastChild === "undefined" || wysihtml.dom.domNode(blocks[blocks.length - 1].lastChild).is.rangyBookmark() - ) - ) { - blocks[blocks.length - 1].appendChild(composer.doc.createElement('br')); - } - return blocks; - } - - // Find closest block level element - function getParentBlockNodeName(element, composer) { - var parentNode = wysihtml.dom.getParentElement(element, { - query: BLOCK_ELEMENTS - }, null, composer.element); - - return (parentNode) ? parentNode.nodeName : null; - } - - // Expands caret to cover the closest block that: - // * cannot contain other block level elements (h1-6,p, etc) - // * Has the same nodeName that is to be inserted - // * has insertingNodeName - // * is DIV if insertingNodeName is not present - // - // If nothing found selects the current line - function expandCaretToBlock(composer, insertingNodeName) { - var parent = wysihtml.dom.getParentElement(composer.selection.getOwnRanges()[0].startContainer, { - query: UNNESTABLE_BLOCK_ELEMENTS + ', ' + (insertingNodeName ? insertingNodeName.toLowerCase() : 'div'), - }, null, composer.element), - range; - - if (parent) { - range = composer.selection.createRange(); - range.selectNode(parent); - composer.selection.setSelection(range); - } else if (!composer.isEmpty()) { - composer.selection.selectLine(); - } - } - - // Set selection to begin inside first created block element (beginning of it) and end inside (and after content) of last block element - // TODO: Checking nodetype might be unnescescary as nodes inserted by formatBlock are nodetype 1 anyway - function selectElements(newBlockElements, composer) { - var range = composer.selection.createRange(), - lastEl = newBlockElements[newBlockElements.length - 1], - lastOffset = (lastEl.nodeType === 1 && lastEl.childNodes) ? lastEl.childNodes.length | 0 : lastEl.length || 0; - - range.setStart(newBlockElements[0], 0); - range.setEnd(lastEl, lastOffset); - range.select(); - } - - // Get all ranges from selection (takes out uneditables and out of editor parts) and apply format to each - // Return created/modified block level elements - // Method can be either "apply" or "remove" - function formatSelection(method, composer, options) { - var ranges = composer.selection.getOwnRanges(), - newBlockElements = [], - closestBlockName; - - // Some places do not allow block level elements inbetween (inside ul and outside li, inside table and outside of td/th) - ranges = fixNotPermittedInsertionPoints(ranges); - - for (var i = ranges.length; i--;) { - fixRangeCoverage(ranges[i], composer); - closestBlockName = getParentBlockNodeName(ranges[i].startContainer, composer); - if (method === "remove") { - newBlockElements = newBlockElements.concat(clearRangeBlockFromating(ranges[i], closestBlockName, composer)); - } else { - newBlockElements = newBlockElements.concat(wrapRangeWithElement(ranges[i], options, closestBlockName, composer)); - } - } - return newBlockElements; - } - - // If properties is passed as a string, look for tag with that tagName/query - function parseOptions(options) { - if (typeof options === "string") { - options = { - nodeName: options.toUpperCase() - }; - } - return options; - } - - function caretIsOnEmptyLine(composer) { - var caretInfo; - if (composer.selection.isCollapsed()) { - caretInfo = composer.selection.getNodesNearCaret(); - if (caretInfo && caretInfo.caretNode) { - if ( - // caret is allready breaknode - wysihtml.dom.domNode(caretInfo.caretNode).is.lineBreak() || - // caret is textnode - (caretInfo.caretNode.nodeType === 3 && caretInfo.textOffset === 0 && (!caretInfo.prevNode || wysihtml.dom.domNode(caretInfo.prevNode).is.lineBreak())) || - // Caret is temprorary rangy selection marker - (caretInfo.caretNode.nodeType === 1 && caretInfo.caretNode.classList.contains('rangySelectionBoundary') && - (!caretInfo.prevNode || wysihtml.dom.domNode(caretInfo.prevNode).is.lineBreak() || wysihtml.dom.domNode(caretInfo.prevNode).is.block()) && - (!caretInfo.nextNode || wysihtml.dom.domNode(caretInfo.nextNode).is.lineBreak() || wysihtml.dom.domNode(caretInfo.nextNode).is.block()) - ) - ) { - return true; - } - } - } - return false; - } - - wysihtml.commands.formatBlock = { - exec: function(composer, command, options) { - options = parseOptions(options); - var newBlockElements = [], - ranges, range, bookmark, state, closestBlockName; - - // Find if current format state is active if options.toggle is set as true - // In toggle case active state elemets are formatted instead of working directly on selection - if (options && options.toggle) { - state = this.state(composer, command, options); - } - if (state) { - // Remove format from state nodes if toggle set and state on and selection is collapsed - bookmark = rangy.saveSelection(composer.win); - for (var j = 0, jmax = state.length; j < jmax; j++) { - removeOptionsFromElement(state[j], options, composer); - } - - } else { - // If selection is caret expand it to cover nearest suitable block element or row if none found - if (composer.selection.isCollapsed()) { - bookmark = rangy.saveSelection(composer.win); - if (caretIsOnEmptyLine(composer)) { - composer.selection.selectLine(); - } else { - expandCaretToBlock(composer, options && options.nodeName ? options.nodeName.toUpperCase() : undefined); - } - } - if (options) { - newBlockElements = formatSelection("apply", composer, options); - } else { - // Options == null means block formatting should be removed from selection - newBlockElements = formatSelection("remove", composer); - } - - } - - // Remove empty block elements that may be left behind - // Also remove them from new blocks list - newBlockElements = cleanup(composer, newBlockElements); - - // Restore selection - if (bookmark) { - rangy.restoreSelection(bookmark); - } else { - selectElements(newBlockElements, composer); - } - }, - - // Removes all block formatting from selection - remove: function(composer, command, options) { - options = parseOptions(options); - var newBlockElements, bookmark; - - // If selection is caret expand it to cover nearest suitable block element or row if none found - if (composer.selection.isCollapsed()) { - bookmark = rangy.saveSelection(composer.win); - expandCaretToBlock(composer, options && options.nodeName ? options.nodeName.toUpperCase() : undefined); - } - - newBlockElements = formatSelection("remove", composer); - newBlockElements = cleanup(composer, newBlockElements); - - // Restore selection - if (bookmark) { - rangy.restoreSelection(bookmark); - } else { - selectElements(newBlockElements, composer); - } - }, - - // If options as null is passed returns status describing all block level elements - state: function(composer, command, options) { - options = parseOptions(options); - - var nodes = composer.selection.filterElements((function (element) { // Finds matching elements inside selection - return wysihtml.dom.domNode(element).test(options || { query: BLOCK_ELEMENTS }); - }).bind(this)), - parentNodes = composer.selection.getSelectedOwnNodes(), - parent; - - // Finds matching elements that are parents of selection and adds to nodes list - for (var i = 0, maxi = parentNodes.length; i < maxi; i++) { - parent = dom.getParentElement(parentNodes[i], options || { query: BLOCK_ELEMENTS }, null, composer.element); - if (parent && nodes.indexOf(parent) === -1) { - nodes.push(parent); - } - } - - return (nodes.length === 0) ? false : nodes; - } - - }; -})(wysihtml); -;/** - * Unifies all inline tags additions and removals - * See https://github.com/Voog/wysihtml/pull/169 for specification of action - */ - -(function(wysihtml) { - - var defaultTag = "SPAN", - INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u", - queryAliasMap = { - "b": "b, strong", - "strong": "b, strong", - "em": "em, i", - "i": "em, i" - }; - - function hasNoClass(element) { - return (/^\s*$/).test(element.className); - } - - function hasNoStyle(element) { - return !element.getAttribute('style') || (/^\s*$/).test(element.getAttribute('style')); - } - - // Associative arrays in javascript are really objects and do not have length defined - // Thus have to check emptyness in a different way - function hasNoAttributes(element) { - var attr = wysihtml.dom.getAttributes(element); - return wysihtml.lang.object(attr).isEmpty(); - } - - // compares two nodes if they are semantically the same - // Used in cleanup to find consequent semantically similar elements for merge - function isSameNode(element1, element2) { - var classes1, classes2, - attr1, attr2; - - if (element1.nodeType !== 1 || element2.nodeType !== 1) { - return false; - } - - if (element1.nodeName !== element2.nodeName) { - return false; - } - - classes1 = element1.className.trim().replace(/\s+/g, ' ').split(' '); - classes2 = element2.className.trim().replace(/\s+/g, ' ').split(' '); - if (wysihtml.lang.array(classes1).without(classes2).length > 0) { - return false; - } - - attr1 = wysihtml.dom.getAttributes(element1); - attr2 = wysihtml.dom.getAttributes(element2); - - if (attr1.length !== attr2.length || !wysihtml.lang.object(wysihtml.lang.object(attr1).difference(attr2)).isEmpty()) { - return false; - } - - return true; - } - - function createWrapNode(textNode, options) { - var nodeName = options && options.nodeName || defaultTag, - element = textNode.ownerDocument.createElement(nodeName); - - // Remove similar classes before applying className - if (options.classRegExp) { - element.className = element.className.replace(options.classRegExp, ""); - } - - if (options.className) { - element.classList.add(options.className); - } - - if (options.styleProperty && typeof options.styleValue !== "undefined") { - element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; - } - - if (options.attribute) { - if (typeof options.attribute === "object") { - for (var a in options.attribute) { - if (options.attribute.hasOwnProperty(a)) { - element.setAttribute(a, options.attribute[a]); - } - } - } else if (typeof options.attributeValue !== "undefined") { - element.setAttribute(options.attribute, options.attributeValue); - } - } - - return element; - } - - // Tests if attr2 list contains all attributes present in attr1 - // Note: attr 1 can have more attributes than attr2 - function containsSameAttributes(attr1, attr2) { - for (var a in attr1) { - if (attr1.hasOwnProperty(a)) { - if (typeof attr2[a] === undefined || attr2[a] !== attr1[a]) { - return false; - } - } - } - return true; - } - - // If attrbutes and values are the same > remove - // if attributes or values - function updateElementAttributes(element, newAttributes, toggle) { - var attr = wysihtml.dom.getAttributes(element), - fullContain = containsSameAttributes(newAttributes, attr), - attrDifference = wysihtml.lang.object(attr).difference(newAttributes), - a, b; - - if (fullContain && toggle !== false) { - for (a in newAttributes) { - if (newAttributes.hasOwnProperty(a)) { - element.removeAttribute(a); - } - } - } else { - - /*if (!wysihtml.lang.object(attrDifference).isEmpty()) { - for (b in attrDifference) { - if (attrDifference.hasOwnProperty(b)) { - element.removeAttribute(b); - } - } - }*/ - - for (a in newAttributes) { - if (newAttributes.hasOwnProperty(a)) { - element.setAttribute(a, newAttributes[a]); - } - } - } - } - - function updateFormatOfElement(element, options) { - var attr, newNode, a, newAttributes, nodeNameQuery, nodeQueryMatch; - - if (options.className) { - if (options.toggle !== false && element.classList.contains(options.className)) { - element.classList.remove(options.className); - } else { - if (options.classRegExp) { - element.className = element.className.replace(options.classRegExp, ''); - } - element.classList.add(options.className); - } - if (hasNoClass(element)) { - element.removeAttribute('class'); - } - } - - // change/remove style - if (options.styleProperty) { - if (options.toggle !== false && element.style[wysihtml.browser.fixStyleKey(options.styleProperty)].trim().replace(/, /g, ",") === options.styleValue) { - element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = ''; - } else { - element.style[wysihtml.browser.fixStyleKey(options.styleProperty)] = options.styleValue; - } - } - if (hasNoStyle(element)) { - element.removeAttribute('style'); - } - - if (options.attribute) { - if (typeof options.attribute === "object") { - newAttributes = options.attribute; - } else { - newAttributes = {}; - newAttributes[options.attribute] = options.attributeValue || ''; - } - updateElementAttributes(element, newAttributes, options.toggle); - } - - - // Handle similar semantically same elements (queryAliasMap) - nodeNameQuery = options.nodeName ? queryAliasMap[options.nodeName.toLowerCase()] || options.nodeName.toLowerCase() : null; - nodeQueryMatch = nodeNameQuery ? wysihtml.dom.domNode(element).test({ query: nodeNameQuery }) : false; - - // Unwrap element if no attributes present and node name given - // or no attributes and if no nodename set but node is the default - if (!options.nodeName || options.nodeName === defaultTag || nodeQueryMatch) { - if ( - ((options.toggle !== false && nodeQueryMatch) || (!options.nodeName && element.nodeName === defaultTag)) && - hasNoClass(element) && hasNoStyle(element) && hasNoAttributes(element) - ) { - wysihtml.dom.unwrap(element); - } - - } - } - - // Fetch all textnodes in selection - // Empty textnodes are ignored except the one containing text caret - function getSelectedTextNodes(selection, splitBounds) { - var textNodes = []; - - if (!selection.isCollapsed()) { - textNodes = textNodes.concat(selection.getOwnNodes([3], function(node) { - // Exclude empty nodes except caret node - return (!wysihtml.dom.domNode(node).is.emptyTextNode()); - }, splitBounds)); - } - - return textNodes; - } - - function findSimilarTextNodeWrapper(textNode, options, container, exact) { - var node = textNode, - similarOptions = exact ? options : correctOptionsForSimilarityCheck(options); - - do { - if (node.nodeType === 1 && isSimilarNode(node, similarOptions)) { - return node; - } - node = node.parentNode; - } while (node && node !== container); - - return null; - } - - function correctOptionsForSimilarityCheck(options) { - return { - nodeName: options.nodeName || null, - className: (!options.classRegExp) ? options.className || null : null, - classRegExp: options.classRegExp || null, - styleProperty: options.styleProperty || null - }; - } - - // Finds inline node with similar nodeName/style/className - // If nodeName is specified inline node with the same (or alias) nodeName is expected to prove similar regardless of attributes - function isSimilarNode(node, options) { - var o; - if (options.nodeName) { - var query = queryAliasMap[options.nodeName.toLowerCase()] || options.nodeName.toLowerCase(); - return wysihtml.dom.domNode(node).test({ query: query }); - } else { - o = wysihtml.lang.object(options).clone(); - o.query = INLINE_ELEMENTS; // make sure only inline elements with styles and classes are counted - return wysihtml.dom.domNode(node).test(o); - } - } - - function selectRange(composer, range) { - var d = document.documentElement || document.body, - oldScrollTop = d.scrollTop, - oldScrollLeft = d.scrollLeft, - selection = rangy.getSelection(composer.win); - - rangy.getSelection(composer.win).removeAllRanges(); - - // IE looses focus of contenteditable on removeallranges and can not set new selection unless contenteditable is focused again - try { - rangy.getSelection(composer.win).addRange(range); - } catch (e) {} - if (!composer.doc.activeElement || !wysihtml.dom.contains(composer.element, composer.doc.activeElement)) { - composer.element.focus(); - d.scrollTop = oldScrollTop; - d.scrollLeft = oldScrollLeft; - rangy.getSelection(composer.win).addRange(range); - } - } - - function selectTextNodes(textNodes, composer) { - var range = rangy.createRange(composer.doc), - lastText = textNodes[textNodes.length - 1]; - - if (textNodes[0] && lastText) { - range.setStart(textNodes[0], 0); - range.setEnd(lastText, lastText.length); - selectRange(composer, range); - } - - } - - function selectTextNode(composer, node, start, end) { - var range = rangy.createRange(composer.doc); - if (node) { - range.setStart(node, start); - range.setEnd(node, typeof end !== 'undefined' ? end : start); - selectRange(composer, range); - } - } - - function getState(composer, options, exact) { - var searchNodes = getSelectedTextNodes(composer.selection), - nodes = [], - partial = false, - node, range, caretNode; - - if (composer.selection.isInThisEditable()) { - - if (searchNodes.length === 0 && composer.selection.isCollapsed()) { - caretNode = composer.selection.getSelection().anchorNode; - if (!caretNode) { - // selection not in editor - return { - nodes: [], - partial: false - }; - } - if (caretNode.nodeType === 3) { - searchNodes = [caretNode]; - } - } - - // Handle collapsed selection caret - if (!searchNodes.length) { - range = composer.selection.getOwnRanges()[0]; - if (range) { - searchNodes = [range.endContainer]; - } - } - - for (var i = 0, maxi = searchNodes.length; i < maxi; i++) { - node = findSimilarTextNodeWrapper(searchNodes[i], options, composer.element, exact); - if (node) { - nodes.push(node); - } else { - partial = true; - } - } - - } - - return { - nodes: nodes, - partial: partial - }; - } - - // Returns if caret is inside a word in textnode (not on boundary) - // If selection anchornode is not text node, returns false - function caretIsInsideWord(selection) { - var anchor, offset, beforeChar, afterChar; - if (selection) { - anchor = selection.anchorNode; - offset = selection.anchorOffset; - if (anchor && anchor.nodeType === 3 && offset > 0 && offset < anchor.data.length) { - beforeChar = anchor.data[offset - 1]; - afterChar = anchor.data[offset]; - return (/\w/).test(beforeChar) && (/\w/).test(afterChar); - } - } - return false; - } - - // Returns a range and textnode containing object from caret position covering a whole word - // wordOffsety describes the original position of caret in the new textNode - // Caret has to be inside a textNode. - function getRangeForWord(selection) { - var anchor, offset, doc, range, offsetStart, offsetEnd, beforeChar, afterChar, - txtNodes = []; - if (selection) { - anchor = selection.anchorNode; - offset = offsetStart = offsetEnd = selection.anchorOffset; - doc = anchor.ownerDocument; - range = rangy.createRange(doc); - - if (anchor && anchor.nodeType === 3) { - - while (offsetStart > 0 && (/\w/).test(anchor.data[offsetStart - 1])) { - offsetStart--; - } - - while (offsetEnd < anchor.data.length && (/\w/).test(anchor.data[offsetEnd])) { - offsetEnd++; - } - - range.setStartAndEnd(anchor, offsetStart, offsetEnd); - range.splitBoundaries(); - txtNodes = range.getNodes([3], function(node) { - return (!wysihtml.dom.domNode(node).is.emptyTextNode()); - }); - - return { - wordOffset: offset - offsetStart, - range: range, - textNode: txtNodes[0] - }; - - } - } - return false; - } - - // Contents of 2 elements are merged to fitst element. second element is removed as consequence - function mergeContents(element1, element2) { - while (element2.firstChild) { - element1.appendChild(element2.firstChild); - } - element2.parentNode.removeChild(element2); - } - - function mergeConsequentSimilarElements(elements) { - for (var i = elements.length; i--;) { - - if (elements[i] && elements[i].parentNode) { // Test if node is not allready removed in cleanup - - if (elements[i].nextSibling && isSameNode(elements[i], elements[i].nextSibling)) { - mergeContents(elements[i], elements[i].nextSibling); - } - - if (elements[i].previousSibling && isSameNode(elements[i] , elements[i].previousSibling)) { - mergeContents(elements[i].previousSibling, elements[i]); - } - - } - } - } - - function cleanupAndSetSelection(composer, textNodes, options) { - if (textNodes.length > 0) { - selectTextNodes(textNodes, composer); - } - mergeConsequentSimilarElements(getState(composer, options).nodes); - if (textNodes.length > 0) { - selectTextNodes(textNodes, composer); - } - } - - function cleanupAndSetCaret(composer, textNode, offset, options) { - selectTextNode(composer, textNode, offset); - mergeConsequentSimilarElements(getState(composer, options).nodes); - selectTextNode(composer, textNode, offset); - } - - // Formats a textnode with given options - function formatTextNode(textNode, options) { - var wrapNode = createWrapNode(textNode, options); - - textNode.parentNode.insertBefore(wrapNode, textNode); - wrapNode.appendChild(textNode); - } - - // Changes/toggles format of a textnode - function unformatTextNode(textNode, composer, options) { - var container = composer.element, - wrapNode = findSimilarTextNodeWrapper(textNode, options, container), - newWrapNode; - - if (wrapNode) { - newWrapNode = wrapNode.cloneNode(false); - - wysihtml.dom.domNode(textNode).escapeParent(wrapNode, newWrapNode); - updateFormatOfElement(newWrapNode, options); - } - } - - // Removes the format around textnode - function removeFormatFromTextNode(textNode, composer, options) { - var container = composer.element, - wrapNode = findSimilarTextNodeWrapper(textNode, options, container); - - if (wrapNode) { - wysihtml.dom.domNode(textNode).escapeParent(wrapNode); - } - } - - // Creates node around caret formated with options - function formatTextRange(range, composer, options) { - var wrapNode = createWrapNode(range.endContainer, options); - - range.surroundContents(wrapNode); - composer.selection.selectNode(wrapNode); - } - - // Changes/toggles format of whole selection - function updateFormat(composer, textNodes, state, options) { - var exactState = getState(composer, options, true), - selection = composer.selection.getSelection(), - wordObj, textNode, newNode, i; - - if (!textNodes.length) { - // Selection is caret - - - if (options.toggle !== false) { - if (caretIsInsideWord(selection)) { - - // Unformat whole word - wordObj = getRangeForWord(selection); - textNode = wordObj.textNode; - unformatTextNode(wordObj.textNode, composer, options); - cleanupAndSetCaret(composer, wordObj.textNode, wordObj.wordOffset, options); - - } else { - - // Escape caret out of format - textNode = composer.doc.createTextNode(wysihtml.INVISIBLE_SPACE); - newNode = state.nodes[0].cloneNode(false); - newNode.appendChild(textNode); - composer.selection.splitElementAtCaret(state.nodes[0], newNode); - updateFormatOfElement(newNode, options); - cleanupAndSetSelection(composer, [textNode], options); - var s = composer.selection.getSelection(); - if (s.anchorNode && s.focusNode) { - // Has an error in IE when collapsing selection. probably from rangy - try { - s.collapseToEnd(); - } catch (e) {} - } - } - } else { - // In non-toggle mode the closest state element has to be found and the state updated differently - for (i = state.nodes.length; i--;) { - updateFormatOfElement(state.nodes[i], options); - } - } - - } else { - - if (!exactState.partial && options.toggle !== false) { - - // If whole selection (all textnodes) are in the applied format - // remove the format from selection - // Non-toggle mode never removes. Remove has to be called explicitly - for (i = textNodes.length; i--;) { - unformatTextNode(textNodes[i], composer, options); - } - - } else { - - // Selection is partially in format - // change it to new if format if textnode allreafy in similar state - // else just apply - - for (i = textNodes.length; i--;) { - - if (findSimilarTextNodeWrapper(textNodes[i], options, composer.element)) { - unformatTextNode(textNodes[i], composer, options); - } - - if (!findSimilarTextNodeWrapper(textNodes[i], options, composer.element)) { - formatTextNode(textNodes[i], options); - } - } - - } - - cleanupAndSetSelection(composer, textNodes, options); - } - } - - // Removes format from selection - function removeFormat(composer, textNodes, state, options) { - var textNode, textOffset, newNode, i, - selection = composer.selection.getSelection(); - - if (!textNodes.length) { - textNode = selection.anchorNode; - textOffset = selection.anchorOffset; - - for (i = state.nodes.length; i--;) { - wysihtml.dom.unwrap(state.nodes[i]); - } - - cleanupAndSetCaret(composer, textNode, textOffset, options); - } else { - for (i = textNodes.length; i--;) { - removeFormatFromTextNode(textNodes[i], composer, options); - } - cleanupAndSetSelection(composer, textNodes, options); - } - } - - // Adds format to selection - function applyFormat(composer, textNodes, options) { - var wordObj, i, - selection = composer.selection.getSelection(); - - if (!textNodes.length) { - // Handle collapsed selection caret and return - if (caretIsInsideWord(selection)) { - - wordObj = getRangeForWord(selection); - formatTextNode(wordObj.textNode, options); - cleanupAndSetCaret(composer, wordObj.textNode, wordObj.wordOffset, options); - - } else { - var r = composer.selection.getOwnRanges()[0]; - if (r) { - formatTextRange(r, composer, options); - } - } - - } else { - // Handle textnodes in selection and apply format - for (i = textNodes.length; i--;) { - formatTextNode(textNodes[i], options); - } - cleanupAndSetSelection(composer, textNodes, options); - } - } - - // If properties is passed as a string, correct options with that nodeName - function fixOptions(options) { - options = (typeof options === "string") ? { nodeName: options } : options; - if (options.nodeName) { options.nodeName = options.nodeName.toUpperCase(); } - return options; - } - - wysihtml.commands.formatInline = { - - // Basics: - // In case of plain text or inline state not set wrap all non-empty textnodes with - // In case a similar inline wrapper node is detected on one of textnodes, the wrapper node is changed (if fully contained) or split and changed (partially contained) - // In case of changing mode every textnode is addressed separatly - exec: function(composer, command, options) { - options = fixOptions(options); - - // Join adjactent textnodes first - composer.element.normalize(); - - var textNodes = getSelectedTextNodes(composer.selection, true), - state = getState(composer, options); - if (state.nodes.length > 0) { - // Text allready has the format applied - updateFormat(composer, textNodes, state, options); - } else { - // Selection is not in the applied format - applyFormat(composer, textNodes, options); - } - composer.element.normalize(); - }, - - remove: function(composer, command, options) { - options = fixOptions(options); - composer.element.normalize(); - - var textNodes = getSelectedTextNodes(composer.selection, true), - state = getState(composer, options); - - if (state.nodes.length > 0) { - // Text allready has the format applied - removeFormat(composer, textNodes, state, options); - } - - composer.element.normalize(); - }, - - state: function(composer, command, options) { - options = fixOptions(options); - var nodes = getState(composer, options, true).nodes; - return (nodes.length === 0) ? false : nodes; - } - }; - -})(wysihtml); -;(function(wysihtml){ - wysihtml.commands.insertHTML = { - exec: function(composer, command, html) { - composer.selection.insertHTML(html); - }, - - state: function() { - return false; - } - }; -}(wysihtml)); -;(function(wysihtml) { - var LINE_BREAK = "
    " + (wysihtml.browser.needsSpaceAfterLineBreak() ? " " : ""); - - wysihtml.commands.insertLineBreak = { - exec: function(composer, command) { - composer.selection.insertHTML(LINE_BREAK); - }, - - state: function() { - return false; - } - }; -})(wysihtml); -;wysihtml.commands.insertList = (function(wysihtml) { - - var isNode = function(node, name) { - if (node && node.nodeName) { - if (typeof name === 'string') { - name = [name]; - } - for (var n = name.length; n--;) { - if (node.nodeName === name[n]) { - return true; - } - } - } - return false; - }; - - var findListEl = function(node, nodeName, composer) { - var ret = { - el: null, - other: false - }; - - if (node) { - var parentLi = wysihtml.dom.getParentElement(node, { query: "li" }, false, composer.element), - otherNodeName = (nodeName === "UL") ? "OL" : "UL"; - - if (isNode(node, nodeName)) { - ret.el = node; - } else if (isNode(node, otherNodeName)) { - ret = { - el: node, - other: true - }; - } else if (parentLi) { - if (isNode(parentLi.parentNode, nodeName)) { - ret.el = parentLi.parentNode; - } else if (isNode(parentLi.parentNode, otherNodeName)) { - ret = { - el : parentLi.parentNode, - other: true - }; - } - } - } - - // do not count list elements outside of composer - if (ret.el && !composer.element.contains(ret.el)) { - ret.el = null; - } - - return ret; - }; - - var handleSameTypeList = function(el, nodeName, composer) { - var otherNodeName = (nodeName === "UL") ? "OL" : "UL", - otherLists, innerLists; - // Unwrap list - //
    • foo
    • bar
    - // becomes: - // foo
    bar
    - - composer.selection.executeAndRestoreRangy(function() { - otherLists = getListsInSelection(otherNodeName, composer); - if (otherLists.length) { - for (var l = otherLists.length; l--;) { - wysihtml.dom.renameElement(otherLists[l], nodeName.toLowerCase()); - } - } else { - innerLists = getListsInSelection(['OL', 'UL'], composer); - for (var i = innerLists.length; i--;) { - wysihtml.dom.resolveList(innerLists[i], composer.config.useLineBreaks); - } - if (innerLists.length === 0) { - wysihtml.dom.resolveList(el, composer.config.useLineBreaks); - } - } - }); - }; - - var handleOtherTypeList = function(el, nodeName, composer) { - var otherNodeName = (nodeName === "UL") ? "OL" : "UL"; - // Turn an ordered list into an unordered list - //
    1. foo
    2. bar
    - // becomes: - //
    • foo
    • bar
    - // Also rename other lists in selection - composer.selection.executeAndRestoreRangy(function() { - var renameLists = [el].concat(getListsInSelection(otherNodeName, composer)); - - // All selection inner lists get renamed too - for (var l = renameLists.length; l--;) { - wysihtml.dom.renameElement(renameLists[l], nodeName.toLowerCase()); - } - }); - }; - - var getListsInSelection = function(nodeName, composer) { - var ranges = composer.selection.getOwnRanges(), - renameLists = []; - - for (var r = ranges.length; r--;) { - renameLists = renameLists.concat(ranges[r].getNodes([1], function(node) { - return isNode(node, nodeName); - })); - } - - return renameLists; - }; - - var createListFallback = function(nodeName, composer) { - var sel = rangy.saveSelection(composer.win); - - // Fallback for Create list - var tempClassName = "_wysihtml5-temp-" + new Date().getTime(), - isEmpty, list; - - composer.commands.exec("formatBlock", { - "nodeName": "div", - "className": tempClassName - }); - - var tempElement = composer.element.querySelector("." + tempClassName); - - // This space causes new lists to never break on enter - var INVISIBLE_SPACE_REG_EXP = /\uFEFF/g; - tempElement.innerHTML = tempElement.innerHTML.replace(wysihtml.INVISIBLE_SPACE_REG_EXP, ""); - if (tempElement) { - isEmpty = (/^(\s|(
    ))+$/i).test(tempElement.innerHTML); - list = wysihtml.dom.convertToList(tempElement, nodeName.toLowerCase(), composer.parent.config.classNames.uneditableContainer); - if (sel) { - rangy.restoreSelection(sel); - } - if (isEmpty) { - composer.selection.selectNode(list.querySelector("li"), true); - } - } - }; - - return { - exec: function(composer, command, nodeName) { - var doc = composer.doc, - cmd = (nodeName === "OL") ? "insertOrderedList" : "insertUnorderedList", - s = composer.selection.getSelection(), - anode = s.anchorNode.nodeType === 1 && s.anchorNode.firstChild ? s.anchorNode.childNodes[s.anchorOffset] : s.anchorNode, - fnode = s.focusNode.nodeType === 1 && s.focusNode.firstChild ? s.focusNode.childNodes[s.focusOffset] || s.focusNode.lastChild : s.focusNode, - selectedNode, list; - - if (s.isBackwards()) { - // swap variables - anode = [fnode, fnode = anode][0]; - } - - if (wysihtml.dom.domNode(fnode).is.emptyTextNode(true) && fnode) { - fnode = wysihtml.dom.domNode(fnode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); - } - if (wysihtml.dom.domNode(anode).is.emptyTextNode(true) && anode) { - anode = wysihtml.dom.domNode(anode).next({nodeTypes: [1,3], ignoreBlankTexts: true}); - } - - if (anode && fnode) { - if (anode === fnode) { - selectedNode = anode; - } else { - selectedNode = wysihtml.dom.domNode(anode).commonAncestor(fnode, composer.element); - } - } else { - selectedNode = composer.selection.getSelectedNode(); - } - - list = findListEl(selectedNode, nodeName, composer); - - if (!list.el) { - if (composer.commands.support(cmd)) { - doc.execCommand(cmd, false, null); - } else { - createListFallback(nodeName, composer); - } - } else if (list.other) { - handleOtherTypeList(list.el, nodeName, composer); - } else { - handleSameTypeList(list.el, nodeName, composer); - } - }, - - state: function(composer, command, nodeName) { - var selectedNode = composer.selection.getSelectedNode(), - list = findListEl(selectedNode, nodeName, composer); - - return (list.el && !list.other) ? list.el : false; - } - }; - -})(wysihtml); -;(function(wysihtml){ - wysihtml.commands.redo = { - exec: function(composer) { - return composer.undoManager.redo(); - }, - - state: function(composer) { - return false; - } - }; -}(wysihtml)); -;(function(wysihtml){ - wysihtml.commands.undo = { - exec: function(composer) { - return composer.undoManager.undo(); - }, - - state: function(composer) { - return false; - } - }; -}(wysihtml)); -;(function(wysihtml){ - wysihtml.commands.createTable = { - exec: function(composer, command, value) { - var col, row, html; - if (value && value.cols && value.rows && parseInt(value.cols, 10) > 0 && parseInt(value.rows, 10) > 0) { - if (value.tableStyle) { - html = ""; - } else { - html = "
    "; - } - html += ""; - for (row = 0; row < value.rows; row ++) { - html += ''; - for (col = 0; col < value.cols; col ++) { - html += ""; - } - html += ''; - } - html += "

    "; - composer.commands.exec("insertHTML", html); - //composer.selection.insertHTML(html); - } - }, - - state: function(composer, command) { - return false; - } - }; - -}(wysihtml)); -;(function(wysihtml){ - wysihtml.commands.mergeTableCells = { - exec: function(composer, command) { - if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { - if (this.state(composer, command)) { - wysihtml.dom.table.unmergeCell(composer.tableSelection.start); - } else { - wysihtml.dom.table.mergeCellsBetween(composer.tableSelection.start, composer.tableSelection.end); - } - } - }, - - state: function(composer, command) { - if (composer.tableSelection) { - var start = composer.tableSelection.start, - end = composer.tableSelection.end; - if (start && end && start == end && - (( - wysihtml.dom.getAttribute(start, "colspan") && - parseInt(wysihtml.dom.getAttribute(start, "colspan"), 10) > 1 - ) || ( - wysihtml.dom.getAttribute(start, "rowspan") && - parseInt(wysihtml.dom.getAttribute(start, "rowspan"), 10) > 1 - )) - ) { - return [start]; - } - } - return false; - } - }; -}(wysihtml)); -;(function(wysihtml){ - wysihtml.commands.addTableCells = { - exec: function(composer, command, value) { - if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { - - // switches start and end if start is bigger than end (reverse selection) - var tableSelect = wysihtml.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end); - if (value == "before" || value == "above") { - wysihtml.dom.table.addCells(tableSelect.start, value); - } else if (value == "after" || value == "below") { - wysihtml.dom.table.addCells(tableSelect.end, value); - } - setTimeout(function() { - composer.tableSelection.select(tableSelect.start, tableSelect.end); - },0); - } - }, - - state: function(composer, command) { - return false; - } - }; -}(wysihtml)); -;(function(wysihtml){ - wysihtml.commands.deleteTableCells = { - exec: function(composer, command, value) { - if (composer.tableSelection && composer.tableSelection.start && composer.tableSelection.end) { - var tableSelect = wysihtml.dom.table.orderSelectionEnds(composer.tableSelection.start, composer.tableSelection.end), - idx = wysihtml.dom.table.indexOf(tableSelect.start), - selCell, - table = composer.tableSelection.table; - - wysihtml.dom.table.removeCells(tableSelect.start, value); - setTimeout(function() { - // move selection to next or previous if not present - selCell = wysihtml.dom.table.findCell(table, idx); - - if (!selCell){ - if (value == "row") { - selCell = wysihtml.dom.table.findCell(table, { - "row": idx.row - 1, - "col": idx.col - }); - } - - if (value == "column") { - selCell = wysihtml.dom.table.findCell(table, { - "row": idx.row, - "col": idx.col - 1 - }); - } - } - if (selCell) { - composer.tableSelection.select(selCell, selCell); - } - }, 0); - } - }, - - state: function(composer, command) { - return false; - } - }; -}(wysihtml)); -;(function(wysihtml){ - wysihtml.commands.indentList = { - exec: function(composer, command, value) { - var listEls = composer.selection.getSelectionParentsByTag('LI'); - if (listEls) { - return this.tryToPushLiLevel(listEls, composer.selection); - } - return false; - }, - - state: function(composer, command) { - return false; - }, - - tryToPushLiLevel: function(liNodes, selection) { - var listTag, list, prevLi, liNode, prevLiList, - found = false; - - selection.executeAndRestoreRangy(function() { - - for (var i = liNodes.length; i--;) { - liNode = liNodes[i]; - listTag = (liNode.parentNode.nodeName === 'OL') ? 'OL' : 'UL'; - list = liNode.ownerDocument.createElement(listTag); - prevLi = wysihtml.dom.domNode(liNode).prev({nodeTypes: [wysihtml.ELEMENT_NODE]}); - prevLiList = (prevLi) ? prevLi.querySelector('ul, ol') : null; - - if (prevLi) { - if (prevLiList) { - prevLiList.appendChild(liNode); - } else { - list.appendChild(liNode); - prevLi.appendChild(list); - } - found = true; - } - } - - }); - return found; - } - }; -}(wysihtml)); -;(function(wysihtml){ - - wysihtml.commands.outdentList = { - exec: function(composer, command, value) { - var listEls = composer.selection.getSelectionParentsByTag('LI'); - if (listEls) { - return this.tryToPullLiLevel(listEls, composer); - } - return false; - }, - - state: function(composer, command) { - return false; - }, - - tryToPullLiLevel: function(liNodes, composer) { - var listNode, outerListNode, outerLiNode, list, prevLi, liNode, afterList, - found = false, - that = this; - - composer.selection.executeAndRestoreRangy(function() { - - for (var i = liNodes.length; i--;) { - liNode = liNodes[i]; - if (liNode.parentNode) { - listNode = liNode.parentNode; - - if (listNode.tagName === 'OL' || listNode.tagName === 'UL') { - found = true; - - outerListNode = wysihtml.dom.getParentElement(listNode.parentNode, { query: 'ol, ul' }, false, composer.element); - outerLiNode = wysihtml.dom.getParentElement(listNode.parentNode, { query: 'li' }, false, composer.element); - - if (outerListNode && outerLiNode) { - - if (liNode.nextSibling) { - afterList = that.getAfterList(listNode, liNode); - liNode.appendChild(afterList); - } - outerListNode.insertBefore(liNode, outerLiNode.nextSibling); - - } else { - - if (liNode.nextSibling) { - afterList = that.getAfterList(listNode, liNode); - liNode.appendChild(afterList); - } - - for (var j = liNode.childNodes.length; j--;) { - listNode.parentNode.insertBefore(liNode.childNodes[j], listNode.nextSibling); - } - - listNode.parentNode.insertBefore(document.createElement('br'), listNode.nextSibling); - liNode.parentNode.removeChild(liNode); - - } - - // cleanup - if (listNode.childNodes.length === 0) { - listNode.parentNode.removeChild(listNode); - } - } - } - } - - }); - return found; - }, - - getAfterList: function(listNode, liNode) { - var nodeName = listNode.nodeName, - newList = document.createElement(nodeName); - - while (liNode.nextSibling) { - newList.appendChild(liNode.nextSibling); - } - return newList; - } - - }; -}(wysihtml)); -;/** - * Undo Manager for wysihtml5 - * slightly inspired by http://rniwa.com/editing/undomanager.html#the-undomanager-interface - */ -(function(wysihtml) { - var Z_KEY = 90, - Y_KEY = 89, - BACKSPACE_KEY = 8, - DELETE_KEY = 46, - MAX_HISTORY_ENTRIES = 25, - DATA_ATTR_NODE = "data-wysihtml5-selection-node", - DATA_ATTR_OFFSET = "data-wysihtml5-selection-offset", - UNDO_HTML = '' + wysihtml.INVISIBLE_SPACE + '', - REDO_HTML = '' + wysihtml.INVISIBLE_SPACE + '', - dom = wysihtml.dom; - - function cleanTempElements(doc) { - var tempElement; - while (tempElement = doc.querySelector("._wysihtml5-temp")) { - tempElement.parentNode.removeChild(tempElement); - } - } - - wysihtml.UndoManager = wysihtml.lang.Dispatcher.extend( - /** @scope wysihtml.UndoManager.prototype */ { - constructor: function(editor) { - this.editor = editor; - this.composer = editor.composer; - this.element = this.composer.element; - - this.position = 0; - this.historyStr = []; - this.historyDom = []; - - this.transact(); - - this._observe(); - }, - - _observe: function() { - var that = this, - doc = this.composer.sandbox.getDocument(), - lastKey; - - // Catch CTRL+Z and CTRL+Y - dom.observe(this.element, "keydown", function(event) { - if (event.altKey || (!event.ctrlKey && !event.metaKey)) { - return; - } - - var keyCode = event.keyCode, - isUndo = keyCode === Z_KEY && !event.shiftKey, - isRedo = (keyCode === Z_KEY && event.shiftKey) || (keyCode === Y_KEY); - - if (isUndo) { - that.undo(); - event.preventDefault(); - } else if (isRedo) { - that.redo(); - event.preventDefault(); - } - }); - - // Catch delete and backspace - dom.observe(this.element, "keydown", function(event) { - var keyCode = event.keyCode; - if (keyCode === lastKey) { - return; - } - - lastKey = keyCode; - - if (keyCode === BACKSPACE_KEY || keyCode === DELETE_KEY) { - that.transact(); - } - }); - - this.editor - .on("newword:composer", function() { - that.transact(); - }) - - .on("beforecommand:composer", function() { - that.transact(); - }); - }, - - transact: function() { - var previousHtml = this.historyStr[this.position - 1], - currentHtml = this.composer.getValue(false, false), - composerIsVisible = this.element.offsetWidth > 0 && this.element.offsetHeight > 0, - range, node, offset, element, position; - - if (currentHtml === previousHtml) { - return; - } - - var length = this.historyStr.length = this.historyDom.length = this.position; - if (length > MAX_HISTORY_ENTRIES) { - this.historyStr.shift(); - this.historyDom.shift(); - this.position--; - } - - this.position++; - - if (composerIsVisible) { - // Do not start saving selection if composer is not visible - range = this.composer.selection.getRange(); - node = (range && range.startContainer) ? range.startContainer : this.element; - offset = (range && range.startOffset) ? range.startOffset : 0; - - if (node.nodeType === wysihtml.ELEMENT_NODE) { - element = node; - } else { - element = node.parentNode; - position = this.getChildNodeIndex(element, node); - } - - element.setAttribute(DATA_ATTR_OFFSET, offset); - if (typeof(position) !== "undefined") { - element.setAttribute(DATA_ATTR_NODE, position); - } - } - - var clone = this.element.cloneNode(!!currentHtml); - this.historyDom.push(clone); - this.historyStr.push(currentHtml); - - if (element) { - element.removeAttribute(DATA_ATTR_OFFSET); - element.removeAttribute(DATA_ATTR_NODE); - } - - }, - - undo: function() { - this.transact(); - - if (!this.undoPossible()) { - return; - } - - this.set(this.historyDom[--this.position - 1]); - this.editor.fire("undo:composer"); - }, - - redo: function() { - if (!this.redoPossible()) { - return; - } - - this.set(this.historyDom[++this.position - 1]); - this.editor.fire("redo:composer"); - }, - - undoPossible: function() { - return this.position > 1; - }, - - redoPossible: function() { - return this.position < this.historyStr.length; - }, - - set: function(historyEntry) { - this.element.innerHTML = ""; - - var i = 0, - childNodes = historyEntry.childNodes, - length = historyEntry.childNodes.length; - - for (; i"; - }, - - getValue: function(parse, clearInternals) { - var value = this.isEmpty() ? "" : wysihtml.quirks.getCorrectInnerHTML(this.element); - if (parse !== false) { - value = this.parent.parse(value, (clearInternals === false) ? false : true); - } - return value; - }, - - setValue: function(html, parse) { - if (parse !== false) { - html = this.parent.parse(html); - } - - try { - this.element.innerHTML = html; - } catch (e) { - this.element.innerText = html; - } - }, - - cleanUp: function(rules) { - var bookmark; - if (this.selection && this.selection.isInThisEditable()) { - bookmark = rangy.saveSelection(this.win); - } - this.parent.parse(this.element, undefined, rules); - if (bookmark) { - rangy.restoreSelection(bookmark); - } - }, - - show: function() { - this.editableArea.style.display = this._displayStyle || ""; - - if (!this.config.noTextarea && !this.textarea.element.disabled) { - // Firefox needs this, otherwise contentEditable becomes uneditable - this.disable(); - this.enable(); - } - }, - - hide: function() { - this._displayStyle = dom.getStyle("display").from(this.editableArea); - if (this._displayStyle === "none") { - this._displayStyle = null; - } - this.editableArea.style.display = "none"; - }, - - disable: function() { - this.parent.fire("disable:composer"); - this.element.removeAttribute("contentEditable"); - }, - - enable: function() { - this.parent.fire("enable:composer"); - this.element.setAttribute("contentEditable", "true"); - }, - - focus: function(setToEnd) { - // IE 8 fires the focus event after .focus() - // This is needed by our simulate_placeholder.js to work - // therefore we clear it ourselves this time - if (wysihtml.browser.doesAsyncFocus() && this.hasPlaceholderSet()) { - this.clear(); - } - - this.base(); - - var lastChild = this.element.lastChild; - if (setToEnd && lastChild && this.selection) { - if (lastChild.nodeName === "BR") { - this.selection.setBefore(this.element.lastChild); - } else { - this.selection.setAfter(this.element.lastChild); - } - } - }, - - getScrollPos: function() { - if (this.doc && this.win) { - var pos = {}; - - if (typeof this.win.pageYOffset !== "undefined") { - pos.y = this.win.pageYOffset; - } else { - pos.y = (this.doc.documentElement || this.doc.body.parentNode || this.doc.body).scrollTop; - } - - if (typeof this.win.pageXOffset !== "undefined") { - pos.x = this.win.pageXOffset; - } else { - pos.x = (this.doc.documentElement || this.doc.body.parentNode || this.doc.body).scrollLeft; - } - - return pos; - } - }, - - setScrollPos: function(pos) { - if (pos && typeof pos.x !== "undefined" && typeof pos.y !== "undefined") { - this.win.scrollTo(pos.x, pos.y); - } - }, - - getTextContent: function() { - return dom.getTextContent(this.element); - }, - - hasPlaceholderSet: function() { - return this.getTextContent() == ((this.config.noTextarea) ? this.editableArea.getAttribute("data-placeholder") : this.textarea.element.getAttribute("placeholder")) && this.placeholderSet; - }, - - isEmpty: function() { - var innerHTML = this.element.innerHTML.toLowerCase(); - return (/^(\s|
    |<\/br>|

    |<\/p>)*$/i).test(innerHTML) || - innerHTML === "" || - innerHTML === "
    " || - innerHTML === "

    " || - innerHTML === "


    " || - this.hasPlaceholderSet(); - }, - - _initContentEditableArea: function() { - var that = this; - if (this.config.noTextarea) { - this.sandbox = new dom.ContentEditableArea(function() { - that._create(); - }, { - className: this.config.classNames.sandbox - }, this.editableArea); - } else { - this.sandbox = new dom.ContentEditableArea(function() { - that._create(); - }, { - className: this.config.classNames.sandbox - }); - this.editableArea = this.sandbox.getContentEditable(); - dom.insert(this.editableArea).after(this.textarea.element); - this._createWysiwygFormField(); - } - }, - - _initSandbox: function() { - var that = this; - this.sandbox = new dom.Sandbox(function() { - that._create(); - }, { - stylesheets: this.config.stylesheets, - className: this.config.classNames.sandbox - }); - this.editableArea = this.sandbox.getIframe(); - - var textareaElement = this.textarea.element; - dom.insert(this.editableArea).after(textareaElement); - - this._createWysiwygFormField(); - }, - - // Creates hidden field which tells the server after submit, that the user used an wysiwyg editor - _createWysiwygFormField: function() { - if (this.textarea.element.form) { - var hiddenField = document.createElement("input"); - hiddenField.type = "hidden"; - hiddenField.name = "_wysihtml5_mode"; - hiddenField.value = 1; - dom.insert(hiddenField).after(this.textarea.element); - } - }, - - _create: function() { - var that = this; - this.doc = this.sandbox.getDocument(); - this.win = this.sandbox.getWindow(); - this.element = (this.config.contentEditableMode) ? this.sandbox.getContentEditable() : this.doc.body; - if (!this.config.noTextarea) { - this.textarea = this.parent.textarea; - this.element.innerHTML = this.textarea.getValue(true, false); - } else { - this.cleanUp(); // cleans contenteditable on initiation as it may contain html - } - - // Make sure our selection handler is ready - this.selection = new wysihtml.Selection(this.parent, this.element, this.config.classNames.uneditableContainer); - - // Make sure commands dispatcher is ready - this.commands = new wysihtml.Commands(this.parent); - - if (!this.config.noTextarea) { - dom.copyAttributes([ - "className", "spellcheck", "title", "lang", "dir", "accessKey" - ]).from(this.textarea.element).to(this.element); - } - - this._initAutoLinking(); - - dom.addClass(this.element, this.config.classNames.composer); - // - // Make the editor look like the original textarea, by syncing styles - if (this.config.style && !this.config.contentEditableMode) { - this.style(); - } - - this.observe(); - - var name = this.config.name; - if (name) { - dom.addClass(this.element, name); - if (!this.config.contentEditableMode) { dom.addClass(this.editableArea, name); } - } - - this.enable(); - - if (!this.config.noTextarea && this.textarea.element.disabled) { - this.disable(); - } - - // Simulate html5 placeholder attribute on contentEditable element - var placeholderText = typeof(this.config.placeholder) === "string" - ? this.config.placeholder - : ((this.config.noTextarea) ? this.editableArea.getAttribute("data-placeholder") : this.textarea.element.getAttribute("placeholder")); - if (placeholderText) { - dom.simulatePlaceholder(this.parent, this, placeholderText, this.config.classNames.placeholder); - } - - // Make sure that the browser avoids using inline styles whenever possible - this.commands.exec("styleWithCSS", false); - - this._initObjectResizing(); - this._initUndoManager(); - this._initLineBreaking(); - - // Simulate html5 autofocus on contentEditable element - // This doesn't work on IOS (5.1.1) - if (!this.config.noTextarea && (this.textarea.element.hasAttribute("autofocus") || document.querySelector(":focus") == this.textarea.element) && !browser.isIos()) { - setTimeout(function() { that.focus(true); }, 100); - } - - // IE sometimes leaves a single paragraph, which can't be removed by the user - if (!browser.clearsContentEditableCorrectly()) { - wysihtml.quirks.ensureProperClearing(this); - } - - // Set up a sync that makes sure that textarea and editor have the same content - if (this.initSync && this.config.sync) { - this.initSync(); - } - - // Okay hide the textarea, we are ready to go - if (!this.config.noTextarea) { this.textarea.hide(); } - - // Fire global (before-)load event - this.parent.fire("beforeload").fire("load"); - }, - - _initAutoLinking: function() { - var that = this, - supportsDisablingOfAutoLinking = browser.canDisableAutoLinking(), - supportsAutoLinking = browser.doesAutoLinkingInContentEditable(); - - if (supportsDisablingOfAutoLinking) { - this.commands.exec("AutoUrlDetect", false, false); - } - - if (!this.config.autoLink) { - return; - } - - // Only do the auto linking by ourselves when the browser doesn't support auto linking - // OR when he supports auto linking but we were able to turn it off (IE9+) - if (!supportsAutoLinking || (supportsAutoLinking && supportsDisablingOfAutoLinking)) { - this.parent.on("newword:composer", function() { - if (dom.getTextContent(that.element).match(dom.autoLink.URL_REG_EXP)) { - var nodeWithSelection = that.selection.getSelectedNode(), - uneditables = that.element.querySelectorAll("." + that.config.classNames.uneditableContainer), - isInUneditable = false; - - for (var i = uneditables.length; i--;) { - if (wysihtml.dom.contains(uneditables[i], nodeWithSelection)) { - isInUneditable = true; - } - } - - if (!isInUneditable) dom.autoLink(nodeWithSelection, [that.config.classNames.uneditableContainer]); - } - }); - - dom.observe(this.element, "blur", function() { - dom.autoLink(that.element, [that.config.classNames.uneditableContainer]); - }); - } - - // Assuming we have the following: - // http://www.google.de - // If a user now changes the url in the innerHTML we want to make sure that - // it's synchronized with the href attribute (as long as the innerHTML is still a url) - var // Use a live NodeList to check whether there are any links in the document - links = this.sandbox.getDocument().getElementsByTagName("a"), - // The autoLink helper method reveals a reg exp to detect correct urls - urlRegExp = dom.autoLink.URL_REG_EXP, - getTextContent = function(element) { - var textContent = wysihtml.lang.string(dom.getTextContent(element)).trim(); - if (textContent.substr(0, 4) === "www.") { - textContent = "http://" + textContent; - } - return textContent; - }; - - dom.observe(this.element, "keydown", function(event) { - if (!links.length) { - return; - } - - var selectedNode = that.selection.getSelectedNode(event.target.ownerDocument), - link = dom.getParentElement(selectedNode, { query: "a" }, 4), - textContent; - - if (!link) { - return; - } - - textContent = getTextContent(link); - // keydown is fired before the actual content is changed - // therefore we set a timeout to change the href - setTimeout(function() { - var newTextContent = getTextContent(link); - if (newTextContent === textContent) { - return; - } - - // Only set href when new href looks like a valid url - if (newTextContent.match(urlRegExp)) { - link.setAttribute("href", newTextContent); - } - }, 0); - }); - }, - - _initObjectResizing: function() { - this.commands.exec("enableObjectResizing", true); - - // IE sets inline styles after resizing objects - // The following lines make sure that the width/height css properties - // are copied over to the width/height attributes - if (browser.supportsEvent("resizeend")) { - var properties = ["width", "height"], - propertiesLength = properties.length, - element = this.element; - - dom.observe(element, "resizeend", function(event) { - var target = event.target || event.srcElement, - style = target.style, - i = 0, - property; - - if (target.nodeName !== "IMG") { - return; - } - - for (; i p:first-child { margin-top: 0; }", - "._wysihtml5-temp { display: none; }", - wysihtml.browser.isGecko ? - "body.placeholder { color: graytext !important; }" : - "body.placeholder { color: #a9a9a9 !important; }", - // Ensure that user see's broken images and can delete them - "img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }" - ]; - - /** - * With "setActive" IE offers a smart way of focusing elements without scrolling them into view: - * http://msdn.microsoft.com/en-us/library/ms536738(v=vs.85).aspx - * - * Other browsers need a more hacky way: (pssst don't tell my mama) - * In order to prevent the element being scrolled into view when focusing it, we simply - * move it out of the scrollable area, focus it, and reset it's position - */ - var focusWithoutScrolling = function(element) { - if (element.setActive) { - // Following line could cause a js error when the textarea is invisible - // See https://github.com/xing/wysihtml5/issues/9 - try { element.setActive(); } catch(e) {} - } else { - var elementStyle = element.style, - originalScrollTop = doc.documentElement.scrollTop || doc.body.scrollTop, - originalScrollLeft = doc.documentElement.scrollLeft || doc.body.scrollLeft, - originalStyles = { - position: elementStyle.position, - top: elementStyle.top, - left: elementStyle.left, - WebkitUserSelect: elementStyle.WebkitUserSelect - }; - - dom.setStyles({ - position: "absolute", - top: "-99999px", - left: "-99999px", - // Don't ask why but temporarily setting -webkit-user-select to none makes the whole thing performing smoother - WebkitUserSelect: "none" - }).on(element); - - element.focus(); - - dom.setStyles(originalStyles).on(element); - - if (win.scrollTo) { - // Some browser extensions unset this method to prevent annoyances - // "Better PopUp Blocker" for Chrome http://code.google.com/p/betterpopupblocker/source/browse/trunk/blockStart.js#100 - // Issue: http://code.google.com/p/betterpopupblocker/issues/detail?id=1 - win.scrollTo(originalScrollLeft, originalScrollTop); - } - } - }; - - - wysihtml.views.Composer.prototype.style = function() { - var that = this, - originalActiveElement = doc.querySelector(":focus"), - textareaElement = this.textarea.element, - hasPlaceholder = textareaElement.hasAttribute("placeholder"), - originalPlaceholder = hasPlaceholder && textareaElement.getAttribute("placeholder"), - originalDisplayValue = textareaElement.style.display, - originalDisabled = textareaElement.disabled, - displayValueForCopying; - - this.focusStylesHost = HOST_TEMPLATE.cloneNode(false); - this.blurStylesHost = HOST_TEMPLATE.cloneNode(false); - this.disabledStylesHost = HOST_TEMPLATE.cloneNode(false); - - // Remove placeholder before copying (as the placeholder has an affect on the computed style) - if (hasPlaceholder) { - textareaElement.removeAttribute("placeholder"); - } - - if (textareaElement === originalActiveElement) { - textareaElement.blur(); - } - - // enable for copying styles - textareaElement.disabled = false; - - // set textarea to display="none" to get cascaded styles via getComputedStyle - textareaElement.style.display = displayValueForCopying = "none"; - - if ((textareaElement.getAttribute("rows") && dom.getStyle("height").from(textareaElement) === "auto") || - (textareaElement.getAttribute("cols") && dom.getStyle("width").from(textareaElement) === "auto")) { - textareaElement.style.display = displayValueForCopying = originalDisplayValue; - } - - // --------- iframe styles (has to be set before editor styles, otherwise IE9 sets wrong fontFamily on blurStylesHost) --------- - dom.copyStyles(BOX_FORMATTING).from(textareaElement).to(this.editableArea).andTo(this.blurStylesHost); - - // --------- editor styles --------- - dom.copyStyles(TEXT_FORMATTING).from(textareaElement).to(this.element).andTo(this.blurStylesHost); - - // --------- apply standard rules --------- - dom.insertCSS(ADDITIONAL_CSS_RULES).into(this.element.ownerDocument); - - // --------- :disabled styles --------- - textareaElement.disabled = true; - dom.copyStyles(BOX_FORMATTING).from(textareaElement).to(this.disabledStylesHost); - dom.copyStyles(TEXT_FORMATTING).from(textareaElement).to(this.disabledStylesHost); - textareaElement.disabled = originalDisabled; - - // --------- :focus styles --------- - textareaElement.style.display = originalDisplayValue; - focusWithoutScrolling(textareaElement); - textareaElement.style.display = displayValueForCopying; - - dom.copyStyles(BOX_FORMATTING).from(textareaElement).to(this.focusStylesHost); - dom.copyStyles(TEXT_FORMATTING).from(textareaElement).to(this.focusStylesHost); - - // reset textarea - textareaElement.style.display = originalDisplayValue; - - dom.copyStyles(["display"]).from(textareaElement).to(this.editableArea); - - // Make sure that we don't change the display style of the iframe when copying styles oblur/onfocus - // this is needed for when the change_view event is fired where the iframe is hidden and then - // the blur event fires and re-displays it - var boxFormattingStyles = wysihtml.lang.array(BOX_FORMATTING).without(["display"]); - - // --------- restore focus --------- - if (originalActiveElement) { - originalActiveElement.focus(); - } else { - textareaElement.blur(); - } - - // --------- restore placeholder --------- - if (hasPlaceholder) { - textareaElement.setAttribute("placeholder", originalPlaceholder); - } - - // --------- Sync focus/blur styles --------- - this.parent.on("focus:composer", function() { - dom.copyStyles(boxFormattingStyles) .from(that.focusStylesHost).to(that.editableArea); - dom.copyStyles(TEXT_FORMATTING) .from(that.focusStylesHost).to(that.element); - }); - - this.parent.on("blur:composer", function() { - dom.copyStyles(boxFormattingStyles) .from(that.blurStylesHost).to(that.editableArea); - dom.copyStyles(TEXT_FORMATTING) .from(that.blurStylesHost).to(that.element); - }); - - this.parent.observe("disable:composer", function() { - dom.copyStyles(boxFormattingStyles) .from(that.disabledStylesHost).to(that.editableArea); - dom.copyStyles(TEXT_FORMATTING) .from(that.disabledStylesHost).to(that.element); - }); - - this.parent.observe("enable:composer", function() { - dom.copyStyles(boxFormattingStyles) .from(that.blurStylesHost).to(that.editableArea); - dom.copyStyles(TEXT_FORMATTING) .from(that.blurStylesHost).to(that.element); - }); - - return this; - }; -})(wysihtml); -;/** - * Taking care of events - * - Simulating 'change' event on contentEditable element - * - Handling drag & drop logic - * - Catch paste events - * - Dispatch proprietary newword:composer event - * - Keyboard shortcuts - */ -(function(wysihtml) { - var dom = wysihtml.dom, - domNode = dom.domNode, - browser = wysihtml.browser, - /** - * Map keyCodes to query commands - */ - shortcuts = { - "66": "bold", // B - "73": "italic", // I - "85": "underline" // U - }; - - var actions = { - - // Adds multiple eventlisteners to target, bound to one callback - // TODO: If needed elsewhere make it part of wysihtml.dom or sth - addListeners: function (target, events, callback) { - for(var i = 0, max = events.length; i < max; i++) { - target.addEventListener(events[i], callback, false); - } - }, - - // Removes multiple eventlisteners from target, bound to one callback - // TODO: If needed elsewhere make it part of wysihtml.dom or sth - removeListeners: function (target, events, callback) { - for(var i = 0, max = events.length; i < max; i++) { - target.removeEventListener(events[i], callback, false); - } - }, - - // Override for giving user ability to delete last line break in table cell - fixLastBrDeletionInTable: function(composer, force) { - if (composer.selection.caretIsLastInSelection()) { - var sel = composer.selection.getSelection(), - aNode = sel.anchorNode; - if (aNode && aNode.nodeType === 1 && (wysihtml.dom.getParentElement(aNode, {query: 'td, th'}, false, composer.element) || force)) { - var nextNode = aNode.childNodes[sel.anchorOffset]; - if (nextNode && nextNode.nodeType === 1 & nextNode.nodeName === "BR") { - nextNode.parentNode.removeChild(nextNode); - return true; - } - } - } - return false; - }, - - // If found an uneditable before caret then notify it before deletion - handleUneditableDeletion: function(composer) { - var before = composer.selection.getBeforeSelection(true); - if (before && (before.type === "element" || before.type === "leafnode") && before.node.nodeType === 1 && before.node.classList.contains(composer.config.classNames.uneditableContainer)) { - if (actions.fixLastBrDeletionInTable(composer, true)) { - return true; - } - try { - var ev = new CustomEvent("wysihtml5:uneditable:delete", {bubbles: true, cancelable: false}); - before.node.dispatchEvent(ev); - } catch (err) {} - before.node.parentNode.removeChild(before.node); - return true; - } - return false; - }, - - // Deletion with caret in the beginning of headings and other block elvel elements needs special attention - // Not allways does it concate text to previous block node correctly (browsers do unexpected miracles here especially webkit) - fixDeleteInTheBeginningOfBlock: function(composer) { - var selection = composer.selection, - prevNode = selection.getPreviousNode(); - - if (selection.caretIsFirstInSelection(wysihtml.browser.usesControlRanges()) && prevNode) { - if (prevNode.nodeType === 1 && - wysihtml.dom.domNode(prevNode).is.block() && - !domNode(prevNode).test({ - query: "ol, ul, table, tr, dl" - }) - ) { - if ((/^\s*$/).test(prevNode.textContent || prevNode.innerText)) { - // If heading is empty remove the heading node - prevNode.parentNode.removeChild(prevNode); - return true; - } else { - if (prevNode.lastChild) { - var selNode = prevNode.lastChild, - selectedNode = selection.getSelectedNode(), - commonAncestorNode = domNode(prevNode).commonAncestor(selectedNode, composer.element), - curNode = wysihtml.dom.getParentElement(selectedNode, { - query: "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote" - }, false, commonAncestorNode || composer.element); - - if (curNode) { - domNode(curNode).transferContentTo(prevNode, true); - selection.setAfter(selNode); - return true; - } else if (wysihtml.browser.usesControlRanges()) { - selectedNode = selection.getCaretNode(); - domNode(selectedNode).transferContentTo(prevNode, true); - selection.setAfter(selNode); - return true; - } - } - } - } - } - return false; - }, - - /* In IE when deleting with caret at the begining of LI, list gets broken into half instead of merging the LI with previous */ - /* This does not match other browsers an is less intuitive from UI standpoint, thus has to be fixed */ - fixDeleteInTheBeginningOfLi: function(composer) { - if (wysihtml.browser.hasLiDeletingProblem()) { - var selection = composer.selection.getSelection(), - aNode = selection.anchorNode, - listNode, prevNode, firstNode, - isInBeginnig = composer.selection.caretIsFirstInSelection(); - - // Fix caret at the beginnig of first textNode in LI - if (aNode.nodeType === 3 && selection.anchorOffset === 0 && aNode === aNode.parentNode.firstChild) { - aNode = aNode.parentNode; - isInBeginnig = true; - } - - if (isInBeginnig && aNode && aNode.nodeType === 1 && aNode.nodeName === "LI") { - prevNode = domNode(aNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); - if (!prevNode && aNode.parentNode && (aNode.parentNode.nodeName === "UL" || aNode.parentNode.nodeName === "OL")) { - prevNode = domNode(aNode.parentNode).prev({nodeTypes: [1,3], ignoreBlankTexts: true}); - } - if (prevNode) { - firstNode = aNode.firstChild; - domNode(aNode).transferContentTo(prevNode, true); - if (firstNode) { - composer.selection.setBefore(firstNode); - } else if (prevNode) { - if (prevNode.nodeType === 1) { - if (prevNode.lastChild) { - composer.selection.setAfter(prevNode.lastChild); - } else { - composer.selection.selectNode(prevNode); - } - } else { - composer.selection.setAfter(prevNode); - } - } - return true; - } - } - } - return false; - }, - - fixDeleteInTheBeginningOfControlSelection: function(composer) { - var selection = composer.selection, - prevNode = selection.getPreviousNode(), - selectedNode = selection.getSelectedNode(), - afterCaretNode; - - if (selection.caretIsFirstInSelection()) { - if (selectedNode.nodeType === 3) { - selectedNode = selectedNode.parentNode; - } - afterCaretNode = selectedNode.firstChild; - domNode(selectedNode).transferContentTo(prevNode, true); - if (afterCaretNode) { - composer.selection.setBefore(afterCaretNode); - } - return true; - } - return false; - }, - - // Table management - // If present enableObjectResizing and enableInlineTableEditing command should be called with false to prevent native table handlers - initTableHandling: function() { - var hideHandlers = function() { - window.removeEventListener('load', hideHandlers); - this.doc.execCommand("enableObjectResizing", false, "false"); - this.doc.execCommand("enableInlineTableEditing", false, "false"); - }.bind(this), - iframeInitiator = (function() { - hideHandlers.call(this); - actions.removeListeners(this.sandbox.getIframe(), ["focus", "mouseup", "mouseover"], iframeInitiator); - }).bind(this); - - if( this.doc.execCommand && - wysihtml.browser.supportsCommand(this.doc, "enableObjectResizing") && - wysihtml.browser.supportsCommand(this.doc, "enableInlineTableEditing")) - { - if (this.sandbox.getIframe) { - actions.addListeners(this.sandbox.getIframe(), ["focus", "mouseup", "mouseover"], iframeInitiator); - } else { - window.addEventListener('load', hideHandlers); - } - } - this.tableSelection = wysihtml.quirks.tableCellsSelection(this.element, this.parent); - }, - - // Fixes some misbehaviours of enters in linebreaks mode (natively a bit unsupported feature) - // Returns true if some corrections is applied so events know when to prevent default - doLineBreaksModeEnterWithCaret: function(composer) { - var breakNodes = "p, pre, div, blockquote", - caretInfo, parent, txtNode, - ret = false; - - caretInfo = composer.selection.getNodesNearCaret(); - if (caretInfo) { - - if (caretInfo.caretNode || caretInfo.nextNode) { - parent = dom.getParentElement(caretInfo.caretNode || caretInfo.nextNode, { query: breakNodes }, 2); - if (parent === composer.element) { - parent = undefined; - } - } - - if (parent && caretInfo.caretNode) { - if (domNode(caretInfo.caretNode).is.lineBreak()) { - - if (composer.config.doubleLineBreakEscapesBlock) { - // Double enter (enter on blank line) exits block element in useLineBreaks mode. - ret = true; - caretInfo.caretNode.parentNode.removeChild(caretInfo.caretNode); - - // Ensure surplous line breaks are not added to preceding element - if (domNode(caretInfo.nextNode).is.lineBreak()) { - caretInfo.nextNode.parentNode.removeChild(caretInfo.nextNode); - } - - var brNode = composer.doc.createElement('br'); - if (domNode(caretInfo.nextNode).is.lineBreak() && caretInfo.nextNode === parent.lastChild) { - parent.parentNode.insertBefore(brNode, parent.nextSibling); - } else { - composer.selection.splitElementAtCaret(parent, brNode); - } - - // Ensure surplous blank lines are not added to preceding element - if (caretInfo.nextNode && caretInfo.nextNode.nodeType === 3) { - // Replaces blank lines at the beginning of textnode - caretInfo.nextNode.data = caretInfo.nextNode.data.replace(/^ *[\r\n]+/, ''); - } - composer.selection.setBefore(brNode); - } - - } else if (caretInfo.caretNode.nodeType === 3 && wysihtml.browser.hasCaretBlockElementIssue() && caretInfo.textOffset === caretInfo.caretNode.data.length && !caretInfo.nextNode) { - - // This fixes annoying webkit issue when you press enter at the end of a block then seemingly nothing happens. - // in reality one line break is generated and cursor is reported after it, but when entering something cursor jumps before the br - ret = true; - var br1 = composer.doc.createElement('br'), - br2 = composer.doc.createElement('br'), - f = composer.doc.createDocumentFragment(); - f.appendChild(br1); - f.appendChild(br2); - composer.selection.insertNode(f); - composer.selection.setBefore(br2); - - } - } - } - return ret; - } - }; - - var handleDeleteKeyPress = function(event, composer) { - var selection = composer.selection, - element = composer.element; - - if (selection.isCollapsed()) { - /** - * when the editor is empty in useLineBreaks = false mode, preserve - * the default value in it which is


    - */ - if (composer.isEmpty() && !composer.config.useLineBreaks) { - event.preventDefault(); - return; - } - if (actions.handleUneditableDeletion(composer)) { - event.preventDefault(); - return; - } - if (actions.fixDeleteInTheBeginningOfLi(composer)) { - event.preventDefault(); - return; - } - if (actions.fixDeleteInTheBeginningOfBlock(composer)) { - event.preventDefault(); - return; - } - if (actions.fixLastBrDeletionInTable(composer)) { - event.preventDefault(); - return; - } - if (wysihtml.browser.usesControlRanges()) { - if (actions.fixDeleteInTheBeginningOfControlSelection(composer)) { - event.preventDefault(); - return; - } - } - } else { - if (selection.containsUneditable()) { - event.preventDefault(); - selection.deleteContents(); - } - } - }; - - var handleEnterKeyPress = function(event, composer) { - if (composer.config.useLineBreaks && !event.shiftKey && !event.ctrlKey) { - // Fixes some misbehaviours of enters in linebreaks mode (natively a bit unsupported feature) - - var breakNodes = "p, pre, div, blockquote", - caretInfo, parent, txtNode; - - if (composer.selection.isCollapsed()) { - if (actions.doLineBreaksModeEnterWithCaret(composer)) { - event.preventDefault(); - } - } - } - }; - - var handleTabKeyDown = function(composer, element, shiftKey) { - if (!composer.selection.isCollapsed()) { - composer.selection.deleteContents(); - } else if (composer.selection.caretIsInTheBeginnig('li')) { - if (shiftKey) { - if (composer.commands.exec('outdentList')) return; - } else { - if (composer.commands.exec('indentList')) return; - } - } - - // Is   close enough to tab. Could not find enough counter arguments for now. - composer.commands.exec("insertHTML", " "); - }; - - var handleDomNodeRemoved = function(event) { - if (this.domNodeRemovedInterval) { - clearInterval(domNodeRemovedInterval); - } - this.parent.fire("destroy:composer"); - }; - - // Listens to "drop", "paste", "mouseup", "focus", "keyup" events and fires - var handleUserInteraction = function (event) { - this.parent.fire("beforeinteraction", event).fire("beforeinteraction:composer", event); - setTimeout((function() { - this.parent.fire("interaction", event).fire("interaction:composer", event); - }).bind(this), 0); - }; - - var handleFocus = function(event) { - this.parent.fire("focus", event).fire("focus:composer", event); - - // Delay storing of state until all focus handler are fired - // especially the one which resets the placeholder - setTimeout((function() { - this.focusState = this.getValue(false, false); - }).bind(this), 0); - }; - - var handleBlur = function(event) { - if (this.focusState !== this.getValue(false, false)) { - //create change event if supported (all except IE8) - var changeevent = event; - if(typeof Object.create == 'function') { - changeevent = Object.create(event, { type: { value: 'change' } }); - } - this.parent.fire("change", changeevent).fire("change:composer", changeevent); - } - this.parent.fire("blur", event).fire("blur:composer", event); - }; - - var handlePaste = function(event) { - this.parent.fire(event.type, event).fire(event.type + ":composer", event); - if (event.type === "paste") { - setTimeout((function() { - this.parent.fire("newword:composer"); - }).bind(this), 0); - } - }; - - var handleCopy = function(event) { - if (this.config.copyedFromMarking) { - // If supported the copied source can be based directly on selection - // Very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection. - if (wysihtml.browser.supportsModernPaste()) { - event.clipboardData.setData("text/html", this.config.copyedFromMarking + this.selection.getHtml()); - event.clipboardData.setData("text/plain", this.selection.getPlainText()); - event.preventDefault(); - } - this.parent.fire(event.type, event).fire(event.type + ":composer", event); - } - }; - - var handleKeyUp = function(event) { - var keyCode = event.keyCode; - if (keyCode === wysihtml.SPACE_KEY || keyCode === wysihtml.ENTER_KEY) { - this.parent.fire("newword:composer"); - } - }; - - var handleMouseDown = function(event) { - if (!browser.canSelectImagesInContentEditable()) { - // Make sure that images are selected when clicking on them - var target = event.target, - allImages = this.element.querySelectorAll('img'), - notMyImages = this.element.querySelectorAll('.' + this.config.classNames.uneditableContainer + ' img'), - myImages = wysihtml.lang.array(allImages).without(notMyImages); - - if (target.nodeName === "IMG" && wysihtml.lang.array(myImages).contains(target)) { - this.selection.selectNode(target); - } - } - - // Saves mousedown position for IE controlSelect fix - if (wysihtml.browser.usesControlRanges()) { - this.selection.lastMouseDownPos = {x: event.clientX, y: event.clientY}; - setTimeout(function() { - delete this.selection.lastMouseDownPos; - }.bind(this), 0); - } - }; - - // IE has this madness of control selects of overflowed and some other elements (weird box around element on selection and second click selects text) - // This fix handles the second click problem by adding cursor to the right position under cursor inside when controlSelection is made - var handleIEControlSelect = function(event) { - var target = event.target, - pos = this.selection.lastMouseDownPos; - if (pos) { - var caretPosition = document.body.createTextRange(); - setTimeout(function() { - try { - caretPosition.moveToPoint(pos.x, pos.y); - caretPosition.select(); - } catch (e) {} - }.bind(this), 0); - } - }; - - var handleClick = function(event) { - if (this.config.classNames.uneditableContainer) { - // If uneditables is configured, makes clicking on uneditable move caret after clicked element (so it can be deleted like text) - // If uneditable needs text selection itself event.stopPropagation can be used to prevent this behaviour - var uneditable = wysihtml.dom.getParentElement(event.target, { query: "." + this.config.classNames.uneditableContainer }, false, this.element); - if (uneditable) { - this.selection.setAfter(uneditable); - } - } - }; - - var handleDrop = function(event) { - if (!browser.canSelectImagesInContentEditable()) { - // TODO: if I knew how to get dropped elements list from event I could limit it to only IMG element case - setTimeout((function() { - this.selection.getSelection().removeAllRanges(); - }).bind(this), 0); - } - }; - - var handleKeyDown = function(event) { - var keyCode = event.keyCode, - command = shortcuts[keyCode], - target, parent; - - // Select all (meta/ctrl + a) - if ((event.ctrlKey || event.metaKey) && !event.altKey && keyCode === 65) { - this.selection.selectAll(); - event.preventDefault(); - return; - } - - // Shortcut logic - if ((event.ctrlKey || event.metaKey) && !event.altKey && command) { - this.commands.exec(command); - event.preventDefault(); - } - - if (keyCode === wysihtml.BACKSPACE_KEY) { - // Delete key override for special cases - handleDeleteKeyPress(event, this); - } - - // Make sure that when pressing backspace/delete on selected images deletes the image and it's anchor - if (keyCode === wysihtml.BACKSPACE_KEY || keyCode === wysihtml.DELETE_KEY) { - target = this.selection.getSelectedNode(true); - if (target && target.nodeName === "IMG") { - event.preventDefault(); - parent = target.parentNode; - parent.removeChild(target);// delete the - // And it's parent too if it hasn't got any other child nodes - if (parent.nodeName === "A" && !parent.firstChild) { - parent.parentNode.removeChild(parent); - } - setTimeout((function() { - wysihtml.quirks.redraw(this.element); - }).bind(this), 0); - } - } - - if (this.config.handleTabKey && keyCode === wysihtml.TAB_KEY) { - // TAB key handling - event.preventDefault(); - handleTabKeyDown(this, this.element, event.shiftKey); - } - - if (keyCode === wysihtml.ENTER_KEY) { - handleEnterKeyPress(event, this); - } - - }; - - var handleIframeFocus = function(event) { - setTimeout((function() { - if (this.doc.querySelector(":focus") !== this.element) { - this.focus(); - } - }).bind(this), 0); - }; - - var handleIframeBlur = function(event) { - setTimeout((function() { - this.selection.getSelection().removeAllRanges(); - }).bind(this), 0); - }; - - // Testing requires actions to be accessible from out of scope - wysihtml.views.Composer.prototype.observeActions = actions; - - wysihtml.views.Composer.prototype.observe = function() { - var that = this, - container = (this.sandbox.getIframe) ? this.sandbox.getIframe() : this.sandbox.getContentEditable(), - element = this.element, - focusBlurElement = (browser.supportsEventsInIframeCorrectly() || this.sandbox.getContentEditable) ? this.element : this.sandbox.getWindow(); - - this.focusState = this.getValue(false, false); - - // --------- destroy:composer event --------- - container.addEventListener(["DOMNodeRemoved"], handleDomNodeRemoved.bind(this), false); - - // DOMNodeRemoved event is not supported in IE 8 - // TODO: try to figure out a polyfill style fix, so it could be transferred to polyfills and removed if ie8 is not needed - if (!browser.supportsMutationEvents()) { - this.domNodeRemovedInterval = setInterval(function() { - if (!dom.contains(document.documentElement, container)) { - handleDomNodeRemoved.call(this); - } - }, 250); - } - - // --------- User interactions -- - if (this.config.handleTables) { - // If handleTables option is true, table handling functions are bound - actions.initTableHandling.call(this); - } - - actions.addListeners(focusBlurElement, ["drop", "paste", "mouseup", "focus", "keyup"], handleUserInteraction.bind(this)); - focusBlurElement.addEventListener("focus", handleFocus.bind(this), false); - focusBlurElement.addEventListener("blur", handleBlur.bind(this), false); - - actions.addListeners(this.element, ["drop", "paste", "beforepaste"], handlePaste.bind(this), false); - this.element.addEventListener("copy", handleCopy.bind(this), false); - this.element.addEventListener("mousedown", handleMouseDown.bind(this), false); - this.element.addEventListener("click", handleClick.bind(this), false); - this.element.addEventListener("drop", handleDrop.bind(this), false); - this.element.addEventListener("keyup", handleKeyUp.bind(this), false); - this.element.addEventListener("keydown", handleKeyDown.bind(this), false); - - // IE controlselect madness fix - if (wysihtml.browser.usesControlRanges()) { - this.element.addEventListener('mscontrolselect', handleIEControlSelect.bind(this), false); - } - - this.element.addEventListener("dragenter", (function() { - this.parent.fire("unset_placeholder"); - }).bind(this), false); - - }; -})(wysihtml); -;/** - * Class that takes care that the value of the composer and the textarea is always in sync - */ -(function(wysihtml) { - var INTERVAL = 400; - - wysihtml.views.Synchronizer = Base.extend( - /** @scope wysihtml.views.Synchronizer.prototype */ { - - constructor: function(editor, textarea, composer) { - this.editor = editor; - this.textarea = textarea; - this.composer = composer; - - this._observe(); - }, - - /** - * Sync html from composer to textarea - * Takes care of placeholders - * @param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the textarea - */ - fromComposerToTextarea: function(shouldParseHtml) { - this.textarea.setValue(wysihtml.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml); - }, - - /** - * Sync value of textarea to composer - * Takes care of placeholders - * @param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the composer - */ - fromTextareaToComposer: function(shouldParseHtml) { - var textareaValue = this.textarea.getValue(false, false); - if (textareaValue) { - this.composer.setValue(textareaValue, shouldParseHtml); - } else { - this.composer.clear(); - this.editor.fire("set_placeholder"); - } - }, - - /** - * Invoke syncing based on view state - * @param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the composer/textarea - */ - sync: function(shouldParseHtml) { - if (this.editor.currentView.name === "textarea") { - this.fromTextareaToComposer(shouldParseHtml); - } else { - this.fromComposerToTextarea(shouldParseHtml); - } - }, - - /** - * Initializes interval-based syncing - * also makes sure that on-submit the composer's content is synced with the textarea - * immediately when the form gets submitted - */ - _observe: function() { - var interval, - that = this, - form = this.textarea.element.form, - startInterval = function() { - interval = setInterval(function() { that.fromComposerToTextarea(); }, INTERVAL); - }, - stopInterval = function() { - clearInterval(interval); - interval = null; - }; - - startInterval(); - - if (form) { - // If the textarea is in a form make sure that after onreset and onsubmit the composer - // has the correct state - wysihtml.dom.observe(form, "submit", function() { - that.sync(true); - }); - wysihtml.dom.observe(form, "reset", function() { - setTimeout(function() { that.fromTextareaToComposer(); }, 0); - }); - } - - this.editor.on("change_view", function(view) { - if (view === "composer" && !interval) { - that.fromTextareaToComposer(true); - startInterval(); - } else if (view === "textarea") { - that.fromComposerToTextarea(true); - stopInterval(); - } - }); - - this.editor.on("destroy:composer", stopInterval); - } - }); -})(wysihtml); -;(function(wysihtml) { - - wysihtml.views.SourceView = Base.extend( - /** @scope wysihtml.views.SourceView.prototype */ { - - constructor: function(editor, composer) { - this.editor = editor; - this.composer = composer; - - this._observe(); - }, - - switchToTextarea: function(shouldParseHtml) { - var composerStyles = this.composer.win.getComputedStyle(this.composer.element), - width = parseFloat(composerStyles.width), - height = Math.max(parseFloat(composerStyles.height), 100); - - if (!this.textarea) { - this.textarea = this.composer.doc.createElement('textarea'); - this.textarea.className = "wysihtml5-source-view"; - } - this.textarea.style.width = width + 'px'; - this.textarea.style.height = height + 'px'; - this.textarea.value = this.editor.getValue(shouldParseHtml, true); - this.composer.element.parentNode.insertBefore(this.textarea, this.composer.element); - this.editor.currentView = "source"; - this.composer.element.style.display = 'none'; - }, - - switchToComposer: function(shouldParseHtml) { - var textareaValue = this.textarea.value; - if (textareaValue) { - this.composer.setValue(textareaValue, shouldParseHtml); - } else { - this.composer.clear(); - this.editor.fire("set_placeholder"); - } - this.textarea.parentNode.removeChild(this.textarea); - this.editor.currentView = this.composer; - this.composer.element.style.display = ''; - }, - - _observe: function() { - this.editor.on("change_view", function(view) { - if (view === "composer") { - this.switchToComposer(true); - } else if (view === "textarea") { - this.switchToTextarea(true); - } - }.bind(this)); - } - - }); - -})(wysihtml); -;wysihtml.views.Textarea = wysihtml.views.View.extend( - /** @scope wysihtml.views.Textarea.prototype */ { - name: "textarea", - - constructor: function(parent, textareaElement, config) { - this.base(parent, textareaElement, config); - - this._observe(); - }, - - clear: function() { - this.element.value = ""; - }, - - getValue: function(parse) { - var value = this.isEmpty() ? "" : this.element.value; - if (parse !== false) { - value = this.parent.parse(value); - } - return value; - }, - - setValue: function(html, parse) { - if (parse !== false) { - html = this.parent.parse(html); - } - this.element.value = html; - }, - - cleanUp: function(rules) { - var html = this.parent.parse(this.element.value, undefined, rules); - this.element.value = html; - }, - - hasPlaceholderSet: function() { - var supportsPlaceholder = wysihtml.browser.supportsPlaceholderAttributeOn(this.element), - placeholderText = this.element.getAttribute("placeholder") || null, - value = this.element.value, - isEmpty = !value; - return (supportsPlaceholder && isEmpty) || (value === placeholderText); - }, - - isEmpty: function() { - return !wysihtml.lang.string(this.element.value).trim() || this.hasPlaceholderSet(); - }, - - _observe: function() { - var element = this.element, - parent = this.parent, - eventMapping = { - focusin: "focus", - focusout: "blur" - }, - /** - * Calling focus() or blur() on an element doesn't synchronously trigger the attached focus/blur events - * This is the case for focusin and focusout, so let's use them whenever possible, kkthxbai - */ - events = wysihtml.browser.supportsEvent("focusin") ? ["focusin", "focusout", "change"] : ["focus", "blur", "change"]; - - parent.on("beforeload", function() { - wysihtml.dom.observe(element, events, function(event) { - var eventName = eventMapping[event.type] || event.type; - parent.fire(eventName).fire(eventName + ":textarea"); - }); - - wysihtml.dom.observe(element, ["paste", "drop"], function() { - setTimeout(function() { parent.fire("paste").fire("paste:textarea"); }, 0); - }); - }); - } -}); -;/** - * WYSIHTML5 Editor - * - * @param {Element} editableElement Reference to the textarea which should be turned into a rich text interface - * @param {Object} [config] See defaultConfig object below for explanation of each individual config option - * - * @events - * load - * beforeload (for internal use only) - * focus - * focus:composer - * focus:textarea - * blur - * blur:composer - * blur:textarea - * change - * change:composer - * change:textarea - * paste - * paste:composer - * paste:textarea - * newword:composer - * destroy:composer - * undo:composer - * redo:composer - * beforecommand:composer - * aftercommand:composer - * enable:composer - * disable:composer - * change_view - */ -(function(wysihtml) { - var undef; - - var defaultConfig = { - // Give the editor a name, the name will also be set as class name on the iframe and on the iframe's body - name: undef, - // Whether the editor should look like the textarea (by adopting styles) - style: true, - // Id of the toolbar element, pass falsey value if you don't want any toolbar logic - toolbar: undef, - // Whether toolbar is displayed after init by script automatically. - // Can be set to false if toolobar is set to display only on editable area focus - showToolbarAfterInit: true, - // With default toolbar it shows dialogs in toolbar when their related text format state becomes active (click on link in text opens link dialogue) - showToolbarDialogsOnSelection: true, - // Whether urls, entered by the user should automatically become clickable-links - autoLink: true, - // Includes table editing events and cell selection tracking - handleTables: true, - // Tab key inserts tab into text as default behaviour. It can be disabled to regain keyboard navigation - handleTabKey: true, - // Object which includes parser rules to apply when html gets cleaned - // See parser_rules/*.js for examples - parserRules: { tags: { br: {}, span: {}, div: {}, p: {}, b: {}, i: {}, u: {} }, classes: {} }, - // Object which includes parser when the user inserts content via copy & paste. If null parserRules will be used instead - pasteParserRulesets: null, - // Parser method to use when the user inserts content - parser: wysihtml.dom.parse, - // By default wysihtml5 will insert a
    for line breaks, set this to false to use

    - useLineBreaks: true, - // Double enter (enter on blank line) exits block element in useLineBreaks mode. - // It enables a way of escaping out of block elements and splitting block elements - doubleLineBreakEscapesBlock: true, - // Array (or single string) of stylesheet urls to be loaded in the editor's iframe - stylesheets: [], - // Placeholder text to use, defaults to the placeholder attribute on the textarea element - placeholderText: undef, - // Whether the rich text editor should be rendered on touch devices (wysihtml5 >= 0.3.0 comes with basic support for iOS 5) - supportTouchDevices: true, - // Whether senseless elements (empty or without attributes) should be removed/replaced with their content - cleanUp: true, - // Whether to use div instead of secure iframe - contentEditableMode: false, - classNames: { - // Class name which should be set on the contentEditable element in the created sandbox iframe, can be styled via the 'stylesheets' option - composer: "wysihtml5-editor", - // Class name to add to the body when the wysihtml5 editor is supported - body: "wysihtml5-supported", - // classname added to editable area element (iframe/div) on creation - sandbox: "wysihtml5-sandbox", - // class on editable area with placeholder - placeholder: "wysihtml5-placeholder", - // Classname of container that editor should not touch and pass through - uneditableContainer: "wysihtml5-uneditable-container" - }, - // Browsers that support copied source handling will get a marking of the origin of the copied source (for determinig code cleanup rules on paste) - // Also copied source is based directly on selection - - // (very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection). - // If falsy value is passed source override is also disabled - copyedFromMarking: '' - }; - - wysihtml.Editor = wysihtml.lang.Dispatcher.extend( - /** @scope wysihtml.Editor.prototype */ { - constructor: function(editableElement, config) { - this.editableElement = typeof(editableElement) === "string" ? document.getElementById(editableElement) : editableElement; - this.config = wysihtml.lang.object({}).merge(defaultConfig).merge(config).get(); - this._isCompatible = wysihtml.browser.supported(); - - // merge classNames - if (config && config.classNames) { - wysihtml.lang.object(this.config.classNames).merge(config.classNames); - } - - if (this.editableElement.nodeName.toLowerCase() != "textarea") { - this.config.contentEditableMode = true; - this.config.noTextarea = true; - } - if (!this.config.noTextarea) { - this.textarea = new wysihtml.views.Textarea(this, this.editableElement, this.config); - this.currentView = this.textarea; - } - - // Sort out unsupported/unwanted browsers here - if (!this._isCompatible || (!this.config.supportTouchDevices && wysihtml.browser.isTouchDevice())) { - var that = this; - setTimeout(function() { that.fire("beforeload").fire("load"); }, 0); - return; - } - - // Add class name to body, to indicate that the editor is supported - wysihtml.dom.addClass(document.body, this.config.classNames.body); - - this.composer = new wysihtml.views.Composer(this, this.editableElement, this.config); - this.currentView = this.composer; - - if (typeof(this.config.parser) === "function") { - this._initParser(); - } - - this.on("beforeload", this.handleBeforeLoad); - }, - - handleBeforeLoad: function() { - if (!this.config.noTextarea) { - this.synchronizer = new wysihtml.views.Synchronizer(this, this.textarea, this.composer); - } else { - this.sourceView = new wysihtml.views.SourceView(this, this.composer); - } - if (this.config.toolbar) { - if (typeof wysihtml.toolbar === "undefined") { - throw Error("Toolbar not found. Make sure you're loading wysihtml-toolbar.js or wysihtml-toolbar.min.js"); - } - this.toolbar = new wysihtml.toolbar.Toolbar(this, this.config.toolbar, this.config.showToolbarAfterInit); - } - }, - - isCompatible: function() { - return this._isCompatible; - }, - - clear: function() { - this.currentView.clear(); - return this; - }, - - getValue: function(parse, clearInternals) { - return this.currentView.getValue(parse, clearInternals); - }, - - setValue: function(html, parse) { - this.fire("unset_placeholder"); - - if (!html) { - return this.clear(); - } - - this.currentView.setValue(html, parse); - return this; - }, - - cleanUp: function(rules) { - this.currentView.cleanUp(rules); - }, - - focus: function(setToEnd) { - this.currentView.focus(setToEnd); - return this; - }, - - /** - * Deactivate editor (make it readonly) - */ - disable: function() { - this.currentView.disable(); - return this; - }, - - /** - * Activate editor - */ - enable: function() { - this.currentView.enable(); - return this; - }, - - isEmpty: function() { - return this.currentView.isEmpty(); - }, - - hasPlaceholderSet: function() { - return this.currentView.hasPlaceholderSet(); - }, - - destroy: function() { - if (this.composer && this.composer.sandbox) { - this.composer.sandbox.destroy(); - } - if (this.toolbar) { - this.toolbar.destroy(); - } - this.off(); - }, - - parse: function(htmlOrElement, clearInternals, customRules) { - var parseContext = (this.config.contentEditableMode) ? document : ((this.composer) ? this.composer.sandbox.getDocument() : null); - var returnValue = this.config.parser(htmlOrElement, { - "rules": customRules || this.config.parserRules, - "cleanUp": this.config.cleanUp, - "context": parseContext, - "uneditableClass": this.config.classNames.uneditableContainer, - "clearInternals" : clearInternals - }); - if (typeof(htmlOrElement) === "object") { - wysihtml.quirks.redraw(htmlOrElement); - } - return returnValue; - }, - - /** - * Prepare html parser logic - * - Observes for paste and drop - */ - _initParser: function() { - var oldHtml; - - if (wysihtml.browser.supportsModernPaste()) { - this.on("paste:composer", function(event) { - event.preventDefault(); - oldHtml = wysihtml.dom.getPastedHtml(event); - if (oldHtml) { - this._cleanAndPaste(oldHtml); - } - }.bind(this)); - - } else { - this.on("beforepaste:composer", function(event) { - event.preventDefault(); - var scrollPos = this.composer.getScrollPos(); - - wysihtml.dom.getPastedHtmlWithDiv(this.composer, function(pastedHTML) { - if (pastedHTML) { - this._cleanAndPaste(pastedHTML); - } - this.composer.setScrollPos(scrollPos); - }.bind(this)); - - }.bind(this)); - } - }, - - _cleanAndPaste: function (oldHtml) { - var cleanHtml = wysihtml.quirks.cleanPastedHTML(oldHtml, { - "referenceNode": this.composer.element, - "rules": this.config.pasteParserRulesets || [{"set": this.config.parserRules}], - "uneditableClass": this.config.classNames.uneditableContainer - }); - this.composer.selection.deleteContents(); - this.composer.selection.insertHTML(cleanHtml); - } - }); -})(wysihtml); -;/** - * Toolbar Dialog - * - * @param {Element} link The toolbar link which causes the dialog to show up - * @param {Element} container The dialog container - * - * @example - * - * insert an image - * - * - *

    - * - * - *
    - * - * - */ -(function(wysihtml) { - var dom = wysihtml.dom, - CLASS_NAME_OPENED = "wysihtml5-command-dialog-opened", - SELECTOR_FORM_ELEMENTS = "input, select, textarea", - SELECTOR_FIELDS = "[data-wysihtml5-dialog-field]", - ATTRIBUTE_FIELDS = "data-wysihtml5-dialog-field"; - - - wysihtml.toolbar.Dialog = wysihtml.lang.Dispatcher.extend( - /** @scope wysihtml.toolbar.Dialog.prototype */ { - constructor: function(link, container) { - this.link = link; - this.container = container; - }, - - _observe: function() { - if (this._observed) { - return; - } - - var that = this, - callbackWrapper = function(event) { - var attributes = that._serialize(); - that.fire("save", attributes); - that.hide(); - event.preventDefault(); - event.stopPropagation(); - }; - - dom.observe(that.link, "click", function() { - if (dom.hasClass(that.link, CLASS_NAME_OPENED)) { - setTimeout(function() { that.hide(); }, 0); - } - }); - - dom.observe(this.container, "keydown", function(event) { - var keyCode = event.keyCode; - if (keyCode === wysihtml.ENTER_KEY) { - callbackWrapper(event); - } - if (keyCode === wysihtml.ESCAPE_KEY) { - that.cancel(); - } - }); - - dom.delegate(this.container, "[data-wysihtml5-dialog-action=save]", "click", callbackWrapper); - - dom.delegate(this.container, "[data-wysihtml5-dialog-action=cancel]", "click", function(event) { - that.cancel(); - event.preventDefault(); - event.stopPropagation(); - }); - - this._observed = true; - }, - - /** - * Grabs all fields in the dialog and puts them in key=>value style in an object which - * then gets returned - */ - _serialize: function() { - var data = {}, - fields = this.container.querySelectorAll(SELECTOR_FIELDS), - length = fields.length, - i = 0; - - for (; ifoo - * - * and we have the following dialog: - * - * - * - * after calling _interpolate() the dialog will look like this - * - * - * - * Basically it adopted the attribute values into the corresponding input fields - * - */ - _interpolate: function(avoidHiddenFields) { - var field, - fieldName, - newValue, - focusedElement = document.querySelector(":focus"), - fields = this.container.querySelectorAll(SELECTOR_FIELDS), - length = fields.length, - i = 0; - for (; i