xmt_froala 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +2 -0
  5. data/app/assets/javascripts/xmt_froala.js +31 -0
  6. data/app/assets/stylesheets/xmt_froala.css +17 -0
  7. data/app/controllers/xmt_froala/application_controller.rb +5 -0
  8. data/app/controllers/xmt_froala/assets_controller.rb +94 -0
  9. data/app/models/xmt_froala/asset_uploader.rb +107 -0
  10. data/app/models/xmt_froala/file_uploader.rb +10 -0
  11. data/app/models/xmt_froala/flash_uploader.rb +10 -0
  12. data/app/models/xmt_froala/image_uploader.rb +10 -0
  13. data/app/models/xmt_froala/media_uploader.rb +10 -0
  14. data/config/routes.rb +6 -0
  15. data/lib/generators/xmt_froala/install/USAGE +10 -0
  16. data/lib/generators/xmt_froala/install/install_generator.rb +23 -0
  17. data/lib/generators/xmt_froala/install/templates/application.js +17 -0
  18. data/lib/generators/xmt_froala/install/templates/xmt_froala.rb +29 -0
  19. data/lib/generators/xmt_froala/migration/USAGE +14 -0
  20. data/lib/generators/xmt_froala/migration/migration_generator.rb +36 -0
  21. data/lib/generators/xmt_froala/migration/templates/migration/migration.rb +18 -0
  22. data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/asset.rb +14 -0
  23. data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/file.rb +3 -0
  24. data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/flash.rb +3 -0
  25. data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/image.rb +3 -0
  26. data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/media.rb +3 -0
  27. data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/asset.rb +27 -0
  28. data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/file.rb +3 -0
  29. data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/flash.rb +3 -0
  30. data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/image.rb +3 -0
  31. data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/media.rb +3 -0
  32. data/lib/tasks/xmt_froala_tasks.rake +9 -0
  33. data/lib/xmt_froala.rb +65 -0
  34. data/lib/xmt_froala/active_record.rb +14 -0
  35. data/lib/xmt_froala/engine.rb +32 -0
  36. data/lib/xmt_froala/formtastic.rb +12 -0
  37. data/lib/xmt_froala/helper.rb +105 -0
  38. data/lib/xmt_froala/simple_form.rb +11 -0
  39. data/lib/xmt_froala/version.rb +3 -0
  40. data/vendor/assets/javascripts/xmt_froala/froala_editor.js +0 -0
  41. data/vendor/assets/javascripts/xmt_froala/languages/ar.js +318 -0
  42. data/vendor/assets/javascripts/xmt_froala/languages/bs.js +318 -0
  43. data/vendor/assets/javascripts/xmt_froala/languages/cs.js +318 -0
  44. data/vendor/assets/javascripts/xmt_froala/languages/da.js +318 -0
  45. data/vendor/assets/javascripts/xmt_froala/languages/de.js +318 -0
  46. data/vendor/assets/javascripts/xmt_froala/languages/en_ca.js +262 -0
  47. data/vendor/assets/javascripts/xmt_froala/languages/en_gb.js +262 -0
  48. data/vendor/assets/javascripts/xmt_froala/languages/es.js +318 -0
  49. data/vendor/assets/javascripts/xmt_froala/languages/et.js +318 -0
  50. data/vendor/assets/javascripts/xmt_froala/languages/fa.js +318 -0
  51. data/vendor/assets/javascripts/xmt_froala/languages/fi.js +318 -0
  52. data/vendor/assets/javascripts/xmt_froala/languages/fr.js +318 -0
  53. data/vendor/assets/javascripts/xmt_froala/languages/he.js +318 -0
  54. data/vendor/assets/javascripts/xmt_froala/languages/hr.js +318 -0
  55. data/vendor/assets/javascripts/xmt_froala/languages/hu.js +318 -0
  56. data/vendor/assets/javascripts/xmt_froala/languages/id.js +319 -0
  57. data/vendor/assets/javascripts/xmt_froala/languages/it.js +318 -0
  58. data/vendor/assets/javascripts/xmt_froala/languages/ja.js +318 -0
  59. data/vendor/assets/javascripts/xmt_froala/languages/ko.js +318 -0
  60. data/vendor/assets/javascripts/xmt_froala/languages/me.js +318 -0
  61. data/vendor/assets/javascripts/xmt_froala/languages/nb.js +318 -0
  62. data/vendor/assets/javascripts/xmt_froala/languages/nl.js +318 -0
  63. data/vendor/assets/javascripts/xmt_froala/languages/pl.js +318 -0
  64. data/vendor/assets/javascripts/xmt_froala/languages/pt_br.js +318 -0
  65. data/vendor/assets/javascripts/xmt_froala/languages/pt_pt.js +318 -0
  66. data/vendor/assets/javascripts/xmt_froala/languages/ro.js +319 -0
  67. data/vendor/assets/javascripts/xmt_froala/languages/ru.js +318 -0
  68. data/vendor/assets/javascripts/xmt_froala/languages/sk.js +318 -0
  69. data/vendor/assets/javascripts/xmt_froala/languages/sr.js +318 -0
  70. data/vendor/assets/javascripts/xmt_froala/languages/sv.js +318 -0
  71. data/vendor/assets/javascripts/xmt_froala/languages/th.js +318 -0
  72. data/vendor/assets/javascripts/xmt_froala/languages/tr.js +318 -0
  73. data/vendor/assets/javascripts/xmt_froala/languages/uk.js +318 -0
  74. data/vendor/assets/javascripts/xmt_froala/languages/vi.js +258 -0
  75. data/vendor/assets/javascripts/xmt_froala/languages/zh_cn.js +320 -0
  76. data/vendor/assets/javascripts/xmt_froala/languages/zh_tw.js +318 -0
  77. data/vendor/assets/javascripts/xmt_froala/plugins/align.js +139 -0
  78. data/vendor/assets/javascripts/xmt_froala/plugins/align.min.js +7 -0
  79. data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.js +154 -0
  80. data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.min.js +7 -0
  81. data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.js +3270 -0
  82. data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.min.js +7 -0
  83. data/vendor/assets/javascripts/xmt_froala/plugins/code_view.js +393 -0
  84. data/vendor/assets/javascripts/xmt_froala/plugins/code_view.min.js +7 -0
  85. data/vendor/assets/javascripts/xmt_froala/plugins/colors.js +492 -0
  86. data/vendor/assets/javascripts/xmt_froala/plugins/colors.min.js +7 -0
  87. data/vendor/assets/javascripts/xmt_froala/plugins/draggable.js +459 -0
  88. data/vendor/assets/javascripts/xmt_froala/plugins/draggable.min.js +7 -0
  89. data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.js +509 -0
  90. data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.min.js +7 -0
  91. data/vendor/assets/javascripts/xmt_froala/plugins/entities.js +121 -0
  92. data/vendor/assets/javascripts/xmt_froala/plugins/entities.min.js +7 -0
  93. data/vendor/assets/javascripts/xmt_froala/plugins/file.js +736 -0
  94. data/vendor/assets/javascripts/xmt_froala/plugins/file.min.js +239 -0
  95. data/vendor/assets/javascripts/xmt_froala/plugins/font_family.js +182 -0
  96. data/vendor/assets/javascripts/xmt_froala/plugins/font_family.min.js +7 -0
  97. data/vendor/assets/javascripts/xmt_froala/plugins/font_size.js +118 -0
  98. data/vendor/assets/javascripts/xmt_froala/plugins/font_size.min.js +7 -0
  99. data/vendor/assets/javascripts/xmt_froala/plugins/forms.js +430 -0
  100. data/vendor/assets/javascripts/xmt_froala/plugins/forms.min.js +7 -0
  101. data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.js +274 -0
  102. data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.min.js +7 -0
  103. data/vendor/assets/javascripts/xmt_froala/plugins/help.js +216 -0
  104. data/vendor/assets/javascripts/xmt_froala/plugins/help.min.js +7 -0
  105. data/vendor/assets/javascripts/xmt_froala/plugins/image.js +3323 -0
  106. data/vendor/assets/javascripts/xmt_froala/plugins/image.min.js +7 -0
  107. data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.js +1056 -0
  108. data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.min.js +7 -0
  109. data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.js +94 -0
  110. data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.min.js +7 -0
  111. data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.js +537 -0
  112. data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.min.js +7 -0
  113. data/vendor/assets/javascripts/xmt_froala/plugins/link.js +1157 -0
  114. data/vendor/assets/javascripts/xmt_froala/plugins/link.min.js +7 -0
  115. data/vendor/assets/javascripts/xmt_froala/plugins/lists.js +462 -0
  116. data/vendor/assets/javascripts/xmt_froala/plugins/lists.min.js +7 -0
  117. data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.js +290 -0
  118. data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.min.js +7 -0
  119. data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.js +144 -0
  120. data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.min.js +7 -0
  121. data/vendor/assets/javascripts/xmt_froala/plugins/plain_paste.js +96 -0
  122. data/vendor/assets/javascripts/xmt_froala/plugins/print.js +137 -0
  123. data/vendor/assets/javascripts/xmt_froala/plugins/print.min.js +7 -0
  124. data/vendor/assets/javascripts/xmt_froala/plugins/quick_format.js +89 -0
  125. data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.js +478 -0
  126. data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.min.js +7 -0
  127. data/vendor/assets/javascripts/xmt_froala/plugins/quote.js +141 -0
  128. data/vendor/assets/javascripts/xmt_froala/plugins/quote.min.js +7 -0
  129. data/vendor/assets/javascripts/xmt_froala/plugins/save.js +189 -0
  130. data/vendor/assets/javascripts/xmt_froala/plugins/save.min.js +7 -0
  131. data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.js +781 -0
  132. data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.min.js +7 -0
  133. data/vendor/assets/javascripts/xmt_froala/plugins/table.js +4194 -0
  134. data/vendor/assets/javascripts/xmt_froala/plugins/table.min.js +7 -0
  135. data/vendor/assets/javascripts/xmt_froala/plugins/url.js +194 -0
  136. data/vendor/assets/javascripts/xmt_froala/plugins/url.min.js +7 -0
  137. data/vendor/assets/javascripts/xmt_froala/plugins/video.js +2342 -0
  138. data/vendor/assets/javascripts/xmt_froala/plugins/video.min.js +7 -0
  139. data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.js +1403 -0
  140. data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.min.js +7 -0
  141. data/vendor/assets/javascripts/xmt_froala/third_party/embedly.js +543 -0
  142. data/vendor/assets/javascripts/xmt_froala/third_party/embedly.min.js +7 -0
  143. data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.js +163 -0
  144. data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.min.js +7 -0
  145. data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.js +222 -0
  146. data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.min.js +7 -0
  147. data/vendor/assets/javascripts/xmt_froala/xmt_froala.js +15172 -0
  148. data/vendor/assets/stylesheets/xmt_froala/css/font-awesome.css +2546 -0
  149. data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.min.css +7 -0
  150. data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.css +2902 -0
  151. data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.min.css +7 -0
  152. data/vendor/assets/stylesheets/xmt_froala/css/froala_style.css +413 -0
  153. data/vendor/assets/stylesheets/xmt_froala/css/froala_style.min.css +7 -0
  154. data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.css +57 -0
  155. data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.min.css +7 -0
  156. data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.css +112 -0
  157. data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.min.css +7 -0
  158. data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.css +155 -0
  159. data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.min.css +7 -0
  160. data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.css +43 -0
  161. data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.min.css +7 -0
  162. data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.css +42 -0
  163. data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.min.css +7 -0
  164. data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.css +146 -0
  165. data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.min.css +7 -0
  166. data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.css +28 -0
  167. data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.min.css +7 -0
  168. data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.css +52 -0
  169. data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.min.css +7 -0
  170. data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.css +244 -0
  171. data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.min.css +7 -0
  172. data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.css +266 -0
  173. data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.min.css +7 -0
  174. data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.css +37 -0
  175. data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.min.css +7 -0
  176. data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.css +70 -0
  177. data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.min.css +7 -0
  178. data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.css +51 -0
  179. data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.min.css +7 -0
  180. data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.css +181 -0
  181. data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.min.css +7 -0
  182. data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.css +231 -0
  183. data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.min.css +7 -0
  184. data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.css +1281 -0
  185. data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.min.css +7 -0
  186. data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.css +1281 -0
  187. data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.min.css +7 -0
  188. data/vendor/assets/stylesheets/xmt_froala/css/themes/red.css +1281 -0
  189. data/vendor/assets/stylesheets/xmt_froala/css/themes/red.min.css +7 -0
  190. data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.css +1281 -0
  191. data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.min.css +7 -0
  192. data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.css +64 -0
  193. data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.min.css +7 -0
  194. data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.css +72 -0
  195. data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.min.css +7 -0
  196. data/vendor/assets/stylesheets/xmt_froala/css/xmt_froala.css +1423 -0
  197. data/vendor/assets/stylesheets/xmt_froala/fonts/FontAwesome.otf +0 -0
  198. data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.eot +0 -0
  199. data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.svg +2671 -0
  200. data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.ttf +0 -0
  201. data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff +0 -0
  202. data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff2 +0 -0
  203. metadata +273 -0
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
3
+ * License https://froala.com/wysiwyg-editor/terms/
4
+ * Copyright 2014-2018 Froala Labs
5
+ */
6
+
7
+ !function(r){"function"==typeof define&&define.amd?define(["jquery"],r):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),r(t)}:r(window.jQuery)}(function(S){S.extend(S.FE.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent"],wordPasteModal:!0}),S.FE.PLUGINS.wordPaste=function(A){var l,i,a="word_paste";function t(e){var t=A.opts.wordAllowedStyleProps;e||(A.opts.wordAllowedStyleProps=[]),0===i.indexOf("<colgroup>")&&(i="<table>"+i+"</table>"),i=function(e,t){!function(e){for(var t=e.split("v:shape"),r=1;r<t.length;r++){var i=t[r],n=i.split(' id="')[1];if(n&&1<n.length){n=n.split('"')[0];var l=i.split(' o:spid="')[1];l&&1<l.length&&(l=l.split('"')[0],c[n]=l)}}}(e=e.replace(/[.\s\S\w\W<>]*(<html[^>]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));var r=(new DOMParser).parseFromString(e,"text/html"),i=r.head,n=r.body,a=function(e){var t={},r=e.getElementsByTagName("style");if(r.length){var i=r[0],n=i.innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);if(n)for(var l=0;l<n.length;l++){var a=n[l],s=a.replace(/([\S ]+\s+){[\s\S]+?}/gi,"$1"),o=a.replace(/[\S ]+\s+{([\s\S]+?)}/gi,"$1");s=s.replace(/^[\s]|[\s]$/gm,""),o=o.replace(/^[\s]|[\s]$/gm,""),s=s.replace(/\n|\r|\n\r/g,""),o=o.replace(/\n|\r|\n\r/g,"");for(var d=s.split(", "),g=0;g<d.length;g++)t[d[g]]=o}}return t}(i);g(n,function(e){if(e.nodeType==Node.TEXT_NODE&&/\n|\u00a0|\r/.test(e.data)){if(!/\S| /.test(e.data))return e.data==S.FE.UNICODE_NBSP?(e.data="\u200b",!0):1==e.data.length&&10==e.data.charCodeAt(0)?(e.data=" ",!0):(y(e),!1);e.data=e.data.replace(/\n|\r/gi," ")}return!0}),g(n,function(e){return e.nodeType!=Node.ELEMENT_NODE||"V:IMAGEDATA"!=e.tagName&&"IMG"!=e.tagName||function(e,t){if(!t)return;var r;if("IMG"==e.tagName){var i=e.getAttribute("src");if(!i||-1==i.indexOf("file://"))return;if(0===i.indexOf("file://")&&A.helpers.isURL(e.getAttribute("alt")))return e.setAttribute("src",e.getAttribute("alt"));(r=c[e.getAttribute("v:shapes")])||(r=e.getAttribute("v:shapes"))}else r=e.parentNode.getAttribute("o:spid");if(e.removeAttribute("height"),!r)return;n=t,p={},u(n,"i","\\shppict"),u(n,"s","\\shp{");var n;var l=p[r.substring(7)];if(l){var a=function(e){for(var t=e.match(/[0-9a-f]{2}/gi),r=[],i=0;i<t.length;i++)r.push(String.fromCharCode(parseInt(t[i],16)));var n=r.join("");return btoa(n)}(l.image_hex),s="data:"+l.image_type+";base64,"+a;"IMG"===e.tagName?(e.src=s,e.setAttribute("data-fr-image-pasted",!0)):S(e.parentNode).before('<img data-fr-image-pasted="true" src="'+s+'" style="'+e.parentNode.getAttribute("style")+'">').remove()}}(e,t),!0});for(var l=n.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),s=l.length-1;0<=s;s--)l[s].previousElementSibling&&"LI"===l[s].previousElementSibling.tagName&&l[s].previousElementSibling.appendChild(l[s]);g(n,function(t){if(t.nodeType==Node.TEXT_NODE)return t.data=t.data.replace(/<br>(\n|\r)/gi,"<br>"),!1;if(t.nodeType==Node.ELEMENT_NODE){if(C(t)){var r=t.parentNode,i=t.previousSibling,n=function e(t,r){var i=/[0-9a-zA-Z]./gi;var n=!1;t.firstElementChild&&t.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstChild&&!(n=n||i.test(t.firstElementChild.firstElementChild.firstChild.data||""))&&t.firstElementChild.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstElementChild.firstChild&&(n=n||i.test(t.firstElementChild.firstElementChild.firstElementChild.firstChild.data||""));var l=n?"ol":"ul";var a=m(t);var s="<"+l+"><li>"+h(t,r);var o=t.nextElementSibling;var d=t.parentNode;y(t);t=null;for(;o&&C(o);){var g=o.previousElementSibling,u=m(o);if(a<u)s+=e(o,r).outerHTML;else{if(u<a)break;s+="</li><li>"+h(o,r)}if(a=u,o.previousElementSibling||o.nextElementSibling||o.parentNode){var f=o;o=o.nextElementSibling,y(f),f=null}else o=g?g.nextElementSibling:d.firstElementChild}s+="</li></"+l+">";var p=document.createElement("div");p.innerHTML=s;var c=p.firstElementChild;return c}(t,a),l=null;return(l=i?i.nextSibling:r.firstChild)?r.insertBefore(n,l):r.appendChild(n),!1}return f(t,a)}return t.nodeType!=Node.COMMENT_NODE||(y(t),!1)}),g(n,function(e){if(e.nodeType==Node.ELEMENT_NODE){var t=e.tagName;if(!e.innerHTML&&-1==["BR","IMG"].indexOf(t)){for(var r=e.parentNode;r&&(y(e),!(e=r).innerHTML);)r=e.parentNode;return!1}!function(e){var t=e.getAttribute("style");if(!t)return;(t=w(t))&&";"!=t.slice(-1)&&(t+=";");var r=t.match(/(^|\S+?):.+?;{1,1}/gi);if(!r)return;for(var i={},n=0;n<r.length;n++){var l=r[n],a=l.split(":");2==a.length&&("text-align"==a[0]&&"SPAN"==e.tagName||(i[a[0]]=a[1]))}var s="";for(var o in i)if(i.hasOwnProperty(o)){if("font-size"==o&&"pt;"==i[o].slice(-3)){var d=null;try{d=parseFloat(i[o].slice(0,-3),10)}catch(g){}d&&(d=Math.round(1.33*d),i[o]=d+"px;")}s+=o+":"+i[o]}s&&e.setAttribute("style",s)}(e)}return!0});var o=n.outerHTML,d=A.opts.htmlAllowedStyleProps;return A.opts.htmlAllowedStyleProps=A.opts.wordAllowedStyleProps,o=A.clean.html(o,A.opts.wordDeniedTags,A.opts.wordDeniedAttrs,!1),A.opts.htmlAllowedStyleProps=d,o}(i=i.replace(/<span[\n\r ]*style='mso-spacerun:yes'>([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var r="",i=0;i++<t.length;)r+="&nbsp;";return r}),A.paste.getRtfClipboard());var r=A.doc.createElement("DIV");r.innerHTML=i,A.html.cleanBlankSpaces(r),i=r.innerHTML,i=(i=A.paste.cleanEmptyTagsAndDivs(i)).replace(/\u200b/g,""),A.modals.hide(a),A.paste.clean(i,!0,!0),A.opts.wordAllowedStyleProps=t}function y(e){e.parentNode&&e.parentNode.removeChild(e)}function g(e,t){if(t(e))for(var r=e.firstChild;r;){var i=r,n=r.previousSibling;r=r.nextSibling,g(i,t),i.previousSibling||i.nextSibling||i.parentNode||!r||n==r.previousSibling||!r.parentNode?i.previousSibling||i.nextSibling||i.parentNode||!r||r.previousSibling||r.nextSibling||r.parentNode||(n?r=n.nextSibling?n.nextSibling.nextSibling:null:e.firstChild&&(r=e.firstChild.nextSibling)):r=n?n.nextSibling:e.firstChild}}function C(e){if(!e.getAttribute("style")||!/mso-list:[\s]*l/gi.test(e.getAttribute("style").replace(/\n/gi,"")))return!1;try{if(!e.querySelector('[style="mso-list:Ignore"]'))return!1}catch(t){return!1}return!0}function m(e){return e.getAttribute("style").replace(/\n/gi,"").replace(/.*level([0-9]+?).*/gi,"$1")}function h(e,t){var r=e.cloneNode(!0);if(-1!=["H1","H2","H3","H4","H5","H6"].indexOf(e.tagName)){var i=document.createElement(e.tagName.toLowerCase());i.setAttribute("style",e.getAttribute("style")),i.innerHTML=r.innerHTML,r.innerHTML=i.outerHTML}g(r,function(e){return e.nodeType==Node.ELEMENT_NODE&&("mso-list:Ignore"==e.getAttribute("style")&&e.parentNode.removeChild(e),f(e,t)),!0});var n=r.innerHTML;return n=n.replace(/<!--[\s\S]*?-->/gi,"")}function v(e,t){for(var r=document.createElement(t),i=0;i<e.attributes.length;i++){var n=e.attributes[i].name;r.setAttribute(n,e.getAttribute(n))}return r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e),r}function N(e){var t=e.parentNode,r=e.getAttribute("align");r&&(t&&"TD"==t.tagName?t.setAttribute("style",t.getAttribute("style")+"text-align:"+r+";"):e.style["text-align"]=r,e.removeAttribute("align"))}function w(e){return e.replace(/\n|\r|\n\r|&quot;/g,"")}function x(e,t,r){if(t){var i=e.getAttribute("style");i&&";"!=i.slice(-1)&&(i+=";"),t&&";"!=t.slice(-1)&&(t+=";"),t=t.replace(/\n/gi,"");var n=null;n=r?(i||"")+t:t+(i||""),e.setAttribute("style",n)}}var p=null;function u(e,t,r){for(var i=e.split(r),n=1;n<i.length;n++){var l=i[n];if(1<(l=l.split("shplid")).length){l=l[1];for(var a="",s=0;s<l.length&&"\\"!=l[s]&&"{"!=l[s]&&" "!=l[s]&&"\r"!=l[s]&&"\n"!=l[s];)a+=l[s],s++;var o=l.split("bliptag");if(o&&o.length<2)continue;var d=null;if(-1!=o[0].indexOf("pngblip")?d="image/png":-1!=o[0].indexOf("jpegblip")&&(d="image/jpeg"),!d)continue;var g,u=o[1].split("}");if(u&&u.length<2)continue;if(2<u.length&&-1!=u[0].indexOf("blipuid"))g=u[1].split(" ");else{if((g=u[0].split(" "))&&g.length<2)continue;g.shift()}var f=g.join("");p[t+a]={image_hex:f,image_type:d}}}}function f(e,t){var r=e.tagName,i=r.toLowerCase();e.firstElementChild&&("I"==e.firstElementChild.tagName?v(e.firstElementChild,"em"):"B"==e.firstElementChild.tagName&&v(e.firstElementChild,"strong"));if(-1!=["SCRIPT","APPLET","EMBED","NOFRAMES","NOSCRIPT"].indexOf(r))return y(e),!1;var n=-1,l=["META","LINK","XML","ST1:","O:","W:","FONT"];for(n=0;n<l.length;n++)if(-1!=r.indexOf(l[n]))return e.innerHTML&&(e.outerHTML=e.innerHTML),y(e),!1;if("TD"!=r){var a=e.getAttribute("class");if(t&&a){var s=(a=w(a)).split(" ");for(n=0;n<s.length;n++){var o=[],d="."+s[n];o.push(d),d=i+d,o.push(d);for(var g=0;g<o.length;g++)t[o[g]]&&x(e,t[o[g]])}e.removeAttribute("class")}t&&t[i]&&x(e,t[i])}if(-1!=["P","H1","H2","H3","H4","H5","H6","PRE"].indexOf(r)){var u=e.getAttribute("class");if(u&&(t&&t[r.toLowerCase()+"."+u]&&x(e,t[r.toLowerCase()+"."+u]),-1!=u.toLowerCase().indexOf("mso"))){var f=w(u);(f=f.replace(/[0-9a-z-_]*mso[0-9a-z-_]*/gi,""))?e.setAttribute("class",f):e.removeAttribute("class")}var p=e.getAttribute("style");if(p){var c=p.match(/text-align:.+?[; "]{1,1}/gi);c&&c[c.length-1].replace(/(text-align:.+?[; "]{1,1})/gi,"$1")}N(e)}if("TR"==r&&function(e,t){A.node.clearAttributes(e);for(var r=e.firstElementChild,i=0,n=!1,l=null;r;){r.firstElementChild&&-1!=r.firstElementChild.tagName.indexOf("W:")&&(r.innerHTML=r.firstElementChild.innerHTML),(l=r.getAttribute("width"))||n||(n=!0),i+=parseInt(l,10),(!r.firstChild||r.firstChild&&r.firstChild.data==S.FE.UNICODE_NBSP)&&(r.firstChild&&y(r.firstChild),r.innerHTML="<br>");for(var a=r.firstElementChild,s=1==r.children.length;a;)"P"!=a.tagName||C(a)||s&&N(a),a=a.nextElementSibling;if(t){var o=r.getAttribute("class");if(o){var d=(o=w(o)).match(/xl[0-9]+/gi);if(d){var g="."+d[0];t[g]&&x(r,t[g])}}t.td&&x(r,t.td)}var u=r.getAttribute("style");u&&(u=w(u))&&";"!=u.slice(-1)&&(u+=";");var f=r.getAttribute("valign");if(!f&&u){var p=u.match(/vertical-align:.+?[; "]{1,1}/gi);p&&(f=p[p.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var c=null;if(u){var m=u.match(/text-align:.+?[; "]{1,1}/gi);m&&(c=m[m.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"==c&&(c=null)}var h=null;if(u){var v=u.match(/background:.+?[; "]{1,1}/gi);v&&(h=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var b=r.getAttribute("colspan"),E=r.getAttribute("rowspan");b&&r.setAttribute("colspan",b),E&&r.setAttribute("rowspan",E),f&&(r.style["vertical-align"]=f),c&&(r.style["text-align"]=c),h&&(r.style["background-color"]=h),l&&r.setAttribute("width",l),r=r.nextElementSibling}for(r=e.firstElementChild;r;)l=r.getAttribute("width"),n?r.removeAttribute("width"):r.setAttribute("width",100*parseInt(l,10)/i+"%"),r=r.nextElementSibling}(e,t),"A"!=r||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"TD"!=r&&"TH"!=r||e.innerHTML||(e.innerHTML="<br>"),"TABLE"==r&&(e.style.width="100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!=e.getAttribute("style").toLowerCase().indexOf("mso")){var m=w(e.getAttribute("style"));(m=m.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",m):e.removeAttribute("style")}return!0}var c={};return{_init:function(){A.events.on("paste.wordPaste",function(e){return i=e,A.opts.wordPasteModal?function(){if(!l){var e='<h4><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 74.95 73.23" style="height: 25px; vertical-align: text-bottom; margin-right: 5px; display: inline-block"><defs><style>.a{fill:#2a5699;}.b{fill:#fff;}</style></defs><path class="a" d="M615.15,827.22h5.09V834c9.11.05,18.21-.09,27.32.05a2.93,2.93,0,0,1,3.29,3.25c.14,16.77,0,33.56.09,50.33-.09,1.72.17,3.63-.83,5.15-1.24.89-2.85.78-4.3.84-8.52,0-17,0-25.56,0v6.81h-5.32c-13-2.37-26-4.54-38.94-6.81q0-29.8,0-59.59c13.05-2.28,26.11-4.5,39.17-6.83Z" transform="translate(-575.97 -827.22)"/><path class="b" d="M620.24,836.59h28.1v54.49h-28.1v-6.81h22.14v-3.41H620.24v-4.26h22.14V873.2H620.24v-4.26h22.14v-3.41H620.24v-4.26h22.14v-3.41H620.24v-4.26h22.14v-3.41H620.24V846h22.14v-3.41H620.24Zm-26.67,15c1.62-.09,3.24-.16,4.85-.25,1.13,5.75,2.29,11.49,3.52,17.21,1-5.91,2-11.8,3.06-17.7,1.7-.06,3.41-.15,5.1-.26-1.92,8.25-3.61,16.57-5.71,24.77-1.42.74-3.55,0-5.24.09-1.13-5.64-2.45-11.24-3.47-16.9-1,5.5-2.29,10.95-3.43,16.42q-2.45-.13-4.92-.3c-1.41-7.49-3.07-14.93-4.39-22.44l4.38-.18c.88,5.42,1.87,10.82,2.64,16.25,1.2-5.57,2.43-11.14,3.62-16.71Z" transform="translate(-575.97 -827.22)"/></svg> '+A.language.translate("Word Paste Detected")+"</h4>",t=(n='<div class="fr-word-paste-modal" style="padding: 20px 20px 10px 20px;">',n+='<p style="text-align: left;">'+A.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"</p>",n+='<div style="text-align: right; margin-top: 50px;"><button class="fr-remove-word fr-command">'+A.language.translate("Clean")+'</button> <button class="fr-keep-word fr-command">'+A.language.translate("Keep")+"</button></div>",n+="</div>"),r=A.modals.create(a,e,t),i=r.$body;l=r.$modal,r.$modal.addClass("fr-middle"),A.events.bindClick(i,"button.fr-remove-word",function(){var e=l.data("instance")||A;e.wordPaste.clean()}),A.events.bindClick(i,"button.fr-keep-word",function(){var e=l.data("instance")||A;e.wordPaste.clean(!0)}),A.events.$on(S(A.o_win),"resize",function(){A.modals.resize(a)})}var n;A.modals.show(a),A.modals.resize(a)}():t(!0),!1})},clean:t}}});
@@ -0,0 +1,543 @@
1
+ /*!
2
+ * froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
3
+ * License https://froala.com/wysiwyg-editor/terms/
4
+ * Copyright 2014-2018 Froala Labs
5
+ */
6
+
7
+ (function (factory) {
8
+ if (typeof define === 'function' && define.amd) {
9
+ // AMD. Register as an anonymous module.
10
+ define(['jquery'], factory);
11
+ } else if (typeof module === 'object' && module.exports) {
12
+ // Node/CommonJS
13
+ module.exports = function( root, jQuery ) {
14
+ if ( jQuery === undefined ) {
15
+ // require('jQuery') returns a factory that requires window to
16
+ // build a jQuery instance, we normalize how we use modules
17
+ // that require this pattern but the window provided is a noop
18
+ // if it's defined (how jquery works)
19
+ if ( typeof window !== 'undefined' ) {
20
+ jQuery = require('jquery');
21
+ }
22
+ else {
23
+ jQuery = require('jquery')(root);
24
+ }
25
+ }
26
+ return factory(jQuery);
27
+ };
28
+ } else {
29
+ // Browser globals
30
+ factory(window.jQuery);
31
+ }
32
+ }(function ($) {
33
+
34
+
35
+
36
+ $.extend($.FE.POPUP_TEMPLATES, {
37
+ 'embedly.insert': '[_BUTTONS_][_URL_LAYER_]',
38
+ 'embedly.edit': '[_BUTTONS_]'
39
+ })
40
+
41
+ $.extend($.FE.DEFAULTS, {
42
+ embedlyKey: null,
43
+ embedlyInsertButtons: ['embedlyBack', '|'],
44
+ embedlyEditButtons: ['embedlyRemove'],
45
+ embedlyScriptPath: 'https://cdn.embedly.com/widgets/platform.js'
46
+ });
47
+
48
+ $.FE.PLUGINS.embedly = function (editor) {
49
+
50
+ function _doInit () {
51
+ // Remove any fr-uploading / fr-error images.
52
+ editor.events.on('html.processGet', _cleanOnGet);
53
+
54
+ editor.events.$on(editor.$el, 'click touchend', 'div.fr-embedly', _edit);
55
+
56
+ editor.events.on('mousedown window.mousedown', _markExit);
57
+ editor.events.on('window.touchmove', _unmarkExit);
58
+ editor.events.on('mouseup window.mouseup', _exitEdit);
59
+
60
+ editor.events.on('commands.mousedown', function ($btn) {
61
+ if ($btn.parents('.fr-toolbar').length > 0) {
62
+ _exitEdit();
63
+ }
64
+ });
65
+
66
+ editor.events.on('blur video.hideResizer commands.undo commands.redo element.dropped', function () {
67
+ _exitEdit(true);
68
+ });
69
+
70
+ editor.events.on('element.beforeDrop', function ($el) {
71
+ if ($el.hasClass('fr-embedly')) {
72
+ $el.html($el.attr('data-original-embed'));
73
+ return $el;
74
+ }
75
+ })
76
+
77
+ editor.events.on('keydown', function (e) {
78
+ var key_code = e.which;
79
+
80
+ if ($current_embed && (key_code == $.FE.KEYCODE.BACKSPACE || key_code == $.FE.KEYCODE.DELETE)) {
81
+ e.preventDefault();
82
+ remove();
83
+
84
+ return false;
85
+ }
86
+
87
+ if ($current_embed && key_code == $.FE.KEYCODE.ESC) {
88
+ _exitEdit(true);
89
+ e.preventDefault();
90
+
91
+ return false;
92
+ }
93
+
94
+ if ($current_embed && key_code != $.FE.KEYCODE.F10 && !editor.keys.isBrowserAction(e)) {
95
+ e.preventDefault();
96
+
97
+ return false;
98
+ }
99
+ }, true);
100
+
101
+ // ESC from accessibility.
102
+ editor.events.on('toolbar.esc', function () {
103
+ if ($current_embed) {
104
+ editor.events.disableBlur();
105
+ editor.events.focus();
106
+
107
+ return false;
108
+ }
109
+ }, true);
110
+
111
+ // focusEditor from accessibility.
112
+ editor.events.on('toolbar.focusEditor', function () {
113
+ if ($current_embed) {
114
+
115
+ return false;
116
+ }
117
+ }, true);
118
+
119
+ // Keep Embedly structure in undo stack.
120
+ editor.events.on('snapshot.after', function (snapshot) {
121
+ var div = editor.doc.createElement('div');
122
+ div.innerHTML = snapshot.html;
123
+ _cleanOnGet(div);
124
+
125
+ snapshot.html = div.innerHTML;
126
+ });
127
+
128
+ // Update card size.
129
+ if (editor.win.embedly) {
130
+ editor.win.embedly('on', 'card.resize', function(iframe){
131
+ var $card = $(iframe);
132
+ var $card_parent = $card.parents('.fr-embedly');
133
+
134
+ $card_parent
135
+ .attr('contenteditable', false)
136
+ .attr('draggable', true)
137
+ .css('height', $card.height())
138
+ .addClass('fr-draggable');
139
+ });
140
+ }
141
+
142
+ _initInsertPopup(true);
143
+ }
144
+
145
+ function _init () {
146
+ if (!editor.$wp) return false;
147
+
148
+ if (typeof embedly !== 'undefined') {
149
+ _doInit();
150
+ }
151
+ else {
152
+ if (!editor.shared.embedlyLoaded) editor.shared.embedlyCallbacks = [];
153
+ editor.shared.embedlyCallbacks.push(_doInit);
154
+
155
+ if (!editor.shared.embedlyLoaded) {
156
+ editor.shared.embedlyLoaded = true;
157
+
158
+ // Init SCAYT.
159
+ var script = editor.doc.createElement('script');
160
+ script.type = 'text/javascript';
161
+ script.src = editor.opts.embedlyScriptPath;
162
+ script.innerText = '';
163
+ script.onload = function () {
164
+ /*global SCAYT */
165
+ for (var i = 0; i < editor.shared.embedlyCallbacks.length; i++) {
166
+ editor.shared.embedlyCallbacks[i]();
167
+ }
168
+ }
169
+
170
+ editor.doc.getElementsByTagName('head')[0].appendChild(script);
171
+ }
172
+ }
173
+ }
174
+
175
+ var $current_embed;
176
+ function _edit (e) {
177
+ $current_embed = $(this);
178
+
179
+ _repositionResizer();
180
+ _showEditPopup();
181
+ }
182
+
183
+ function _normalize () {
184
+ // Make it draggable.
185
+ var els = editor.el.querySelectorAll('.fr-embedly');
186
+ for (var i = 0; i < els.length; i++) {
187
+ if (!editor.node.hasClass(els[i], 'fr-draggable')) {
188
+ els[i].className += ' fr-draggable';
189
+ }
190
+ els[i].setAttribute('contenteditable', false);
191
+ els[i].setAttribute('draggable', true);
192
+ }
193
+ }
194
+
195
+ var $embedly_resizer;
196
+ var $overlay;
197
+
198
+ function _initEditPopup () {
199
+ // embedly buttons.
200
+ var embedly_buttons = '';
201
+
202
+ if (editor.opts.embedlyEditButtons.length > 0) {
203
+ embedly_buttons += '<div class="fr-buttons">';
204
+ embedly_buttons += editor.button.buildList(editor.opts.embedlyEditButtons);
205
+ embedly_buttons += '</div>';
206
+
207
+ var template = {
208
+ buttons: embedly_buttons
209
+ }
210
+
211
+ var $popup = editor.popups.create('embedly.edit', template);
212
+
213
+ editor.events.$on(editor.$wp, 'scroll.emebdly-edit', function () {
214
+ if ($current_embed && editor.popups.isVisible('embedly.edit')) {
215
+
216
+ editor.events.disableBlur();
217
+ _editEmbed($current_embed);
218
+ }
219
+ });
220
+
221
+ return $popup;
222
+ }
223
+
224
+ return false;
225
+ }
226
+
227
+ function _editEmbed ($embed) {
228
+ _edit.call($embed.get(0));
229
+ }
230
+
231
+ /**
232
+ * Show the embedly edit popup.
233
+ */
234
+ function _showEditPopup () {
235
+ var $popup = editor.popups.get('embedly.edit');
236
+
237
+ if (!$popup) $popup = _initEditPopup();
238
+
239
+ if ($popup) {
240
+ editor.popups.setContainer('embedly.edit', editor.$sc);
241
+ editor.popups.refresh('embedly.edit');
242
+
243
+ var left = $current_embed.offset().left + $current_embed.outerWidth() / 2;
244
+ var top = $current_embed.offset().top + $current_embed.outerHeight();
245
+
246
+ editor.popups.show('embedly.edit', left, top, $current_embed.outerHeight());
247
+ }
248
+ }
249
+
250
+ function _initResizer () {
251
+ var doc;
252
+
253
+ // No shared embedly resizer.
254
+ if (!editor.shared.$embedly_resizer) {
255
+
256
+ // Create shared embedly resizer.
257
+ editor.shared.$embedly_resizer = $('<div class="fr-embedly-resizer"></div>');
258
+ $embedly_resizer = editor.shared.$embedly_resizer;
259
+
260
+ // Bind mousedown event shared.
261
+ editor.events.$on($embedly_resizer, 'mousedown', function (e) {
262
+ e.stopPropagation();
263
+ }, true);
264
+ }
265
+ else {
266
+ $embedly_resizer = editor.shared.$embedly_resizer;
267
+ $overlay = editor.shared.$embedly_overlay;
268
+
269
+ editor.events.on('destroy', function () {
270
+ $embedly_resizer.appendTo($('body:first'));
271
+ }, true);
272
+ }
273
+
274
+ // Shared destroy.
275
+ editor.events.on('shared.destroy', function () {
276
+ $embedly_resizer.html('').removeData().remove();
277
+ $embedly_resizer = null;
278
+ }, true);
279
+ }
280
+
281
+ /**
282
+ * Reposition resizer.
283
+ */
284
+ function _repositionResizer () {
285
+ if (!$embedly_resizer) _initResizer();
286
+
287
+ (editor.$wp || editor.$sc).append($embedly_resizer);
288
+ $embedly_resizer.data('instance', editor);
289
+
290
+ $embedly_resizer
291
+ .css('top', (editor.opts.iframe ? $current_embed.offset().top - 1 + editor.$iframe.position().top : $current_embed.offset().top - editor.$wp.offset().top - 1) + editor.$wp.scrollTop())
292
+ .css('left', (editor.opts.iframe ? $current_embed.offset().left - 1 : $current_embed.offset().left - editor.$wp.offset().left - 1) + editor.$wp.scrollLeft())
293
+ .css('width', $current_embed.outerWidth())
294
+ .css('height', $current_embed.height())
295
+ .addClass('fr-active')
296
+ }
297
+
298
+ function _cleanOnGet (el) {
299
+ // Tag is image.
300
+ if (el && editor.node.hasClass(el, 'fr-embedly')) {
301
+ el.innerHTML = el.getAttribute('data-original-embed');
302
+ el.removeAttribute('draggable');
303
+ el.removeAttribute('contenteditable');
304
+ el.setAttribute('class', (el.getAttribute('class') || '').replace('fr-draggable', ''));
305
+ }
306
+
307
+ // Look for inner nodes that might be in a similar case.
308
+ else if (el && el.nodeType == Node.ELEMENT_NODE) {
309
+ var els = el.querySelectorAll('.fr-embedly');
310
+
311
+ for (var i = 0; i < els.length; i++) {
312
+ _cleanOnGet(els[i]);
313
+ }
314
+ }
315
+ }
316
+
317
+ function _initInsertPopup (delayed) {
318
+ if (delayed) {
319
+ editor.popups.onRefresh('embedly.insert', _refreshInsertPopup);
320
+
321
+ return true;
322
+ }
323
+
324
+ var buttons = '';
325
+
326
+ if (editor.opts.embedlyInsertButtons.length > 0) {
327
+ buttons += '<div class="fr-buttons">';
328
+ buttons += editor.button.buildList(editor.opts.embedlyInsertButtons);
329
+ buttons += '</div>';
330
+ }
331
+
332
+ // Image by url layer.
333
+ var url_layer = '';
334
+ url_layer = '<div class="fr-embedly-layer fr-active fr-layer" id="fr-embedly-layer-' + editor.id + '"><div class="fr-input-line"><input id="fr-embedly-layer-text-' + editor.id + '" type="text" placeholder="' + editor.language.translate('Paste in a URL to embed') + '" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="embedlyInsert" tabIndex="2" role="button">' + editor.language.translate('Insert') + '</button></div></div>'
335
+
336
+ var template = {
337
+ buttons: buttons,
338
+ url_layer: url_layer
339
+ }
340
+
341
+ // Set the template in the popup.
342
+ var $popup = editor.popups.create('embedly.insert', template);
343
+
344
+ return $popup;
345
+ }
346
+
347
+ /**
348
+ * Refresh the video insert popup.
349
+ */
350
+ function _refreshInsertPopup () {
351
+ var $popup = editor.popups.get('embedly.insert');
352
+
353
+ var $url_input = $popup.find('.fr-embedly-layer input');
354
+ $url_input.val('').trigger('change');
355
+ }
356
+
357
+ function showInsertPopup () {
358
+ var $btn = editor.$tb.find('.fr-command[data-cmd="embedly"]');
359
+
360
+ var $popup = editor.popups.get('embedly.insert');
361
+
362
+ if (!$popup) $popup = _initInsertPopup();
363
+
364
+ if (!$popup.hasClass('fr-active')) {
365
+ editor.popups.refresh('embedly.insert');
366
+ editor.popups.setContainer('embedly.insert', editor.$tb);
367
+
368
+ if ($btn.is(':visible')) {
369
+ var left = $btn.offset().left + $btn.outerWidth() / 2;
370
+ var top = $btn.offset().top + (editor.opts.toolbarBottom ? 10 : $btn.outerHeight() - 10);
371
+ editor.popups.show('embedly.insert', left, top, $btn.outerHeight());
372
+ }
373
+ else {
374
+ editor.position.forSelection($popup);
375
+ editor.popups.show('embedly.insert');
376
+ }
377
+ }
378
+ }
379
+
380
+ function insert () {
381
+ var $popup = editor.popups.get('embedly.insert');
382
+ var $input = $popup.find('.fr-embedly-layer input');
383
+
384
+ add($input.val());
385
+ }
386
+
387
+ function add (url) {
388
+ if (url.length) {
389
+ var embed = '<a href=\'' + url + '\' class=\'embedly-card\'' + (editor.opts.embedlyKey ? ' data-card-key=\'' + editor.opts.embedlyKey + '\'' : '') + '></a>';
390
+
391
+ editor.html.insert('<div class="fr-embedly fr-draggable" draggable="true" contenteditable="false" data-original-embed="' + embed + '">' + embed + '</div>');
392
+
393
+ editor.popups.hideAll();
394
+ }
395
+ }
396
+
397
+ function remove () {
398
+ if ($current_embed) {
399
+ if (editor.events.trigger('embedly.beforeRemove', [$current_embed]) !== false) {
400
+ var $embed = $current_embed;
401
+ editor.popups.hideAll();
402
+
403
+ _exitEdit(true);
404
+
405
+ editor.selection.setBefore($embed.get(0)) || editor.selection.setAfter($embed.get(0));
406
+ $embed.remove();
407
+ editor.selection.restore();
408
+
409
+ editor.html.fillEmptyBlocks();
410
+
411
+ editor.undo.saveStep();
412
+
413
+ editor.events.trigger('video.removed', [$embed]);
414
+ }
415
+ }
416
+ }
417
+
418
+ /**
419
+ * Exit edit.
420
+ */
421
+ function _exitEdit (force_exit) {
422
+ if ($current_embed && (_canExit() || force_exit === true)) {
423
+ $embedly_resizer.removeClass('fr-active');
424
+
425
+ editor.toolbar.enable();
426
+
427
+ $current_embed.removeClass('fr-active');
428
+ $current_embed = null;
429
+
430
+ _unmarkExit();
431
+ }
432
+ }
433
+
434
+ editor.shared.embedly_exit_flag = false;
435
+
436
+ function _markExit () {
437
+ editor.shared.embedly_exit_flag = true;
438
+ }
439
+
440
+ function _unmarkExit () {
441
+ editor.shared.embedly_exit_flag = false;
442
+ }
443
+
444
+ function _canExit () {
445
+
446
+ return editor.shared.embedly_exit_flag;
447
+ }
448
+
449
+ function get () {
450
+ return $current_embed;
451
+ }
452
+
453
+ function back () {
454
+ if ($current_embed) {
455
+ editor.events.disableBlur();
456
+ $current_embed.trigger('click');
457
+ }
458
+ else {
459
+ editor.events.disableBlur();
460
+ editor.selection.restore();
461
+ editor.events.enableBlur();
462
+
463
+ editor.popups.hide('embedly.insert');
464
+ editor.toolbar.showInline();
465
+ }
466
+ }
467
+
468
+ return {
469
+ _init: _init,
470
+ showInsertPopup: showInsertPopup,
471
+ insert: insert,
472
+ remove: remove,
473
+ get: get,
474
+ add: add,
475
+ back: back
476
+ }
477
+ }
478
+
479
+ $.FE.DefineIcon('embedly', { NAME: 'share-alt' })
480
+ $.FE.RegisterCommand('embedly', {
481
+ undo: true,
482
+ focus: true,
483
+ title: 'Embed URL',
484
+ popup: true,
485
+ callback: function () {
486
+ if (!this.popups.isVisible('embedly.insert')) {
487
+ this.embedly.showInsertPopup();
488
+ }
489
+ else {
490
+ if (this.$el.find('.fr-marker').length) {
491
+ this.events.disableBlur();
492
+ this.selection.restore();
493
+ }
494
+
495
+ this.popups.hide('embedly.insert');
496
+ }
497
+ },
498
+ plugin: 'embedly'
499
+ })
500
+
501
+ $.FE.RegisterCommand('embedlyInsert', {
502
+ undo: true,
503
+ focus: true,
504
+ callback: function () {
505
+ this.embedly.insert();
506
+ }
507
+ })
508
+
509
+ // Video remove.
510
+ $.FE.DefineIcon('embedlyRemove', { NAME: 'trash' })
511
+ $.FE.RegisterCommand('embedlyRemove', {
512
+ title: 'Remove',
513
+ undo: false,
514
+ callback: function () {
515
+ this.embedly.remove();
516
+ }
517
+ })
518
+
519
+ // Video back.
520
+ $.FE.DefineIcon('embedlyBack', { NAME: 'arrow-left' });
521
+ $.FE.RegisterCommand('embedlyBack', {
522
+ title: 'Back',
523
+ undo: false,
524
+ focus: false,
525
+ back: true,
526
+ callback: function () {
527
+ this.embedly.back();
528
+ },
529
+ refresh: function ($btn) {
530
+ var $current_emebed = this.embedly.get();
531
+
532
+ if (!$current_emebed && !this.opts.toolbarInline) {
533
+ $btn.addClass('fr-hidden');
534
+ $btn.next('.fr-separator').addClass('fr-hidden');
535
+ }
536
+ else {
537
+ $btn.removeClass('fr-hidden');
538
+ $btn.next('.fr-separator').removeClass('fr-hidden');
539
+ }
540
+ }
541
+ });
542
+
543
+ }));