@muze-nl/simplystore 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/package.json +2 -2
  2. package/package.json~ +33 -0
  3. package/src/server.mjs +68 -61
  4. package/www/codemirror/addon/comment/comment.js +0 -211
  5. package/www/codemirror/addon/comment/continuecomment.js +0 -114
  6. package/www/codemirror/addon/dialog/dialog.css +0 -32
  7. package/www/codemirror/addon/dialog/dialog.js +0 -163
  8. package/www/codemirror/addon/display/autorefresh.js +0 -47
  9. package/www/codemirror/addon/display/fullscreen.css +0 -6
  10. package/www/codemirror/addon/display/fullscreen.js +0 -41
  11. package/www/codemirror/addon/display/panel.js +0 -133
  12. package/www/codemirror/addon/display/placeholder.js +0 -78
  13. package/www/codemirror/addon/display/rulers.js +0 -51
  14. package/www/codemirror/addon/edit/closebrackets.js +0 -201
  15. package/www/codemirror/addon/edit/closetag.js +0 -185
  16. package/www/codemirror/addon/edit/continuelist.js +0 -101
  17. package/www/codemirror/addon/edit/matchbrackets.js +0 -160
  18. package/www/codemirror/addon/edit/matchtags.js +0 -66
  19. package/www/codemirror/addon/edit/trailingspace.js +0 -27
  20. package/www/codemirror/addon/fold/brace-fold.js +0 -119
  21. package/www/codemirror/addon/fold/comment-fold.js +0 -59
  22. package/www/codemirror/addon/fold/foldcode.js +0 -159
  23. package/www/codemirror/addon/fold/foldgutter.css +0 -20
  24. package/www/codemirror/addon/fold/foldgutter.js +0 -169
  25. package/www/codemirror/addon/fold/indent-fold.js +0 -48
  26. package/www/codemirror/addon/fold/markdown-fold.js +0 -49
  27. package/www/codemirror/addon/fold/xml-fold.js +0 -184
  28. package/www/codemirror/addon/hint/anyword-hint.js +0 -41
  29. package/www/codemirror/addon/hint/css-hint.js +0 -66
  30. package/www/codemirror/addon/hint/html-hint.js +0 -351
  31. package/www/codemirror/addon/hint/javascript-hint.js +0 -162
  32. package/www/codemirror/addon/hint/show-hint.css +0 -37
  33. package/www/codemirror/addon/hint/show-hint.js +0 -523
  34. package/www/codemirror/addon/hint/sql-hint.js +0 -304
  35. package/www/codemirror/addon/hint/xml-hint.js +0 -132
  36. package/www/codemirror/addon/lint/coffeescript-lint.js +0 -47
  37. package/www/codemirror/addon/lint/css-lint.js +0 -40
  38. package/www/codemirror/addon/lint/html-lint.js +0 -59
  39. package/www/codemirror/addon/lint/json-lint.js +0 -40
  40. package/www/codemirror/addon/lint/yaml-lint.js +0 -41
  41. package/www/codemirror/addon/merge/merge.css +0 -119
  42. package/www/codemirror/addon/merge/merge.js +0 -1018
  43. package/www/codemirror/addon/mode/loadmode.js +0 -66
  44. package/www/codemirror/addon/mode/multiplex.js +0 -136
  45. package/www/codemirror/addon/mode/multiplex_test.js +0 -49
  46. package/www/codemirror/addon/mode/overlay.js +0 -90
  47. package/www/codemirror/addon/mode/simple.js +0 -216
  48. package/www/codemirror/addon/runmode/colorize.js +0 -40
  49. package/www/codemirror/addon/runmode/runmode-standalone.js +0 -334
  50. package/www/codemirror/addon/runmode/runmode.js +0 -76
  51. package/www/codemirror/addon/runmode/runmode.node.js +0 -329
  52. package/www/codemirror/addon/scroll/annotatescrollbar.js +0 -128
  53. package/www/codemirror/addon/scroll/scrollpastend.js +0 -48
  54. package/www/codemirror/addon/scroll/simplescrollbars.css +0 -66
  55. package/www/codemirror/addon/scroll/simplescrollbars.js +0 -152
  56. package/www/codemirror/addon/search/jump-to-line.js +0 -53
  57. package/www/codemirror/addon/search/match-highlighter.js +0 -167
  58. package/www/codemirror/addon/search/matchesonscrollbar.css +0 -8
  59. package/www/codemirror/addon/search/matchesonscrollbar.js +0 -97
  60. package/www/codemirror/addon/search/search.js +0 -295
  61. package/www/codemirror/addon/search/searchcursor.js +0 -305
  62. package/www/codemirror/addon/selection/active-line.js +0 -72
  63. package/www/codemirror/addon/selection/mark-selection.js +0 -119
  64. package/www/codemirror/addon/selection/selection-pointer.js +0 -98
  65. package/www/codemirror/addon/tern/tern.css +0 -87
  66. package/www/codemirror/addon/tern/tern.js +0 -756
  67. package/www/codemirror/addon/tern/worker.js +0 -44
  68. package/www/codemirror/addon/wrap/hardwrap.js +0 -160
  69. package/www/codemirror/bin/source-highlight +0 -48
  70. package/www/codemirror/keymap/emacs.js +0 -545
  71. package/www/codemirror/keymap/sublime.js +0 -720
  72. package/www/codemirror/keymap/vim.js +0 -5978
  73. package/www/codemirror/mode/apl/apl.js +0 -174
  74. package/www/codemirror/mode/asciiarmor/asciiarmor.js +0 -74
  75. package/www/codemirror/mode/asn.1/asn.1.js +0 -204
  76. package/www/codemirror/mode/asterisk/asterisk.js +0 -220
  77. package/www/codemirror/mode/brainfuck/brainfuck.js +0 -85
  78. package/www/codemirror/mode/clike/clike.js +0 -940
  79. package/www/codemirror/mode/clojure/clojure.js +0 -292
  80. package/www/codemirror/mode/cmake/cmake.js +0 -97
  81. package/www/codemirror/mode/cobol/cobol.js +0 -255
  82. package/www/codemirror/mode/coffeescript/coffeescript.js +0 -359
  83. package/www/codemirror/mode/commonlisp/commonlisp.js +0 -125
  84. package/www/codemirror/mode/crystal/crystal.js +0 -433
  85. package/www/codemirror/mode/css/css.js +0 -862
  86. package/www/codemirror/mode/cypher/cypher.js +0 -152
  87. package/www/codemirror/mode/d/d.js +0 -223
  88. package/www/codemirror/mode/dart/dart.js +0 -166
  89. package/www/codemirror/mode/diff/diff.js +0 -47
  90. package/www/codemirror/mode/django/django.js +0 -356
  91. package/www/codemirror/mode/dockerfile/dockerfile.js +0 -211
  92. package/www/codemirror/mode/dtd/dtd.js +0 -142
  93. package/www/codemirror/mode/dylan/dylan.js +0 -352
  94. package/www/codemirror/mode/ebnf/ebnf.js +0 -195
  95. package/www/codemirror/mode/ecl/ecl.js +0 -206
  96. package/www/codemirror/mode/eiffel/eiffel.js +0 -160
  97. package/www/codemirror/mode/elm/elm.js +0 -245
  98. package/www/codemirror/mode/erlang/erlang.js +0 -619
  99. package/www/codemirror/mode/factor/factor.js +0 -85
  100. package/www/codemirror/mode/fcl/fcl.js +0 -173
  101. package/www/codemirror/mode/forth/forth.js +0 -180
  102. package/www/codemirror/mode/fortran/fortran.js +0 -188
  103. package/www/codemirror/mode/gas/gas.js +0 -353
  104. package/www/codemirror/mode/gfm/gfm.js +0 -129
  105. package/www/codemirror/mode/gherkin/gherkin.js +0 -178
  106. package/www/codemirror/mode/go/go.js +0 -187
  107. package/www/codemirror/mode/groovy/groovy.js +0 -247
  108. package/www/codemirror/mode/haml/haml.js +0 -161
  109. package/www/codemirror/mode/handlebars/handlebars.js +0 -70
  110. package/www/codemirror/mode/haskell/haskell.js +0 -268
  111. package/www/codemirror/mode/haskell-literate/haskell-literate.js +0 -43
  112. package/www/codemirror/mode/haxe/haxe.js +0 -515
  113. package/www/codemirror/mode/htmlembedded/htmlembedded.js +0 -37
  114. package/www/codemirror/mode/htmlmixed/htmlmixed.js +0 -153
  115. package/www/codemirror/mode/http/http.js +0 -113
  116. package/www/codemirror/mode/idl/idl.js +0 -290
  117. package/www/codemirror/mode/jinja2/jinja2.js +0 -193
  118. package/www/codemirror/mode/jsx/jsx.js +0 -148
  119. package/www/codemirror/mode/julia/julia.js +0 -390
  120. package/www/codemirror/mode/livescript/livescript.js +0 -280
  121. package/www/codemirror/mode/lua/lua.js +0 -160
  122. package/www/codemirror/mode/markdown/markdown.js +0 -886
  123. package/www/codemirror/mode/mathematica/mathematica.js +0 -176
  124. package/www/codemirror/mode/mbox/mbox.js +0 -129
  125. package/www/codemirror/mode/meta.js +0 -221
  126. package/www/codemirror/mode/mirc/mirc.js +0 -193
  127. package/www/codemirror/mode/mllike/mllike.js +0 -359
  128. package/www/codemirror/mode/modelica/modelica.js +0 -245
  129. package/www/codemirror/mode/mscgen/mscgen.js +0 -175
  130. package/www/codemirror/mode/mumps/mumps.js +0 -148
  131. package/www/codemirror/mode/nginx/nginx.js +0 -178
  132. package/www/codemirror/mode/nsis/nsis.js +0 -95
  133. package/www/codemirror/mode/ntriples/ntriples.js +0 -195
  134. package/www/codemirror/mode/octave/octave.js +0 -139
  135. package/www/codemirror/mode/oz/oz.js +0 -252
  136. package/www/codemirror/mode/pascal/pascal.js +0 -136
  137. package/www/codemirror/mode/pegjs/pegjs.js +0 -111
  138. package/www/codemirror/mode/perl/perl.js +0 -836
  139. package/www/codemirror/mode/php/php.js +0 -234
  140. package/www/codemirror/mode/pig/pig.js +0 -178
  141. package/www/codemirror/mode/powershell/powershell.js +0 -398
  142. package/www/codemirror/mode/properties/properties.js +0 -78
  143. package/www/codemirror/mode/protobuf/protobuf.js +0 -72
  144. package/www/codemirror/mode/pug/pug.js +0 -591
  145. package/www/codemirror/mode/puppet/puppet.js +0 -220
  146. package/www/codemirror/mode/python/python.js +0 -402
  147. package/www/codemirror/mode/q/q.js +0 -139
  148. package/www/codemirror/mode/r/r.js +0 -190
  149. package/www/codemirror/mode/rpm/changes/index.html +0 -66
  150. package/www/codemirror/mode/rpm/rpm.js +0 -109
  151. package/www/codemirror/mode/rst/rst.js +0 -557
  152. package/www/codemirror/mode/ruby/ruby.js +0 -303
  153. package/www/codemirror/mode/rust/rust.js +0 -72
  154. package/www/codemirror/mode/sas/sas.js +0 -303
  155. package/www/codemirror/mode/sass/sass.js +0 -459
  156. package/www/codemirror/mode/scheme/scheme.js +0 -284
  157. package/www/codemirror/mode/shell/shell.js +0 -168
  158. package/www/codemirror/mode/sieve/sieve.js +0 -193
  159. package/www/codemirror/mode/slim/slim.js +0 -575
  160. package/www/codemirror/mode/smalltalk/smalltalk.js +0 -168
  161. package/www/codemirror/mode/smarty/smarty.js +0 -225
  162. package/www/codemirror/mode/solr/solr.js +0 -104
  163. package/www/codemirror/mode/soy/soy.js +0 -665
  164. package/www/codemirror/mode/sparql/sparql.js +0 -184
  165. package/www/codemirror/mode/spreadsheet/spreadsheet.js +0 -112
  166. package/www/codemirror/mode/sql/sql.js +0 -525
  167. package/www/codemirror/mode/stex/stex.js +0 -264
  168. package/www/codemirror/mode/stylus/stylus.js +0 -775
  169. package/www/codemirror/mode/swift/swift.js +0 -221
  170. package/www/codemirror/mode/tcl/tcl.js +0 -140
  171. package/www/codemirror/mode/textile/textile.js +0 -469
  172. package/www/codemirror/mode/tiddlywiki/tiddlywiki.css +0 -14
  173. package/www/codemirror/mode/tiddlywiki/tiddlywiki.js +0 -308
  174. package/www/codemirror/mode/tiki/tiki.css +0 -26
  175. package/www/codemirror/mode/tiki/tiki.js +0 -312
  176. package/www/codemirror/mode/toml/toml.js +0 -88
  177. package/www/codemirror/mode/tornado/tornado.js +0 -68
  178. package/www/codemirror/mode/troff/troff.js +0 -84
  179. package/www/codemirror/mode/ttcn/ttcn.js +0 -283
  180. package/www/codemirror/mode/ttcn-cfg/ttcn-cfg.js +0 -214
  181. package/www/codemirror/mode/turtle/turtle.js +0 -162
  182. package/www/codemirror/mode/twig/twig.js +0 -141
  183. package/www/codemirror/mode/vb/vb.js +0 -275
  184. package/www/codemirror/mode/vbscript/vbscript.js +0 -350
  185. package/www/codemirror/mode/velocity/velocity.js +0 -202
  186. package/www/codemirror/mode/verilog/verilog.js +0 -781
  187. package/www/codemirror/mode/vhdl/vhdl.js +0 -189
  188. package/www/codemirror/mode/vue/vue.js +0 -77
  189. package/www/codemirror/mode/wast/wast.js +0 -132
  190. package/www/codemirror/mode/webidl/webidl.js +0 -195
  191. package/www/codemirror/mode/xml/xml.js +0 -417
  192. package/www/codemirror/mode/xquery/xquery.js +0 -448
  193. package/www/codemirror/mode/yacas/yacas.js +0 -204
  194. package/www/codemirror/mode/yaml/yaml.js +0 -120
  195. package/www/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +0 -72
  196. package/www/codemirror/mode/z80/z80.js +0 -116
  197. package/www/codemirror/rollup.config.js +0 -52
  198. package/www/codemirror/src/addon/runmode/codemirror-standalone.js +0 -24
  199. package/www/codemirror/src/addon/runmode/codemirror.node.js +0 -21
  200. package/www/codemirror/src/addon/runmode/runmode-standalone.js +0 -2
  201. package/www/codemirror/src/addon/runmode/runmode.node.js +0 -2
  202. package/www/codemirror/src/codemirror.js +0 -3
  203. package/www/codemirror/src/display/Display.js +0 -116
  204. package/www/codemirror/src/display/focus.js +0 -50
  205. package/www/codemirror/src/display/gutters.js +0 -44
  206. package/www/codemirror/src/display/highlight_worker.js +0 -55
  207. package/www/codemirror/src/display/line_numbers.js +0 -48
  208. package/www/codemirror/src/display/mode_state.js +0 -22
  209. package/www/codemirror/src/display/operations.js +0 -206
  210. package/www/codemirror/src/display/scroll_events.js +0 -132
  211. package/www/codemirror/src/display/scrollbars.js +0 -194
  212. package/www/codemirror/src/display/scrolling.js +0 -186
  213. package/www/codemirror/src/display/selection.js +0 -173
  214. package/www/codemirror/src/display/update_display.js +0 -267
  215. package/www/codemirror/src/display/update_line.js +0 -189
  216. package/www/codemirror/src/display/update_lines.js +0 -82
  217. package/www/codemirror/src/display/view_tracking.js +0 -153
  218. package/www/codemirror/src/edit/CodeMirror.js +0 -217
  219. package/www/codemirror/src/edit/commands.js +0 -178
  220. package/www/codemirror/src/edit/deleteNearSelection.js +0 -30
  221. package/www/codemirror/src/edit/drop_events.js +0 -130
  222. package/www/codemirror/src/edit/fromTextArea.js +0 -61
  223. package/www/codemirror/src/edit/global_events.js +0 -45
  224. package/www/codemirror/src/edit/key_events.js +0 -163
  225. package/www/codemirror/src/edit/legacy.js +0 -62
  226. package/www/codemirror/src/edit/main.js +0 -69
  227. package/www/codemirror/src/edit/methods.js +0 -555
  228. package/www/codemirror/src/edit/mouse_events.js +0 -417
  229. package/www/codemirror/src/edit/options.js +0 -194
  230. package/www/codemirror/src/edit/utils.js +0 -7
  231. package/www/codemirror/src/input/ContentEditableInput.js +0 -546
  232. package/www/codemirror/src/input/TextareaInput.js +0 -380
  233. package/www/codemirror/src/input/indent.js +0 -71
  234. package/www/codemirror/src/input/input.js +0 -134
  235. package/www/codemirror/src/input/keymap.js +0 -147
  236. package/www/codemirror/src/input/keynames.js +0 -17
  237. package/www/codemirror/src/input/movement.js +0 -111
  238. package/www/codemirror/src/line/highlight.js +0 -284
  239. package/www/codemirror/src/line/line_data.js +0 -349
  240. package/www/codemirror/src/line/pos.js +0 -40
  241. package/www/codemirror/src/line/saw_special_spans.js +0 -10
  242. package/www/codemirror/src/line/spans.js +0 -390
  243. package/www/codemirror/src/line/utils_line.js +0 -85
  244. package/www/codemirror/src/measurement/position_measurement.js +0 -702
  245. package/www/codemirror/src/measurement/widgets.js +0 -26
  246. package/www/codemirror/src/model/Doc.js +0 -436
  247. package/www/codemirror/src/model/change_measurement.js +0 -61
  248. package/www/codemirror/src/model/changes.js +0 -339
  249. package/www/codemirror/src/model/chunk.js +0 -167
  250. package/www/codemirror/src/model/document_data.js +0 -112
  251. package/www/codemirror/src/model/history.js +0 -228
  252. package/www/codemirror/src/model/line_widget.js +0 -78
  253. package/www/codemirror/src/model/mark_text.js +0 -293
  254. package/www/codemirror/src/model/selection.js +0 -84
  255. package/www/codemirror/src/model/selection_updates.js +0 -216
  256. package/www/codemirror/src/modes.js +0 -96
  257. package/www/codemirror/src/util/StringStream.js +0 -90
  258. package/www/codemirror/src/util/bidi.js +0 -215
  259. package/www/codemirror/src/util/browser.js +0 -34
  260. package/www/codemirror/src/util/dom.js +0 -101
  261. package/www/codemirror/src/util/event.js +0 -103
  262. package/www/codemirror/src/util/feature_detection.js +0 -84
  263. package/www/codemirror/src/util/misc.js +0 -168
  264. package/www/codemirror/src/util/operation_group.js +0 -72
  265. package/www/codemirror/theme/3024-day.css +0 -41
  266. package/www/codemirror/theme/3024-night.css +0 -39
  267. package/www/codemirror/theme/abbott.css +0 -268
  268. package/www/codemirror/theme/abcdef.css +0 -32
  269. package/www/codemirror/theme/ambiance-mobile.css +0 -5
  270. package/www/codemirror/theme/ambiance.css +0 -74
  271. package/www/codemirror/theme/ayu-dark.css +0 -44
  272. package/www/codemirror/theme/ayu-mirage.css +0 -45
  273. package/www/codemirror/theme/base16-dark.css +0 -40
  274. package/www/codemirror/theme/base16-light.css +0 -38
  275. package/www/codemirror/theme/bespin.css +0 -34
  276. package/www/codemirror/theme/blackboard.css +0 -32
  277. package/www/codemirror/theme/cobalt.css +0 -25
  278. package/www/codemirror/theme/colorforth.css +0 -33
  279. package/www/codemirror/theme/darcula.css +0 -53
  280. package/www/codemirror/theme/dracula.css +0 -40
  281. package/www/codemirror/theme/duotone-dark.css +0 -35
  282. package/www/codemirror/theme/duotone-light.css +0 -36
  283. package/www/codemirror/theme/eclipse.css +0 -23
  284. package/www/codemirror/theme/elegant.css +0 -13
  285. package/www/codemirror/theme/erlang-dark.css +0 -34
  286. package/www/codemirror/theme/gruvbox-dark.css +0 -39
  287. package/www/codemirror/theme/hopscotch.css +0 -34
  288. package/www/codemirror/theme/icecoder.css +0 -43
  289. package/www/codemirror/theme/idea.css +0 -42
  290. package/www/codemirror/theme/isotope.css +0 -34
  291. package/www/codemirror/theme/juejin.css +0 -30
  292. package/www/codemirror/theme/lesser-dark.css +0 -47
  293. package/www/codemirror/theme/liquibyte.css +0 -95
  294. package/www/codemirror/theme/lucario.css +0 -37
  295. package/www/codemirror/theme/material-darker.css +0 -135
  296. package/www/codemirror/theme/material-palenight.css +0 -141
  297. package/www/codemirror/theme/material.css +0 -141
  298. package/www/codemirror/theme/mbo.css +0 -37
  299. package/www/codemirror/theme/mdn-like.css +0 -46
  300. package/www/codemirror/theme/midnight.css +0 -39
  301. package/www/codemirror/theme/monokai.css +0 -41
  302. package/www/codemirror/theme/moxer.css +0 -143
  303. package/www/codemirror/theme/neat.css +0 -12
  304. package/www/codemirror/theme/neo.css +0 -43
  305. package/www/codemirror/theme/night.css +0 -27
  306. package/www/codemirror/theme/nord.css +0 -42
  307. package/www/codemirror/theme/oceanic-next.css +0 -46
  308. package/www/codemirror/theme/panda-syntax.css +0 -85
  309. package/www/codemirror/theme/paraiso-dark.css +0 -38
  310. package/www/codemirror/theme/paraiso-light.css +0 -38
  311. package/www/codemirror/theme/pastel-on-dark.css +0 -52
  312. package/www/codemirror/theme/railscasts.css +0 -34
  313. package/www/codemirror/theme/rubyblue.css +0 -25
  314. package/www/codemirror/theme/seti.css +0 -44
  315. package/www/codemirror/theme/shadowfox.css +0 -52
  316. package/www/codemirror/theme/solarized.css +0 -165
  317. package/www/codemirror/theme/ssms.css +0 -16
  318. package/www/codemirror/theme/the-matrix.css +0 -30
  319. package/www/codemirror/theme/tomorrow-night-bright.css +0 -35
  320. package/www/codemirror/theme/tomorrow-night-eighties.css +0 -38
  321. package/www/codemirror/theme/ttcn.css +0 -64
  322. package/www/codemirror/theme/twilight.css +0 -32
  323. package/www/codemirror/theme/vibrant-ink.css +0 -34
  324. package/www/codemirror/theme/xq-dark.css +0 -53
  325. package/www/codemirror/theme/xq-light.css +0 -43
  326. package/www/codemirror/theme/yeti.css +0 -44
  327. package/www/codemirror/theme/yonce.css +0 -59
  328. package/www/codemirror/theme/zenburn.css +0 -37
@@ -1,178 +0,0 @@
1
- import { deleteNearSelection } from "./deleteNearSelection.js"
2
- import { runInOp } from "../display/operations.js"
3
- import { ensureCursorVisible } from "../display/scrolling.js"
4
- import { endOfLine } from "../input/movement.js"
5
- import { clipPos, Pos } from "../line/pos.js"
6
- import { visualLine, visualLineEnd } from "../line/spans.js"
7
- import { getLine, lineNo } from "../line/utils_line.js"
8
- import { Range } from "../model/selection.js"
9
- import { selectAll } from "../model/selection_updates.js"
10
- import { countColumn, sel_dontScroll, sel_move, spaceStr } from "../util/misc.js"
11
- import { getOrder } from "../util/bidi.js"
12
-
13
- // Commands are parameter-less actions that can be performed on an
14
- // editor, mostly used for keybindings.
15
- export let commands = {
16
- selectAll: selectAll,
17
- singleSelection: cm => cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll),
18
- killLine: cm => deleteNearSelection(cm, range => {
19
- if (range.empty()) {
20
- let len = getLine(cm.doc, range.head.line).text.length
21
- if (range.head.ch == len && range.head.line < cm.lastLine())
22
- return {from: range.head, to: Pos(range.head.line + 1, 0)}
23
- else
24
- return {from: range.head, to: Pos(range.head.line, len)}
25
- } else {
26
- return {from: range.from(), to: range.to()}
27
- }
28
- }),
29
- deleteLine: cm => deleteNearSelection(cm, range => ({
30
- from: Pos(range.from().line, 0),
31
- to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
32
- })),
33
- delLineLeft: cm => deleteNearSelection(cm, range => ({
34
- from: Pos(range.from().line, 0), to: range.from()
35
- })),
36
- delWrappedLineLeft: cm => deleteNearSelection(cm, range => {
37
- let top = cm.charCoords(range.head, "div").top + 5
38
- let leftPos = cm.coordsChar({left: 0, top: top}, "div")
39
- return {from: leftPos, to: range.from()}
40
- }),
41
- delWrappedLineRight: cm => deleteNearSelection(cm, range => {
42
- let top = cm.charCoords(range.head, "div").top + 5
43
- let rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
44
- return {from: range.from(), to: rightPos }
45
- }),
46
- undo: cm => cm.undo(),
47
- redo: cm => cm.redo(),
48
- undoSelection: cm => cm.undoSelection(),
49
- redoSelection: cm => cm.redoSelection(),
50
- goDocStart: cm => cm.extendSelection(Pos(cm.firstLine(), 0)),
51
- goDocEnd: cm => cm.extendSelection(Pos(cm.lastLine())),
52
- goLineStart: cm => cm.extendSelectionsBy(range => lineStart(cm, range.head.line),
53
- {origin: "+move", bias: 1}
54
- ),
55
- goLineStartSmart: cm => cm.extendSelectionsBy(range => lineStartSmart(cm, range.head),
56
- {origin: "+move", bias: 1}
57
- ),
58
- goLineEnd: cm => cm.extendSelectionsBy(range => lineEnd(cm, range.head.line),
59
- {origin: "+move", bias: -1}
60
- ),
61
- goLineRight: cm => cm.extendSelectionsBy(range => {
62
- let top = cm.cursorCoords(range.head, "div").top + 5
63
- return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
64
- }, sel_move),
65
- goLineLeft: cm => cm.extendSelectionsBy(range => {
66
- let top = cm.cursorCoords(range.head, "div").top + 5
67
- return cm.coordsChar({left: 0, top: top}, "div")
68
- }, sel_move),
69
- goLineLeftSmart: cm => cm.extendSelectionsBy(range => {
70
- let top = cm.cursorCoords(range.head, "div").top + 5
71
- let pos = cm.coordsChar({left: 0, top: top}, "div")
72
- if (pos.ch < cm.getLine(pos.line).search(/\S/)) return lineStartSmart(cm, range.head)
73
- return pos
74
- }, sel_move),
75
- goLineUp: cm => cm.moveV(-1, "line"),
76
- goLineDown: cm => cm.moveV(1, "line"),
77
- goPageUp: cm => cm.moveV(-1, "page"),
78
- goPageDown: cm => cm.moveV(1, "page"),
79
- goCharLeft: cm => cm.moveH(-1, "char"),
80
- goCharRight: cm => cm.moveH(1, "char"),
81
- goColumnLeft: cm => cm.moveH(-1, "column"),
82
- goColumnRight: cm => cm.moveH(1, "column"),
83
- goWordLeft: cm => cm.moveH(-1, "word"),
84
- goGroupRight: cm => cm.moveH(1, "group"),
85
- goGroupLeft: cm => cm.moveH(-1, "group"),
86
- goWordRight: cm => cm.moveH(1, "word"),
87
- delCharBefore: cm => cm.deleteH(-1, "codepoint"),
88
- delCharAfter: cm => cm.deleteH(1, "char"),
89
- delWordBefore: cm => cm.deleteH(-1, "word"),
90
- delWordAfter: cm => cm.deleteH(1, "word"),
91
- delGroupBefore: cm => cm.deleteH(-1, "group"),
92
- delGroupAfter: cm => cm.deleteH(1, "group"),
93
- indentAuto: cm => cm.indentSelection("smart"),
94
- indentMore: cm => cm.indentSelection("add"),
95
- indentLess: cm => cm.indentSelection("subtract"),
96
- insertTab: cm => cm.replaceSelection("\t"),
97
- insertSoftTab: cm => {
98
- let spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize
99
- for (let i = 0; i < ranges.length; i++) {
100
- let pos = ranges[i].from()
101
- let col = countColumn(cm.getLine(pos.line), pos.ch, tabSize)
102
- spaces.push(spaceStr(tabSize - col % tabSize))
103
- }
104
- cm.replaceSelections(spaces)
105
- },
106
- defaultTab: cm => {
107
- if (cm.somethingSelected()) cm.indentSelection("add")
108
- else cm.execCommand("insertTab")
109
- },
110
- // Swap the two chars left and right of each selection's head.
111
- // Move cursor behind the two swapped characters afterwards.
112
- //
113
- // Doesn't consider line feeds a character.
114
- // Doesn't scan more than one line above to find a character.
115
- // Doesn't do anything on an empty line.
116
- // Doesn't do anything with non-empty selections.
117
- transposeChars: cm => runInOp(cm, () => {
118
- let ranges = cm.listSelections(), newSel = []
119
- for (let i = 0; i < ranges.length; i++) {
120
- if (!ranges[i].empty()) continue
121
- let cur = ranges[i].head, line = getLine(cm.doc, cur.line).text
122
- if (line) {
123
- if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1)
124
- if (cur.ch > 0) {
125
- cur = new Pos(cur.line, cur.ch + 1)
126
- cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
127
- Pos(cur.line, cur.ch - 2), cur, "+transpose")
128
- } else if (cur.line > cm.doc.first) {
129
- let prev = getLine(cm.doc, cur.line - 1).text
130
- if (prev) {
131
- cur = new Pos(cur.line, 1)
132
- cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
133
- prev.charAt(prev.length - 1),
134
- Pos(cur.line - 1, prev.length - 1), cur, "+transpose")
135
- }
136
- }
137
- }
138
- newSel.push(new Range(cur, cur))
139
- }
140
- cm.setSelections(newSel)
141
- }),
142
- newlineAndIndent: cm => runInOp(cm, () => {
143
- let sels = cm.listSelections()
144
- for (let i = sels.length - 1; i >= 0; i--)
145
- cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input")
146
- sels = cm.listSelections()
147
- for (let i = 0; i < sels.length; i++)
148
- cm.indentLine(sels[i].from().line, null, true)
149
- ensureCursorVisible(cm)
150
- }),
151
- openLine: cm => cm.replaceSelection("\n", "start"),
152
- toggleOverwrite: cm => cm.toggleOverwrite()
153
- }
154
-
155
-
156
- function lineStart(cm, lineN) {
157
- let line = getLine(cm.doc, lineN)
158
- let visual = visualLine(line)
159
- if (visual != line) lineN = lineNo(visual)
160
- return endOfLine(true, cm, visual, lineN, 1)
161
- }
162
- function lineEnd(cm, lineN) {
163
- let line = getLine(cm.doc, lineN)
164
- let visual = visualLineEnd(line)
165
- if (visual != line) lineN = lineNo(visual)
166
- return endOfLine(true, cm, line, lineN, -1)
167
- }
168
- function lineStartSmart(cm, pos) {
169
- let start = lineStart(cm, pos.line)
170
- let line = getLine(cm.doc, start.line)
171
- let order = getOrder(line, cm.doc.direction)
172
- if (!order || order[0].level == 0) {
173
- let firstNonWS = Math.max(start.ch, line.text.search(/\S/))
174
- let inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch
175
- return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
176
- }
177
- return start
178
- }
@@ -1,30 +0,0 @@
1
- import { runInOp } from "../display/operations.js"
2
- import { ensureCursorVisible } from "../display/scrolling.js"
3
- import { cmp } from "../line/pos.js"
4
- import { replaceRange } from "../model/changes.js"
5
- import { lst } from "../util/misc.js"
6
-
7
- // Helper for deleting text near the selection(s), used to implement
8
- // backspace, delete, and similar functionality.
9
- export function deleteNearSelection(cm, compute) {
10
- let ranges = cm.doc.sel.ranges, kill = []
11
- // Build up a set of ranges to kill first, merging overlapping
12
- // ranges.
13
- for (let i = 0; i < ranges.length; i++) {
14
- let toKill = compute(ranges[i])
15
- while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
16
- let replaced = kill.pop()
17
- if (cmp(replaced.from, toKill.from) < 0) {
18
- toKill.from = replaced.from
19
- break
20
- }
21
- }
22
- kill.push(toKill)
23
- }
24
- // Next, remove those actual ranges.
25
- runInOp(cm, () => {
26
- for (let i = kill.length - 1; i >= 0; i--)
27
- replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete")
28
- ensureCursorVisible(cm)
29
- })
30
- }
@@ -1,130 +0,0 @@
1
- import { drawSelectionCursor } from "../display/selection.js"
2
- import { operation } from "../display/operations.js"
3
- import { clipPos } from "../line/pos.js"
4
- import { posFromMouse } from "../measurement/position_measurement.js"
5
- import { eventInWidget } from "../measurement/widgets.js"
6
- import { makeChange, replaceRange } from "../model/changes.js"
7
- import { changeEnd } from "../model/change_measurement.js"
8
- import { simpleSelection } from "../model/selection.js"
9
- import { setSelectionNoUndo, setSelectionReplaceHistory } from "../model/selection_updates.js"
10
- import { ie, presto, safari } from "../util/browser.js"
11
- import { elt, removeChildrenAndAdd } from "../util/dom.js"
12
- import { e_preventDefault, e_stop, signalDOMEvent } from "../util/event.js"
13
- import { indexOf } from "../util/misc.js"
14
-
15
- // Kludge to work around strange IE behavior where it'll sometimes
16
- // re-fire a series of drag-related events right after the drop (#1551)
17
- let lastDrop = 0
18
-
19
- export function onDrop(e) {
20
- let cm = this
21
- clearDragCursor(cm)
22
- if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
23
- return
24
- e_preventDefault(e)
25
- if (ie) lastDrop = +new Date
26
- let pos = posFromMouse(cm, e, true), files = e.dataTransfer.files
27
- if (!pos || cm.isReadOnly()) return
28
- // Might be a file drop, in which case we simply extract the text
29
- // and insert it.
30
- if (files && files.length && window.FileReader && window.File) {
31
- let n = files.length, text = Array(n), read = 0
32
- const markAsReadAndPasteIfAllFilesAreRead = () => {
33
- if (++read == n) {
34
- operation(cm, () => {
35
- pos = clipPos(cm.doc, pos)
36
- let change = {from: pos, to: pos,
37
- text: cm.doc.splitLines(
38
- text.filter(t => t != null).join(cm.doc.lineSeparator())),
39
- origin: "paste"}
40
- makeChange(cm.doc, change)
41
- setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))))
42
- })()
43
- }
44
- }
45
- const readTextFromFile = (file, i) => {
46
- if (cm.options.allowDropFileTypes &&
47
- indexOf(cm.options.allowDropFileTypes, file.type) == -1) {
48
- markAsReadAndPasteIfAllFilesAreRead()
49
- return
50
- }
51
- let reader = new FileReader
52
- reader.onerror = () => markAsReadAndPasteIfAllFilesAreRead()
53
- reader.onload = () => {
54
- let content = reader.result
55
- if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) {
56
- markAsReadAndPasteIfAllFilesAreRead()
57
- return
58
- }
59
- text[i] = content
60
- markAsReadAndPasteIfAllFilesAreRead()
61
- }
62
- reader.readAsText(file)
63
- }
64
- for (let i = 0; i < files.length; i++) readTextFromFile(files[i], i)
65
- } else { // Normal drop
66
- // Don't do a replace if the drop happened inside of the selected text.
67
- if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
68
- cm.state.draggingText(e)
69
- // Ensure the editor is re-focused
70
- setTimeout(() => cm.display.input.focus(), 20)
71
- return
72
- }
73
- try {
74
- let text = e.dataTransfer.getData("Text")
75
- if (text) {
76
- let selected
77
- if (cm.state.draggingText && !cm.state.draggingText.copy)
78
- selected = cm.listSelections()
79
- setSelectionNoUndo(cm.doc, simpleSelection(pos, pos))
80
- if (selected) for (let i = 0; i < selected.length; ++i)
81
- replaceRange(cm.doc, "", selected[i].anchor, selected[i].head, "drag")
82
- cm.replaceSelection(text, "around", "paste")
83
- cm.display.input.focus()
84
- }
85
- }
86
- catch(e){}
87
- }
88
- }
89
-
90
- export function onDragStart(cm, e) {
91
- if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
92
- if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return
93
-
94
- e.dataTransfer.setData("Text", cm.getSelection())
95
- e.dataTransfer.effectAllowed = "copyMove"
96
-
97
- // Use dummy image instead of default browsers image.
98
- // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
99
- if (e.dataTransfer.setDragImage && !safari) {
100
- let img = elt("img", null, null, "position: fixed; left: 0; top: 0;")
101
- img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
102
- if (presto) {
103
- img.width = img.height = 1
104
- cm.display.wrapper.appendChild(img)
105
- // Force a relayout, or Opera won't use our image for some obscure reason
106
- img._top = img.offsetTop
107
- }
108
- e.dataTransfer.setDragImage(img, 0, 0)
109
- if (presto) img.parentNode.removeChild(img)
110
- }
111
- }
112
-
113
- export function onDragOver(cm, e) {
114
- let pos = posFromMouse(cm, e)
115
- if (!pos) return
116
- let frag = document.createDocumentFragment()
117
- drawSelectionCursor(cm, pos, frag)
118
- if (!cm.display.dragCursor) {
119
- cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors")
120
- cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv)
121
- }
122
- removeChildrenAndAdd(cm.display.dragCursor, frag)
123
- }
124
-
125
- export function clearDragCursor(cm) {
126
- if (cm.display.dragCursor) {
127
- cm.display.lineSpace.removeChild(cm.display.dragCursor)
128
- cm.display.dragCursor = null
129
- }
130
- }
@@ -1,61 +0,0 @@
1
- import { CodeMirror } from "./CodeMirror.js"
2
- import { activeElt } from "../util/dom.js"
3
- import { off, on } from "../util/event.js"
4
- import { copyObj } from "../util/misc.js"
5
-
6
- export function fromTextArea(textarea, options) {
7
- options = options ? copyObj(options) : {}
8
- options.value = textarea.value
9
- if (!options.tabindex && textarea.tabIndex)
10
- options.tabindex = textarea.tabIndex
11
- if (!options.placeholder && textarea.placeholder)
12
- options.placeholder = textarea.placeholder
13
- // Set autofocus to true if this textarea is focused, or if it has
14
- // autofocus and no other element is focused.
15
- if (options.autofocus == null) {
16
- let hasFocus = activeElt(textarea.ownerDocument)
17
- options.autofocus = hasFocus == textarea ||
18
- textarea.getAttribute("autofocus") != null && hasFocus == document.body
19
- }
20
-
21
- function save() {textarea.value = cm.getValue()}
22
-
23
- let realSubmit
24
- if (textarea.form) {
25
- on(textarea.form, "submit", save)
26
- // Deplorable hack to make the submit method do the right thing.
27
- if (!options.leaveSubmitMethodAlone) {
28
- let form = textarea.form
29
- realSubmit = form.submit
30
- try {
31
- let wrappedSubmit = form.submit = () => {
32
- save()
33
- form.submit = realSubmit
34
- form.submit()
35
- form.submit = wrappedSubmit
36
- }
37
- } catch(e) {}
38
- }
39
- }
40
-
41
- options.finishInit = cm => {
42
- cm.save = save
43
- cm.getTextArea = () => textarea
44
- cm.toTextArea = () => {
45
- cm.toTextArea = isNaN // Prevent this from being ran twice
46
- save()
47
- textarea.parentNode.removeChild(cm.getWrapperElement())
48
- textarea.style.display = ""
49
- if (textarea.form) {
50
- off(textarea.form, "submit", save)
51
- if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
52
- textarea.form.submit = realSubmit
53
- }
54
- }
55
- }
56
-
57
- textarea.style.display = "none"
58
- let cm = CodeMirror(node => textarea.parentNode.insertBefore(node, textarea.nextSibling),
59
- options)
60
- return cm
61
- }
@@ -1,45 +0,0 @@
1
- import { onBlur } from "../display/focus.js"
2
- import { on } from "../util/event.js"
3
-
4
- // These must be handled carefully, because naively registering a
5
- // handler for each editor will cause the editors to never be
6
- // garbage collected.
7
-
8
- function forEachCodeMirror(f) {
9
- if (!document.getElementsByClassName) return
10
- let byClass = document.getElementsByClassName("CodeMirror"), editors = []
11
- for (let i = 0; i < byClass.length; i++) {
12
- let cm = byClass[i].CodeMirror
13
- if (cm) editors.push(cm)
14
- }
15
- if (editors.length) editors[0].operation(() => {
16
- for (let i = 0; i < editors.length; i++) f(editors[i])
17
- })
18
- }
19
-
20
- let globalsRegistered = false
21
- export function ensureGlobalHandlers() {
22
- if (globalsRegistered) return
23
- registerGlobalHandlers()
24
- globalsRegistered = true
25
- }
26
- function registerGlobalHandlers() {
27
- // When the window resizes, we need to refresh active editors.
28
- let resizeTimer
29
- on(window, "resize", () => {
30
- if (resizeTimer == null) resizeTimer = setTimeout(() => {
31
- resizeTimer = null
32
- forEachCodeMirror(onResize)
33
- }, 100)
34
- })
35
- // When the window loses focus, we want to show the editor as blurred
36
- on(window, "blur", () => forEachCodeMirror(onBlur))
37
- }
38
- // Called when the window resizes
39
- function onResize(cm) {
40
- let d = cm.display
41
- // Might be a text scaling operation, clear size caches.
42
- d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
43
- d.scrollbarsClipped = false
44
- cm.setSize()
45
- }
@@ -1,163 +0,0 @@
1
- import { signalLater } from "../util/operation_group.js"
2
- import { restartBlink } from "../display/selection.js"
3
- import { isModifierKey, keyName, lookupKey } from "../input/keymap.js"
4
- import { eventInWidget } from "../measurement/widgets.js"
5
- import { ie, ie_version, mac, presto, gecko } from "../util/browser.js"
6
- import { activeElt, addClass, rmClass, doc } from "../util/dom.js"
7
- import { e_preventDefault, off, on, signalDOMEvent } from "../util/event.js"
8
- import { hasCopyEvent } from "../util/feature_detection.js"
9
- import { Delayed, Pass } from "../util/misc.js"
10
-
11
- import { commands } from "./commands.js"
12
-
13
- // Run a handler that was bound to a key.
14
- function doHandleBinding(cm, bound, dropShift) {
15
- if (typeof bound == "string") {
16
- bound = commands[bound]
17
- if (!bound) return false
18
- }
19
- // Ensure previous input has been read, so that the handler sees a
20
- // consistent view of the document
21
- cm.display.input.ensurePolled()
22
- let prevShift = cm.display.shift, done = false
23
- try {
24
- if (cm.isReadOnly()) cm.state.suppressEdits = true
25
- if (dropShift) cm.display.shift = false
26
- done = bound(cm) != Pass
27
- } finally {
28
- cm.display.shift = prevShift
29
- cm.state.suppressEdits = false
30
- }
31
- return done
32
- }
33
-
34
- function lookupKeyForEditor(cm, name, handle) {
35
- for (let i = 0; i < cm.state.keyMaps.length; i++) {
36
- let result = lookupKey(name, cm.state.keyMaps[i], handle, cm)
37
- if (result) return result
38
- }
39
- return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
40
- || lookupKey(name, cm.options.keyMap, handle, cm)
41
- }
42
-
43
- // Note that, despite the name, this function is also used to check
44
- // for bound mouse clicks.
45
-
46
- let stopSeq = new Delayed
47
-
48
- export function dispatchKey(cm, name, e, handle) {
49
- let seq = cm.state.keySeq
50
- if (seq) {
51
- if (isModifierKey(name)) return "handled"
52
- if (/\'$/.test(name))
53
- cm.state.keySeq = null
54
- else
55
- stopSeq.set(50, () => {
56
- if (cm.state.keySeq == seq) {
57
- cm.state.keySeq = null
58
- cm.display.input.reset()
59
- }
60
- })
61
- if (dispatchKeyInner(cm, seq + " " + name, e, handle)) return true
62
- }
63
- return dispatchKeyInner(cm, name, e, handle)
64
- }
65
-
66
- function dispatchKeyInner(cm, name, e, handle) {
67
- let result = lookupKeyForEditor(cm, name, handle)
68
-
69
- if (result == "multi")
70
- cm.state.keySeq = name
71
- if (result == "handled")
72
- signalLater(cm, "keyHandled", cm, name, e)
73
-
74
- if (result == "handled" || result == "multi") {
75
- e_preventDefault(e)
76
- restartBlink(cm)
77
- }
78
-
79
- return !!result
80
- }
81
-
82
- // Handle a key from the keydown event.
83
- function handleKeyBinding(cm, e) {
84
- let name = keyName(e, true)
85
- if (!name) return false
86
-
87
- if (e.shiftKey && !cm.state.keySeq) {
88
- // First try to resolve full name (including 'Shift-'). Failing
89
- // that, see if there is a cursor-motion command (starting with
90
- // 'go') bound to the keyname without 'Shift-'.
91
- return dispatchKey(cm, "Shift-" + name, e, b => doHandleBinding(cm, b, true))
92
- || dispatchKey(cm, name, e, b => {
93
- if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
94
- return doHandleBinding(cm, b)
95
- })
96
- } else {
97
- return dispatchKey(cm, name, e, b => doHandleBinding(cm, b))
98
- }
99
- }
100
-
101
- // Handle a key from the keypress event
102
- function handleCharBinding(cm, e, ch) {
103
- return dispatchKey(cm, "'" + ch + "'", e, b => doHandleBinding(cm, b, true))
104
- }
105
-
106
- let lastStoppedKey = null
107
- export function onKeyDown(e) {
108
- let cm = this
109
- if (e.target && e.target != cm.display.input.getField()) return
110
- cm.curOp.focus = activeElt(doc(cm))
111
- if (signalDOMEvent(cm, e)) return
112
- // IE does strange things with escape.
113
- if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false
114
- let code = e.keyCode
115
- cm.display.shift = code == 16 || e.shiftKey
116
- let handled = handleKeyBinding(cm, e)
117
- if (presto) {
118
- lastStoppedKey = handled ? code : null
119
- // Opera has no cut event... we try to at least catch the key combo
120
- if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
121
- cm.replaceSelection("", null, "cut")
122
- }
123
- if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)
124
- document.execCommand("cut")
125
-
126
- // Turn mouse into crosshair when Alt is held on Mac.
127
- if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
128
- showCrossHair(cm)
129
- }
130
-
131
- function showCrossHair(cm) {
132
- let lineDiv = cm.display.lineDiv
133
- addClass(lineDiv, "CodeMirror-crosshair")
134
-
135
- function up(e) {
136
- if (e.keyCode == 18 || !e.altKey) {
137
- rmClass(lineDiv, "CodeMirror-crosshair")
138
- off(document, "keyup", up)
139
- off(document, "mouseover", up)
140
- }
141
- }
142
- on(document, "keyup", up)
143
- on(document, "mouseover", up)
144
- }
145
-
146
- export function onKeyUp(e) {
147
- if (e.keyCode == 16) this.doc.sel.shift = false
148
- signalDOMEvent(this, e)
149
- }
150
-
151
- export function onKeyPress(e) {
152
- let cm = this
153
- if (e.target && e.target != cm.display.input.getField()) return
154
- if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return
155
- let keyCode = e.keyCode, charCode = e.charCode
156
- if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
157
- if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return
158
- let ch = String.fromCharCode(charCode == null ? keyCode : charCode)
159
- // Some browsers fire keypress events for backspace
160
- if (ch == "\x08") return
161
- if (handleCharBinding(cm, e, ch)) return
162
- cm.display.input.onKeyPress(e)
163
- }
@@ -1,62 +0,0 @@
1
- import { scrollbarModel } from "../display/scrollbars.js"
2
- import { wheelEventPixels } from "../display/scroll_events.js"
3
- import { keyMap, keyName, isModifierKey, lookupKey, normalizeKeyMap } from "../input/keymap.js"
4
- import { keyNames } from "../input/keynames.js"
5
- import { Line } from "../line/line_data.js"
6
- import { cmp, Pos } from "../line/pos.js"
7
- import { changeEnd } from "../model/change_measurement.js"
8
- import Doc from "../model/Doc.js"
9
- import { LineWidget } from "../model/line_widget.js"
10
- import { SharedTextMarker, TextMarker } from "../model/mark_text.js"
11
- import { copyState, extendMode, getMode, innerMode, mimeModes, modeExtensions, modes, resolveMode, startState } from "../modes.js"
12
- import { addClass, contains, rmClass } from "../util/dom.js"
13
- import { e_preventDefault, e_stop, e_stopPropagation, off, on, signal } from "../util/event.js"
14
- import { splitLinesAuto } from "../util/feature_detection.js"
15
- import { countColumn, findColumn, isWordCharBasic, Pass } from "../util/misc.js"
16
- import StringStream from "../util/StringStream.js"
17
-
18
- import { commands } from "./commands.js"
19
-
20
- export function addLegacyProps(CodeMirror) {
21
- CodeMirror.off = off
22
- CodeMirror.on = on
23
- CodeMirror.wheelEventPixels = wheelEventPixels
24
- CodeMirror.Doc = Doc
25
- CodeMirror.splitLines = splitLinesAuto
26
- CodeMirror.countColumn = countColumn
27
- CodeMirror.findColumn = findColumn
28
- CodeMirror.isWordChar = isWordCharBasic
29
- CodeMirror.Pass = Pass
30
- CodeMirror.signal = signal
31
- CodeMirror.Line = Line
32
- CodeMirror.changeEnd = changeEnd
33
- CodeMirror.scrollbarModel = scrollbarModel
34
- CodeMirror.Pos = Pos
35
- CodeMirror.cmpPos = cmp
36
- CodeMirror.modes = modes
37
- CodeMirror.mimeModes = mimeModes
38
- CodeMirror.resolveMode = resolveMode
39
- CodeMirror.getMode = getMode
40
- CodeMirror.modeExtensions = modeExtensions
41
- CodeMirror.extendMode = extendMode
42
- CodeMirror.copyState = copyState
43
- CodeMirror.startState = startState
44
- CodeMirror.innerMode = innerMode
45
- CodeMirror.commands = commands
46
- CodeMirror.keyMap = keyMap
47
- CodeMirror.keyName = keyName
48
- CodeMirror.isModifierKey = isModifierKey
49
- CodeMirror.lookupKey = lookupKey
50
- CodeMirror.normalizeKeyMap = normalizeKeyMap
51
- CodeMirror.StringStream = StringStream
52
- CodeMirror.SharedTextMarker = SharedTextMarker
53
- CodeMirror.TextMarker = TextMarker
54
- CodeMirror.LineWidget = LineWidget
55
- CodeMirror.e_preventDefault = e_preventDefault
56
- CodeMirror.e_stopPropagation = e_stopPropagation
57
- CodeMirror.e_stop = e_stop
58
- CodeMirror.addClass = addClass
59
- CodeMirror.contains = contains
60
- CodeMirror.rmClass = rmClass
61
- CodeMirror.keyNames = keyNames
62
- }