wysiwyg-rails 4.0.8 → 4.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/froala_editor.min.js +3 -3
  3. data/app/assets/javascripts/froala_editor.pkgd.min.js +3 -3
  4. data/app/assets/javascripts/languages/ar.js +2 -2
  5. data/app/assets/javascripts/languages/bs.js +2 -2
  6. data/app/assets/javascripts/languages/cs.js +2 -2
  7. data/app/assets/javascripts/languages/da.js +2 -2
  8. data/app/assets/javascripts/languages/de.js +2 -2
  9. data/app/assets/javascripts/languages/el.js +2 -2
  10. data/app/assets/javascripts/languages/en_ca.js +2 -2
  11. data/app/assets/javascripts/languages/en_gb.js +2 -2
  12. data/app/assets/javascripts/languages/es.js +2 -2
  13. data/app/assets/javascripts/languages/et.js +2 -2
  14. data/app/assets/javascripts/languages/fa.js +2 -2
  15. data/app/assets/javascripts/languages/fi.js +2 -2
  16. data/app/assets/javascripts/languages/fr.js +2 -2
  17. data/app/assets/javascripts/languages/he.js +2 -2
  18. data/app/assets/javascripts/languages/hr.js +2 -2
  19. data/app/assets/javascripts/languages/hu.js +2 -2
  20. data/app/assets/javascripts/languages/id.js +2 -2
  21. data/app/assets/javascripts/languages/it.js +2 -2
  22. data/app/assets/javascripts/languages/ja.js +2 -2
  23. data/app/assets/javascripts/languages/ko.js +2 -2
  24. data/app/assets/javascripts/languages/ku.js +2 -2
  25. data/app/assets/javascripts/languages/me.js +2 -2
  26. data/app/assets/javascripts/languages/nb.js +2 -2
  27. data/app/assets/javascripts/languages/nl.js +2 -2
  28. data/app/assets/javascripts/languages/pl.js +2 -2
  29. data/app/assets/javascripts/languages/pt_br.js +2 -2
  30. data/app/assets/javascripts/languages/pt_pt.js +2 -2
  31. data/app/assets/javascripts/languages/ro.js +2 -2
  32. data/app/assets/javascripts/languages/ru.js +2 -2
  33. data/app/assets/javascripts/languages/sk.js +2 -2
  34. data/app/assets/javascripts/languages/sl.js +2 -2
  35. data/app/assets/javascripts/languages/sr.js +2 -2
  36. data/app/assets/javascripts/languages/sv.js +2 -2
  37. data/app/assets/javascripts/languages/th.js +2 -2
  38. data/app/assets/javascripts/languages/tr.js +2 -2
  39. data/app/assets/javascripts/languages/uk.js +2 -2
  40. data/app/assets/javascripts/languages/vi.js +2 -2
  41. data/app/assets/javascripts/languages/zh_cn.js +2 -2
  42. data/app/assets/javascripts/languages/zh_tw.js +2 -2
  43. data/app/assets/javascripts/plugins/align.min.js +2 -2
  44. data/app/assets/javascripts/plugins/char_counter.min.js +2 -2
  45. data/app/assets/javascripts/plugins/code_beautifier.min.js +2 -2
  46. data/app/assets/javascripts/plugins/code_view.min.js +2 -2
  47. data/app/assets/javascripts/plugins/colors.min.js +2 -2
  48. data/app/assets/javascripts/plugins/cryptojs.min.js +2 -2
  49. data/app/assets/javascripts/plugins/draggable.min.js +2 -2
  50. data/app/assets/javascripts/plugins/edit_in_popup.min.js +2 -2
  51. data/app/assets/javascripts/plugins/emoticons.min.js +2 -2
  52. data/app/assets/javascripts/plugins/entities.min.js +2 -2
  53. data/app/assets/javascripts/plugins/file.min.js +2 -2
  54. data/app/assets/javascripts/plugins/files_manager.min.js +3 -3
  55. data/app/assets/javascripts/plugins/font_family.min.js +2 -2
  56. data/app/assets/javascripts/plugins/font_size.min.js +2 -2
  57. data/app/assets/javascripts/plugins/forms.min.js +2 -2
  58. data/app/assets/javascripts/plugins/fullscreen.min.js +2 -2
  59. data/app/assets/javascripts/plugins/help.min.js +2 -2
  60. data/app/assets/javascripts/plugins/image.min.js +3 -3
  61. data/app/assets/javascripts/plugins/image_manager.min.js +2 -2
  62. data/app/assets/javascripts/plugins/inline_class.min.js +2 -2
  63. data/app/assets/javascripts/plugins/inline_style.min.js +2 -2
  64. data/app/assets/javascripts/plugins/line_breaker.min.js +2 -2
  65. data/app/assets/javascripts/plugins/line_height.min.js +3 -3
  66. data/app/assets/javascripts/plugins/link.min.js +3 -3
  67. data/app/assets/javascripts/plugins/lists.min.js +2 -2
  68. data/app/assets/javascripts/plugins/markdown.min.js +3 -3
  69. data/app/assets/javascripts/plugins/paragraph_format.min.js +2 -2
  70. data/app/assets/javascripts/plugins/paragraph_style.min.js +2 -2
  71. data/app/assets/javascripts/plugins/print.min.js +2 -2
  72. data/app/assets/javascripts/plugins/quick_insert.min.js +2 -2
  73. data/app/assets/javascripts/plugins/quote.min.js +3 -3
  74. data/app/assets/javascripts/plugins/save.min.js +2 -2
  75. data/app/assets/javascripts/plugins/special_characters.min.js +2 -2
  76. data/app/assets/javascripts/plugins/table.min.js +3 -3
  77. data/app/assets/javascripts/plugins/track_changes.min.js +3 -3
  78. data/app/assets/javascripts/plugins/trim_video.min.js +2 -2
  79. data/app/assets/javascripts/plugins/url.min.js +2 -2
  80. data/app/assets/javascripts/plugins/video.min.js +3 -3
  81. data/app/assets/javascripts/plugins/word_paste.min.js +3 -3
  82. data/app/assets/javascripts/plugins.pkgd.min.js +3 -3
  83. data/app/assets/javascripts/third_party/embedly.min.js +2 -2
  84. data/app/assets/javascripts/third_party/font_awesome.min.js +2 -2
  85. data/app/assets/javascripts/third_party/image_tui.min.js +2 -2
  86. data/app/assets/javascripts/third_party/showdown.min.js +3 -3
  87. data/app/assets/javascripts/third_party/spell_checker.min.js +2 -2
  88. data/app/assets/stylesheets/froala_editor.css +10 -6
  89. data/app/assets/stylesheets/froala_editor.min.css +3 -3
  90. data/app/assets/stylesheets/froala_editor.pkgd.css +12 -13
  91. data/app/assets/stylesheets/froala_editor.pkgd.min.css +3 -3
  92. data/app/assets/stylesheets/froala_style.css +4 -2
  93. data/app/assets/stylesheets/froala_style.min.css +3 -3
  94. data/app/assets/stylesheets/plugins/char_counter.css +2 -2
  95. data/app/assets/stylesheets/plugins/char_counter.min.css +2 -2
  96. data/app/assets/stylesheets/plugins/code_view.css +2 -2
  97. data/app/assets/stylesheets/plugins/code_view.min.css +2 -2
  98. data/app/assets/stylesheets/plugins/colors.css +2 -2
  99. data/app/assets/stylesheets/plugins/colors.min.css +2 -2
  100. data/app/assets/stylesheets/plugins/draggable.css +2 -2
  101. data/app/assets/stylesheets/plugins/draggable.min.css +2 -2
  102. data/app/assets/stylesheets/plugins/emoticons.css +2 -2
  103. data/app/assets/stylesheets/plugins/emoticons.min.css +2 -2
  104. data/app/assets/stylesheets/plugins/file.css +2 -2
  105. data/app/assets/stylesheets/plugins/file.min.css +2 -2
  106. data/app/assets/stylesheets/plugins/files_manager.css +2 -2
  107. data/app/assets/stylesheets/plugins/files_manager.min.css +2 -2
  108. data/app/assets/stylesheets/plugins/fullscreen.css +2 -2
  109. data/app/assets/stylesheets/plugins/fullscreen.min.css +2 -2
  110. data/app/assets/stylesheets/plugins/help.css +2 -2
  111. data/app/assets/stylesheets/plugins/help.min.css +2 -2
  112. data/app/assets/stylesheets/plugins/image.css +2 -2
  113. data/app/assets/stylesheets/plugins/image.min.css +2 -2
  114. data/app/assets/stylesheets/plugins/image_manager.css +2 -2
  115. data/app/assets/stylesheets/plugins/image_manager.min.css +2 -2
  116. data/app/assets/stylesheets/plugins/line_breaker.css +2 -2
  117. data/app/assets/stylesheets/plugins/line_breaker.min.css +2 -2
  118. data/app/assets/stylesheets/plugins/markdown.css +2 -2
  119. data/app/assets/stylesheets/plugins/markdown.min.css +2 -2
  120. data/app/assets/stylesheets/plugins/quick_insert.css +2 -2
  121. data/app/assets/stylesheets/plugins/quick_insert.min.css +2 -2
  122. data/app/assets/stylesheets/plugins/special_characters.css +2 -2
  123. data/app/assets/stylesheets/plugins/special_characters.min.css +2 -2
  124. data/app/assets/stylesheets/plugins/table.css +2 -9
  125. data/app/assets/stylesheets/plugins/table.min.css +3 -3
  126. data/app/assets/stylesheets/plugins/trim_video.css +2 -2
  127. data/app/assets/stylesheets/plugins/trim_video.min.css +2 -2
  128. data/app/assets/stylesheets/plugins/video.css +2 -2
  129. data/app/assets/stylesheets/plugins/video.min.css +2 -2
  130. data/app/assets/stylesheets/plugins.pkgd.css +2 -9
  131. data/app/assets/stylesheets/plugins.pkgd.min.css +3 -3
  132. data/app/assets/stylesheets/themes/dark.css +4 -14
  133. data/app/assets/stylesheets/themes/dark.min.css +3 -3
  134. data/app/assets/stylesheets/themes/gray.css +4 -14
  135. data/app/assets/stylesheets/themes/gray.min.css +3 -3
  136. data/app/assets/stylesheets/themes/royal.css +4 -14
  137. data/app/assets/stylesheets/themes/royal.min.css +3 -3
  138. data/app/assets/stylesheets/third_party/embedly.css +2 -2
  139. data/app/assets/stylesheets/third_party/embedly.min.css +2 -2
  140. data/app/assets/stylesheets/third_party/font_awesome.css +2 -2
  141. data/app/assets/stylesheets/third_party/font_awesome.min.css +2 -2
  142. data/app/assets/stylesheets/third_party/image_tui.css +2 -2
  143. data/app/assets/stylesheets/third_party/image_tui.min.css +2 -2
  144. data/app/assets/stylesheets/third_party/spell_checker.css +2 -2
  145. data/app/assets/stylesheets/third_party/spell_checker.min.css +2 -2
  146. data/lib/wysiwyg-rails/version.rb +1 -1
  147. metadata +2 -2
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * froala_editor v4.0.8 (https://www.froala.com/wysiwyg-editor)
2
+ * froala_editor v4.0.11 (https://www.froala.com/wysiwyg-editor)
3
3
  * License https://froala.com/wysiwyg-editor/terms/
4
- * Copyright 2014-2021 Froala Labs
4
+ * Copyright 2014-2022 Froala Labs
5
5
  */
6
6
 
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(y){"use strict";y=y&&y.hasOwnProperty("default")?y["default"]:y,Object.assign(y.POPUP_TEMPLATES,{"link.edit":"[_BUTTONS_]","link.insert":"[_BUTTONS_][_INPUT_LAYER_]"}),Object.assign(y.DEFAULTS,{linkEditButtons:["linkOpen","linkStyle","linkEdit","linkRemove"],linkInsertButtons:["linkBack","|","linkList"],linkAttributes:{},linkAutoPrefix:"http://",linkStyles:{"fr-green":"Green","fr-strong":"Thick"},linkMultipleStyles:!0,linkConvertEmailAddress:!0,linkAlwaysBlank:!1,linkAlwaysNoFollow:!1,linkNoOpener:!0,linkNoReferrer:!0,linkList:[{text:"Froala",href:"https://froala.com",target:"_blank"},{text:"Google",href:"https://google.com",target:"_blank"},{displayText:"Facebook",href:"https://facebook.com"}],linkText:!0}),y.PLUGINS.link=function(h){var m=h.$;function v(){var e=h.image?h.image.get():null;if(e||!h.$wp)return"A"==h.el.tagName?h.el:e&&e.get(0).parentNode&&"A"==e.get(0).parentNode.tagName?e.get(0).parentNode:void 0;var t=h.selection.ranges(0).commonAncestorContainer;try{t&&(t.contains&&t.contains(h.el)||!h.el.contains(t)||h.el==t)&&(t=null)}catch(r){t=null}if(t&&"A"===t.tagName)return t;var n=h.selection.element(),i=h.selection.endElement();"A"==n.tagName||h.node.isElement(n)||(n=m(n).parentsUntil(h.$el,"a").first().get(0)),"A"==i.tagName||h.node.isElement(i)||(i=m(i).parentsUntil(h.$el,"a").first().get(0));try{i&&(i.contains&&i.contains(h.el)||!h.el.contains(i)||h.el==i)&&(i=null)}catch(r){i=null}try{n&&(n.contains&&n.contains(h.el)||!h.el.contains(n)||h.el==n)&&(n=null)}catch(r){n=null}return i&&i==n&&"A"==i.tagName?(h.browser.msie||h.helpers.isMobile())&&(h.selection.info(n).atEnd||h.selection.info(n).atStart)?null:n:null}function b(){var e,t,n,i,r=h.image?h.image.get():null,a=[];if(r)"A"==r.get(0).parentNode.tagName&&a.push(r.get(0).parentNode);else if(h.win.getSelection){var l=h.win.getSelection();if(l.getRangeAt&&l.rangeCount){i=h.doc.createRange();for(var s=0;s<l.rangeCount;++s)if((t=(e=l.getRangeAt(s)).commonAncestorContainer)&&1!=t.nodeType&&(t=t.parentNode),t&&"a"==t.nodeName.toLowerCase())a.push(t);else{n=t.getElementsByTagName("a");for(var o=0;o<n.length;++o)i.selectNodeContents(n[o]),i.compareBoundaryPoints(e.END_TO_START,e)<1&&-1<i.compareBoundaryPoints(e.START_TO_END,e)&&a.push(n[o])}}}else if(h.doc.selection&&"Control"!=h.doc.selection.type)if("a"==(t=(e=h.doc.selection.createRange()).parentElement()).nodeName.toLowerCase())a.push(t);else{n=t.getElementsByTagName("a"),i=h.doc.body.createTextRange();for(var p=0;p<n.length;++p)i.moveToElementText(n[p]),-1<i.compareEndPoints("StartToEnd",e)&&i.compareEndPoints("EndToStart",e)<1&&a.push(n[p])}return a}function E(r){if(h.core.hasFocus()){if(a(),r&&"keyup"===r.type&&(r.altKey||r.which==y.KEYCODE.ALT))return!0;setTimeout(function(){if(!r||r&&(1==r.which||"mouseup"!=r.type)){var e=v(),t=h.image?h.image.get():null;if(e&&!t){if(h.image){var n=h.node.contents(e);if(1==n.length&&"IMG"==n[0].tagName){var i=h.selection.ranges(0);return 0===i.startOffset&&0===i.endOffset?m(e).before(y.INVISIBLE_SPACE+y.MARKERS):m(e).after(y.INVISIBLE_SPACE+y.MARKERS),h.selection.restore(),!1}}r&&r.stopPropagation(),l(e)}}},h.helpers.isIOS()?100:0)}}function l(e){var t=h.popups.get("link.edit");t||(t=function a(){var e="";1<=h.opts.linkEditButtons.length&&("A"==h.el.tagName&&0<=h.opts.linkEditButtons.indexOf("linkRemove")&&h.opts.linkEditButtons.splice(h.opts.linkEditButtons.indexOf("linkRemove"),1),e='<div class="fr-buttons">'.concat(h.button.buildList(h.opts.linkEditButtons),"</div>"));var t={buttons:e},n=h.popups.create("link.edit",t);h.$wp&&h.events.$on(h.$wp,"scroll.link-edit",function(){v()&&h.popups.isVisible("link.edit")&&l(v())});return n}());var n=m(e);h.popups.isVisible("link.edit")||h.popups.refresh("link.edit"),h.popups.setContainer("link.edit",h.$sc);var i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();h.popups.show("link.edit",i,r,n.outerHeight(),!0)}function a(){h.popups.hide("link.edit")}function o(){var e=h.popups.get("link.insert"),t=v();if(t){var n,i,r=m(t),a=e.find('input.fr-link-attr[type="text"]'),l=e.find('input.fr-link-attr[type="checkbox"]');for(n=0;n<a.length;n++)(i=m(a[n])).val(r.attr(i.attr("name")||""));for(l.attr("checked",!1),n=0;n<l.length;n++)i=m(l[n]),r.attr(i.attr("name"))==i.data("checked")&&i.attr("checked",!0);e.find('input.fr-link-attr[type="text"][name="text"]').val(r.text())}else e.find('input.fr-link-attr[type="text"]').val(""),e.find('input.fr-link-attr[type="checkbox"]').attr("checked",!1),e.find('input.fr-link-attr[type="text"][name="text"]').val(h.selection.text());e.find("input.fr-link-attr").trigger("change"),(h.image?h.image.get():null)?e.find('.fr-link-attr[name="text"]').parent().hide():e.find('.fr-link-attr[name="text"]').parent().show()}function s(e){if(e)return h.popups.onRefresh("link.insert",o),!0;var t="";1<=h.opts.linkInsertButtons.length&&(t='<div class="fr-buttons fr-tabs">'.concat(h.button.buildList(h.opts.linkInsertButtons),"</div>"));var n="",i=0;for(var r in n='<div class="fr-link-insert-layer fr-layer fr-active" id="fr-link-insert-layer-'.concat(h.id,'">'),n+='<div class="fr-input-line"><input id="fr-link-insert-layer-url-'.concat(h.id,'" name="href" type="text" class="fr-link-attr" placeholder="').concat(h.language.translate("URL"),'" tabIndex="').concat(++i,'"></div>'),h.opts.linkText&&(n+='<div class="fr-input-line"><input id="fr-link-insert-layer-text-'.concat(h.id,'" name="text" type="text" class="fr-link-attr" placeholder="').concat(h.language.translate("Text"),'" tabIndex="').concat(++i,'"></div>')),h.opts.linkAttributes)if(h.opts.linkAttributes.hasOwnProperty(r)){var a=h.opts.linkAttributes[r];n+='<div class="fr-input-line"><input name="'.concat(r,'" type="text" class="fr-link-attr" placeholder="').concat(h.language.translate(a),'" tabIndex="').concat(++i,'"></div>')}h.opts.linkAlwaysBlank||(n+='<div class="fr-checkbox-line"><span class="fr-checkbox"><input name="target" class="fr-link-attr" data-checked="_blank" type="checkbox" id="fr-link-target-'.concat(h.id,'" tabIndex="').concat(++i,'"><span>').concat('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10" viewBox="0 0 32 32"><path d="M27 4l-15 15-7-7-5 5 12 12 20-20z" fill="#FFF"></path></svg>','</span></span><label id="fr-label-target-').concat(h.id,'">').concat(h.language.translate("Open in new tab"),"</label></div>"));var l={buttons:t,input_layer:n+='<div class="fr-action-buttons"><button class="fr-command fr-submit" role="button" data-cmd="linkInsert" href="#" tabIndex="'.concat(++i,'" type="button">').concat(h.language.translate("Insert"),"</button></div></div>")},s=h.popups.create("link.insert",l);return h.$wp&&h.events.$on(h.$wp,"scroll.link-insert",function(){(h.image?h.image.get():null)&&h.popups.isVisible("link.insert")&&f(),h.popups.isVisible("link.insert")&&c()}),s}function p(e,t,n){if(h.opts.trackChangesEnabled){if(h.edit.on(),h.events.focus(!0),h.undo.saveStep(),h.markers.insert(),h.html.wrap(),!h.$el.find(".fr-marker").length)return void h.popups.hide("link.insert");h.markers.remove()}if(void 0===n&&(n={}),!1===h.events.trigger("link.beforeInsert",[e,t,n]))return!1;var i=h.image?h.image.get():null;i||"A"==h.el.tagName?"A"==h.el.tagName&&h.$el.focus():(h.selection.restore(),h.popups.hide("link.insert"));var r=e;h.opts.linkConvertEmailAddress&&h.helpers.isEmail(e)&&!/^mailto:.*/i.test(e)&&(e="mailto:".concat(e));if(""===h.opts.linkAutoPrefix||new RegExp("^("+y.LinkProtocols.join("|")+"):.","i").test(e)||/^data:image.*/i.test(e)||/^(https?:|ftps?:|file:|)\/\//i.test(e)||/^([A-Za-z]:(\\){1,2}|[A-Za-z]:((\\){1,2}[^\\]+)+)(\\)?$/i.test(e)||["/","{","[","#","(","."].indexOf((e||"")[0])<0&&(e=h.opts.linkAutoPrefix+e),e=h.helpers.sanitizeURL(e),h.opts.linkAlwaysBlank&&(n.target="_blank"),h.opts.linkAlwaysNoFollow&&(n.rel="nofollow"),h.helpers.isEmail(r)&&(n.target=null,n.rel=null),"_blank"==n.target?(h.opts.linkNoOpener&&(n.rel?n.rel+=" noopener":n.rel="noopener"),h.opts.linkNoReferrer&&(n.rel?n.rel+=" noreferrer":n.rel="noreferrer")):null==n.target&&(n.rel?n.rel=n.rel.replace(/noopener/,"").replace(/noreferrer/,""):n.rel=null),t=t||"",e===h.opts.linkAutoPrefix)return h.popups.get("link.insert").find('input[name="href"]').addClass("fr-error"),h.events.trigger("link.bad",[r]),!1;var a,l=v();if(l){if((a=m(l)).attr("href",e),0<t.length&&a.text()!=t&&!i){if(h.opts.trackChangesEnabled){var s=m(a.get(0).outerHTML);s.insertBefore(a.parent());var o=h.track_changes.wrapLinkInTracking(s,h.track_changes.getPendingChanges().length-1),p=h.track_changes.wrapInDelete(o);a.parent().append(p)}for(var c=a.get(0);1===c.childNodes.length&&c.childNodes[0].nodeType==Node.ELEMENT_NODE;)c=c.childNodes[0];m(c).text(t)}for(var f in i||a.prepend(y.START_MARKER).append(y.END_MARKER),n)n[f]?a.attr(f,n[f]):a.removeAttr(f);i||h.selection.restore()}else{i?(i.wrap('<a href="'.concat(e,'"></a>')),h.image.hasCaption()&&i.parent().append(i.parents(".fr-img-caption").find(".fr-inner"))):(h.format.remove("a"),h.selection.isCollapsed()?(t=0===t.length?r:t,h.html.insert('<a href="'.concat(e,'">').concat(y.START_MARKER).concat(t.replace(/&/g,"&amp;").replace(/</,"&lt;",">","&gt;")).concat(y.END_MARKER,"</a>")),h.selection.restore()):0<t.length&&t!=h.selection.text().replace(/\n/g,"")?(h.selection.remove(),h.html.insert('<a href="'.concat(e,'">').concat(y.START_MARKER).concat(t.replace(/&/g,"&amp;")).concat(y.END_MARKER,"</a>")),h.selection.restore()):(!function g(){if(!h.selection.isCollapsed()){h.selection.save();for(var e=h.$el.find(".fr-marker").addClass("fr-unprocessed").toArray();e.length;){var t=m(e.pop());t.removeClass("fr-unprocessed");var n=h.node.deepestParent(t.get(0));if(n){for(var i=t.get(0),r="",a="";i=i.parentNode,h.node.isBlock(i)||(r+=h.node.closeTagString(i),a=h.node.openTagString(i)+a),i!=n;);var l=h.node.openTagString(t.get(0))+t.html()+h.node.closeTagString(t.get(0));t.replaceWith('<span id="fr-break"></span>');var s=n.outerHTML;s=(s=s.replace(/<span id="fr-break"><\/span>/g,r+l+a)).replace(a+r,""),n.outerHTML=s}e=h.$el.find(".fr-marker.fr-unprocessed").toArray()}h.html.cleanEmptyTags(),h.selection.restore()}}(),h.format.apply("a",{href:e})));for(var d=b(),u=0;u<d.length;u++)(a=m(d[u])).attr(n),a.removeAttr("_moz_dirty");1==d.length&&h.$wp&&!i&&(m(d[0]).prepend(y.START_MARKER).append(y.END_MARKER),h.selection.restore())}if(i){var k=h.popups.get("link.insert");k&&k.find("input:focus").blur(),h.image.edit(i)}else E()}function c(){a();var e=v();if(e){var t=h.popups.get("link.insert");t||(t=s()),h.popups.isVisible("link.insert")||(h.popups.refresh("link.insert"),h.selection.save(),h.helpers.isMobile()&&(h.events.disableBlur(),h.$el.blur(),h.events.enableBlur())),h.popups.setContainer("link.insert",h.$sc);var n=(h.image?h.image.get():null)||m(e),i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();h.popups.show("link.insert",i,r,n.outerHeight(),!0)}}function f(){var e=h.image?h.image.getEl():null;if(e){var t=h.popups.get("link.insert");h.image.hasCaption()&&(e=e.find(".fr-img-wrap")),t||(t=s()),o(),h.popups.setContainer("link.insert",h.$sc);var n=e.offset().left+e.outerWidth()/2,i=e.offset().top+e.outerHeight();h.popups.show("link.insert",n,i,e.outerHeight(),!0)}}return{_init:function e(){h.events.on("keyup",function(e){e.which!=y.KEYCODE.ESC&&E(e)}),h.events.on("window.mouseup",E),h.events.$on(h.$el,"click","a",function(e){h.edit.isDisabled()&&e.preventDefault()}),h.helpers.isMobile()&&h.events.$on(h.$doc,"selectionchange",E),s(!0),"A"==h.el.tagName&&h.$el.addClass("fr-view"),h.events.on("toolbar.esc",function(){if(h.popups.isVisible("link.edit"))return h.events.disableBlur(),h.events.focus(),!1},!0)},remove:function i(){var e=v(),t=h.image?h.image.get():null;if(!1===h.events.trigger("link.beforeRemove",[e]))return!1;if(t&&e)if(h.image.hasCaption()){t.addClass("img-link-caption"),m(e).replaceWith(m(e).html());var n=document.querySelectorAll("img.img-link-caption");h.image.edit(m(n[0])),m(n[0]).removeClass("img-link-caption")}else t.unwrap(),h.image.edit(t);else e&&(h.selection.save(),m(e).replaceWith(m(e).html()),h.selection.restore(),a())},showInsertPopup:function d(){var e=h.$tb.find('.fr-command[data-cmd="insertLink"]'),t=h.popups.get("link.insert");if(t||(t=s()),!t.hasClass("fr-active"))if(h.popups.refresh("link.insert"),h.popups.setContainer("link.insert",h.$tb||h.$sc),e.isVisible()){var n=h.button.getPosition(e),i=n.left,r=n.top;h.popups.show("link.insert",i,r,e.outerHeight())}else h.position.forSelection(t),h.popups.show("link.insert")},usePredefined:function u(e){var t,n,i=h.opts.linkList[e],r=h.popups.get("link.insert"),a=r.find('input.fr-link-attr[type="text"]'),l=r.find('input.fr-link-attr[type="checkbox"]');for(i.rel&&(r.rel=i.rel),n=0;n<a.length;n++)i[(t=m(a[n])).attr("name")]?(t.val(i[t.attr("name")]),t.toggleClass("fr-not-empty",!0)):"text"!=t.attr("name")&&t.val("");for(n=0;n<l.length;n++)(t=m(l[n])).attr("checked",t.data("checked")==i[t.attr("name")]);h.accessibility.focusPopup(r)},insertCallback:function k(){var e,t,n=h.popups.get("link.insert"),i=n.find('input.fr-link-attr[type="text"]'),r=n.find('input.fr-link-attr[type="checkbox"]'),a=(i.filter('[name="href"]').val()||"").trim(),l=h.opts.linkText?i.filter('[name="text"]').val():"",s={};for(t=0;t<i.length;t++)e=m(i[t]),["href","text"].indexOf(e.attr("name"))<0&&(s[e.attr("name")]=e.val());for(t=0;t<r.length;t++)(e=m(r[t])).is(":checked")?s[e.attr("name")]=e.data("checked"):s[e.attr("name")]=e.data("unchecked")||null;n.rel&&(s.rel=n.rel);var o=h.helpers.scrollTop();p(a,l,s),m(h.o_win).scrollTop(o)},insert:p,update:c,get:v,allSelected:b,back:function t(){h.image&&h.image.get()?h.image.back():(h.events.disableBlur(),h.selection.restore(),h.events.enableBlur(),v()&&h.$wp?(h.selection.restore(),a(),E()):"A"==h.el.tagName?(h.$el.focus(),E()):(h.popups.hide("link.insert"),h.toolbar.showInline()))},imageLink:f,applyStyle:function g(e,t,n){void 0===n&&(n=h.opts.linkMultipleStyles),void 0===t&&(t=h.opts.linkStyles);var i=v();if(!i)return!1;if(!n){var r=Object.keys(t);r.splice(r.indexOf(e),1),m(i).removeClass(r.join(" "))}m(i).toggleClass(e),E()}}},y.DefineIcon("insertLink",{NAME:"link",SVG_KEY:"insertLink"}),y.RegisterShortcut(y.KEYCODE.K,"insertLink",null,"K"),y.RegisterCommand("insertLink",{title:"Insert Link",undo:!1,focus:!0,refreshOnCallback:!1,popup:!0,callback:function(){this.popups.isVisible("link.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("link.insert")):this.link.showInsertPopup()},plugin:"link"}),y.DefineIcon("linkOpen",{NAME:"external-link",FA5NAME:"external-link-alt",SVG_KEY:"openLink"}),y.RegisterCommand("linkOpen",{title:"Open Link",undo:!1,refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},callback:function(){var e=this.link.get();e&&(-1!==e.href.indexOf("mailto:")?this.o_win.open(e.href).close():(e.target||(e.target="_self"),this.browser.msie||this.browser.edge?this.o_win.open(e.href,e.target):this.o_win.open(e.href,e.target,"noopener")),this.popups.hide("link.edit"))},plugin:"link"}),y.DefineIcon("linkEdit",{NAME:"edit",SVG_KEY:"edit"}),y.RegisterCommand("linkEdit",{title:"Edit Link",undo:!1,refreshAfterCallback:!1,popup:!0,callback:function(){this.link.update()},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"}),y.DefineIcon("linkRemove",{NAME:"unlink",SVG_KEY:"unlink"}),y.RegisterCommand("linkRemove",{title:"Unlink",callback:function(){this.link.remove()},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"}),y.DefineIcon("linkBack",{NAME:"arrow-left",SVG_KEY:"back"}),y.RegisterCommand("linkBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.link.back()},refresh:function(e){var t=this.link.get()&&this.doc.hasFocus();(this.image?this.image.get():null)||t||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))},plugin:"link"}),y.DefineIcon("linkList",{NAME:"search",SVG_KEY:"search"}),y.RegisterCommand("linkList",{title:"Choose Link",type:"dropdown",focus:!1,undo:!1,refreshAfterCallback:!1,html:function(){for(var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.linkList,n=0;n<t.length;n++)e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="linkList" data-param1="'.concat(n,'">').concat(t[n].displayText||t[n].text,"</a></li>");return e+="</ul>"},callback:function(e,t){this.link.usePredefined(t)},plugin:"link"}),y.RegisterCommand("linkInsert",{focus:!1,refreshAfterCallback:!1,callback:function(){this.link.insertCallback()},refresh:function(e){this.link.get()?e.text(this.language.translate("Update")):e.text(this.language.translate("Insert"))},plugin:"link"}),y.DefineIcon("imageLink",{NAME:"link",SVG_KEY:"insertLink"}),y.RegisterCommand("imageLink",{title:"Insert Link",undo:!1,focus:!1,popup:!0,callback:function(){this.link.imageLink()},refresh:function(e){var t;this.link.get()?((t=e.prev()).hasClass("fr-separator")&&t.removeClass("fr-hidden"),e.addClass("fr-hidden")):((t=e.prev()).hasClass("fr-separator")&&t.addClass("fr-hidden"),e.removeClass("fr-hidden"))},plugin:"link"}),y.DefineIcon("linkStyle",{NAME:"magic",SVG_KEY:"linkStyles"}),y.RegisterCommand("linkStyle",{title:"Style",type:"dropdown",html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.linkStyles;for(var n in t)t.hasOwnProperty(n)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="linkStyle" data-param1="'.concat(n,'">').concat(this.language.translate(t[n]),"</a></li>"));return e+="</ul>"},callback:function(e,t){this.link.applyStyle(t)},refreshOnShow:function(e,t){var n=this.$,i=this.link.get();if(i){var r=n(i);t.find(".fr-command").each(function(){var e=n(this).data("param1"),t=r.hasClass(e);n(this).toggleClass("fr-active",t).attr("aria-selected",t)})}},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"})});
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(y){"use strict";y=y&&y.hasOwnProperty("default")?y["default"]:y,Object.assign(y.POPUP_TEMPLATES,{"link.edit":"[_BUTTONS_]","link.insert":"[_BUTTONS_][_INPUT_LAYER_]"}),Object.assign(y.DEFAULTS,{linkEditButtons:["linkOpen","linkStyle","linkEdit","linkRemove"],linkInsertButtons:["linkBack","|","linkList"],linkAttributes:{},linkAutoPrefix:"http://",linkStyles:{"fr-green":"Green","fr-strong":"Thick"},linkMultipleStyles:!0,linkConvertEmailAddress:!0,linkAlwaysBlank:!1,linkAlwaysNoFollow:!1,linkNoOpener:!0,linkNoReferrer:!0,linkList:[{text:"Froala",href:"https://froala.com",target:"_blank"},{text:"Google",href:"https://google.com",target:"_blank"},{displayText:"Facebook",href:"https://facebook.com"}],linkText:!0}),y.PLUGINS.link=function(h){var m=h.$;function v(){var e=h.image?h.image.get():null;if(e||!h.$wp)return"A"==h.el.tagName?h.el:e&&e.get(0).parentNode&&"A"==e.get(0).parentNode.tagName?e.get(0).parentNode:void 0;var t=h.selection.ranges(0).commonAncestorContainer;try{t&&(t.contains&&t.contains(h.el)||!h.el.contains(t)||h.el==t)&&(t=null)}catch(r){t=null}if(t&&"A"===t.tagName)return t;var n=h.selection.element(),i=h.selection.endElement();"A"==n.tagName||h.node.isElement(n)||(n=m(n).parentsUntil(h.$el,"a").first().get(0)),"A"==i.tagName||h.node.isElement(i)||(i=m(i).parentsUntil(h.$el,"a").first().get(0));try{i&&(i.contains&&i.contains(h.el)||!h.el.contains(i)||h.el==i)&&(i=null)}catch(r){i=null}try{n&&(n.contains&&n.contains(h.el)||!h.el.contains(n)||h.el==n)&&(n=null)}catch(r){n=null}return i&&i==n&&"A"==i.tagName?(h.browser.msie||h.helpers.isMobile())&&(h.selection.info(n).atEnd||h.selection.info(n).atStart)?null:n:null}function b(){var e,t,n,i,r=h.image?h.image.get():null,a=[];if(r)"A"==r.get(0).parentNode.tagName&&a.push(r.get(0).parentNode);else if(h.win.getSelection){var l=h.win.getSelection();if(l.getRangeAt&&l.rangeCount){i=h.doc.createRange();for(var s=0;s<l.rangeCount;++s)if((t=(e=l.getRangeAt(s)).commonAncestorContainer)&&1!=t.nodeType&&(t=t.parentNode),t&&"a"==t.nodeName.toLowerCase())a.push(t);else{n=t.getElementsByTagName("a");for(var o=0;o<n.length;++o)i.selectNodeContents(n[o]),i.compareBoundaryPoints(e.END_TO_START,e)<1&&-1<i.compareBoundaryPoints(e.START_TO_END,e)&&a.push(n[o])}}}else if(h.doc.selection&&"Control"!=h.doc.selection.type)if("a"==(t=(e=h.doc.selection.createRange()).parentElement()).nodeName.toLowerCase())a.push(t);else{n=t.getElementsByTagName("a"),i=h.doc.body.createTextRange();for(var p=0;p<n.length;++p)i.moveToElementText(n[p]),-1<i.compareEndPoints("StartToEnd",e)&&i.compareEndPoints("EndToStart",e)<1&&a.push(n[p])}return a}function E(r){if(h.core.hasFocus()){if(a(),r&&"keyup"===r.type&&(r.altKey||r.which==y.KEYCODE.ALT))return!0;setTimeout(function(){if(!r||r&&(1==r.which||"mouseup"!=r.type)){var e=v(),t=h.image?h.image.get():null;if(e&&!t){if(h.image){var n=h.node.contents(e);if(1==n.length&&"IMG"==n[0].tagName){var i=h.selection.ranges(0);return 0===i.startOffset&&0===i.endOffset?m(e).before(y.INVISIBLE_SPACE+y.MARKERS):m(e).after(y.INVISIBLE_SPACE+y.MARKERS),h.selection.restore(),!1}}r&&r.stopPropagation(),l(e)}}},h.helpers.isIOS()?100:0)}}function l(e){var t=h.popups.get("link.edit");t||(t=function a(){var e="";1<=h.opts.linkEditButtons.length&&("A"==h.el.tagName&&0<=h.opts.linkEditButtons.indexOf("linkRemove")&&h.opts.linkEditButtons.splice(h.opts.linkEditButtons.indexOf("linkRemove"),1),e='<div class="fr-buttons">'.concat(h.button.buildList(h.opts.linkEditButtons),"</div>"));var t={buttons:e},n=h.popups.create("link.edit",t);h.$wp&&h.events.$on(h.$wp,"scroll.link-edit",function(){v()&&h.popups.isVisible("link.edit")&&l(v())});return n}());var n=m(e);h.popups.isVisible("link.edit")||h.popups.refresh("link.edit"),h.popups.setContainer("link.edit",h.$sc);var i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();h.popups.show("link.edit",i,r,n.outerHeight(),!0)}function a(){h.popups.hide("link.edit")}function o(){var e=h.popups.get("link.insert"),t=v();if(t){var n,i,r=m(t),a=e.find('input.fr-link-attr[type="text"]'),l=e.find('input.fr-link-attr[type="checkbox"]');for(n=0;n<a.length;n++)(i=m(a[n])).val(r.attr(i.attr("name")||""));for(l.attr("checked",!1),n=0;n<l.length;n++)i=m(l[n]),r.attr(i.attr("name"))==i.data("checked")&&i.attr("checked",!0);e.find('input.fr-link-attr[type="text"][name="text"]').val(r.text())}else e.find('input.fr-link-attr[type="text"]').val(""),e.find('input.fr-link-attr[type="checkbox"]').attr("checked",!1),e.find('input.fr-link-attr[type="text"][name="text"]').val(h.selection.text());e.find("input.fr-link-attr").trigger("change"),(h.image?h.image.get():null)?e.find('.fr-link-attr[name="text"]').parent().hide():e.find('.fr-link-attr[name="text"]').parent().show()}function s(e){if(e)return h.popups.onRefresh("link.insert",o),!0;var t="";1<=h.opts.linkInsertButtons.length&&(t='<div class="fr-buttons fr-tabs">'.concat(h.button.buildList(h.opts.linkInsertButtons),"</div>"));var n="",i=0;for(var r in n='<div class="fr-link-insert-layer fr-layer fr-active" id="fr-link-insert-layer-'.concat(h.id,'">'),n+='<div class="fr-input-line"><input id="fr-link-insert-layer-url-'.concat(h.id,'" name="href" type="text" class="fr-link-attr" placeholder="').concat(h.language.translate("URL"),'" tabIndex="').concat(++i,'"></div>'),h.opts.linkText&&(n+='<div class="fr-input-line"><input id="fr-link-insert-layer-text-'.concat(h.id,'" name="text" type="text" class="fr-link-attr" placeholder="').concat(h.language.translate("Text"),'" tabIndex="').concat(++i,'"></div>')),h.opts.linkAttributes)if(h.opts.linkAttributes.hasOwnProperty(r)){var a=h.opts.linkAttributes[r];n+='<div class="fr-input-line"><input name="'.concat(r,'" type="text" class="fr-link-attr" placeholder="').concat(h.language.translate(a),'" tabIndex="').concat(++i,'"></div>')}h.opts.linkAlwaysBlank||(n+='<div class="fr-checkbox-line"><span class="fr-checkbox"><input name="target" class="fr-link-attr" data-checked="_blank" type="checkbox" id="fr-link-target-'.concat(h.id,'" tabIndex="').concat(++i,'"><span>').concat('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10" viewBox="0 0 32 32"><path d="M27 4l-15 15-7-7-5 5 12 12 20-20z" fill="#FFF"></path></svg>','</span></span><label id="fr-label-target-').concat(h.id,'">').concat(h.language.translate("Open in new tab"),"</label></div>"));var l={buttons:t,input_layer:n+='<div class="fr-action-buttons"><button class="fr-command fr-submit" role="button" data-cmd="linkInsert" href="#" tabIndex="'.concat(++i,'" type="button">').concat(h.language.translate("Insert"),"</button></div></div>")},s=h.popups.create("link.insert",l);return h.$wp&&h.events.$on(h.$wp,"scroll.link-insert",function(){(h.image?h.image.get():null)&&h.popups.isVisible("link.insert")&&f(),h.popups.isVisible("link.insert")&&c()}),s}function p(e,t,n){if(h.opts.trackChangesEnabled){if(h.edit.on(),h.events.focus(!0),h.undo.saveStep(),h.markers.insert(),h.html.wrap(),!h.$el.find(".fr-marker").length)return void h.popups.hide("link.insert");h.markers.remove()}if(void 0===n&&(n={}),!1===h.events.trigger("link.beforeInsert",[e,t,n]))return!1;var i=h.image?h.image.get():null;i||"A"==h.el.tagName?"A"==h.el.tagName&&h.$el.focus():(h.selection.restore(),h.popups.hide("link.insert"));var r=e;h.opts.linkConvertEmailAddress&&h.helpers.isEmail(e)&&!/^mailto:.*/i.test(e)&&(e="mailto:".concat(e));if(""===h.opts.linkAutoPrefix||new RegExp("^("+y.LinkProtocols.join("|")+"):.","i").test(e)||/^data:image.*/i.test(e)||/^(https?:|ftps?:|file:|)\/\//i.test(e)||/^([A-Za-z]:(\\){1,2}|[A-Za-z]:((\\){1,2}[^\\]+)+)(\\)?$/i.test(e)||["/","{","[","#","(","."].indexOf((e||"")[0])<0&&(e=h.opts.linkAutoPrefix+e),e=h.helpers.sanitizeURL(e),h.opts.linkAlwaysBlank&&(n.target="_blank"),h.opts.linkAlwaysNoFollow&&(n.rel="nofollow"),h.helpers.isEmail(r)&&(n.target=null,n.rel=null),"_blank"==n.target?(h.opts.linkNoOpener&&(n.rel?n.rel+=" noopener":n.rel="noopener"),h.opts.linkNoReferrer&&(n.rel?n.rel+=" noreferrer":n.rel="noreferrer")):null==n.target&&(n.rel?n.rel=n.rel.replace(/noopener/,"").replace(/noreferrer/,""):n.rel=null),t=t||"",e===h.opts.linkAutoPrefix)return h.popups.get("link.insert").find('input[name="href"]').addClass("fr-error"),h.events.trigger("link.bad",[r]),!1;var a,l=v();if(l){if((a=m(l)).attr("href",e),0<t.length&&a.text()!=t&&!i){if(h.opts.trackChangesEnabled){var s=m(a.get(0).outerHTML);s.insertBefore(a.parent());var o=h.track_changes.wrapLinkInTracking(s,h.track_changes.getPendingChanges().length-1),p=h.track_changes.wrapInDelete(o);a.parent().append(p)}for(var c=a.get(0);1===c.childNodes.length&&c.childNodes[0].nodeType==Node.ELEMENT_NODE;)c=c.childNodes[0];m(c).text(t)}for(var f in i||a.prepend(y.START_MARKER).append(y.END_MARKER),n)n[f]?a.attr(f,n[f]):a.removeAttr(f);i||h.selection.restore()}else{i?(i.wrap('<a href="'.concat(e,'"></a>')),h.image.hasCaption()&&i.parent().append(i.parents(".fr-img-caption").find(".fr-inner"))):(h.format.remove("a"),h.selection.isCollapsed()?(t=0===t.length?r:t,h.html.insert('<a href="'.concat(e,'">').concat(y.START_MARKER).concat(t.replace(/&/g,"&amp;").replace(/</,"&lt;",">","&gt;")).concat(y.END_MARKER,"</a>")),h.selection.restore()):0<t.length&&t!=h.selection.text().replace(/\n/g,"")?(h.selection.remove(),h.html.insert('<a href="'.concat(e,'">').concat(y.START_MARKER).concat(t.replace(/&/g,"&amp;")).concat(y.END_MARKER,"</a>")),h.selection.restore()):(!function g(){if(!h.selection.isCollapsed()){h.selection.save();for(var e=h.$el.find(".fr-marker").addClass("fr-unprocessed").toArray();e.length;){var t=m(e.pop());t.removeClass("fr-unprocessed");var n=h.node.deepestParent(t.get(0));if(n){for(var i=t.get(0),r="",a="";i=i.parentNode,h.node.isBlock(i)||(r+=h.node.closeTagString(i),a=h.node.openTagString(i)+a),i!=n;);var l=h.node.openTagString(t.get(0))+t.html()+h.node.closeTagString(t.get(0));t.replaceWith('<span id="fr-break"></span>');var s=n.outerHTML;s=(s=s.replace(/<span id="fr-break"><\/span>/g,r+l+a)).replace(a+r,""),n.outerHTML=s}e=h.$el.find(".fr-marker.fr-unprocessed").toArray()}h.html.cleanEmptyTags(),h.selection.restore()}}(),h.format.apply("a",{href:e})));for(var d=b(),u=0;u<d.length;u++)(a=m(d[u])).attr(n),a.removeAttr("_moz_dirty");1==d.length&&h.$wp&&!i&&(m(d[0]).prepend(y.START_MARKER).append(y.END_MARKER),h.selection.restore())}if(i){var k=h.popups.get("link.insert");k&&k.find("input:focus").blur(),h.image.edit(i)}else E()}function c(){a();var e=v();if(e){var t=h.popups.get("link.insert");t||(t=s()),h.popups.isVisible("link.insert")||(h.popups.refresh("link.insert"),h.selection.save(),h.helpers.isMobile()&&(h.events.disableBlur(),h.$el.blur(),h.events.enableBlur())),h.popups.setContainer("link.insert",h.$sc);var n=(h.image?h.image.get():null)||m(e),i=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();h.popups.show("link.insert",i,r,n.outerHeight(),!0)}}function f(){var e=h.image?h.image.getEl():null;if(e){var t=h.popups.get("link.insert"),n=e.outerWidth()/2;h.image.hasCaption()&&(e=e.find(".fr-img-wrap"),m(e)&&m(e).find("img")&&(n=m(e).find("img").outerWidth()/2)),t||(t=s()),o(),h.popups.setContainer("link.insert",h.$sc);var i=e.offset().left+n,r=e.offset().top+e.outerHeight(),a=e.outerHeight();h.opts.iframe&&h.image.hasCaption()&&m(e)&&m(e).find("img")&&(a=m(e).find("img").outerHeight()),h.popups.show("link.insert",i,r,a,!0)}}return{_init:function e(){h.events.on("keyup",function(e){e.which!=y.KEYCODE.ESC&&E(e)}),h.events.on("window.mouseup",E),h.events.$on(h.$el,"click","a",function(e){h.edit.isDisabled()&&e.preventDefault()}),h.helpers.isMobile()&&h.events.$on(h.$doc,"selectionchange",E),s(!0),"A"==h.el.tagName&&h.$el.addClass("fr-view"),h.events.on("toolbar.esc",function(){if(h.popups.isVisible("link.edit"))return h.events.disableBlur(),h.events.focus(),!1},!0)},remove:function i(){var e=v(),t=h.image?h.image.get():null;if(!1===h.events.trigger("link.beforeRemove",[e]))return!1;if(t&&e)if(h.image.hasCaption()){t.addClass("img-link-caption"),m(e).replaceWith(m(e).html());var n=document.querySelectorAll("img.img-link-caption");h.image.edit(m(n[0])),m(n[0]).removeClass("img-link-caption")}else t.unwrap(),h.image.edit(t);else e&&(h.selection.save(),m(e).replaceWith(m(e).html()),h.selection.restore(),a())},showInsertPopup:function d(){var e=h.$tb.find('.fr-command[data-cmd="insertLink"]'),t=h.popups.get("link.insert");if(t||(t=s()),!t.hasClass("fr-active"))if(h.popups.refresh("link.insert"),h.popups.setContainer("link.insert",h.$tb||h.$sc),e.isVisible()){var n=h.button.getPosition(e),i=n.left,r=n.top;h.popups.show("link.insert",i,r,e.outerHeight())}else h.position.forSelection(t),h.popups.show("link.insert")},usePredefined:function u(e){var t,n,i=h.opts.linkList[e],r=h.popups.get("link.insert"),a=r.find('input.fr-link-attr[type="text"]'),l=r.find('input.fr-link-attr[type="checkbox"]');for(i.rel&&(r.rel=i.rel),n=0;n<a.length;n++)i[(t=m(a[n])).attr("name")]?(t.val(i[t.attr("name")]),t.toggleClass("fr-not-empty",!0)):"text"!=t.attr("name")&&t.val("");for(n=0;n<l.length;n++)(t=m(l[n])).attr("checked",t.data("checked")==i[t.attr("name")]);h.accessibility.focusPopup(r)},insertCallback:function k(){var e,t,n=h.popups.get("link.insert"),i=n.find('input.fr-link-attr[type="text"]'),r=n.find('input.fr-link-attr[type="checkbox"]'),a=(i.filter('[name="href"]').val()||"").trim(),l=h.opts.linkText?i.filter('[name="text"]').val():"",s={};for(t=0;t<i.length;t++)e=m(i[t]),["href","text"].indexOf(e.attr("name"))<0&&(s[e.attr("name")]=e.val());for(t=0;t<r.length;t++)(e=m(r[t])).is(":checked")?s[e.attr("name")]=e.data("checked"):s[e.attr("name")]=e.data("unchecked")||null;n.rel&&(s.rel=n.rel);var o=h.helpers.scrollTop();p(a,l,s),m(h.o_win).scrollTop(o)},insert:p,update:c,get:v,allSelected:b,back:function t(){h.image&&h.image.get()?h.image.back():(h.events.disableBlur(),h.selection.restore(),h.events.enableBlur(),v()&&h.$wp?(h.selection.restore(),a(),E()):"A"==h.el.tagName?(h.$el.focus(),E()):(h.popups.hide("link.insert"),h.toolbar.showInline()))},imageLink:f,applyStyle:function g(e,t,n){void 0===n&&(n=h.opts.linkMultipleStyles),void 0===t&&(t=h.opts.linkStyles);var i=v();if(!i)return!1;if(!n){var r=Object.keys(t);r.splice(r.indexOf(e),1),m(i).removeClass(r.join(" "))}m(i).toggleClass(e),E()}}},y.DefineIcon("insertLink",{NAME:"link",SVG_KEY:"insertLink"}),y.RegisterShortcut(y.KEYCODE.K,"insertLink",null,"K"),y.RegisterCommand("insertLink",{title:"Insert Link",undo:!1,focus:!0,refreshOnCallback:!1,popup:!0,callback:function(){this.popups.isVisible("link.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("link.insert")):this.link.showInsertPopup()},plugin:"link"}),y.DefineIcon("linkOpen",{NAME:"external-link",FA5NAME:"external-link-alt",SVG_KEY:"openLink"}),y.RegisterCommand("linkOpen",{title:"Open Link",undo:!1,refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},callback:function(){var e=this.link.get();e&&(-1!==e.href.indexOf("mailto:")?this.o_win.open(e.href).close():(e.target||(e.target="_self"),this.browser.msie||this.browser.edge?this.o_win.open(e.href,e.target):this.o_win.open(e.href,e.target,"noopener")),this.popups.hide("link.edit"))},plugin:"link"}),y.DefineIcon("linkEdit",{NAME:"edit",SVG_KEY:"edit"}),y.RegisterCommand("linkEdit",{title:"Edit Link",undo:!1,refreshAfterCallback:!1,popup:!0,callback:function(){this.link.update()},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"}),y.DefineIcon("linkRemove",{NAME:"unlink",SVG_KEY:"unlink"}),y.RegisterCommand("linkRemove",{title:"Unlink",callback:function(){this.link.remove()},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"}),y.DefineIcon("linkBack",{NAME:"arrow-left",SVG_KEY:"back"}),y.RegisterCommand("linkBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.link.back()},refresh:function(e){var t=this.link.get()&&this.doc.hasFocus();(this.image?this.image.get():null)||t||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))},plugin:"link"}),y.DefineIcon("linkList",{NAME:"search",SVG_KEY:"search"}),y.RegisterCommand("linkList",{title:"Choose Link",type:"dropdown",focus:!1,undo:!1,refreshAfterCallback:!1,html:function(){for(var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.linkList,n=0;n<t.length;n++)e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="linkList" data-param1="'.concat(n,'">').concat(t[n].displayText||t[n].text,"</a></li>");return e+="</ul>"},callback:function(e,t){this.link.usePredefined(t)},plugin:"link"}),y.RegisterCommand("linkInsert",{focus:!1,refreshAfterCallback:!1,callback:function(){this.link.insertCallback()},refresh:function(e){this.link.get()?e.text(this.language.translate("Update")):e.text(this.language.translate("Insert"))},plugin:"link"}),y.DefineIcon("imageLink",{NAME:"link",SVG_KEY:"insertLink"}),y.RegisterCommand("imageLink",{title:"Insert Link",undo:!1,focus:!1,popup:!0,callback:function(){this.link.imageLink()},refresh:function(e){var t;this.link.get()?((t=e.prev()).hasClass("fr-separator")&&t.removeClass("fr-hidden"),e.addClass("fr-hidden")):((t=e.prev()).hasClass("fr-separator")&&t.addClass("fr-hidden"),e.removeClass("fr-hidden"))},plugin:"link"}),y.DefineIcon("linkStyle",{NAME:"magic",SVG_KEY:"linkStyles"}),y.RegisterCommand("linkStyle",{title:"Style",type:"dropdown",html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.linkStyles;for(var n in t)t.hasOwnProperty(n)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="linkStyle" data-param1="'.concat(n,'">').concat(this.language.translate(t[n]),"</a></li>"));return e+="</ul>"},callback:function(e,t){this.link.applyStyle(t)},refreshOnShow:function(e,t){var n=this.$,i=this.link.get();if(i){var r=n(i);t.find(".fr-command").each(function(){var e=n(this).data("param1"),t=r.hasClass(e);n(this).toggleClass("fr-active",t).attr("aria-selected",t)})}},refresh:function(e){this.link.get()?e.removeClass("fr-hidden"):e.addClass("fr-hidden")},plugin:"link"})});
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * froala_editor v4.0.8 (https://www.froala.com/wysiwyg-editor)
2
+ * froala_editor v4.0.11 (https://www.froala.com/wysiwyg-editor)
3
3
  * License https://froala.com/wysiwyg-editor/terms/
4
- * Copyright 2014-2021 Froala Labs
4
+ * Copyright 2014-2022 Froala Labs
5
5
  */
6
6
 
7
7
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(l){"use strict";l=l&&l.hasOwnProperty("default")?l["default"]:l,Object.assign(l.DEFAULTS,{listAdvancedTypes:!0}),l.PLUGINS.lists=function(m){var g=m.$;function d(e){return'<span class="fr-open-'.concat(e.toLowerCase(),'"></span>')}function f(e){return'<span class="fr-close-'.concat(e.toLowerCase(),'"></span>')}function o(e,t){!function c(e,t){for(var a=[],n=0;n<e.length;n++){var r=e[n].parentNode;"LI"==e[n].tagName&&r.tagName!=t&&a.indexOf(r)<0&&a.push(r)}for(var o=a.length-1;0<=o;o--){var i=g(a[o]);i.replaceWith("<".concat(t.toLowerCase()," ").concat(m.node.attributes(i.get(0)),">").concat(i.html(),"</").concat(t.toLowerCase(),">"))}}(e,t);var a,n=m.html.defaultTag(),r=null;e.length&&(a="rtl"==m.opts.direction||"rtl"==g(e[0]).css("direction")?"margin-right":"margin-left");for(var o=0;o<e.length;o++)if("TD"!=e[o].tagName&&"TH"!=e[o].tagName&&"LI"!=e[o].tagName){var i=m.helpers.getPX(g(e[o]).css(a))||0;(e[o].style.marginLeft=null)===r&&(r=i);var l=0<r?"<".concat(t,' style="').concat(a,": ").concat(r,'px ">'):"<".concat(t,">"),s="</".concat(t,">");for(i-=r;0<i/m.opts.indentMargin;)l+="</".concat(t,">"),s+=s,i-=m.opts.indentMargin;n&&e[o].tagName.toLowerCase()==n?g(e[o]).replaceWith("".concat(l,"<li").concat(m.node.attributes(e[o]),">").concat(g(e[o]).html(),"</li>").concat(s)):g(e[o]).wrap("".concat(l,"<li></li>").concat(s))}m.clean.lists()}function c(e){var t,a;for(t=e.length-1;0<=t;t--)for(a=t-1;0<=a;a--){if(g(e[a]).find(e[t]).length||e[a]==e[t]){e.splice(t,1);break}if(g(e[a]).contains(e[t])){e.splice(a,1);break}}var n=[];for(t=0;t<e.length;t++){var r=g(e[t]),o=e[t].parentNode,i=r.attr("class");if(r.before(f(o.tagName)),"LI"==o.parentNode.tagName)r.before(f("LI")),r.after(d("LI"));else if("OL"==o.parentNode.tagName)r.before(f("OL")),r.after(d("OL"));else{var l="";i&&(l+=' class="'.concat(i,'"'));var s="rtl"==m.opts.direction||"rtl"==r.css("direction")?"margin-right":"margin-left";m.helpers.getPX(g(o).css(s))&&0<=(g(o).attr("style")||"").indexOf("".concat(s,":"))&&(l+=' style="'.concat(s,":").concat(m.helpers.getPX(g(o).css(s)),'px;"')),m.html.defaultTag()&&0===r.find(m.html.blockTagsQuery()).length&&r.wrapInner(m.html.defaultTag()+l),m.node.isEmpty(r.get(0),!0)||0!==r.find(m.html.blockTagsQuery()).length||("DIV"==o.parentNode.tagName&&m.html.defaultTag()?(r.prepend(d(m.html.defaultTag())),r.append(f(m.html.defaultTag()))):r.append("<br>")),r.append(d("LI")),r.prepend(f("LI"))}r.after(d(o.tagName)),"LI"==o.parentNode.tagName&&(o=o.parentNode.parentNode),n.indexOf(o)<0&&n.push(o)}for(t=0;t<n.length;t++){var c=g(n[t]),p=c.html();p=(p=p.replace(/<span class="fr-close-([a-z]*)"><\/span>/g,"</$1>")).replace(/<span class="fr-open-([a-z]*)"><\/span>/g,"<$1>"),c.replaceWith(m.node.openTagString(c.get(0))+p+m.node.closeTagString(c.get(0)))}m.$el.find("li:empty").remove(),m.$el.find("ul:empty, ol:empty").remove(),m.clean.lists(),m.$el.find("ul:empty, ol:empty").remove(),m.html.wrap()}function e(e){if("indent"==e||"outdent"==e){var t=!1,a=m.selection.blocks(),n=[],r=a[0].previousSibling||a[0].parentElement;if("outdent"==e){if("UL"!=a[0].parentNode.tagName&&"UL"!=r.parentNode.tagName&&"OL"!=r.parentNode.tagName&&"LI"!=r.parentNode.tagName)return;if(!a[0].previousSibling&&"none"==r.parentNode.style.listStyleType)return void function i(e){for(m.selection.save();0<e.childNodes.length;)e.parentNode.parentNode.append(e.childNodes[0]);m.clean.lists(),m.selection.restore()}(r)}else{if("UL"!=r.parentNode.tagName&&"OL"!=r.parentNode.tagName&&"LI"!=r.parentNode.tagName)return;if(!a[0].previousSibling||"LI"!=a[0].previousSibling.tagName)return void function l(e){m.selection.save();for(var t="OL"==e.tagName?document.createElement("ol"):document.createElement("ul");0<e.childNodes.length;)t.append(e.childNodes[0]);var a=document.createElement("li");t.append(a),e.append(t),m.clean.lists(),m.selection.restore()}(r)}for(var o=0;o<a.length;o++)"LI"==a[o].tagName?(t=!0,n.push(a[o])):"LI"==a[o].parentNode.tagName&&(t=!0,n.push(a[o].parentNode));t&&("indent"==e?function f(e){m.selection.save();for(var t=0;t<e.length;t++){var a=e[t].previousSibling;if(a){var n=g(e[t]).find("> ul, > ol").last().get(0);if(n){var r=g(document.createElement("li"));if(n.childNodes.length)for(var o=n.childNodes[0].attributes,i=0;i<o.length;i++){var l=o[i];"style"===l.name&&(r[0].style.cssText+=l.value)}g(n).prepend(r);for(var s=m.node.contents(e[t])[0];s&&!m.node.isList(s);){var c=s.nextSibling;r.append(s),s=c}g(a).append(g(n)),g(e[t]).remove()}else{var p=g(a).find("> ul, > ol").last().get(0);if(p)g(p).append(g(e[t]));else{var d=g("<".concat(e[t].parentNode.tagName,">"));g(a).append(d),d.append(g(e[t]))}}}}m.clean.lists(),m.selection.restore()}(n):function s(e){m.selection.save(),c(e),m.selection.restore()}(n))}}return{_init:function t(){m.events.on("commands.after",e),m.events.on("keydown",function(e){if(e.which==l.KEYCODE.TAB){for(var t=m.selection.blocks(),a=[],n=0;n<t.length;n++)"LI"==t[n].tagName?a.push(t[n]):"LI"==t[n].parentNode.tagName&&a.push(t[n].parentNode);if(1<a.length||a.length&&(m.selection.info(a[0]).atStart||m.node.isEmpty(a[0])))return e.preventDefault(),e.stopPropagation(),e.shiftKey?m.commands.outdent():m.commands.indent(),!1}},!0)},format:function i(e,t){var a,n;for(m.html.syncInputs(),m.selection.save(),m.html.wrap(!0,!0,!0,!0),m.selection.restore(),n=m.selection.blocks(!0),a=0;a<n.length;a++)"LI"!=n[a].tagName&&"LI"==n[a].parentNode.tagName&&(n[a]=n[a].parentNode);if(m.selection.save(),function r(e,t){for(var a=!0,n=0;n<e.length;n++){if("LI"!=e[n].tagName)return!1;e[n].parentNode.tagName!=t&&(a=!1)}return a}(n,e)?t||c(n):o(n,e),m.html.unwrap(),m.selection.restore(),t=t||"default"){for(n=m.selection.blocks(),a=0;a<n.length;a++)"LI"!=n[a].tagName&&"LI"==n[a].parentNode.tagName&&(n[a]=n[a].parentNode);for(a=0;a<n.length;a++)"LI"==n[a].tagName&&(g(n[a].parentNode).css("list-style-type","default"===t?"":t),0===(g(n[a].parentNode).attr("style")||"").length&&g(n[a].parentNode).removeAttr("style"))}},refresh:function r(e,t){var a=g(m.selection.element());if(a.get(0)!=m.el){var n=a.get(0);(n="LI"!=n.tagName&&n.firstElementChild&&"LI"!=n.firstElementChild.tagName?a.parents("li").get(0):"LI"==n.tagName||n.firstElementChild?n.firstElementChild&&"LI"==n.firstElementChild.tagName?a.get(0).firstChild:a.get(0):a.parents("li").get(0))&&n.parentNode.tagName==t&&m.el.contains(n.parentNode)&&e.addClass("fr-active")}}}},l.DefineIcon("formatOLSimple",{NAME:"list-ol",SVG_KEY:"orderedList"}),l.RegisterCommand("formatOLSimple",{title:"Ordered List",type:"button",options:{"default":"Default",circle:"Circle",disc:"Disc",square:"Square"},refresh:function(e){this.lists.refresh(e,"OL")},callback:function(e,t){this.lists.format("OL",t)},plugin:"lists"}),l.RegisterCommand("formatUL",{title:"Unordered List",type:"button",hasOptions:function(){return this.opts.listAdvancedTypes},options:{"default":"Default",circle:"Circle",disc:"Disc",square:"Square"},refresh:function(e){this.lists.refresh(e,"UL")},callback:function(e,t){this.lists.format("UL",t)},plugin:"lists"}),l.RegisterCommand("formatOL",{title:"Ordered List",hasOptions:function(){return this.opts.listAdvancedTypes},options:{"default":"Default","lower-alpha":"Lower Alpha","lower-greek":"Lower Greek","lower-roman":"Lower Roman","upper-alpha":"Upper Alpha","upper-roman":"Upper Roman"},refresh:function(e){this.lists.refresh(e,"OL")},callback:function(e,t){this.lists.format("OL",t)},plugin:"lists"}),l.DefineIcon("formatUL",{NAME:"list-ul",SVG_KEY:"unorderedList"}),l.DefineIcon("formatOL",{NAME:"list-ol",SVG_KEY:"orderedList"})});