glebtv-ckeditor 4.5.10.3 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ckeditor/config.js.erb +1 -1
  3. data/lib/ckeditor.rb +1 -0
  4. data/lib/ckeditor/version.rb +2 -2
  5. data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +1 -1
  6. data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +1 -1
  7. data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +1 -1
  8. data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +1 -1
  9. data/vendor/assets/javascripts/ckeditor/LICENSE.md +2 -2
  10. data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +1 -1
  11. data/vendor/assets/javascripts/ckeditor/build-config.js +26 -26
  12. data/vendor/assets/javascripts/ckeditor/ckeditor.js +605 -576
  13. data/vendor/assets/javascripts/ckeditor/lang/en.js +2 -2
  14. data/vendor/assets/javascripts/ckeditor/lang/ru.js +2 -2
  15. data/vendor/assets/javascripts/ckeditor/plugins/CKCss/css/styles.css +9 -0
  16. data/vendor/assets/javascripts/ckeditor/plugins/CKCss/dialogs/ckcss.js +2 -1
  17. data/vendor/assets/javascripts/ckeditor/plugins/CKCss/plugin.js +3 -1
  18. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +6 -6
  19. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +3 -4
  20. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +4 -4
  21. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +4 -3
  22. data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +1 -1
  23. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/LICENSE.md +21 -0
  24. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.ckeditor.css +183 -0
  25. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.css +341 -0
  26. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
  27. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/comment/comment.js +206 -0
  28. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/comment/continuecomment.js +85 -0
  29. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.css +32 -0
  30. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.js +157 -0
  31. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closebrackets.js +202 -0
  32. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closetag.js +169 -0
  33. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js +51 -0
  34. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchbrackets.js +122 -0
  35. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchtags.js +66 -0
  36. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/trailingspace.js +27 -0
  37. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/brace-fold.js +105 -0
  38. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/comment-fold.js +59 -0
  39. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldcode.js +150 -0
  40. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldgutter.css +20 -0
  41. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldgutter.js +146 -0
  42. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/indent-fold.js +44 -0
  43. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/markdown-fold.js +49 -0
  44. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/xml-fold.js +182 -0
  45. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/autoFormatAll.js +43 -0
  46. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/formatting.js +226 -0
  47. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/anyword-hint.js +41 -0
  48. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/css-hint.js +60 -0
  49. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/html-hint.js +348 -0
  50. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/javascript-hint.js +155 -0
  51. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/show-hint.css +36 -0
  52. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/show-hint.js +438 -0
  53. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/sql-hint.js +271 -0
  54. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/xml-hint.js +110 -0
  55. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/loadmode.js +64 -0
  56. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/multiplex.js +123 -0
  57. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/multiplex_test.js +33 -0
  58. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/overlay.js +85 -0
  59. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/simple.js +213 -0
  60. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/jump-to-line.js +49 -0
  61. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/match-highlighter.js +165 -0
  62. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/matchesonscrollbar.css +8 -0
  63. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/matchesonscrollbar.js +97 -0
  64. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/search.js +252 -0
  65. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/searchcursor.js +189 -0
  66. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/active-line.js +74 -0
  67. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/mark-selection.js +118 -0
  68. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/selection-pointer.js +98 -0
  69. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify-html.js +952 -0
  70. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.js +2087 -0
  71. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +1 -1
  72. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
  73. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.js +9109 -0
  74. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -1
  75. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +1 -1
  76. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
  77. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +1 -1
  78. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcode/bbcode.js +137 -0
  79. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcode/index.html +73 -0
  80. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcodemixed/bbcodemixed.js +161 -0
  81. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcodemixed/index.html +128 -0
  82. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/clike.js +785 -0
  83. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/index.html +360 -0
  84. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/scala.html +767 -0
  85. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/test.js +55 -0
  86. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/css.js +825 -0
  87. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/gss.html +103 -0
  88. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/gss_test.js +17 -0
  89. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/index.html +75 -0
  90. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/less.html +152 -0
  91. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/less_test.js +54 -0
  92. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/scss.html +157 -0
  93. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/scss_test.js +110 -0
  94. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/test.js +200 -0
  95. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlembedded/htmlembedded.js +28 -0
  96. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlembedded/index.html +60 -0
  97. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlmixed/htmlmixed.js +152 -0
  98. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlmixed/index.html +89 -0
  99. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/index.html +114 -0
  100. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/javascript.js +784 -0
  101. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/json-ld.html +72 -0
  102. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/test.js +247 -0
  103. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/typescript.html +61 -0
  104. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/index.html +64 -0
  105. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/php.js +234 -0
  106. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/test.js +154 -0
  107. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/index.html +61 -0
  108. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/test.js +51 -0
  109. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/xml.js +394 -0
  110. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +30 -24
  111. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/dracula.css +1 -1
  112. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-dark.css +35 -0
  113. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-light.css +36 -0
  114. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +85 -0
  115. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +0 -1
  116. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +21 -15
  117. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.css +1 -1
  118. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +1 -1
  119. data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +1 -1
  120. data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +9 -9
  121. data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +12 -12
  122. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +1 -1
  123. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +1 -1
  124. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +1 -1
  125. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +1 -1
  126. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +1 -1
  127. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +11 -11
  128. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +1 -1
  129. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +1 -1
  130. data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  131. data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
  132. data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +1 -1
  133. data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +1 -1
  134. data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +28 -28
  135. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/LICENSE +0 -0
  136. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/README.md +0 -0
  137. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/LANG.js +3 -0
  138. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/en.js +0 -0
  139. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +3 -3
  140. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/plugin.js +1 -1
  141. data/vendor/assets/javascripts/ckeditor/plugins/lineheight/readme.txt +0 -0
  142. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +1 -1
  143. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +25 -23
  144. data/vendor/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
  145. data/vendor/assets/javascripts/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
  146. data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +1 -1
  147. data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/en.js +1 -1
  148. data/vendor/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +1 -1
  149. data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +2 -2
  150. data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +40 -29
  151. data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +19 -19
  152. data/vendor/assets/javascripts/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css +20 -0
  153. data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +1 -1
  154. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +2 -2
  155. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +1 -1
  156. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +1 -1
  157. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +1 -1
  158. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/assets/sample.css +70 -0
  159. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +85 -0
  160. data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +1 -1
  161. data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +1 -1
  162. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +1 -1
  163. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +1 -1
  164. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +2 -2
  165. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
  166. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
  167. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
  168. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/css/wordcount.css +0 -0
  169. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +1 -1
  170. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +1 -1
  171. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +60 -13
  172. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/samples/wordcount.html +61 -0
  173. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/samples/wordcountWithMaxCount.html +110 -0
  174. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +9 -9
  175. data/vendor/assets/javascripts/ckeditor/plugins/wsc/skins/moono-lisa/wsc.css +43 -0
  176. data/vendor/assets/javascripts/ckeditor/plugins/youtube/LICENSE.md +15 -0
  177. data/vendor/assets/javascripts/ckeditor/plugins/youtube/images/icon.png +0 -0
  178. data/vendor/assets/javascripts/ckeditor/plugins/youtube/lang/en.js +3 -1
  179. data/vendor/assets/javascripts/ckeditor/plugins/youtube/lang/ru.js +1 -0
  180. data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +448 -388
  181. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/icons16.png +0 -0
  182. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/icons16.svg +175 -0
  183. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/icons32.png +0 -0
  184. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/icons32.svg +167 -0
  185. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dev/locations.json +145 -0
  186. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog.css +5 -0
  187. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie.css +5 -0
  188. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie8.css +5 -0
  189. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_iequirks.css +5 -0
  190. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor.css +5 -0
  191. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_gecko.css +5 -0
  192. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie.css +5 -0
  193. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie8.css +5 -0
  194. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_iequirks.css +5 -0
  195. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/arrow.png +0 -0
  196. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/close.png +0 -0
  197. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/hidpi/close.png +0 -0
  198. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/hidpi/lock-open.png +0 -0
  199. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/hidpi/lock.png +0 -0
  200. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/hidpi/refresh.png +0 -0
  201. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/lock-open.png +0 -0
  202. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/lock.png +0 -0
  203. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/refresh.png +0 -0
  204. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/images/spinner.gif +0 -0
  205. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/readme.md +46 -0
  206. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/skin.js +7 -0
  207. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +1 -1
  208. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +1 -1
  209. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +1 -1
  210. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +1 -1
  211. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +1 -1
  212. data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +2 -2
  213. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +2 -2
  214. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +2 -2
  215. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +2 -2
  216. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +2 -2
  217. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +2 -2
  218. data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
  219. data/vendor/assets/javascripts/ckeditor/skins/moono/icons_hidpi.png +0 -0
  220. data/vendor/assets/javascripts/ckeditor/skins/moono/images/anchor.png +0 -0
  221. data/vendor/assets/javascripts/ckeditor/skins/moono/images/close.png +0 -0
  222. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
  223. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/close.png +0 -0
  224. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
  225. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
  226. data/vendor/assets/javascripts/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
  227. data/vendor/assets/javascripts/ckeditor/skins/moono/images/lock-open.png +0 -0
  228. data/vendor/assets/javascripts/ckeditor/skins/moono/images/lock.png +0 -0
  229. data/vendor/assets/javascripts/ckeditor/skins/moono/images/refresh.png +0 -0
  230. data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +3 -3
  231. data/vendor/assets/javascripts/ckeditor/styles.js +42 -16
  232. metadata +161 -105
  233. data/app/assets/javascripts/ckeditor/config_orig.js +0 -58
  234. data/vendor/assets/javascripts/ckeditor/README.md +0 -39
  235. data/vendor/assets/javascripts/ckeditor/config.js +0 -10
  236. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/af.js +0 -12
  237. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ar.js +0 -12
  238. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bg.js +0 -12
  239. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bn.js +0 -12
  240. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bs.js +0 -12
  241. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ca.js +0 -12
  242. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/cs.js +0 -12
  243. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/cy.js +0 -12
  244. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/da.js +0 -12
  245. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/de.js +0 -12
  246. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/el.js +0 -12
  247. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-au.js +0 -12
  248. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-ca.js +0 -12
  249. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-gb.js +0 -12
  250. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/eo.js +0 -12
  251. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/es.js +0 -12
  252. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/et.js +0 -12
  253. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/eu.js +0 -12
  254. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fa.js +0 -12
  255. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fi.js +0 -12
  256. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fo.js +0 -12
  257. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fr-ca.js +0 -12
  258. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fr.js +0 -12
  259. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/gl.js +0 -12
  260. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/gu.js +0 -12
  261. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/he.js +0 -12
  262. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hi.js +0 -12
  263. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hr.js +0 -12
  264. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hu.js +0 -12
  265. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/is.js +0 -12
  266. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/it.js +0 -12
  267. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ja.js +0 -12
  268. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ka.js +0 -12
  269. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/km.js +0 -12
  270. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ko.js +0 -12
  271. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ku.js +0 -12
  272. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/lt.js +0 -12
  273. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/lv.js +0 -12
  274. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/mk.js +0 -12
  275. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/mn.js +0 -12
  276. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ms.js +0 -12
  277. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/nb.js +0 -12
  278. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/nl.js +0 -12
  279. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/no.js +0 -12
  280. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pl.js +0 -12
  281. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pt-br.js +0 -12
  282. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pt.js +0 -12
  283. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ro.js +0 -12
  284. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sk.js +0 -12
  285. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sl.js +0 -12
  286. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sr-latn.js +0 -12
  287. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sr.js +0 -12
  288. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sv.js +0 -12
  289. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/th.js +0 -12
  290. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/tr.js +0 -12
  291. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ug.js +0 -12
  292. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/uk.js +0 -12
  293. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/vi.js +0 -12
  294. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/zh-cn.js +0 -12
  295. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/zh.js +0 -12
@@ -0,0 +1,89 @@
1
+ <!doctype html>
2
+
3
+ <title>CodeMirror: HTML mixed mode</title>
4
+ <meta charset="utf-8"/>
5
+ <link rel=stylesheet href="../../doc/docs.css">
6
+
7
+ <link rel="stylesheet" href="../../lib/codemirror.css">
8
+ <script src="../../lib/codemirror.js"></script>
9
+ <script src="../../addon/selection/selection-pointer.js"></script>
10
+ <script src="../xml/xml.js"></script>
11
+ <script src="../javascript/javascript.js"></script>
12
+ <script src="../css/css.js"></script>
13
+ <script src="../vbscript/vbscript.js"></script>
14
+ <script src="htmlmixed.js"></script>
15
+ <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
16
+ <div id=nav>
17
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
18
+
19
+ <ul>
20
+ <li><a href="../../index.html">Home</a>
21
+ <li><a href="../../doc/manual.html">Manual</a>
22
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
23
+ </ul>
24
+ <ul>
25
+ <li><a href="../index.html">Language modes</a>
26
+ <li><a class=active href="#">HTML mixed</a>
27
+ </ul>
28
+ </div>
29
+
30
+ <article>
31
+ <h2>HTML mixed mode</h2>
32
+ <form><textarea id="code" name="code">
33
+ <html style="color: green">
34
+ <!-- this is a comment -->
35
+ <head>
36
+ <title>Mixed HTML Example</title>
37
+ <style type="text/css">
38
+ h1 {font-family: comic sans; color: #f0f;}
39
+ div {background: yellow !important;}
40
+ body {
41
+ max-width: 50em;
42
+ margin: 1em 2em 1em 5em;
43
+ }
44
+ </style>
45
+ </head>
46
+ <body>
47
+ <h1>Mixed HTML Example</h1>
48
+ <script>
49
+ function jsFunc(arg1, arg2) {
50
+ if (arg1 && arg2) document.body.innerHTML = "achoo";
51
+ }
52
+ </script>
53
+ </body>
54
+ </html>
55
+ </textarea></form>
56
+ <script>
57
+ // Define an extended mixed-mode that understands vbscript and
58
+ // leaves mustache/handlebars embedded templates in html mode
59
+ var mixedMode = {
60
+ name: "htmlmixed",
61
+ scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
62
+ mode: null},
63
+ {matches: /(text|application)\/(x-)?vb(a|script)/i,
64
+ mode: "vbscript"}]
65
+ };
66
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
67
+ mode: mixedMode,
68
+ selectionPointer: true
69
+ });
70
+ </script>
71
+
72
+ <p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
73
+
74
+ <p>It takes an optional mode configuration
75
+ option, <code>scriptTypes</code>, which can be used to add custom
76
+ behavior for specific <code>&lt;script type="..."></code> tags. If
77
+ given, it should hold an array of <code>{matches, mode}</code>
78
+ objects, where <code>matches</code> is a string or regexp that
79
+ matches the script type, and <code>mode</code> is
80
+ either <code>null</code>, for script types that should stay in
81
+ HTML mode, or a <a href="../../doc/manual.html#option_mode">mode
82
+ spec</a> corresponding to the mode that should be used for the
83
+ script.</p>
84
+
85
+ <p><strong>MIME types defined:</strong> <code>text/html</code>
86
+ (redefined, only takes effect if you load this parser after the
87
+ XML parser).</p>
88
+
89
+ </article>
@@ -0,0 +1,114 @@
1
+ <!doctype html>
2
+
3
+ <title>CodeMirror: JavaScript mode</title>
4
+ <meta charset="utf-8"/>
5
+ <link rel=stylesheet href="../../doc/docs.css">
6
+
7
+ <link rel="stylesheet" href="../../lib/codemirror.css">
8
+ <script src="../../lib/codemirror.js"></script>
9
+ <script src="../../addon/edit/matchbrackets.js"></script>
10
+ <script src="../../addon/comment/continuecomment.js"></script>
11
+ <script src="../../addon/comment/comment.js"></script>
12
+ <script src="javascript.js"></script>
13
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
14
+ <div id=nav>
15
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
16
+
17
+ <ul>
18
+ <li><a href="../../index.html">Home</a>
19
+ <li><a href="../../doc/manual.html">Manual</a>
20
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
21
+ </ul>
22
+ <ul>
23
+ <li><a href="../index.html">Language modes</a>
24
+ <li><a class=active href="#">JavaScript</a>
25
+ </ul>
26
+ </div>
27
+
28
+ <article>
29
+ <h2>JavaScript mode</h2>
30
+
31
+
32
+ <div><textarea id="code" name="code">
33
+ // Demo code (the actual new parser character stream implementation)
34
+
35
+ function StringStream(string) {
36
+ this.pos = 0;
37
+ this.string = string;
38
+ }
39
+
40
+ StringStream.prototype = {
41
+ done: function() {return this.pos >= this.string.length;},
42
+ peek: function() {return this.string.charAt(this.pos);},
43
+ next: function() {
44
+ if (this.pos &lt; this.string.length)
45
+ return this.string.charAt(this.pos++);
46
+ },
47
+ eat: function(match) {
48
+ var ch = this.string.charAt(this.pos);
49
+ if (typeof match == "string") var ok = ch == match;
50
+ else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);
51
+ if (ok) {this.pos++; return ch;}
52
+ },
53
+ eatWhile: function(match) {
54
+ var start = this.pos;
55
+ while (this.eat(match));
56
+ if (this.pos > start) return this.string.slice(start, this.pos);
57
+ },
58
+ backUp: function(n) {this.pos -= n;},
59
+ column: function() {return this.pos;},
60
+ eatSpace: function() {
61
+ var start = this.pos;
62
+ while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
63
+ return this.pos - start;
64
+ },
65
+ match: function(pattern, consume, caseInsensitive) {
66
+ if (typeof pattern == "string") {
67
+ function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
68
+ if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
69
+ if (consume !== false) this.pos += str.length;
70
+ return true;
71
+ }
72
+ }
73
+ else {
74
+ var match = this.string.slice(this.pos).match(pattern);
75
+ if (match &amp;&amp; consume !== false) this.pos += match[0].length;
76
+ return match;
77
+ }
78
+ }
79
+ };
80
+ </textarea></div>
81
+
82
+ <script>
83
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
84
+ lineNumbers: true,
85
+ matchBrackets: true,
86
+ continueComments: "Enter",
87
+ extraKeys: {"Ctrl-Q": "toggleComment"}
88
+ });
89
+ </script>
90
+
91
+ <p>
92
+ JavaScript mode supports several configuration options:
93
+ <ul>
94
+ <li><code>json</code> which will set the mode to expect JSON
95
+ data rather than a JavaScript program.</li>
96
+ <li><code>jsonld</code> which will set the mode to expect
97
+ <a href="http://json-ld.org">JSON-LD</a> linked data rather
98
+ than a JavaScript program (<a href="json-ld.html">demo</a>).</li>
99
+ <li><code>typescript</code> which will activate additional
100
+ syntax highlighting and some other things for TypeScript code
101
+ (<a href="typescript.html">demo</a>).</li>
102
+ <li><code>statementIndent</code> which (given a number) will
103
+ determine the amount of indentation to use for statements
104
+ continued on a new line.</li>
105
+ <li><code>wordCharacters</code>, a regexp that indicates which
106
+ characters should be considered part of an identifier.
107
+ Defaults to <code>/[\w$]/</code>, which does not handle
108
+ non-ASCII identifiers. Can be set to something more elaborate
109
+ to improve Unicode support.</li>
110
+ </ul>
111
+ </p>
112
+
113
+ <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>, <code>application/ld+json</code>, <code>text/typescript</code>, <code>application/typescript</code>.</p>
114
+ </article>
@@ -0,0 +1,784 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ function expressionAllowed(stream, state, backUp) {
15
+ return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
16
+ (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
17
+ }
18
+
19
+ CodeMirror.defineMode("javascript", function(config, parserConfig) {
20
+ var indentUnit = config.indentUnit;
21
+ var statementIndent = parserConfig.statementIndent;
22
+ var jsonldMode = parserConfig.jsonld;
23
+ var jsonMode = parserConfig.json || jsonldMode;
24
+ var isTS = parserConfig.typescript;
25
+ var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
26
+
27
+ // Tokenizer
28
+
29
+ var keywords = function(){
30
+ function kw(type) {return {type: type, style: "keyword"};}
31
+ var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
32
+ var operator = kw("operator"), atom = {type: "atom", style: "atom"};
33
+
34
+ var jsKeywords = {
35
+ "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
36
+ "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
37
+ "var": kw("var"), "const": kw("var"), "let": kw("var"),
38
+ "function": kw("function"), "catch": kw("catch"),
39
+ "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
40
+ "in": operator, "typeof": operator, "instanceof": operator,
41
+ "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
42
+ "this": kw("this"), "class": kw("class"), "super": kw("atom"),
43
+ "yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
44
+ "await": C, "async": kw("async")
45
+ };
46
+
47
+ // Extend the 'normal' keywords with the TypeScript language extensions
48
+ if (isTS) {
49
+ var type = {type: "variable", style: "variable-3"};
50
+ var tsKeywords = {
51
+ // object-like things
52
+ "interface": kw("class"),
53
+ "implements": C,
54
+ "namespace": C,
55
+ "module": kw("module"),
56
+ "enum": kw("module"),
57
+ "type": kw("type"),
58
+
59
+ // scope modifiers
60
+ "public": kw("modifier"),
61
+ "private": kw("modifier"),
62
+ "protected": kw("modifier"),
63
+ "abstract": kw("modifier"),
64
+
65
+ // operators
66
+ "as": operator,
67
+
68
+ // types
69
+ "string": type, "number": type, "boolean": type, "any": type
70
+ };
71
+
72
+ for (var attr in tsKeywords) {
73
+ jsKeywords[attr] = tsKeywords[attr];
74
+ }
75
+ }
76
+
77
+ return jsKeywords;
78
+ }();
79
+
80
+ var isOperatorChar = /[+\-*&%=<>!?|~^]/;
81
+ var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
82
+
83
+ function readRegexp(stream) {
84
+ var escaped = false, next, inSet = false;
85
+ while ((next = stream.next()) != null) {
86
+ if (!escaped) {
87
+ if (next == "/" && !inSet) return;
88
+ if (next == "[") inSet = true;
89
+ else if (inSet && next == "]") inSet = false;
90
+ }
91
+ escaped = !escaped && next == "\\";
92
+ }
93
+ }
94
+
95
+ // Used as scratch variables to communicate multiple values without
96
+ // consing up tons of objects.
97
+ var type, content;
98
+ function ret(tp, style, cont) {
99
+ type = tp; content = cont;
100
+ return style;
101
+ }
102
+ function tokenBase(stream, state) {
103
+ var ch = stream.next();
104
+ if (ch == '"' || ch == "'") {
105
+ state.tokenize = tokenString(ch);
106
+ return state.tokenize(stream, state);
107
+ } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
108
+ return ret("number", "number");
109
+ } else if (ch == "." && stream.match("..")) {
110
+ return ret("spread", "meta");
111
+ } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
112
+ return ret(ch);
113
+ } else if (ch == "=" && stream.eat(">")) {
114
+ return ret("=>", "operator");
115
+ } else if (ch == "0" && stream.eat(/x/i)) {
116
+ stream.eatWhile(/[\da-f]/i);
117
+ return ret("number", "number");
118
+ } else if (ch == "0" && stream.eat(/o/i)) {
119
+ stream.eatWhile(/[0-7]/i);
120
+ return ret("number", "number");
121
+ } else if (ch == "0" && stream.eat(/b/i)) {
122
+ stream.eatWhile(/[01]/i);
123
+ return ret("number", "number");
124
+ } else if (/\d/.test(ch)) {
125
+ stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
126
+ return ret("number", "number");
127
+ } else if (ch == "/") {
128
+ if (stream.eat("*")) {
129
+ state.tokenize = tokenComment;
130
+ return tokenComment(stream, state);
131
+ } else if (stream.eat("/")) {
132
+ stream.skipToEnd();
133
+ return ret("comment", "comment");
134
+ } else if (expressionAllowed(stream, state, 1)) {
135
+ readRegexp(stream);
136
+ stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
137
+ return ret("regexp", "string-2");
138
+ } else {
139
+ stream.eatWhile(isOperatorChar);
140
+ return ret("operator", "operator", stream.current());
141
+ }
142
+ } else if (ch == "`") {
143
+ state.tokenize = tokenQuasi;
144
+ return tokenQuasi(stream, state);
145
+ } else if (ch == "#") {
146
+ stream.skipToEnd();
147
+ return ret("error", "error");
148
+ } else if (isOperatorChar.test(ch)) {
149
+ stream.eatWhile(isOperatorChar);
150
+ return ret("operator", "operator", stream.current());
151
+ } else if (wordRE.test(ch)) {
152
+ stream.eatWhile(wordRE);
153
+ var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
154
+ return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
155
+ ret("variable", "variable", word);
156
+ }
157
+ }
158
+
159
+ function tokenString(quote) {
160
+ return function(stream, state) {
161
+ var escaped = false, next;
162
+ if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
163
+ state.tokenize = tokenBase;
164
+ return ret("jsonld-keyword", "meta");
165
+ }
166
+ while ((next = stream.next()) != null) {
167
+ if (next == quote && !escaped) break;
168
+ escaped = !escaped && next == "\\";
169
+ }
170
+ if (!escaped) state.tokenize = tokenBase;
171
+ return ret("string", "string");
172
+ };
173
+ }
174
+
175
+ function tokenComment(stream, state) {
176
+ var maybeEnd = false, ch;
177
+ while (ch = stream.next()) {
178
+ if (ch == "/" && maybeEnd) {
179
+ state.tokenize = tokenBase;
180
+ break;
181
+ }
182
+ maybeEnd = (ch == "*");
183
+ }
184
+ return ret("comment", "comment");
185
+ }
186
+
187
+ function tokenQuasi(stream, state) {
188
+ var escaped = false, next;
189
+ while ((next = stream.next()) != null) {
190
+ if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
191
+ state.tokenize = tokenBase;
192
+ break;
193
+ }
194
+ escaped = !escaped && next == "\\";
195
+ }
196
+ return ret("quasi", "string-2", stream.current());
197
+ }
198
+
199
+ var brackets = "([{}])";
200
+ // This is a crude lookahead trick to try and notice that we're
201
+ // parsing the argument patterns for a fat-arrow function before we
202
+ // actually hit the arrow token. It only works if the arrow is on
203
+ // the same line as the arguments and there's no strange noise
204
+ // (comments) in between. Fallback is to only notice when we hit the
205
+ // arrow, and not declare the arguments as locals for the arrow
206
+ // body.
207
+ function findFatArrow(stream, state) {
208
+ if (state.fatArrowAt) state.fatArrowAt = null;
209
+ var arrow = stream.string.indexOf("=>", stream.start);
210
+ if (arrow < 0) return;
211
+
212
+ if (isTS) { // Try to skip TypeScript return type declarations after the arguments
213
+ var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
214
+ if (m) arrow = m.index
215
+ }
216
+
217
+ var depth = 0, sawSomething = false;
218
+ for (var pos = arrow - 1; pos >= 0; --pos) {
219
+ var ch = stream.string.charAt(pos);
220
+ var bracket = brackets.indexOf(ch);
221
+ if (bracket >= 0 && bracket < 3) {
222
+ if (!depth) { ++pos; break; }
223
+ if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
224
+ } else if (bracket >= 3 && bracket < 6) {
225
+ ++depth;
226
+ } else if (wordRE.test(ch)) {
227
+ sawSomething = true;
228
+ } else if (/["'\/]/.test(ch)) {
229
+ return;
230
+ } else if (sawSomething && !depth) {
231
+ ++pos;
232
+ break;
233
+ }
234
+ }
235
+ if (sawSomething && !depth) state.fatArrowAt = pos;
236
+ }
237
+
238
+ // Parser
239
+
240
+ var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
241
+
242
+ function JSLexical(indented, column, type, align, prev, info) {
243
+ this.indented = indented;
244
+ this.column = column;
245
+ this.type = type;
246
+ this.prev = prev;
247
+ this.info = info;
248
+ if (align != null) this.align = align;
249
+ }
250
+
251
+ function inScope(state, varname) {
252
+ for (var v = state.localVars; v; v = v.next)
253
+ if (v.name == varname) return true;
254
+ for (var cx = state.context; cx; cx = cx.prev) {
255
+ for (var v = cx.vars; v; v = v.next)
256
+ if (v.name == varname) return true;
257
+ }
258
+ }
259
+
260
+ function parseJS(state, style, type, content, stream) {
261
+ var cc = state.cc;
262
+ // Communicate our context to the combinators.
263
+ // (Less wasteful than consing up a hundred closures on every call.)
264
+ cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
265
+
266
+ if (!state.lexical.hasOwnProperty("align"))
267
+ state.lexical.align = true;
268
+
269
+ while(true) {
270
+ var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
271
+ if (combinator(type, content)) {
272
+ while(cc.length && cc[cc.length - 1].lex)
273
+ cc.pop()();
274
+ if (cx.marked) return cx.marked;
275
+ if (type == "variable" && inScope(state, content)) return "variable-2";
276
+ return style;
277
+ }
278
+ }
279
+ }
280
+
281
+ // Combinator utils
282
+
283
+ var cx = {state: null, column: null, marked: null, cc: null};
284
+ function pass() {
285
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
286
+ }
287
+ function cont() {
288
+ pass.apply(null, arguments);
289
+ return true;
290
+ }
291
+ function register(varname) {
292
+ function inList(list) {
293
+ for (var v = list; v; v = v.next)
294
+ if (v.name == varname) return true;
295
+ return false;
296
+ }
297
+ var state = cx.state;
298
+ cx.marked = "def";
299
+ if (state.context) {
300
+ if (inList(state.localVars)) return;
301
+ state.localVars = {name: varname, next: state.localVars};
302
+ } else {
303
+ if (inList(state.globalVars)) return;
304
+ if (parserConfig.globalVars)
305
+ state.globalVars = {name: varname, next: state.globalVars};
306
+ }
307
+ }
308
+
309
+ // Combinators
310
+
311
+ var defaultVars = {name: "this", next: {name: "arguments"}};
312
+ function pushcontext() {
313
+ cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
314
+ cx.state.localVars = defaultVars;
315
+ }
316
+ function popcontext() {
317
+ cx.state.localVars = cx.state.context.vars;
318
+ cx.state.context = cx.state.context.prev;
319
+ }
320
+ function pushlex(type, info) {
321
+ var result = function() {
322
+ var state = cx.state, indent = state.indented;
323
+ if (state.lexical.type == "stat") indent = state.lexical.indented;
324
+ else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
325
+ indent = outer.indented;
326
+ state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
327
+ };
328
+ result.lex = true;
329
+ return result;
330
+ }
331
+ function poplex() {
332
+ var state = cx.state;
333
+ if (state.lexical.prev) {
334
+ if (state.lexical.type == ")")
335
+ state.indented = state.lexical.indented;
336
+ state.lexical = state.lexical.prev;
337
+ }
338
+ }
339
+ poplex.lex = true;
340
+
341
+ function expect(wanted) {
342
+ function exp(type) {
343
+ if (type == wanted) return cont();
344
+ else if (wanted == ";") return pass();
345
+ else return cont(exp);
346
+ };
347
+ return exp;
348
+ }
349
+
350
+ function statement(type, value) {
351
+ if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
352
+ if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
353
+ if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
354
+ if (type == "{") return cont(pushlex("}"), block, poplex);
355
+ if (type == ";") return cont();
356
+ if (type == "if") {
357
+ if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
358
+ cx.state.cc.pop()();
359
+ return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
360
+ }
361
+ if (type == "function") return cont(functiondef);
362
+ if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
363
+ if (type == "variable") return cont(pushlex("stat"), maybelabel);
364
+ if (type == "switch") return cont(pushlex("form"), parenExpr, pushlex("}", "switch"), expect("{"),
365
+ block, poplex, poplex);
366
+ if (type == "case") return cont(expression, expect(":"));
367
+ if (type == "default") return cont(expect(":"));
368
+ if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
369
+ statement, poplex, popcontext);
370
+ if (type == "class") return cont(pushlex("form"), className, poplex);
371
+ if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
372
+ if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
373
+ if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
374
+ if (type == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
375
+ if (type == "async") return cont(statement)
376
+ return pass(pushlex("stat"), expression, expect(";"), poplex);
377
+ }
378
+ function expression(type) {
379
+ return expressionInner(type, false);
380
+ }
381
+ function expressionNoComma(type) {
382
+ return expressionInner(type, true);
383
+ }
384
+ function parenExpr(type) {
385
+ if (type != "(") return pass()
386
+ return cont(pushlex(")"), expression, expect(")"), poplex)
387
+ }
388
+ function expressionInner(type, noComma) {
389
+ if (cx.state.fatArrowAt == cx.stream.start) {
390
+ var body = noComma ? arrowBodyNoComma : arrowBody;
391
+ if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
392
+ else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
393
+ }
394
+
395
+ var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
396
+ if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
397
+ if (type == "function") return cont(functiondef, maybeop);
398
+ if (type == "class") return cont(pushlex("form"), classExpression, poplex);
399
+ if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
400
+ if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
401
+ if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
402
+ if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
403
+ if (type == "{") return contCommasep(objprop, "}", null, maybeop);
404
+ if (type == "quasi") return pass(quasi, maybeop);
405
+ if (type == "new") return cont(maybeTarget(noComma));
406
+ return cont();
407
+ }
408
+ function maybeexpression(type) {
409
+ if (type.match(/[;\}\)\],]/)) return pass();
410
+ return pass(expression);
411
+ }
412
+ function maybeexpressionNoComma(type) {
413
+ if (type.match(/[;\}\)\],]/)) return pass();
414
+ return pass(expressionNoComma);
415
+ }
416
+
417
+ function maybeoperatorComma(type, value) {
418
+ if (type == ",") return cont(expression);
419
+ return maybeoperatorNoComma(type, value, false);
420
+ }
421
+ function maybeoperatorNoComma(type, value, noComma) {
422
+ var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
423
+ var expr = noComma == false ? expression : expressionNoComma;
424
+ if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
425
+ if (type == "operator") {
426
+ if (/\+\+|--/.test(value)) return cont(me);
427
+ if (value == "?") return cont(expression, expect(":"), expr);
428
+ return cont(expr);
429
+ }
430
+ if (type == "quasi") { return pass(quasi, me); }
431
+ if (type == ";") return;
432
+ if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
433
+ if (type == ".") return cont(property, me);
434
+ if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
435
+ }
436
+ function quasi(type, value) {
437
+ if (type != "quasi") return pass();
438
+ if (value.slice(value.length - 2) != "${") return cont(quasi);
439
+ return cont(expression, continueQuasi);
440
+ }
441
+ function continueQuasi(type) {
442
+ if (type == "}") {
443
+ cx.marked = "string-2";
444
+ cx.state.tokenize = tokenQuasi;
445
+ return cont(quasi);
446
+ }
447
+ }
448
+ function arrowBody(type) {
449
+ findFatArrow(cx.stream, cx.state);
450
+ return pass(type == "{" ? statement : expression);
451
+ }
452
+ function arrowBodyNoComma(type) {
453
+ findFatArrow(cx.stream, cx.state);
454
+ return pass(type == "{" ? statement : expressionNoComma);
455
+ }
456
+ function maybeTarget(noComma) {
457
+ return function(type) {
458
+ if (type == ".") return cont(noComma ? targetNoComma : target);
459
+ else return pass(noComma ? expressionNoComma : expression);
460
+ };
461
+ }
462
+ function target(_, value) {
463
+ if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
464
+ }
465
+ function targetNoComma(_, value) {
466
+ if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
467
+ }
468
+ function maybelabel(type) {
469
+ if (type == ":") return cont(poplex, statement);
470
+ return pass(maybeoperatorComma, expect(";"), poplex);
471
+ }
472
+ function property(type) {
473
+ if (type == "variable") {cx.marked = "property"; return cont();}
474
+ }
475
+ function objprop(type, value) {
476
+ if (type == "async") {
477
+ cx.marked = "property";
478
+ return cont(objprop);
479
+ } else if (type == "variable" || cx.style == "keyword") {
480
+ cx.marked = "property";
481
+ if (value == "get" || value == "set") return cont(getterSetter);
482
+ return cont(afterprop);
483
+ } else if (type == "number" || type == "string") {
484
+ cx.marked = jsonldMode ? "property" : (cx.style + " property");
485
+ return cont(afterprop);
486
+ } else if (type == "jsonld-keyword") {
487
+ return cont(afterprop);
488
+ } else if (type == "modifier") {
489
+ return cont(objprop)
490
+ } else if (type == "[") {
491
+ return cont(expression, expect("]"), afterprop);
492
+ } else if (type == "spread") {
493
+ return cont(expression);
494
+ } else if (type == ":") {
495
+ return pass(afterprop)
496
+ }
497
+ }
498
+ function getterSetter(type) {
499
+ if (type != "variable") return pass(afterprop);
500
+ cx.marked = "property";
501
+ return cont(functiondef);
502
+ }
503
+ function afterprop(type) {
504
+ if (type == ":") return cont(expressionNoComma);
505
+ if (type == "(") return pass(functiondef);
506
+ }
507
+ function commasep(what, end) {
508
+ function proceed(type, value) {
509
+ if (type == ",") {
510
+ var lex = cx.state.lexical;
511
+ if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
512
+ return cont(function(type, value) {
513
+ if (type == end || value == end) return pass()
514
+ return pass(what)
515
+ }, proceed);
516
+ }
517
+ if (type == end || value == end) return cont();
518
+ return cont(expect(end));
519
+ }
520
+ return function(type, value) {
521
+ if (type == end || value == end) return cont();
522
+ return pass(what, proceed);
523
+ };
524
+ }
525
+ function contCommasep(what, end, info) {
526
+ for (var i = 3; i < arguments.length; i++)
527
+ cx.cc.push(arguments[i]);
528
+ return cont(pushlex(end, info), commasep(what, end), poplex);
529
+ }
530
+ function block(type) {
531
+ if (type == "}") return cont();
532
+ return pass(statement, block);
533
+ }
534
+ function maybetype(type, value) {
535
+ if (isTS) {
536
+ if (type == ":") return cont(typeexpr);
537
+ if (value == "?") return cont(maybetype);
538
+ }
539
+ }
540
+ function typeexpr(type) {
541
+ if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
542
+ if (type == "{") return cont(commasep(typeprop, "}"))
543
+ if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
544
+ }
545
+ function maybeReturnType(type) {
546
+ if (type == "=>") return cont(typeexpr)
547
+ }
548
+ function typeprop(type) {
549
+ if (type == "variable" || cx.style == "keyword") {
550
+ cx.marked = "property"
551
+ return cont(typeprop)
552
+ } else if (type == ":") {
553
+ return cont(typeexpr)
554
+ }
555
+ }
556
+ function typearg(type) {
557
+ if (type == "variable") return cont(typearg)
558
+ else if (type == ":") return cont(typeexpr)
559
+ }
560
+ function afterType(type, value) {
561
+ if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
562
+ if (type == "[") return cont(expect("]"), afterType)
563
+ }
564
+ function vardef() {
565
+ return pass(pattern, maybetype, maybeAssign, vardefCont);
566
+ }
567
+ function pattern(type, value) {
568
+ if (type == "modifier") return cont(pattern)
569
+ if (type == "variable") { register(value); return cont(); }
570
+ if (type == "spread") return cont(pattern);
571
+ if (type == "[") return contCommasep(pattern, "]");
572
+ if (type == "{") return contCommasep(proppattern, "}");
573
+ }
574
+ function proppattern(type, value) {
575
+ if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
576
+ register(value);
577
+ return cont(maybeAssign);
578
+ }
579
+ if (type == "variable") cx.marked = "property";
580
+ if (type == "spread") return cont(pattern);
581
+ if (type == "}") return pass();
582
+ return cont(expect(":"), pattern, maybeAssign);
583
+ }
584
+ function maybeAssign(_type, value) {
585
+ if (value == "=") return cont(expressionNoComma);
586
+ }
587
+ function vardefCont(type) {
588
+ if (type == ",") return cont(vardef);
589
+ }
590
+ function maybeelse(type, value) {
591
+ if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
592
+ }
593
+ function forspec(type) {
594
+ if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
595
+ }
596
+ function forspec1(type) {
597
+ if (type == "var") return cont(vardef, expect(";"), forspec2);
598
+ if (type == ";") return cont(forspec2);
599
+ if (type == "variable") return cont(formaybeinof);
600
+ return pass(expression, expect(";"), forspec2);
601
+ }
602
+ function formaybeinof(_type, value) {
603
+ if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
604
+ return cont(maybeoperatorComma, forspec2);
605
+ }
606
+ function forspec2(type, value) {
607
+ if (type == ";") return cont(forspec3);
608
+ if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
609
+ return pass(expression, expect(";"), forspec3);
610
+ }
611
+ function forspec3(type) {
612
+ if (type != ")") cont(expression);
613
+ }
614
+ function functiondef(type, value) {
615
+ if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
616
+ if (type == "variable") {register(value); return cont(functiondef);}
617
+ if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
618
+ }
619
+ function funarg(type) {
620
+ if (type == "spread") return cont(funarg);
621
+ return pass(pattern, maybetype, maybeAssign);
622
+ }
623
+ function classExpression(type, value) {
624
+ // Class expressions may have an optional name.
625
+ if (type == "variable") return className(type, value);
626
+ return classNameAfter(type, value);
627
+ }
628
+ function className(type, value) {
629
+ if (type == "variable") {register(value); return cont(classNameAfter);}
630
+ }
631
+ function classNameAfter(type, value) {
632
+ if (value == "extends" || value == "implements") return cont(isTS ? typeexpr : expression, classNameAfter);
633
+ if (type == "{") return cont(pushlex("}"), classBody, poplex);
634
+ }
635
+ function classBody(type, value) {
636
+ if (type == "variable" || cx.style == "keyword") {
637
+ if ((value == "static" || value == "get" || value == "set" ||
638
+ (isTS && (value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract"))) &&
639
+ cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false)) {
640
+ cx.marked = "keyword";
641
+ return cont(classBody);
642
+ }
643
+ cx.marked = "property";
644
+ return cont(isTS ? classfield : functiondef, classBody);
645
+ }
646
+ if (value == "*") {
647
+ cx.marked = "keyword";
648
+ return cont(classBody);
649
+ }
650
+ if (type == ";") return cont(classBody);
651
+ if (type == "}") return cont();
652
+ }
653
+ function classfield(type, value) {
654
+ if (value == "?") return cont(classfield)
655
+ if (type == ":") return cont(typeexpr, maybeAssign)
656
+ return pass(functiondef)
657
+ }
658
+ function afterExport(_type, value) {
659
+ if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
660
+ if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
661
+ return pass(statement);
662
+ }
663
+ function afterImport(type) {
664
+ if (type == "string") return cont();
665
+ return pass(importSpec, maybeFrom);
666
+ }
667
+ function importSpec(type, value) {
668
+ if (type == "{") return contCommasep(importSpec, "}");
669
+ if (type == "variable") register(value);
670
+ if (value == "*") cx.marked = "keyword";
671
+ return cont(maybeAs);
672
+ }
673
+ function maybeAs(_type, value) {
674
+ if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
675
+ }
676
+ function maybeFrom(_type, value) {
677
+ if (value == "from") { cx.marked = "keyword"; return cont(expression); }
678
+ }
679
+ function arrayLiteral(type) {
680
+ if (type == "]") return cont();
681
+ return pass(commasep(expressionNoComma, "]"));
682
+ }
683
+
684
+ function isContinuedStatement(state, textAfter) {
685
+ return state.lastType == "operator" || state.lastType == "," ||
686
+ isOperatorChar.test(textAfter.charAt(0)) ||
687
+ /[,.]/.test(textAfter.charAt(0));
688
+ }
689
+
690
+ // Interface
691
+
692
+ return {
693
+ startState: function(basecolumn) {
694
+ var state = {
695
+ tokenize: tokenBase,
696
+ lastType: "sof",
697
+ cc: [],
698
+ lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
699
+ localVars: parserConfig.localVars,
700
+ context: parserConfig.localVars && {vars: parserConfig.localVars},
701
+ indented: basecolumn || 0
702
+ };
703
+ if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
704
+ state.globalVars = parserConfig.globalVars;
705
+ return state;
706
+ },
707
+
708
+ token: function(stream, state) {
709
+ if (stream.sol()) {
710
+ if (!state.lexical.hasOwnProperty("align"))
711
+ state.lexical.align = false;
712
+ state.indented = stream.indentation();
713
+ findFatArrow(stream, state);
714
+ }
715
+ if (state.tokenize != tokenComment && stream.eatSpace()) return null;
716
+ var style = state.tokenize(stream, state);
717
+ if (type == "comment") return style;
718
+ state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
719
+ return parseJS(state, style, type, content, stream);
720
+ },
721
+
722
+ indent: function(state, textAfter) {
723
+ if (state.tokenize == tokenComment) return CodeMirror.Pass;
724
+ if (state.tokenize != tokenBase) return 0;
725
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
726
+ // Kludge to prevent 'maybelse' from blocking lexical scope pops
727
+ if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
728
+ var c = state.cc[i];
729
+ if (c == poplex) lexical = lexical.prev;
730
+ else if (c != maybeelse) break;
731
+ }
732
+ while ((lexical.type == "stat" || lexical.type == "form") &&
733
+ (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
734
+ (top == maybeoperatorComma || top == maybeoperatorNoComma) &&
735
+ !/^[,\.=+\-*:?[\(]/.test(textAfter))))
736
+ lexical = lexical.prev;
737
+ if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
738
+ lexical = lexical.prev;
739
+ var type = lexical.type, closing = firstChar == type;
740
+
741
+ if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
742
+ else if (type == "form" && firstChar == "{") return lexical.indented;
743
+ else if (type == "form") return lexical.indented + indentUnit;
744
+ else if (type == "stat")
745
+ return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
746
+ else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
747
+ return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
748
+ else if (lexical.align) return lexical.column + (closing ? 0 : 1);
749
+ else return lexical.indented + (closing ? 0 : indentUnit);
750
+ },
751
+
752
+ electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
753
+ blockCommentStart: jsonMode ? null : "/*",
754
+ blockCommentEnd: jsonMode ? null : "*/",
755
+ lineComment: jsonMode ? null : "//",
756
+ fold: "brace",
757
+ closeBrackets: "()[]{}''\"\"``",
758
+
759
+ helperType: jsonMode ? "json" : "javascript",
760
+ jsonldMode: jsonldMode,
761
+ jsonMode: jsonMode,
762
+
763
+ expressionAllowed: expressionAllowed,
764
+ skipExpression: function(state) {
765
+ var top = state.cc[state.cc.length - 1]
766
+ if (top == expression || top == expressionNoComma) state.cc.pop()
767
+ }
768
+ };
769
+ });
770
+
771
+ CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
772
+
773
+ CodeMirror.defineMIME("text/javascript", "javascript");
774
+ CodeMirror.defineMIME("text/ecmascript", "javascript");
775
+ CodeMirror.defineMIME("application/javascript", "javascript");
776
+ CodeMirror.defineMIME("application/x-javascript", "javascript");
777
+ CodeMirror.defineMIME("application/ecmascript", "javascript");
778
+ CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
779
+ CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
780
+ CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
781
+ CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
782
+ CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
783
+
784
+ });