spiderfw 0.6.38 → 0.6.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (515) hide show
  1. checksums.yaml +13 -5
  2. data/CHANGELOG +23 -0
  3. data/VERSION +1 -1
  4. data/apps/core/admin/views/admin.layout.shtml +6 -0
  5. data/apps/core/auth/controllers/login_controller.rb +1 -1
  6. data/apps/core/components/assets.rb +55 -6
  7. data/apps/core/components/public/bootstrap/scss/_variables.scss +5 -2
  8. data/apps/core/components/public/bootstrap/scss/bootstrap.css +942 -236
  9. data/apps/core/components/public/bootstrap/scss/responsive.css +187 -30
  10. data/apps/core/components/public/css/tinymce/skins/lightgray/AbsoluteLayout.less +17 -0
  11. data/apps/core/components/public/css/tinymce/skins/lightgray/Animations.less +10 -0
  12. data/apps/core/components/public/css/tinymce/skins/lightgray/Button.less +172 -0
  13. data/apps/core/components/public/css/tinymce/skins/lightgray/ButtonGroup.less +71 -0
  14. data/apps/core/components/public/css/tinymce/skins/lightgray/Checkbox.less +49 -0
  15. data/apps/core/components/public/css/tinymce/skins/lightgray/ColorBox.less +6 -0
  16. data/apps/core/components/public/css/tinymce/skins/lightgray/ColorButton.less +72 -0
  17. data/apps/core/components/public/css/tinymce/skins/lightgray/ColorPicker.less +80 -0
  18. data/apps/core/components/public/css/tinymce/skins/lightgray/ComboBox.less +39 -0
  19. data/apps/core/components/public/css/tinymce/skins/lightgray/Container.less +9 -0
  20. data/apps/core/components/public/css/tinymce/skins/lightgray/Content.Inline.less +4 -0
  21. data/apps/core/components/public/css/tinymce/skins/lightgray/Content.Objects.less +166 -0
  22. data/apps/core/components/public/css/tinymce/skins/lightgray/Content.less +27 -0
  23. data/apps/core/components/public/css/tinymce/skins/lightgray/CropRect.less +54 -0
  24. data/apps/core/components/public/css/tinymce/skins/lightgray/FieldSet.less +15 -0
  25. data/apps/core/components/public/css/tinymce/skins/lightgray/FitLayout.less +9 -0
  26. data/apps/core/components/public/css/tinymce/skins/lightgray/FloatPanel.less +69 -0
  27. data/apps/core/components/public/css/tinymce/skins/lightgray/FlowLayout.less +36 -0
  28. data/apps/core/components/public/css/tinymce/skins/lightgray/Icons.Ie7.less +136 -0
  29. data/apps/core/components/public/css/tinymce/skins/lightgray/Icons.less +180 -0
  30. data/apps/core/components/public/css/tinymce/skins/lightgray/Iframe.less +6 -0
  31. data/apps/core/components/public/css/tinymce/skins/lightgray/ImagePanel.less +20 -0
  32. data/apps/core/components/public/css/tinymce/skins/lightgray/InfoBox.less +71 -0
  33. data/apps/core/components/public/css/tinymce/skins/lightgray/Label.less +38 -0
  34. data/apps/core/components/public/css/tinymce/skins/lightgray/ListBox.less +26 -0
  35. data/apps/core/components/public/css/tinymce/skins/lightgray/Menu.less +34 -0
  36. data/apps/core/components/public/css/tinymce/skins/lightgray/MenuBar.less +32 -0
  37. data/apps/core/components/public/css/tinymce/skins/lightgray/MenuButton.less +34 -0
  38. data/apps/core/components/public/css/tinymce/skins/lightgray/MenuItem.less +142 -0
  39. data/apps/core/components/public/css/tinymce/skins/lightgray/Mixins.less +54 -0
  40. data/apps/core/components/public/css/tinymce/skins/lightgray/Notification.less +144 -0
  41. data/apps/core/components/public/css/tinymce/skins/lightgray/Panel.less +7 -0
  42. data/apps/core/components/public/css/tinymce/skins/lightgray/Path.less +45 -0
  43. data/apps/core/components/public/css/tinymce/skins/lightgray/Progress.less +34 -0
  44. data/apps/core/components/public/css/tinymce/skins/lightgray/Radio.less +1 -0
  45. data/apps/core/components/public/css/tinymce/skins/lightgray/Reset.less +32 -0
  46. data/apps/core/components/public/css/tinymce/skins/lightgray/ResizeHandle.less +18 -0
  47. data/apps/core/components/public/css/tinymce/skins/lightgray/Scrollable.less +44 -0
  48. data/apps/core/components/public/css/tinymce/skins/lightgray/SelectBox.less +6 -0
  49. data/apps/core/components/public/css/tinymce/skins/lightgray/Slider.less +29 -0
  50. data/apps/core/components/public/css/tinymce/skins/lightgray/Spacer.less +5 -0
  51. data/apps/core/components/public/css/tinymce/skins/lightgray/SplitButton.less +49 -0
  52. data/apps/core/components/public/css/tinymce/skins/lightgray/StackLayout.less +5 -0
  53. data/apps/core/components/public/css/tinymce/skins/lightgray/TabPanel.less +44 -0
  54. data/apps/core/components/public/css/tinymce/skins/lightgray/TextBox.less +41 -0
  55. data/apps/core/components/public/css/tinymce/skins/lightgray/Throbber.less +19 -0
  56. data/apps/core/components/public/css/tinymce/skins/lightgray/TinyMCE.less +159 -0
  57. data/apps/core/components/public/css/tinymce/skins/lightgray/ToolTip.less +129 -0
  58. data/apps/core/components/public/css/tinymce/skins/lightgray/Variables.less +214 -0
  59. data/apps/core/components/public/css/tinymce/skins/lightgray/Window.less +127 -0
  60. data/apps/core/components/public/css/tinymce/skins/lightgray/content.inline.min.css +1 -0
  61. data/apps/core/components/public/css/tinymce/skins/lightgray/content.min.css +1 -0
  62. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/readme.md +1 -0
  63. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
  64. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce-small.json +1277 -0
  65. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce-small.svg +63 -0
  66. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  67. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
  68. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
  69. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce.json +3381 -0
  70. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce.svg +129 -0
  71. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
  72. data/apps/core/components/public/css/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
  73. data/apps/core/components/public/css/tinymce/skins/lightgray/img/anchor.gif +0 -0
  74. data/apps/core/components/public/css/tinymce/skins/lightgray/img/loader.gif +0 -0
  75. data/apps/core/components/public/css/tinymce/skins/lightgray/img/object.gif +0 -0
  76. data/apps/core/components/public/css/tinymce/skins/lightgray/img/trans.gif +0 -0
  77. data/apps/core/components/public/css/tinymce/skins/lightgray/skin.dev.less +46 -0
  78. data/apps/core/components/public/css/tinymce/skins/lightgray/skin.ie7.dev.less +46 -0
  79. data/apps/core/components/public/css/tinymce/skins/lightgray/skin.ie7.less +2542 -0
  80. data/apps/core/components/public/css/tinymce/skins/lightgray/skin.ie7.min.css +1 -0
  81. data/apps/core/components/public/css/tinymce/skins/lightgray/skin.less +2586 -0
  82. data/apps/core/components/public/css/tinymce/skins/lightgray/skin.min.css +1 -0
  83. data/apps/core/components/public/js/bootbox_2/bootbox.js +551 -0
  84. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-it-min.js +4 -0
  85. data/apps/core/components/public/js/spider.js +7 -3
  86. data/apps/core/components/public/js/tinymce/classes/AddOnManager.js +265 -0
  87. data/apps/core/components/public/js/tinymce/classes/Compat.js +90 -0
  88. data/apps/core/components/public/js/tinymce/classes/DragDropOverrides.js +224 -0
  89. data/apps/core/components/public/js/tinymce/classes/Editor.js +2221 -0
  90. data/apps/core/components/public/js/tinymce/classes/EditorCommands.js +1028 -0
  91. data/apps/core/components/public/js/tinymce/classes/EditorManager.js +715 -0
  92. data/apps/core/components/public/js/tinymce/classes/EditorObservable.js +204 -0
  93. data/apps/core/components/public/js/tinymce/classes/EditorUpload.js +191 -0
  94. data/apps/core/components/public/js/tinymce/classes/EnterKey.js +676 -0
  95. data/apps/core/components/public/js/tinymce/classes/Env.js +177 -0
  96. data/apps/core/components/public/js/tinymce/classes/FocusManager.js +266 -0
  97. data/apps/core/components/public/js/tinymce/classes/ForceBlocks.js +138 -0
  98. data/apps/core/components/public/js/tinymce/classes/Formatter.js +2378 -0
  99. data/apps/core/components/public/js/tinymce/classes/LegacyInput.js +82 -0
  100. data/apps/core/components/public/js/tinymce/classes/Mode.js +54 -0
  101. data/apps/core/components/public/js/tinymce/classes/NodeChange.js +154 -0
  102. data/apps/core/components/public/js/tinymce/classes/NotificationManager.js +156 -0
  103. data/apps/core/components/public/js/tinymce/classes/Register.js +34 -0
  104. data/apps/core/components/public/js/tinymce/classes/SelectionOverrides.js +810 -0
  105. data/apps/core/components/public/js/tinymce/classes/Shortcuts.js +172 -0
  106. data/apps/core/components/public/js/tinymce/classes/UndoManager.js +346 -0
  107. data/apps/core/components/public/js/tinymce/classes/WindowManager.js +278 -0
  108. data/apps/core/components/public/js/tinymce/classes/caret/CaretBookmark.js +263 -0
  109. data/apps/core/components/public/js/tinymce/classes/caret/CaretCandidate.js +86 -0
  110. data/apps/core/components/public/js/tinymce/classes/caret/CaretContainer.js +151 -0
  111. data/apps/core/components/public/js/tinymce/classes/caret/CaretPosition.js +371 -0
  112. data/apps/core/components/public/js/tinymce/classes/caret/CaretUtils.js +302 -0
  113. data/apps/core/components/public/js/tinymce/classes/caret/CaretWalker.js +215 -0
  114. data/apps/core/components/public/js/tinymce/classes/caret/FakeCaret.js +192 -0
  115. data/apps/core/components/public/js/tinymce/classes/caret/LineUtils.js +135 -0
  116. data/apps/core/components/public/js/tinymce/classes/caret/LineWalker.js +166 -0
  117. data/apps/core/components/public/js/tinymce/classes/data/Binding.js +79 -0
  118. data/apps/core/components/public/js/tinymce/classes/data/ObservableArray.js +196 -0
  119. data/apps/core/components/public/js/tinymce/classes/data/ObservableObject.js +194 -0
  120. data/apps/core/components/public/js/tinymce/classes/dom/BookmarkManager.js +456 -0
  121. data/apps/core/components/public/js/tinymce/classes/dom/ControlSelection.js +634 -0
  122. data/apps/core/components/public/js/tinymce/classes/dom/DOMUtils.js +1853 -0
  123. data/apps/core/components/public/js/tinymce/classes/dom/Dimensions.js +64 -0
  124. data/apps/core/components/public/js/tinymce/classes/dom/DomQuery.js +1578 -0
  125. data/apps/core/components/public/js/tinymce/classes/dom/ElementUtils.js +118 -0
  126. data/apps/core/components/public/js/tinymce/classes/dom/EventUtils.js +583 -0
  127. data/apps/core/components/public/js/tinymce/classes/dom/NodePath.js +50 -0
  128. data/apps/core/components/public/js/tinymce/classes/dom/NodeType.js +110 -0
  129. data/apps/core/components/public/js/tinymce/classes/dom/Range.js +785 -0
  130. data/apps/core/components/public/js/tinymce/classes/dom/RangeUtils.js +628 -0
  131. data/apps/core/components/public/js/tinymce/classes/dom/ScriptLoader.js +254 -0
  132. data/apps/core/components/public/js/tinymce/classes/dom/Selection.js +1008 -0
  133. data/apps/core/components/public/js/tinymce/classes/dom/Serializer.js +506 -0
  134. data/apps/core/components/public/js/tinymce/classes/dom/Sizzle.jQuery.js +23 -0
  135. data/apps/core/components/public/js/tinymce/classes/dom/Sizzle.js +2039 -0
  136. data/apps/core/components/public/js/tinymce/classes/dom/StyleSheetLoader.js +190 -0
  137. data/apps/core/components/public/js/tinymce/classes/dom/TreeWalker.js +127 -0
  138. data/apps/core/components/public/js/tinymce/classes/dom/TridentSelection.js +508 -0
  139. data/apps/core/components/public/js/tinymce/classes/file/BlobCache.js +72 -0
  140. data/apps/core/components/public/js/tinymce/classes/file/Conversions.js +106 -0
  141. data/apps/core/components/public/js/tinymce/classes/file/ImageScanner.js +145 -0
  142. data/apps/core/components/public/js/tinymce/classes/file/Uploader.js +193 -0
  143. data/apps/core/components/public/js/tinymce/classes/fmt/Hooks.js +66 -0
  144. data/apps/core/components/public/js/tinymce/classes/fmt/Preview.js +151 -0
  145. data/apps/core/components/public/js/tinymce/classes/geom/ClientRect.js +136 -0
  146. data/apps/core/components/public/js/tinymce/classes/geom/Rect.js +214 -0
  147. data/apps/core/components/public/js/tinymce/classes/html/DomParser.js +822 -0
  148. data/apps/core/components/public/js/tinymce/classes/html/Entities.js +268 -0
  149. data/apps/core/components/public/js/tinymce/classes/html/Node.js +496 -0
  150. data/apps/core/components/public/js/tinymce/classes/html/SaxParser.js +474 -0
  151. data/apps/core/components/public/js/tinymce/classes/html/Schema.js +1004 -0
  152. data/apps/core/components/public/js/tinymce/classes/html/Serializer.js +158 -0
  153. data/apps/core/components/public/js/tinymce/classes/html/Styles.js +363 -0
  154. data/apps/core/components/public/js/tinymce/classes/html/Writer.js +199 -0
  155. data/apps/core/components/public/js/tinymce/classes/jquery.tinymce.js +377 -0
  156. data/apps/core/components/public/js/tinymce/classes/text/ExtendingChar.js +53 -0
  157. data/apps/core/components/public/js/tinymce/classes/text/Zwsp.js +36 -0
  158. data/apps/core/components/public/js/tinymce/classes/ui/AbsoluteLayout.js +63 -0
  159. data/apps/core/components/public/js/tinymce/classes/ui/BoxUtils.js +98 -0
  160. data/apps/core/components/public/js/tinymce/classes/ui/Button.js +199 -0
  161. data/apps/core/components/public/js/tinymce/classes/ui/ButtonGroup.js +62 -0
  162. data/apps/core/components/public/js/tinymce/classes/ui/Checkbox.js +162 -0
  163. data/apps/core/components/public/js/tinymce/classes/ui/ClassList.js +149 -0
  164. data/apps/core/components/public/js/tinymce/classes/ui/Collection.js +438 -0
  165. data/apps/core/components/public/js/tinymce/classes/ui/ColorBox.js +72 -0
  166. data/apps/core/components/public/js/tinymce/classes/ui/ColorButton.js +124 -0
  167. data/apps/core/components/public/js/tinymce/classes/ui/ColorPicker.js +206 -0
  168. data/apps/core/components/public/js/tinymce/classes/ui/ComboBox.js +306 -0
  169. data/apps/core/components/public/js/tinymce/classes/ui/Container.js +506 -0
  170. data/apps/core/components/public/js/tinymce/classes/ui/Control.js +1301 -0
  171. data/apps/core/components/public/js/tinymce/classes/ui/DomUtils.js +107 -0
  172. data/apps/core/components/public/js/tinymce/classes/ui/DragHelper.js +144 -0
  173. data/apps/core/components/public/js/tinymce/classes/ui/ElementPath.js +79 -0
  174. data/apps/core/components/public/js/tinymce/classes/ui/Factory.js +105 -0
  175. data/apps/core/components/public/js/tinymce/classes/ui/FieldSet.js +59 -0
  176. data/apps/core/components/public/js/tinymce/classes/ui/FilePicker.js +85 -0
  177. data/apps/core/components/public/js/tinymce/classes/ui/FitLayout.js +48 -0
  178. data/apps/core/components/public/js/tinymce/classes/ui/FlexLayout.js +246 -0
  179. data/apps/core/components/public/js/tinymce/classes/ui/FloatPanel.js +409 -0
  180. data/apps/core/components/public/js/tinymce/classes/ui/FlowLayout.js +46 -0
  181. data/apps/core/components/public/js/tinymce/classes/ui/Form.js +157 -0
  182. data/apps/core/components/public/js/tinymce/classes/ui/FormItem.js +56 -0
  183. data/apps/core/components/public/js/tinymce/classes/ui/FormatControls.js +535 -0
  184. data/apps/core/components/public/js/tinymce/classes/ui/GridLayout.js +233 -0
  185. data/apps/core/components/public/js/tinymce/classes/ui/Iframe.js +85 -0
  186. data/apps/core/components/public/js/tinymce/classes/ui/InfoBox.js +93 -0
  187. data/apps/core/components/public/js/tinymce/classes/ui/KeyboardNavigation.js +406 -0
  188. data/apps/core/components/public/js/tinymce/classes/ui/Label.js +144 -0
  189. data/apps/core/components/public/js/tinymce/classes/ui/Layout.js +120 -0
  190. data/apps/core/components/public/js/tinymce/classes/ui/ListBox.js +152 -0
  191. data/apps/core/components/public/js/tinymce/classes/ui/Menu.js +195 -0
  192. data/apps/core/components/public/js/tinymce/classes/ui/MenuBar.js +33 -0
  193. data/apps/core/components/public/js/tinymce/classes/ui/MenuButton.js +268 -0
  194. data/apps/core/components/public/js/tinymce/classes/ui/MenuItem.js +336 -0
  195. data/apps/core/components/public/js/tinymce/classes/ui/MessageBox.js +202 -0
  196. data/apps/core/components/public/js/tinymce/classes/ui/Movable.js +200 -0
  197. data/apps/core/components/public/js/tinymce/classes/ui/Notification.js +154 -0
  198. data/apps/core/components/public/js/tinymce/classes/ui/Panel.js +67 -0
  199. data/apps/core/components/public/js/tinymce/classes/ui/PanelButton.js +114 -0
  200. data/apps/core/components/public/js/tinymce/classes/ui/Path.js +127 -0
  201. data/apps/core/components/public/js/tinymce/classes/ui/Progress.js +81 -0
  202. data/apps/core/components/public/js/tinymce/classes/ui/Radio.js +29 -0
  203. data/apps/core/components/public/js/tinymce/classes/ui/ReflowQueue.js +79 -0
  204. data/apps/core/components/public/js/tinymce/classes/ui/Resizable.js +68 -0
  205. data/apps/core/components/public/js/tinymce/classes/ui/ResizeHandle.js +86 -0
  206. data/apps/core/components/public/js/tinymce/classes/ui/Scrollable.js +141 -0
  207. data/apps/core/components/public/js/tinymce/classes/ui/SelectBox.js +106 -0
  208. data/apps/core/components/public/js/tinymce/classes/ui/Selector.js +369 -0
  209. data/apps/core/components/public/js/tinymce/classes/ui/Slider.js +161 -0
  210. data/apps/core/components/public/js/tinymce/classes/ui/Spacer.js +39 -0
  211. data/apps/core/components/public/js/tinymce/classes/ui/SplitButton.js +146 -0
  212. data/apps/core/components/public/js/tinymce/classes/ui/StackLayout.js +34 -0
  213. data/apps/core/components/public/js/tinymce/classes/ui/TabPanel.js +178 -0
  214. data/apps/core/components/public/js/tinymce/classes/ui/TextBox.js +208 -0
  215. data/apps/core/components/public/js/tinymce/classes/ui/Throbber.js +88 -0
  216. data/apps/core/components/public/js/tinymce/classes/ui/Toolbar.js +56 -0
  217. data/apps/core/components/public/js/tinymce/classes/ui/Tooltip.js +73 -0
  218. data/apps/core/components/public/js/tinymce/classes/ui/Widget.js +151 -0
  219. data/apps/core/components/public/js/tinymce/classes/ui/Window.js +474 -0
  220. data/apps/core/components/public/js/tinymce/classes/util/Arr.js +153 -0
  221. data/apps/core/components/public/js/tinymce/classes/util/Class.js +167 -0
  222. data/apps/core/components/public/js/tinymce/classes/util/Color.js +235 -0
  223. data/apps/core/components/public/js/tinymce/classes/util/Delay.js +191 -0
  224. data/apps/core/components/public/js/tinymce/classes/util/EventDispatcher.js +294 -0
  225. data/apps/core/components/public/js/tinymce/classes/util/Fun.js +87 -0
  226. data/apps/core/components/public/js/tinymce/classes/util/I18n.js +116 -0
  227. data/apps/core/components/public/js/tinymce/classes/util/JSON.js +109 -0
  228. data/apps/core/components/public/js/tinymce/classes/util/JSONP.js +38 -0
  229. data/apps/core/components/public/js/tinymce/classes/util/JSONRequest.js +110 -0
  230. data/apps/core/components/public/js/tinymce/classes/util/LocalStorage.js +213 -0
  231. data/apps/core/components/public/js/tinymce/classes/util/Observable.js +129 -0
  232. data/apps/core/components/public/js/tinymce/classes/util/Promise.js +200 -0
  233. data/apps/core/components/public/js/tinymce/classes/util/Quirks.js +1701 -0
  234. data/apps/core/components/public/js/tinymce/classes/util/Tools.js +442 -0
  235. data/apps/core/components/public/js/tinymce/classes/util/URI.js +411 -0
  236. data/apps/core/components/public/js/tinymce/classes/util/VK.js +37 -0
  237. data/apps/core/components/public/js/tinymce/classes/util/XHR.js +110 -0
  238. data/apps/core/components/public/js/tinymce/jquery.tinymce.min.js +1 -0
  239. data/apps/core/components/public/js/tinymce/langs/it.js +219 -0
  240. data/apps/core/components/public/js/tinymce/langs/readme.md +3 -0
  241. data/apps/core/components/public/js/tinymce/license.txt +504 -0
  242. data/apps/core/components/public/js/tinymce/plugins/advlist/plugin.js +97 -0
  243. data/apps/core/components/public/js/tinymce/plugins/advlist/plugin.min.js +1 -0
  244. data/apps/core/components/public/js/tinymce/plugins/anchor/plugin.js +55 -0
  245. data/apps/core/components/public/js/tinymce/plugins/anchor/plugin.min.js +1 -0
  246. data/apps/core/components/public/js/tinymce/plugins/autolink/plugin.js +204 -0
  247. data/apps/core/components/public/js/tinymce/plugins/autolink/plugin.min.js +1 -0
  248. data/apps/core/components/public/js/tinymce/plugins/autoresize/plugin.js +162 -0
  249. data/apps/core/components/public/js/tinymce/plugins/autoresize/plugin.min.js +1 -0
  250. data/apps/core/components/public/js/tinymce/plugins/autosave/plugin.js +165 -0
  251. data/apps/core/components/public/js/tinymce/plugins/autosave/plugin.min.js +1 -0
  252. data/apps/core/components/public/js/tinymce/plugins/bbcode/plugin.js +123 -0
  253. data/apps/core/components/public/js/tinymce/plugins/bbcode/plugin.min.js +1 -0
  254. data/apps/core/components/public/js/tinymce/plugins/charmap/plugin.js +450 -0
  255. data/apps/core/components/public/js/tinymce/plugins/charmap/plugin.min.js +1 -0
  256. data/apps/core/components/public/js/tinymce/plugins/code/plugin.js +60 -0
  257. data/apps/core/components/public/js/tinymce/plugins/code/plugin.min.js +1 -0
  258. data/apps/core/components/public/js/tinymce/plugins/codesample/classes/Dialog.js +121 -0
  259. data/apps/core/components/public/js/tinymce/plugins/codesample/classes/Plugin.js +95 -0
  260. data/apps/core/components/public/js/tinymce/plugins/codesample/classes/Prism.js +937 -0
  261. data/apps/core/components/public/js/tinymce/plugins/codesample/classes/Utils.js +33 -0
  262. data/apps/core/components/public/js/tinymce/plugins/codesample/css/prism.css +138 -0
  263. data/apps/core/components/public/js/tinymce/plugins/codesample/plugin.dev.js +141 -0
  264. data/apps/core/components/public/js/tinymce/plugins/codesample/plugin.js +1299 -0
  265. data/apps/core/components/public/js/tinymce/plugins/codesample/plugin.min.js +1 -0
  266. data/apps/core/components/public/js/tinymce/plugins/colorpicker/plugin.js +112 -0
  267. data/apps/core/components/public/js/tinymce/plugins/colorpicker/plugin.min.js +1 -0
  268. data/apps/core/components/public/js/tinymce/plugins/compat3x/css/dialog.css +118 -0
  269. data/apps/core/components/public/js/tinymce/plugins/compat3x/img/buttons.png +0 -0
  270. data/apps/core/components/public/js/tinymce/plugins/compat3x/img/icons.gif +0 -0
  271. data/apps/core/components/public/js/tinymce/plugins/compat3x/img/items.gif +0 -0
  272. data/apps/core/components/public/js/tinymce/plugins/compat3x/img/menu_arrow.gif +0 -0
  273. data/apps/core/components/public/js/tinymce/plugins/compat3x/img/menu_check.gif +0 -0
  274. data/apps/core/components/public/js/tinymce/plugins/compat3x/img/progress.gif +0 -0
  275. data/apps/core/components/public/js/tinymce/plugins/compat3x/img/tabs.gif +0 -0
  276. data/apps/core/components/public/js/tinymce/plugins/compat3x/plugin.js +297 -0
  277. data/apps/core/components/public/js/tinymce/plugins/compat3x/plugin.min.js +1 -0
  278. data/apps/core/components/public/js/tinymce/plugins/compat3x/tiny_mce_popup.js +542 -0
  279. data/apps/core/components/public/js/tinymce/plugins/compat3x/utils/editable_selects.js +70 -0
  280. data/apps/core/components/public/js/tinymce/plugins/compat3x/utils/form_utils.js +210 -0
  281. data/apps/core/components/public/js/tinymce/plugins/compat3x/utils/mctabs.js +164 -0
  282. data/apps/core/components/public/js/tinymce/plugins/compat3x/utils/validate.js +252 -0
  283. data/apps/core/components/public/js/tinymce/plugins/contextmenu/plugin.js +88 -0
  284. data/apps/core/components/public/js/tinymce/plugins/contextmenu/plugin.min.js +1 -0
  285. data/apps/core/components/public/js/tinymce/plugins/directionality/plugin.js +64 -0
  286. data/apps/core/components/public/js/tinymce/plugins/directionality/plugin.min.js +1 -0
  287. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
  288. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
  289. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  290. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  291. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
  292. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
  293. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
  294. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
  295. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  296. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
  297. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
  298. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
  299. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  300. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
  301. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
  302. data/apps/core/components/public/js/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
  303. data/apps/core/components/public/js/tinymce/plugins/emoticons/plugin.js +65 -0
  304. data/apps/core/components/public/js/tinymce/plugins/emoticons/plugin.min.js +1 -0
  305. data/apps/core/components/public/js/tinymce/plugins/example/dialog.html +8 -0
  306. data/apps/core/components/public/js/tinymce/plugins/example/plugin.js +68 -0
  307. data/apps/core/components/public/js/tinymce/plugins/example/plugin.min.js +1 -0
  308. data/apps/core/components/public/js/tinymce/plugins/example_dependency/plugin.js +22 -0
  309. data/apps/core/components/public/js/tinymce/plugins/example_dependency/plugin.min.js +1 -0
  310. data/apps/core/components/public/js/tinymce/plugins/fullpage/plugin.js +490 -0
  311. data/apps/core/components/public/js/tinymce/plugins/fullpage/plugin.min.js +1 -0
  312. data/apps/core/components/public/js/tinymce/plugins/fullscreen/plugin.js +154 -0
  313. data/apps/core/components/public/js/tinymce/plugins/fullscreen/plugin.min.js +1 -0
  314. data/apps/core/components/public/js/tinymce/plugins/hr/plugin.js +30 -0
  315. data/apps/core/components/public/js/tinymce/plugins/hr/plugin.min.js +1 -0
  316. data/apps/core/components/public/js/tinymce/plugins/image/plugin.js +630 -0
  317. data/apps/core/components/public/js/tinymce/plugins/image/plugin.min.js +1 -0
  318. data/apps/core/components/public/js/tinymce/plugins/imagetools/config/bolt/atomic.js +6 -0
  319. data/apps/core/components/public/js/tinymce/plugins/imagetools/config/bolt/browser.js +6 -0
  320. data/apps/core/components/public/js/tinymce/plugins/imagetools/config/bolt/demo.js +8 -0
  321. data/apps/core/components/public/js/tinymce/plugins/imagetools/config/bolt/prod.js +6 -0
  322. data/apps/core/components/public/js/tinymce/plugins/imagetools/plugin.js +2668 -0
  323. data/apps/core/components/public/js/tinymce/plugins/imagetools/plugin.min.js +1 -0
  324. data/apps/core/components/public/js/tinymce/plugins/imagetools/src/demo/html/demo.html +16 -0
  325. data/apps/core/components/public/js/tinymce/plugins/imagetools/src/demo/js/Demo.js +92 -0
  326. data/apps/core/components/public/js/tinymce/plugins/imagetools/src/main/js/CropRect.js +214 -0
  327. data/apps/core/components/public/js/tinymce/plugins/imagetools/src/main/js/Dialog.js +485 -0
  328. data/apps/core/components/public/js/tinymce/plugins/imagetools/src/main/js/ImagePanel.js +218 -0
  329. data/apps/core/components/public/js/tinymce/plugins/imagetools/src/main/js/Plugin.js +411 -0
  330. data/apps/core/components/public/js/tinymce/plugins/imagetools/src/main/js/UndoStack.js +57 -0
  331. data/apps/core/components/public/js/tinymce/plugins/importcss/plugin.js +227 -0
  332. data/apps/core/components/public/js/tinymce/plugins/importcss/plugin.min.js +1 -0
  333. data/apps/core/components/public/js/tinymce/plugins/insertdatetime/plugin.js +121 -0
  334. data/apps/core/components/public/js/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
  335. data/apps/core/components/public/js/tinymce/plugins/layer/plugin.js +225 -0
  336. data/apps/core/components/public/js/tinymce/plugins/layer/plugin.min.js +1 -0
  337. data/apps/core/components/public/js/tinymce/plugins/legacyoutput/plugin.js +211 -0
  338. data/apps/core/components/public/js/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
  339. data/apps/core/components/public/js/tinymce/plugins/link/plugin.js +403 -0
  340. data/apps/core/components/public/js/tinymce/plugins/link/plugin.min.js +1 -0
  341. data/apps/core/components/public/js/tinymce/plugins/lists/plugin.js +885 -0
  342. data/apps/core/components/public/js/tinymce/plugins/lists/plugin.min.js +1 -0
  343. data/apps/core/components/public/js/tinymce/plugins/media/moxieplayer.swf +0 -0
  344. data/apps/core/components/public/js/tinymce/plugins/media/plugin.js +878 -0
  345. data/apps/core/components/public/js/tinymce/plugins/media/plugin.min.js +1 -0
  346. data/apps/core/components/public/js/tinymce/plugins/nonbreaking/plugin.js +53 -0
  347. data/apps/core/components/public/js/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
  348. data/apps/core/components/public/js/tinymce/plugins/noneditable/plugin.js +101 -0
  349. data/apps/core/components/public/js/tinymce/plugins/noneditable/plugin.min.js +1 -0
  350. data/apps/core/components/public/js/tinymce/plugins/pagebreak/plugin.js +88 -0
  351. data/apps/core/components/public/js/tinymce/plugins/pagebreak/plugin.min.js +1 -0
  352. data/apps/core/components/public/js/tinymce/plugins/paste/classes/Clipboard.js +672 -0
  353. data/apps/core/components/public/js/tinymce/plugins/paste/classes/Plugin.js +121 -0
  354. data/apps/core/components/public/js/tinymce/plugins/paste/classes/Quirks.js +159 -0
  355. data/apps/core/components/public/js/tinymce/plugins/paste/classes/Utils.js +140 -0
  356. data/apps/core/components/public/js/tinymce/plugins/paste/classes/WordFilter.js +500 -0
  357. data/apps/core/components/public/js/tinymce/plugins/paste/plugin.dev.js +142 -0
  358. data/apps/core/components/public/js/tinymce/plugins/paste/plugin.js +1708 -0
  359. data/apps/core/components/public/js/tinymce/plugins/paste/plugin.min.js +1 -0
  360. data/apps/core/components/public/js/tinymce/plugins/preview/plugin.js +88 -0
  361. data/apps/core/components/public/js/tinymce/plugins/preview/plugin.min.js +1 -0
  362. data/apps/core/components/public/js/tinymce/plugins/print/plugin.js +32 -0
  363. data/apps/core/components/public/js/tinymce/plugins/print/plugin.min.js +1 -0
  364. data/apps/core/components/public/js/tinymce/plugins/save/plugin.js +98 -0
  365. data/apps/core/components/public/js/tinymce/plugins/save/plugin.min.js +1 -0
  366. data/apps/core/components/public/js/tinymce/plugins/searchreplace/plugin.js +609 -0
  367. data/apps/core/components/public/js/tinymce/plugins/searchreplace/plugin.min.js +1 -0
  368. data/apps/core/components/public/js/tinymce/plugins/spellchecker/classes/DomTextMatcher.js +480 -0
  369. data/apps/core/components/public/js/tinymce/plugins/spellchecker/classes/Plugin.js +439 -0
  370. data/apps/core/components/public/js/tinymce/plugins/spellchecker/plugin.dev.js +139 -0
  371. data/apps/core/components/public/js/tinymce/plugins/spellchecker/plugin.js +1026 -0
  372. data/apps/core/components/public/js/tinymce/plugins/spellchecker/plugin.min.js +1 -0
  373. data/apps/core/components/public/js/tinymce/plugins/tabfocus/plugin.js +120 -0
  374. data/apps/core/components/public/js/tinymce/plugins/tabfocus/plugin.min.js +1 -0
  375. data/apps/core/components/public/js/tinymce/plugins/table/classes/CellSelection.js +202 -0
  376. data/apps/core/components/public/js/tinymce/plugins/table/classes/Dialogs.js +824 -0
  377. data/apps/core/components/public/js/tinymce/plugins/table/classes/Plugin.js +599 -0
  378. data/apps/core/components/public/js/tinymce/plugins/table/classes/Quirks.js +400 -0
  379. data/apps/core/components/public/js/tinymce/plugins/table/classes/ResizeBars.js +984 -0
  380. data/apps/core/components/public/js/tinymce/plugins/table/classes/TableGrid.js +941 -0
  381. data/apps/core/components/public/js/tinymce/plugins/table/classes/Utils.js +36 -0
  382. data/apps/core/components/public/js/tinymce/plugins/table/plugin.dev.js +142 -0
  383. data/apps/core/components/public/js/tinymce/plugins/table/plugin.js +4106 -0
  384. data/apps/core/components/public/js/tinymce/plugins/table/plugin.min.js +2 -0
  385. data/apps/core/components/public/js/tinymce/plugins/template/plugin.js +270 -0
  386. data/apps/core/components/public/js/tinymce/plugins/template/plugin.min.js +1 -0
  387. data/apps/core/components/public/js/tinymce/plugins/textcolor/plugin.js +282 -0
  388. data/apps/core/components/public/js/tinymce/plugins/textcolor/plugin.min.js +1 -0
  389. data/apps/core/components/public/js/tinymce/plugins/textpattern/plugin.js +268 -0
  390. data/apps/core/components/public/js/tinymce/plugins/textpattern/plugin.min.js +1 -0
  391. data/apps/core/components/public/js/tinymce/plugins/visualblocks/css/visualblocks.css +135 -0
  392. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/address.gif +0 -0
  393. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/article.gif +0 -0
  394. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/aside.gif +0 -0
  395. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/blockquote.gif +0 -0
  396. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/div.gif +0 -0
  397. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/dl.gif +0 -0
  398. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/figure.gif +0 -0
  399. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/h1.gif +0 -0
  400. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/h2.gif +0 -0
  401. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/h3.gif +0 -0
  402. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/h4.gif +0 -0
  403. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/h5.gif +0 -0
  404. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/h6.gif +0 -0
  405. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/hgroup.gif +0 -0
  406. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/ol.gif +0 -0
  407. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/p.gif +0 -0
  408. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/pre.gif +0 -0
  409. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/section.gif +0 -0
  410. data/apps/core/components/public/js/tinymce/plugins/visualblocks/img/ul.gif +0 -0
  411. data/apps/core/components/public/js/tinymce/plugins/visualblocks/plugin.js +86 -0
  412. data/apps/core/components/public/js/tinymce/plugins/visualblocks/plugin.min.js +1 -0
  413. data/apps/core/components/public/js/tinymce/plugins/visualchars/plugin.js +123 -0
  414. data/apps/core/components/public/js/tinymce/plugins/visualchars/plugin.min.js +1 -0
  415. data/apps/core/components/public/js/tinymce/plugins/wordcount/plugin.js +69 -0
  416. data/apps/core/components/public/js/tinymce/plugins/wordcount/plugin.min.js +1 -0
  417. data/apps/core/components/public/js/tinymce/skins/lightgray/AbsoluteLayout.less +17 -0
  418. data/apps/core/components/public/js/tinymce/skins/lightgray/Animations.less +10 -0
  419. data/apps/core/components/public/js/tinymce/skins/lightgray/Button.less +172 -0
  420. data/apps/core/components/public/js/tinymce/skins/lightgray/ButtonGroup.less +71 -0
  421. data/apps/core/components/public/js/tinymce/skins/lightgray/Checkbox.less +49 -0
  422. data/apps/core/components/public/js/tinymce/skins/lightgray/ColorBox.less +6 -0
  423. data/apps/core/components/public/js/tinymce/skins/lightgray/ColorButton.less +72 -0
  424. data/apps/core/components/public/js/tinymce/skins/lightgray/ColorPicker.less +80 -0
  425. data/apps/core/components/public/js/tinymce/skins/lightgray/ComboBox.less +39 -0
  426. data/apps/core/components/public/js/tinymce/skins/lightgray/Container.less +9 -0
  427. data/apps/core/components/public/js/tinymce/skins/lightgray/Content.Inline.less +4 -0
  428. data/apps/core/components/public/js/tinymce/skins/lightgray/Content.Objects.less +166 -0
  429. data/apps/core/components/public/js/tinymce/skins/lightgray/Content.less +27 -0
  430. data/apps/core/components/public/js/tinymce/skins/lightgray/CropRect.less +54 -0
  431. data/apps/core/components/public/js/tinymce/skins/lightgray/FieldSet.less +15 -0
  432. data/apps/core/components/public/js/tinymce/skins/lightgray/FitLayout.less +9 -0
  433. data/apps/core/components/public/js/tinymce/skins/lightgray/FloatPanel.less +69 -0
  434. data/apps/core/components/public/js/tinymce/skins/lightgray/FlowLayout.less +36 -0
  435. data/apps/core/components/public/js/tinymce/skins/lightgray/Icons.Ie7.less +136 -0
  436. data/apps/core/components/public/js/tinymce/skins/lightgray/Icons.less +180 -0
  437. data/apps/core/components/public/js/tinymce/skins/lightgray/Iframe.less +6 -0
  438. data/apps/core/components/public/js/tinymce/skins/lightgray/ImagePanel.less +20 -0
  439. data/apps/core/components/public/js/tinymce/skins/lightgray/InfoBox.less +71 -0
  440. data/apps/core/components/public/js/tinymce/skins/lightgray/Label.less +38 -0
  441. data/apps/core/components/public/js/tinymce/skins/lightgray/ListBox.less +26 -0
  442. data/apps/core/components/public/js/tinymce/skins/lightgray/Menu.less +34 -0
  443. data/apps/core/components/public/js/tinymce/skins/lightgray/MenuBar.less +32 -0
  444. data/apps/core/components/public/js/tinymce/skins/lightgray/MenuButton.less +34 -0
  445. data/apps/core/components/public/js/tinymce/skins/lightgray/MenuItem.less +142 -0
  446. data/apps/core/components/public/js/tinymce/skins/lightgray/Mixins.less +54 -0
  447. data/apps/core/components/public/js/tinymce/skins/lightgray/Notification.less +144 -0
  448. data/apps/core/components/public/js/tinymce/skins/lightgray/Panel.less +7 -0
  449. data/apps/core/components/public/js/tinymce/skins/lightgray/Path.less +45 -0
  450. data/apps/core/components/public/js/tinymce/skins/lightgray/Progress.less +34 -0
  451. data/apps/core/components/public/js/tinymce/skins/lightgray/Radio.less +1 -0
  452. data/apps/core/components/public/js/tinymce/skins/lightgray/Reset.less +32 -0
  453. data/apps/core/components/public/js/tinymce/skins/lightgray/ResizeHandle.less +18 -0
  454. data/apps/core/components/public/js/tinymce/skins/lightgray/Scrollable.less +44 -0
  455. data/apps/core/components/public/js/tinymce/skins/lightgray/SelectBox.less +6 -0
  456. data/apps/core/components/public/js/tinymce/skins/lightgray/Slider.less +29 -0
  457. data/apps/core/components/public/js/tinymce/skins/lightgray/Spacer.less +5 -0
  458. data/apps/core/components/public/js/tinymce/skins/lightgray/SplitButton.less +49 -0
  459. data/apps/core/components/public/js/tinymce/skins/lightgray/StackLayout.less +5 -0
  460. data/apps/core/components/public/js/tinymce/skins/lightgray/TabPanel.less +44 -0
  461. data/apps/core/components/public/js/tinymce/skins/lightgray/TextBox.less +41 -0
  462. data/apps/core/components/public/js/tinymce/skins/lightgray/Throbber.less +19 -0
  463. data/apps/core/components/public/js/tinymce/skins/lightgray/TinyMCE.less +159 -0
  464. data/apps/core/components/public/js/tinymce/skins/lightgray/ToolTip.less +129 -0
  465. data/apps/core/components/public/js/tinymce/skins/lightgray/Variables.less +214 -0
  466. data/apps/core/components/public/js/tinymce/skins/lightgray/Window.less +127 -0
  467. data/apps/core/components/public/js/tinymce/skins/lightgray/content.inline.min.css +1 -0
  468. data/apps/core/components/public/js/tinymce/skins/lightgray/content.min.css +1 -0
  469. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/readme.md +1 -0
  470. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
  471. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce-small.json +1277 -0
  472. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce-small.svg +63 -0
  473. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  474. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
  475. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
  476. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce.json +3381 -0
  477. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce.svg +129 -0
  478. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
  479. data/apps/core/components/public/js/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
  480. data/apps/core/components/public/js/tinymce/skins/lightgray/img/anchor.gif +0 -0
  481. data/apps/core/components/public/js/tinymce/skins/lightgray/img/loader.gif +0 -0
  482. data/apps/core/components/public/js/tinymce/skins/lightgray/img/object.gif +0 -0
  483. data/apps/core/components/public/js/tinymce/skins/lightgray/img/trans.gif +0 -0
  484. data/apps/core/components/public/js/tinymce/skins/lightgray/skin.dev.less +46 -0
  485. data/apps/core/components/public/js/tinymce/skins/lightgray/skin.ie7.dev.less +46 -0
  486. data/apps/core/components/public/js/tinymce/skins/lightgray/skin.ie7.less +2542 -0
  487. data/apps/core/components/public/js/tinymce/skins/lightgray/skin.ie7.min.css +1 -0
  488. data/apps/core/components/public/js/tinymce/skins/lightgray/skin.less +2586 -0
  489. data/apps/core/components/public/js/tinymce/skins/lightgray/skin.min.css +1 -0
  490. data/apps/core/components/public/js/tinymce/themes/modern/theme.js +878 -0
  491. data/apps/core/components/public/js/tinymce/themes/modern/theme.min.js +1 -0
  492. data/apps/core/components/public/js/tinymce/tinymce.dev.js +286 -0
  493. data/apps/core/components/public/js/tinymce/tinymce.js +45811 -0
  494. data/apps/core/components/public/js/tinymce/tinymce.min.js +13 -0
  495. data/apps/core/forms/widgets/form/form.rb +3 -1
  496. data/apps/core/forms/widgets/form/form.shtml +1 -0
  497. data/apps/core/forms/widgets/inputs/search_select/search_select.rb +1 -1
  498. data/apps/core/forms/widgets/inputs/select/select.rb +1 -1
  499. data/apps/core/forms/widgets/inputs/select/select.shtml +0 -1
  500. data/apps/messenger/backends/sms/skebby.rb +1 -1
  501. data/apps/messenger/controllers/mixins/messenger_helper.rb +23 -5
  502. data/lib/spiderfw/config/options/spider.rb +1 -1
  503. data/lib/spiderfw/controller/mixins/visual.rb +2 -0
  504. data/lib/spiderfw/http/adapters/rack.rb +10 -5
  505. data/lib/spiderfw/http/http.rb +4 -2
  506. data/lib/spiderfw/model/base_model.rb +4 -4
  507. data/lib/spiderfw/model/mappers/db_mapper.rb +4 -2
  508. data/lib/spiderfw/model/storage/db/adapters/mysql.rb +2 -1
  509. data/lib/spiderfw/model/storage/db/db_storage.rb +4 -0
  510. data/lib/spiderfw/spider.rb +6 -0
  511. data/lib/spiderfw/templates/layout.rb +1 -1
  512. data/lib/spiderfw/utils/monkey/object.rb +3 -0
  513. data/spider.gemspec +6 -2
  514. metadata +539 -42
  515. data/blueprints/.DS_Store +0 -0
@@ -0,0 +1,400 @@
1
+ /**
2
+ * Quirks.js
3
+ *
4
+ * Released under LGPL License.
5
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /**
12
+ * This class includes fixes for various browser quirks.
13
+ *
14
+ * @class tinymce.tableplugin.Quirks
15
+ * @private
16
+ */
17
+ define("tinymce/tableplugin/Quirks", [
18
+ "tinymce/util/VK",
19
+ "tinymce/util/Delay",
20
+ "tinymce/Env",
21
+ "tinymce/util/Tools",
22
+ "tinymce/tableplugin/Utils"
23
+ ], function(VK, Delay, Env, Tools, Utils) {
24
+ var each = Tools.each, getSpanVal = Utils.getSpanVal;
25
+
26
+ return function(editor) {
27
+ /**
28
+ * Fixed caret movement around tables on WebKit.
29
+ */
30
+ function moveWebKitSelection() {
31
+ function eventHandler(e) {
32
+ var key = e.keyCode;
33
+
34
+ function handle(upBool, sourceNode) {
35
+ var siblingDirection = upBool ? 'previousSibling' : 'nextSibling';
36
+ var currentRow = editor.dom.getParent(sourceNode, 'tr');
37
+ var siblingRow = currentRow[siblingDirection];
38
+
39
+ if (siblingRow) {
40
+ moveCursorToRow(editor, sourceNode, siblingRow, upBool);
41
+ e.preventDefault();
42
+ return true;
43
+ }
44
+
45
+ var tableNode = editor.dom.getParent(currentRow, 'table');
46
+ var middleNode = currentRow.parentNode;
47
+ var parentNodeName = middleNode.nodeName.toLowerCase();
48
+ if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) {
49
+ var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody');
50
+ if (targetParent !== null) {
51
+ return moveToRowInTarget(upBool, targetParent, sourceNode);
52
+ }
53
+ }
54
+
55
+ return escapeTable(upBool, currentRow, siblingDirection, tableNode);
56
+ }
57
+
58
+ function getTargetParent(upBool, topNode, secondNode, nodeName) {
59
+ var tbodies = editor.dom.select('>' + nodeName, topNode);
60
+ var position = tbodies.indexOf(secondNode);
61
+ if (upBool && position === 0 || !upBool && position === tbodies.length - 1) {
62
+ return getFirstHeadOrFoot(upBool, topNode);
63
+ } else if (position === -1) {
64
+ var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1;
65
+ return tbodies[topOrBottom];
66
+ }
67
+
68
+ return tbodies[position + (upBool ? -1 : 1)];
69
+ }
70
+
71
+ function getFirstHeadOrFoot(upBool, parent) {
72
+ var tagName = upBool ? 'thead' : 'tfoot';
73
+ var headOrFoot = editor.dom.select('>' + tagName, parent);
74
+ return headOrFoot.length !== 0 ? headOrFoot[0] : null;
75
+ }
76
+
77
+ function moveToRowInTarget(upBool, targetParent, sourceNode) {
78
+ var targetRow = getChildForDirection(targetParent, upBool);
79
+
80
+ if (targetRow) {
81
+ moveCursorToRow(editor, sourceNode, targetRow, upBool);
82
+ }
83
+
84
+ e.preventDefault();
85
+ return true;
86
+ }
87
+
88
+ function escapeTable(upBool, currentRow, siblingDirection, table) {
89
+ var tableSibling = table[siblingDirection];
90
+
91
+ if (tableSibling) {
92
+ moveCursorToStartOfElement(tableSibling);
93
+ return true;
94
+ }
95
+
96
+ var parentCell = editor.dom.getParent(table, 'td,th');
97
+ if (parentCell) {
98
+ return handle(upBool, parentCell, e);
99
+ }
100
+
101
+ var backUpSibling = getChildForDirection(currentRow, !upBool);
102
+ moveCursorToStartOfElement(backUpSibling);
103
+ e.preventDefault();
104
+ return false;
105
+ }
106
+
107
+ function getChildForDirection(parent, up) {
108
+ var child = parent && parent[up ? 'lastChild' : 'firstChild'];
109
+ // BR is not a valid table child to return in this case we return the table cell
110
+ return child && child.nodeName === 'BR' ? editor.dom.getParent(child, 'td,th') : child;
111
+ }
112
+
113
+ function moveCursorToStartOfElement(n) {
114
+ editor.selection.setCursorLocation(n, 0);
115
+ }
116
+
117
+ function isVerticalMovement() {
118
+ return key == VK.UP || key == VK.DOWN;
119
+ }
120
+
121
+ function isInTable(editor) {
122
+ var node = editor.selection.getNode();
123
+ var currentRow = editor.dom.getParent(node, 'tr');
124
+ return currentRow !== null;
125
+ }
126
+
127
+ function columnIndex(column) {
128
+ var colIndex = 0;
129
+ var c = column;
130
+ while (c.previousSibling) {
131
+ c = c.previousSibling;
132
+ colIndex = colIndex + getSpanVal(c, "colspan");
133
+ }
134
+ return colIndex;
135
+ }
136
+
137
+ function findColumn(rowElement, columnIndex) {
138
+ var c = 0, r = 0;
139
+
140
+ each(rowElement.children, function(cell, i) {
141
+ c = c + getSpanVal(cell, "colspan");
142
+ r = i;
143
+ if (c > columnIndex) {
144
+ return false;
145
+ }
146
+ });
147
+ return r;
148
+ }
149
+
150
+ function moveCursorToRow(ed, node, row, upBool) {
151
+ var srcColumnIndex = columnIndex(editor.dom.getParent(node, 'td,th'));
152
+ var tgtColumnIndex = findColumn(row, srcColumnIndex);
153
+ var tgtNode = row.childNodes[tgtColumnIndex];
154
+ var rowCellTarget = getChildForDirection(tgtNode, upBool);
155
+ moveCursorToStartOfElement(rowCellTarget || tgtNode);
156
+ }
157
+
158
+ function shouldFixCaret(preBrowserNode) {
159
+ var newNode = editor.selection.getNode();
160
+ var newParent = editor.dom.getParent(newNode, 'td,th');
161
+ var oldParent = editor.dom.getParent(preBrowserNode, 'td,th');
162
+
163
+ return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent);
164
+ }
165
+
166
+ function checkSameParentTable(nodeOne, NodeTwo) {
167
+ return editor.dom.getParent(nodeOne, 'TABLE') === editor.dom.getParent(NodeTwo, 'TABLE');
168
+ }
169
+
170
+ if (isVerticalMovement() && isInTable(editor)) {
171
+ var preBrowserNode = editor.selection.getNode();
172
+ Delay.setEditorTimeout(editor, function() {
173
+ if (shouldFixCaret(preBrowserNode)) {
174
+ handle(!e.shiftKey && key === VK.UP, preBrowserNode, e);
175
+ }
176
+ }, 0);
177
+ }
178
+ }
179
+
180
+ editor.on('KeyDown', function(e) {
181
+ eventHandler(e);
182
+ });
183
+ }
184
+
185
+ function fixBeforeTableCaretBug() {
186
+ // Checks if the selection/caret is at the start of the specified block element
187
+ function isAtStart(rng, par) {
188
+ var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
189
+
190
+ rng2.setStartBefore(par);
191
+ rng2.setEnd(rng.endContainer, rng.endOffset);
192
+
193
+ elm = doc.createElement('body');
194
+ elm.appendChild(rng2.cloneContents());
195
+
196
+ // Check for text characters of other elements that should be treated as content
197
+ return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length === 0;
198
+ }
199
+
200
+ // Fixes an bug where it's impossible to place the caret before a table in Gecko
201
+ // this fix solves it by detecting when the caret is at the beginning of such a table
202
+ // and then manually moves the caret infront of the table
203
+ editor.on('KeyDown', function(e) {
204
+ var rng, table, dom = editor.dom;
205
+
206
+ // On gecko it's not possible to place the caret before a table
207
+ if (e.keyCode == 37 || e.keyCode == 38) {
208
+ rng = editor.selection.getRng();
209
+ table = dom.getParent(rng.startContainer, 'table');
210
+
211
+ if (table && editor.getBody().firstChild == table) {
212
+ if (isAtStart(rng, table)) {
213
+ rng = dom.createRng();
214
+
215
+ rng.setStartBefore(table);
216
+ rng.setEndBefore(table);
217
+
218
+ editor.selection.setRng(rng);
219
+
220
+ e.preventDefault();
221
+ }
222
+ }
223
+ }
224
+ });
225
+ }
226
+
227
+ // Fixes an issue on Gecko where it's impossible to place the caret behind a table
228
+ // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
229
+ function fixTableCaretPos() {
230
+ editor.on('KeyDown SetContent VisualAid', function() {
231
+ var last;
232
+
233
+ // Skip empty text nodes from the end
234
+ for (last = editor.getBody().lastChild; last; last = last.previousSibling) {
235
+ if (last.nodeType == 3) {
236
+ if (last.nodeValue.length > 0) {
237
+ break;
238
+ }
239
+ } else if (last.nodeType == 1 && (last.tagName == 'BR' || !last.getAttribute('data-mce-bogus'))) {
240
+ break;
241
+ }
242
+ }
243
+
244
+ if (last && last.nodeName == 'TABLE') {
245
+ if (editor.settings.forced_root_block) {
246
+ editor.dom.add(
247
+ editor.getBody(),
248
+ editor.settings.forced_root_block,
249
+ editor.settings.forced_root_block_attrs,
250
+ Env.ie && Env.ie < 10 ? '&nbsp;' : '<br data-mce-bogus="1" />'
251
+ );
252
+ } else {
253
+ editor.dom.add(editor.getBody(), 'br', {'data-mce-bogus': '1'});
254
+ }
255
+ }
256
+ });
257
+
258
+ editor.on('PreProcess', function(o) {
259
+ var last = o.node.lastChild;
260
+
261
+ if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 &&
262
+ (last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) &&
263
+ last.previousSibling && last.previousSibling.nodeName == "TABLE") {
264
+ editor.dom.remove(last);
265
+ }
266
+ });
267
+ }
268
+
269
+ // this nasty hack is here to work around some WebKit selection bugs.
270
+ function fixTableCellSelection() {
271
+ function tableCellSelected(ed, rng, n, currentCell) {
272
+ // The decision of when a table cell is selected is somewhat involved. The fact that this code is
273
+ // required is actually a pointer to the root cause of this bug. A cell is selected when the start
274
+ // and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases)
275
+ // or the parent of the table (in the case of the selection containing the last cell of a table).
276
+ var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE');
277
+ var tableParent, allOfCellSelected, tableCellSelection;
278
+
279
+ if (table) {
280
+ tableParent = table.parentNode;
281
+ }
282
+
283
+ allOfCellSelected = rng.startContainer.nodeType == TEXT_NODE &&
284
+ rng.startOffset === 0 &&
285
+ rng.endOffset === 0 &&
286
+ currentCell &&
287
+ (n.nodeName == "TR" || n == tableParent);
288
+
289
+ tableCellSelection = (n.nodeName == "TD" || n.nodeName == "TH") && !currentCell;
290
+
291
+ return allOfCellSelected || tableCellSelection;
292
+ }
293
+
294
+ function fixSelection() {
295
+ var rng = editor.selection.getRng();
296
+ var n = editor.selection.getNode();
297
+ var currentCell = editor.dom.getParent(rng.startContainer, 'TD,TH');
298
+
299
+ if (!tableCellSelected(editor, rng, n, currentCell)) {
300
+ return;
301
+ }
302
+
303
+ if (!currentCell) {
304
+ currentCell = n;
305
+ }
306
+
307
+ // Get the very last node inside the table cell
308
+ var end = currentCell.lastChild;
309
+ while (end.lastChild) {
310
+ end = end.lastChild;
311
+ }
312
+
313
+ // Select the entire table cell. Nothing outside of the table cell should be selected.
314
+ if (end.nodeType == 3) {
315
+ rng.setEnd(end, end.data.length);
316
+ editor.selection.setRng(rng);
317
+ }
318
+ }
319
+
320
+ editor.on('KeyDown', function() {
321
+ fixSelection();
322
+ });
323
+
324
+ editor.on('MouseDown', function(e) {
325
+ if (e.button != 2) {
326
+ fixSelection();
327
+ }
328
+ });
329
+ }
330
+
331
+ /**
332
+ * Delete table if all cells are selected.
333
+ */
334
+ function deleteTable() {
335
+ function placeCaretInCell(cell) {
336
+ editor.selection.select(cell, true);
337
+ editor.selection.collapse(true);
338
+ }
339
+
340
+ function clearCell(cell) {
341
+ editor.$(cell).empty();
342
+ Utils.paddCell(cell);
343
+ }
344
+
345
+ editor.on('keydown', function(e) {
346
+ if ((e.keyCode == VK.DELETE || e.keyCode == VK.BACKSPACE) && !e.isDefaultPrevented()) {
347
+ var table, tableCells, selectedTableCells, cell;
348
+
349
+ table = editor.dom.getParent(editor.selection.getStart(), 'table');
350
+ if (table) {
351
+ tableCells = editor.dom.select('td,th', table);
352
+ selectedTableCells = Tools.grep(tableCells, function(cell) {
353
+ return !!editor.dom.getAttrib(cell, 'data-mce-selected');
354
+ });
355
+
356
+ if (selectedTableCells.length === 0) {
357
+ // If caret is within an empty table cell then empty it for real
358
+ cell = editor.dom.getParent(editor.selection.getStart(), 'td,th');
359
+ if (editor.selection.isCollapsed() && cell && editor.dom.isEmpty(cell)) {
360
+ e.preventDefault();
361
+ clearCell(cell);
362
+ placeCaretInCell(cell);
363
+ }
364
+
365
+ return;
366
+ }
367
+
368
+ e.preventDefault();
369
+
370
+ editor.undoManager.transact(function() {
371
+ if (tableCells.length == selectedTableCells.length) {
372
+ editor.execCommand('mceTableDelete');
373
+ } else {
374
+ Tools.each(selectedTableCells, clearCell);
375
+ placeCaretInCell(selectedTableCells[0]);
376
+ }
377
+ });
378
+ }
379
+ }
380
+ });
381
+ }
382
+
383
+ deleteTable();
384
+
385
+ if (Env.webkit) {
386
+ moveWebKitSelection();
387
+ fixTableCellSelection();
388
+ }
389
+
390
+ if (Env.gecko) {
391
+ fixBeforeTableCaretBug();
392
+ fixTableCaretPos();
393
+ }
394
+
395
+ if (Env.ie > 9) {
396
+ fixBeforeTableCaretBug();
397
+ fixTableCaretPos();
398
+ }
399
+ };
400
+ });
@@ -0,0 +1,984 @@
1
+ /**
2
+ * ResizeBars.js
3
+ *
4
+ * Released under LGPL License.
5
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /**
12
+ * This class handles table column and row resizing by adding divs over the columns and rows of the table.
13
+ * These divs are then manipulated using mouse events to resize the underlying table.
14
+ *
15
+ * @class tinymce.tableplugin.ResizeBars
16
+ * @private
17
+ */
18
+ define("tinymce/tableplugin/ResizeBars", [
19
+ "tinymce/util/Tools",
20
+ "tinymce/util/VK"
21
+ ], function(Tools, VK) {
22
+ var hoverTable;
23
+
24
+ return function(editor) {
25
+ var RESIZE_BAR_CLASS = 'mce-resize-bar',
26
+ RESIZE_BAR_ROW_CLASS = 'mce-resize-bar-row',
27
+ RESIZE_BAR_ROW_CURSOR_STYLE = 'row-resize',
28
+ RESIZE_BAR_ROW_DATA_ATTRIBUTE = 'data-row',
29
+ RESIZE_BAR_ROW_DATA_INITIAL_TOP_ATTRIBUTE = 'data-initial-top',
30
+ RESIZE_BAR_COL_CLASS = 'mce-resize-bar-col',
31
+ RESIZE_BAR_COL_CURSOR_STYLE = 'col-resize',
32
+ RESIZE_BAR_COL_DATA_ATTRIBUTE = 'data-col',
33
+ RESIZE_BAR_COL_DATA_INITIAL_LEFT_ATTRIBUTE = 'data-initial-left',
34
+ RESIZE_BAR_THICKNESS = 4,
35
+ RESIZE_MINIMUM_WIDTH = 10,
36
+ RESIZE_MINIMUM_HEIGHT = 10,
37
+ RESIZE_BAR_DRAGGING_CLASS = 'mce-resize-bar-dragging';
38
+
39
+ var percentageBasedSizeRegex = new RegExp(/(\d+(\.\d+)?%)/),
40
+ pixelBasedSizeRegex = new RegExp(/px|em/);
41
+
42
+ var delayDrop, dragging, blockerElement, dragBar, lastX, lastY;
43
+
44
+ // Get the absolute position's top edge.
45
+ function getTopEdge(index, row) {
46
+ return {
47
+ index: index,
48
+ y: editor.dom.getPos(row).y
49
+ };
50
+ }
51
+
52
+ // Get the absolute position's bottom edge.
53
+ function getBottomEdge(index, row) {
54
+ return {
55
+ index: index,
56
+ y: editor.dom.getPos(row).y + row.offsetHeight
57
+ };
58
+ }
59
+
60
+ // Get the absolute position's left edge.
61
+ function getLeftEdge(index, cell) {
62
+ return {
63
+ index: index,
64
+ x: editor.dom.getPos(cell).x
65
+ };
66
+ }
67
+
68
+ // Get the absolute position's right edge.
69
+ function getRightEdge(index, cell) {
70
+ return {
71
+ index: index,
72
+ x: editor.dom.getPos(cell).x + cell.offsetWidth
73
+ };
74
+ }
75
+
76
+ function isRtl() {
77
+ var dir = editor.getBody().dir;
78
+ return dir === 'rtl';
79
+ }
80
+
81
+ function isInline() {
82
+ return editor.inline;
83
+ }
84
+
85
+ function getBody() {
86
+ return isInline ? editor.getBody().ownerDocument.body : editor.getBody();
87
+ }
88
+
89
+ function getInnerEdge(index, cell) {
90
+ return isRtl() ? getRightEdge(index, cell) : getLeftEdge(index, cell);
91
+ }
92
+
93
+ function getOuterEdge(index, cell) {
94
+ return isRtl() ? getLeftEdge(index, cell) : getRightEdge(index, cell);
95
+ }
96
+
97
+ function getPercentageWidthFallback(element, table) {
98
+ return getComputedStyleSize(element, 'width') / getComputedStyleSize(table, 'width') * 100;
99
+ }
100
+
101
+ function getComputedStyleSize(element, property) {
102
+ var widthString = editor.dom.getStyle(element, property, true);
103
+ var width = parseInt(widthString, 10);
104
+ return width;
105
+ }
106
+
107
+ function getCurrentTablePercentWidth(table) {
108
+ var tableWidth = getComputedStyleSize(table, 'width');
109
+ var tableParentWidth = getComputedStyleSize(table.parentElement, 'width');
110
+ return tableWidth / tableParentWidth * 100;
111
+ }
112
+
113
+ function getCellPercentDelta(table, delta) {
114
+ var tableWidth = getComputedStyleSize(table, 'width');
115
+ return delta / tableWidth * 100;
116
+ }
117
+
118
+ function getTablePercentDelta(table, delta) {
119
+ var tableParentWidth = getComputedStyleSize(table.parentElement, 'width');
120
+ return delta / tableParentWidth * 100;
121
+ }
122
+
123
+ // Find the left/right (ltr/rtl) or top side locations of the cells to measure.
124
+ // This is the location of the borders we need to draw over.
125
+ function findPositions(getInner, getOuter, thingsToMeasure) {
126
+ var tablePositions = [];
127
+
128
+ // Skip the first item in the array = no left (LTR), right (RTL) or top bars
129
+ for (var i = 1; i < thingsToMeasure.length; i++) {
130
+ // Get the element from the details
131
+ var item = thingsToMeasure[i].element;
132
+
133
+ // We need to zero index this again
134
+ tablePositions.push(getInner(i - 1, item));
135
+ }
136
+
137
+ var lastTableLineToMake = thingsToMeasure[thingsToMeasure.length - 1];
138
+ tablePositions.push(getOuter(thingsToMeasure.length - 1, lastTableLineToMake.element));
139
+
140
+ return tablePositions;
141
+ }
142
+
143
+ // Clear the bars.
144
+ function clearBars() {
145
+ var bars = editor.dom.select('.' + RESIZE_BAR_CLASS, getBody());
146
+ Tools.each(bars, function(bar) {
147
+ editor.dom.remove(bar);
148
+ });
149
+ }
150
+
151
+ // Refresh the bars.
152
+ function refreshBars(tableElement) {
153
+ clearBars();
154
+ drawBars(tableElement);
155
+ }
156
+
157
+ // Generates a resize bar object for the editor to add.
158
+ function generateBar(classToAdd, cursor, left, top, height, width, indexAttr, index) {
159
+ var bar = {
160
+ 'data-mce-bogus': 'all',
161
+ 'class': RESIZE_BAR_CLASS + ' ' + classToAdd,
162
+ 'unselectable': 'on',
163
+ 'data-mce-resize': false,
164
+ style: 'cursor: ' + cursor + '; ' +
165
+ 'margin: 0; ' +
166
+ 'padding: 0; ' +
167
+ 'position: absolute; ' +
168
+ 'left: ' + left + 'px; ' +
169
+ 'top: ' + top + 'px; ' +
170
+ 'height: ' + height + 'px; ' +
171
+ 'width: ' + width + 'px; '
172
+ };
173
+
174
+ bar[indexAttr] = index;
175
+
176
+ return bar;
177
+ }
178
+
179
+ // Draw the row bars over the row borders.
180
+ function drawRows(rowPositions, tableWidth, tablePosition) {
181
+ Tools.each(rowPositions, function(rowPosition) {
182
+ var left = tablePosition.x,
183
+ top = rowPosition.y - RESIZE_BAR_THICKNESS / 2,
184
+ height = RESIZE_BAR_THICKNESS,
185
+ width = tableWidth;
186
+
187
+ editor.dom.add(getBody(), 'div',
188
+ generateBar(RESIZE_BAR_ROW_CLASS, RESIZE_BAR_ROW_CURSOR_STYLE,
189
+ left, top, height, width, RESIZE_BAR_ROW_DATA_ATTRIBUTE, rowPosition.index));
190
+ });
191
+ }
192
+
193
+ // Draw the column bars over the column borders.
194
+ function drawCols(cellPositions, tableHeight, tablePosition) {
195
+ Tools.each(cellPositions, function(cellPosition) {
196
+ var left = cellPosition.x - RESIZE_BAR_THICKNESS / 2,
197
+ top = tablePosition.y,
198
+ height = tableHeight,
199
+ width = RESIZE_BAR_THICKNESS;
200
+
201
+ editor.dom.add(getBody(), 'div',
202
+ generateBar(RESIZE_BAR_COL_CLASS, RESIZE_BAR_COL_CURSOR_STYLE,
203
+ left, top, height, width, RESIZE_BAR_COL_DATA_ATTRIBUTE, cellPosition.index));
204
+ });
205
+ }
206
+
207
+ // Get a matrix of the cells in each row and the rows in the table.
208
+ function getTableDetails(table) {
209
+ return Tools.map(table.rows, function(row) {
210
+
211
+ var cells = Tools.map(row.cells, function(cell) {
212
+
213
+ var rowspan = cell.hasAttribute('rowspan') ? parseInt(cell.getAttribute('rowspan'), 10) : 1;
214
+ var colspan = cell.hasAttribute('colspan') ? parseInt(cell.getAttribute('colspan'), 10) : 1;
215
+
216
+ return {
217
+ element: cell,
218
+ rowspan: rowspan,
219
+ colspan: colspan
220
+ };
221
+ });
222
+
223
+ return {
224
+ element: row,
225
+ cells: cells
226
+ };
227
+
228
+ });
229
+
230
+ }
231
+
232
+ // Get a grid model of the table.
233
+ function getTableGrid(tableDetails) {
234
+ function key(rowIndex, colIndex) {
235
+ return rowIndex + ',' + colIndex;
236
+ }
237
+
238
+ function getAt(rowIndex, colIndex) {
239
+ return access[key(rowIndex, colIndex)];
240
+ }
241
+
242
+ function getAllCells() {
243
+ var allCells = [];
244
+ Tools.each(rows, function(row) {
245
+ allCells = allCells.concat(row.cells);
246
+ });
247
+ return allCells;
248
+ }
249
+
250
+ function getAllRows() {
251
+ return rows;
252
+ }
253
+
254
+ var access = {};
255
+ var rows = [];
256
+
257
+ var maxRows = 0;
258
+ var maxCols = 0;
259
+
260
+ Tools.each(tableDetails, function(row, rowIndex) {
261
+ var currentRow = [];
262
+
263
+ Tools.each(row.cells, function(cell) {
264
+
265
+ var start = 0;
266
+
267
+ while (access[key(rowIndex, start)] !== undefined) {
268
+ start++;
269
+ }
270
+
271
+ var current = {
272
+ element: cell.element,
273
+ colspan: cell.colspan,
274
+ rowspan: cell.rowspan,
275
+ rowIndex: rowIndex,
276
+ colIndex: start
277
+ };
278
+
279
+ for (var i = 0; i < cell.colspan; i++) {
280
+ for (var j = 0; j < cell.rowspan; j++) {
281
+ var cr = rowIndex + j;
282
+ var cc = start + i;
283
+ access[key(cr, cc)] = current;
284
+ maxRows = Math.max(maxRows, cr + 1);
285
+ maxCols = Math.max(maxCols, cc + 1);
286
+ }
287
+ }
288
+
289
+ currentRow.push(current);
290
+ });
291
+
292
+ rows.push({
293
+ element: row.element,
294
+ cells: currentRow
295
+ });
296
+ });
297
+
298
+ return {
299
+ grid: {
300
+ maxRows: maxRows,
301
+ maxCols: maxCols
302
+ },
303
+ getAt: getAt,
304
+ getAllCells: getAllCells,
305
+ getAllRows: getAllRows
306
+ };
307
+ }
308
+
309
+ function range(start, end) {
310
+ var r = [];
311
+
312
+ for (var i = start; i < end; i++) {
313
+ r.push(i);
314
+ }
315
+
316
+ return r;
317
+ }
318
+
319
+ // Attempt to get a representative single block for this column.
320
+ // If we can't find a single block, all blocks in this row/column are spanned
321
+ // and we'll need to fallback to getting the first cell in the row/column.
322
+ function decide(getBlock, isSingle, getFallback) {
323
+ var inBlock = getBlock();
324
+ var singleInBlock;
325
+
326
+ for (var i = 0; i < inBlock.length; i++) {
327
+ if (isSingle(inBlock[i])) {
328
+ singleInBlock = inBlock[i];
329
+ }
330
+ }
331
+ return singleInBlock ? singleInBlock : getFallback();
332
+ }
333
+
334
+ // Attempt to get representative blocks for the width of each column.
335
+ function getColumnBlocks(tableGrid) {
336
+ var cols = range(0, tableGrid.grid.maxCols);
337
+ var rows = range(0, tableGrid.grid.maxRows);
338
+
339
+ return Tools.map(cols, function(col) {
340
+ function getBlock() {
341
+ var details = [];
342
+ for (var i = 0; i < rows.length; i++) {
343
+ var detail = tableGrid.getAt(i, col);
344
+ if (detail && detail.colIndex === col) {
345
+ details.push(detail);
346
+ }
347
+ }
348
+
349
+ return details;
350
+ }
351
+
352
+ function isSingle(detail) {
353
+ return detail.colspan === 1;
354
+ }
355
+
356
+ function getFallback() {
357
+ var item;
358
+
359
+ for (var i = 0; i < rows.length; i++) {
360
+ item = tableGrid.getAt(i, col);
361
+ if (item) {
362
+ return item;
363
+ }
364
+ }
365
+
366
+ return null;
367
+ }
368
+
369
+ return decide(getBlock, isSingle, getFallback);
370
+ });
371
+ }
372
+
373
+ // Attempt to get representative blocks for the height of each row.
374
+ function getRowBlocks(tableGrid) {
375
+ var cols = range(0, tableGrid.grid.maxCols);
376
+ var rows = range(0, tableGrid.grid.maxRows);
377
+
378
+ return Tools.map(rows, function(row) {
379
+ function getBlock() {
380
+ var details = [];
381
+ for (var i = 0; i < cols.length; i++) {
382
+ var detail = tableGrid.getAt(row, i);
383
+ if (detail && detail.rowIndex === row) {
384
+ details.push(detail);
385
+ }
386
+ }
387
+ return details;
388
+ }
389
+
390
+ function isSingle(detail) {
391
+ return detail.rowspan === 1;
392
+ }
393
+
394
+ function getFallback() {
395
+ return tableGrid.getAt(row, 0);
396
+ }
397
+
398
+ return decide(getBlock, isSingle, getFallback);
399
+ });
400
+ }
401
+
402
+ // Draw resize bars over the left/right (ltr/rtl) or top side locations of the cells to measure.
403
+ // This is the location of the borders we need to draw over.
404
+ function drawBars(table) {
405
+ var tableDetails = getTableDetails(table);
406
+ var tableGrid = getTableGrid(tableDetails);
407
+ var rows = getRowBlocks(tableGrid);
408
+ var cols = getColumnBlocks(tableGrid);
409
+
410
+ var tablePosition = editor.dom.getPos(table);
411
+ var rowPositions = rows.length > 0 ? findPositions(getTopEdge, getBottomEdge, rows) : [];
412
+ var colPositions = cols.length > 0 ? findPositions(getInnerEdge, getOuterEdge, cols) : [];
413
+
414
+ drawRows(rowPositions, table.offsetWidth, tablePosition);
415
+ drawCols(colPositions, table.offsetHeight, tablePosition);
416
+ }
417
+
418
+ // Attempt to deduce the width/height of a column/row that has more than one cell spanned.
419
+ function deduceSize(deducables, index, isPercentageBased, table) {
420
+ if (index < 0 || index >= deducables.length - 1) {
421
+ return "";
422
+ }
423
+
424
+ var current = deducables[index];
425
+
426
+ if (current) {
427
+ current = {
428
+ value: current,
429
+ delta: 0
430
+ };
431
+ } else {
432
+ var reversedUpToIndex = deducables.slice(0, index).reverse();
433
+ for (var i = 0; i < reversedUpToIndex.length; i++) {
434
+ if (reversedUpToIndex[i]) {
435
+ current = {
436
+ value: reversedUpToIndex[i],
437
+ delta: i + 1
438
+ };
439
+ }
440
+ }
441
+ }
442
+
443
+ var next = deducables[index + 1];
444
+
445
+ if (next) {
446
+ next = {
447
+ value: next,
448
+ delta: 1
449
+ };
450
+ } else {
451
+ var rest = deducables.slice(index + 1);
452
+ for (var j = 0; j < rest.length; j++) {
453
+ if (rest[j]) {
454
+ next = {
455
+ value: rest[j],
456
+ delta: j + 1
457
+ };
458
+ }
459
+ }
460
+ }
461
+
462
+ var extras = next.delta - current.delta;
463
+ var pixelWidth = Math.abs(next.value - current.value) / extras;
464
+ return isPercentageBased ? pixelWidth / getComputedStyleSize(table, 'width') * 100 : pixelWidth;
465
+ }
466
+
467
+ function getStyleOrAttrib(element, property) {
468
+ var sizeString = editor.dom.getStyle(element, property);
469
+ if (!sizeString) {
470
+ sizeString = editor.dom.getAttrib(element, property);
471
+ }
472
+ if (!sizeString) {
473
+ sizeString = editor.dom.getStyle(element, property, true);
474
+ }
475
+ return sizeString;
476
+ }
477
+
478
+ function getWidth(element, isPercentageBased, table) {
479
+ var widthString = getStyleOrAttrib(element, 'width');
480
+
481
+ var widthNumber = parseInt(widthString, 10);
482
+
483
+ var getWidthFallback = isPercentageBased ? getPercentageWidthFallback(element, table) : getComputedStyleSize(element, 'width');
484
+
485
+ // If this is percentage based table, but this cell isn't percentage based.
486
+ // Or if this is a pixel based table, but this cell isn't pixel based.
487
+ if (isPercentageBased && !isPercentageBasedSize(widthString) ||
488
+ !isPercentageBased && !isPixelBasedSize(widthString)) {
489
+ // set the widthnumber to 0
490
+ widthNumber = 0;
491
+ }
492
+
493
+ return !isNaN(widthNumber) && widthNumber > 0 ?
494
+ widthNumber : getWidthFallback;
495
+ }
496
+
497
+ // Attempt to get the css width from column representative cells.
498
+ function getWidths(tableGrid, isPercentageBased, table) {
499
+
500
+ var cols = getColumnBlocks(tableGrid);
501
+
502
+ var backups = Tools.map(cols, function(col) {
503
+ return getInnerEdge(col.colIndex, col.element).x;
504
+ });
505
+
506
+ var widths = [];
507
+
508
+ for (var i = 0; i < cols.length; i++) {
509
+ var span = cols[i].element.hasAttribute('colspan') ? parseInt(cols[i].element.getAttribute('colspan'), 10) : 1;
510
+ // Deduce if the column has colspan of more than 1
511
+ var width = span > 1 ? deduceSize(backups, i) : getWidth(cols[i].element, isPercentageBased, table);
512
+ // If everything's failed and we still don't have a width
513
+ width = width ? width : RESIZE_MINIMUM_WIDTH;
514
+ widths.push(width);
515
+ }
516
+
517
+ return widths;
518
+ }
519
+
520
+ // Attempt to get the pixel height from a cell.
521
+ function getPixelHeight(element) {
522
+
523
+ var heightString = getStyleOrAttrib(element, 'height');
524
+
525
+ var heightNumber = parseInt(heightString, 10);
526
+
527
+ if (isPercentageBasedSize(heightString)) {
528
+ heightNumber = 0;
529
+ }
530
+
531
+ return !isNaN(heightNumber) && heightNumber > 0 ?
532
+ heightNumber : getComputedStyleSize(element, 'height');
533
+ }
534
+
535
+ // Attempt to get the css height from row representative cells.
536
+ function getPixelHeights(tableGrid) {
537
+
538
+ var rows = getRowBlocks(tableGrid);
539
+
540
+ var backups = Tools.map(rows, function(row) {
541
+ return getTopEdge(row.rowIndex, row.element).y;
542
+ });
543
+
544
+ var heights = [];
545
+
546
+ for (var i = 0; i < rows.length; i++) {
547
+ var span = rows[i].element.hasAttribute('rowspan') ? parseInt(rows[i].element.getAttribute('rowspan'), 10) : 1;
548
+
549
+ var height = span > 1 ? deduceSize(backups, i) : getPixelHeight(rows[i].element);
550
+
551
+ height = height ? height : RESIZE_MINIMUM_HEIGHT;
552
+ heights.push(height);
553
+ }
554
+
555
+ return heights;
556
+ }
557
+
558
+ // Determine how much each column's css width will need to change.
559
+ // Sizes = result = pixels widths OR percentage based widths
560
+ function determineDeltas(sizes, column, step, min, isPercentageBased) {
561
+
562
+ var result = sizes.slice(0);
563
+
564
+ function generateZeros(array) {
565
+ return Tools.map(array, function() {
566
+ return 0;
567
+ });
568
+ }
569
+
570
+ function onOneColumn() {
571
+ var deltas;
572
+ if (isPercentageBased) {
573
+ // If we have one column in a percent based table, that column should be 100% of the width of the table.
574
+ deltas = [100 - result[0]];
575
+ } else {
576
+ var newNext = Math.max(min, result[0] + step);
577
+ deltas = [newNext - result[0]];
578
+ }
579
+ return deltas;
580
+ }
581
+
582
+ function onLeftOrMiddle(index, next) {
583
+
584
+ var startZeros = generateZeros(result.slice(0, index));
585
+ var endZeros = generateZeros(result.slice(next + 1));
586
+ var deltas;
587
+
588
+ if (step >= 0) {
589
+ var newNext = Math.max(min, result[next] - step);
590
+ deltas = startZeros.concat([step, newNext - result[next]]).concat(endZeros);
591
+ } else {
592
+ var newThis = Math.max(min, result[index] + step);
593
+ var diffx = result[index] - newThis;
594
+ deltas = startZeros.concat([newThis - result[index], diffx]).concat(endZeros);
595
+ }
596
+
597
+ return deltas;
598
+ }
599
+
600
+ function onRight(previous, index) {
601
+ var startZeros = generateZeros(result.slice(0, index));
602
+ var deltas;
603
+
604
+ if (step >= 0) {
605
+ deltas = startZeros.concat([step]);
606
+ } else {
607
+ var size = Math.max(min, result[index] + step);
608
+ deltas = startZeros.concat([size - result[index]]);
609
+ }
610
+
611
+ return deltas;
612
+
613
+ }
614
+
615
+ var deltas;
616
+
617
+ if (sizes.length === 0) { // No Columns
618
+ deltas = [];
619
+ } else if (sizes.length === 1) { // One Column
620
+ deltas = onOneColumn();
621
+ } else if (column === 0) { // Left Column
622
+ deltas = onLeftOrMiddle(0, 1);
623
+ } else if (column > 0 && column < sizes.length - 1) { // Middle Column
624
+ deltas = onLeftOrMiddle(column, column + 1);
625
+ } else if (column === sizes.length - 1) { // Right Column
626
+ deltas = onRight(column - 1, column);
627
+ } else {
628
+ deltas = [];
629
+ }
630
+
631
+ return deltas;
632
+ }
633
+
634
+ function total(start, end, measures) {
635
+ var r = 0;
636
+ for (var i = start; i < end; i++) {
637
+ r += measures[i];
638
+ }
639
+ return r;
640
+ }
641
+
642
+ // Combine cell's css widths to determine widths of colspan'd cells.
643
+ function recalculateWidths(tableGrid, widths) {
644
+ var allCells = tableGrid.getAllCells();
645
+ return Tools.map(allCells, function(cell) {
646
+ var width = total(cell.colIndex, cell.colIndex + cell.colspan, widths);
647
+ return {
648
+ element: cell.element,
649
+ width: width,
650
+ colspan: cell.colspan
651
+ };
652
+ });
653
+ }
654
+
655
+ // Combine cell's css heights to determine heights of rowspan'd cells.
656
+ function recalculateCellHeights(tableGrid, heights) {
657
+ var allCells = tableGrid.getAllCells();
658
+ return Tools.map(allCells, function(cell) {
659
+ var height = total(cell.rowIndex, cell.rowIndex + cell.rowspan, heights);
660
+ return {
661
+ element: cell.element,
662
+ height: height,
663
+ rowspan: cell.rowspan
664
+ };
665
+ });
666
+ }
667
+
668
+ // Calculate row heights.
669
+ function recalculateRowHeights(tableGrid, heights) {
670
+ var allRows = tableGrid.getAllRows();
671
+ return Tools.map(allRows, function(row, i) {
672
+ return {
673
+ element: row.element,
674
+ height: heights[i]
675
+ };
676
+ });
677
+ }
678
+
679
+ function isPercentageBasedSize(size) {
680
+ return percentageBasedSizeRegex.test(size);
681
+ }
682
+
683
+ function isPixelBasedSize(size) {
684
+ return pixelBasedSizeRegex.test(size);
685
+ }
686
+
687
+ // Adjust the width of the column of table at index, with delta.
688
+ function adjustWidth(table, delta, index) {
689
+ var tableDetails = getTableDetails(table);
690
+ var tableGrid = getTableGrid(tableDetails);
691
+
692
+ function setSizes(newSizes, styleExtension) {
693
+ Tools.each(newSizes, function(cell) {
694
+ editor.dom.setStyle(cell.element, 'width', cell.width + styleExtension);
695
+ editor.dom.setAttrib(cell.element, 'width', null);
696
+ });
697
+ }
698
+
699
+ function getNewTablePercentWidth() {
700
+ return index < tableGrid.grid.maxCols - 1 ? getCurrentTablePercentWidth(table) :
701
+ getCurrentTablePercentWidth(table) + getTablePercentDelta(table, delta);
702
+ }
703
+
704
+ function getNewTablePixelWidth() {
705
+ return index < tableGrid.grid.maxCols - 1 ? getComputedStyleSize(table, 'width') :
706
+ getComputedStyleSize(table, 'width') + delta;
707
+ }
708
+
709
+ function setTableSize(newTableWidth, styleExtension, isPercentBased) {
710
+ if (index == tableGrid.grid.maxCols - 1 || !isPercentBased) {
711
+ editor.dom.setStyle(table, 'width', newTableWidth + styleExtension);
712
+ editor.dom.setAttrib(table, 'width', null);
713
+ }
714
+ }
715
+
716
+ var percentageBased = isPercentageBasedSize(table.width) ||
717
+ isPercentageBasedSize(table.style.width);
718
+
719
+ var widths = getWidths(tableGrid, percentageBased, table);
720
+
721
+ var step = percentageBased ? getCellPercentDelta(table, delta) : delta;
722
+ // TODO: change the min for percentage maybe?
723
+ var deltas = determineDeltas(widths, index, step, RESIZE_MINIMUM_WIDTH, percentageBased, table);
724
+ var newWidths = [];
725
+
726
+ for (var i = 0; i < deltas.length; i++) {
727
+ newWidths.push(deltas[i] + widths[i]);
728
+ }
729
+
730
+ var newSizes = recalculateWidths(tableGrid, newWidths);
731
+ var styleExtension = percentageBased ? '%' : 'px';
732
+ var newTableWidth = percentageBased ? getNewTablePercentWidth() :
733
+ getNewTablePixelWidth();
734
+
735
+ editor.undoManager.transact(function() {
736
+ setSizes(newSizes, styleExtension);
737
+ setTableSize(newTableWidth, styleExtension, percentageBased);
738
+ });
739
+ }
740
+
741
+ // Adjust the height of the row of table at index, with delta.
742
+ function adjustHeight(table, delta, index) {
743
+ var tableDetails = getTableDetails(table);
744
+ var tableGrid = getTableGrid(tableDetails);
745
+
746
+ var heights = getPixelHeights(tableGrid);
747
+
748
+ var newHeights = [], newTotalHeight = 0;
749
+
750
+ for (var i = 0; i < heights.length; i++) {
751
+ newHeights.push(i === index ? delta + heights[i] : heights[i]);
752
+ newTotalHeight += newTotalHeight[i];
753
+ }
754
+
755
+ var newCellSizes = recalculateCellHeights(tableGrid, newHeights);
756
+ var newRowSizes = recalculateRowHeights(tableGrid, newHeights);
757
+
758
+ editor.undoManager.transact(function() {
759
+
760
+ Tools.each(newRowSizes, function(row) {
761
+ editor.dom.setStyle(row.element, 'height', row.height + 'px');
762
+ editor.dom.setAttrib(row.element, 'height', null);
763
+ });
764
+
765
+ Tools.each(newCellSizes, function(cell) {
766
+ editor.dom.setStyle(cell.element, 'height', cell.height + 'px');
767
+ editor.dom.setAttrib(cell.element, 'height', null);
768
+ });
769
+
770
+ editor.dom.setStyle(table, 'height', newTotalHeight + 'px');
771
+ editor.dom.setAttrib(table, 'height', null);
772
+ });
773
+ }
774
+
775
+ function scheduleDelayedDropEvent() {
776
+ delayDrop = setTimeout(function() {
777
+ drop();
778
+ }, 200);
779
+ }
780
+
781
+ function cancelDelayedDropEvent() {
782
+ clearTimeout(delayDrop);
783
+ }
784
+
785
+ function getBlockerElement() {
786
+ var blocker = document.createElement('div');
787
+
788
+ blocker.setAttribute('style', 'margin: 0; ' +
789
+ 'padding: 0; ' +
790
+ 'position: fixed; ' +
791
+ 'left: 0px; ' +
792
+ 'top: 0px; ' +
793
+ 'height: 100%; ' +
794
+ 'width: 100%;');
795
+ blocker.setAttribute('data-mce-bogus', 'all');
796
+
797
+ return blocker;
798
+ }
799
+
800
+ function bindBlockerEvents(blocker, dragHandler) {
801
+ editor.dom.bind(blocker, 'mouseup', function() {
802
+ drop();
803
+ });
804
+
805
+ editor.dom.bind(blocker, 'mousemove', function(e) {
806
+ cancelDelayedDropEvent();
807
+
808
+ if (dragging) {
809
+ dragHandler(e);
810
+ }
811
+ });
812
+
813
+ editor.dom.bind(blocker, 'mouseout', function() {
814
+ scheduleDelayedDropEvent();
815
+ });
816
+
817
+ }
818
+
819
+ function drop() {
820
+ editor.dom.remove(blockerElement);
821
+
822
+ if (dragging) {
823
+ editor.dom.removeClass(dragBar, RESIZE_BAR_DRAGGING_CLASS);
824
+ dragging = false;
825
+
826
+ var index, delta;
827
+
828
+ if (isCol(dragBar)) {
829
+ var initialLeft = parseInt(editor.dom.getAttrib(dragBar, RESIZE_BAR_COL_DATA_INITIAL_LEFT_ATTRIBUTE), 10);
830
+ var newLeft = editor.dom.getPos(dragBar).x;
831
+ index = parseInt(editor.dom.getAttrib(dragBar, RESIZE_BAR_COL_DATA_ATTRIBUTE), 10);
832
+ delta = isRtl() ? initialLeft - newLeft : newLeft - initialLeft;
833
+ adjustWidth(hoverTable, delta, index);
834
+ } else if (isRow(dragBar)) {
835
+ var initialTop = parseInt(editor.dom.getAttrib(dragBar, RESIZE_BAR_ROW_DATA_INITIAL_TOP_ATTRIBUTE), 10);
836
+ var newTop = editor.dom.getPos(dragBar).y;
837
+ index = parseInt(editor.dom.getAttrib(dragBar, RESIZE_BAR_ROW_DATA_ATTRIBUTE), 10);
838
+ delta = newTop - initialTop;
839
+ adjustHeight(hoverTable, delta, index);
840
+ }
841
+ refreshBars(hoverTable);
842
+ editor.nodeChanged();
843
+ }
844
+ }
845
+
846
+ function setupBaseDrag(bar, dragHandler) {
847
+ blockerElement = blockerElement ? blockerElement : getBlockerElement();
848
+ dragging = true;
849
+ editor.dom.addClass(bar, RESIZE_BAR_DRAGGING_CLASS);
850
+ dragBar = bar;
851
+ bindBlockerEvents(blockerElement, dragHandler);
852
+ editor.dom.add(getBody(), blockerElement);
853
+ }
854
+
855
+ function isCol(target) {
856
+ return editor.dom.hasClass(target, RESIZE_BAR_COL_CLASS);
857
+ }
858
+
859
+ function isRow(target) {
860
+ return editor.dom.hasClass(target, RESIZE_BAR_ROW_CLASS);
861
+ }
862
+
863
+ function colDragHandler(event) {
864
+ lastX = lastX !== undefined ? lastX : event.clientX; // we need a firstX
865
+ var deltaX = event.clientX - lastX;
866
+ lastX = event.clientX;
867
+ var oldLeft = editor.dom.getPos(dragBar).x;
868
+ editor.dom.setStyle(dragBar, 'left', oldLeft + deltaX + 'px');
869
+ }
870
+
871
+ function rowDragHandler(event) {
872
+ lastY = lastY !== undefined ? lastY : event.clientY;
873
+ var deltaY = event.clientY - lastY;
874
+ lastY = event.clientY;
875
+ var oldTop = editor.dom.getPos(dragBar).y;
876
+ editor.dom.setStyle(dragBar, 'top', oldTop + deltaY + 'px');
877
+ }
878
+
879
+ function setupColDrag(bar) {
880
+ lastX = undefined;
881
+ setupBaseDrag(bar, colDragHandler);
882
+ }
883
+
884
+ function setupRowDrag(bar) {
885
+ lastY = undefined;
886
+ setupBaseDrag(bar, rowDragHandler);
887
+ }
888
+
889
+ function mouseDownHandler(e) {
890
+ var target = e.target, body = editor.getBody();
891
+
892
+ // Since this code is working on global events we need to work on a global hoverTable state
893
+ // and make sure that the state is correct according to the events fired
894
+ if (!editor.$.contains(body, hoverTable) && hoverTable !== body) {
895
+ return;
896
+ }
897
+
898
+ if (isCol(target)) {
899
+ e.preventDefault();
900
+ var initialLeft = editor.dom.getPos(target).x;
901
+ editor.dom.setAttrib(target, RESIZE_BAR_COL_DATA_INITIAL_LEFT_ATTRIBUTE, initialLeft);
902
+ setupColDrag(target);
903
+ } else if (isRow(target)) {
904
+ e.preventDefault();
905
+ var initialTop = editor.dom.getPos(target).y;
906
+ editor.dom.setAttrib(target, RESIZE_BAR_ROW_DATA_INITIAL_TOP_ATTRIBUTE, initialTop);
907
+ setupRowDrag(target);
908
+ }
909
+ }
910
+
911
+ editor.on('init', function() {
912
+ // Needs to be like this for inline mode, editor.on does not bind to elements in the document body otherwise
913
+ editor.dom.bind(getBody(), 'mousedown', mouseDownHandler);
914
+ });
915
+
916
+ // If we're updating the table width via the old mechanic, we need to update the constituent cells' widths/heights too.
917
+ editor.on('ObjectResized', function(e) {
918
+ var table = e.target;
919
+ if (table.nodeName === 'TABLE') {
920
+ var newCellSizes = [];
921
+ Tools.each(table.rows, function(row) {
922
+ Tools.each(row.cells, function(cell) {
923
+ var width = editor.dom.getStyle(cell, 'width', true);
924
+ newCellSizes.push({
925
+ cell: cell,
926
+ width: width
927
+ });
928
+ });
929
+ });
930
+ Tools.each(newCellSizes, function(newCellSize) {
931
+ editor.dom.setStyle(newCellSize.cell, 'width', newCellSize.width);
932
+ editor.dom.setAttrib(newCellSize.cell, 'width', null);
933
+ });
934
+ }
935
+ });
936
+
937
+ editor.on('mouseover', function(e) {
938
+ if (!dragging) {
939
+ var tableElement = editor.dom.getParent(e.target, 'table');
940
+
941
+ if (e.target.nodeName === 'TABLE' || tableElement) {
942
+ hoverTable = tableElement;
943
+ refreshBars(tableElement);
944
+ }
945
+ }
946
+ });
947
+
948
+ // Prevents the user from moving the caret inside the resize bars on Chrome
949
+ // Only does it on arrow keys since clearBars might be an epxensive operation
950
+ // since it's querying the DOM
951
+ editor.on('keydown', function(e) {
952
+ switch (e.keyCode) {
953
+ case VK.LEFT:
954
+ case VK.RIGHT:
955
+ case VK.UP:
956
+ case VK.DOWN:
957
+ clearBars();
958
+ break;
959
+ }
960
+ });
961
+
962
+ editor.on('remove', function() {
963
+ clearBars();
964
+ editor.dom.unbind(getBody(), 'mousedown', mouseDownHandler);
965
+ });
966
+
967
+ return {
968
+ adjustWidth: adjustWidth,
969
+ adjustHeight: adjustHeight,
970
+ clearBars: clearBars,
971
+ drawBars: drawBars,
972
+ determineDeltas: determineDeltas,
973
+ getTableGrid: getTableGrid,
974
+ getTableDetails: getTableDetails,
975
+ getWidths: getWidths,
976
+ getPixelHeights: getPixelHeights,
977
+ isPercentageBasedSize: isPercentageBasedSize,
978
+ isPixelBasedSize: isPixelBasedSize,
979
+ recalculateWidths: recalculateWidths,
980
+ recalculateCellHeights: recalculateCellHeights,
981
+ recalculateRowHeights: recalculateRowHeights
982
+ };
983
+ };
984
+ });