bedrock_sass 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (466) hide show
  1. checksums.yaml +4 -4
  2. data/assets/_vendor/ace/ace.js +255 -589
  3. data/assets/_vendor/ace/ext-beautify.js +1 -2
  4. data/assets/_vendor/ace/ext-elastic_tabstops_lite.js +2 -2
  5. data/assets/_vendor/ace/ext-emmet.js +4 -4
  6. data/assets/_vendor/ace/ext-error_marker.js +1 -2
  7. data/assets/_vendor/ace/ext-keybinding_menu.js +1 -2
  8. data/assets/_vendor/ace/ext-language_tools.js +5 -9
  9. data/assets/_vendor/ace/ext-linking.js +1 -2
  10. data/assets/_vendor/ace/ext-modelist.js +9 -5
  11. data/assets/_vendor/ace/ext-options.js +10 -7
  12. data/assets/_vendor/ace/ext-rtl.js +1 -2
  13. data/assets/_vendor/ace/ext-searchbox.js +8 -4
  14. data/assets/_vendor/ace/ext-settings_menu.js +10 -7
  15. data/assets/_vendor/ace/ext-spellcheck.js +1 -2
  16. data/assets/_vendor/ace/ext-split.js +1 -2
  17. data/assets/_vendor/ace/ext-static_highlight.js +11 -8
  18. data/assets/_vendor/ace/ext-statusbar.js +1 -2
  19. data/assets/_vendor/ace/ext-textarea.js +1 -5
  20. data/assets/_vendor/ace/ext-themelist.js +2 -4
  21. data/assets/_vendor/ace/ext-whitespace.js +1 -2
  22. data/assets/_vendor/ace/keybinding-emacs.js +6 -2
  23. data/assets/_vendor/ace/keybinding-vim.js +13 -25
  24. data/assets/_vendor/ace/mode-abap.js +2 -3
  25. data/assets/_vendor/ace/mode-abc.js +3 -2
  26. data/assets/_vendor/ace/mode-actionscript.js +2 -2
  27. data/assets/_vendor/ace/mode-ada.js +1 -2
  28. data/assets/_vendor/ace/mode-apache_conf.js +2 -2
  29. data/assets/_vendor/ace/mode-apex.js +457 -0
  30. data/assets/_vendor/ace/mode-applescript.js +1 -2
  31. data/assets/_vendor/ace/mode-asciidoc.js +2 -2
  32. data/assets/_vendor/ace/mode-asl.js +1 -2
  33. data/assets/_vendor/ace/mode-assembly_x86.js +2 -2
  34. data/assets/_vendor/ace/mode-autohotkey.js +1 -2
  35. data/assets/_vendor/ace/mode-batchfile.js +2 -2
  36. data/assets/_vendor/ace/mode-bro.js +2 -2
  37. data/assets/_vendor/ace/mode-c9search.js +1 -2
  38. data/assets/_vendor/ace/mode-c_cpp.js +2 -2
  39. data/assets/_vendor/ace/mode-cirru.js +1 -2
  40. data/assets/_vendor/ace/mode-clojure.js +2 -2
  41. data/assets/_vendor/ace/mode-cobol.js +1 -2
  42. data/assets/_vendor/ace/mode-coffee.js +1 -2
  43. data/assets/_vendor/ace/mode-coldfusion.js +3 -2
  44. data/assets/_vendor/ace/mode-csharp.js +3 -3
  45. data/assets/_vendor/ace/mode-csound_document.js +319 -80
  46. data/assets/_vendor/ace/mode-csound_orchestra.js +323 -86
  47. data/assets/_vendor/ace/mode-csound_score.js +1 -2
  48. data/assets/_vendor/ace/mode-csp.js +1 -2
  49. data/assets/_vendor/ace/mode-css.js +2 -2
  50. data/assets/_vendor/ace/mode-curly.js +3 -2
  51. data/assets/_vendor/ace/mode-d.js +2 -2
  52. data/assets/_vendor/ace/mode-dart.js +24 -14
  53. data/assets/_vendor/ace/mode-diff.js +4 -4
  54. data/assets/_vendor/ace/mode-django.js +3 -2
  55. data/assets/_vendor/ace/mode-dockerfile.js +3 -2
  56. data/assets/_vendor/ace/mode-dot.js +1 -2
  57. data/assets/_vendor/ace/mode-drools.js +3 -2
  58. data/assets/_vendor/ace/mode-edifact.js +2 -2
  59. data/assets/_vendor/ace/mode-eiffel.js +1 -2
  60. data/assets/_vendor/ace/mode-ejs.js +5 -2
  61. data/assets/_vendor/ace/mode-elixir.js +2 -2
  62. data/assets/_vendor/ace/mode-elm.js +1 -2
  63. data/assets/_vendor/ace/mode-erlang.js +2 -2
  64. data/assets/_vendor/ace/mode-forth.js +2 -2
  65. data/assets/_vendor/ace/mode-fortran.js +1 -2
  66. data/assets/_vendor/ace/mode-fsharp.js +1 -2
  67. data/assets/_vendor/ace/mode-fsl.js +258 -0
  68. data/assets/_vendor/ace/mode-ftl.js +3 -2
  69. data/assets/_vendor/ace/mode-gcode.js +1 -2
  70. data/assets/_vendor/ace/mode-gherkin.js +2 -4
  71. data/assets/_vendor/ace/mode-gitignore.js +1 -2
  72. data/assets/_vendor/ace/mode-glsl.js +2 -2
  73. data/assets/_vendor/ace/mode-gobstones.js +3 -2
  74. data/assets/_vendor/ace/mode-golang.js +1 -2
  75. data/assets/_vendor/ace/mode-graphqlschema.js +1 -2
  76. data/assets/_vendor/ace/mode-groovy.js +4 -2
  77. data/assets/_vendor/ace/mode-haml.js +5 -2
  78. data/assets/_vendor/ace/mode-handlebars.js +3 -2
  79. data/assets/_vendor/ace/mode-haskell.js +2 -2
  80. data/assets/_vendor/ace/mode-haskell_cabal.js +1 -2
  81. data/assets/_vendor/ace/mode-haxe.js +2 -2
  82. data/assets/_vendor/ace/mode-hjson.js +2 -2
  83. data/assets/_vendor/ace/mode-html.js +3 -2
  84. data/assets/_vendor/ace/mode-html_elixir.js +4 -2
  85. data/assets/_vendor/ace/mode-html_ruby.js +5 -2
  86. data/assets/_vendor/ace/mode-ini.js +1 -2
  87. data/assets/_vendor/ace/mode-io.js +2 -2
  88. data/assets/_vendor/ace/mode-jack.js +1 -2
  89. data/assets/_vendor/ace/mode-jade.js +14 -115
  90. data/assets/_vendor/ace/mode-java.js +64 -3
  91. data/assets/_vendor/ace/mode-javascript.js +2 -2
  92. data/assets/_vendor/ace/mode-json.js +1 -2
  93. data/assets/_vendor/ace/mode-jsoniq.js +8 -2317
  94. data/assets/_vendor/ace/mode-jsp.js +4 -2
  95. data/assets/_vendor/ace/mode-jssm.js +2 -2
  96. data/assets/_vendor/ace/mode-jsx.js +1 -2
  97. data/assets/_vendor/ace/mode-julia.js +2 -2
  98. data/assets/_vendor/ace/mode-kotlin.js +2 -2
  99. data/assets/_vendor/ace/mode-latex.js +1 -2
  100. data/assets/_vendor/ace/mode-less.js +4 -2
  101. data/assets/_vendor/ace/mode-liquid.js +2026 -477
  102. data/assets/_vendor/ace/mode-lisp.js +2 -2
  103. data/assets/_vendor/ace/mode-livescript.js +1 -2
  104. data/assets/_vendor/ace/mode-logiql.js +2 -2
  105. data/assets/_vendor/ace/mode-logtalk.js +352 -0
  106. data/assets/_vendor/ace/mode-lsl.js +1 -2
  107. data/assets/_vendor/ace/mode-lua.js +1 -2
  108. data/assets/_vendor/ace/mode-luapage.js +3 -2
  109. data/assets/_vendor/ace/mode-lucene.js +2 -3
  110. data/assets/_vendor/ace/mode-makefile.js +3 -2
  111. data/assets/_vendor/ace/mode-markdown.js +5 -2
  112. data/assets/_vendor/ace/mode-mask.js +3 -2
  113. data/assets/_vendor/ace/mode-matlab.js +1 -2
  114. data/assets/_vendor/ace/mode-maze.js +2 -2
  115. data/assets/_vendor/ace/mode-mel.js +2 -2
  116. data/assets/_vendor/ace/mode-mixal.js +1 -2
  117. data/assets/_vendor/ace/mode-mushcode.js +2 -2
  118. data/assets/_vendor/ace/mode-mysql.js +3 -4
  119. data/assets/_vendor/ace/mode-nix.js +2 -2
  120. data/assets/_vendor/ace/mode-nsis.js +2 -2
  121. data/assets/_vendor/ace/mode-objectivec.js +3 -2
  122. data/assets/_vendor/ace/mode-ocaml.js +1 -2
  123. data/assets/_vendor/ace/mode-pascal.js +2 -2
  124. data/assets/_vendor/ace/mode-perl.js +2 -2
  125. data/assets/_vendor/ace/mode-perl6.js +593 -0
  126. data/assets/_vendor/ace/mode-pgsql.js +304 -69
  127. data/assets/_vendor/ace/mode-php.js +844 -1029
  128. data/assets/_vendor/ace/mode-php_laravel_blade.js +844 -1029
  129. data/assets/_vendor/ace/mode-pig.js +2 -2
  130. data/assets/_vendor/ace/mode-plain_text.js +1 -2
  131. data/assets/_vendor/ace/mode-powershell.js +2 -2
  132. data/assets/_vendor/ace/mode-praat.js +2 -2
  133. data/assets/_vendor/ace/mode-prolog.js +2 -2
  134. data/assets/_vendor/ace/mode-properties.js +1 -2
  135. data/assets/_vendor/ace/mode-protobuf.js +2 -2
  136. data/assets/_vendor/ace/mode-puppet.js +1 -2
  137. data/assets/_vendor/ace/mode-python.js +297 -63
  138. data/assets/_vendor/ace/mode-r.js +3 -2
  139. data/assets/_vendor/ace/mode-razor.js +9 -3
  140. data/assets/_vendor/ace/mode-rdoc.js +2 -2
  141. data/assets/_vendor/ace/mode-red.js +2 -2
  142. data/assets/_vendor/ace/mode-redshift.js +1 -2
  143. data/assets/_vendor/ace/mode-rhtml.js +5 -2
  144. data/assets/_vendor/ace/mode-rst.js +1 -2
  145. data/assets/_vendor/ace/mode-ruby.js +3 -2
  146. data/assets/_vendor/ace/mode-rust.js +2 -2
  147. data/assets/_vendor/ace/mode-sass.js +205 -117
  148. data/assets/_vendor/ace/mode-scad.js +2 -2
  149. data/assets/_vendor/ace/mode-scala.js +3 -2
  150. data/assets/_vendor/ace/mode-scheme.js +2 -2
  151. data/assets/_vendor/ace/mode-scss.js +204 -115
  152. data/assets/_vendor/ace/mode-sh.js +3 -2
  153. data/assets/_vendor/ace/mode-sjs.js +2 -2
  154. data/assets/_vendor/ace/mode-slim.js +18 -117
  155. data/assets/_vendor/ace/mode-smarty.js +3 -2
  156. data/assets/_vendor/ace/mode-snippets.js +1 -2
  157. data/assets/_vendor/ace/mode-soy_template.js +4 -2
  158. data/assets/_vendor/ace/mode-space.js +1 -2
  159. data/assets/_vendor/ace/mode-sparql.js +2 -2
  160. data/assets/_vendor/ace/mode-sql.js +2 -3
  161. data/assets/_vendor/ace/mode-sqlserver.js +2 -2
  162. data/assets/_vendor/ace/mode-stylus.js +3 -2
  163. data/assets/_vendor/ace/mode-svg.js +2 -2
  164. data/assets/_vendor/ace/mode-swift.js +1 -2
  165. data/assets/_vendor/ace/mode-tcl.js +2 -2
  166. data/assets/_vendor/ace/mode-terraform.js +1 -2
  167. data/assets/_vendor/ace/mode-tex.js +2 -2
  168. data/assets/_vendor/ace/mode-text.js +1 -2
  169. data/assets/_vendor/ace/mode-textile.js +1 -2
  170. data/assets/_vendor/ace/mode-toml.js +1 -2
  171. data/assets/_vendor/ace/mode-tsx.js +2 -2
  172. data/assets/_vendor/ace/mode-turtle.js +2 -2
  173. data/assets/_vendor/ace/mode-twig.js +3 -2
  174. data/assets/_vendor/ace/mode-typescript.js +2 -2
  175. data/assets/_vendor/ace/mode-vala.js +2 -2
  176. data/assets/_vendor/ace/mode-vbscript.js +1 -2
  177. data/assets/_vendor/ace/mode-velocity.js +4 -2
  178. data/assets/_vendor/ace/mode-verilog.js +1 -2
  179. data/assets/_vendor/ace/mode-vhdl.js +1 -2
  180. data/assets/_vendor/ace/mode-visualforce.js +2641 -0
  181. data/assets/_vendor/ace/mode-wollok.js +3 -2
  182. data/assets/_vendor/ace/mode-xml.js +1 -2
  183. data/assets/_vendor/ace/mode-xquery.js +8 -2287
  184. data/assets/_vendor/ace/mode-yaml.js +1 -2
  185. data/assets/_vendor/ace/snippets/abap.js +2 -3
  186. data/assets/_vendor/ace/snippets/abc.js +1 -2
  187. data/assets/_vendor/ace/snippets/actionscript.js +1 -2
  188. data/assets/_vendor/ace/snippets/ada.js +2 -3
  189. data/assets/_vendor/ace/snippets/apache_conf.js +2 -3
  190. data/assets/_vendor/ace/snippets/apex.js +14 -0
  191. data/assets/_vendor/ace/snippets/applescript.js +2 -3
  192. data/assets/_vendor/ace/snippets/asciidoc.js +2 -3
  193. data/assets/_vendor/ace/snippets/asl.js +2 -3
  194. data/assets/_vendor/ace/snippets/assembly_x86.js +2 -3
  195. data/assets/_vendor/ace/snippets/autohotkey.js +2 -3
  196. data/assets/_vendor/ace/snippets/batchfile.js +2 -3
  197. data/assets/_vendor/ace/snippets/bro.js +1 -2
  198. data/assets/_vendor/ace/snippets/c9search.js +2 -3
  199. data/assets/_vendor/ace/snippets/c_cpp.js +1 -2
  200. data/assets/_vendor/ace/snippets/cirru.js +2 -3
  201. data/assets/_vendor/ace/snippets/clojure.js +1 -2
  202. data/assets/_vendor/ace/snippets/cobol.js +2 -3
  203. data/assets/_vendor/ace/snippets/coffee.js +1 -2
  204. data/assets/_vendor/ace/snippets/coldfusion.js +2 -3
  205. data/assets/_vendor/ace/snippets/csharp.js +2 -3
  206. data/assets/_vendor/ace/snippets/csound_document.js +1 -2
  207. data/assets/_vendor/ace/snippets/csound_orchestra.js +1 -2
  208. data/assets/_vendor/ace/snippets/csound_score.js +2 -3
  209. data/assets/_vendor/ace/snippets/csp.js +1 -2
  210. data/assets/_vendor/ace/snippets/css.js +1 -2
  211. data/assets/_vendor/ace/snippets/curly.js +2 -3
  212. data/assets/_vendor/ace/snippets/d.js +2 -3
  213. data/assets/_vendor/ace/snippets/dart.js +1 -2
  214. data/assets/_vendor/ace/snippets/diff.js +1 -2
  215. data/assets/_vendor/ace/snippets/django.js +1 -2
  216. data/assets/_vendor/ace/snippets/dockerfile.js +2 -3
  217. data/assets/_vendor/ace/snippets/dot.js +2 -3
  218. data/assets/_vendor/ace/snippets/drools.js +1 -2
  219. data/assets/_vendor/ace/snippets/edifact.js +1 -2
  220. data/assets/_vendor/ace/snippets/eiffel.js +2 -3
  221. data/assets/_vendor/ace/snippets/ejs.js +2 -3
  222. data/assets/_vendor/ace/snippets/elixir.js +1 -2
  223. data/assets/_vendor/ace/snippets/elm.js +2 -3
  224. data/assets/_vendor/ace/snippets/erlang.js +1 -2
  225. data/assets/_vendor/ace/snippets/forth.js +2 -3
  226. data/assets/_vendor/ace/snippets/fortran.js +2 -3
  227. data/assets/_vendor/ace/snippets/fsharp.js +2 -3
  228. data/assets/_vendor/ace/snippets/fsl.js +14 -0
  229. data/assets/_vendor/ace/snippets/ftl.js +2 -3
  230. data/assets/_vendor/ace/snippets/gcode.js +2 -3
  231. data/assets/_vendor/ace/snippets/gherkin.js +2 -3
  232. data/assets/_vendor/ace/snippets/gitignore.js +2 -3
  233. data/assets/_vendor/ace/snippets/glsl.js +2 -3
  234. data/assets/_vendor/ace/snippets/gobstones.js +1 -2
  235. data/assets/_vendor/ace/snippets/golang.js +2 -3
  236. data/assets/_vendor/ace/snippets/graphqlschema.js +1 -2
  237. data/assets/_vendor/ace/snippets/groovy.js +2 -3
  238. data/assets/_vendor/ace/snippets/haml.js +1 -2
  239. data/assets/_vendor/ace/snippets/handlebars.js +2 -3
  240. data/assets/_vendor/ace/snippets/haskell.js +1 -2
  241. data/assets/_vendor/ace/snippets/haskell_cabal.js +2 -3
  242. data/assets/_vendor/ace/snippets/haxe.js +2 -3
  243. data/assets/_vendor/ace/snippets/hjson.js +1 -2
  244. data/assets/_vendor/ace/snippets/html.js +1 -2
  245. data/assets/_vendor/ace/snippets/html_elixir.js +2 -3
  246. data/assets/_vendor/ace/snippets/html_ruby.js +2 -3
  247. data/assets/_vendor/ace/snippets/ini.js +2 -3
  248. data/assets/_vendor/ace/snippets/io.js +1 -2
  249. data/assets/_vendor/ace/snippets/jack.js +2 -3
  250. data/assets/_vendor/ace/snippets/jade.js +2 -3
  251. data/assets/_vendor/ace/snippets/java.js +1 -2
  252. data/assets/_vendor/ace/snippets/javascript.js +1 -2
  253. data/assets/_vendor/ace/snippets/json.js +2 -3
  254. data/assets/_vendor/ace/snippets/jsoniq.js +1 -2
  255. data/assets/_vendor/ace/snippets/jsp.js +1 -2
  256. data/assets/_vendor/ace/snippets/jssm.js +1 -2
  257. data/assets/_vendor/ace/snippets/jsx.js +2 -3
  258. data/assets/_vendor/ace/snippets/julia.js +2 -3
  259. data/assets/_vendor/ace/snippets/kotlin.js +1 -2
  260. data/assets/_vendor/ace/snippets/latex.js +2 -3
  261. data/assets/_vendor/ace/snippets/less.js +2 -3
  262. data/assets/_vendor/ace/snippets/liquid.js +883 -3
  263. data/assets/_vendor/ace/snippets/lisp.js +2 -3
  264. data/assets/_vendor/ace/snippets/livescript.js +2 -3
  265. data/assets/_vendor/ace/snippets/logiql.js +2 -3
  266. data/assets/_vendor/ace/snippets/logtalk.js +14 -0
  267. data/assets/_vendor/ace/snippets/lsl.js +1 -2
  268. data/assets/_vendor/ace/snippets/lua.js +1 -2
  269. data/assets/_vendor/ace/snippets/luapage.js +2 -3
  270. data/assets/_vendor/ace/snippets/lucene.js +2 -3
  271. data/assets/_vendor/ace/snippets/makefile.js +1 -2
  272. data/assets/_vendor/ace/snippets/markdown.js +1 -2
  273. data/assets/_vendor/ace/snippets/mask.js +2 -3
  274. data/assets/_vendor/ace/snippets/matlab.js +2 -3
  275. data/assets/_vendor/ace/snippets/maze.js +1 -2
  276. data/assets/_vendor/ace/snippets/mel.js +2 -3
  277. data/assets/_vendor/ace/snippets/mixal.js +2 -3
  278. data/assets/_vendor/ace/snippets/mushcode.js +2 -3
  279. data/assets/_vendor/ace/snippets/mysql.js +2 -3
  280. data/assets/_vendor/ace/snippets/nix.js +2 -3
  281. data/assets/_vendor/ace/snippets/nsis.js +1 -2
  282. data/assets/_vendor/ace/snippets/objectivec.js +2 -3
  283. data/assets/_vendor/ace/snippets/ocaml.js +2 -3
  284. data/assets/_vendor/ace/snippets/pascal.js +2 -3
  285. data/assets/_vendor/ace/snippets/perl.js +1 -2
  286. data/assets/_vendor/ace/snippets/perl6.js +14 -0
  287. data/assets/_vendor/ace/snippets/pgsql.js +2 -3
  288. data/assets/_vendor/ace/snippets/php.js +1 -2
  289. data/assets/_vendor/ace/snippets/php_laravel_blade.js +2 -3
  290. data/assets/_vendor/ace/snippets/pig.js +2 -3
  291. data/assets/_vendor/ace/snippets/plain_text.js +2 -3
  292. data/assets/_vendor/ace/snippets/powershell.js +2 -3
  293. data/assets/_vendor/ace/snippets/praat.js +2 -3
  294. data/assets/_vendor/ace/snippets/prolog.js +2 -3
  295. data/assets/_vendor/ace/snippets/properties.js +2 -3
  296. data/assets/_vendor/ace/snippets/protobuf.js +1 -2
  297. data/assets/_vendor/ace/snippets/puppet.js +2 -3
  298. data/assets/_vendor/ace/snippets/python.js +1 -2
  299. data/assets/_vendor/ace/snippets/r.js +1 -2
  300. data/assets/_vendor/ace/snippets/razor.js +1 -2
  301. data/assets/_vendor/ace/snippets/rdoc.js +2 -3
  302. data/assets/_vendor/ace/snippets/red.js +1 -2
  303. data/assets/_vendor/ace/snippets/redshift.js +2 -3
  304. data/assets/_vendor/ace/snippets/rhtml.js +2 -3
  305. data/assets/_vendor/ace/snippets/rst.js +1 -2
  306. data/assets/_vendor/ace/snippets/ruby.js +1 -2
  307. data/assets/_vendor/ace/snippets/rust.js +2 -3
  308. data/assets/_vendor/ace/snippets/sass.js +2 -3
  309. data/assets/_vendor/ace/snippets/scad.js +2 -3
  310. data/assets/_vendor/ace/snippets/scala.js +2 -3
  311. data/assets/_vendor/ace/snippets/scheme.js +2 -3
  312. data/assets/_vendor/ace/snippets/scss.js +2 -3
  313. data/assets/_vendor/ace/snippets/sh.js +1 -2
  314. data/assets/_vendor/ace/snippets/sjs.js +2 -3
  315. data/assets/_vendor/ace/snippets/slim.js +2 -3
  316. data/assets/_vendor/ace/snippets/smarty.js +2 -3
  317. data/assets/_vendor/ace/snippets/snippets.js +1 -2
  318. data/assets/_vendor/ace/snippets/soy_template.js +2 -3
  319. data/assets/_vendor/ace/snippets/space.js +2 -3
  320. data/assets/_vendor/ace/snippets/sparql.js +1 -2
  321. data/assets/_vendor/ace/snippets/sql.js +1 -2
  322. data/assets/_vendor/ace/snippets/sqlserver.js +1 -2
  323. data/assets/_vendor/ace/snippets/stylus.js +2 -3
  324. data/assets/_vendor/ace/snippets/svg.js +2 -3
  325. data/assets/_vendor/ace/snippets/swift.js +2 -3
  326. data/assets/_vendor/ace/snippets/tcl.js +1 -2
  327. data/assets/_vendor/ace/snippets/terraform.js +2 -3
  328. data/assets/_vendor/ace/snippets/tex.js +1 -2
  329. data/assets/_vendor/ace/snippets/text.js +2 -3
  330. data/assets/_vendor/ace/snippets/textile.js +1 -2
  331. data/assets/_vendor/ace/snippets/toml.js +2 -3
  332. data/assets/_vendor/ace/snippets/tsx.js +2 -3
  333. data/assets/_vendor/ace/snippets/turtle.js +1 -2
  334. data/assets/_vendor/ace/snippets/twig.js +2 -3
  335. data/assets/_vendor/ace/snippets/typescript.js +2 -3
  336. data/assets/_vendor/ace/snippets/vala.js +1 -2
  337. data/assets/_vendor/ace/snippets/vbscript.js +2 -3
  338. data/assets/_vendor/ace/snippets/velocity.js +1 -2
  339. data/assets/_vendor/ace/snippets/verilog.js +2 -3
  340. data/assets/_vendor/ace/snippets/vhdl.js +2 -3
  341. data/assets/_vendor/ace/snippets/visualforce.js +14 -0
  342. data/assets/_vendor/ace/snippets/wollok.js +1 -2
  343. data/assets/_vendor/ace/snippets/xml.js +2 -3
  344. data/assets/_vendor/ace/snippets/xquery.js +1 -2
  345. data/assets/_vendor/ace/snippets/yaml.js +2 -3
  346. data/assets/_vendor/ace/theme-ambiance.js +1 -2
  347. data/assets/_vendor/ace/theme-chaos.js +1 -2
  348. data/assets/_vendor/ace/theme-chrome.js +1 -2
  349. data/assets/_vendor/ace/theme-clouds.js +1 -2
  350. data/assets/_vendor/ace/theme-clouds_midnight.js +1 -2
  351. data/assets/_vendor/ace/theme-cobalt.js +1 -2
  352. data/assets/_vendor/ace/theme-crimson_editor.js +1 -2
  353. data/assets/_vendor/ace/theme-dawn.js +1 -2
  354. data/assets/_vendor/ace/theme-dracula.js +1 -2
  355. data/assets/_vendor/ace/theme-dreamweaver.js +1 -2
  356. data/assets/_vendor/ace/theme-eclipse.js +1 -2
  357. data/assets/_vendor/ace/theme-github.js +3 -3
  358. data/assets/_vendor/ace/theme-gob.js +1 -2
  359. data/assets/_vendor/ace/theme-gruvbox.js +1 -2
  360. data/assets/_vendor/ace/theme-idle_fingers.js +1 -2
  361. data/assets/_vendor/ace/theme-iplastic.js +1 -2
  362. data/assets/_vendor/ace/theme-katzenmilch.js +1 -2
  363. data/assets/_vendor/ace/theme-kr_theme.js +1 -2
  364. data/assets/_vendor/ace/theme-kuroir.js +1 -2
  365. data/assets/_vendor/ace/theme-merbivore.js +1 -2
  366. data/assets/_vendor/ace/theme-merbivore_soft.js +1 -2
  367. data/assets/_vendor/ace/theme-mono_industrial.js +1 -2
  368. data/assets/_vendor/ace/theme-monokai.js +1 -2
  369. data/assets/_vendor/ace/theme-pastel_on_dark.js +1 -2
  370. data/assets/_vendor/ace/theme-solarized_dark.js +1 -2
  371. data/assets/_vendor/ace/theme-solarized_light.js +1 -2
  372. data/assets/_vendor/ace/theme-sqlserver.js +1 -2
  373. data/assets/_vendor/ace/theme-terminal.js +1 -2
  374. data/assets/_vendor/ace/theme-textmate.js +1 -2
  375. data/assets/_vendor/ace/theme-tomorrow.js +1 -2
  376. data/assets/_vendor/ace/theme-tomorrow_night.js +1 -2
  377. data/assets/_vendor/ace/theme-tomorrow_night_blue.js +1 -2
  378. data/assets/_vendor/ace/theme-tomorrow_night_bright.js +1 -2
  379. data/assets/_vendor/ace/theme-tomorrow_night_eighties.js +1 -2
  380. data/assets/_vendor/ace/theme-twilight.js +1 -2
  381. data/assets/_vendor/ace/theme-vibrant_ink.js +1 -2
  382. data/assets/_vendor/ace/theme-xcode.js +1 -2
  383. data/assets/_vendor/ace/worker-coffee.js +11 -20
  384. data/assets/_vendor/ace/worker-css.js +23 -20
  385. data/assets/_vendor/ace/worker-html.js +25 -31
  386. data/assets/_vendor/ace/worker-javascript.js +76 -36
  387. data/assets/_vendor/ace/worker-json.js +25 -20
  388. data/assets/_vendor/ace/worker-lua.js +68 -69
  389. data/assets/_vendor/ace/worker-php.js +12 -20
  390. data/assets/_vendor/ace/worker-xml.js +12 -22
  391. data/assets/_vendor/ace/worker-xquery.js +44 -12378
  392. data/assets/_vendor/tinymce/plugins/advlist/plugin.js +137 -137
  393. data/assets/_vendor/tinymce/plugins/anchor/plugin.js +102 -102
  394. data/assets/_vendor/tinymce/plugins/autolink/plugin.js +154 -154
  395. data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +145 -145
  396. data/assets/_vendor/tinymce/plugins/autosave/plugin.js +207 -217
  397. data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -1
  398. data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +89 -89
  399. data/assets/_vendor/tinymce/plugins/charmap/plugin.js +1246 -1246
  400. data/assets/_vendor/tinymce/plugins/code/plugin.js +80 -80
  401. data/assets/_vendor/tinymce/plugins/codesample/plugin.js +852 -852
  402. data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +109 -109
  403. data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +144 -144
  404. data/assets/_vendor/tinymce/plugins/directionality/plugin.js +53 -53
  405. data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +74 -74
  406. data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +464 -464
  407. data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +152 -152
  408. data/assets/_vendor/tinymce/plugins/help/plugin.js +639 -678
  409. data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -1
  410. data/assets/_vendor/tinymce/plugins/hr/plugin.js +29 -29
  411. data/assets/_vendor/tinymce/plugins/image/plugin.js +1119 -1126
  412. data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -1
  413. data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +3414 -3445
  414. data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +1 -1
  415. data/assets/_vendor/tinymce/plugins/importcss/plugin.js +230 -230
  416. data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +152 -152
  417. data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +193 -193
  418. data/assets/_vendor/tinymce/plugins/link/plugin.js +646 -646
  419. data/assets/_vendor/tinymce/plugins/lists/plugin.js +2103 -1037
  420. data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -1
  421. data/assets/_vendor/tinymce/plugins/media/plugin.js +1050 -1050
  422. data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +69 -69
  423. data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +98 -98
  424. data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +91 -91
  425. data/assets/_vendor/tinymce/plugins/paste/plugin.js +1725 -1364
  426. data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -1
  427. data/assets/_vendor/tinymce/plugins/preview/plugin.js +107 -107
  428. data/assets/_vendor/tinymce/plugins/print/plugin.js +28 -28
  429. data/assets/_vendor/tinymce/plugins/save/plugin.js +101 -101
  430. data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +535 -537
  431. data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -1
  432. data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +683 -681
  433. data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -1
  434. data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +95 -95
  435. data/assets/_vendor/tinymce/plugins/table/plugin.js +8927 -9805
  436. data/assets/_vendor/tinymce/plugins/table/plugin.min.js +1 -1
  437. data/assets/_vendor/tinymce/plugins/template/plugin.js +305 -311
  438. data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -1
  439. data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +317 -317
  440. data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +575 -329
  441. data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -1
  442. data/assets/_vendor/tinymce/plugins/toc/plugin.js +201 -201
  443. data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +113 -113
  444. data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +419 -471
  445. data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -1
  446. data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +371 -308
  447. data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -1
  448. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
  449. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +1 -0
  450. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
  451. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
  452. data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -1
  453. data/assets/_vendor/tinymce/themes/inlite/theme.js +9272 -9686
  454. data/assets/_vendor/tinymce/themes/inlite/theme.min.js +1 -1
  455. data/assets/_vendor/tinymce/themes/mobile/theme.js +12130 -13042
  456. data/assets/_vendor/tinymce/themes/mobile/theme.min.js +1 -1
  457. data/assets/_vendor/tinymce/themes/modern/theme.js +9090 -9504
  458. data/assets/_vendor/tinymce/themes/modern/theme.min.js +1 -1
  459. data/assets/_vendor/tinymce/tinymce.js +24914 -25218
  460. data/assets/bedrock/js/bedrock.js +1 -1
  461. data/assets/bedrock/scss/components/no-content.scss +5 -0
  462. data/assets/bedrock/scss/components/select-box.scss +1 -1
  463. data/lib/bedrock_sass.rb +51 -16
  464. data/lib/bedrock_sass/engine.rb +3 -2
  465. data/lib/bedrock_sass/version.rb +1 -1
  466. metadata +17 -7
@@ -1,1115 +1,2181 @@
1
1
  (function () {
2
2
  var lists = (function () {
3
- 'use strict';
4
-
5
- var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
6
-
7
- var global$1 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
8
-
9
- var global$2 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
10
-
11
- var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK');
12
-
13
- var global$4 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
14
-
15
- var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
16
-
17
- var global$6 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
18
-
19
- var isTextNode = function (node) {
20
- return node && node.nodeType === 3;
21
- };
22
- var isListNode = function (node) {
23
- return node && /^(OL|UL|DL)$/.test(node.nodeName);
24
- };
25
- var isListItemNode = function (node) {
26
- return node && /^(LI|DT|DD)$/.test(node.nodeName);
27
- };
28
- var isTableCellNode = function (node) {
29
- return node && /^(TH|TD)$/.test(node.nodeName);
30
- };
31
- var isBr = function (node) {
32
- return node && node.nodeName === 'BR';
33
- };
34
- var isFirstChild = function (node) {
35
- return node.parentNode.firstChild === node;
36
- };
37
- var isLastChild = function (node) {
38
- return node.parentNode.lastChild === node;
39
- };
40
- var isTextBlock = function (editor, node) {
41
- return node && !!editor.schema.getTextBlockElements()[node.nodeName];
42
- };
43
- var isBlock = function (node, blockElements) {
44
- return node && node.nodeName in blockElements;
45
- };
46
- var isBogusBr = function (dom, node) {
47
- if (!isBr(node)) {
48
- return false;
49
- }
50
- if (dom.isBlock(node.nextSibling) && !isBr(node.previousSibling)) {
51
- return true;
52
- }
53
- return false;
54
- };
55
- var isEmpty = function (dom, elm, keepBookmarks) {
56
- var empty = dom.isEmpty(elm);
57
- if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {
3
+ 'use strict';
4
+
5
+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
6
+
7
+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
8
+
9
+ var global$2 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
10
+
11
+ var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK');
12
+
13
+ var global$4 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
14
+
15
+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
16
+
17
+ var global$6 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
18
+
19
+ var isTextNode = function (node) {
20
+ return node && node.nodeType === 3;
21
+ };
22
+ var isListNode = function (node) {
23
+ return node && /^(OL|UL|DL)$/.test(node.nodeName);
24
+ };
25
+ var isOlUlNode = function (node) {
26
+ return node && /^(OL|UL)$/.test(node.nodeName);
27
+ };
28
+ var isListItemNode = function (node) {
29
+ return node && /^(LI|DT|DD)$/.test(node.nodeName);
30
+ };
31
+ var isDlItemNode = function (node) {
32
+ return node && /^(DT|DD)$/.test(node.nodeName);
33
+ };
34
+ var isTableCellNode = function (node) {
35
+ return node && /^(TH|TD)$/.test(node.nodeName);
36
+ };
37
+ var isBr = function (node) {
38
+ return node && node.nodeName === 'BR';
39
+ };
40
+ var isFirstChild = function (node) {
41
+ return node.parentNode.firstChild === node;
42
+ };
43
+ var isLastChild = function (node) {
44
+ return node.parentNode.lastChild === node;
45
+ };
46
+ var isTextBlock = function (editor, node) {
47
+ return node && !!editor.schema.getTextBlockElements()[node.nodeName];
48
+ };
49
+ var isBlock = function (node, blockElements) {
50
+ return node && node.nodeName in blockElements;
51
+ };
52
+ var isBogusBr = function (dom, node) {
53
+ if (!isBr(node)) {
54
+ return false;
55
+ }
56
+ if (dom.isBlock(node.nextSibling) && !isBr(node.previousSibling)) {
57
+ return true;
58
+ }
58
59
  return false;
59
- }
60
- return empty;
61
- };
62
- var isChildOfBody = function (dom, elm) {
63
- return dom.isChildOf(elm, dom.getRoot());
64
- };
65
- var $_74mztagkjm0ofzg7 = {
66
- isTextNode: isTextNode,
67
- isListNode: isListNode,
68
- isListItemNode: isListItemNode,
69
- isTableCellNode: isTableCellNode,
70
- isBr: isBr,
71
- isFirstChild: isFirstChild,
72
- isLastChild: isLastChild,
73
- isTextBlock: isTextBlock,
74
- isBlock: isBlock,
75
- isBogusBr: isBogusBr,
76
- isEmpty: isEmpty,
77
- isChildOfBody: isChildOfBody
78
- };
79
-
80
- var getNormalizedEndPoint = function (container, offset) {
81
- var node = global$1.getNode(container, offset);
82
- if ($_74mztagkjm0ofzg7.isListItemNode(container) && $_74mztagkjm0ofzg7.isTextNode(node)) {
83
- var textNodeOffset = offset >= container.childNodes.length ? node.data.length : 0;
60
+ };
61
+ var isEmpty = function (dom, elm, keepBookmarks) {
62
+ var empty = dom.isEmpty(elm);
63
+ if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {
64
+ return false;
65
+ }
66
+ return empty;
67
+ };
68
+ var isChildOfBody = function (dom, elm) {
69
+ return dom.isChildOf(elm, dom.getRoot());
70
+ };
71
+ var NodeType = {
72
+ isTextNode: isTextNode,
73
+ isListNode: isListNode,
74
+ isOlUlNode: isOlUlNode,
75
+ isDlItemNode: isDlItemNode,
76
+ isListItemNode: isListItemNode,
77
+ isTableCellNode: isTableCellNode,
78
+ isBr: isBr,
79
+ isFirstChild: isFirstChild,
80
+ isLastChild: isLastChild,
81
+ isTextBlock: isTextBlock,
82
+ isBlock: isBlock,
83
+ isBogusBr: isBogusBr,
84
+ isEmpty: isEmpty,
85
+ isChildOfBody: isChildOfBody
86
+ };
87
+
88
+ var getNormalizedPoint = function (container, offset) {
89
+ if (NodeType.isTextNode(container)) {
90
+ return {
91
+ container: container,
92
+ offset: offset
93
+ };
94
+ }
95
+ var node = global$1.getNode(container, offset);
96
+ if (NodeType.isTextNode(node)) {
97
+ return {
98
+ container: node,
99
+ offset: offset >= container.childNodes.length ? node.data.length : 0
100
+ };
101
+ } else if (node.previousSibling && NodeType.isTextNode(node.previousSibling)) {
102
+ return {
103
+ container: node.previousSibling,
104
+ offset: node.previousSibling.data.length
105
+ };
106
+ } else if (node.nextSibling && NodeType.isTextNode(node.nextSibling)) {
107
+ return {
108
+ container: node.nextSibling,
109
+ offset: 0
110
+ };
111
+ }
84
112
  return {
85
- container: node,
86
- offset: textNodeOffset
113
+ container: container,
114
+ offset: offset
115
+ };
116
+ };
117
+ var normalizeRange = function (rng) {
118
+ var outRng = rng.cloneRange();
119
+ var rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset);
120
+ outRng.setStart(rangeStart.container, rangeStart.offset);
121
+ var rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset);
122
+ outRng.setEnd(rangeEnd.container, rangeEnd.offset);
123
+ return outRng;
124
+ };
125
+ var Range = {
126
+ getNormalizedPoint: getNormalizedPoint,
127
+ normalizeRange: normalizeRange
128
+ };
129
+
130
+ var DOM = global$6.DOM;
131
+ var createBookmark = function (rng) {
132
+ var bookmark = {};
133
+ var setupEndPoint = function (start) {
134
+ var offsetNode, container, offset;
135
+ container = rng[start ? 'startContainer' : 'endContainer'];
136
+ offset = rng[start ? 'startOffset' : 'endOffset'];
137
+ if (container.nodeType === 1) {
138
+ offsetNode = DOM.create('span', { 'data-mce-type': 'bookmark' });
139
+ if (container.hasChildNodes()) {
140
+ offset = Math.min(offset, container.childNodes.length - 1);
141
+ if (start) {
142
+ container.insertBefore(offsetNode, container.childNodes[offset]);
143
+ } else {
144
+ DOM.insertAfter(offsetNode, container.childNodes[offset]);
145
+ }
146
+ } else {
147
+ container.appendChild(offsetNode);
148
+ }
149
+ container = offsetNode;
150
+ offset = 0;
151
+ }
152
+ bookmark[start ? 'startContainer' : 'endContainer'] = container;
153
+ bookmark[start ? 'startOffset' : 'endOffset'] = offset;
154
+ };
155
+ setupEndPoint(true);
156
+ if (!rng.collapsed) {
157
+ setupEndPoint();
158
+ }
159
+ return bookmark;
160
+ };
161
+ var resolveBookmark = function (bookmark) {
162
+ function restoreEndPoint(start) {
163
+ var container, offset, node;
164
+ var nodeIndex = function (container) {
165
+ var node = container.parentNode.firstChild, idx = 0;
166
+ while (node) {
167
+ if (node === container) {
168
+ return idx;
169
+ }
170
+ if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {
171
+ idx++;
172
+ }
173
+ node = node.nextSibling;
174
+ }
175
+ return -1;
176
+ };
177
+ container = node = bookmark[start ? 'startContainer' : 'endContainer'];
178
+ offset = bookmark[start ? 'startOffset' : 'endOffset'];
179
+ if (!container) {
180
+ return;
181
+ }
182
+ if (container.nodeType === 1) {
183
+ offset = nodeIndex(container);
184
+ container = container.parentNode;
185
+ DOM.remove(node);
186
+ if (!container.hasChildNodes() && DOM.isBlock(container)) {
187
+ container.appendChild(DOM.create('br'));
188
+ }
189
+ }
190
+ bookmark[start ? 'startContainer' : 'endContainer'] = container;
191
+ bookmark[start ? 'startOffset' : 'endOffset'] = offset;
192
+ }
193
+ restoreEndPoint(true);
194
+ restoreEndPoint();
195
+ var rng = DOM.createRng();
196
+ rng.setStart(bookmark.startContainer, bookmark.startOffset);
197
+ if (bookmark.endContainer) {
198
+ rng.setEnd(bookmark.endContainer, bookmark.endOffset);
199
+ }
200
+ return Range.normalizeRange(rng);
201
+ };
202
+ var Bookmark = {
203
+ createBookmark: createBookmark,
204
+ resolveBookmark: resolveBookmark
205
+ };
206
+
207
+ var constant = function (value) {
208
+ return function () {
209
+ return value;
210
+ };
211
+ };
212
+ function curry(fn) {
213
+ var initialArgs = [];
214
+ for (var _i = 1; _i < arguments.length; _i++) {
215
+ initialArgs[_i - 1] = arguments[_i];
216
+ }
217
+ return function () {
218
+ var restArgs = [];
219
+ for (var _i = 0; _i < arguments.length; _i++) {
220
+ restArgs[_i] = arguments[_i];
221
+ }
222
+ var all = initialArgs.concat(restArgs);
223
+ return fn.apply(null, all);
87
224
  };
88
225
  }
89
- return {
90
- container: container,
91
- offset: offset
92
- };
93
- };
94
- var normalizeRange = function (rng) {
95
- var outRng = rng.cloneRange();
96
- var rangeStart = getNormalizedEndPoint(rng.startContainer, rng.startOffset);
97
- outRng.setStart(rangeStart.container, rangeStart.offset);
98
- var rangeEnd = getNormalizedEndPoint(rng.endContainer, rng.endOffset);
99
- outRng.setEnd(rangeEnd.container, rangeEnd.offset);
100
- return outRng;
101
- };
102
- var $_crui3egjjm0ofzg5 = {
103
- getNormalizedEndPoint: getNormalizedEndPoint,
104
- normalizeRange: normalizeRange
105
- };
106
-
107
- var DOM = global$6.DOM;
108
- var createBookmark = function (rng) {
109
- var bookmark = {};
110
- var setupEndPoint = function (start) {
111
- var offsetNode, container, offset;
226
+ var not = function (f) {
227
+ return function () {
228
+ var args = [];
229
+ for (var _i = 0; _i < arguments.length; _i++) {
230
+ args[_i] = arguments[_i];
231
+ }
232
+ return !f.apply(null, args);
233
+ };
234
+ };
235
+ var never = constant(false);
236
+ var always = constant(true);
237
+
238
+ var never$1 = never;
239
+ var always$1 = always;
240
+ var none = function () {
241
+ return NONE;
242
+ };
243
+ var NONE = function () {
244
+ var eq = function (o) {
245
+ return o.isNone();
246
+ };
247
+ var call$$1 = function (thunk) {
248
+ return thunk();
249
+ };
250
+ var id = function (n) {
251
+ return n;
252
+ };
253
+ var noop$$1 = function () {
254
+ };
255
+ var nul = function () {
256
+ return null;
257
+ };
258
+ var undef = function () {
259
+ return undefined;
260
+ };
261
+ var me = {
262
+ fold: function (n, s) {
263
+ return n();
264
+ },
265
+ is: never$1,
266
+ isSome: never$1,
267
+ isNone: always$1,
268
+ getOr: id,
269
+ getOrThunk: call$$1,
270
+ getOrDie: function (msg) {
271
+ throw new Error(msg || 'error: getOrDie called on none.');
272
+ },
273
+ getOrNull: nul,
274
+ getOrUndefined: undef,
275
+ or: id,
276
+ orThunk: call$$1,
277
+ map: none,
278
+ ap: none,
279
+ each: noop$$1,
280
+ bind: none,
281
+ flatten: none,
282
+ exists: never$1,
283
+ forall: always$1,
284
+ filter: none,
285
+ equals: eq,
286
+ equals_: eq,
287
+ toArray: function () {
288
+ return [];
289
+ },
290
+ toString: constant('none()')
291
+ };
292
+ if (Object.freeze)
293
+ Object.freeze(me);
294
+ return me;
295
+ }();
296
+ var some = function (a) {
297
+ var constant_a = function () {
298
+ return a;
299
+ };
300
+ var self = function () {
301
+ return me;
302
+ };
303
+ var map = function (f) {
304
+ return some(f(a));
305
+ };
306
+ var bind = function (f) {
307
+ return f(a);
308
+ };
309
+ var me = {
310
+ fold: function (n, s) {
311
+ return s(a);
312
+ },
313
+ is: function (v) {
314
+ return a === v;
315
+ },
316
+ isSome: always$1,
317
+ isNone: never$1,
318
+ getOr: constant_a,
319
+ getOrThunk: constant_a,
320
+ getOrDie: constant_a,
321
+ getOrNull: constant_a,
322
+ getOrUndefined: constant_a,
323
+ or: self,
324
+ orThunk: self,
325
+ map: map,
326
+ ap: function (optfab) {
327
+ return optfab.fold(none, function (fab) {
328
+ return some(fab(a));
329
+ });
330
+ },
331
+ each: function (f) {
332
+ f(a);
333
+ },
334
+ bind: bind,
335
+ flatten: constant_a,
336
+ exists: bind,
337
+ forall: bind,
338
+ filter: function (f) {
339
+ return f(a) ? me : NONE;
340
+ },
341
+ equals: function (o) {
342
+ return o.is(a);
343
+ },
344
+ equals_: function (o, elementEq) {
345
+ return o.fold(never$1, function (b) {
346
+ return elementEq(a, b);
347
+ });
348
+ },
349
+ toArray: function () {
350
+ return [a];
351
+ },
352
+ toString: function () {
353
+ return 'some(' + a + ')';
354
+ }
355
+ };
356
+ return me;
357
+ };
358
+ var from = function (value) {
359
+ return value === null || value === undefined ? NONE : some(value);
360
+ };
361
+ var Option = {
362
+ some: some,
363
+ none: none,
364
+ from: from
365
+ };
366
+
367
+ var typeOf = function (x) {
368
+ if (x === null)
369
+ return 'null';
370
+ var t = typeof x;
371
+ if (t === 'object' && Array.prototype.isPrototypeOf(x))
372
+ return 'array';
373
+ if (t === 'object' && String.prototype.isPrototypeOf(x))
374
+ return 'string';
375
+ return t;
376
+ };
377
+ var isType = function (type) {
378
+ return function (value) {
379
+ return typeOf(value) === type;
380
+ };
381
+ };
382
+ var isString = isType('string');
383
+ var isBoolean = isType('boolean');
384
+ var isFunction = isType('function');
385
+ var isNumber = isType('number');
386
+
387
+ var map = function (xs, f) {
388
+ var len = xs.length;
389
+ var r = new Array(len);
390
+ for (var i = 0; i < len; i++) {
391
+ var x = xs[i];
392
+ r[i] = f(x, i, xs);
393
+ }
394
+ return r;
395
+ };
396
+ var each = function (xs, f) {
397
+ for (var i = 0, len = xs.length; i < len; i++) {
398
+ var x = xs[i];
399
+ f(x, i, xs);
400
+ }
401
+ };
402
+ var filter = function (xs, pred) {
403
+ var r = [];
404
+ for (var i = 0, len = xs.length; i < len; i++) {
405
+ var x = xs[i];
406
+ if (pred(x, i, xs)) {
407
+ r.push(x);
408
+ }
409
+ }
410
+ return r;
411
+ };
412
+ var groupBy = function (xs, f) {
413
+ if (xs.length === 0) {
414
+ return [];
415
+ } else {
416
+ var wasType = f(xs[0]);
417
+ var r = [];
418
+ var group = [];
419
+ for (var i = 0, len = xs.length; i < len; i++) {
420
+ var x = xs[i];
421
+ var type = f(x);
422
+ if (type !== wasType) {
423
+ r.push(group);
424
+ group = [];
425
+ }
426
+ wasType = type;
427
+ group.push(x);
428
+ }
429
+ if (group.length !== 0) {
430
+ r.push(group);
431
+ }
432
+ return r;
433
+ }
434
+ };
435
+ var foldl = function (xs, f, acc) {
436
+ each(xs, function (x) {
437
+ acc = f(acc, x);
438
+ });
439
+ return acc;
440
+ };
441
+ var find = function (xs, pred) {
442
+ for (var i = 0, len = xs.length; i < len; i++) {
443
+ var x = xs[i];
444
+ if (pred(x, i, xs)) {
445
+ return Option.some(x);
446
+ }
447
+ }
448
+ return Option.none();
449
+ };
450
+ var push = Array.prototype.push;
451
+ var flatten = function (xs) {
452
+ var r = [];
453
+ for (var i = 0, len = xs.length; i < len; ++i) {
454
+ if (!Array.prototype.isPrototypeOf(xs[i]))
455
+ throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
456
+ push.apply(r, xs[i]);
457
+ }
458
+ return r;
459
+ };
460
+ var bind = function (xs, f) {
461
+ var output = map(xs, f);
462
+ return flatten(output);
463
+ };
464
+ var slice = Array.prototype.slice;
465
+ var reverse = function (xs) {
466
+ var r = slice.call(xs, 0);
467
+ r.reverse();
468
+ return r;
469
+ };
470
+ var head = function (xs) {
471
+ return xs.length === 0 ? Option.none() : Option.some(xs[0]);
472
+ };
473
+ var last = function (xs) {
474
+ return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
475
+ };
476
+ var from$1 = isFunction(Array.from) ? Array.from : function (x) {
477
+ return slice.call(x);
478
+ };
479
+
480
+ var Global = typeof window !== 'undefined' ? window : Function('return this;')();
481
+
482
+ var path = function (parts, scope) {
483
+ var o = scope !== undefined && scope !== null ? scope : Global;
484
+ for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
485
+ o = o[parts[i]];
486
+ return o;
487
+ };
488
+ var resolve = function (p, scope) {
489
+ var parts = p.split('.');
490
+ return path(parts, scope);
491
+ };
492
+
493
+ var unsafe = function (name, scope) {
494
+ return resolve(name, scope);
495
+ };
496
+ var getOrDie = function (name, scope) {
497
+ var actual = unsafe(name, scope);
498
+ if (actual === undefined || actual === null)
499
+ throw name + ' not available on this browser';
500
+ return actual;
501
+ };
502
+ var Global$1 = { getOrDie: getOrDie };
503
+
504
+ var htmlElement = function (scope) {
505
+ return Global$1.getOrDie('HTMLElement', scope);
506
+ };
507
+ var isPrototypeOf = function (x) {
508
+ var scope = resolve('ownerDocument.defaultView', x);
509
+ return htmlElement(scope).prototype.isPrototypeOf(x);
510
+ };
511
+ var HTMLElement = { isPrototypeOf: isPrototypeOf };
512
+
513
+ var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
514
+
515
+ var getParentList = function (editor) {
516
+ var selectionStart = editor.selection.getStart(true);
517
+ return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart));
518
+ };
519
+ var isParentListSelected = function (parentList, selectedBlocks) {
520
+ return parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
521
+ };
522
+ var findSubLists = function (parentList) {
523
+ return global$5.grep(parentList.querySelectorAll('ol,ul,dl'), function (elm) {
524
+ return NodeType.isListNode(elm);
525
+ });
526
+ };
527
+ var getSelectedSubLists = function (editor) {
528
+ var parentList = getParentList(editor);
529
+ var selectedBlocks = editor.selection.getSelectedBlocks();
530
+ if (isParentListSelected(parentList, selectedBlocks)) {
531
+ return findSubLists(parentList);
532
+ } else {
533
+ return global$5.grep(selectedBlocks, function (elm) {
534
+ return NodeType.isListNode(elm) && parentList !== elm;
535
+ });
536
+ }
537
+ };
538
+ var findParentListItemsNodes = function (editor, elms) {
539
+ var listItemsElms = global$5.map(elms, function (elm) {
540
+ var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));
541
+ return parentLi ? parentLi : elm;
542
+ });
543
+ return global$7.unique(listItemsElms);
544
+ };
545
+ var getSelectedListItems = function (editor) {
546
+ var selectedBlocks = editor.selection.getSelectedBlocks();
547
+ return global$5.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) {
548
+ return NodeType.isListItemNode(block);
549
+ });
550
+ };
551
+ var getSelectedDlItems = function (editor) {
552
+ return filter(getSelectedListItems(editor), NodeType.isDlItemNode);
553
+ };
554
+ var getClosestListRootElm = function (editor, elm) {
555
+ var parentTableCell = editor.dom.getParents(elm, 'TD,TH');
556
+ var root = parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
557
+ return root;
558
+ };
559
+ var findLastParentListNode = function (editor, elm) {
560
+ var parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListRootElm(editor, elm));
561
+ return last(parentLists);
562
+ };
563
+ var getSelectedLists = function (editor) {
564
+ var firstList = findLastParentListNode(editor, editor.selection.getStart());
565
+ var subsequentLists = filter(editor.selection.getSelectedBlocks(), NodeType.isOlUlNode);
566
+ return firstList.toArray().concat(subsequentLists);
567
+ };
568
+ var getSelectedListRoots = function (editor) {
569
+ var selectedLists = getSelectedLists(editor);
570
+ return getUniqueListRoots(editor, selectedLists);
571
+ };
572
+ var getUniqueListRoots = function (editor, lists) {
573
+ var listRoots = map(lists, function (list) {
574
+ return findLastParentListNode(editor, list).getOr(list);
575
+ });
576
+ return global$7.unique(listRoots);
577
+ };
578
+ var isList = function (editor) {
579
+ var list = getParentList(editor);
580
+ return HTMLElement.isPrototypeOf(list);
581
+ };
582
+ var Selection = {
583
+ isList: isList,
584
+ getParentList: getParentList,
585
+ getSelectedSubLists: getSelectedSubLists,
586
+ getSelectedListItems: getSelectedListItems,
587
+ getClosestListRootElm: getClosestListRootElm,
588
+ getSelectedDlItems: getSelectedDlItems,
589
+ getSelectedListRoots: getSelectedListRoots
590
+ };
591
+
592
+ var node = function () {
593
+ var f = Global$1.getOrDie('Node');
594
+ return f;
595
+ };
596
+ var compareDocumentPosition = function (a, b, match) {
597
+ return (a.compareDocumentPosition(b) & match) !== 0;
598
+ };
599
+ var documentPositionPreceding = function (a, b) {
600
+ return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
601
+ };
602
+ var documentPositionContainedBy = function (a, b) {
603
+ return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
604
+ };
605
+ var Node$1 = {
606
+ documentPositionPreceding: documentPositionPreceding,
607
+ documentPositionContainedBy: documentPositionContainedBy
608
+ };
609
+
610
+ var cached = function (f) {
611
+ var called = false;
612
+ var r;
613
+ return function () {
614
+ var args = [];
615
+ for (var _i = 0; _i < arguments.length; _i++) {
616
+ args[_i] = arguments[_i];
617
+ }
618
+ if (!called) {
619
+ called = true;
620
+ r = f.apply(null, args);
621
+ }
622
+ return r;
623
+ };
624
+ };
625
+
626
+ var firstMatch = function (regexes, s) {
627
+ for (var i = 0; i < regexes.length; i++) {
628
+ var x = regexes[i];
629
+ if (x.test(s))
630
+ return x;
631
+ }
632
+ return undefined;
633
+ };
634
+ var find$1 = function (regexes, agent) {
635
+ var r = firstMatch(regexes, agent);
636
+ if (!r)
637
+ return {
638
+ major: 0,
639
+ minor: 0
640
+ };
641
+ var group = function (i) {
642
+ return Number(agent.replace(r, '$' + i));
643
+ };
644
+ return nu(group(1), group(2));
645
+ };
646
+ var detect = function (versionRegexes, agent) {
647
+ var cleanedAgent = String(agent).toLowerCase();
648
+ if (versionRegexes.length === 0)
649
+ return unknown();
650
+ return find$1(versionRegexes, cleanedAgent);
651
+ };
652
+ var unknown = function () {
653
+ return nu(0, 0);
654
+ };
655
+ var nu = function (major, minor) {
656
+ return {
657
+ major: major,
658
+ minor: minor
659
+ };
660
+ };
661
+ var Version = {
662
+ nu: nu,
663
+ detect: detect,
664
+ unknown: unknown
665
+ };
666
+
667
+ var edge = 'Edge';
668
+ var chrome = 'Chrome';
669
+ var ie = 'IE';
670
+ var opera = 'Opera';
671
+ var firefox = 'Firefox';
672
+ var safari = 'Safari';
673
+ var isBrowser = function (name, current) {
674
+ return function () {
675
+ return current === name;
676
+ };
677
+ };
678
+ var unknown$1 = function () {
679
+ return nu$1({
680
+ current: undefined,
681
+ version: Version.unknown()
682
+ });
683
+ };
684
+ var nu$1 = function (info) {
685
+ var current = info.current;
686
+ var version = info.version;
687
+ return {
688
+ current: current,
689
+ version: version,
690
+ isEdge: isBrowser(edge, current),
691
+ isChrome: isBrowser(chrome, current),
692
+ isIE: isBrowser(ie, current),
693
+ isOpera: isBrowser(opera, current),
694
+ isFirefox: isBrowser(firefox, current),
695
+ isSafari: isBrowser(safari, current)
696
+ };
697
+ };
698
+ var Browser = {
699
+ unknown: unknown$1,
700
+ nu: nu$1,
701
+ edge: constant(edge),
702
+ chrome: constant(chrome),
703
+ ie: constant(ie),
704
+ opera: constant(opera),
705
+ firefox: constant(firefox),
706
+ safari: constant(safari)
707
+ };
708
+
709
+ var windows = 'Windows';
710
+ var ios = 'iOS';
711
+ var android = 'Android';
712
+ var linux = 'Linux';
713
+ var osx = 'OSX';
714
+ var solaris = 'Solaris';
715
+ var freebsd = 'FreeBSD';
716
+ var isOS = function (name, current) {
717
+ return function () {
718
+ return current === name;
719
+ };
720
+ };
721
+ var unknown$2 = function () {
722
+ return nu$2({
723
+ current: undefined,
724
+ version: Version.unknown()
725
+ });
726
+ };
727
+ var nu$2 = function (info) {
728
+ var current = info.current;
729
+ var version = info.version;
730
+ return {
731
+ current: current,
732
+ version: version,
733
+ isWindows: isOS(windows, current),
734
+ isiOS: isOS(ios, current),
735
+ isAndroid: isOS(android, current),
736
+ isOSX: isOS(osx, current),
737
+ isLinux: isOS(linux, current),
738
+ isSolaris: isOS(solaris, current),
739
+ isFreeBSD: isOS(freebsd, current)
740
+ };
741
+ };
742
+ var OperatingSystem = {
743
+ unknown: unknown$2,
744
+ nu: nu$2,
745
+ windows: constant(windows),
746
+ ios: constant(ios),
747
+ android: constant(android),
748
+ linux: constant(linux),
749
+ osx: constant(osx),
750
+ solaris: constant(solaris),
751
+ freebsd: constant(freebsd)
752
+ };
753
+
754
+ var DeviceType = function (os, browser, userAgent) {
755
+ var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
756
+ var isiPhone = os.isiOS() && !isiPad;
757
+ var isAndroid3 = os.isAndroid() && os.version.major === 3;
758
+ var isAndroid4 = os.isAndroid() && os.version.major === 4;
759
+ var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
760
+ var isTouch = os.isiOS() || os.isAndroid();
761
+ var isPhone = isTouch && !isTablet;
762
+ var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
763
+ return {
764
+ isiPad: constant(isiPad),
765
+ isiPhone: constant(isiPhone),
766
+ isTablet: constant(isTablet),
767
+ isPhone: constant(isPhone),
768
+ isTouch: constant(isTouch),
769
+ isAndroid: os.isAndroid,
770
+ isiOS: os.isiOS,
771
+ isWebView: constant(iOSwebview)
772
+ };
773
+ };
774
+
775
+ var detect$1 = function (candidates, userAgent) {
776
+ var agent = String(userAgent).toLowerCase();
777
+ return find(candidates, function (candidate) {
778
+ return candidate.search(agent);
779
+ });
780
+ };
781
+ var detectBrowser = function (browsers, userAgent) {
782
+ return detect$1(browsers, userAgent).map(function (browser) {
783
+ var version = Version.detect(browser.versionRegexes, userAgent);
784
+ return {
785
+ current: browser.name,
786
+ version: version
787
+ };
788
+ });
789
+ };
790
+ var detectOs = function (oses, userAgent) {
791
+ return detect$1(oses, userAgent).map(function (os) {
792
+ var version = Version.detect(os.versionRegexes, userAgent);
793
+ return {
794
+ current: os.name,
795
+ version: version
796
+ };
797
+ });
798
+ };
799
+ var UaString = {
800
+ detectBrowser: detectBrowser,
801
+ detectOs: detectOs
802
+ };
803
+
804
+ var contains$1 = function (str, substr) {
805
+ return str.indexOf(substr) !== -1;
806
+ };
807
+
808
+ var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
809
+ var checkContains = function (target) {
810
+ return function (uastring) {
811
+ return contains$1(uastring, target);
812
+ };
813
+ };
814
+ var browsers = [
815
+ {
816
+ name: 'Edge',
817
+ versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
818
+ search: function (uastring) {
819
+ var monstrosity = contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit');
820
+ return monstrosity;
821
+ }
822
+ },
823
+ {
824
+ name: 'Chrome',
825
+ versionRegexes: [
826
+ /.*?chrome\/([0-9]+)\.([0-9]+).*/,
827
+ normalVersionRegex
828
+ ],
829
+ search: function (uastring) {
830
+ return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe');
831
+ }
832
+ },
833
+ {
834
+ name: 'IE',
835
+ versionRegexes: [
836
+ /.*?msie\ ?([0-9]+)\.([0-9]+).*/,
837
+ /.*?rv:([0-9]+)\.([0-9]+).*/
838
+ ],
839
+ search: function (uastring) {
840
+ return contains$1(uastring, 'msie') || contains$1(uastring, 'trident');
841
+ }
842
+ },
843
+ {
844
+ name: 'Opera',
845
+ versionRegexes: [
846
+ normalVersionRegex,
847
+ /.*?opera\/([0-9]+)\.([0-9]+).*/
848
+ ],
849
+ search: checkContains('opera')
850
+ },
851
+ {
852
+ name: 'Firefox',
853
+ versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
854
+ search: checkContains('firefox')
855
+ },
856
+ {
857
+ name: 'Safari',
858
+ versionRegexes: [
859
+ normalVersionRegex,
860
+ /.*?cpu os ([0-9]+)_([0-9]+).*/
861
+ ],
862
+ search: function (uastring) {
863
+ return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit');
864
+ }
865
+ }
866
+ ];
867
+ var oses = [
868
+ {
869
+ name: 'Windows',
870
+ search: checkContains('win'),
871
+ versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
872
+ },
873
+ {
874
+ name: 'iOS',
875
+ search: function (uastring) {
876
+ return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad');
877
+ },
878
+ versionRegexes: [
879
+ /.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
880
+ /.*cpu os ([0-9]+)_([0-9]+).*/,
881
+ /.*cpu iphone os ([0-9]+)_([0-9]+).*/
882
+ ]
883
+ },
884
+ {
885
+ name: 'Android',
886
+ search: checkContains('android'),
887
+ versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
888
+ },
889
+ {
890
+ name: 'OSX',
891
+ search: checkContains('os x'),
892
+ versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
893
+ },
894
+ {
895
+ name: 'Linux',
896
+ search: checkContains('linux'),
897
+ versionRegexes: []
898
+ },
899
+ {
900
+ name: 'Solaris',
901
+ search: checkContains('sunos'),
902
+ versionRegexes: []
903
+ },
904
+ {
905
+ name: 'FreeBSD',
906
+ search: checkContains('freebsd'),
907
+ versionRegexes: []
908
+ }
909
+ ];
910
+ var PlatformInfo = {
911
+ browsers: constant(browsers),
912
+ oses: constant(oses)
913
+ };
914
+
915
+ var detect$2 = function (userAgent) {
916
+ var browsers = PlatformInfo.browsers();
917
+ var oses = PlatformInfo.oses();
918
+ var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu);
919
+ var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
920
+ var deviceType = DeviceType(os, browser, userAgent);
921
+ return {
922
+ browser: browser,
923
+ os: os,
924
+ deviceType: deviceType
925
+ };
926
+ };
927
+ var PlatformDetection = { detect: detect$2 };
928
+
929
+ var detect$3 = cached(function () {
930
+ var userAgent = navigator.userAgent;
931
+ return PlatformDetection.detect(userAgent);
932
+ });
933
+ var PlatformDetection$1 = { detect: detect$3 };
934
+
935
+ var fromHtml = function (html, scope) {
936
+ var doc = scope || document;
937
+ var div = doc.createElement('div');
938
+ div.innerHTML = html;
939
+ if (!div.hasChildNodes() || div.childNodes.length > 1) {
940
+ console.error('HTML does not have a single root node', html);
941
+ throw 'HTML must have a single root node';
942
+ }
943
+ return fromDom(div.childNodes[0]);
944
+ };
945
+ var fromTag = function (tag, scope) {
946
+ var doc = scope || document;
947
+ var node = doc.createElement(tag);
948
+ return fromDom(node);
949
+ };
950
+ var fromText = function (text, scope) {
951
+ var doc = scope || document;
952
+ var node = doc.createTextNode(text);
953
+ return fromDom(node);
954
+ };
955
+ var fromDom = function (node) {
956
+ if (node === null || node === undefined)
957
+ throw new Error('Node cannot be null or undefined');
958
+ return { dom: constant(node) };
959
+ };
960
+ var fromPoint = function (docElm, x, y) {
961
+ var doc = docElm.dom();
962
+ return Option.from(doc.elementFromPoint(x, y)).map(fromDom);
963
+ };
964
+ var Element$$1 = {
965
+ fromHtml: fromHtml,
966
+ fromTag: fromTag,
967
+ fromText: fromText,
968
+ fromDom: fromDom,
969
+ fromPoint: fromPoint
970
+ };
971
+
972
+ var ATTRIBUTE = Node.ATTRIBUTE_NODE;
973
+ var CDATA_SECTION = Node.CDATA_SECTION_NODE;
974
+ var COMMENT = Node.COMMENT_NODE;
975
+ var DOCUMENT = Node.DOCUMENT_NODE;
976
+ var DOCUMENT_TYPE = Node.DOCUMENT_TYPE_NODE;
977
+ var DOCUMENT_FRAGMENT = Node.DOCUMENT_FRAGMENT_NODE;
978
+ var ELEMENT = Node.ELEMENT_NODE;
979
+ var TEXT = Node.TEXT_NODE;
980
+ var PROCESSING_INSTRUCTION = Node.PROCESSING_INSTRUCTION_NODE;
981
+ var ENTITY_REFERENCE = Node.ENTITY_REFERENCE_NODE;
982
+ var ENTITY = Node.ENTITY_NODE;
983
+ var NOTATION = Node.NOTATION_NODE;
984
+
985
+ var ELEMENT$1 = ELEMENT;
986
+ var is = function (element, selector) {
987
+ var elem = element.dom();
988
+ if (elem.nodeType !== ELEMENT$1)
989
+ return false;
990
+ else if (elem.matches !== undefined)
991
+ return elem.matches(selector);
992
+ else if (elem.msMatchesSelector !== undefined)
993
+ return elem.msMatchesSelector(selector);
994
+ else if (elem.webkitMatchesSelector !== undefined)
995
+ return elem.webkitMatchesSelector(selector);
996
+ else if (elem.mozMatchesSelector !== undefined)
997
+ return elem.mozMatchesSelector(selector);
998
+ else
999
+ throw new Error('Browser lacks native selectors');
1000
+ };
1001
+
1002
+ var eq = function (e1, e2) {
1003
+ return e1.dom() === e2.dom();
1004
+ };
1005
+ var regularContains = function (e1, e2) {
1006
+ var d1 = e1.dom(), d2 = e2.dom();
1007
+ return d1 === d2 ? false : d1.contains(d2);
1008
+ };
1009
+ var ieContains = function (e1, e2) {
1010
+ return Node$1.documentPositionContainedBy(e1.dom(), e2.dom());
1011
+ };
1012
+ var browser = PlatformDetection$1.detect().browser;
1013
+ var contains$2 = browser.isIE() ? ieContains : regularContains;
1014
+ var is$1 = is;
1015
+
1016
+ var keys = Object.keys;
1017
+ var each$1 = function (obj, f) {
1018
+ var props = keys(obj);
1019
+ for (var k = 0, len = props.length; k < len; k++) {
1020
+ var i = props[k];
1021
+ var x = obj[i];
1022
+ f(x, i, obj);
1023
+ }
1024
+ };
1025
+
1026
+ var name = function (element) {
1027
+ var r = element.dom().nodeName;
1028
+ return r.toLowerCase();
1029
+ };
1030
+
1031
+ var rawSet = function (dom, key, value$$1) {
1032
+ if (isString(value$$1) || isBoolean(value$$1) || isNumber(value$$1)) {
1033
+ dom.setAttribute(key, value$$1 + '');
1034
+ } else {
1035
+ console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value$$1, ':: Element ', dom);
1036
+ throw new Error('Attribute value was not simple');
1037
+ }
1038
+ };
1039
+ var setAll = function (element, attrs) {
1040
+ var dom = element.dom();
1041
+ each$1(attrs, function (v, k) {
1042
+ rawSet(dom, k, v);
1043
+ });
1044
+ };
1045
+ var clone = function (element) {
1046
+ return foldl(element.dom().attributes, function (acc, attr) {
1047
+ acc[attr.name] = attr.value;
1048
+ return acc;
1049
+ }, {});
1050
+ };
1051
+
1052
+ var Immutable = function () {
1053
+ var fields = [];
1054
+ for (var _i = 0; _i < arguments.length; _i++) {
1055
+ fields[_i] = arguments[_i];
1056
+ }
1057
+ return function () {
1058
+ var values = [];
1059
+ for (var _i = 0; _i < arguments.length; _i++) {
1060
+ values[_i] = arguments[_i];
1061
+ }
1062
+ if (fields.length !== values.length) {
1063
+ throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
1064
+ }
1065
+ var struct = {};
1066
+ each(fields, function (name, i) {
1067
+ struct[name] = constant(values[i]);
1068
+ });
1069
+ return struct;
1070
+ };
1071
+ };
1072
+
1073
+ var parent = function (element) {
1074
+ var dom = element.dom();
1075
+ return Option.from(dom.parentNode).map(Element$$1.fromDom);
1076
+ };
1077
+ var children = function (element) {
1078
+ var dom = element.dom();
1079
+ return map(dom.childNodes, Element$$1.fromDom);
1080
+ };
1081
+ var child = function (element, index) {
1082
+ var children = element.dom().childNodes;
1083
+ return Option.from(children[index]).map(Element$$1.fromDom);
1084
+ };
1085
+ var firstChild = function (element) {
1086
+ return child(element, 0);
1087
+ };
1088
+ var lastChild = function (element) {
1089
+ return child(element, element.dom().childNodes.length - 1);
1090
+ };
1091
+ var spot = Immutable('element', 'offset');
1092
+
1093
+ var before = function (marker, element) {
1094
+ var parent$$1 = parent(marker);
1095
+ parent$$1.each(function (v) {
1096
+ v.dom().insertBefore(element.dom(), marker.dom());
1097
+ });
1098
+ };
1099
+ var append = function (parent$$1, element) {
1100
+ parent$$1.dom().appendChild(element.dom());
1101
+ };
1102
+
1103
+ var before$1 = function (marker, elements) {
1104
+ each(elements, function (x) {
1105
+ before(marker, x);
1106
+ });
1107
+ };
1108
+ var append$1 = function (parent, elements) {
1109
+ each(elements, function (x) {
1110
+ append(parent, x);
1111
+ });
1112
+ };
1113
+
1114
+ var remove$1 = function (element) {
1115
+ var dom = element.dom();
1116
+ if (dom.parentNode !== null)
1117
+ dom.parentNode.removeChild(dom);
1118
+ };
1119
+
1120
+ var clone$1 = function (original, deep) {
1121
+ return Element$$1.fromDom(original.dom().cloneNode(deep));
1122
+ };
1123
+ var deep = function (original) {
1124
+ return clone$1(original, true);
1125
+ };
1126
+ var shallowAs = function (original, tag) {
1127
+ var nu = Element$$1.fromTag(tag);
1128
+ var attributes = clone(original);
1129
+ setAll(nu, attributes);
1130
+ return nu;
1131
+ };
1132
+ var mutate = function (original, tag) {
1133
+ var nu = shallowAs(original, tag);
1134
+ before(original, nu);
1135
+ var children$$1 = children(original);
1136
+ append$1(nu, children$$1);
1137
+ remove$1(original);
1138
+ return nu;
1139
+ };
1140
+
1141
+ var global$8 = tinymce.util.Tools.resolve('tinymce.Env');
1142
+
1143
+ var DOM$1 = global$6.DOM;
1144
+ var createNewTextBlock = function (editor, contentNode, blockName) {
1145
+ var node, textBlock;
1146
+ var fragment = DOM$1.createFragment();
1147
+ var hasContentNode;
1148
+ var blockElements = editor.schema.getBlockElements();
1149
+ if (editor.settings.forced_root_block) {
1150
+ blockName = blockName || editor.settings.forced_root_block;
1151
+ }
1152
+ if (blockName) {
1153
+ textBlock = DOM$1.create(blockName);
1154
+ if (textBlock.tagName === editor.settings.forced_root_block) {
1155
+ DOM$1.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
1156
+ }
1157
+ if (!NodeType.isBlock(contentNode.firstChild, blockElements)) {
1158
+ fragment.appendChild(textBlock);
1159
+ }
1160
+ }
1161
+ if (contentNode) {
1162
+ while (node = contentNode.firstChild) {
1163
+ var nodeName = node.nodeName;
1164
+ if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
1165
+ hasContentNode = true;
1166
+ }
1167
+ if (NodeType.isBlock(node, blockElements)) {
1168
+ fragment.appendChild(node);
1169
+ textBlock = null;
1170
+ } else {
1171
+ if (blockName) {
1172
+ if (!textBlock) {
1173
+ textBlock = DOM$1.create(blockName);
1174
+ fragment.appendChild(textBlock);
1175
+ }
1176
+ textBlock.appendChild(node);
1177
+ } else {
1178
+ fragment.appendChild(node);
1179
+ }
1180
+ }
1181
+ }
1182
+ }
1183
+ if (!editor.settings.forced_root_block) {
1184
+ fragment.appendChild(DOM$1.create('br'));
1185
+ } else {
1186
+ if (!hasContentNode && (!global$8.ie || global$8.ie > 10)) {
1187
+ textBlock.appendChild(DOM$1.create('br', { 'data-mce-bogus': '1' }));
1188
+ }
1189
+ }
1190
+ return fragment;
1191
+ };
1192
+ var TextBlock = { createNewTextBlock: createNewTextBlock };
1193
+
1194
+ var DOM$2 = global$6.DOM;
1195
+ var splitList = function (editor, ul, li, newBlock) {
1196
+ var tmpRng, fragment, bookmarks, node;
1197
+ var removeAndKeepBookmarks = function (targetNode) {
1198
+ global$5.each(bookmarks, function (node) {
1199
+ targetNode.parentNode.insertBefore(node, li.parentNode);
1200
+ });
1201
+ DOM$2.remove(targetNode);
1202
+ };
1203
+ bookmarks = DOM$2.select('span[data-mce-type="bookmark"]', ul);
1204
+ newBlock = newBlock || TextBlock.createNewTextBlock(editor, li);
1205
+ tmpRng = DOM$2.createRng();
1206
+ tmpRng.setStartAfter(li);
1207
+ tmpRng.setEndAfter(ul);
1208
+ fragment = tmpRng.extractContents();
1209
+ for (node = fragment.firstChild; node; node = node.firstChild) {
1210
+ if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {
1211
+ DOM$2.remove(node);
1212
+ break;
1213
+ }
1214
+ }
1215
+ if (!editor.dom.isEmpty(fragment)) {
1216
+ DOM$2.insertAfter(fragment, ul);
1217
+ }
1218
+ DOM$2.insertAfter(newBlock, ul);
1219
+ if (NodeType.isEmpty(editor.dom, li.parentNode)) {
1220
+ removeAndKeepBookmarks(li.parentNode);
1221
+ }
1222
+ DOM$2.remove(li);
1223
+ if (NodeType.isEmpty(editor.dom, ul)) {
1224
+ DOM$2.remove(ul);
1225
+ }
1226
+ };
1227
+ var SplitList = { splitList: splitList };
1228
+
1229
+ var liftN = function (arr, f) {
1230
+ var r = [];
1231
+ for (var i = 0; i < arr.length; i++) {
1232
+ var x = arr[i];
1233
+ if (x.isSome()) {
1234
+ r.push(x.getOrDie());
1235
+ } else {
1236
+ return Option.none();
1237
+ }
1238
+ }
1239
+ return Option.some(f.apply(null, r));
1240
+ };
1241
+
1242
+ var fromElements = function (elements, scope) {
1243
+ var doc = scope || document;
1244
+ var fragment = doc.createDocumentFragment();
1245
+ each(elements, function (element) {
1246
+ fragment.appendChild(element.dom());
1247
+ });
1248
+ return Element$$1.fromDom(fragment);
1249
+ };
1250
+
1251
+ var isSupported = function (dom) {
1252
+ return dom.style !== undefined;
1253
+ };
1254
+
1255
+ var internalSet = function (dom, property, value$$1) {
1256
+ if (!isString(value$$1)) {
1257
+ console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value$$1, ':: Element ', dom);
1258
+ throw new Error('CSS value must be a string: ' + value$$1);
1259
+ }
1260
+ if (isSupported(dom))
1261
+ dom.style.setProperty(property, value$$1);
1262
+ };
1263
+ var set$1 = function (element, property, value$$1) {
1264
+ var dom = element.dom();
1265
+ internalSet(dom, property, value$$1);
1266
+ };
1267
+
1268
+ var createSection = function (scope, listType) {
1269
+ var section = {
1270
+ list: Element$$1.fromTag(listType, scope),
1271
+ item: Element$$1.fromTag('li', scope)
1272
+ };
1273
+ append(section.list, section.item);
1274
+ return section;
1275
+ };
1276
+ var joinSections = function (parent, appendor) {
1277
+ append(parent.item, appendor.list);
1278
+ };
1279
+ var createJoinedSections = function (scope, length, listType) {
1280
+ var sections = [];
1281
+ var _loop_1 = function (i) {
1282
+ var newSection = createSection(scope, listType);
1283
+ last(sections).each(function (lastSection) {
1284
+ return joinSections(lastSection, newSection);
1285
+ });
1286
+ sections.push(newSection);
1287
+ };
1288
+ for (var i = 0; i < length; i++) {
1289
+ _loop_1(i);
1290
+ }
1291
+ return sections;
1292
+ };
1293
+ var normalizeSection = function (section, entry) {
1294
+ if (name(section.list).toUpperCase() !== entry.listType) {
1295
+ section.list = mutate(section.list, entry.listType);
1296
+ }
1297
+ setAll(section.list, entry.listAttributes);
1298
+ };
1299
+ var createItem = function (scope, attr, content) {
1300
+ var item = Element$$1.fromTag('li', scope);
1301
+ setAll(item, attr);
1302
+ append$1(item, content);
1303
+ return item;
1304
+ };
1305
+ var setItem = function (section, item) {
1306
+ append(section.list, item);
1307
+ section.item = item;
1308
+ };
1309
+ var writeShallow = function (scope, outline, entry) {
1310
+ var newOutline = outline.slice(0, entry.depth);
1311
+ last(newOutline).each(function (section) {
1312
+ setItem(section, createItem(scope, entry.itemAttributes, entry.content));
1313
+ normalizeSection(section, entry);
1314
+ });
1315
+ return newOutline;
1316
+ };
1317
+ var populateSections = function (sections, entry) {
1318
+ last(sections).each(function (section) {
1319
+ setAll(section.list, entry.listAttributes);
1320
+ setAll(section.item, entry.itemAttributes);
1321
+ append$1(section.item, entry.content);
1322
+ });
1323
+ for (var i = 0; i < sections.length - 1; i++) {
1324
+ set$1(sections[i].item, 'list-style-type', 'none');
1325
+ }
1326
+ };
1327
+ var writeDeep = function (scope, outline, entry) {
1328
+ var newSections = createJoinedSections(scope, entry.depth - outline.length, entry.listType);
1329
+ populateSections(newSections, entry);
1330
+ liftN([
1331
+ last(outline),
1332
+ head(newSections)
1333
+ ], joinSections);
1334
+ return outline.concat(newSections);
1335
+ };
1336
+ var composeList = function (scope, entries) {
1337
+ var outline = foldl(entries, function (outline, entry) {
1338
+ return entry.depth > outline.length ? writeDeep(scope, outline, entry) : writeShallow(scope, outline, entry);
1339
+ }, []);
1340
+ return head(outline).map(function (section) {
1341
+ return section.list;
1342
+ });
1343
+ };
1344
+
1345
+ var isIndented = function (entry) {
1346
+ return entry.depth > 0;
1347
+ };
1348
+ var isSelected = function (entry) {
1349
+ return entry.isSelected;
1350
+ };
1351
+
1352
+ var indentEntry = function (indentation, entry) {
1353
+ switch (indentation) {
1354
+ case 'Indent':
1355
+ entry.depth++;
1356
+ break;
1357
+ case 'Outdent':
1358
+ entry.depth--;
1359
+ break;
1360
+ case 'Flatten':
1361
+ entry.depth = 0;
1362
+ }
1363
+ };
1364
+
1365
+ var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1366
+ var shallow$1 = function (old, nu) {
1367
+ return nu;
1368
+ };
1369
+ var baseMerge = function (merger) {
1370
+ return function () {
1371
+ var objects = new Array(arguments.length);
1372
+ for (var i = 0; i < objects.length; i++)
1373
+ objects[i] = arguments[i];
1374
+ if (objects.length === 0)
1375
+ throw new Error('Can\'t merge zero objects');
1376
+ var ret = {};
1377
+ for (var j = 0; j < objects.length; j++) {
1378
+ var curObject = objects[j];
1379
+ for (var key in curObject)
1380
+ if (hasOwnProperty$1.call(curObject, key)) {
1381
+ ret[key] = merger(ret[key], curObject[key]);
1382
+ }
1383
+ }
1384
+ return ret;
1385
+ };
1386
+ };
1387
+ var merge = baseMerge(shallow$1);
1388
+
1389
+ var assimilateEntry = function (adherent, source) {
1390
+ adherent.listType = source.listType;
1391
+ adherent.listAttributes = merge({}, source.listAttributes);
1392
+ };
1393
+ var normalizeShallow = function (outline, entry) {
1394
+ var matchingEntryDepth = entry.depth - 1;
1395
+ outline[matchingEntryDepth].each(function (matchingEntry) {
1396
+ return assimilateEntry(entry, matchingEntry);
1397
+ });
1398
+ var newOutline = outline.slice(0, matchingEntryDepth);
1399
+ newOutline.push(Option.some(entry));
1400
+ return newOutline;
1401
+ };
1402
+ var normalizeDeep = function (outline, entry) {
1403
+ var newOutline = outline.slice(0);
1404
+ var diff = entry.depth - outline.length;
1405
+ for (var i = 1; i < diff; i++) {
1406
+ newOutline.push(Option.none());
1407
+ }
1408
+ newOutline.push(Option.some(entry));
1409
+ return newOutline;
1410
+ };
1411
+ var normalizeEntries = function (entries) {
1412
+ foldl(entries, function (outline, entry) {
1413
+ return entry.depth > outline.length ? normalizeDeep(outline, entry) : normalizeShallow(outline, entry);
1414
+ }, []);
1415
+ };
1416
+
1417
+ var Cell = function (initial) {
1418
+ var value = initial;
1419
+ var get = function () {
1420
+ return value;
1421
+ };
1422
+ var set = function (v) {
1423
+ value = v;
1424
+ };
1425
+ var clone = function () {
1426
+ return Cell(get());
1427
+ };
1428
+ return {
1429
+ get: get,
1430
+ set: set,
1431
+ clone: clone
1432
+ };
1433
+ };
1434
+
1435
+ var ListType;
1436
+ (function (ListType) {
1437
+ ListType['OL'] = 'OL';
1438
+ ListType['UL'] = 'UL';
1439
+ ListType['DL'] = 'DL';
1440
+ }(ListType || (ListType = {})));
1441
+ var getListType = function (list) {
1442
+ switch (name(list)) {
1443
+ case 'ol':
1444
+ return Option.some(ListType.OL);
1445
+ case 'ul':
1446
+ return Option.some(ListType.UL);
1447
+ case 'dl':
1448
+ return Option.some(ListType.DL);
1449
+ default:
1450
+ return Option.none();
1451
+ }
1452
+ };
1453
+ var isList$1 = function (el) {
1454
+ return is$1(el, 'OL,UL,DL');
1455
+ };
1456
+
1457
+ var hasFirstChildList = function (li) {
1458
+ return firstChild(li).map(isList$1).getOr(false);
1459
+ };
1460
+ var hasLastChildList = function (li) {
1461
+ return lastChild(li).map(isList$1).getOr(false);
1462
+ };
1463
+
1464
+ var getItemContent = function (li) {
1465
+ var childNodes = children(li);
1466
+ var contentLength = childNodes.length + (hasLastChildList(li) ? -1 : 0);
1467
+ return map(childNodes.slice(0, contentLength), deep);
1468
+ };
1469
+ var createEntry = function (li, depth, isSelected) {
1470
+ var list = parent(li);
1471
+ return {
1472
+ depth: depth,
1473
+ isSelected: isSelected,
1474
+ content: getItemContent(li),
1475
+ listType: list.bind(getListType).getOr(ListType.OL),
1476
+ listAttributes: list.map(clone).getOr({}),
1477
+ itemAttributes: clone(li)
1478
+ };
1479
+ };
1480
+ var parseItem = function (depth, itemSelection, selectionState, item) {
1481
+ var curriedParseList = curry(parseList, depth, itemSelection, selectionState);
1482
+ var updateSelectionState = function (itemRange) {
1483
+ return itemSelection.each(function (selection) {
1484
+ if (eq(itemRange === 'Start' ? selection.start : selection.end, item)) {
1485
+ selectionState.set(itemRange === 'Start');
1486
+ }
1487
+ });
1488
+ };
1489
+ return firstChild(item).filter(isList$1).fold(function () {
1490
+ updateSelectionState('Start');
1491
+ var fromCurrentItem = createEntry(item, depth, selectionState.get());
1492
+ updateSelectionState('End');
1493
+ var fromChildList = lastChild(item).filter(isList$1).map(curriedParseList).getOr([]);
1494
+ return [fromCurrentItem].concat(fromChildList);
1495
+ }, curriedParseList);
1496
+ };
1497
+ var parseList = function (depth, itemSelection, selectionState, list) {
1498
+ var newDepth = depth + 1;
1499
+ return bind(children(list), function (child$$1) {
1500
+ return isList$1(child$$1) ? parseList(newDepth, itemSelection, selectionState, child$$1) : parseItem(newDepth, itemSelection, selectionState, child$$1);
1501
+ });
1502
+ };
1503
+ var parseLists = function (lists, itemSelection) {
1504
+ var selectionState = Cell(false);
1505
+ var initialDepth = 0;
1506
+ return map(lists, function (list) {
1507
+ return {
1508
+ entries: parseList(initialDepth, itemSelection, selectionState, list),
1509
+ sourceList: list
1510
+ };
1511
+ });
1512
+ };
1513
+
1514
+ var outdentedComposer = function (editor, entries) {
1515
+ return map(entries, function (entry) {
1516
+ var content = fromElements(entry.content);
1517
+ return Element$$1.fromDom(TextBlock.createNewTextBlock(editor, content.dom()));
1518
+ });
1519
+ };
1520
+ var indentedComposer = function (editor, entries) {
1521
+ normalizeEntries(entries);
1522
+ return composeList(editor.contentDocument, entries).toArray();
1523
+ };
1524
+ var composeEntries = function (editor, entries) {
1525
+ return bind(groupBy(entries, isIndented), function (entries) {
1526
+ var groupIsIndented = head(entries).map(isIndented).getOr(false);
1527
+ return groupIsIndented ? indentedComposer(editor, entries) : outdentedComposer(editor, entries);
1528
+ });
1529
+ };
1530
+ var indentSelectedEntries = function (entries, indentation) {
1531
+ each(filter(entries, isSelected), function (entry) {
1532
+ return indentEntry(indentation, entry);
1533
+ });
1534
+ };
1535
+ var getItemSelection = function (editor) {
1536
+ var selectedListItems = map(Selection.getSelectedListItems(editor), Element$$1.fromDom);
1537
+ return liftN([
1538
+ find(selectedListItems, not(hasFirstChildList)),
1539
+ find(reverse(selectedListItems), not(hasFirstChildList))
1540
+ ], function (start, end) {
1541
+ return {
1542
+ start: start,
1543
+ end: end
1544
+ };
1545
+ });
1546
+ };
1547
+ var listsIndentation = function (editor, lists, indentation) {
1548
+ var parsedLists = parseLists(lists, getItemSelection(editor));
1549
+ each(parsedLists, function (entrySet) {
1550
+ indentSelectedEntries(entrySet.entries, indentation);
1551
+ before$1(entrySet.sourceList, composeEntries(editor, entrySet.entries));
1552
+ remove$1(entrySet.sourceList);
1553
+ });
1554
+ };
1555
+
1556
+ var outdentDlItem = function (editor, item) {
1557
+ if (is$1(item, 'DD')) {
1558
+ mutate(item, 'DT');
1559
+ } else if (is$1(item, 'DT')) {
1560
+ parent(item).each(function (dl) {
1561
+ return SplitList.splitList(editor, dl.dom(), item.dom());
1562
+ });
1563
+ }
1564
+ };
1565
+ var indentDlItem = function (item) {
1566
+ if (is$1(item, 'DT')) {
1567
+ mutate(item, 'DD');
1568
+ }
1569
+ };
1570
+ var dlIndentation = function (editor, indentation, dlItems) {
1571
+ if (indentation === 'Indent') {
1572
+ each(dlItems, indentDlItem);
1573
+ } else {
1574
+ each(dlItems, function (item) {
1575
+ return outdentDlItem(editor, item);
1576
+ });
1577
+ }
1578
+ };
1579
+ var selectionIndentation = function (editor, indentation) {
1580
+ var dlItems = map(Selection.getSelectedDlItems(editor), Element$$1.fromDom);
1581
+ var lists = map(Selection.getSelectedListRoots(editor), Element$$1.fromDom);
1582
+ if (dlItems.length || lists.length) {
1583
+ var bookmark = editor.selection.getBookmark();
1584
+ dlIndentation(editor, indentation, dlItems);
1585
+ listsIndentation(editor, lists, indentation);
1586
+ editor.selection.moveToBookmark(bookmark);
1587
+ editor.selection.setRng(Range.normalizeRange(editor.selection.getRng()));
1588
+ editor.nodeChanged();
1589
+ }
1590
+ };
1591
+ var indentListSelection = function (editor) {
1592
+ selectionIndentation(editor, 'Indent');
1593
+ };
1594
+ var outdentListSelection = function (editor) {
1595
+ selectionIndentation(editor, 'Outdent');
1596
+ };
1597
+ var flattenListSelection = function (editor) {
1598
+ selectionIndentation(editor, 'Flatten');
1599
+ };
1600
+
1601
+ var updateListStyle = function (dom, el, detail) {
1602
+ var type = detail['list-style-type'] ? detail['list-style-type'] : null;
1603
+ dom.setStyle(el, 'list-style-type', type);
1604
+ };
1605
+ var setAttribs = function (elm, attrs) {
1606
+ global$5.each(attrs, function (value, key) {
1607
+ elm.setAttribute(key, value);
1608
+ });
1609
+ };
1610
+ var updateListAttrs = function (dom, el, detail) {
1611
+ setAttribs(el, detail['list-attributes']);
1612
+ global$5.each(dom.select('li', el), function (li) {
1613
+ setAttribs(li, detail['list-item-attributes']);
1614
+ });
1615
+ };
1616
+ var updateListWithDetails = function (dom, el, detail) {
1617
+ updateListStyle(dom, el, detail);
1618
+ updateListAttrs(dom, el, detail);
1619
+ };
1620
+ var removeStyles = function (dom, element, styles) {
1621
+ global$5.each(styles, function (style) {
1622
+ var _a;
1623
+ return dom.setStyle(element, (_a = {}, _a[style] = '', _a));
1624
+ });
1625
+ };
1626
+ var getEndPointNode = function (editor, rng, start, root) {
1627
+ var container, offset;
112
1628
  container = rng[start ? 'startContainer' : 'endContainer'];
113
1629
  offset = rng[start ? 'startOffset' : 'endOffset'];
114
1630
  if (container.nodeType === 1) {
115
- offsetNode = DOM.create('span', { 'data-mce-type': 'bookmark' });
116
- if (container.hasChildNodes()) {
117
- offset = Math.min(offset, container.childNodes.length - 1);
118
- if (start) {
119
- container.insertBefore(offsetNode, container.childNodes[offset]);
120
- } else {
121
- DOM.insertAfter(offsetNode, container.childNodes[offset]);
122
- }
123
- } else {
124
- container.appendChild(offsetNode);
1631
+ container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
1632
+ }
1633
+ if (!start && NodeType.isBr(container.nextSibling)) {
1634
+ container = container.nextSibling;
1635
+ }
1636
+ while (container.parentNode !== root) {
1637
+ if (NodeType.isTextBlock(editor, container)) {
1638
+ return container;
125
1639
  }
126
- container = offsetNode;
127
- offset = 0;
1640
+ if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
1641
+ return container;
1642
+ }
1643
+ container = container.parentNode;
128
1644
  }
129
- bookmark[start ? 'startContainer' : 'endContainer'] = container;
130
- bookmark[start ? 'startOffset' : 'endOffset'] = offset;
1645
+ return container;
131
1646
  };
132
- setupEndPoint(true);
133
- if (!rng.collapsed) {
134
- setupEndPoint();
135
- }
136
- return bookmark;
137
- };
138
- var resolveBookmark = function (bookmark) {
139
- function restoreEndPoint(start) {
140
- var container, offset, node;
141
- var nodeIndex = function (container) {
142
- var node = container.parentNode.firstChild, idx = 0;
143
- while (node) {
144
- if (node === container) {
145
- return idx;
1647
+ var getSelectedTextBlocks = function (editor, rng, root) {
1648
+ var textBlocks = [], dom = editor.dom;
1649
+ var startNode = getEndPointNode(editor, rng, true, root);
1650
+ var endNode = getEndPointNode(editor, rng, false, root);
1651
+ var block;
1652
+ var siblings = [];
1653
+ for (var node = startNode; node; node = node.nextSibling) {
1654
+ siblings.push(node);
1655
+ if (node === endNode) {
1656
+ break;
1657
+ }
1658
+ }
1659
+ global$5.each(siblings, function (node) {
1660
+ if (NodeType.isTextBlock(editor, node)) {
1661
+ textBlocks.push(node);
1662
+ block = null;
1663
+ return;
1664
+ }
1665
+ if (dom.isBlock(node) || NodeType.isBr(node)) {
1666
+ if (NodeType.isBr(node)) {
1667
+ dom.remove(node);
146
1668
  }
147
- if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {
148
- idx++;
1669
+ block = null;
1670
+ return;
1671
+ }
1672
+ var nextSibling = node.nextSibling;
1673
+ if (global$4.isBookmarkNode(node)) {
1674
+ if (NodeType.isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) {
1675
+ block = null;
1676
+ return;
149
1677
  }
150
- node = node.nextSibling;
151
1678
  }
152
- return -1;
153
- };
154
- container = node = bookmark[start ? 'startContainer' : 'endContainer'];
155
- offset = bookmark[start ? 'startOffset' : 'endOffset'];
156
- if (!container) {
1679
+ if (!block) {
1680
+ block = dom.create('p');
1681
+ node.parentNode.insertBefore(block, node);
1682
+ textBlocks.push(block);
1683
+ }
1684
+ block.appendChild(node);
1685
+ });
1686
+ return textBlocks;
1687
+ };
1688
+ var hasCompatibleStyle = function (dom, sib, detail) {
1689
+ var sibStyle = dom.getStyle(sib, 'list-style-type');
1690
+ var detailStyle = detail ? detail['list-style-type'] : '';
1691
+ detailStyle = detailStyle === null ? '' : detailStyle;
1692
+ return sibStyle === detailStyle;
1693
+ };
1694
+ var applyList = function (editor, listName, detail) {
1695
+ if (detail === void 0) {
1696
+ detail = {};
1697
+ }
1698
+ var rng = editor.selection.getRng(true);
1699
+ var bookmark;
1700
+ var listItemName = 'LI';
1701
+ var root = Selection.getClosestListRootElm(editor, editor.selection.getStart(true));
1702
+ var dom = editor.dom;
1703
+ if (dom.getContentEditable(editor.selection.getNode()) === 'false') {
157
1704
  return;
158
1705
  }
159
- if (container.nodeType === 1) {
160
- offset = nodeIndex(container);
161
- container = container.parentNode;
162
- DOM.remove(node);
163
- if (!container.hasChildNodes() && DOM.isBlock(container)) {
164
- container.appendChild(DOM.create('br'));
1706
+ listName = listName.toUpperCase();
1707
+ if (listName === 'DL') {
1708
+ listItemName = 'DT';
1709
+ }
1710
+ bookmark = Bookmark.createBookmark(rng);
1711
+ global$5.each(getSelectedTextBlocks(editor, rng, root), function (block) {
1712
+ var listBlock, sibling;
1713
+ sibling = block.previousSibling;
1714
+ if (sibling && NodeType.isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) {
1715
+ listBlock = sibling;
1716
+ block = dom.rename(block, listItemName);
1717
+ sibling.appendChild(block);
1718
+ } else {
1719
+ listBlock = dom.create(listName);
1720
+ block.parentNode.insertBefore(listBlock, block);
1721
+ listBlock.appendChild(block);
1722
+ block = dom.rename(block, listItemName);
1723
+ }
1724
+ removeStyles(dom, block, [
1725
+ 'margin',
1726
+ 'margin-right',
1727
+ 'margin-bottom',
1728
+ 'margin-left',
1729
+ 'margin-top',
1730
+ 'padding',
1731
+ 'padding-right',
1732
+ 'padding-bottom',
1733
+ 'padding-left',
1734
+ 'padding-top'
1735
+ ]);
1736
+ updateListWithDetails(dom, listBlock, detail);
1737
+ mergeWithAdjacentLists(editor.dom, listBlock);
1738
+ });
1739
+ editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
1740
+ };
1741
+ var isValidLists = function (list1, list2) {
1742
+ return list1 && list2 && NodeType.isListNode(list1) && list1.nodeName === list2.nodeName;
1743
+ };
1744
+ var hasSameListStyle = function (dom, list1, list2) {
1745
+ var targetStyle = dom.getStyle(list1, 'list-style-type', true);
1746
+ var style = dom.getStyle(list2, 'list-style-type', true);
1747
+ return targetStyle === style;
1748
+ };
1749
+ var hasSameClasses = function (elm1, elm2) {
1750
+ return elm1.className === elm2.className;
1751
+ };
1752
+ var shouldMerge = function (dom, list1, list2) {
1753
+ return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
1754
+ };
1755
+ var mergeWithAdjacentLists = function (dom, listBlock) {
1756
+ var sibling, node;
1757
+ sibling = listBlock.nextSibling;
1758
+ if (shouldMerge(dom, listBlock, sibling)) {
1759
+ while (node = sibling.firstChild) {
1760
+ listBlock.appendChild(node);
165
1761
  }
1762
+ dom.remove(sibling);
166
1763
  }
167
- bookmark[start ? 'startContainer' : 'endContainer'] = container;
168
- bookmark[start ? 'startOffset' : 'endOffset'] = offset;
169
- }
170
- restoreEndPoint(true);
171
- restoreEndPoint();
172
- var rng = DOM.createRng();
173
- rng.setStart(bookmark.startContainer, bookmark.startOffset);
174
- if (bookmark.endContainer) {
175
- rng.setEnd(bookmark.endContainer, bookmark.endOffset);
176
- }
177
- return $_crui3egjjm0ofzg5.normalizeRange(rng);
178
- };
179
- var $_68j8lagijm0ofzg2 = {
180
- createBookmark: createBookmark,
181
- resolveBookmark: resolveBookmark
182
- };
183
-
184
- var DOM$1 = global$6.DOM;
185
- var normalizeList = function (dom, ul) {
186
- var sibling;
187
- var parentNode = ul.parentNode;
188
- if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) {
189
- sibling = parentNode.previousSibling;
190
- if (sibling && sibling.nodeName === 'LI') {
191
- sibling.appendChild(ul);
192
- if ($_74mztagkjm0ofzg7.isEmpty(dom, parentNode)) {
193
- DOM$1.remove(parentNode);
1764
+ sibling = listBlock.previousSibling;
1765
+ if (shouldMerge(dom, listBlock, sibling)) {
1766
+ while (node = sibling.lastChild) {
1767
+ listBlock.insertBefore(node, listBlock.firstChild);
194
1768
  }
195
- } else {
196
- DOM$1.setStyle(parentNode, 'listStyleType', 'none');
1769
+ dom.remove(sibling);
197
1770
  }
198
- }
199
- if ($_74mztagkjm0ofzg7.isListNode(parentNode)) {
200
- sibling = parentNode.previousSibling;
201
- if (sibling && sibling.nodeName === 'LI') {
202
- sibling.appendChild(ul);
1771
+ };
1772
+ var updateList = function (dom, list, listName, detail) {
1773
+ if (list.nodeName !== listName) {
1774
+ var newList = dom.rename(list, listName);
1775
+ updateListWithDetails(dom, newList, detail);
1776
+ } else {
1777
+ updateListWithDetails(dom, list, detail);
203
1778
  }
204
- }
205
- };
206
- var normalizeLists = function (dom, element) {
207
- global$5.each(global$5.grep(dom.select('ol,ul', element)), function (ul) {
208
- normalizeList(dom, ul);
209
- });
210
- };
211
- var $_er8krqgljm0ofzga = {
212
- normalizeList: normalizeList,
213
- normalizeLists: normalizeLists
214
- };
215
-
216
- var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
217
-
218
- var getParentList = function (editor) {
219
- var selectionStart = editor.selection.getStart(true);
220
- return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart));
221
- };
222
- var isParentListSelected = function (parentList, selectedBlocks) {
223
- return parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
224
- };
225
- var findSubLists = function (parentList) {
226
- return global$5.grep(parentList.querySelectorAll('ol,ul,dl'), function (elm) {
227
- return $_74mztagkjm0ofzg7.isListNode(elm);
228
- });
229
- };
230
- var getSelectedSubLists = function (editor) {
231
- var parentList = getParentList(editor);
232
- var selectedBlocks = editor.selection.getSelectedBlocks();
233
- if (isParentListSelected(parentList, selectedBlocks)) {
234
- return findSubLists(parentList);
235
- } else {
236
- return global$5.grep(selectedBlocks, function (elm) {
237
- return $_74mztagkjm0ofzg7.isListNode(elm) && parentList !== elm;
238
- });
239
- }
240
- };
241
- var findParentListItemsNodes = function (editor, elms) {
242
- var listItemsElms = global$5.map(elms, function (elm) {
243
- var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));
244
- return parentLi ? parentLi : elm;
245
- });
246
- return global$7.unique(listItemsElms);
247
- };
248
- var getSelectedListItems = function (editor) {
249
- var selectedBlocks = editor.selection.getSelectedBlocks();
250
- return global$5.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) {
251
- return $_74mztagkjm0ofzg7.isListItemNode(block);
252
- });
253
- };
254
- var getClosestListRootElm = function (editor, elm) {
255
- var parentTableCell = editor.dom.getParents(elm, 'TD,TH');
256
- var root = parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
257
- return root;
258
- };
259
- var $_3e5hb9gmjm0ofzgc = {
260
- getParentList: getParentList,
261
- getSelectedSubLists: getSelectedSubLists,
262
- getSelectedListItems: getSelectedListItems,
263
- getClosestListRootElm: getClosestListRootElm
264
- };
265
-
266
- var global$8 = tinymce.util.Tools.resolve('tinymce.Env');
267
-
268
- var DOM$2 = global$6.DOM;
269
- var createNewTextBlock = function (editor, contentNode, blockName) {
270
- var node, textBlock;
271
- var fragment = DOM$2.createFragment();
272
- var hasContentNode;
273
- var blockElements = editor.schema.getBlockElements();
274
- if (editor.settings.forced_root_block) {
275
- blockName = blockName || editor.settings.forced_root_block;
276
- }
277
- if (blockName) {
278
- textBlock = DOM$2.create(blockName);
279
- if (textBlock.tagName === editor.settings.forced_root_block) {
280
- DOM$2.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
1779
+ };
1780
+ var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
1781
+ if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
1782
+ flattenListSelection(editor);
1783
+ } else {
1784
+ var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
1785
+ global$5.each([parentList].concat(lists), function (elm) {
1786
+ updateList(editor.dom, elm, listName, detail);
1787
+ });
1788
+ editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
281
1789
  }
282
- if (!$_74mztagkjm0ofzg7.isBlock(contentNode.firstChild, blockElements)) {
283
- fragment.appendChild(textBlock);
1790
+ };
1791
+ var hasListStyleDetail = function (detail) {
1792
+ return 'list-style-type' in detail;
1793
+ };
1794
+ var toggleSingleList = function (editor, parentList, listName, detail) {
1795
+ if (parentList === editor.getBody()) {
1796
+ return;
284
1797
  }
285
- }
286
- if (contentNode) {
287
- while (node = contentNode.firstChild) {
288
- var nodeName = node.nodeName;
289
- if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
290
- hasContentNode = true;
291
- }
292
- if ($_74mztagkjm0ofzg7.isBlock(node, blockElements)) {
293
- fragment.appendChild(node);
294
- textBlock = null;
1798
+ if (parentList) {
1799
+ if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
1800
+ flattenListSelection(editor);
295
1801
  } else {
296
- if (blockName) {
297
- if (!textBlock) {
298
- textBlock = DOM$2.create(blockName);
299
- fragment.appendChild(textBlock);
300
- }
301
- textBlock.appendChild(node);
302
- } else {
303
- fragment.appendChild(node);
304
- }
1802
+ var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
1803
+ updateListWithDetails(editor.dom, parentList, detail);
1804
+ mergeWithAdjacentLists(editor.dom, editor.dom.rename(parentList, listName));
1805
+ editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
305
1806
  }
306
- }
307
- }
308
- if (!editor.settings.forced_root_block) {
309
- fragment.appendChild(DOM$2.create('br'));
310
- } else {
311
- if (!hasContentNode && (!global$8.ie || global$8.ie > 10)) {
312
- textBlock.appendChild(DOM$2.create('br', { 'data-mce-bogus': '1' }));
313
- }
314
- }
315
- return fragment;
316
- };
317
- var $_gboej7gpjm0ofzgh = { createNewTextBlock: createNewTextBlock };
318
-
319
- var DOM$3 = global$6.DOM;
320
- var splitList = function (editor, ul, li, newBlock) {
321
- var tmpRng, fragment, bookmarks, node;
322
- var removeAndKeepBookmarks = function (targetNode) {
323
- global$5.each(bookmarks, function (node) {
324
- targetNode.parentNode.insertBefore(node, li.parentNode);
325
- });
326
- DOM$3.remove(targetNode);
327
- };
328
- bookmarks = DOM$3.select('span[data-mce-type="bookmark"]', ul);
329
- newBlock = newBlock || $_gboej7gpjm0ofzgh.createNewTextBlock(editor, li);
330
- tmpRng = DOM$3.createRng();
331
- tmpRng.setStartAfter(li);
332
- tmpRng.setEndAfter(ul);
333
- fragment = tmpRng.extractContents();
334
- for (node = fragment.firstChild; node; node = node.firstChild) {
335
- if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {
336
- DOM$3.remove(node);
337
- break;
338
- }
339
- }
340
- if (!editor.dom.isEmpty(fragment)) {
341
- DOM$3.insertAfter(fragment, ul);
342
- }
343
- DOM$3.insertAfter(newBlock, ul);
344
- if ($_74mztagkjm0ofzg7.isEmpty(editor.dom, li.parentNode)) {
345
- removeAndKeepBookmarks(li.parentNode);
346
- }
347
- DOM$3.remove(li);
348
- if ($_74mztagkjm0ofzg7.isEmpty(editor.dom, ul)) {
349
- DOM$3.remove(ul);
350
- }
351
- };
352
- var $_f3a77tgojm0ofzgf = { splitList: splitList };
353
-
354
- var DOM$4 = global$6.DOM;
355
- var removeEmptyLi = function (dom, li) {
356
- if ($_74mztagkjm0ofzg7.isEmpty(dom, li)) {
357
- DOM$4.remove(li);
358
- }
359
- };
360
- var outdent = function (editor, li) {
361
- var ul = li.parentNode;
362
- var ulParent, newBlock;
363
- if (ul) {
364
- ulParent = ul.parentNode;
365
- } else {
366
- removeEmptyLi(editor.dom, li);
367
- return true;
368
- }
369
- if (ul === editor.getBody()) {
370
- return true;
371
- }
372
- if (li.nodeName === 'DD') {
373
- DOM$4.rename(li, 'DT');
374
- return true;
375
- }
376
- if ($_74mztagkjm0ofzg7.isFirstChild(li) && $_74mztagkjm0ofzg7.isLastChild(li)) {
377
- if (ulParent.nodeName === 'LI') {
378
- DOM$4.insertAfter(li, ulParent);
379
- removeEmptyLi(editor.dom, ulParent);
380
- DOM$4.remove(ul);
381
- } else if ($_74mztagkjm0ofzg7.isListNode(ulParent)) {
382
- DOM$4.remove(ul, true);
383
1807
  } else {
384
- ulParent.insertBefore($_gboej7gpjm0ofzgh.createNewTextBlock(editor, li), ul);
385
- DOM$4.remove(ul);
386
- }
387
- return true;
388
- } else if ($_74mztagkjm0ofzg7.isFirstChild(li)) {
389
- if (ulParent.nodeName === 'LI') {
390
- DOM$4.insertAfter(li, ulParent);
391
- li.appendChild(ul);
392
- removeEmptyLi(editor.dom, ulParent);
393
- } else if ($_74mztagkjm0ofzg7.isListNode(ulParent)) {
394
- ulParent.insertBefore(li, ul);
395
- } else {
396
- ulParent.insertBefore($_gboej7gpjm0ofzgh.createNewTextBlock(editor, li), ul);
397
- DOM$4.remove(li);
398
- }
399
- return true;
400
- } else if ($_74mztagkjm0ofzg7.isLastChild(li)) {
401
- if (ulParent.nodeName === 'LI') {
402
- DOM$4.insertAfter(li, ulParent);
403
- } else if ($_74mztagkjm0ofzg7.isListNode(ulParent)) {
404
- DOM$4.insertAfter(li, ul);
1808
+ applyList(editor, listName, detail);
1809
+ }
1810
+ };
1811
+ var toggleList = function (editor, listName, detail) {
1812
+ var parentList = Selection.getParentList(editor);
1813
+ var selectedSubLists = Selection.getSelectedSubLists(editor);
1814
+ detail = detail ? detail : {};
1815
+ if (parentList && selectedSubLists.length > 0) {
1816
+ toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
405
1817
  } else {
406
- DOM$4.insertAfter($_gboej7gpjm0ofzgh.createNewTextBlock(editor, li), ul);
407
- DOM$4.remove(li);
1818
+ toggleSingleList(editor, parentList, listName, detail);
408
1819
  }
409
- return true;
410
- }
411
- if (ulParent.nodeName === 'LI') {
412
- ul = ulParent;
413
- newBlock = $_gboej7gpjm0ofzgh.createNewTextBlock(editor, li, 'LI');
414
- } else if ($_74mztagkjm0ofzg7.isListNode(ulParent)) {
415
- newBlock = $_gboej7gpjm0ofzgh.createNewTextBlock(editor, li, 'LI');
416
- } else {
417
- newBlock = $_gboej7gpjm0ofzgh.createNewTextBlock(editor, li);
418
- }
419
- $_f3a77tgojm0ofzgf.splitList(editor, ul, li, newBlock);
420
- $_er8krqgljm0ofzga.normalizeLists(editor.dom, ul.parentNode);
421
- return true;
422
- };
423
- var outdentSelection = function (editor) {
424
- var listElements = $_3e5hb9gmjm0ofzgc.getSelectedListItems(editor);
425
- if (listElements.length) {
426
- var bookmark = $_68j8lagijm0ofzg2.createBookmark(editor.selection.getRng());
427
- var i = void 0, y = void 0;
428
- var root = $_3e5hb9gmjm0ofzgc.getClosestListRootElm(editor, editor.selection.getStart(true));
429
- i = listElements.length;
430
- while (i--) {
431
- var node = listElements[i].parentNode;
432
- while (node && node !== root) {
433
- y = listElements.length;
434
- while (y--) {
435
- if (listElements[y] === node) {
436
- listElements.splice(i, 1);
437
- break;
438
- }
1820
+ };
1821
+ var ToggleList = {
1822
+ toggleList: toggleList,
1823
+ mergeWithAdjacentLists: mergeWithAdjacentLists
1824
+ };
1825
+
1826
+ var DOM$3 = global$6.DOM;
1827
+ var normalizeList = function (dom, ul) {
1828
+ var sibling;
1829
+ var parentNode = ul.parentNode;
1830
+ if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) {
1831
+ sibling = parentNode.previousSibling;
1832
+ if (sibling && sibling.nodeName === 'LI') {
1833
+ sibling.appendChild(ul);
1834
+ if (NodeType.isEmpty(dom, parentNode)) {
1835
+ DOM$3.remove(parentNode);
439
1836
  }
440
- node = node.parentNode;
1837
+ } else {
1838
+ DOM$3.setStyle(parentNode, 'listStyleType', 'none');
441
1839
  }
442
1840
  }
443
- for (i = 0; i < listElements.length; i++) {
444
- if (!outdent(editor, listElements[i]) && i === 0) {
445
- break;
1841
+ if (NodeType.isListNode(parentNode)) {
1842
+ sibling = parentNode.previousSibling;
1843
+ if (sibling && sibling.nodeName === 'LI') {
1844
+ sibling.appendChild(ul);
446
1845
  }
447
1846
  }
448
- editor.selection.setRng($_68j8lagijm0ofzg2.resolveBookmark(bookmark));
449
- editor.nodeChanged();
450
- return true;
451
- }
452
- };
453
- var $_40lbtggjm0ofzfy = {
454
- outdent: outdent,
455
- outdentSelection: outdentSelection
456
- };
457
-
458
- var updateListStyle = function (dom, el, detail) {
459
- var type = detail['list-style-type'] ? detail['list-style-type'] : null;
460
- dom.setStyle(el, 'list-style-type', type);
461
- };
462
- var setAttribs = function (elm, attrs) {
463
- global$5.each(attrs, function (value, key) {
464
- elm.setAttribute(key, value);
465
- });
466
- };
467
- var updateListAttrs = function (dom, el, detail) {
468
- setAttribs(el, detail['list-attributes']);
469
- global$5.each(dom.select('li', el), function (li) {
470
- setAttribs(li, detail['list-item-attributes']);
471
- });
472
- };
473
- var updateListWithDetails = function (dom, el, detail) {
474
- updateListStyle(dom, el, detail);
475
- updateListAttrs(dom, el, detail);
476
- };
477
- var removeStyles = function (dom, element, styles) {
478
- global$5.each(styles, function (style) {
479
- var _a;
480
- return dom.setStyle(element, (_a = {}, _a[style] = '', _a));
481
- });
482
- };
483
- var getEndPointNode = function (editor, rng, start, root) {
484
- var container, offset;
485
- container = rng[start ? 'startContainer' : 'endContainer'];
486
- offset = rng[start ? 'startOffset' : 'endOffset'];
487
- if (container.nodeType === 1) {
488
- container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
489
- }
490
- if (!start && $_74mztagkjm0ofzg7.isBr(container.nextSibling)) {
491
- container = container.nextSibling;
492
- }
493
- while (container.parentNode !== root) {
494
- if ($_74mztagkjm0ofzg7.isTextBlock(editor, container)) {
495
- return container;
496
- }
497
- if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
498
- return container;
499
- }
500
- container = container.parentNode;
501
- }
502
- return container;
503
- };
504
- var getSelectedTextBlocks = function (editor, rng, root) {
505
- var textBlocks = [], dom = editor.dom;
506
- var startNode = getEndPointNode(editor, rng, true, root);
507
- var endNode = getEndPointNode(editor, rng, false, root);
508
- var block;
509
- var siblings = [];
510
- for (var node = startNode; node; node = node.nextSibling) {
511
- siblings.push(node);
512
- if (node === endNode) {
513
- break;
1847
+ };
1848
+ var normalizeLists = function (dom, element) {
1849
+ global$5.each(global$5.grep(dom.select('ol,ul', element)), function (ul) {
1850
+ normalizeList(dom, ul);
1851
+ });
1852
+ };
1853
+ var NormalizeLists = {
1854
+ normalizeList: normalizeList,
1855
+ normalizeLists: normalizeLists
1856
+ };
1857
+
1858
+ var findNextCaretContainer = function (editor, rng, isForward, root) {
1859
+ var node = rng.startContainer;
1860
+ var offset = rng.startOffset;
1861
+ var nonEmptyBlocks, walker;
1862
+ if (node.nodeType === 3 && (isForward ? offset < node.data.length : offset > 0)) {
1863
+ return node;
514
1864
  }
515
- }
516
- global$5.each(siblings, function (node) {
517
- if ($_74mztagkjm0ofzg7.isTextBlock(editor, node)) {
518
- textBlocks.push(node);
519
- block = null;
520
- return;
1865
+ nonEmptyBlocks = editor.schema.getNonEmptyElements();
1866
+ if (node.nodeType === 1) {
1867
+ node = global$1.getNode(node, offset);
521
1868
  }
522
- if (dom.isBlock(node) || $_74mztagkjm0ofzg7.isBr(node)) {
523
- if ($_74mztagkjm0ofzg7.isBr(node)) {
524
- dom.remove(node);
1869
+ walker = new global$2(node, root);
1870
+ if (isForward) {
1871
+ if (NodeType.isBogusBr(editor.dom, node)) {
1872
+ walker.next();
525
1873
  }
526
- block = null;
527
- return;
528
1874
  }
529
- var nextSibling = node.nextSibling;
530
- if (global$4.isBookmarkNode(node)) {
531
- if ($_74mztagkjm0ofzg7.isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) {
532
- block = null;
533
- return;
1875
+ while (node = walker[isForward ? 'next' : 'prev2']()) {
1876
+ if (node.nodeName === 'LI' && !node.hasChildNodes()) {
1877
+ return node;
1878
+ }
1879
+ if (nonEmptyBlocks[node.nodeName]) {
1880
+ return node;
1881
+ }
1882
+ if (node.nodeType === 3 && node.data.length > 0) {
1883
+ return node;
534
1884
  }
535
1885
  }
536
- if (!block) {
537
- block = dom.create('p');
538
- node.parentNode.insertBefore(block, node);
539
- textBlocks.push(block);
1886
+ };
1887
+ var hasOnlyOneBlockChild = function (dom, elm) {
1888
+ var childNodes = elm.childNodes;
1889
+ return childNodes.length === 1 && !NodeType.isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
1890
+ };
1891
+ var unwrapSingleBlockChild = function (dom, elm) {
1892
+ if (hasOnlyOneBlockChild(dom, elm)) {
1893
+ dom.remove(elm.firstChild, true);
540
1894
  }
541
- block.appendChild(node);
542
- });
543
- return textBlocks;
544
- };
545
- var hasCompatibleStyle = function (dom, sib, detail) {
546
- var sibStyle = dom.getStyle(sib, 'list-style-type');
547
- var detailStyle = detail ? detail['list-style-type'] : '';
548
- detailStyle = detailStyle === null ? '' : detailStyle;
549
- return sibStyle === detailStyle;
550
- };
551
- var applyList = function (editor, listName, detail) {
552
- if (detail === void 0) {
553
- detail = {};
554
- }
555
- var rng = editor.selection.getRng(true);
556
- var bookmark;
557
- var listItemName = 'LI';
558
- var root = $_3e5hb9gmjm0ofzgc.getClosestListRootElm(editor, editor.selection.getStart(true));
559
- var dom = editor.dom;
560
- if (dom.getContentEditable(editor.selection.getNode()) === 'false') {
561
- return;
562
- }
563
- listName = listName.toUpperCase();
564
- if (listName === 'DL') {
565
- listItemName = 'DT';
566
- }
567
- bookmark = $_68j8lagijm0ofzg2.createBookmark(rng);
568
- global$5.each(getSelectedTextBlocks(editor, rng, root), function (block) {
569
- var listBlock, sibling;
570
- sibling = block.previousSibling;
571
- if (sibling && $_74mztagkjm0ofzg7.isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) {
572
- listBlock = sibling;
573
- block = dom.rename(block, listItemName);
574
- sibling.appendChild(block);
575
- } else {
576
- listBlock = dom.create(listName);
577
- block.parentNode.insertBefore(listBlock, block);
578
- listBlock.appendChild(block);
579
- block = dom.rename(block, listItemName);
580
- }
581
- removeStyles(dom, block, [
582
- 'margin',
583
- 'margin-right',
584
- 'margin-bottom',
585
- 'margin-left',
586
- 'margin-top',
587
- 'padding',
588
- 'padding-right',
589
- 'padding-bottom',
590
- 'padding-left',
591
- 'padding-top'
592
- ]);
593
- updateListWithDetails(dom, listBlock, detail);
594
- mergeWithAdjacentLists(editor.dom, listBlock);
595
- });
596
- editor.selection.setRng($_68j8lagijm0ofzg2.resolveBookmark(bookmark));
597
- };
598
- var removeList = function (editor) {
599
- var bookmark = $_68j8lagijm0ofzg2.createBookmark(editor.selection.getRng(true));
600
- var root = $_3e5hb9gmjm0ofzgc.getClosestListRootElm(editor, editor.selection.getStart(true));
601
- var listItems = $_3e5hb9gmjm0ofzgc.getSelectedListItems(editor);
602
- var emptyListItems = global$5.grep(listItems, function (li) {
603
- return editor.dom.isEmpty(li);
604
- });
605
- listItems = global$5.grep(listItems, function (li) {
606
- return !editor.dom.isEmpty(li);
607
- });
608
- global$5.each(emptyListItems, function (li) {
609
- if ($_74mztagkjm0ofzg7.isEmpty(editor.dom, li)) {
610
- $_40lbtggjm0ofzfy.outdent(editor, li);
611
- return;
1895
+ };
1896
+ var moveChildren = function (dom, fromElm, toElm) {
1897
+ var node, targetElm;
1898
+ targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
1899
+ unwrapSingleBlockChild(dom, fromElm);
1900
+ if (!NodeType.isEmpty(dom, fromElm, true)) {
1901
+ while (node = fromElm.firstChild) {
1902
+ targetElm.appendChild(node);
1903
+ }
612
1904
  }
613
- });
614
- global$5.each(listItems, function (li) {
615
- var node, rootList;
616
- if (li.parentNode === editor.getBody()) {
1905
+ };
1906
+ var mergeLiElements = function (dom, fromElm, toElm) {
1907
+ var node, listNode;
1908
+ var ul = fromElm.parentNode;
1909
+ if (!NodeType.isChildOfBody(dom, fromElm) || !NodeType.isChildOfBody(dom, toElm)) {
617
1910
  return;
618
1911
  }
619
- for (node = li; node && node !== root; node = node.parentNode) {
620
- if ($_74mztagkjm0ofzg7.isListNode(node)) {
621
- rootList = node;
622
- }
623
- }
624
- $_f3a77tgojm0ofzgf.splitList(editor, rootList, li);
625
- $_er8krqgljm0ofzga.normalizeLists(editor.dom, rootList.parentNode);
626
- });
627
- editor.selection.setRng($_68j8lagijm0ofzg2.resolveBookmark(bookmark));
628
- };
629
- var isValidLists = function (list1, list2) {
630
- return list1 && list2 && $_74mztagkjm0ofzg7.isListNode(list1) && list1.nodeName === list2.nodeName;
631
- };
632
- var hasSameListStyle = function (dom, list1, list2) {
633
- var targetStyle = dom.getStyle(list1, 'list-style-type', true);
634
- var style = dom.getStyle(list2, 'list-style-type', true);
635
- return targetStyle === style;
636
- };
637
- var hasSameClasses = function (elm1, elm2) {
638
- return elm1.className === elm2.className;
639
- };
640
- var shouldMerge = function (dom, list1, list2) {
641
- return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
642
- };
643
- var mergeWithAdjacentLists = function (dom, listBlock) {
644
- var sibling, node;
645
- sibling = listBlock.nextSibling;
646
- if (shouldMerge(dom, listBlock, sibling)) {
647
- while (node = sibling.firstChild) {
648
- listBlock.appendChild(node);
649
- }
650
- dom.remove(sibling);
651
- }
652
- sibling = listBlock.previousSibling;
653
- if (shouldMerge(dom, listBlock, sibling)) {
654
- while (node = sibling.lastChild) {
655
- listBlock.insertBefore(node, listBlock.firstChild);
1912
+ if (NodeType.isListNode(toElm.lastChild)) {
1913
+ listNode = toElm.lastChild;
656
1914
  }
657
- dom.remove(sibling);
658
- }
659
- };
660
- var updateList = function (dom, list, listName, detail) {
661
- if (list.nodeName !== listName) {
662
- var newList = dom.rename(list, listName);
663
- updateListWithDetails(dom, newList, detail);
664
- } else {
665
- updateListWithDetails(dom, list, detail);
666
- }
667
- };
668
- var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
669
- if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
670
- removeList(editor);
671
- } else {
672
- var bookmark = $_68j8lagijm0ofzg2.createBookmark(editor.selection.getRng(true));
673
- global$5.each([parentList].concat(lists), function (elm) {
674
- updateList(editor.dom, elm, listName, detail);
675
- });
676
- editor.selection.setRng($_68j8lagijm0ofzg2.resolveBookmark(bookmark));
677
- }
678
- };
679
- var hasListStyleDetail = function (detail) {
680
- return 'list-style-type' in detail;
681
- };
682
- var toggleSingleList = function (editor, parentList, listName, detail) {
683
- if (parentList === editor.getBody()) {
684
- return;
685
- }
686
- if (parentList) {
687
- if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
688
- removeList(editor);
689
- } else {
690
- var bookmark = $_68j8lagijm0ofzg2.createBookmark(editor.selection.getRng(true));
691
- updateListWithDetails(editor.dom, parentList, detail);
692
- mergeWithAdjacentLists(editor.dom, editor.dom.rename(parentList, listName));
693
- editor.selection.setRng($_68j8lagijm0ofzg2.resolveBookmark(bookmark));
1915
+ if (ul === toElm.lastChild) {
1916
+ if (NodeType.isBr(ul.previousSibling)) {
1917
+ dom.remove(ul.previousSibling);
1918
+ }
694
1919
  }
695
- } else {
696
- applyList(editor, listName, detail);
697
- }
698
- };
699
- var toggleList = function (editor, listName, detail) {
700
- var parentList = $_3e5hb9gmjm0ofzgc.getParentList(editor);
701
- var selectedSubLists = $_3e5hb9gmjm0ofzgc.getSelectedSubLists(editor);
702
- detail = detail ? detail : {};
703
- if (parentList && selectedSubLists.length > 0) {
704
- toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
705
- } else {
706
- toggleSingleList(editor, parentList, listName, detail);
707
- }
708
- };
709
- var $_9gjx41gdjm0ofzfr = {
710
- toggleList: toggleList,
711
- removeList: removeList,
712
- mergeWithAdjacentLists: mergeWithAdjacentLists
713
- };
714
-
715
- var findNextCaretContainer = function (editor, rng, isForward, root) {
716
- var node = rng.startContainer;
717
- var offset = rng.startOffset;
718
- var nonEmptyBlocks, walker;
719
- if (node.nodeType === 3 && (isForward ? offset < node.data.length : offset > 0)) {
720
- return node;
721
- }
722
- nonEmptyBlocks = editor.schema.getNonEmptyElements();
723
- if (node.nodeType === 1) {
724
- node = global$1.getNode(node, offset);
725
- }
726
- walker = new global$2(node, root);
727
- if (isForward) {
728
- if ($_74mztagkjm0ofzg7.isBogusBr(editor.dom, node)) {
729
- walker.next();
1920
+ node = toElm.lastChild;
1921
+ if (node && NodeType.isBr(node) && fromElm.hasChildNodes()) {
1922
+ dom.remove(node);
730
1923
  }
731
- }
732
- while (node = walker[isForward ? 'next' : 'prev2']()) {
733
- if (node.nodeName === 'LI' && !node.hasChildNodes()) {
734
- return node;
1924
+ if (NodeType.isEmpty(dom, toElm, true)) {
1925
+ dom.$(toElm).empty();
735
1926
  }
736
- if (nonEmptyBlocks[node.nodeName]) {
737
- return node;
1927
+ moveChildren(dom, fromElm, toElm);
1928
+ if (listNode) {
1929
+ toElm.appendChild(listNode);
738
1930
  }
739
- if (node.nodeType === 3 && node.data.length > 0) {
740
- return node;
1931
+ dom.remove(fromElm);
1932
+ if (NodeType.isEmpty(dom, ul) && ul !== dom.getRoot()) {
1933
+ dom.remove(ul);
741
1934
  }
742
- }
743
- };
744
- var hasOnlyOneBlockChild = function (dom, elm) {
745
- var childNodes = elm.childNodes;
746
- return childNodes.length === 1 && !$_74mztagkjm0ofzg7.isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
747
- };
748
- var unwrapSingleBlockChild = function (dom, elm) {
749
- if (hasOnlyOneBlockChild(dom, elm)) {
750
- dom.remove(elm.firstChild, true);
751
- }
752
- };
753
- var moveChildren = function (dom, fromElm, toElm) {
754
- var node, targetElm;
755
- targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
756
- unwrapSingleBlockChild(dom, fromElm);
757
- if (!$_74mztagkjm0ofzg7.isEmpty(dom, fromElm, true)) {
758
- while (node = fromElm.firstChild) {
759
- targetElm.appendChild(node);
1935
+ };
1936
+ var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
1937
+ editor.dom.$(toLi).empty();
1938
+ mergeLiElements(editor.dom, fromLi, toLi);
1939
+ editor.selection.setCursorLocation(toLi);
1940
+ };
1941
+ var mergeForward = function (editor, rng, fromLi, toLi) {
1942
+ var dom = editor.dom;
1943
+ if (dom.isEmpty(toLi)) {
1944
+ mergeIntoEmptyLi(editor, fromLi, toLi);
1945
+ } else {
1946
+ var bookmark = Bookmark.createBookmark(rng);
1947
+ mergeLiElements(dom, fromLi, toLi);
1948
+ editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
760
1949
  }
761
- }
762
- };
763
- var mergeLiElements = function (dom, fromElm, toElm) {
764
- var node, listNode;
765
- var ul = fromElm.parentNode;
766
- if (!$_74mztagkjm0ofzg7.isChildOfBody(dom, fromElm) || !$_74mztagkjm0ofzg7.isChildOfBody(dom, toElm)) {
767
- return;
768
- }
769
- if ($_74mztagkjm0ofzg7.isListNode(toElm.lastChild)) {
770
- listNode = toElm.lastChild;
771
- }
772
- if (ul === toElm.lastChild) {
773
- if ($_74mztagkjm0ofzg7.isBr(ul.previousSibling)) {
774
- dom.remove(ul.previousSibling);
1950
+ };
1951
+ var mergeBackward = function (editor, rng, fromLi, toLi) {
1952
+ var bookmark = Bookmark.createBookmark(rng);
1953
+ mergeLiElements(editor.dom, fromLi, toLi);
1954
+ var resolvedBookmark = Bookmark.resolveBookmark(bookmark);
1955
+ editor.selection.setRng(resolvedBookmark);
1956
+ };
1957
+ var backspaceDeleteFromListToListCaret = function (editor, isForward) {
1958
+ var dom = editor.dom, selection = editor.selection;
1959
+ var selectionStartElm = selection.getStart();
1960
+ var root = Selection.getClosestListRootElm(editor, selectionStartElm);
1961
+ var li = dom.getParent(selection.getStart(), 'LI', root);
1962
+ var ul, rng, otherLi;
1963
+ if (li) {
1964
+ ul = li.parentNode;
1965
+ if (ul === editor.getBody() && NodeType.isEmpty(dom, ul)) {
1966
+ return true;
1967
+ }
1968
+ rng = Range.normalizeRange(selection.getRng(true));
1969
+ otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
1970
+ if (otherLi && otherLi !== li) {
1971
+ if (isForward) {
1972
+ mergeForward(editor, rng, otherLi, li);
1973
+ } else {
1974
+ mergeBackward(editor, rng, li, otherLi);
1975
+ }
1976
+ return true;
1977
+ } else if (!otherLi) {
1978
+ if (!isForward) {
1979
+ flattenListSelection(editor);
1980
+ return true;
1981
+ }
1982
+ }
775
1983
  }
776
- }
777
- node = toElm.lastChild;
778
- if (node && $_74mztagkjm0ofzg7.isBr(node) && fromElm.hasChildNodes()) {
779
- dom.remove(node);
780
- }
781
- if ($_74mztagkjm0ofzg7.isEmpty(dom, toElm, true)) {
782
- dom.$(toElm).empty();
783
- }
784
- moveChildren(dom, fromElm, toElm);
785
- if (listNode) {
786
- toElm.appendChild(listNode);
787
- }
788
- dom.remove(fromElm);
789
- if ($_74mztagkjm0ofzg7.isEmpty(dom, ul) && ul !== dom.getRoot()) {
790
- dom.remove(ul);
791
- }
792
- };
793
- var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
794
- editor.dom.$(toLi).empty();
795
- mergeLiElements(editor.dom, fromLi, toLi);
796
- editor.selection.setCursorLocation(toLi);
797
- };
798
- var mergeForward = function (editor, rng, fromLi, toLi) {
799
- var dom = editor.dom;
800
- if (dom.isEmpty(toLi)) {
801
- mergeIntoEmptyLi(editor, fromLi, toLi);
802
- } else {
803
- var bookmark = $_68j8lagijm0ofzg2.createBookmark(rng);
804
- mergeLiElements(dom, fromLi, toLi);
805
- editor.selection.setRng($_68j8lagijm0ofzg2.resolveBookmark(bookmark));
806
- }
807
- };
808
- var mergeBackward = function (editor, rng, fromLi, toLi) {
809
- var bookmark = $_68j8lagijm0ofzg2.createBookmark(rng);
810
- mergeLiElements(editor.dom, fromLi, toLi);
811
- var resolvedBookmark = $_68j8lagijm0ofzg2.resolveBookmark(bookmark);
812
- editor.selection.setRng(resolvedBookmark);
813
- };
814
- var backspaceDeleteFromListToListCaret = function (editor, isForward) {
815
- var dom = editor.dom, selection = editor.selection;
816
- var selectionStartElm = selection.getStart();
817
- var root = $_3e5hb9gmjm0ofzgc.getClosestListRootElm(editor, selectionStartElm);
818
- var li = dom.getParent(selection.getStart(), 'LI', root);
819
- var ul, rng, otherLi;
820
- if (li) {
821
- ul = li.parentNode;
822
- if (ul === editor.getBody() && $_74mztagkjm0ofzg7.isEmpty(dom, ul)) {
823
- return true;
1984
+ return false;
1985
+ };
1986
+ var removeBlock = function (dom, block, root) {
1987
+ var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);
1988
+ dom.remove(block);
1989
+ if (parentBlock && dom.isEmpty(parentBlock)) {
1990
+ dom.remove(parentBlock);
824
1991
  }
825
- rng = $_crui3egjjm0ofzg5.normalizeRange(selection.getRng(true));
826
- otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
827
- if (otherLi && otherLi !== li) {
828
- if (isForward) {
829
- mergeForward(editor, rng, otherLi, li);
830
- } else {
831
- mergeBackward(editor, rng, li, otherLi);
832
- }
833
- return true;
834
- } else if (!otherLi) {
835
- if (!isForward) {
836
- $_9gjx41gdjm0ofzfr.removeList(editor);
1992
+ };
1993
+ var backspaceDeleteIntoListCaret = function (editor, isForward) {
1994
+ var dom = editor.dom;
1995
+ var selectionStartElm = editor.selection.getStart();
1996
+ var root = Selection.getClosestListRootElm(editor, selectionStartElm);
1997
+ var block = dom.getParent(selectionStartElm, dom.isBlock, root);
1998
+ if (block && dom.isEmpty(block)) {
1999
+ var rng = Range.normalizeRange(editor.selection.getRng(true));
2000
+ var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
2001
+ if (otherLi_1) {
2002
+ editor.undoManager.transact(function () {
2003
+ removeBlock(dom, block, root);
2004
+ ToggleList.mergeWithAdjacentLists(dom, otherLi_1.parentNode);
2005
+ editor.selection.select(otherLi_1, true);
2006
+ editor.selection.collapse(isForward);
2007
+ });
837
2008
  return true;
838
2009
  }
839
2010
  }
840
- }
841
- return false;
842
- };
843
- var removeBlock = function (dom, block, root) {
844
- var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);
845
- dom.remove(block);
846
- if (parentBlock && dom.isEmpty(parentBlock)) {
847
- dom.remove(parentBlock);
848
- }
849
- };
850
- var backspaceDeleteIntoListCaret = function (editor, isForward) {
851
- var dom = editor.dom;
852
- var selectionStartElm = editor.selection.getStart();
853
- var root = $_3e5hb9gmjm0ofzgc.getClosestListRootElm(editor, selectionStartElm);
854
- var block = dom.getParent(selectionStartElm, dom.isBlock, root);
855
- if (block && dom.isEmpty(block)) {
856
- var rng = $_crui3egjjm0ofzg5.normalizeRange(editor.selection.getRng(true));
857
- var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
858
- if (otherLi_1) {
2011
+ return false;
2012
+ };
2013
+ var backspaceDeleteCaret = function (editor, isForward) {
2014
+ return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);
2015
+ };
2016
+ var backspaceDeleteRange = function (editor) {
2017
+ var selectionStartElm = editor.selection.getStart();
2018
+ var root = Selection.getClosestListRootElm(editor, selectionStartElm);
2019
+ var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);
2020
+ if (startListParent || Selection.getSelectedListItems(editor).length > 0) {
859
2021
  editor.undoManager.transact(function () {
860
- removeBlock(dom, block, root);
861
- $_9gjx41gdjm0ofzfr.mergeWithAdjacentLists(dom, otherLi_1.parentNode);
862
- editor.selection.select(otherLi_1, true);
863
- editor.selection.collapse(isForward);
2022
+ editor.execCommand('Delete');
2023
+ NormalizeLists.normalizeLists(editor.dom, editor.getBody());
864
2024
  });
865
2025
  return true;
866
2026
  }
867
- }
868
- return false;
869
- };
870
- var backspaceDeleteCaret = function (editor, isForward) {
871
- return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);
872
- };
873
- var backspaceDeleteRange = function (editor) {
874
- var selectionStartElm = editor.selection.getStart();
875
- var root = $_3e5hb9gmjm0ofzgc.getClosestListRootElm(editor, selectionStartElm);
876
- var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);
877
- if (startListParent || $_3e5hb9gmjm0ofzgc.getSelectedListItems(editor).length > 0) {
878
- editor.undoManager.transact(function () {
879
- editor.execCommand('Delete');
880
- $_er8krqgljm0ofzga.normalizeLists(editor.dom, editor.getBody());
2027
+ return false;
2028
+ };
2029
+ var backspaceDelete = function (editor, isForward) {
2030
+ return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor);
2031
+ };
2032
+ var setup = function (editor) {
2033
+ editor.on('keydown', function (e) {
2034
+ if (e.keyCode === global$3.BACKSPACE) {
2035
+ if (backspaceDelete(editor, false)) {
2036
+ e.preventDefault();
2037
+ }
2038
+ } else if (e.keyCode === global$3.DELETE) {
2039
+ if (backspaceDelete(editor, true)) {
2040
+ e.preventDefault();
2041
+ }
2042
+ }
881
2043
  });
882
- return true;
883
- }
884
- return false;
885
- };
886
- var backspaceDelete = function (editor, isForward) {
887
- return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor);
888
- };
889
- var setup = function (editor) {
890
- editor.on('keydown', function (e) {
891
- if (e.keyCode === global$3.BACKSPACE) {
892
- if (backspaceDelete(editor, false)) {
893
- e.preventDefault();
2044
+ };
2045
+ var Delete = {
2046
+ setup: setup,
2047
+ backspaceDelete: backspaceDelete
2048
+ };
2049
+
2050
+ var get$3 = function (editor) {
2051
+ return {
2052
+ backspaceDelete: function (isForward) {
2053
+ Delete.backspaceDelete(editor, isForward);
894
2054
  }
895
- } else if (e.keyCode === global$3.DELETE) {
896
- if (backspaceDelete(editor, true)) {
897
- e.preventDefault();
2055
+ };
2056
+ };
2057
+ var Api = { get: get$3 };
2058
+
2059
+ var queryListCommandState = function (editor, listName) {
2060
+ return function () {
2061
+ var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
2062
+ return parentList && parentList.nodeName === listName;
2063
+ };
2064
+ };
2065
+ var register = function (editor) {
2066
+ editor.on('BeforeExecCommand', function (e) {
2067
+ var cmd = e.command.toLowerCase();
2068
+ if (cmd === 'indent') {
2069
+ indentListSelection(editor);
2070
+ } else if (cmd === 'outdent') {
2071
+ outdentListSelection(editor);
898
2072
  }
899
- }
900
- });
901
- };
902
- var $_b0poo3g9jm0ofzfi = {
903
- setup: setup,
904
- backspaceDelete: backspaceDelete
905
- };
2073
+ });
2074
+ editor.addCommand('InsertUnorderedList', function (ui, detail) {
2075
+ ToggleList.toggleList(editor, 'UL', detail);
2076
+ });
2077
+ editor.addCommand('InsertOrderedList', function (ui, detail) {
2078
+ ToggleList.toggleList(editor, 'OL', detail);
2079
+ });
2080
+ editor.addCommand('InsertDefinitionList', function (ui, detail) {
2081
+ ToggleList.toggleList(editor, 'DL', detail);
2082
+ });
2083
+ editor.addCommand('RemoveList', function () {
2084
+ flattenListSelection(editor);
2085
+ });
2086
+ editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));
2087
+ editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL'));
2088
+ editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));
2089
+ };
2090
+ var Commands = { register: register };
906
2091
 
907
- var get = function (editor) {
908
- return {
909
- backspaceDelete: function (isForward) {
910
- $_b0poo3g9jm0ofzfi.backspaceDelete(editor, isForward);
911
- }
2092
+ var shouldIndentOnTab = function (editor) {
2093
+ return editor.getParam('lists_indent_on_tab', true);
912
2094
  };
913
- };
914
- var $_c4ki86g8jm0ofzfg = { get: get };
2095
+ var Settings = { shouldIndentOnTab: shouldIndentOnTab };
915
2096
 
916
- var DOM$5 = global$6.DOM;
917
- var mergeLists = function (from, to) {
918
- var node;
919
- if ($_74mztagkjm0ofzg7.isListNode(from)) {
920
- while (node = from.firstChild) {
921
- to.appendChild(node);
922
- }
923
- DOM$5.remove(from);
924
- }
925
- };
926
- var indent = function (li) {
927
- var sibling, newList, listStyle;
928
- if (li.nodeName === 'DT') {
929
- DOM$5.rename(li, 'DD');
930
- return true;
931
- }
932
- sibling = li.previousSibling;
933
- if (sibling && $_74mztagkjm0ofzg7.isListNode(sibling)) {
934
- sibling.appendChild(li);
935
- return true;
936
- }
937
- if (sibling && sibling.nodeName === 'LI' && $_74mztagkjm0ofzg7.isListNode(sibling.lastChild)) {
938
- sibling.lastChild.appendChild(li);
939
- mergeLists(li.lastChild, sibling.lastChild);
940
- return true;
941
- }
942
- sibling = li.nextSibling;
943
- if (sibling && $_74mztagkjm0ofzg7.isListNode(sibling)) {
944
- sibling.insertBefore(li, sibling.firstChild);
945
- return true;
946
- }
947
- sibling = li.previousSibling;
948
- if (sibling && sibling.nodeName === 'LI') {
949
- newList = DOM$5.create(li.parentNode.nodeName);
950
- listStyle = DOM$5.getStyle(li.parentNode, 'listStyleType');
951
- if (listStyle) {
952
- DOM$5.setStyle(newList, 'listStyleType', listStyle);
953
- }
954
- sibling.appendChild(newList);
955
- newList.appendChild(li);
956
- mergeLists(li.lastChild, newList);
957
- return true;
958
- }
959
- return false;
960
- };
961
- var indentSelection = function (editor) {
962
- var listElements = $_3e5hb9gmjm0ofzgc.getSelectedListItems(editor);
963
- if (listElements.length) {
964
- var bookmark = $_68j8lagijm0ofzg2.createBookmark(editor.selection.getRng(true));
965
- for (var i = 0; i < listElements.length; i++) {
966
- if (!indent(listElements[i]) && i === 0) {
967
- break;
968
- }
969
- }
970
- editor.selection.setRng($_68j8lagijm0ofzg2.resolveBookmark(bookmark));
971
- editor.nodeChanged();
972
- return true;
973
- }
974
- };
975
- var $_917p8bgsjm0ofzgo = { indentSelection: indentSelection };
976
-
977
- var queryListCommandState = function (editor, listName) {
978
- return function () {
979
- var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
980
- return parentList && parentList.nodeName === listName;
981
- };
982
- };
983
- var register = function (editor) {
984
- editor.on('BeforeExecCommand', function (e) {
985
- var cmd = e.command.toLowerCase();
986
- var isHandled;
987
- if (cmd === 'indent') {
988
- if ($_917p8bgsjm0ofzgo.indentSelection(editor)) {
989
- isHandled = true;
990
- }
991
- } else if (cmd === 'outdent') {
992
- if ($_40lbtggjm0ofzfy.outdentSelection(editor)) {
993
- isHandled = true;
2097
+ var setupTabKey = function (editor) {
2098
+ editor.on('keydown', function (e) {
2099
+ if (e.keyCode !== global$3.TAB || global$3.metaKeyPressed(e)) {
2100
+ return;
994
2101
  }
995
- }
996
- if (isHandled) {
997
- editor.fire('ExecCommand', { command: e.command });
998
- e.preventDefault();
999
- return true;
1000
- }
1001
- });
1002
- editor.addCommand('InsertUnorderedList', function (ui, detail) {
1003
- $_9gjx41gdjm0ofzfr.toggleList(editor, 'UL', detail);
1004
- });
1005
- editor.addCommand('InsertOrderedList', function (ui, detail) {
1006
- $_9gjx41gdjm0ofzfr.toggleList(editor, 'OL', detail);
1007
- });
1008
- editor.addCommand('InsertDefinitionList', function (ui, detail) {
1009
- $_9gjx41gdjm0ofzfr.toggleList(editor, 'DL', detail);
1010
- });
1011
- editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));
1012
- editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL'));
1013
- editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));
1014
- };
1015
- var $_hekmbgrjm0ofzgm = { register: register };
1016
-
1017
- var shouldIndentOnTab = function (editor) {
1018
- return editor.getParam('lists_indent_on_tab', true);
1019
- };
1020
- var $_2iimujgujm0ofzgs = { shouldIndentOnTab: shouldIndentOnTab };
1021
-
1022
- var setupTabKey = function (editor) {
1023
- editor.on('keydown', function (e) {
1024
- if (e.keyCode !== global$3.TAB || global$3.metaKeyPressed(e)) {
1025
- return;
1026
- }
1027
- if (editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD')) {
1028
- e.preventDefault();
1029
- if (e.shiftKey) {
1030
- $_40lbtggjm0ofzfy.outdentSelection(editor);
1031
- } else {
1032
- $_917p8bgsjm0ofzgo.indentSelection(editor);
2102
+ if (Selection.isList(editor)) {
2103
+ e.preventDefault();
2104
+ editor.undoManager.transact(function () {
2105
+ if (e.shiftKey) {
2106
+ outdentListSelection(editor);
2107
+ } else {
2108
+ indentListSelection(editor);
2109
+ }
2110
+ });
1033
2111
  }
2112
+ });
2113
+ };
2114
+ var setup$1 = function (editor) {
2115
+ if (Settings.shouldIndentOnTab(editor)) {
2116
+ setupTabKey(editor);
1034
2117
  }
1035
- });
1036
- };
1037
- var setup$1 = function (editor) {
1038
- if ($_2iimujgujm0ofzgs.shouldIndentOnTab(editor)) {
1039
- setupTabKey(editor);
1040
- }
1041
- $_b0poo3g9jm0ofzfi.setup(editor);
1042
- };
1043
- var $_9so6nrgtjm0ofzgq = { setup: setup$1 };
2118
+ Delete.setup(editor);
2119
+ };
2120
+ var Keyboard = { setup: setup$1 };
1044
2121
 
1045
- var findIndex = function (list, predicate) {
1046
- for (var index = 0; index < list.length; index++) {
1047
- var element = list[index];
1048
- if (predicate(element)) {
1049
- return index;
2122
+ var findIndex$2 = function (list, predicate) {
2123
+ for (var index = 0; index < list.length; index++) {
2124
+ var element = list[index];
2125
+ if (predicate(element)) {
2126
+ return index;
2127
+ }
1050
2128
  }
1051
- }
1052
- return -1;
1053
- };
1054
- var listState = function (editor, listName) {
1055
- return function (e) {
1056
- var ctrl = e.control;
1057
- editor.on('NodeChange', function (e) {
1058
- var tableCellIndex = findIndex(e.parents, $_74mztagkjm0ofzg7.isTableCellNode);
1059
- var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
1060
- var lists = global$5.grep(parents, $_74mztagkjm0ofzg7.isListNode);
1061
- ctrl.active(lists.length > 0 && lists[0].nodeName === listName);
1062
- });
2129
+ return -1;
1063
2130
  };
1064
- };
1065
- var indentPostRender = function (editor) {
1066
- return function (e) {
1067
- var ctrl = e.control;
1068
- editor.on('nodechange', function () {
1069
- var listItemBlocks = $_3e5hb9gmjm0ofzgc.getSelectedListItems(editor);
1070
- var disable = listItemBlocks.length > 0 && $_74mztagkjm0ofzg7.isFirstChild(listItemBlocks[0]);
1071
- ctrl.disabled(disable);
1072
- });
2131
+ var listState = function (editor, listName) {
2132
+ return function (e) {
2133
+ var ctrl = e.control;
2134
+ editor.on('NodeChange', function (e) {
2135
+ var tableCellIndex = findIndex$2(e.parents, NodeType.isTableCellNode);
2136
+ var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
2137
+ var lists = global$5.grep(parents, NodeType.isListNode);
2138
+ ctrl.active(lists.length > 0 && lists[0].nodeName === listName);
2139
+ });
2140
+ };
1073
2141
  };
1074
- };
1075
- var register$1 = function (editor) {
1076
- var hasPlugin = function (editor, plugin) {
1077
- var plugins = editor.settings.plugins ? editor.settings.plugins : '';
1078
- return global$5.inArray(plugins.split(/[ ,]/), plugin) !== -1;
1079
- };
1080
- if (!hasPlugin(editor, 'advlist')) {
1081
- editor.addButton('numlist', {
1082
- active: false,
1083
- title: 'Numbered list',
1084
- cmd: 'InsertOrderedList',
1085
- onPostRender: listState(editor, 'OL')
1086
- });
1087
- editor.addButton('bullist', {
1088
- active: false,
1089
- title: 'Bullet list',
1090
- cmd: 'InsertUnorderedList',
1091
- onPostRender: listState(editor, 'UL')
2142
+ var register$1 = function (editor) {
2143
+ var hasPlugin = function (editor, plugin) {
2144
+ var plugins = editor.settings.plugins ? editor.settings.plugins : '';
2145
+ return global$5.inArray(plugins.split(/[ ,]/), plugin) !== -1;
2146
+ };
2147
+ if (!hasPlugin(editor, 'advlist')) {
2148
+ editor.addButton('numlist', {
2149
+ active: false,
2150
+ title: 'Numbered list',
2151
+ cmd: 'InsertOrderedList',
2152
+ onPostRender: listState(editor, 'OL')
2153
+ });
2154
+ editor.addButton('bullist', {
2155
+ active: false,
2156
+ title: 'Bullet list',
2157
+ cmd: 'InsertUnorderedList',
2158
+ onPostRender: listState(editor, 'UL')
2159
+ });
2160
+ }
2161
+ editor.addButton('indent', {
2162
+ icon: 'indent',
2163
+ title: 'Increase indent',
2164
+ cmd: 'Indent'
1092
2165
  });
1093
- }
1094
- editor.addButton('indent', {
1095
- icon: 'indent',
1096
- title: 'Increase indent',
1097
- cmd: 'Indent',
1098
- onPostRender: indentPostRender(editor)
2166
+ };
2167
+ var Buttons = { register: register$1 };
2168
+
2169
+ global.add('lists', function (editor) {
2170
+ Keyboard.setup(editor);
2171
+ Buttons.register(editor);
2172
+ Commands.register(editor);
2173
+ return Api.get(editor);
1099
2174
  });
1100
- };
1101
- var $_cef9vxgvjm0ofzgt = { register: register$1 };
1102
-
1103
- global.add('lists', function (editor) {
1104
- $_9so6nrgtjm0ofzgq.setup(editor);
1105
- $_cef9vxgvjm0ofzgt.register(editor);
1106
- $_hekmbgrjm0ofzgm.register(editor);
1107
- return $_c4ki86g8jm0ofzfg.get(editor);
1108
- });
1109
- function Plugin () {
1110
- }
1111
-
1112
- return Plugin;
2175
+ function Plugin () {
2176
+ }
2177
+
2178
+ return Plugin;
1113
2179
 
1114
2180
  }());
1115
2181
  })();