qword 0.1.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.
- package/ChangeLog +2333 -0
- package/LICENSE +22 -0
- package/README.md +170 -0
- package/assets/font/DroidSansMono.eot +0 -0
- package/assets/font/DroidSansMono.woff +0 -0
- package/assets/font/DroidSansMono.woff2 +0 -0
- package/assets/index.html +24 -0
- package/assets/style.css +34 -0
- package/bin/dword.js +109 -0
- package/client/_clipboard.js +53 -0
- package/client/_init-socket.js +77 -0
- package/client/_on-save.js +38 -0
- package/client/codemirror/show-trailing.js +54 -0
- package/client/codemirror/use-soft-tabs.js +38 -0
- package/client/dword.js +717 -0
- package/client/loadremote.js +93 -0
- package/client/save.js +53 -0
- package/client/set-key-map.js +3 -0
- package/client/show-message.js +30 -0
- package/client/story.js +55 -0
- package/codemirror/codemirror.js +3 -0
- package/css/dword.css +20 -0
- package/dist/2b22a33a0a80bb926bbc.png +1 -0
- package/dist/8e9019bd86255ac9a618.png +1 -0
- package/dist/codemirror.js +2 -0
- package/dist/codemirror.js.map +1 -0
- package/dist/dword.js +2 -0
- package/dist/dword.js.map +1 -0
- package/dist-dev/2b22a33a0a80bb926bbc.png +1 -0
- package/dist-dev/8e9019bd86255ac9a618.png +1 -0
- package/dist-dev/codemirror.js +104 -0
- package/dist-dev/dword.js +960 -0
- package/img/dword.png +0 -0
- package/json/bin.json +4 -0
- package/json/edit.json +17 -0
- package/json/ext.json +12 -0
- package/json/modules.json +22 -0
- package/modules/cm-searchbox/ChangeLog +60 -0
- package/modules/cm-searchbox/LICENSE +21 -0
- package/modules/cm-searchbox/README.md +27 -0
- package/modules/cm-searchbox/img/searchbox.png +0 -0
- package/modules/cm-searchbox/lib/searchbox.js +679 -0
- package/modules/cm-searchbox/package.json +27 -0
- package/modules/cm-show-invisibles/ChangeLog +108 -0
- package/modules/cm-show-invisibles/LICENSE +21 -0
- package/modules/cm-show-invisibles/README.md +25 -0
- package/modules/cm-show-invisibles/lib/show-invisibles.js +131 -0
- package/modules/cm-show-invisibles/package.json +34 -0
- package/modules/codemirror/AUTHORS +992 -0
- package/modules/codemirror/CHANGELOG.md +2290 -0
- package/modules/codemirror/CONTRIBUTING.md +97 -0
- package/modules/codemirror/LICENSE +21 -0
- package/modules/codemirror/README.md +48 -0
- package/modules/codemirror/addon/comment/comment.js +211 -0
- package/modules/codemirror/addon/comment/continuecomment.js +114 -0
- package/modules/codemirror/addon/dialog/dialog.css +32 -0
- package/modules/codemirror/addon/dialog/dialog.js +163 -0
- package/modules/codemirror/addon/display/autorefresh.js +47 -0
- package/modules/codemirror/addon/display/fullscreen.css +6 -0
- package/modules/codemirror/addon/display/fullscreen.js +41 -0
- package/modules/codemirror/addon/display/panel.js +133 -0
- package/modules/codemirror/addon/display/placeholder.js +78 -0
- package/modules/codemirror/addon/display/rulers.js +51 -0
- package/modules/codemirror/addon/edit/closebrackets.js +201 -0
- package/modules/codemirror/addon/edit/closetag.js +185 -0
- package/modules/codemirror/addon/edit/continuelist.js +101 -0
- package/modules/codemirror/addon/edit/matchbrackets.js +160 -0
- package/modules/codemirror/addon/edit/matchtags.js +66 -0
- package/modules/codemirror/addon/edit/trailingspace.js +27 -0
- package/modules/codemirror/addon/fold/brace-fold.js +119 -0
- package/modules/codemirror/addon/fold/comment-fold.js +59 -0
- package/modules/codemirror/addon/fold/foldcode.js +159 -0
- package/modules/codemirror/addon/fold/foldgutter.css +20 -0
- package/modules/codemirror/addon/fold/foldgutter.js +169 -0
- package/modules/codemirror/addon/fold/indent-fold.js +48 -0
- package/modules/codemirror/addon/fold/markdown-fold.js +49 -0
- package/modules/codemirror/addon/fold/xml-fold.js +184 -0
- package/modules/codemirror/addon/hint/anyword-hint.js +41 -0
- package/modules/codemirror/addon/hint/css-hint.js +66 -0
- package/modules/codemirror/addon/hint/html-hint.js +351 -0
- package/modules/codemirror/addon/hint/javascript-hint.js +162 -0
- package/modules/codemirror/addon/hint/show-hint.css +37 -0
- package/modules/codemirror/addon/hint/show-hint.js +523 -0
- package/modules/codemirror/addon/hint/sql-hint.js +304 -0
- package/modules/codemirror/addon/hint/xml-hint.js +132 -0
- package/modules/codemirror/addon/lint/coffeescript-lint.js +47 -0
- package/modules/codemirror/addon/lint/css-lint.js +40 -0
- package/modules/codemirror/addon/lint/html-lint.js +59 -0
- package/modules/codemirror/addon/lint/javascript-lint.js +65 -0
- package/modules/codemirror/addon/lint/json-lint.js +40 -0
- package/modules/codemirror/addon/lint/lint.css +79 -0
- package/modules/codemirror/addon/lint/lint.js +288 -0
- package/modules/codemirror/addon/lint/yaml-lint.js +41 -0
- package/modules/codemirror/addon/merge/merge.css +119 -0
- package/modules/codemirror/addon/merge/merge.js +1018 -0
- package/modules/codemirror/addon/mode/loadmode.js +66 -0
- package/modules/codemirror/addon/mode/multiplex.js +136 -0
- package/modules/codemirror/addon/mode/multiplex_test.js +49 -0
- package/modules/codemirror/addon/mode/overlay.js +90 -0
- package/modules/codemirror/addon/mode/simple.js +216 -0
- package/modules/codemirror/addon/runmode/colorize.js +40 -0
- package/modules/codemirror/addon/runmode/runmode-standalone.js +334 -0
- package/modules/codemirror/addon/runmode/runmode.js +76 -0
- package/modules/codemirror/addon/runmode/runmode.node.js +329 -0
- package/modules/codemirror/addon/scroll/annotatescrollbar.js +128 -0
- package/modules/codemirror/addon/scroll/scrollpastend.js +48 -0
- package/modules/codemirror/addon/scroll/simplescrollbars.css +66 -0
- package/modules/codemirror/addon/scroll/simplescrollbars.js +152 -0
- package/modules/codemirror/addon/search/jump-to-line.js +53 -0
- package/modules/codemirror/addon/search/match-highlighter.js +167 -0
- package/modules/codemirror/addon/search/matchesonscrollbar.css +8 -0
- package/modules/codemirror/addon/search/matchesonscrollbar.js +97 -0
- package/modules/codemirror/addon/search/search.js +295 -0
- package/modules/codemirror/addon/search/searchcursor.js +305 -0
- package/modules/codemirror/addon/selection/active-line.js +72 -0
- package/modules/codemirror/addon/selection/mark-selection.js +119 -0
- package/modules/codemirror/addon/selection/selection-pointer.js +98 -0
- package/modules/codemirror/addon/tern/tern.css +87 -0
- package/modules/codemirror/addon/tern/tern.js +756 -0
- package/modules/codemirror/addon/tern/worker.js +44 -0
- package/modules/codemirror/addon/wrap/hardwrap.js +160 -0
- package/modules/codemirror/bin/source-highlight +48 -0
- package/modules/codemirror/changes +3 -0
- package/modules/codemirror/changes.md +42 -0
- package/modules/codemirror/changes.txt +8 -0
- package/modules/codemirror/diff +781 -0
- package/modules/codemirror/dist/index.cjs +102 -0
- package/modules/codemirror/dist/index.d.cts +52 -0
- package/modules/codemirror/dist/index.d.ts +52 -0
- package/modules/codemirror/dist/index.js +96 -0
- package/modules/codemirror/keymap/emacs.js +545 -0
- package/modules/codemirror/keymap/sublime.js +720 -0
- package/modules/codemirror/keymap/vim.js +5978 -0
- package/modules/codemirror/lib/codemirror.css +344 -0
- package/modules/codemirror/lib/codemirror.js +9884 -0
- package/modules/codemirror/mode/apl/apl.js +174 -0
- package/modules/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
- package/modules/codemirror/mode/asn.1/asn.1.js +204 -0
- package/modules/codemirror/mode/asterisk/asterisk.js +220 -0
- package/modules/codemirror/mode/brainfuck/brainfuck.js +85 -0
- package/modules/codemirror/mode/clike/clike.js +942 -0
- package/modules/codemirror/mode/clojure/clojure.js +293 -0
- package/modules/codemirror/mode/cmake/cmake.js +97 -0
- package/modules/codemirror/mode/cobol/cobol.js +255 -0
- package/modules/codemirror/mode/coffeescript/coffeescript.js +359 -0
- package/modules/codemirror/mode/commonlisp/commonlisp.js +125 -0
- package/modules/codemirror/mode/crystal/crystal.js +433 -0
- package/modules/codemirror/mode/css/css.js +862 -0
- package/modules/codemirror/mode/cypher/cypher.js +152 -0
- package/modules/codemirror/mode/d/d.js +223 -0
- package/modules/codemirror/mode/dart/dart.js +168 -0
- package/modules/codemirror/mode/diff/diff.js +47 -0
- package/modules/codemirror/mode/django/django.js +356 -0
- package/modules/codemirror/mode/dockerfile/dockerfile.js +211 -0
- package/modules/codemirror/mode/dtd/dtd.js +142 -0
- package/modules/codemirror/mode/dylan/dylan.js +352 -0
- package/modules/codemirror/mode/ebnf/ebnf.js +195 -0
- package/modules/codemirror/mode/ecl/ecl.js +206 -0
- package/modules/codemirror/mode/eiffel/eiffel.js +160 -0
- package/modules/codemirror/mode/elm/elm.js +245 -0
- package/modules/codemirror/mode/erlang/erlang.js +619 -0
- package/modules/codemirror/mode/factor/factor.js +85 -0
- package/modules/codemirror/mode/fcl/fcl.js +173 -0
- package/modules/codemirror/mode/forth/forth.js +180 -0
- package/modules/codemirror/mode/fortran/fortran.js +188 -0
- package/modules/codemirror/mode/gas/gas.js +355 -0
- package/modules/codemirror/mode/gfm/gfm.js +129 -0
- package/modules/codemirror/mode/gherkin/gherkin.js +194 -0
- package/modules/codemirror/mode/go/go.js +187 -0
- package/modules/codemirror/mode/groovy/groovy.js +245 -0
- package/modules/codemirror/mode/haml/haml.js +161 -0
- package/modules/codemirror/mode/handlebars/handlebars.js +70 -0
- package/modules/codemirror/mode/haskell/haskell.js +268 -0
- package/modules/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
- package/modules/codemirror/mode/haxe/haxe.js +515 -0
- package/modules/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
- package/modules/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
- package/modules/codemirror/mode/http/http.js +113 -0
- package/modules/codemirror/mode/idl/idl.js +290 -0
- package/modules/codemirror/mode/javascript/javascript.js +960 -0
- package/modules/codemirror/mode/jinja2/jinja2.js +193 -0
- package/modules/codemirror/mode/jsx/jsx.js +149 -0
- package/modules/codemirror/mode/julia/julia.js +390 -0
- package/modules/codemirror/mode/livescript/livescript.js +280 -0
- package/modules/codemirror/mode/lua/lua.js +160 -0
- package/modules/codemirror/mode/markdown/markdown.js +886 -0
- package/modules/codemirror/mode/mathematica/mathematica.js +176 -0
- package/modules/codemirror/mode/mbox/mbox.js +129 -0
- package/modules/codemirror/mode/meta.js +221 -0
- package/modules/codemirror/mode/mirc/mirc.js +193 -0
- package/modules/codemirror/mode/mllike/mllike.js +359 -0
- package/modules/codemirror/mode/modelica/modelica.js +245 -0
- package/modules/codemirror/mode/mscgen/mscgen.js +175 -0
- package/modules/codemirror/mode/mumps/mumps.js +148 -0
- package/modules/codemirror/mode/nginx/nginx.js +178 -0
- package/modules/codemirror/mode/nsis/nsis.js +95 -0
- package/modules/codemirror/mode/ntriples/ntriples.js +195 -0
- package/modules/codemirror/mode/octave/octave.js +139 -0
- package/modules/codemirror/mode/oz/oz.js +252 -0
- package/modules/codemirror/mode/pascal/pascal.js +136 -0
- package/modules/codemirror/mode/pegjs/pegjs.js +111 -0
- package/modules/codemirror/mode/perl/perl.js +836 -0
- package/modules/codemirror/mode/php/php.js +234 -0
- package/modules/codemirror/mode/pig/pig.js +178 -0
- package/modules/codemirror/mode/powershell/powershell.js +398 -0
- package/modules/codemirror/mode/properties/properties.js +78 -0
- package/modules/codemirror/mode/protobuf/protobuf.js +72 -0
- package/modules/codemirror/mode/pug/pug.js +591 -0
- package/modules/codemirror/mode/puppet/puppet.js +220 -0
- package/modules/codemirror/mode/python/python.js +402 -0
- package/modules/codemirror/mode/q/q.js +139 -0
- package/modules/codemirror/mode/r/r.js +190 -0
- package/modules/codemirror/mode/rpm/changes/index.html +66 -0
- package/modules/codemirror/mode/rpm/rpm.js +109 -0
- package/modules/codemirror/mode/rst/rst.js +557 -0
- package/modules/codemirror/mode/ruby/ruby.js +303 -0
- package/modules/codemirror/mode/rust/rust.js +72 -0
- package/modules/codemirror/mode/sas/sas.js +303 -0
- package/modules/codemirror/mode/sass/sass.js +459 -0
- package/modules/codemirror/mode/scheme/scheme.js +284 -0
- package/modules/codemirror/mode/shell/shell.js +168 -0
- package/modules/codemirror/mode/sieve/sieve.js +193 -0
- package/modules/codemirror/mode/slim/slim.js +575 -0
- package/modules/codemirror/mode/smalltalk/smalltalk.js +168 -0
- package/modules/codemirror/mode/smarty/smarty.js +225 -0
- package/modules/codemirror/mode/solr/solr.js +104 -0
- package/modules/codemirror/mode/soy/soy.js +665 -0
- package/modules/codemirror/mode/sparql/sparql.js +184 -0
- package/modules/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
- package/modules/codemirror/mode/sql/sql.js +529 -0
- package/modules/codemirror/mode/stex/stex.js +264 -0
- package/modules/codemirror/mode/stylus/stylus.js +775 -0
- package/modules/codemirror/mode/swift/swift.js +221 -0
- package/modules/codemirror/mode/tcl/tcl.js +140 -0
- package/modules/codemirror/mode/textile/textile.js +469 -0
- package/modules/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- package/modules/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
- package/modules/codemirror/mode/tiki/tiki.css +26 -0
- package/modules/codemirror/mode/tiki/tiki.js +312 -0
- package/modules/codemirror/mode/toml/toml.js +88 -0
- package/modules/codemirror/mode/tornado/tornado.js +68 -0
- package/modules/codemirror/mode/troff/troff.js +84 -0
- package/modules/codemirror/mode/ttcn/ttcn.js +283 -0
- package/modules/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- package/modules/codemirror/mode/turtle/turtle.js +162 -0
- package/modules/codemirror/mode/twig/twig.js +141 -0
- package/modules/codemirror/mode/vb/vb.js +275 -0
- package/modules/codemirror/mode/vbscript/vbscript.js +350 -0
- package/modules/codemirror/mode/velocity/velocity.js +202 -0
- package/modules/codemirror/mode/verilog/verilog.js +781 -0
- package/modules/codemirror/mode/vhdl/vhdl.js +189 -0
- package/modules/codemirror/mode/vue/vue.js +77 -0
- package/modules/codemirror/mode/wast/wast.js +132 -0
- package/modules/codemirror/mode/webidl/webidl.js +195 -0
- package/modules/codemirror/mode/xml/xml.js +417 -0
- package/modules/codemirror/mode/xquery/xquery.js +448 -0
- package/modules/codemirror/mode/yacas/yacas.js +204 -0
- package/modules/codemirror/mode/yaml/yaml.js +120 -0
- package/modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +72 -0
- package/modules/codemirror/mode/z80/z80.js +116 -0
- package/modules/codemirror/package.json +52 -0
- package/modules/codemirror/src/addon/runmode/codemirror-standalone.js +24 -0
- package/modules/codemirror/src/addon/runmode/codemirror.node.js +21 -0
- package/modules/codemirror/src/addon/runmode/runmode-standalone.js +2 -0
- package/modules/codemirror/src/addon/runmode/runmode.node.js +2 -0
- package/modules/codemirror/src/codemirror.js +3 -0
- package/modules/codemirror/src/display/Display.js +116 -0
- package/modules/codemirror/src/display/focus.js +50 -0
- package/modules/codemirror/src/display/gutters.js +44 -0
- package/modules/codemirror/src/display/highlight_worker.js +55 -0
- package/modules/codemirror/src/display/line_numbers.js +48 -0
- package/modules/codemirror/src/display/mode_state.js +22 -0
- package/modules/codemirror/src/display/operations.js +206 -0
- package/modules/codemirror/src/display/scroll_events.js +132 -0
- package/modules/codemirror/src/display/scrollbars.js +194 -0
- package/modules/codemirror/src/display/scrolling.js +186 -0
- package/modules/codemirror/src/display/selection.js +173 -0
- package/modules/codemirror/src/display/update_display.js +267 -0
- package/modules/codemirror/src/display/update_line.js +189 -0
- package/modules/codemirror/src/display/update_lines.js +82 -0
- package/modules/codemirror/src/display/view_tracking.js +153 -0
- package/modules/codemirror/src/edit/CodeMirror.js +217 -0
- package/modules/codemirror/src/edit/commands.js +178 -0
- package/modules/codemirror/src/edit/deleteNearSelection.js +30 -0
- package/modules/codemirror/src/edit/drop_events.js +130 -0
- package/modules/codemirror/src/edit/fromTextArea.js +61 -0
- package/modules/codemirror/src/edit/global_events.js +45 -0
- package/modules/codemirror/src/edit/key_events.js +163 -0
- package/modules/codemirror/src/edit/legacy.js +62 -0
- package/modules/codemirror/src/edit/main.js +69 -0
- package/modules/codemirror/src/edit/methods.js +555 -0
- package/modules/codemirror/src/edit/mouse_events.js +417 -0
- package/modules/codemirror/src/edit/options.js +194 -0
- package/modules/codemirror/src/edit/utils.js +7 -0
- package/modules/codemirror/src/input/#ContentEditableInput.js# +475 -0
- package/modules/codemirror/src/input/ContentEditableInput.js +546 -0
- package/modules/codemirror/src/input/TextareaInput.js +380 -0
- package/modules/codemirror/src/input/indent.js +71 -0
- package/modules/codemirror/src/input/input.js +134 -0
- package/modules/codemirror/src/input/keymap.js +147 -0
- package/modules/codemirror/src/input/keynames.js +17 -0
- package/modules/codemirror/src/input/movement.js +111 -0
- package/modules/codemirror/src/line/highlight.js +284 -0
- package/modules/codemirror/src/line/line_data.js +349 -0
- package/modules/codemirror/src/line/pos.js +40 -0
- package/modules/codemirror/src/line/saw_special_spans.js +10 -0
- package/modules/codemirror/src/line/spans.js +390 -0
- package/modules/codemirror/src/line/utils_line.js +85 -0
- package/modules/codemirror/src/measurement/position_measurement.js +702 -0
- package/modules/codemirror/src/measurement/widgets.js +26 -0
- package/modules/codemirror/src/model/Doc.js +436 -0
- package/modules/codemirror/src/model/change_measurement.js +61 -0
- package/modules/codemirror/src/model/changes.js +339 -0
- package/modules/codemirror/src/model/chunk.js +167 -0
- package/modules/codemirror/src/model/document_data.js +112 -0
- package/modules/codemirror/src/model/history.js +228 -0
- package/modules/codemirror/src/model/line_widget.js +78 -0
- package/modules/codemirror/src/model/mark_text.js +293 -0
- package/modules/codemirror/src/model/selection.js +84 -0
- package/modules/codemirror/src/model/selection_updates.js +216 -0
- package/modules/codemirror/src/modes.js +96 -0
- package/modules/codemirror/src/util/StringStream.js +90 -0
- package/modules/codemirror/src/util/bidi.js +215 -0
- package/modules/codemirror/src/util/browser.js +34 -0
- package/modules/codemirror/src/util/dom.js +111 -0
- package/modules/codemirror/src/util/event.js +103 -0
- package/modules/codemirror/src/util/feature_detection.js +84 -0
- package/modules/codemirror/src/util/misc.js +168 -0
- package/modules/codemirror/src/util/operation_group.js +72 -0
- package/modules/codemirror/theme/3024-day.css +41 -0
- package/modules/codemirror/theme/3024-night.css +39 -0
- package/modules/codemirror/theme/abbott.css +268 -0
- package/modules/codemirror/theme/abcdef.css +32 -0
- package/modules/codemirror/theme/ambiance-mobile.css +5 -0
- package/modules/codemirror/theme/ambiance.css +74 -0
- package/modules/codemirror/theme/ayu-dark.css +44 -0
- package/modules/codemirror/theme/ayu-mirage.css +45 -0
- package/modules/codemirror/theme/base16-dark.css +40 -0
- package/modules/codemirror/theme/base16-light.css +38 -0
- package/modules/codemirror/theme/bespin.css +34 -0
- package/modules/codemirror/theme/blackboard.css +32 -0
- package/modules/codemirror/theme/cobalt.css +25 -0
- package/modules/codemirror/theme/colorforth.css +33 -0
- package/modules/codemirror/theme/darcula.css +53 -0
- package/modules/codemirror/theme/dracula.css +40 -0
- package/modules/codemirror/theme/duotone-dark.css +35 -0
- package/modules/codemirror/theme/duotone-light.css +36 -0
- package/modules/codemirror/theme/eclipse.css +23 -0
- package/modules/codemirror/theme/elegant.css +13 -0
- package/modules/codemirror/theme/erlang-dark.css +34 -0
- package/modules/codemirror/theme/gruvbox-dark.css +39 -0
- package/modules/codemirror/theme/hopscotch.css +34 -0
- package/modules/codemirror/theme/icecoder.css +43 -0
- package/modules/codemirror/theme/idea.css +42 -0
- package/modules/codemirror/theme/isotope.css +34 -0
- package/modules/codemirror/theme/juejin.css +30 -0
- package/modules/codemirror/theme/lesser-dark.css +47 -0
- package/modules/codemirror/theme/liquibyte.css +95 -0
- package/modules/codemirror/theme/lucario.css +37 -0
- package/modules/codemirror/theme/material-darker.css +135 -0
- package/modules/codemirror/theme/material-ocean.css +141 -0
- package/modules/codemirror/theme/material-palenight.css +141 -0
- package/modules/codemirror/theme/material.css +141 -0
- package/modules/codemirror/theme/mbo.css +37 -0
- package/modules/codemirror/theme/mdn-like.css +46 -0
- package/modules/codemirror/theme/midnight.css +39 -0
- package/modules/codemirror/theme/monokai.css +41 -0
- package/modules/codemirror/theme/moxer.css +143 -0
- package/modules/codemirror/theme/neat.css +12 -0
- package/modules/codemirror/theme/neo.css +43 -0
- package/modules/codemirror/theme/night.css +27 -0
- package/modules/codemirror/theme/nord.css +42 -0
- package/modules/codemirror/theme/oceanic-next.css +46 -0
- package/modules/codemirror/theme/panda-syntax.css +85 -0
- package/modules/codemirror/theme/paraiso-dark.css +38 -0
- package/modules/codemirror/theme/paraiso-light.css +38 -0
- package/modules/codemirror/theme/pastel-on-dark.css +52 -0
- package/modules/codemirror/theme/railscasts.css +34 -0
- package/modules/codemirror/theme/rubyblue.css +25 -0
- package/modules/codemirror/theme/seti.css +44 -0
- package/modules/codemirror/theme/shadowfox.css +52 -0
- package/modules/codemirror/theme/solarized.css +165 -0
- package/modules/codemirror/theme/ssms.css +16 -0
- package/modules/codemirror/theme/the-matrix.css +30 -0
- package/modules/codemirror/theme/tomorrow-night-bright.css +35 -0
- package/modules/codemirror/theme/tomorrow-night-eighties.css +38 -0
- package/modules/codemirror/theme/ttcn.css +64 -0
- package/modules/codemirror/theme/twilight.css +32 -0
- package/modules/codemirror/theme/vibrant-ink.css +34 -0
- package/modules/codemirror/theme/xq-dark.css +53 -0
- package/modules/codemirror/theme/xq-light.css +43 -0
- package/modules/codemirror/theme/yeti.css +44 -0
- package/modules/codemirror/theme/yonce.css +59 -0
- package/modules/codemirror/theme/zenburn.css +37 -0
- package/modules/codemirror-emmet/README.md +56 -0
- package/modules/codemirror-emmet/dist/emmet.js +48661 -0
- package/modules/codemirror-emmet/dist/emmet.min.js +8 -0
- package/modules/codemirror-emmet/dist/emmetPlugin.js +840 -0
- package/modules/codemirror-emmet/dist/emmetPlugin.min.js +1 -0
- package/modules/codemirror-emmet/dist/index.html +46 -0
- package/modules/codemirror-emmet/editor.js +204 -0
- package/modules/codemirror-emmet/gulpfile.js +54 -0
- package/modules/codemirror-emmet/index.html +68 -0
- package/modules/codemirror-emmet/package.json +36 -0
- package/modules/codemirror-emmet/plugin.js +201 -0
- package/modules/codemirror-emmet/shim.js +19 -0
- package/modules/codemirror-emmet/vendor/almond.js +410 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/codemirror.css +270 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/codemirror.js +7339 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/css.js +701 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/htmlmixed.js +117 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/xml.js +349 -0
- package/modules/jshint/README.md +114 -0
- package/modules/jshint/dist/jshint-rhino.js +32143 -0
- package/modules/jshint/dist/jshint.js +32141 -0
- package/modules/jshint/package.json +77 -0
- package/modules/loadremote/ChangeLog +23 -0
- package/modules/loadremote/LICENSE +21 -0
- package/modules/loadremote/README.md +53 -0
- package/modules/loadremote/lib/loadremote.js +147 -0
- package/modules/loadremote/package.json +26 -0
- package/package.json +107 -0
- package/server/edit.js +54 -0
- package/server/index.js +193 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { buildLineContent } from "../line/line_data.js"
|
|
2
|
+
import { lineNumberFor } from "../line/utils_line.js"
|
|
3
|
+
import { ie, ie_version } from "../util/browser.js"
|
|
4
|
+
import { elt, classTest } from "../util/dom.js"
|
|
5
|
+
import { signalLater } from "../util/operation_group.js"
|
|
6
|
+
|
|
7
|
+
// When an aspect of a line changes, a string is added to
|
|
8
|
+
// lineView.changes. This updates the relevant part of the line's
|
|
9
|
+
// DOM structure.
|
|
10
|
+
export function updateLineForChanges(cm, lineView, lineN, dims) {
|
|
11
|
+
for (let j = 0; j < lineView.changes.length; j++) {
|
|
12
|
+
let type = lineView.changes[j]
|
|
13
|
+
if (type == "text") updateLineText(cm, lineView)
|
|
14
|
+
else if (type == "gutter") updateLineGutter(cm, lineView, lineN, dims)
|
|
15
|
+
else if (type == "class") updateLineClasses(cm, lineView)
|
|
16
|
+
else if (type == "widget") updateLineWidgets(cm, lineView, dims)
|
|
17
|
+
}
|
|
18
|
+
lineView.changes = null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Lines with gutter elements, widgets or a background class need to
|
|
22
|
+
// be wrapped, and have the extra elements added to the wrapper div
|
|
23
|
+
function ensureLineWrapped(lineView) {
|
|
24
|
+
if (lineView.node == lineView.text) {
|
|
25
|
+
lineView.node = elt("div", null, null, "position: relative")
|
|
26
|
+
if (lineView.text.parentNode)
|
|
27
|
+
lineView.text.parentNode.replaceChild(lineView.node, lineView.text)
|
|
28
|
+
lineView.node.appendChild(lineView.text)
|
|
29
|
+
if (ie && ie_version < 8) lineView.node.style.zIndex = 2
|
|
30
|
+
}
|
|
31
|
+
return lineView.node
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function updateLineBackground(cm, lineView) {
|
|
35
|
+
let cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass
|
|
36
|
+
if (cls) cls += " CodeMirror-linebackground"
|
|
37
|
+
if (lineView.background) {
|
|
38
|
+
if (cls) lineView.background.className = cls
|
|
39
|
+
else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null }
|
|
40
|
+
} else if (cls) {
|
|
41
|
+
let wrap = ensureLineWrapped(lineView)
|
|
42
|
+
lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild)
|
|
43
|
+
cm.display.input.setUneditable(lineView.background)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Wrapper around buildLineContent which will reuse the structure
|
|
48
|
+
// in display.externalMeasured when possible.
|
|
49
|
+
function getLineContent(cm, lineView) {
|
|
50
|
+
let ext = cm.display.externalMeasured
|
|
51
|
+
if (ext && ext.line == lineView.line) {
|
|
52
|
+
cm.display.externalMeasured = null
|
|
53
|
+
lineView.measure = ext.measure
|
|
54
|
+
return ext.built
|
|
55
|
+
}
|
|
56
|
+
return buildLineContent(cm, lineView)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Redraw the line's text. Interacts with the background and text
|
|
60
|
+
// classes because the mode may output tokens that influence these
|
|
61
|
+
// classes.
|
|
62
|
+
function updateLineText(cm, lineView) {
|
|
63
|
+
let cls = lineView.text.className
|
|
64
|
+
let built = getLineContent(cm, lineView)
|
|
65
|
+
if (lineView.text == lineView.node) lineView.node = built.pre
|
|
66
|
+
lineView.text.parentNode.replaceChild(built.pre, lineView.text)
|
|
67
|
+
lineView.text = built.pre
|
|
68
|
+
if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
|
|
69
|
+
lineView.bgClass = built.bgClass
|
|
70
|
+
lineView.textClass = built.textClass
|
|
71
|
+
updateLineClasses(cm, lineView)
|
|
72
|
+
} else if (cls) {
|
|
73
|
+
lineView.text.className = cls
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function updateLineClasses(cm, lineView) {
|
|
78
|
+
updateLineBackground(cm, lineView)
|
|
79
|
+
if (lineView.line.wrapClass)
|
|
80
|
+
ensureLineWrapped(lineView).className = lineView.line.wrapClass
|
|
81
|
+
else if (lineView.node != lineView.text)
|
|
82
|
+
lineView.node.className = ""
|
|
83
|
+
let textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass
|
|
84
|
+
lineView.text.className = textClass || ""
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function updateLineGutter(cm, lineView, lineN, dims) {
|
|
88
|
+
if (lineView.gutter) {
|
|
89
|
+
lineView.node.removeChild(lineView.gutter)
|
|
90
|
+
lineView.gutter = null
|
|
91
|
+
}
|
|
92
|
+
if (lineView.gutterBackground) {
|
|
93
|
+
lineView.node.removeChild(lineView.gutterBackground)
|
|
94
|
+
lineView.gutterBackground = null
|
|
95
|
+
}
|
|
96
|
+
if (lineView.line.gutterClass) {
|
|
97
|
+
let wrap = ensureLineWrapped(lineView)
|
|
98
|
+
lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
|
|
99
|
+
`left: ${cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth}px; width: ${dims.gutterTotalWidth}px`)
|
|
100
|
+
cm.display.input.setUneditable(lineView.gutterBackground)
|
|
101
|
+
wrap.insertBefore(lineView.gutterBackground, lineView.text)
|
|
102
|
+
}
|
|
103
|
+
let markers = lineView.line.gutterMarkers
|
|
104
|
+
if (cm.options.lineNumbers || markers) {
|
|
105
|
+
let wrap = ensureLineWrapped(lineView)
|
|
106
|
+
let gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", `left: ${cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth}px`)
|
|
107
|
+
gutterWrap.setAttribute("aria-hidden", "true")
|
|
108
|
+
cm.display.input.setUneditable(gutterWrap)
|
|
109
|
+
wrap.insertBefore(gutterWrap, lineView.text)
|
|
110
|
+
if (lineView.line.gutterClass)
|
|
111
|
+
gutterWrap.className += " " + lineView.line.gutterClass
|
|
112
|
+
if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
|
|
113
|
+
lineView.lineNumber = gutterWrap.appendChild(
|
|
114
|
+
elt("div", lineNumberFor(cm.options, lineN),
|
|
115
|
+
"CodeMirror-linenumber CodeMirror-gutter-elt",
|
|
116
|
+
`left: ${dims.gutterLeft["CodeMirror-linenumbers"]}px; width: ${cm.display.lineNumInnerWidth}px`))
|
|
117
|
+
if (markers) for (let k = 0; k < cm.display.gutterSpecs.length; ++k) {
|
|
118
|
+
let id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id]
|
|
119
|
+
if (found)
|
|
120
|
+
gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
|
|
121
|
+
`left: ${dims.gutterLeft[id]}px; width: ${dims.gutterWidth[id]}px`))
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function updateLineWidgets(cm, lineView, dims) {
|
|
127
|
+
if (lineView.alignable) lineView.alignable = null
|
|
128
|
+
let isWidget = classTest("CodeMirror-linewidget")
|
|
129
|
+
for (let node = lineView.node.firstChild, next; node; node = next) {
|
|
130
|
+
next = node.nextSibling
|
|
131
|
+
if (isWidget.test(node.className)) lineView.node.removeChild(node)
|
|
132
|
+
}
|
|
133
|
+
insertLineWidgets(cm, lineView, dims)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Build a line's DOM representation from scratch
|
|
137
|
+
export function buildLineElement(cm, lineView, lineN, dims) {
|
|
138
|
+
let built = getLineContent(cm, lineView)
|
|
139
|
+
lineView.text = lineView.node = built.pre
|
|
140
|
+
if (built.bgClass) lineView.bgClass = built.bgClass
|
|
141
|
+
if (built.textClass) lineView.textClass = built.textClass
|
|
142
|
+
|
|
143
|
+
updateLineClasses(cm, lineView)
|
|
144
|
+
updateLineGutter(cm, lineView, lineN, dims)
|
|
145
|
+
insertLineWidgets(cm, lineView, dims)
|
|
146
|
+
return lineView.node
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// A lineView may contain multiple logical lines (when merged by
|
|
150
|
+
// collapsed spans). The widgets for all of them need to be drawn.
|
|
151
|
+
function insertLineWidgets(cm, lineView, dims) {
|
|
152
|
+
insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)
|
|
153
|
+
if (lineView.rest) for (let i = 0; i < lineView.rest.length; i++)
|
|
154
|
+
insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
|
|
158
|
+
if (!line.widgets) return
|
|
159
|
+
let wrap = ensureLineWrapped(lineView)
|
|
160
|
+
for (let i = 0, ws = line.widgets; i < ws.length; ++i) {
|
|
161
|
+
let widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : ""))
|
|
162
|
+
if (!widget.handleMouseEvents) node.setAttribute("cm-ignore-events", "true")
|
|
163
|
+
positionLineWidget(widget, node, lineView, dims)
|
|
164
|
+
cm.display.input.setUneditable(node)
|
|
165
|
+
if (allowAbove && widget.above)
|
|
166
|
+
wrap.insertBefore(node, lineView.gutter || lineView.text)
|
|
167
|
+
else
|
|
168
|
+
wrap.appendChild(node)
|
|
169
|
+
signalLater(widget, "redraw")
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function positionLineWidget(widget, node, lineView, dims) {
|
|
174
|
+
if (widget.noHScroll) {
|
|
175
|
+
;(lineView.alignable || (lineView.alignable = [])).push(node)
|
|
176
|
+
let width = dims.wrapperWidth
|
|
177
|
+
node.style.left = dims.fixedPos + "px"
|
|
178
|
+
if (!widget.coverGutter) {
|
|
179
|
+
width -= dims.gutterTotalWidth
|
|
180
|
+
node.style.paddingLeft = dims.gutterTotalWidth + "px"
|
|
181
|
+
}
|
|
182
|
+
node.style.width = width + "px"
|
|
183
|
+
}
|
|
184
|
+
if (widget.coverGutter) {
|
|
185
|
+
node.style.zIndex = 5
|
|
186
|
+
node.style.position = "relative"
|
|
187
|
+
if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { heightAtLine } from "../line/spans.js"
|
|
2
|
+
import { getLine, lineAtHeight, updateLineHeight } from "../line/utils_line.js"
|
|
3
|
+
import { paddingTop, charWidth } from "../measurement/position_measurement.js"
|
|
4
|
+
import { ie, ie_version } from "../util/browser.js"
|
|
5
|
+
|
|
6
|
+
// Read the actual heights of the rendered lines, and update their
|
|
7
|
+
// stored heights to match.
|
|
8
|
+
export function updateHeightsInViewport(cm) {
|
|
9
|
+
let display = cm.display
|
|
10
|
+
let prevBottom = display.lineDiv.offsetTop
|
|
11
|
+
let viewTop = Math.max(0, display.scroller.getBoundingClientRect().top)
|
|
12
|
+
let oldHeight = display.lineDiv.getBoundingClientRect().top
|
|
13
|
+
let mustScroll = 0
|
|
14
|
+
for (let i = 0; i < display.view.length; i++) {
|
|
15
|
+
let cur = display.view[i], wrapping = cm.options.lineWrapping
|
|
16
|
+
let height, width = 0
|
|
17
|
+
if (cur.hidden) continue
|
|
18
|
+
oldHeight += cur.line.height
|
|
19
|
+
if (ie && ie_version < 8) {
|
|
20
|
+
let bot = cur.node.offsetTop + cur.node.offsetHeight
|
|
21
|
+
height = bot - prevBottom
|
|
22
|
+
prevBottom = bot
|
|
23
|
+
} else {
|
|
24
|
+
let box = cur.node.getBoundingClientRect()
|
|
25
|
+
height = box.bottom - box.top
|
|
26
|
+
// Check that lines don't extend past the right of the current
|
|
27
|
+
// editor width
|
|
28
|
+
if (!wrapping && cur.text.firstChild)
|
|
29
|
+
width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1
|
|
30
|
+
}
|
|
31
|
+
let diff = cur.line.height - height
|
|
32
|
+
if (diff > .005 || diff < -.005) {
|
|
33
|
+
if (oldHeight < viewTop) mustScroll -= diff
|
|
34
|
+
updateLineHeight(cur.line, height)
|
|
35
|
+
updateWidgetHeight(cur.line)
|
|
36
|
+
if (cur.rest) for (let j = 0; j < cur.rest.length; j++)
|
|
37
|
+
updateWidgetHeight(cur.rest[j])
|
|
38
|
+
}
|
|
39
|
+
if (width > cm.display.sizerWidth) {
|
|
40
|
+
let chWidth = Math.ceil(width / charWidth(cm.display))
|
|
41
|
+
if (chWidth > cm.display.maxLineLength) {
|
|
42
|
+
cm.display.maxLineLength = chWidth
|
|
43
|
+
cm.display.maxLine = cur.line
|
|
44
|
+
cm.display.maxLineChanged = true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (Math.abs(mustScroll) > 2) display.scroller.scrollTop += mustScroll
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Read and store the height of line widgets associated with the
|
|
52
|
+
// given line.
|
|
53
|
+
function updateWidgetHeight(line) {
|
|
54
|
+
if (line.widgets) for (let i = 0; i < line.widgets.length; ++i) {
|
|
55
|
+
let w = line.widgets[i], parent = w.node.parentNode
|
|
56
|
+
if (parent) w.height = parent.offsetHeight
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Compute the lines that are visible in a given viewport (defaults
|
|
61
|
+
// the current scroll position). viewport may contain top,
|
|
62
|
+
// height, and ensure (see op.scrollToPos) properties.
|
|
63
|
+
export function visibleLines(display, doc, viewport) {
|
|
64
|
+
let top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop
|
|
65
|
+
top = Math.floor(top - paddingTop(display))
|
|
66
|
+
let bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight
|
|
67
|
+
|
|
68
|
+
let from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)
|
|
69
|
+
// Ensure is a {from: {line, ch}, to: {line, ch}} object, and
|
|
70
|
+
// forces those lines into the viewport (if possible).
|
|
71
|
+
if (viewport && viewport.ensure) {
|
|
72
|
+
let ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line
|
|
73
|
+
if (ensureFrom < from) {
|
|
74
|
+
from = ensureFrom
|
|
75
|
+
to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)
|
|
76
|
+
} else if (Math.min(ensureTo, doc.lastLine()) >= to) {
|
|
77
|
+
from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)
|
|
78
|
+
to = ensureTo
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {from: from, to: Math.max(to, from + 1)}
|
|
82
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { buildViewArray } from "../line/line_data.js"
|
|
2
|
+
import { sawCollapsedSpans } from "../line/saw_special_spans.js"
|
|
3
|
+
import { visualLineEndNo, visualLineNo } from "../line/spans.js"
|
|
4
|
+
import { findViewIndex } from "../measurement/position_measurement.js"
|
|
5
|
+
import { indexOf } from "../util/misc.js"
|
|
6
|
+
|
|
7
|
+
// Updates the display.view data structure for a given change to the
|
|
8
|
+
// document. From and to are in pre-change coordinates. Lendiff is
|
|
9
|
+
// the amount of lines added or subtracted by the change. This is
|
|
10
|
+
// used for changes that span multiple lines, or change the way
|
|
11
|
+
// lines are divided into visual lines. regLineChange (below)
|
|
12
|
+
// registers single-line changes.
|
|
13
|
+
export function regChange(cm, from, to, lendiff) {
|
|
14
|
+
if (from == null) from = cm.doc.first
|
|
15
|
+
if (to == null) to = cm.doc.first + cm.doc.size
|
|
16
|
+
if (!lendiff) lendiff = 0
|
|
17
|
+
|
|
18
|
+
let display = cm.display
|
|
19
|
+
if (lendiff && to < display.viewTo &&
|
|
20
|
+
(display.updateLineNumbers == null || display.updateLineNumbers > from))
|
|
21
|
+
display.updateLineNumbers = from
|
|
22
|
+
|
|
23
|
+
cm.curOp.viewChanged = true
|
|
24
|
+
|
|
25
|
+
if (from >= display.viewTo) { // Change after
|
|
26
|
+
if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
|
|
27
|
+
resetView(cm)
|
|
28
|
+
} else if (to <= display.viewFrom) { // Change before
|
|
29
|
+
if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
|
|
30
|
+
resetView(cm)
|
|
31
|
+
} else {
|
|
32
|
+
display.viewFrom += lendiff
|
|
33
|
+
display.viewTo += lendiff
|
|
34
|
+
}
|
|
35
|
+
} else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
|
|
36
|
+
resetView(cm)
|
|
37
|
+
} else if (from <= display.viewFrom) { // Top overlap
|
|
38
|
+
let cut = viewCuttingPoint(cm, to, to + lendiff, 1)
|
|
39
|
+
if (cut) {
|
|
40
|
+
display.view = display.view.slice(cut.index)
|
|
41
|
+
display.viewFrom = cut.lineN
|
|
42
|
+
display.viewTo += lendiff
|
|
43
|
+
} else {
|
|
44
|
+
resetView(cm)
|
|
45
|
+
}
|
|
46
|
+
} else if (to >= display.viewTo) { // Bottom overlap
|
|
47
|
+
let cut = viewCuttingPoint(cm, from, from, -1)
|
|
48
|
+
if (cut) {
|
|
49
|
+
display.view = display.view.slice(0, cut.index)
|
|
50
|
+
display.viewTo = cut.lineN
|
|
51
|
+
} else {
|
|
52
|
+
resetView(cm)
|
|
53
|
+
}
|
|
54
|
+
} else { // Gap in the middle
|
|
55
|
+
let cutTop = viewCuttingPoint(cm, from, from, -1)
|
|
56
|
+
let cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)
|
|
57
|
+
if (cutTop && cutBot) {
|
|
58
|
+
display.view = display.view.slice(0, cutTop.index)
|
|
59
|
+
.concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
|
|
60
|
+
.concat(display.view.slice(cutBot.index))
|
|
61
|
+
display.viewTo += lendiff
|
|
62
|
+
} else {
|
|
63
|
+
resetView(cm)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let ext = display.externalMeasured
|
|
68
|
+
if (ext) {
|
|
69
|
+
if (to < ext.lineN)
|
|
70
|
+
ext.lineN += lendiff
|
|
71
|
+
else if (from < ext.lineN + ext.size)
|
|
72
|
+
display.externalMeasured = null
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Register a change to a single line. Type must be one of "text",
|
|
77
|
+
// "gutter", "class", "widget"
|
|
78
|
+
export function regLineChange(cm, line, type) {
|
|
79
|
+
cm.curOp.viewChanged = true
|
|
80
|
+
let display = cm.display, ext = cm.display.externalMeasured
|
|
81
|
+
if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
|
|
82
|
+
display.externalMeasured = null
|
|
83
|
+
|
|
84
|
+
if (line < display.viewFrom || line >= display.viewTo) return
|
|
85
|
+
let lineView = display.view[findViewIndex(cm, line)]
|
|
86
|
+
if (lineView.node == null) return
|
|
87
|
+
let arr = lineView.changes || (lineView.changes = [])
|
|
88
|
+
if (indexOf(arr, type) == -1) arr.push(type)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Clear the view.
|
|
92
|
+
export function resetView(cm) {
|
|
93
|
+
cm.display.viewFrom = cm.display.viewTo = cm.doc.first
|
|
94
|
+
cm.display.view = []
|
|
95
|
+
cm.display.viewOffset = 0
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function viewCuttingPoint(cm, oldN, newN, dir) {
|
|
99
|
+
let index = findViewIndex(cm, oldN), diff, view = cm.display.view
|
|
100
|
+
if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
|
|
101
|
+
return {index: index, lineN: newN}
|
|
102
|
+
let n = cm.display.viewFrom
|
|
103
|
+
for (let i = 0; i < index; i++)
|
|
104
|
+
n += view[i].size
|
|
105
|
+
if (n != oldN) {
|
|
106
|
+
if (dir > 0) {
|
|
107
|
+
if (index == view.length - 1) return null
|
|
108
|
+
diff = (n + view[index].size) - oldN
|
|
109
|
+
index++
|
|
110
|
+
} else {
|
|
111
|
+
diff = n - oldN
|
|
112
|
+
}
|
|
113
|
+
oldN += diff; newN += diff
|
|
114
|
+
}
|
|
115
|
+
while (visualLineNo(cm.doc, newN) != newN) {
|
|
116
|
+
if (index == (dir < 0 ? 0 : view.length - 1)) return null
|
|
117
|
+
newN += dir * view[index - (dir < 0 ? 1 : 0)].size
|
|
118
|
+
index += dir
|
|
119
|
+
}
|
|
120
|
+
return {index: index, lineN: newN}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Force the view to cover a given range, adding empty view element
|
|
124
|
+
// or clipping off existing ones as needed.
|
|
125
|
+
export function adjustView(cm, from, to) {
|
|
126
|
+
let display = cm.display, view = display.view
|
|
127
|
+
if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
|
|
128
|
+
display.view = buildViewArray(cm, from, to)
|
|
129
|
+
display.viewFrom = from
|
|
130
|
+
} else {
|
|
131
|
+
if (display.viewFrom > from)
|
|
132
|
+
display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view)
|
|
133
|
+
else if (display.viewFrom < from)
|
|
134
|
+
display.view = display.view.slice(findViewIndex(cm, from))
|
|
135
|
+
display.viewFrom = from
|
|
136
|
+
if (display.viewTo < to)
|
|
137
|
+
display.view = display.view.concat(buildViewArray(cm, display.viewTo, to))
|
|
138
|
+
else if (display.viewTo > to)
|
|
139
|
+
display.view = display.view.slice(0, findViewIndex(cm, to))
|
|
140
|
+
}
|
|
141
|
+
display.viewTo = to
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Count the number of lines in the view whose DOM representation is
|
|
145
|
+
// out of date (or nonexistent).
|
|
146
|
+
export function countDirtyView(cm) {
|
|
147
|
+
let view = cm.display.view, dirty = 0
|
|
148
|
+
for (let i = 0; i < view.length; i++) {
|
|
149
|
+
let lineView = view[i]
|
|
150
|
+
if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty
|
|
151
|
+
}
|
|
152
|
+
return dirty
|
|
153
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Display } from "../display/Display.js"
|
|
2
|
+
import { onFocus, onBlur } from "../display/focus.js"
|
|
3
|
+
import { maybeUpdateLineNumberWidth } from "../display/line_numbers.js"
|
|
4
|
+
import { endOperation, operation, startOperation } from "../display/operations.js"
|
|
5
|
+
import { initScrollbars } from "../display/scrollbars.js"
|
|
6
|
+
import { onScrollWheel } from "../display/scroll_events.js"
|
|
7
|
+
import { setScrollLeft, updateScrollTop } from "../display/scrolling.js"
|
|
8
|
+
import { clipPos, Pos } from "../line/pos.js"
|
|
9
|
+
import { posFromMouse } from "../measurement/position_measurement.js"
|
|
10
|
+
import { eventInWidget } from "../measurement/widgets.js"
|
|
11
|
+
import Doc from "../model/Doc.js"
|
|
12
|
+
import { attachDoc } from "../model/document_data.js"
|
|
13
|
+
import { Range } from "../model/selection.js"
|
|
14
|
+
import { extendSelection } from "../model/selection_updates.js"
|
|
15
|
+
import { ie, ie_version, mobile, webkit } from "../util/browser.js"
|
|
16
|
+
import { e_preventDefault, e_stop, on, signal, signalDOMEvent } from "../util/event.js"
|
|
17
|
+
import { copyObj, Delayed } from "../util/misc.js"
|
|
18
|
+
|
|
19
|
+
import { clearDragCursor, onDragOver, onDragStart, onDrop } from "./drop_events.js"
|
|
20
|
+
import { ensureGlobalHandlers } from "./global_events.js"
|
|
21
|
+
import { onKeyDown, onKeyPress, onKeyUp } from "./key_events.js"
|
|
22
|
+
import { clickInGutter, onContextMenu, onMouseDown } from "./mouse_events.js"
|
|
23
|
+
import { themeChanged } from "./utils.js"
|
|
24
|
+
import { defaults, optionHandlers, Init } from "./options.js"
|
|
25
|
+
|
|
26
|
+
// A CodeMirror instance represents an editor. This is the object
|
|
27
|
+
// that user code is usually dealing with.
|
|
28
|
+
|
|
29
|
+
export function CodeMirror(place, options) {
|
|
30
|
+
if (!(this instanceof CodeMirror)) return new CodeMirror(place, options)
|
|
31
|
+
|
|
32
|
+
this.options = options = options ? copyObj(options) : {}
|
|
33
|
+
// Determine effective options based on given values and defaults.
|
|
34
|
+
copyObj(defaults, options, false)
|
|
35
|
+
|
|
36
|
+
let doc = options.value
|
|
37
|
+
if (typeof doc == "string") doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction)
|
|
38
|
+
else if (options.mode) doc.modeOption = options.mode
|
|
39
|
+
this.doc = doc
|
|
40
|
+
|
|
41
|
+
let input = new CodeMirror.inputStyles[options.inputStyle](this)
|
|
42
|
+
let display = this.display = new Display(place, doc, input, options)
|
|
43
|
+
display.wrapper.CodeMirror = this
|
|
44
|
+
themeChanged(this)
|
|
45
|
+
if (options.lineWrapping)
|
|
46
|
+
this.display.wrapper.className += " CodeMirror-wrap"
|
|
47
|
+
initScrollbars(this)
|
|
48
|
+
|
|
49
|
+
this.state = {
|
|
50
|
+
keyMaps: [], // stores maps added by addKeyMap
|
|
51
|
+
overlays: [], // highlighting overlays, as added by addOverlay
|
|
52
|
+
modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
|
|
53
|
+
overwrite: false,
|
|
54
|
+
delayingBlurEvent: false,
|
|
55
|
+
focused: false,
|
|
56
|
+
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
|
|
57
|
+
pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
|
|
58
|
+
selectingText: false,
|
|
59
|
+
draggingText: false,
|
|
60
|
+
highlight: new Delayed(), // stores highlight worker timeout
|
|
61
|
+
keySeq: null, // Unfinished key sequence
|
|
62
|
+
specialChars: null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (options.autofocus && !mobile) display.input.focus()
|
|
66
|
+
|
|
67
|
+
// Override magic textarea content restore that IE sometimes does
|
|
68
|
+
// on our hidden textarea on reload
|
|
69
|
+
if (ie && ie_version < 11) setTimeout(() => this.display.input.reset(true), 20)
|
|
70
|
+
|
|
71
|
+
registerEventHandlers(this)
|
|
72
|
+
ensureGlobalHandlers()
|
|
73
|
+
|
|
74
|
+
startOperation(this)
|
|
75
|
+
this.curOp.forceUpdate = true
|
|
76
|
+
attachDoc(this, doc)
|
|
77
|
+
|
|
78
|
+
if ((options.autofocus && !mobile) || this.hasFocus())
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
if (this.hasFocus() && !this.state.focused) onFocus(this)
|
|
81
|
+
}, 20)
|
|
82
|
+
else
|
|
83
|
+
onBlur(this)
|
|
84
|
+
|
|
85
|
+
for (let opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))
|
|
86
|
+
optionHandlers[opt](this, options[opt], Init)
|
|
87
|
+
maybeUpdateLineNumberWidth(this)
|
|
88
|
+
if (options.finishInit) options.finishInit(this)
|
|
89
|
+
for (let i = 0; i < initHooks.length; ++i) initHooks[i](this)
|
|
90
|
+
endOperation(this)
|
|
91
|
+
// Suppress optimizelegibility in Webkit, since it breaks text
|
|
92
|
+
// measuring on line wrapping boundaries.
|
|
93
|
+
if (webkit && options.lineWrapping &&
|
|
94
|
+
getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
|
|
95
|
+
display.lineDiv.style.textRendering = "auto"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// The default configuration options.
|
|
99
|
+
CodeMirror.defaults = defaults
|
|
100
|
+
// Functions to run when options are changed.
|
|
101
|
+
CodeMirror.optionHandlers = optionHandlers
|
|
102
|
+
|
|
103
|
+
export default CodeMirror
|
|
104
|
+
|
|
105
|
+
// Attach the necessary event handlers when initializing the editor
|
|
106
|
+
function registerEventHandlers(cm) {
|
|
107
|
+
let d = cm.display
|
|
108
|
+
on(d.scroller, "mousedown", operation(cm, onMouseDown))
|
|
109
|
+
// Older IE's will not fire a second mousedown for a double click
|
|
110
|
+
if (ie && ie_version < 11)
|
|
111
|
+
on(d.scroller, "dblclick", operation(cm, e => {
|
|
112
|
+
if (signalDOMEvent(cm, e)) return
|
|
113
|
+
let pos = posFromMouse(cm, e)
|
|
114
|
+
if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return
|
|
115
|
+
e_preventDefault(e)
|
|
116
|
+
let word = cm.findWordAt(pos)
|
|
117
|
+
extendSelection(cm.doc, word.anchor, word.head)
|
|
118
|
+
}))
|
|
119
|
+
else
|
|
120
|
+
on(d.scroller, "dblclick", e => signalDOMEvent(cm, e) || e_preventDefault(e))
|
|
121
|
+
// Some browsers fire contextmenu *after* opening the menu, at
|
|
122
|
+
// which point we can't mess with it anymore. Context menu is
|
|
123
|
+
// handled in onMouseDown for these browsers.
|
|
124
|
+
on(d.scroller, "contextmenu", e => onContextMenu(cm, e))
|
|
125
|
+
on(d.input.getField(), "contextmenu", e => {
|
|
126
|
+
if (!d.scroller.contains(e.target)) onContextMenu(cm, e)
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
// Used to suppress mouse event handling when a touch happens
|
|
130
|
+
let touchFinished, prevTouch = {end: 0}
|
|
131
|
+
function finishTouch() {
|
|
132
|
+
if (d.activeTouch) {
|
|
133
|
+
touchFinished = setTimeout(() => d.activeTouch = null, 1000)
|
|
134
|
+
prevTouch = d.activeTouch
|
|
135
|
+
prevTouch.end = +new Date
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function isMouseLikeTouchEvent(e) {
|
|
139
|
+
if (e.touches.length != 1) return false
|
|
140
|
+
let touch = e.touches[0]
|
|
141
|
+
return touch.radiusX <= 1 && touch.radiusY <= 1
|
|
142
|
+
}
|
|
143
|
+
function farAway(touch, other) {
|
|
144
|
+
if (other.left == null) return true
|
|
145
|
+
let dx = other.left - touch.left, dy = other.top - touch.top
|
|
146
|
+
return dx * dx + dy * dy > 20 * 20
|
|
147
|
+
}
|
|
148
|
+
on(d.scroller, "touchstart", e => {
|
|
149
|
+
if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {
|
|
150
|
+
d.input.ensurePolled()
|
|
151
|
+
clearTimeout(touchFinished)
|
|
152
|
+
let now = +new Date
|
|
153
|
+
d.activeTouch = {start: now, moved: false,
|
|
154
|
+
prev: now - prevTouch.end <= 300 ? prevTouch : null}
|
|
155
|
+
if (e.touches.length == 1) {
|
|
156
|
+
d.activeTouch.left = e.touches[0].pageX
|
|
157
|
+
d.activeTouch.top = e.touches[0].pageY
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
on(d.scroller, "touchmove", () => {
|
|
162
|
+
if (d.activeTouch) d.activeTouch.moved = true
|
|
163
|
+
})
|
|
164
|
+
on(d.scroller, "touchend", e => {
|
|
165
|
+
let touch = d.activeTouch
|
|
166
|
+
if (touch && !eventInWidget(d, e) && touch.left != null &&
|
|
167
|
+
!touch.moved && new Date - touch.start < 300) {
|
|
168
|
+
let pos = cm.coordsChar(d.activeTouch, "page"), range
|
|
169
|
+
if (!touch.prev || farAway(touch, touch.prev)) // Single tap
|
|
170
|
+
range = new Range(pos, pos)
|
|
171
|
+
else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
|
|
172
|
+
range = cm.findWordAt(pos)
|
|
173
|
+
else // Triple tap
|
|
174
|
+
range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)))
|
|
175
|
+
cm.setSelection(range.anchor, range.head)
|
|
176
|
+
cm.focus()
|
|
177
|
+
e_preventDefault(e)
|
|
178
|
+
}
|
|
179
|
+
finishTouch()
|
|
180
|
+
})
|
|
181
|
+
on(d.scroller, "touchcancel", finishTouch)
|
|
182
|
+
|
|
183
|
+
// Sync scrolling between fake scrollbars and real scrollable
|
|
184
|
+
// area, ensure viewport is updated when scrolling.
|
|
185
|
+
on(d.scroller, "scroll", () => {
|
|
186
|
+
if (d.scroller.clientHeight) {
|
|
187
|
+
updateScrollTop(cm, d.scroller.scrollTop)
|
|
188
|
+
setScrollLeft(cm, d.scroller.scrollLeft, true)
|
|
189
|
+
signal(cm, "scroll", cm)
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
// Listen to wheel events in order to try and update the viewport on time.
|
|
194
|
+
on(d.scroller, "mousewheel", e => onScrollWheel(cm, e))
|
|
195
|
+
on(d.scroller, "DOMMouseScroll", e => onScrollWheel(cm, e))
|
|
196
|
+
|
|
197
|
+
// Prevent wrapper from ever scrolling
|
|
198
|
+
on(d.wrapper, "scroll", () => d.wrapper.scrollTop = d.wrapper.scrollLeft = 0)
|
|
199
|
+
|
|
200
|
+
d.dragFunctions = {
|
|
201
|
+
enter: e => {if (!signalDOMEvent(cm, e)) e_stop(e)},
|
|
202
|
+
over: e => {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e) }},
|
|
203
|
+
start: e => onDragStart(cm, e),
|
|
204
|
+
drop: operation(cm, onDrop),
|
|
205
|
+
leave: e => {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm) }}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let inp = d.input.getField()
|
|
209
|
+
on(inp, "keyup", e => onKeyUp.call(cm, e))
|
|
210
|
+
on(inp, "keydown", operation(cm, onKeyDown))
|
|
211
|
+
on(inp, "keypress", operation(cm, onKeyPress))
|
|
212
|
+
on(inp, "focus", e => onFocus(cm, e))
|
|
213
|
+
on(inp, "blur", e => onBlur(cm, e))
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
let initHooks = []
|
|
217
|
+
CodeMirror.defineInitHook = f => initHooks.push(f)
|