scrivito_codemirror_editor 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +21 -165
  3. data/README.md +2 -2
  4. data/app/assets/javascripts/scrivito_codemirror_editor/codemirror_editor.js +29 -0
  5. data/lib/scrivito_codemirror_editor.rb +0 -2
  6. data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +203 -0
  7. data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +85 -0
  8. data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +157 -0
  9. data/vendor/assets/javascripts/codemirror/addons/display/autorefresh.js +47 -0
  10. data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +41 -0
  11. data/vendor/assets/javascripts/codemirror/addons/display/panel.js +112 -0
  12. data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +62 -0
  13. data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +51 -0
  14. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +195 -0
  15. data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +169 -0
  16. data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +51 -0
  17. data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +120 -0
  18. data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +66 -0
  19. data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +27 -0
  20. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +105 -0
  21. data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +59 -0
  22. data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +150 -0
  23. data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +146 -0
  24. data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +44 -0
  25. data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +49 -0
  26. data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +182 -0
  27. data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +41 -0
  28. data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +60 -0
  29. data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +348 -0
  30. data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +146 -0
  31. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +437 -0
  32. data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +271 -0
  33. data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +110 -0
  34. data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +41 -0
  35. data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +35 -0
  36. data/vendor/assets/javascripts/codemirror/addons/lint/html-lint.js +46 -0
  37. data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +136 -0
  38. data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +31 -0
  39. data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +239 -0
  40. data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +28 -0
  41. data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +773 -0
  42. data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +64 -0
  43. data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +123 -0
  44. data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +85 -0
  45. data/vendor/assets/javascripts/codemirror/addons/mode/simple.js +213 -0
  46. data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +40 -0
  47. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +157 -0
  48. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +72 -0
  49. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +179 -0
  50. data/vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js +118 -0
  51. data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +48 -0
  52. data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +152 -0
  53. data/vendor/assets/javascripts/codemirror/addons/search/jump-to-line.js +49 -0
  54. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +146 -0
  55. data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js +97 -0
  56. data/vendor/assets/javascripts/codemirror/addons/search/search.js +249 -0
  57. data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +189 -0
  58. data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +74 -0
  59. data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +118 -0
  60. data/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js +98 -0
  61. data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +701 -0
  62. data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +44 -0
  63. data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +144 -0
  64. data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +412 -0
  65. data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +580 -0
  66. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +5065 -0
  67. data/vendor/assets/javascripts/codemirror/modes/apl.js +174 -0
  68. data/vendor/assets/javascripts/codemirror/modes/asciiarmor.js +73 -0
  69. data/vendor/assets/javascripts/codemirror/modes/asn.1.js +204 -0
  70. data/vendor/assets/javascripts/codemirror/modes/asterisk.js +196 -0
  71. data/vendor/assets/javascripts/codemirror/modes/brainfuck.js +85 -0
  72. data/vendor/assets/javascripts/codemirror/modes/clike.js +786 -0
  73. data/vendor/assets/javascripts/codemirror/modes/clojure.js +306 -0
  74. data/vendor/assets/javascripts/codemirror/modes/cmake.js +97 -0
  75. data/vendor/assets/javascripts/codemirror/modes/cobol.js +255 -0
  76. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +355 -0
  77. data/vendor/assets/javascripts/codemirror/modes/commonlisp.js +123 -0
  78. data/vendor/assets/javascripts/codemirror/modes/crystal.js +391 -0
  79. data/vendor/assets/javascripts/codemirror/modes/css.js +825 -0
  80. data/vendor/assets/javascripts/codemirror/modes/cypher.js +146 -0
  81. data/vendor/assets/javascripts/codemirror/modes/d.js +218 -0
  82. data/vendor/assets/javascripts/codemirror/modes/dart.js +157 -0
  83. data/vendor/assets/javascripts/codemirror/modes/diff.js +47 -0
  84. data/vendor/assets/javascripts/codemirror/modes/django.js +356 -0
  85. data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +79 -0
  86. data/vendor/assets/javascripts/codemirror/modes/dtd.js +142 -0
  87. data/vendor/assets/javascripts/codemirror/modes/dylan.js +344 -0
  88. data/vendor/assets/javascripts/codemirror/modes/ebnf.js +195 -0
  89. data/vendor/assets/javascripts/codemirror/modes/ecl.js +206 -0
  90. data/vendor/assets/javascripts/codemirror/modes/eiffel.js +160 -0
  91. data/vendor/assets/javascripts/codemirror/modes/elm.js +205 -0
  92. data/vendor/assets/javascripts/codemirror/modes/erlang.js +618 -0
  93. data/vendor/assets/javascripts/codemirror/modes/factor.js +83 -0
  94. data/vendor/assets/javascripts/codemirror/modes/fcl.js +173 -0
  95. data/vendor/assets/javascripts/codemirror/modes/forth.js +180 -0
  96. data/vendor/assets/javascripts/codemirror/modes/fortran.js +188 -0
  97. data/vendor/assets/javascripts/codemirror/modes/gas.js +345 -0
  98. data/vendor/assets/javascripts/codemirror/modes/gfm.js +130 -0
  99. data/vendor/assets/javascripts/codemirror/modes/gherkin.js +178 -0
  100. data/vendor/assets/javascripts/codemirror/modes/go.js +185 -0
  101. data/vendor/assets/javascripts/codemirror/modes/groovy.js +230 -0
  102. data/vendor/assets/javascripts/codemirror/modes/haml.js +161 -0
  103. data/vendor/assets/javascripts/codemirror/modes/handlebars.js +62 -0
  104. data/vendor/assets/javascripts/codemirror/modes/haskell-literate.js +43 -0
  105. data/vendor/assets/javascripts/codemirror/modes/haskell.js +267 -0
  106. data/vendor/assets/javascripts/codemirror/modes/haxe.js +515 -0
  107. data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +28 -0
  108. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +152 -0
  109. data/vendor/assets/javascripts/codemirror/modes/http.js +113 -0
  110. data/vendor/assets/javascripts/codemirror/modes/idl.js +290 -0
  111. data/vendor/assets/javascripts/codemirror/modes/jade.js +590 -0
  112. data/vendor/assets/javascripts/codemirror/modes/javascript.js +748 -0
  113. data/vendor/assets/javascripts/codemirror/modes/jinja2.js +142 -0
  114. data/vendor/assets/javascripts/codemirror/modes/jsx.js +147 -0
  115. data/vendor/assets/javascripts/codemirror/modes/julia.js +392 -0
  116. data/vendor/assets/javascripts/codemirror/modes/livescript.js +280 -0
  117. data/vendor/assets/javascripts/codemirror/modes/lua.js +159 -0
  118. data/vendor/assets/javascripts/codemirror/modes/markdown.js +797 -0
  119. data/vendor/assets/javascripts/codemirror/modes/mathematica.js +176 -0
  120. data/vendor/assets/javascripts/codemirror/modes/mbox.js +129 -0
  121. data/vendor/assets/javascripts/codemirror/modes/mirc.js +193 -0
  122. data/vendor/assets/javascripts/codemirror/modes/mllike.js +205 -0
  123. data/vendor/assets/javascripts/codemirror/modes/modelica.js +245 -0
  124. data/vendor/assets/javascripts/codemirror/modes/mscgen.js +169 -0
  125. data/vendor/assets/javascripts/codemirror/modes/mumps.js +148 -0
  126. data/vendor/assets/javascripts/codemirror/modes/nginx.js +178 -0
  127. data/vendor/assets/javascripts/codemirror/modes/nsis.js +95 -0
  128. data/vendor/assets/javascripts/codemirror/modes/ntriples.js +186 -0
  129. data/vendor/assets/javascripts/codemirror/modes/octave.js +135 -0
  130. data/vendor/assets/javascripts/codemirror/modes/oz.js +252 -0
  131. data/vendor/assets/javascripts/codemirror/modes/pascal.js +109 -0
  132. data/vendor/assets/javascripts/codemirror/modes/pegjs.js +114 -0
  133. data/vendor/assets/javascripts/codemirror/modes/perl.js +837 -0
  134. data/vendor/assets/javascripts/codemirror/modes/php.js +234 -0
  135. data/vendor/assets/javascripts/codemirror/modes/pig.js +178 -0
  136. data/vendor/assets/javascripts/codemirror/modes/powershell.js +396 -0
  137. data/vendor/assets/javascripts/codemirror/modes/properties.js +78 -0
  138. data/vendor/assets/javascripts/codemirror/modes/protobuf.js +68 -0
  139. data/vendor/assets/javascripts/codemirror/modes/puppet.js +220 -0
  140. data/vendor/assets/javascripts/codemirror/modes/python.js +340 -0
  141. data/vendor/assets/javascripts/codemirror/modes/q.js +139 -0
  142. data/vendor/assets/javascripts/codemirror/modes/r.js +164 -0
  143. data/vendor/assets/javascripts/codemirror/modes/rpm.js +109 -0
  144. data/vendor/assets/javascripts/codemirror/modes/rst.js +557 -0
  145. data/vendor/assets/javascripts/codemirror/modes/ruby.js +285 -0
  146. data/vendor/assets/javascripts/codemirror/modes/rust.js +71 -0
  147. data/vendor/assets/javascripts/codemirror/modes/sas.js +315 -0
  148. data/vendor/assets/javascripts/codemirror/modes/sass.js +414 -0
  149. data/vendor/assets/javascripts/codemirror/modes/scheme.js +249 -0
  150. data/vendor/assets/javascripts/codemirror/modes/shell.js +139 -0
  151. data/vendor/assets/javascripts/codemirror/modes/sieve.js +193 -0
  152. data/vendor/assets/javascripts/codemirror/modes/slim.js +575 -0
  153. data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +168 -0
  154. data/vendor/assets/javascripts/codemirror/modes/smarty.js +225 -0
  155. data/vendor/assets/javascripts/codemirror/modes/solr.js +104 -0
  156. data/vendor/assets/javascripts/codemirror/modes/soy.js +199 -0
  157. data/vendor/assets/javascripts/codemirror/modes/sparql.js +180 -0
  158. data/vendor/assets/javascripts/codemirror/modes/spreadsheet.js +112 -0
  159. data/vendor/assets/javascripts/codemirror/modes/sql.js +413 -0
  160. data/vendor/assets/javascripts/codemirror/modes/stex.js +251 -0
  161. data/vendor/assets/javascripts/codemirror/modes/stylus.js +769 -0
  162. data/vendor/assets/javascripts/codemirror/modes/swift.js +202 -0
  163. data/vendor/assets/javascripts/codemirror/modes/tcl.js +139 -0
  164. data/vendor/assets/javascripts/codemirror/modes/textile.js +469 -0
  165. data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +308 -0
  166. data/vendor/assets/javascripts/codemirror/modes/tiki.js +312 -0
  167. data/vendor/assets/javascripts/codemirror/modes/toml.js +88 -0
  168. data/vendor/assets/javascripts/codemirror/modes/tornado.js +68 -0
  169. data/vendor/assets/javascripts/codemirror/modes/troff.js +84 -0
  170. data/vendor/assets/javascripts/codemirror/modes/ttcn-cfg.js +214 -0
  171. data/vendor/assets/javascripts/codemirror/modes/ttcn.js +283 -0
  172. data/vendor/assets/javascripts/codemirror/modes/turtle.js +162 -0
  173. data/vendor/assets/javascripts/codemirror/modes/twig.js +141 -0
  174. data/vendor/assets/javascripts/codemirror/modes/vb.js +276 -0
  175. data/vendor/assets/javascripts/codemirror/modes/vbscript.js +350 -0
  176. data/vendor/assets/javascripts/codemirror/modes/velocity.js +201 -0
  177. data/vendor/assets/javascripts/codemirror/modes/verilog.js +537 -0
  178. data/vendor/assets/javascripts/codemirror/modes/vhdl.js +189 -0
  179. data/vendor/assets/javascripts/codemirror/modes/vue.js +69 -0
  180. data/vendor/assets/javascripts/codemirror/modes/webidl.js +195 -0
  181. data/vendor/assets/javascripts/codemirror/modes/xml.js +394 -0
  182. data/vendor/assets/javascripts/codemirror/modes/xquery.js +437 -0
  183. data/vendor/assets/javascripts/codemirror/modes/yacas.js +204 -0
  184. data/vendor/assets/javascripts/codemirror/modes/yaml-frontmatter.js +68 -0
  185. data/vendor/assets/javascripts/codemirror/modes/yaml.js +117 -0
  186. data/vendor/assets/javascripts/codemirror/modes/z80.js +116 -0
  187. data/vendor/assets/javascripts/codemirror.js +8922 -0
  188. data/vendor/assets/stylesheets/codemirror/addons/dialog/dialog.css +32 -0
  189. data/vendor/assets/stylesheets/codemirror/addons/display/fullscreen.css +6 -0
  190. data/vendor/assets/stylesheets/codemirror/addons/fold/foldgutter.css +20 -0
  191. data/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css +37 -0
  192. data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +73 -0
  193. data/vendor/assets/stylesheets/codemirror/addons/merge/merge.css +113 -0
  194. data/vendor/assets/stylesheets/codemirror/addons/scroll/simplescrollbars.css +66 -0
  195. data/vendor/assets/stylesheets/codemirror/addons/search/matchesonscrollbar.css +8 -0
  196. data/vendor/assets/stylesheets/codemirror/addons/tern/tern.css +87 -0
  197. data/vendor/assets/stylesheets/codemirror/modes/tiddlywiki.css +14 -0
  198. data/vendor/assets/stylesheets/codemirror/modes/tiki.css +26 -0
  199. data/vendor/assets/stylesheets/codemirror/themes/3024-day.css +41 -0
  200. data/vendor/assets/stylesheets/codemirror/themes/3024-night.css +39 -0
  201. data/vendor/assets/stylesheets/codemirror/themes/abcdef.css +32 -0
  202. data/vendor/assets/stylesheets/codemirror/themes/ambiance-mobile.css +5 -0
  203. data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +74 -0
  204. data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +38 -0
  205. data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +38 -0
  206. data/vendor/assets/stylesheets/codemirror/themes/bespin.css +34 -0
  207. data/vendor/assets/stylesheets/codemirror/themes/blackboard.css +32 -0
  208. data/vendor/assets/stylesheets/codemirror/themes/cobalt.css +25 -0
  209. data/vendor/assets/stylesheets/codemirror/themes/colorforth.css +33 -0
  210. data/vendor/assets/stylesheets/codemirror/themes/dracula.css +41 -0
  211. data/vendor/assets/stylesheets/codemirror/themes/eclipse.css +23 -0
  212. data/vendor/assets/stylesheets/codemirror/themes/elegant.css +13 -0
  213. data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +34 -0
  214. data/vendor/assets/stylesheets/codemirror/themes/hopscotch.css +34 -0
  215. data/vendor/assets/stylesheets/codemirror/themes/icecoder.css +43 -0
  216. data/vendor/assets/stylesheets/codemirror/themes/isotope.css +34 -0
  217. data/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css +47 -0
  218. data/vendor/assets/stylesheets/codemirror/themes/liquibyte.css +95 -0
  219. data/vendor/assets/stylesheets/codemirror/themes/material.css +53 -0
  220. data/vendor/assets/stylesheets/codemirror/themes/mbo.css +37 -0
  221. data/vendor/assets/stylesheets/codemirror/themes/mdn-like.css +46 -0
  222. data/vendor/assets/stylesheets/codemirror/themes/midnight.css +45 -0
  223. data/vendor/assets/stylesheets/codemirror/themes/monokai.css +36 -0
  224. data/vendor/assets/stylesheets/codemirror/themes/neat.css +12 -0
  225. data/vendor/assets/stylesheets/codemirror/themes/neo.css +43 -0
  226. data/vendor/assets/stylesheets/codemirror/themes/night.css +27 -0
  227. data/vendor/assets/stylesheets/codemirror/themes/paraiso-dark.css +38 -0
  228. data/vendor/assets/stylesheets/codemirror/themes/paraiso-light.css +38 -0
  229. data/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css +53 -0
  230. data/vendor/assets/stylesheets/codemirror/themes/railscasts.css +34 -0
  231. data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +25 -0
  232. data/vendor/assets/stylesheets/codemirror/themes/seti.css +44 -0
  233. data/vendor/assets/stylesheets/codemirror/themes/solarized.css +169 -0
  234. data/vendor/assets/stylesheets/codemirror/themes/the-matrix.css +30 -0
  235. data/vendor/assets/stylesheets/codemirror/themes/tomorrow-night-bright.css +35 -0
  236. data/vendor/assets/stylesheets/codemirror/themes/tomorrow-night-eighties.css +38 -0
  237. data/vendor/assets/stylesheets/codemirror/themes/ttcn.css +64 -0
  238. data/vendor/assets/stylesheets/codemirror/themes/twilight.css +32 -0
  239. data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +34 -0
  240. data/vendor/assets/stylesheets/codemirror/themes/xq-dark.css +53 -0
  241. data/vendor/assets/stylesheets/codemirror/themes/xq-light.css +43 -0
  242. data/vendor/assets/stylesheets/codemirror/themes/yeti.css +44 -0
  243. data/vendor/assets/stylesheets/codemirror/themes/zenburn.css +37 -0
  244. data/vendor/assets/stylesheets/codemirror.css +347 -0
  245. metadata +244 -49
  246. data/app/assets/javascripts/scrivito_codemirror_editor/codemirror_editor.js.coffee +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a046908be1cc7c8c26538812f661154e427e3bfc
4
- data.tar.gz: a807a4c6514a3d0247c9013d58d0b6f772afd10e
2
+ SHA256:
3
+ metadata.gz: 59abc231fe16a0212eda848da2914a5b602ae0700b30ca1d84a566f0e606e809
4
+ data.tar.gz: 6c2631896c9d9fc726bed527f2ab10a17a63346533f1527c4a6401579aa3b9d0
5
5
  SHA512:
6
- metadata.gz: 5a3e84b8ed062310e77b94ec9d04082d1e3940926f2d8ea21c0a608d00dcdbfbc2b3ebadae225f2f5943d30358bf66d34e612b915c0e3b6a410e86c929897861
7
- data.tar.gz: 83b7a654343a0951a6ad11c98f113b496c47a1245b49ab6f77f23b75c8ff19d8a059c7fb8625e94c265b8179186e55b13a03afb40bf4f92b292b1f078a9cf1da
6
+ metadata.gz: cc06f4402fab50ff1d8e88a18687f847ae5aa3ea08591ce2be6ed69c52874c70475c478615f703bfce35cd199e6db085f23b9082c8d1dacf2e74584acf59ff5f
7
+ data.tar.gz: 1f52b6870666ebcdd1c0362854c2ca5d50cd95559f110ed0b30838e1c375bb7e13e7e2ae859b7da481c51d117a38f1d4a540407a4c604487c43cdf7521174c3b
data/LICENSE CHANGED
@@ -1,165 +1,21 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 JustRelate Group GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21
+ OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -38,12 +38,12 @@ gem 'scrivito_codemirror_editor'
38
38
  scrivito_tag :div, :my_widget, :my_html_attribute, {}, editor: :codemirror
39
39
  ```
40
40
 
41
- ### Enable CodeMirror for all HTML attributes on detail views
41
+ ### Enable CodeMirror for all HTML attributes on a details view
42
42
 
43
43
  ```
44
44
  scrivito.on "load", ->
45
45
  scrivito.select_editor (element, editing) ->
46
- if $(element).is(".scrivito_dialog [data-scrivito-field-type=html]")
46
+ if $(element).is(".my_details_view [data-scrivito-field-type=html]")
47
47
  editing.use("codemirror")
48
48
  ```
49
49
 
@@ -0,0 +1,29 @@
1
+ (function() {
2
+ var scrivito_codemirror_editor = {
3
+ can_edit: function(element) {
4
+ return $(element).is('[data-scrivito-field-type=html]');
5
+ },
6
+ activate: function(element) {
7
+ var cmsField = $(element);
8
+ var value = cmsField.scrivito('content');
9
+ cmsField.empty();
10
+ var options = $.extend({}, scrivito_codemirror_editor.default_options, scrivito_codemirror_editor.options, {
11
+ value: value
12
+ });
13
+ var editor = CodeMirror(element, options);
14
+ editor.on('change', function(instance) {
15
+ cmsField.scrivito('save', instance.getValue());
16
+ });
17
+ },
18
+ default_options: {
19
+ lineNumbers: true,
20
+ lineWrapping: true
21
+ },
22
+ options: {}
23
+ };
24
+
25
+ scrivito.on('load', function() {
26
+ scrivito.define_editor('codemirror', scrivito_codemirror_editor);
27
+ });
28
+
29
+ }).call(this);
@@ -1,5 +1,3 @@
1
- require 'codemirror-rails'
2
-
3
1
  module ScrivitoCodemirrorEditor
4
2
  class Engine < ::Rails::Engine
5
3
  end
@@ -0,0 +1,203 @@
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
+ var noOptions = {};
15
+ var nonWS = /[^\s\u00a0]/;
16
+ var Pos = CodeMirror.Pos;
17
+
18
+ function firstNonWS(str) {
19
+ var found = str.search(nonWS);
20
+ return found == -1 ? 0 : found;
21
+ }
22
+
23
+ CodeMirror.commands.toggleComment = function(cm) {
24
+ cm.toggleComment();
25
+ };
26
+
27
+ CodeMirror.defineExtension("toggleComment", function(options) {
28
+ if (!options) options = noOptions;
29
+ var cm = this;
30
+ var minLine = Infinity, ranges = this.listSelections(), mode = null;
31
+ for (var i = ranges.length - 1; i >= 0; i--) {
32
+ var from = ranges[i].from(), to = ranges[i].to();
33
+ if (from.line >= minLine) continue;
34
+ if (to.line >= minLine) to = Pos(minLine, 0);
35
+ minLine = from.line;
36
+ if (mode == null) {
37
+ if (cm.uncomment(from, to, options)) mode = "un";
38
+ else { cm.lineComment(from, to, options); mode = "line"; }
39
+ } else if (mode == "un") {
40
+ cm.uncomment(from, to, options);
41
+ } else {
42
+ cm.lineComment(from, to, options);
43
+ }
44
+ }
45
+ });
46
+
47
+ // Rough heuristic to try and detect lines that are part of multi-line string
48
+ function probablyInsideString(cm, pos, line) {
49
+ return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line)
50
+ }
51
+
52
+ CodeMirror.defineExtension("lineComment", function(from, to, options) {
53
+ if (!options) options = noOptions;
54
+ var self = this, mode = self.getModeAt(from);
55
+ var firstLine = self.getLine(from.line);
56
+ if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
57
+
58
+ var commentString = options.lineComment || mode.lineComment;
59
+ if (!commentString) {
60
+ if (options.blockCommentStart || mode.blockCommentStart) {
61
+ options.fullLines = true;
62
+ self.blockComment(from, to, options);
63
+ }
64
+ return;
65
+ }
66
+
67
+ var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
68
+ var pad = options.padding == null ? " " : options.padding;
69
+ var blankLines = options.commentBlankLines || from.line == to.line;
70
+
71
+ self.operation(function() {
72
+ if (options.indent) {
73
+ var baseString = null;
74
+ for (var i = from.line; i < end; ++i) {
75
+ var line = self.getLine(i);
76
+ var whitespace = line.slice(0, firstNonWS(line));
77
+ if (baseString == null || baseString.length > whitespace.length) {
78
+ baseString = whitespace;
79
+ }
80
+ }
81
+ for (var i = from.line; i < end; ++i) {
82
+ var line = self.getLine(i), cut = baseString.length;
83
+ if (!blankLines && !nonWS.test(line)) continue;
84
+ if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
85
+ self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
86
+ }
87
+ } else {
88
+ for (var i = from.line; i < end; ++i) {
89
+ if (blankLines || nonWS.test(self.getLine(i)))
90
+ self.replaceRange(commentString + pad, Pos(i, 0));
91
+ }
92
+ }
93
+ });
94
+ });
95
+
96
+ CodeMirror.defineExtension("blockComment", function(from, to, options) {
97
+ if (!options) options = noOptions;
98
+ var self = this, mode = self.getModeAt(from);
99
+ var startString = options.blockCommentStart || mode.blockCommentStart;
100
+ var endString = options.blockCommentEnd || mode.blockCommentEnd;
101
+ if (!startString || !endString) {
102
+ if ((options.lineComment || mode.lineComment) && options.fullLines != false)
103
+ self.lineComment(from, to, options);
104
+ return;
105
+ }
106
+
107
+ var end = Math.min(to.line, self.lastLine());
108
+ if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
109
+
110
+ var pad = options.padding == null ? " " : options.padding;
111
+ if (from.line > end) return;
112
+
113
+ self.operation(function() {
114
+ if (options.fullLines != false) {
115
+ var lastLineHasText = nonWS.test(self.getLine(end));
116
+ self.replaceRange(pad + endString, Pos(end));
117
+ self.replaceRange(startString + pad, Pos(from.line, 0));
118
+ var lead = options.blockCommentLead || mode.blockCommentLead;
119
+ if (lead != null) for (var i = from.line + 1; i <= end; ++i)
120
+ if (i != end || lastLineHasText)
121
+ self.replaceRange(lead + pad, Pos(i, 0));
122
+ } else {
123
+ self.replaceRange(endString, to);
124
+ self.replaceRange(startString, from);
125
+ }
126
+ });
127
+ });
128
+
129
+ CodeMirror.defineExtension("uncomment", function(from, to, options) {
130
+ if (!options) options = noOptions;
131
+ var self = this, mode = self.getModeAt(from);
132
+ var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
133
+
134
+ // Try finding line comments
135
+ var lineString = options.lineComment || mode.lineComment, lines = [];
136
+ var pad = options.padding == null ? " " : options.padding, didSomething;
137
+ lineComment: {
138
+ if (!lineString) break lineComment;
139
+ for (var i = start; i <= end; ++i) {
140
+ var line = self.getLine(i);
141
+ var found = line.indexOf(lineString);
142
+ if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
143
+ if (found == -1 && (i != end || i == start) && nonWS.test(line)) break lineComment;
144
+ if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
145
+ lines.push(line);
146
+ }
147
+ self.operation(function() {
148
+ for (var i = start; i <= end; ++i) {
149
+ var line = lines[i - start];
150
+ var pos = line.indexOf(lineString), endPos = pos + lineString.length;
151
+ if (pos < 0) continue;
152
+ if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
153
+ didSomething = true;
154
+ self.replaceRange("", Pos(i, pos), Pos(i, endPos));
155
+ }
156
+ });
157
+ if (didSomething) return true;
158
+ }
159
+
160
+ // Try block comments
161
+ var startString = options.blockCommentStart || mode.blockCommentStart;
162
+ var endString = options.blockCommentEnd || mode.blockCommentEnd;
163
+ if (!startString || !endString) return false;
164
+ var lead = options.blockCommentLead || mode.blockCommentLead;
165
+ var startLine = self.getLine(start), endLine = end == start ? startLine : self.getLine(end);
166
+ var open = startLine.indexOf(startString), close = endLine.lastIndexOf(endString);
167
+ if (close == -1 && start != end) {
168
+ endLine = self.getLine(--end);
169
+ close = endLine.lastIndexOf(endString);
170
+ }
171
+ if (open == -1 || close == -1 ||
172
+ !/comment/.test(self.getTokenTypeAt(Pos(start, open + 1))) ||
173
+ !/comment/.test(self.getTokenTypeAt(Pos(end, close + 1))))
174
+ return false;
175
+
176
+ // Avoid killing block comments completely outside the selection.
177
+ // Positions of the last startString before the start of the selection, and the first endString after it.
178
+ var lastStart = startLine.lastIndexOf(startString, from.ch);
179
+ var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
180
+ if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
181
+ // Positions of the first endString after the end of the selection, and the last startString before it.
182
+ firstEnd = endLine.indexOf(endString, to.ch);
183
+ var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
184
+ lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
185
+ if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
186
+
187
+ self.operation(function() {
188
+ self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
189
+ Pos(end, close + endString.length));
190
+ var openEnd = open + startString.length;
191
+ if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
192
+ self.replaceRange("", Pos(start, open), Pos(start, openEnd));
193
+ if (lead) for (var i = start + 1; i <= end; ++i) {
194
+ var line = self.getLine(i), found = line.indexOf(lead);
195
+ if (found == -1 || nonWS.test(line.slice(0, found))) continue;
196
+ var foundEnd = found + lead.length;
197
+ if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
198
+ self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
199
+ }
200
+ });
201
+ return true;
202
+ });
203
+ });
@@ -0,0 +1,85 @@
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
+ var modes = ["clike", "css", "javascript"];
13
+
14
+ for (var i = 0; i < modes.length; ++i)
15
+ CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "});
16
+
17
+ function continueComment(cm) {
18
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
19
+ var ranges = cm.listSelections(), mode, inserts = [];
20
+ for (var i = 0; i < ranges.length; i++) {
21
+ var pos = ranges[i].head, token = cm.getTokenAt(pos);
22
+ if (token.type != "comment") return CodeMirror.Pass;
23
+ var modeHere = CodeMirror.innerMode(cm.getMode(), token.state).mode;
24
+ if (!mode) mode = modeHere;
25
+ else if (mode != modeHere) return CodeMirror.Pass;
26
+
27
+ var insert = null;
28
+ if (mode.blockCommentStart && mode.blockCommentContinue) {
29
+ var end = token.string.indexOf(mode.blockCommentEnd);
30
+ var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found;
31
+ if (end != -1 && end == token.string.length - mode.blockCommentEnd.length && pos.ch >= end) {
32
+ // Comment ended, don't continue it
33
+ } else if (token.string.indexOf(mode.blockCommentStart) == 0) {
34
+ insert = full.slice(0, token.start);
35
+ if (!/^\s*$/.test(insert)) {
36
+ insert = "";
37
+ for (var j = 0; j < token.start; ++j) insert += " ";
38
+ }
39
+ } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 &&
40
+ found + mode.blockCommentContinue.length > token.start &&
41
+ /^\s*$/.test(full.slice(0, found))) {
42
+ insert = full.slice(0, found);
43
+ }
44
+ if (insert != null) insert += mode.blockCommentContinue;
45
+ }
46
+ if (insert == null && mode.lineComment && continueLineCommentEnabled(cm)) {
47
+ var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment);
48
+ if (found > -1) {
49
+ insert = line.slice(0, found);
50
+ if (/\S/.test(insert)) insert = null;
51
+ else insert += mode.lineComment + line.slice(found + mode.lineComment.length).match(/^\s*/)[0];
52
+ }
53
+ }
54
+ if (insert == null) return CodeMirror.Pass;
55
+ inserts[i] = "\n" + insert;
56
+ }
57
+
58
+ cm.operation(function() {
59
+ for (var i = ranges.length - 1; i >= 0; i--)
60
+ cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+insert");
61
+ });
62
+ }
63
+
64
+ function continueLineCommentEnabled(cm) {
65
+ var opt = cm.getOption("continueComments");
66
+ if (opt && typeof opt == "object")
67
+ return opt.continueLineComment !== false;
68
+ return true;
69
+ }
70
+
71
+ CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
72
+ if (prev && prev != CodeMirror.Init)
73
+ cm.removeKeyMap("continueComment");
74
+ if (val) {
75
+ var key = "Enter";
76
+ if (typeof val == "string")
77
+ key = val;
78
+ else if (typeof val == "object" && val.key)
79
+ key = val.key;
80
+ var map = {name: "continueComment"};
81
+ map[key] = continueComment;
82
+ cm.addKeyMap(map);
83
+ }
84
+ });
85
+ });