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(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(f){f.extend(f.FE.DEFAULTS,{fontSize:["8","9","10","11","12","14","18","24","30","36","48","60","72","96"],fontSizeSelection:!1,fontSizeDefaultSelection:"12",fontSizeUnit:"px"}),f.FE.PLUGINS.fontSize=function(r){return{apply:function(e){r.format.applyStyle("font-size",e)},refreshOnShow:function(e,t){var n=f(r.selection.element()).css("font-size");t.find(".fr-command.fr-active").removeClass("fr-active").attr("aria-selected",!1),t.find('.fr-command[data-param1="'+n+'"]').addClass("fr-active").attr("aria-selected",!0);var o=t.find(".fr-dropdown-list"),i=t.find(".fr-active").parent();i.length?o.parent().scrollTop(i.offset().top-o.offset().top-(o.parent().outerHeight()/2-i.outerHeight()/2)):o.parent().scrollTop(0)},refresh:function(e){if(r.opts.fontSizeSelection){var t=r.helpers.getPX(f(r.selection.element()).css("font-size"));e.find("> span").text(t)}}}},f.FE.RegisterCommand("fontSize",{type:"dropdown",title:"Font Size",displaySelection:function(e){return e.opts.fontSizeSelection},displaySelectionWidth:30,defaultSelection:function(e){return e.opts.fontSizeDefaultSelection},html:function(){for(var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.fontSize,n=0;n<t.length;n++){var o=t[n];e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="fontSize" data-param1="'+o+this.opts.fontSizeUnit+'" title="'+o+'">'+o+"</a></li>"}return e+="</ul>"},callback:function(e,t){this.fontSize.apply(t)},refresh:function(e){this.fontSize.refresh(e)},refreshOnShow:function(e,t){this.fontSize.refreshOnShow(e,t)},plugin:"fontSize"}),f.FE.DefineIcon("fontSize",{NAME:"text-height"})});
@@ -0,0 +1,430 @@
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
+ 'forms.edit': '[_BUTTONS_]',
38
+ 'forms.update': '[_BUTTONS_][_TEXT_LAYER_]'
39
+ })
40
+
41
+ $.extend($.FE.DEFAULTS, {
42
+ formEditButtons: ['inputStyle', 'inputEdit'],
43
+ formStyles: {
44
+ 'fr-rounded': 'Rounded',
45
+ 'fr-large': 'Large'
46
+ },
47
+ formMultipleStyles: true,
48
+ formUpdateButtons: ['inputBack', '|']
49
+ })
50
+
51
+ $.FE.PLUGINS.forms = function (editor) {
52
+ var current_input;
53
+
54
+ /**
55
+ * Input mousedown.
56
+ */
57
+ function _inputMouseDown (e) {
58
+ e.preventDefault();
59
+ editor.selection.clear();
60
+ $(this).data('mousedown', true);
61
+ }
62
+
63
+ /**
64
+ * Mouseup on the input.
65
+ */
66
+ function _inputMouseUp (e) {
67
+
68
+ // Mousedown was made.
69
+ if ($(this).data('mousedown')) {
70
+ e.stopPropagation();
71
+ $(this).removeData('mousedown');
72
+
73
+ current_input = this;
74
+
75
+ showEditPopup(this);
76
+ }
77
+
78
+ e.preventDefault();
79
+ }
80
+
81
+ /**
82
+ * Cancel if mousedown was made on any input.
83
+ */
84
+ function _cancelSelection () {
85
+ editor.$el.find('input, textarea, button').removeData('mousedown');
86
+ }
87
+
88
+ /**
89
+ * Touch move.
90
+ */
91
+ function _inputTouchMove () {
92
+ $(this).removeData('mousedown');
93
+ }
94
+
95
+ /**
96
+ * Assign the input events.
97
+ */
98
+ function _bindEvents () {
99
+ editor.events.$on(editor.$el, editor._mousedown, 'input, textarea, button', _inputMouseDown);
100
+ editor.events.$on(editor.$el, editor._mouseup, 'input, textarea, button', _inputMouseUp);
101
+ editor.events.$on(editor.$el, 'touchmove', 'input, textarea, button', _inputTouchMove);
102
+ editor.events.$on(editor.$el, editor._mouseup, _cancelSelection);
103
+ editor.events.$on(editor.$win, editor._mouseup, _cancelSelection);
104
+
105
+ _initUpdatePopup(true);
106
+ }
107
+
108
+ /**
109
+ * Get the current button.
110
+ */
111
+ function getInput () {
112
+ if (current_input) return current_input;
113
+
114
+ return null;
115
+ }
116
+
117
+ /**
118
+ * Init the edit button popup.
119
+ */
120
+ function _initEditPopup () {
121
+
122
+ // Button edit buttons.
123
+ var buttons = '';
124
+
125
+ if (editor.opts.formEditButtons.length > 0) {
126
+ buttons = '<div class="fr-buttons">' + editor.button.buildList(editor.opts.formEditButtons) + '</div>';
127
+ }
128
+
129
+ var template = {
130
+ buttons: buttons
131
+ };
132
+
133
+ // Set the template in the popup.
134
+ var $popup = editor.popups.create('forms.edit', template);
135
+
136
+ if (editor.$wp) {
137
+ editor.events.$on(editor.$wp, 'scroll.link-edit', function () {
138
+ if (getInput() && editor.popups.isVisible('forms.edit')) {
139
+ showEditPopup(getInput());
140
+ }
141
+ });
142
+ }
143
+
144
+ return $popup;
145
+ }
146
+
147
+ /**
148
+ * Show the edit button popup.
149
+ */
150
+ function showEditPopup (input) {
151
+ var $popup = editor.popups.get('forms.edit');
152
+
153
+ if (!$popup) $popup = _initEditPopup();
154
+
155
+ current_input = input;
156
+ var $input = $(input);
157
+
158
+ editor.popups.refresh('forms.edit');
159
+
160
+ editor.popups.setContainer('forms.edit', editor.$sc);
161
+ var left = $input.offset().left + $input.outerWidth() / 2;
162
+ var top = $input.offset().top + $input.outerHeight();
163
+
164
+ editor.popups.show('forms.edit', left, top, $input.outerHeight());
165
+ }
166
+
167
+ /**
168
+ * Refresh update button popup callback.
169
+ */
170
+ function _refreshUpdateCallback () {
171
+ var $popup = editor.popups.get('forms.update');
172
+
173
+ var input = getInput();
174
+
175
+ if (input) {
176
+ var $input = $(input);
177
+
178
+ if ($input.is('button')) {
179
+ $popup.find('input[type="text"][name="text"]').val($input.text());
180
+ }
181
+ else {
182
+ $popup.find('input[type="text"][name="text"]').val($input.attr('placeholder'));
183
+ }
184
+ }
185
+
186
+ $popup.find('input[type="text"][name="text"]').trigger('change');
187
+ }
188
+
189
+ /**
190
+ * Hide update button popup callback.
191
+ */
192
+ function _hideUpdateCallback () {
193
+ current_input = null;
194
+ }
195
+
196
+ /**
197
+ * Init update button popup.
198
+ */
199
+ function _initUpdatePopup (delayed) {
200
+ if (delayed) {
201
+ editor.popups.onRefresh('forms.update', _refreshUpdateCallback);
202
+ editor.popups.onHide('forms.update', _hideUpdateCallback);
203
+
204
+ return true;
205
+ }
206
+
207
+ // Button update buttons.
208
+ var buttons = '';
209
+
210
+ if (editor.opts.formUpdateButtons.length >= 1) {
211
+ buttons = '<div class="fr-buttons">' + editor.button.buildList(editor.opts.formUpdateButtons) + '</div>';
212
+ }
213
+
214
+ var text_layer = '';
215
+ var tab_idx = 0;
216
+ text_layer = '<div class="fr-forms-text-layer fr-layer fr-active">';
217
+ text_layer += '<div class="fr-input-line"><input name="text" type="text" placeholder="Text" tabIndex="' + (++tab_idx) + '"></div>';
218
+
219
+ text_layer += '<div class="fr-action-buttons"><button class="fr-command fr-submit" data-cmd="updateInput" href="#" tabIndex="' + (++tab_idx) + '" type="button">' + editor.language.translate('Update') + '</button></div></div>'
220
+
221
+ var template = {
222
+ buttons: buttons,
223
+ text_layer: text_layer
224
+ }
225
+
226
+ // Set the template in the popup.
227
+ var $popup = editor.popups.create('forms.update', template);
228
+
229
+ return $popup;
230
+ }
231
+
232
+ /**
233
+ * Show the button update popup.
234
+ */
235
+ function showUpdatePopup () {
236
+ var input = getInput();
237
+
238
+ if (input) {
239
+ var $input = $(input);
240
+
241
+ var $popup = editor.popups.get('forms.update');
242
+
243
+ if (!$popup) $popup = _initUpdatePopup();
244
+
245
+ if (!editor.popups.isVisible('forms.update')) {
246
+ editor.popups.refresh('forms.update');
247
+ }
248
+
249
+ editor.popups.setContainer('forms.update', editor.$sc);
250
+ var left = $input.offset().left + $input.outerWidth() / 2;
251
+ var top = $input.offset().top + $input.outerHeight();
252
+
253
+ editor.popups.show('forms.update', left, top, $input.outerHeight());
254
+ }
255
+ }
256
+
257
+ /**
258
+ * Apply specific style.
259
+ */
260
+ function applyStyle (val, formStyles, multipleStyles) {
261
+ if (typeof formStyles == 'undefined') formStyles = editor.opts.formStyles;
262
+
263
+ if (typeof multipleStyles == 'undefined') multipleStyles = editor.opts.formMultipleStyles;
264
+
265
+ var input = getInput();
266
+
267
+ if (!input) return false;
268
+
269
+ // Remove multiple styles.
270
+ if (!multipleStyles) {
271
+ var styles = Object.keys(formStyles);
272
+ styles.splice(styles.indexOf(val), 1);
273
+ $(input).removeClass(styles.join(' '));
274
+ }
275
+
276
+ $(input).toggleClass(val);
277
+ }
278
+
279
+ /**
280
+ * Back button in update button popup.
281
+ */
282
+ function back () {
283
+ editor.events.disableBlur();
284
+ editor.selection.restore();
285
+ editor.events.enableBlur();
286
+
287
+ var input = getInput();
288
+
289
+ if (input && editor.$wp) {
290
+ if (input.tagName == 'BUTTON') editor.selection.restore();
291
+ showEditPopup(input);
292
+ }
293
+ }
294
+
295
+ /**
296
+ * Hit the update button in the input popup.
297
+ */
298
+ function updateInput () {
299
+ var $popup = editor.popups.get('forms.update');
300
+
301
+ var input = getInput();
302
+
303
+ if (input) {
304
+ var $input = $(input);
305
+ var val = $popup.find('input[type="text"][name="text"]').val() || '';
306
+
307
+ if (val.length) {
308
+ if ($input.is('button')) {
309
+ $input.text(val);
310
+ }
311
+ else {
312
+ $input.attr('placeholder', val);
313
+ }
314
+ }
315
+
316
+ editor.popups.hide('forms.update');
317
+ showEditPopup(input);
318
+ }
319
+ }
320
+
321
+ /**
322
+ * Initialize.
323
+ */
324
+ function _init () {
325
+
326
+ // Bind input events.
327
+ _bindEvents();
328
+
329
+ // Prevent form submit.
330
+ editor.events.$on(editor.$el, 'submit', 'form', function (e) {
331
+ e.preventDefault();
332
+
333
+ return false;
334
+ })
335
+ }
336
+
337
+ return {
338
+ _init: _init,
339
+ updateInput: updateInput,
340
+ getInput: getInput,
341
+ applyStyle: applyStyle,
342
+ showUpdatePopup: showUpdatePopup,
343
+ showEditPopup: showEditPopup,
344
+ back: back
345
+ }
346
+ }
347
+
348
+ // Register command to update input.
349
+ $.FE.RegisterCommand('updateInput', {
350
+ undo: false,
351
+ focus: false,
352
+ title: 'Update',
353
+ callback: function () {
354
+ this.forms.updateInput();
355
+ }
356
+ });
357
+
358
+ // Link styles.
359
+ $.FE.DefineIcon('inputStyle', { NAME: 'magic' })
360
+ $.FE.RegisterCommand('inputStyle', {
361
+ title: 'Style',
362
+ type: 'dropdown',
363
+ html: function () {
364
+ var c = '<ul class="fr-dropdown-list">';
365
+ var options = this.opts.formStyles;
366
+
367
+ for (var cls in options) {
368
+ if (options.hasOwnProperty(cls)) {
369
+ c += '<li><a class="fr-command" tabIndex="-1" data-cmd="inputStyle" data-param1="' + cls + '">' + this.language.translate(options[cls]) + '</a></li>';
370
+ }
371
+ }
372
+ c += '</ul>';
373
+
374
+ return c;
375
+ },
376
+ callback: function (cmd, val) {
377
+ var input = this.forms.getInput();
378
+
379
+ if (input) {
380
+ this.forms.applyStyle(val);
381
+ this.forms.showEditPopup(input);
382
+ }
383
+ },
384
+ refreshOnShow: function ($btn, $dropdown) {
385
+ var input = this.forms.getInput();
386
+
387
+ if (input) {
388
+ var $input = $(input);
389
+
390
+ $dropdown.find('.fr-command').each (function () {
391
+ var cls = $(this).data('param1');
392
+ $(this).toggleClass('fr-active', $input.hasClass(cls));
393
+ })
394
+ }
395
+ }
396
+ });
397
+
398
+ $.FE.DefineIcon('inputEdit', { NAME: 'edit' });
399
+ $.FE.RegisterCommand('inputEdit', {
400
+ title: 'Edit Button',
401
+ undo: false,
402
+ refreshAfterCallback: false,
403
+ callback: function () {
404
+ this.forms.showUpdatePopup();
405
+ }
406
+ })
407
+
408
+ $.FE.DefineIcon('inputBack', { NAME: 'arrow-left' });
409
+ $.FE.RegisterCommand('inputBack', {
410
+ title: 'Back',
411
+ undo: false,
412
+ focus: false,
413
+ back: true,
414
+ refreshAfterCallback: false,
415
+ callback: function () {
416
+ this.forms.back();
417
+ }
418
+ });
419
+
420
+ // Register command to update button.
421
+ $.FE.RegisterCommand('updateInput', {
422
+ undo: false,
423
+ focus: false,
424
+ title: 'Update',
425
+ callback: function () {
426
+ this.forms.updateInput();
427
+ }
428
+ });
429
+
430
+ }));
@@ -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(o){"function"==typeof define&&define.amd?define(["jquery"],o):"object"==typeof module&&module.exports?module.exports=function(t,e){return e===undefined&&(e="undefined"!=typeof window?require("jquery"):require("jquery")(t)),o(e)}:o(window.jQuery)}(function(l){l.extend(l.FE.POPUP_TEMPLATES,{"forms.edit":"[_BUTTONS_]","forms.update":"[_BUTTONS_][_TEXT_LAYER_]"}),l.extend(l.FE.DEFAULTS,{formEditButtons:["inputStyle","inputEdit"],formStyles:{"fr-rounded":"Rounded","fr-large":"Large"},formMultipleStyles:!0,formUpdateButtons:["inputBack","|"]}),l.FE.PLUGINS.forms=function(s){var r;function t(t){t.preventDefault(),s.selection.clear(),l(this).data("mousedown",!0)}function e(t){l(this).data("mousedown")&&(t.stopPropagation(),l(this).removeData("mousedown"),a(r=this)),t.preventDefault()}function o(){s.$el.find("input, textarea, button").removeData("mousedown")}function n(){l(this).removeData("mousedown")}function i(){return r||null}function a(t){var e=s.popups.get("forms.edit");e||(e=function(){var t="";0<s.opts.formEditButtons.length&&(t='<div class="fr-buttons">'+s.button.buildList(s.opts.formEditButtons)+"</div>");var e={buttons:t},o=s.popups.create("forms.edit",e);return s.$wp&&s.events.$on(s.$wp,"scroll.link-edit",function(){i()&&s.popups.isVisible("forms.edit")&&a(i())}),o}());var o=l(r=t);s.popups.refresh("forms.edit"),s.popups.setContainer("forms.edit",s.$sc);var n=o.offset().left+o.outerWidth()/2,u=o.offset().top+o.outerHeight();s.popups.show("forms.edit",n,u,o.outerHeight())}function p(){var t=s.popups.get("forms.update"),e=i();if(e){var o=l(e);o.is("button")?t.find('input[type="text"][name="text"]').val(o.text()):t.find('input[type="text"][name="text"]').val(o.attr("placeholder"))}t.find('input[type="text"][name="text"]').trigger("change")}function f(){r=null}function d(t){if(t)return s.popups.onRefresh("forms.update",p),s.popups.onHide("forms.update",f),!0;var e="";1<=s.opts.formUpdateButtons.length&&(e='<div class="fr-buttons">'+s.button.buildList(s.opts.formUpdateButtons)+"</div>");var o="",n=0;o='<div class="fr-forms-text-layer fr-layer fr-active">',o+='<div class="fr-input-line"><input name="text" type="text" placeholder="Text" tabIndex="'+ ++n+'"></div>';var u={buttons:e,text_layer:o+='<div class="fr-action-buttons"><button class="fr-command fr-submit" data-cmd="updateInput" href="#" tabIndex="'+ ++n+'" type="button">'+s.language.translate("Update")+"</button></div></div>"};return s.popups.create("forms.update",u)}return{_init:function(){s.events.$on(s.$el,s._mousedown,"input, textarea, button",t),s.events.$on(s.$el,s._mouseup,"input, textarea, button",e),s.events.$on(s.$el,"touchmove","input, textarea, button",n),s.events.$on(s.$el,s._mouseup,o),s.events.$on(s.$win,s._mouseup,o),d(!0),s.events.$on(s.$el,"submit","form",function(t){return t.preventDefault(),!1})},updateInput:function(){var t=s.popups.get("forms.update"),e=i();if(e){var o=l(e),n=t.find('input[type="text"][name="text"]').val()||"";n.length&&(o.is("button")?o.text(n):o.attr("placeholder",n)),s.popups.hide("forms.update"),a(e)}},getInput:i,applyStyle:function(t,e,o){void 0===e&&(e=s.opts.formStyles),void 0===o&&(o=s.opts.formMultipleStyles);var n=i();if(!n)return!1;if(!o){var u=Object.keys(e);u.splice(u.indexOf(t),1),l(n).removeClass(u.join(" "))}l(n).toggleClass(t)},showUpdatePopup:function(){var t=i();if(t){var e=l(t),o=s.popups.get("forms.update");o||(o=d()),s.popups.isVisible("forms.update")||s.popups.refresh("forms.update"),s.popups.setContainer("forms.update",s.$sc);var n=e.offset().left+e.outerWidth()/2,u=e.offset().top+e.outerHeight();s.popups.show("forms.update",n,u,e.outerHeight())}},showEditPopup:a,back:function(){s.events.disableBlur(),s.selection.restore(),s.events.enableBlur();var t=i();t&&s.$wp&&("BUTTON"==t.tagName&&s.selection.restore(),a(t))}}},l.FE.RegisterCommand("updateInput",{undo:!1,focus:!1,title:"Update",callback:function(){this.forms.updateInput()}}),l.FE.DefineIcon("inputStyle",{NAME:"magic"}),l.FE.RegisterCommand("inputStyle",{title:"Style",type:"dropdown",html:function(){var t='<ul class="fr-dropdown-list">',e=this.opts.formStyles;for(var o in e)e.hasOwnProperty(o)&&(t+='<li><a class="fr-command" tabIndex="-1" data-cmd="inputStyle" data-param1="'+o+'">'+this.language.translate(e[o])+"</a></li>");return t+="</ul>"},callback:function(t,e){var o=this.forms.getInput();o&&(this.forms.applyStyle(e),this.forms.showEditPopup(o))},refreshOnShow:function(t,e){var o=this.forms.getInput();if(o){var n=l(o);e.find(".fr-command").each(function(){var t=l(this).data("param1");l(this).toggleClass("fr-active",n.hasClass(t))})}}}),l.FE.DefineIcon("inputEdit",{NAME:"edit"}),l.FE.RegisterCommand("inputEdit",{title:"Edit Button",undo:!1,refreshAfterCallback:!1,callback:function(){this.forms.showUpdatePopup()}}),l.FE.DefineIcon("inputBack",{NAME:"arrow-left"}),l.FE.RegisterCommand("inputBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.forms.back()}}),l.FE.RegisterCommand("updateInput",{undo:!1,focus:!1,title:"Update",callback:function(){this.forms.updateInput()}})});
@@ -0,0 +1,274 @@
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
+ $.FE.PLUGINS.fullscreen = function (editor) {
37
+ var old_scroll;
38
+
39
+ /**
40
+ * Check if fullscreen mode is active.
41
+ */
42
+ function isActive () {
43
+ return editor.$box.hasClass('fr-fullscreen');
44
+ }
45
+
46
+ /**
47
+ * Turn fullscreen on.
48
+ */
49
+ var height;
50
+ var max_height;
51
+ var z_index;
52
+
53
+ function _on () {
54
+ if (editor.helpers.isIOS() && editor.core.hasFocus()) {
55
+ editor.$el.blur();
56
+
57
+ setTimeout(toggle, 250);
58
+
59
+ return false;
60
+ }
61
+
62
+ old_scroll = editor.helpers.scrollTop();
63
+ editor.$box.toggleClass('fr-fullscreen');
64
+ $('body:first').toggleClass('fr-fullscreen');
65
+
66
+ if (editor.helpers.isMobile()) {
67
+ editor.$tb.data('parent', editor.$tb.parent());
68
+ editor.$tb.prependTo(editor.$box);
69
+
70
+ if (editor.$tb.data('sticky-dummy')) {
71
+ editor.$tb.after(editor.$tb.data('sticky-dummy'));
72
+ }
73
+ }
74
+
75
+ height = editor.opts.height;
76
+ max_height = editor.opts.heightMax;
77
+ z_index = editor.opts.zIndex;
78
+
79
+ editor.position.refresh()
80
+
81
+ editor.opts.height = editor.o_win.innerHeight - (editor.opts.toolbarInline ? 0 : editor.$tb.outerHeight());
82
+ editor.opts.zIndex = 2147483641;
83
+ editor.opts.heightMax = null;
84
+ editor.size.refresh();
85
+
86
+ if (editor.opts.toolbarInline) editor.toolbar.showInline();
87
+
88
+ var $parent_node = editor.$box.parent();
89
+
90
+ while (!$parent_node.is('body:first')) {
91
+ $parent_node
92
+ .data('z-index', $parent_node.css('z-index'))
93
+ .data('overflow', $parent_node.css('overflow'))
94
+ .css('z-index', '2147483640')
95
+ .css('overflow', 'visible');
96
+ $parent_node = $parent_node.parent();
97
+ }
98
+
99
+ if (editor.opts.toolbarContainer) {
100
+ editor.$box.prepend(editor.$tb);
101
+ }
102
+
103
+ editor.events.trigger('charCounter.update');
104
+ editor.events.trigger('codeView.update');
105
+ editor.$win.trigger('scroll');
106
+ }
107
+
108
+ /**
109
+ * Turn fullscreen off.
110
+ */
111
+ function _off () {
112
+ if (editor.helpers.isIOS() && editor.core.hasFocus()) {
113
+ editor.$el.blur();
114
+
115
+ setTimeout(toggle, 250);
116
+
117
+ return false;
118
+ }
119
+
120
+ editor.$box.toggleClass('fr-fullscreen');
121
+ $('body:first').toggleClass('fr-fullscreen');
122
+
123
+ editor.$tb.prependTo(editor.$tb.data('parent'));
124
+
125
+ if (editor.$tb.data('sticky-dummy')) {
126
+ editor.$tb.after(editor.$tb.data('sticky-dummy'));
127
+ }
128
+
129
+ editor.opts.height = height;
130
+ editor.opts.heightMax = max_height;
131
+ editor.opts.zIndex = z_index;
132
+ editor.size.refresh();
133
+
134
+ $(editor.o_win).scrollTop(old_scroll)
135
+
136
+ if (editor.opts.toolbarInline) editor.toolbar.showInline();
137
+
138
+ editor.events.trigger('charCounter.update');
139
+
140
+ if (editor.opts.toolbarSticky) {
141
+ if (editor.opts.toolbarStickyOffset) {
142
+ if (editor.opts.toolbarBottom) {
143
+ editor.$tb
144
+ .css('bottom', editor.opts.toolbarStickyOffset)
145
+ .data('bottom', editor.opts.toolbarStickyOffset);
146
+ }
147
+ else {
148
+ editor.$tb
149
+ .css('top', editor.opts.toolbarStickyOffset)
150
+ .data('top', editor.opts.toolbarStickyOffset);
151
+ }
152
+ }
153
+ }
154
+
155
+ var $parent_node = editor.$box.parent();
156
+
157
+ while (!$parent_node.is('body:first')) {
158
+ if ($parent_node.data('z-index')) {
159
+ $parent_node.css('z-index', '');
160
+
161
+ if ($parent_node.css('z-index') != $parent_node.data('z-index')) {
162
+ $parent_node.css('z-index', $parent_node.data('z-index'));
163
+ }
164
+ $parent_node.removeData('z-index');
165
+ }
166
+
167
+ if ($parent_node.data('overflow')) {
168
+ $parent_node.css('overflow', '');
169
+
170
+ if ($parent_node.css('overflow') != $parent_node.data('overflow')) {
171
+ $parent_node.css('overflow', $parent_node.data('overflow'));
172
+ }
173
+ $parent_node.removeData('overflow');
174
+ }
175
+ else {
176
+ $parent_node.css('overflow', '');
177
+ $parent_node.removeData('overflow');
178
+ }
179
+
180
+ $parent_node = $parent_node.parent();
181
+ }
182
+
183
+ if (editor.opts.toolbarContainer) {
184
+ $(editor.opts.toolbarContainer).append(editor.$tb);
185
+ }
186
+
187
+ $(editor.o_win).trigger('scroll');
188
+ editor.events.trigger('codeView.update');
189
+ }
190
+
191
+ /**
192
+ * Exec fullscreen.
193
+ */
194
+ function toggle () {
195
+ if (!isActive()) {
196
+ _on();
197
+ }
198
+ else {
199
+ _off();
200
+ }
201
+
202
+ refresh(editor.$tb.find('.fr-command[data-cmd="fullscreen"]'));
203
+ }
204
+
205
+ function refresh ($btn) {
206
+ var active = isActive();
207
+
208
+ $btn.toggleClass('fr-active', active).attr('aria-pressed', active);
209
+ $btn.find('> *:not(.fr-sr-only)').replaceWith(!active ? editor.icon.create('fullscreen') : editor.icon.create('fullscreenCompress'));
210
+ }
211
+
212
+ function _init () {
213
+ if (!editor.$wp) return false;
214
+
215
+ editor.events.$on($(editor.o_win), 'resize', function () {
216
+ if (isActive()) {
217
+ _off();
218
+ _on();
219
+ }
220
+ });
221
+
222
+ editor.events.on('toolbar.hide', function () {
223
+ if (isActive() && editor.helpers.isMobile()) return false;
224
+ })
225
+
226
+ editor.events.on('position.refresh', function () {
227
+ if (editor.helpers.isIOS()) {
228
+ return !isActive();
229
+ }
230
+ })
231
+
232
+ editor.events.on('destroy', function () {
233
+
234
+ // Exit full screen.
235
+ if (isActive()) {
236
+ _off();
237
+ }
238
+ }, true);
239
+ }
240
+
241
+ return {
242
+ _init: _init,
243
+ toggle: toggle,
244
+ refresh: refresh,
245
+ isActive: isActive
246
+ }
247
+ }
248
+
249
+ // Register the font size command.
250
+ $.FE.RegisterCommand('fullscreen', {
251
+ title: 'Fullscreen',
252
+ undo: false,
253
+ focus: false,
254
+ accessibilityFocus: true,
255
+ forcedRefresh: true,
256
+ toggle: true,
257
+ callback: function () {
258
+ this.fullscreen.toggle();
259
+ },
260
+ refresh: function ($btn) {
261
+ this.fullscreen.refresh($btn);
262
+ },
263
+ plugin: 'fullscreen'
264
+ })
265
+
266
+ // Add the font size icon.
267
+ $.FE.DefineIcon('fullscreen', {
268
+ NAME: 'expand'
269
+ });
270
+ $.FE.DefineIcon('fullscreenCompress', {
271
+ NAME: 'compress'
272
+ });
273
+
274
+ }));