administrate-field-simple_mde_markdown 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +72 -0
- data/.circleci/setup-rubygems.sh +3 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +196 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +8 -0
- data/administrate-field-simple_mde_markdown.gemspec +31 -0
- data/app/assets/javascripts/administrate-field-simple_mde_markdown/application.js +6 -0
- data/app/assets/stylesheets/administrate-field-simple_mde_markdown/application.css +3 -0
- data/app/views/fields/simple_mde_markdown/_form.html.erb +6 -0
- data/app/views/fields/simple_mde_markdown/_index.html.erb +1 -0
- data/app/views/fields/simple_mde_markdown/_show.html.erb +1 -0
- data/lib/administrate/field/simple_mde_markdown.rb +31 -0
- data/node_modules/.bin/marked +1 -0
- data/node_modules/codemirror-spell-checker/.eslintrc +23 -0
- data/node_modules/codemirror-spell-checker/.npmignore +2 -0
- data/node_modules/codemirror-spell-checker/.travis.yml +18 -0
- data/node_modules/codemirror-spell-checker/CONTRIBUTING 2.md +10 -0
- data/node_modules/codemirror-spell-checker/CONTRIBUTING.md +10 -0
- data/node_modules/codemirror-spell-checker/LICENSE +22 -0
- data/node_modules/codemirror-spell-checker/README.md +50 -0
- data/node_modules/codemirror-spell-checker/bower.json +27 -0
- data/node_modules/codemirror-spell-checker/debug/.spell-checker 2.css.icloud +0 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.css +9 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.debug.js +2844 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.js +2841 -0
- data/node_modules/codemirror-spell-checker/dist/.spell-checker.min 2.css.icloud +0 -0
- data/node_modules/codemirror-spell-checker/dist/en_US.aff +201 -0
- data/node_modules/codemirror-spell-checker/dist/en_US.dic +62120 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min 2.js +7 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min.css +7 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min.js +7 -0
- data/node_modules/codemirror-spell-checker/gulpfile.js +94 -0
- data/node_modules/codemirror-spell-checker/package.json +75 -0
- data/node_modules/codemirror-spell-checker/src/css/spell-checker.css +3 -0
- data/node_modules/codemirror-spell-checker/src/data/en_US.aff +201 -0
- data/node_modules/codemirror-spell-checker/src/data/en_US.dic +62120 -0
- data/node_modules/codemirror-spell-checker/src/js/spell-checker.js +119 -0
- data/node_modules/codemirror/.package 2.json.icloud +0 -0
- data/node_modules/codemirror/AUTHORS +773 -0
- data/node_modules/codemirror/CHANGELOG.md +1486 -0
- data/node_modules/codemirror/CONTRIBUTING.md +92 -0
- data/node_modules/codemirror/LICENSE +21 -0
- data/node_modules/codemirror/README.md +49 -0
- data/node_modules/codemirror/addon/comment/comment.js +209 -0
- data/node_modules/codemirror/addon/comment/continuecomment.js +78 -0
- data/node_modules/codemirror/addon/dialog/dialog.css +32 -0
- data/node_modules/codemirror/addon/dialog/dialog.js +161 -0
- data/node_modules/codemirror/addon/display/autorefresh.js +47 -0
- data/node_modules/codemirror/addon/display/fullscreen.css +6 -0
- data/node_modules/codemirror/addon/display/fullscreen.js +41 -0
- data/node_modules/codemirror/addon/display/panel.js +127 -0
- data/node_modules/codemirror/addon/display/placeholder.js +63 -0
- data/node_modules/codemirror/addon/display/rulers.js +51 -0
- data/node_modules/codemirror/addon/edit/closebrackets.js +187 -0
- data/node_modules/codemirror/addon/edit/closetag.js +175 -0
- data/node_modules/codemirror/addon/edit/continuelist.js +89 -0
- data/node_modules/codemirror/addon/edit/matchbrackets.js +145 -0
- data/node_modules/codemirror/addon/edit/matchtags.js +66 -0
- data/node_modules/codemirror/addon/edit/trailingspace.js +27 -0
- data/node_modules/codemirror/addon/fold/brace-fold.js +105 -0
- data/node_modules/codemirror/addon/fold/comment-fold.js +59 -0
- data/node_modules/codemirror/addon/fold/foldcode.js +152 -0
- data/node_modules/codemirror/addon/fold/foldgutter.css +20 -0
- data/node_modules/codemirror/addon/fold/foldgutter.js +146 -0
- data/node_modules/codemirror/addon/fold/indent-fold.js +48 -0
- data/node_modules/codemirror/addon/fold/markdown-fold.js +49 -0
- data/node_modules/codemirror/addon/fold/xml-fold.js +184 -0
- data/node_modules/codemirror/addon/hint/anyword-hint.js +41 -0
- data/node_modules/codemirror/addon/hint/css-hint.js +60 -0
- data/node_modules/codemirror/addon/hint/html-hint.js +348 -0
- data/node_modules/codemirror/addon/hint/javascript-hint.js +157 -0
- data/node_modules/codemirror/addon/hint/show-hint.css +36 -0
- data/node_modules/codemirror/addon/hint/show-hint.js +434 -0
- data/node_modules/codemirror/addon/hint/sql-hint.js +299 -0
- data/node_modules/codemirror/addon/hint/xml-hint.js +110 -0
- data/node_modules/codemirror/addon/lint/coffeescript-lint.js +47 -0
- data/node_modules/codemirror/addon/lint/css-lint.js +40 -0
- data/node_modules/codemirror/addon/lint/html-lint.js +53 -0
- data/node_modules/codemirror/addon/lint/javascript-lint.js +63 -0
- data/node_modules/codemirror/addon/lint/json-lint.js +40 -0
- data/node_modules/codemirror/addon/lint/lint.css +73 -0
- data/node_modules/codemirror/addon/lint/lint.js +252 -0
- data/node_modules/codemirror/addon/lint/yaml-lint.js +41 -0
- data/node_modules/codemirror/addon/merge/merge.css +119 -0
- data/node_modules/codemirror/addon/merge/merge.js +1002 -0
- data/node_modules/codemirror/addon/mode/loadmode.js +64 -0
- data/node_modules/codemirror/addon/mode/multiplex.js +131 -0
- data/node_modules/codemirror/addon/mode/multiplex_test.js +33 -0
- data/node_modules/codemirror/addon/mode/overlay.js +90 -0
- data/node_modules/codemirror/addon/mode/simple.js +216 -0
- data/node_modules/codemirror/addon/runmode/colorize.js +40 -0
- data/node_modules/codemirror/addon/runmode/runmode-standalone.js +158 -0
- data/node_modules/codemirror/addon/runmode/runmode.js +72 -0
- data/node_modules/codemirror/addon/runmode/runmode.node.js +197 -0
- data/node_modules/codemirror/addon/scroll/annotatescrollbar.js +122 -0
- data/node_modules/codemirror/addon/scroll/scrollpastend.js +48 -0
- data/node_modules/codemirror/addon/scroll/simplescrollbars.css +66 -0
- data/node_modules/codemirror/addon/scroll/simplescrollbars.js +152 -0
- data/node_modules/codemirror/addon/search/jump-to-line.js +50 -0
- data/node_modules/codemirror/addon/search/match-highlighter.js +165 -0
- data/node_modules/codemirror/addon/search/matchesonscrollbar.css +8 -0
- data/node_modules/codemirror/addon/search/matchesonscrollbar.js +97 -0
- data/node_modules/codemirror/addon/search/search.js +258 -0
- data/node_modules/codemirror/addon/search/searchcursor.js +293 -0
- data/node_modules/codemirror/addon/selection/active-line.js +72 -0
- data/node_modules/codemirror/addon/selection/mark-selection.js +119 -0
- data/node_modules/codemirror/addon/selection/selection-pointer.js +98 -0
- data/node_modules/codemirror/addon/tern/tern.css +87 -0
- data/node_modules/codemirror/addon/tern/tern.js +718 -0
- data/node_modules/codemirror/addon/tern/worker.js +44 -0
- data/node_modules/codemirror/addon/wrap/hardwrap.js +145 -0
- data/node_modules/codemirror/bin/source-highlight +48 -0
- data/node_modules/codemirror/keymap/emacs.js +417 -0
- data/node_modules/codemirror/keymap/sublime.js +691 -0
- data/node_modules/codemirror/keymap/vim.js +5467 -0
- data/node_modules/codemirror/lib/codemirror.css +346 -0
- data/node_modules/codemirror/lib/codemirror.js +9698 -0
- data/node_modules/codemirror/mode/apl/apl.js +174 -0
- data/node_modules/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
- data/node_modules/codemirror/mode/asn.1/asn.1.js +204 -0
- data/node_modules/codemirror/mode/asterisk/asterisk.js +196 -0
- data/node_modules/codemirror/mode/brainfuck/brainfuck.js +85 -0
- data/node_modules/codemirror/mode/clike/clike.js +879 -0
- data/node_modules/codemirror/mode/clojure/clojure.js +292 -0
- data/node_modules/codemirror/mode/cmake/cmake.js +97 -0
- data/node_modules/codemirror/mode/cobol/cobol.js +255 -0
- data/node_modules/codemirror/mode/coffeescript/coffeescript.js +359 -0
- data/node_modules/codemirror/mode/commonlisp/commonlisp.js +124 -0
- data/node_modules/codemirror/mode/crystal/crystal.js +433 -0
- data/node_modules/codemirror/mode/css/css.js +832 -0
- data/node_modules/codemirror/mode/cypher/cypher.js +150 -0
- data/node_modules/codemirror/mode/d/d.js +223 -0
- data/node_modules/codemirror/mode/dart/dart.js +157 -0
- data/node_modules/codemirror/mode/diff/diff.js +47 -0
- data/node_modules/codemirror/mode/django/django.js +356 -0
- data/node_modules/codemirror/mode/dockerfile/dockerfile.js +211 -0
- data/node_modules/codemirror/mode/dtd/dtd.js +142 -0
- data/node_modules/codemirror/mode/dylan/dylan.js +352 -0
- data/node_modules/codemirror/mode/ebnf/ebnf.js +195 -0
- data/node_modules/codemirror/mode/ecl/ecl.js +206 -0
- data/node_modules/codemirror/mode/eiffel/eiffel.js +160 -0
- data/node_modules/codemirror/mode/elm/elm.js +205 -0
- data/node_modules/codemirror/mode/erlang/erlang.js +619 -0
- data/node_modules/codemirror/mode/factor/factor.js +85 -0
- data/node_modules/codemirror/mode/fcl/fcl.js +173 -0
- data/node_modules/codemirror/mode/forth/forth.js +180 -0
- data/node_modules/codemirror/mode/fortran/fortran.js +188 -0
- data/node_modules/codemirror/mode/gas/gas.js +345 -0
- data/node_modules/codemirror/mode/gfm/gfm.js +129 -0
- data/node_modules/codemirror/mode/gherkin/gherkin.js +178 -0
- data/node_modules/codemirror/mode/go/go.js +187 -0
- data/node_modules/codemirror/mode/groovy/groovy.js +230 -0
- data/node_modules/codemirror/mode/haml/haml.js +161 -0
- data/node_modules/codemirror/mode/handlebars/handlebars.js +66 -0
- data/node_modules/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
- data/node_modules/codemirror/mode/haskell/haskell.js +268 -0
- data/node_modules/codemirror/mode/haxe/haxe.js +515 -0
- data/node_modules/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
- data/node_modules/codemirror/mode/htmlmixed/htmlmixed.js +152 -0
- data/node_modules/codemirror/mode/http/http.js +113 -0
- data/node_modules/codemirror/mode/idl/idl.js +290 -0
- data/node_modules/codemirror/mode/javascript/javascript.js +899 -0
- data/node_modules/codemirror/mode/jinja2/jinja2.js +144 -0
- data/node_modules/codemirror/mode/jsx/jsx.js +148 -0
- data/node_modules/codemirror/mode/julia/julia.js +433 -0
- data/node_modules/codemirror/mode/livescript/livescript.js +280 -0
- data/node_modules/codemirror/mode/lua/lua.js +159 -0
- data/node_modules/codemirror/mode/markdown/markdown.js +884 -0
- data/node_modules/codemirror/mode/mathematica/mathematica.js +176 -0
- data/node_modules/codemirror/mode/mbox/mbox.js +129 -0
- data/node_modules/codemirror/mode/meta.js +217 -0
- data/node_modules/codemirror/mode/mirc/mirc.js +193 -0
- data/node_modules/codemirror/mode/mllike/mllike.js +359 -0
- data/node_modules/codemirror/mode/modelica/modelica.js +245 -0
- data/node_modules/codemirror/mode/mscgen/mscgen.js +175 -0
- data/node_modules/codemirror/mode/mumps/mumps.js +148 -0
- data/node_modules/codemirror/mode/nginx/nginx.js +178 -0
- data/node_modules/codemirror/mode/nsis/nsis.js +95 -0
- data/node_modules/codemirror/mode/ntriples/ntriples.js +195 -0
- data/node_modules/codemirror/mode/octave/octave.js +139 -0
- data/node_modules/codemirror/mode/oz/oz.js +252 -0
- data/node_modules/codemirror/mode/pascal/pascal.js +121 -0
- data/node_modules/codemirror/mode/pegjs/pegjs.js +114 -0
- data/node_modules/codemirror/mode/perl/perl.js +837 -0
- data/node_modules/codemirror/mode/php/php.js +234 -0
- data/node_modules/codemirror/mode/pig/pig.js +178 -0
- data/node_modules/codemirror/mode/powershell/powershell.js +398 -0
- data/node_modules/codemirror/mode/properties/properties 2.js +78 -0
- data/node_modules/codemirror/mode/properties/properties.js +78 -0
- data/node_modules/codemirror/mode/protobuf/protobuf.js +69 -0
- data/node_modules/codemirror/mode/pug/pug.js +591 -0
- data/node_modules/codemirror/mode/puppet/puppet.js +220 -0
- data/node_modules/codemirror/mode/python/python.js +409 -0
- data/node_modules/codemirror/mode/q/q.js +139 -0
- data/node_modules/codemirror/mode/r/r.js +190 -0
- data/node_modules/codemirror/mode/rpm/changes/index.html +66 -0
- data/node_modules/codemirror/mode/rpm/rpm.js +109 -0
- data/node_modules/codemirror/mode/rst/rst.js +557 -0
- data/node_modules/codemirror/mode/ruby/ruby.js +296 -0
- data/node_modules/codemirror/mode/rust/rust.js +72 -0
- data/node_modules/codemirror/mode/sas/sas.js +303 -0
- data/node_modules/codemirror/mode/sass/sass.js +454 -0
- data/node_modules/codemirror/mode/scheme/scheme.js +265 -0
- data/node_modules/codemirror/mode/shell/shell.js +152 -0
- data/node_modules/codemirror/mode/sieve/sieve.js +193 -0
- data/node_modules/codemirror/mode/slim/slim.js +575 -0
- data/node_modules/codemirror/mode/smalltalk/smalltalk.js +168 -0
- data/node_modules/codemirror/mode/smarty/smarty.js +225 -0
- data/node_modules/codemirror/mode/solr/solr.js +104 -0
- data/node_modules/codemirror/mode/soy/soy 2.js +359 -0
- data/node_modules/codemirror/mode/soy/soy.js +235 -0
- data/node_modules/codemirror/mode/sparql/sparql.js +180 -0
- data/node_modules/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
- data/node_modules/codemirror/mode/sql/sql.js +499 -0
- data/node_modules/codemirror/mode/stex/stex.js +264 -0
- data/node_modules/codemirror/mode/stylus/stylus.js +771 -0
- data/node_modules/codemirror/mode/swift/swift.js +219 -0
- data/node_modules/codemirror/mode/tcl/tcl.js +139 -0
- data/node_modules/codemirror/mode/textile/textile.js +469 -0
- data/node_modules/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/node_modules/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
- data/node_modules/codemirror/mode/tiki/tiki.css +26 -0
- data/node_modules/codemirror/mode/tiki/tiki.js +312 -0
- data/node_modules/codemirror/mode/toml/toml.js +88 -0
- data/node_modules/codemirror/mode/tornado/tornado.js +68 -0
- data/node_modules/codemirror/mode/troff/troff.js +84 -0
- data/node_modules/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- data/node_modules/codemirror/mode/ttcn/ttcn.js +283 -0
- data/node_modules/codemirror/mode/turtle/turtle.js +162 -0
- data/node_modules/codemirror/mode/twig/twig.js +141 -0
- data/node_modules/codemirror/mode/vb/vb.js +275 -0
- data/node_modules/codemirror/mode/vbscript/vbscript.js +350 -0
- data/node_modules/codemirror/mode/velocity/velocity.js +201 -0
- data/node_modules/codemirror/mode/verilog/verilog.js +675 -0
- data/node_modules/codemirror/mode/vhdl/vhdl.js +189 -0
- data/node_modules/codemirror/mode/vue/vue.js +77 -0
- data/node_modules/codemirror/mode/webidl/webidl.js +195 -0
- data/node_modules/codemirror/mode/xml/xml.js +402 -0
- data/node_modules/codemirror/mode/xquery/xquery.js +448 -0
- data/node_modules/codemirror/mode/yacas/yacas.js +204 -0
- data/node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +68 -0
- data/node_modules/codemirror/mode/yaml/yaml.js +120 -0
- data/node_modules/codemirror/mode/z80/z80.js +116 -0
- data/node_modules/codemirror/package.json +2395 -0
- data/node_modules/codemirror/rollup.config.js +20 -0
- data/node_modules/codemirror/src/codemirror.js +3 -0
- data/node_modules/codemirror/src/display/Display.js +106 -0
- data/node_modules/codemirror/src/display/focus.js +47 -0
- data/node_modules/codemirror/src/display/gutters.js +34 -0
- data/node_modules/codemirror/src/display/highlight_worker.js +55 -0
- data/node_modules/codemirror/src/display/line_numbers.js +48 -0
- data/node_modules/codemirror/src/display/mode_state.js +22 -0
- data/node_modules/codemirror/src/display/operations.js +205 -0
- data/node_modules/codemirror/src/display/scroll_events.js +115 -0
- data/node_modules/codemirror/src/display/scrollbars.js +193 -0
- data/node_modules/codemirror/src/display/scrolling.js +184 -0
- data/node_modules/codemirror/src/display/selection.js +158 -0
- data/node_modules/codemirror/src/display/update_display.js +260 -0
- data/node_modules/codemirror/src/display/update_line.js +188 -0
- data/node_modules/codemirror/src/display/update_lines.js +64 -0
- data/node_modules/codemirror/src/display/view_tracking.js +153 -0
- data/node_modules/codemirror/src/edit/CodeMirror.js +215 -0
- data/node_modules/codemirror/src/edit/commands.js +178 -0
- data/node_modules/codemirror/src/edit/deleteNearSelection.js +30 -0
- data/node_modules/codemirror/src/edit/drop_events.js +119 -0
- data/node_modules/codemirror/src/edit/fromTextArea.js +61 -0
- data/node_modules/codemirror/src/edit/global_events.js +42 -0
- data/node_modules/codemirror/src/edit/key_events.js +159 -0
- data/node_modules/codemirror/src/edit/legacy.js +62 -0
- data/node_modules/codemirror/src/edit/main.js +69 -0
- data/node_modules/codemirror/src/edit/methods.js +544 -0
- data/node_modules/codemirror/src/edit/mouse_events.js +407 -0
- data/node_modules/codemirror/src/edit/options.js +193 -0
- data/node_modules/codemirror/src/edit/utils.js +7 -0
- data/node_modules/codemirror/src/input/ContentEditableInput.js +527 -0
- data/node_modules/codemirror/src/input/TextareaInput.js +355 -0
- data/node_modules/codemirror/src/input/indent.js +71 -0
- data/node_modules/codemirror/src/input/input.js +135 -0
- data/node_modules/codemirror/src/input/keymap.js +148 -0
- data/node_modules/codemirror/src/input/keynames.js +17 -0
- data/node_modules/codemirror/src/input/movement.js +110 -0
- data/node_modules/codemirror/src/line/highlight.js +284 -0
- data/node_modules/codemirror/src/line/line_data.js +339 -0
- data/node_modules/codemirror/src/line/pos.js +40 -0
- data/node_modules/codemirror/src/line/saw_special_spans.js +10 -0
- data/node_modules/codemirror/src/line/spans.js +382 -0
- data/node_modules/codemirror/src/line/utils_line.js +85 -0
- data/node_modules/codemirror/src/measurement/position_measurement.js +699 -0
- data/node_modules/codemirror/src/measurement/widgets.js +26 -0
- data/node_modules/codemirror/src/model/Doc.js +432 -0
- data/node_modules/codemirror/src/model/change_measurement.js +61 -0
- data/node_modules/codemirror/src/model/changes.js +333 -0
- data/node_modules/codemirror/src/model/chunk.js +167 -0
- data/node_modules/codemirror/src/model/document_data.js +111 -0
- data/node_modules/codemirror/src/model/history.js +228 -0
- data/node_modules/codemirror/src/model/line_widget.js +78 -0
- data/node_modules/codemirror/src/model/mark_text.js +292 -0
- data/node_modules/codemirror/src/model/selection.js +84 -0
- data/node_modules/codemirror/src/model/selection_updates.js +208 -0
- data/node_modules/codemirror/src/modes.js +96 -0
- data/node_modules/codemirror/src/util/StringStream.js +90 -0
- data/node_modules/codemirror/src/util/bidi.js +214 -0
- data/node_modules/codemirror/src/util/browser.js +33 -0
- data/node_modules/codemirror/src/util/dom.js +97 -0
- data/node_modules/codemirror/src/util/event.js +103 -0
- data/node_modules/codemirror/src/util/feature_detection.js +84 -0
- data/node_modules/codemirror/src/util/misc.js +150 -0
- data/node_modules/codemirror/src/util/operation_group.js +72 -0
- data/node_modules/codemirror/theme/3024-day.css +41 -0
- data/node_modules/codemirror/theme/3024-night.css +39 -0
- data/node_modules/codemirror/theme/abcdef.css +32 -0
- data/node_modules/codemirror/theme/ambiance-mobile.css +5 -0
- data/node_modules/codemirror/theme/ambiance.css +74 -0
- data/node_modules/codemirror/theme/base16-dark.css +38 -0
- data/node_modules/codemirror/theme/base16-light.css +38 -0
- data/node_modules/codemirror/theme/bespin.css +34 -0
- data/node_modules/codemirror/theme/blackboard.css +32 -0
- data/node_modules/codemirror/theme/cobalt.css +25 -0
- data/node_modules/codemirror/theme/colorforth.css +33 -0
- data/node_modules/codemirror/theme/darcula.css +46 -0
- data/node_modules/codemirror/theme/dracula.css +40 -0
- data/node_modules/codemirror/theme/duotone-dark.css +35 -0
- data/node_modules/codemirror/theme/duotone-light.css +36 -0
- data/node_modules/codemirror/theme/eclipse.css +23 -0
- data/node_modules/codemirror/theme/elegant.css +13 -0
- data/node_modules/codemirror/theme/erlang-dark.css +34 -0
- data/node_modules/codemirror/theme/gruvbox-dark.css +37 -0
- data/node_modules/codemirror/theme/hopscotch.css +34 -0
- data/node_modules/codemirror/theme/icecoder.css +43 -0
- data/node_modules/codemirror/theme/idea.css +42 -0
- data/node_modules/codemirror/theme/isotope.css +34 -0
- data/node_modules/codemirror/theme/lesser-dark.css +47 -0
- data/node_modules/codemirror/theme/liquibyte.css +95 -0
- data/node_modules/codemirror/theme/lucario.css +37 -0
- data/node_modules/codemirror/theme/material.css +53 -0
- data/node_modules/codemirror/theme/mbo.css +37 -0
- data/node_modules/codemirror/theme/mdn-like.css +46 -0
- data/node_modules/codemirror/theme/midnight.css +43 -0
- data/node_modules/codemirror/theme/monokai.css +41 -0
- data/node_modules/codemirror/theme/neat.css +12 -0
- data/node_modules/codemirror/theme/neo.css +43 -0
- data/node_modules/codemirror/theme/night.css +27 -0
- data/node_modules/codemirror/theme/oceanic-next.css +44 -0
- data/node_modules/codemirror/theme/panda-syntax.css +85 -0
- data/node_modules/codemirror/theme/paraiso-dark.css +38 -0
- data/node_modules/codemirror/theme/paraiso-light.css +38 -0
- data/node_modules/codemirror/theme/pastel-on-dark.css +52 -0
- data/node_modules/codemirror/theme/railscasts.css +34 -0
- data/node_modules/codemirror/theme/rubyblue.css +25 -0
- data/node_modules/codemirror/theme/seti.css +44 -0
- data/node_modules/codemirror/theme/shadowfox.css +52 -0
- data/node_modules/codemirror/theme/solarized.css +168 -0
- data/node_modules/codemirror/theme/ssms.css +16 -0
- data/node_modules/codemirror/theme/the-matrix.css +30 -0
- data/node_modules/codemirror/theme/tomorrow-night-bright.css +35 -0
- data/node_modules/codemirror/theme/tomorrow-night-eighties.css +38 -0
- data/node_modules/codemirror/theme/ttcn.css +64 -0
- data/node_modules/codemirror/theme/twilight.css +32 -0
- data/node_modules/codemirror/theme/vibrant-ink.css +34 -0
- data/node_modules/codemirror/theme/xq-dark.css +53 -0
- data/node_modules/codemirror/theme/xq-light.css +43 -0
- data/node_modules/codemirror/theme/yeti.css +44 -0
- data/node_modules/codemirror/theme/zenburn.css +37 -0
- data/node_modules/marked/.editorconfig +16 -0
- data/node_modules/marked/.eslintignore +1 -0
- data/node_modules/marked/.eslintrc.json +28 -0
- data/node_modules/marked/.package 2.json.icloud +0 -0
- data/node_modules/marked/.travis.yml +47 -0
- data/node_modules/marked/Makefile +15 -0
- data/node_modules/marked/Makefile 2 +15 -0
- data/node_modules/marked/README 2.md +75 -0
- data/node_modules/marked/README.md +75 -0
- data/node_modules/marked/bin/marked +199 -0
- data/node_modules/marked/bower.json +23 -0
- data/node_modules/marked/component.json +10 -0
- data/node_modules/marked/index.js +1 -0
- data/node_modules/marked/jasmine.json +11 -0
- data/node_modules/marked/lib/marked 2.js +1604 -0
- data/node_modules/marked/lib/marked.js +1604 -0
- data/node_modules/marked/man/marked.1 +91 -0
- data/node_modules/marked/man/marked.1.txt +96 -0
- data/node_modules/marked/marked.min.js +6 -0
- data/node_modules/marked/package.json +95 -0
- data/node_modules/simplemde/.eslintrc +23 -0
- data/node_modules/simplemde/.npmignore +9 -0
- data/node_modules/simplemde/.travis.yml +18 -0
- data/node_modules/simplemde/CONTRIBUTING 2.md +10 -0
- data/node_modules/simplemde/CONTRIBUTING.md +10 -0
- data/node_modules/simplemde/LICENSE +22 -0
- data/node_modules/simplemde/README.md +331 -0
- data/node_modules/simplemde/bower.json +23 -0
- data/node_modules/simplemde/debug/.simplemde 2.css.icloud +0 -0
- data/node_modules/simplemde/debug/simplemde.css +676 -0
- data/node_modules/simplemde/debug/simplemde.debug.js +17023 -0
- data/node_modules/simplemde/debug/simplemde.js +17019 -0
- data/node_modules/simplemde/dist/simplemde.min.css +7 -0
- data/node_modules/simplemde/dist/simplemde.min.js +15 -0
- data/node_modules/simplemde/gulpfile.js +96 -0
- data/node_modules/simplemde/package.json +73 -0
- data/node_modules/simplemde/src/css/simplemde.css +328 -0
- data/node_modules/simplemde/src/js/codemirror/tablist 2.js +44 -0
- data/node_modules/simplemde/src/js/codemirror/tablist.js +44 -0
- data/node_modules/simplemde/src/js/simplemde.js +2028 -0
- data/node_modules/typo-js/README.md +45 -0
- data/node_modules/typo-js/dictionaries/en_US/.en_US 2.dic.icloud +0 -0
- data/node_modules/typo-js/dictionaries/en_US/README.md +7 -0
- data/node_modules/typo-js/dictionaries/en_US/en_US.aff +201 -0
- data/node_modules/typo-js/dictionaries/en_US/en_US.dic +62120 -0
- data/node_modules/typo-js/package.json +56 -0
- data/node_modules/typo-js/typo.js +931 -0
- data/package-lock.json +40 -0
- data/package.json +7 -0
- metadata +557 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
import buble from 'rollup-plugin-buble';
|
2
|
+
|
3
|
+
export default {
|
4
|
+
input: "src/codemirror.js",
|
5
|
+
output: {
|
6
|
+
banner: `// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
7
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
8
|
+
|
9
|
+
// This is CodeMirror (https://codemirror.net), a code editor
|
10
|
+
// implemented in JavaScript on top of the browser's DOM.
|
11
|
+
//
|
12
|
+
// You can find some technical background for some of the code below
|
13
|
+
// at http://marijnhaverbeke.nl/blog/#cm-internals .
|
14
|
+
`,
|
15
|
+
format: "umd",
|
16
|
+
file: "lib/codemirror.js",
|
17
|
+
name: "CodeMirror"
|
18
|
+
},
|
19
|
+
plugins: [ buble({namedFunctionExpressions: false}) ]
|
20
|
+
};
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import { gecko, ie, ie_version, mobile, webkit } from "../util/browser.js"
|
2
|
+
import { elt, eltP } from "../util/dom.js"
|
3
|
+
import { scrollerGap } from "../util/misc.js"
|
4
|
+
|
5
|
+
// The display handles the DOM integration, both for input reading
|
6
|
+
// and content drawing. It holds references to DOM nodes and
|
7
|
+
// display-related state.
|
8
|
+
|
9
|
+
export function Display(place, doc, input) {
|
10
|
+
let d = this
|
11
|
+
this.input = input
|
12
|
+
|
13
|
+
// Covers bottom-right square when both scrollbars are present.
|
14
|
+
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler")
|
15
|
+
d.scrollbarFiller.setAttribute("cm-not-content", "true")
|
16
|
+
// Covers bottom of gutter when coverGutterNextToScrollbar is on
|
17
|
+
// and h scrollbar is present.
|
18
|
+
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler")
|
19
|
+
d.gutterFiller.setAttribute("cm-not-content", "true")
|
20
|
+
// Will contain the actual code, positioned to cover the viewport.
|
21
|
+
d.lineDiv = eltP("div", null, "CodeMirror-code")
|
22
|
+
// Elements are added to these to represent selection and cursors.
|
23
|
+
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1")
|
24
|
+
d.cursorDiv = elt("div", null, "CodeMirror-cursors")
|
25
|
+
// A visibility: hidden element used to find the size of things.
|
26
|
+
d.measure = elt("div", null, "CodeMirror-measure")
|
27
|
+
// When lines outside of the viewport are measured, they are drawn in this.
|
28
|
+
d.lineMeasure = elt("div", null, "CodeMirror-measure")
|
29
|
+
// Wraps everything that needs to exist inside the vertically-padded coordinate system
|
30
|
+
d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
|
31
|
+
null, "position: relative; outline: none")
|
32
|
+
let lines = eltP("div", [d.lineSpace], "CodeMirror-lines")
|
33
|
+
// Moved around its parent to cover visible view.
|
34
|
+
d.mover = elt("div", [lines], null, "position: relative")
|
35
|
+
// Set to the height of the document, allowing scrolling.
|
36
|
+
d.sizer = elt("div", [d.mover], "CodeMirror-sizer")
|
37
|
+
d.sizerWidth = null
|
38
|
+
// Behavior of elts with overflow: auto and padding is
|
39
|
+
// inconsistent across browsers. This is used to ensure the
|
40
|
+
// scrollable area is big enough.
|
41
|
+
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;")
|
42
|
+
// Will contain the gutters, if any.
|
43
|
+
d.gutters = elt("div", null, "CodeMirror-gutters")
|
44
|
+
d.lineGutter = null
|
45
|
+
// Actual scrollable element.
|
46
|
+
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll")
|
47
|
+
d.scroller.setAttribute("tabIndex", "-1")
|
48
|
+
// The element in which the editor lives.
|
49
|
+
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror")
|
50
|
+
|
51
|
+
// Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
|
52
|
+
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 }
|
53
|
+
if (!webkit && !(gecko && mobile)) d.scroller.draggable = true
|
54
|
+
|
55
|
+
if (place) {
|
56
|
+
if (place.appendChild) place.appendChild(d.wrapper)
|
57
|
+
else place(d.wrapper)
|
58
|
+
}
|
59
|
+
|
60
|
+
// Current rendered range (may be bigger than the view window).
|
61
|
+
d.viewFrom = d.viewTo = doc.first
|
62
|
+
d.reportedViewFrom = d.reportedViewTo = doc.first
|
63
|
+
// Information about the rendered lines.
|
64
|
+
d.view = []
|
65
|
+
d.renderedView = null
|
66
|
+
// Holds info about a single rendered line when it was rendered
|
67
|
+
// for measurement, while not in view.
|
68
|
+
d.externalMeasured = null
|
69
|
+
// Empty space (in pixels) above the view
|
70
|
+
d.viewOffset = 0
|
71
|
+
d.lastWrapHeight = d.lastWrapWidth = 0
|
72
|
+
d.updateLineNumbers = null
|
73
|
+
|
74
|
+
d.nativeBarWidth = d.barHeight = d.barWidth = 0
|
75
|
+
d.scrollbarsClipped = false
|
76
|
+
|
77
|
+
// Used to only resize the line number gutter when necessary (when
|
78
|
+
// the amount of lines crosses a boundary that makes its width change)
|
79
|
+
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null
|
80
|
+
// Set to true when a non-horizontal-scrolling line widget is
|
81
|
+
// added. As an optimization, line widget aligning is skipped when
|
82
|
+
// this is false.
|
83
|
+
d.alignWidgets = false
|
84
|
+
|
85
|
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
|
86
|
+
|
87
|
+
// Tracks the maximum line length so that the horizontal scrollbar
|
88
|
+
// can be kept static when scrolling.
|
89
|
+
d.maxLine = null
|
90
|
+
d.maxLineLength = 0
|
91
|
+
d.maxLineChanged = false
|
92
|
+
|
93
|
+
// Used for measuring wheel scrolling granularity
|
94
|
+
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null
|
95
|
+
|
96
|
+
// True when shift is held down.
|
97
|
+
d.shift = false
|
98
|
+
|
99
|
+
// Used to track whether anything happened since the context menu
|
100
|
+
// was opened.
|
101
|
+
d.selForContextMenu = null
|
102
|
+
|
103
|
+
d.activeTouch = null
|
104
|
+
|
105
|
+
input.init(d)
|
106
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { restartBlink } from "./selection.js"
|
2
|
+
import { webkit } from "../util/browser.js"
|
3
|
+
import { addClass, rmClass } from "../util/dom.js"
|
4
|
+
import { signal } from "../util/event.js"
|
5
|
+
|
6
|
+
export function ensureFocus(cm) {
|
7
|
+
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) }
|
8
|
+
}
|
9
|
+
|
10
|
+
export function delayBlurEvent(cm) {
|
11
|
+
cm.state.delayingBlurEvent = true
|
12
|
+
setTimeout(() => { if (cm.state.delayingBlurEvent) {
|
13
|
+
cm.state.delayingBlurEvent = false
|
14
|
+
onBlur(cm)
|
15
|
+
} }, 100)
|
16
|
+
}
|
17
|
+
|
18
|
+
export function onFocus(cm, e) {
|
19
|
+
if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false
|
20
|
+
|
21
|
+
if (cm.options.readOnly == "nocursor") return
|
22
|
+
if (!cm.state.focused) {
|
23
|
+
signal(cm, "focus", cm, e)
|
24
|
+
cm.state.focused = true
|
25
|
+
addClass(cm.display.wrapper, "CodeMirror-focused")
|
26
|
+
// This test prevents this from firing when a context
|
27
|
+
// menu is closed (since the input reset would kill the
|
28
|
+
// select-all detection hack)
|
29
|
+
if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
|
30
|
+
cm.display.input.reset()
|
31
|
+
if (webkit) setTimeout(() => cm.display.input.reset(true), 20) // Issue #1730
|
32
|
+
}
|
33
|
+
cm.display.input.receivedFocus()
|
34
|
+
}
|
35
|
+
restartBlink(cm)
|
36
|
+
}
|
37
|
+
export function onBlur(cm, e) {
|
38
|
+
if (cm.state.delayingBlurEvent) return
|
39
|
+
|
40
|
+
if (cm.state.focused) {
|
41
|
+
signal(cm, "blur", cm, e)
|
42
|
+
cm.state.focused = false
|
43
|
+
rmClass(cm.display.wrapper, "CodeMirror-focused")
|
44
|
+
}
|
45
|
+
clearInterval(cm.display.blinker)
|
46
|
+
setTimeout(() => { if (!cm.state.focused) cm.display.shift = false }, 150)
|
47
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { elt, removeChildren } from "../util/dom.js"
|
2
|
+
import { indexOf } from "../util/misc.js"
|
3
|
+
|
4
|
+
import { updateGutterSpace } from "./update_display.js"
|
5
|
+
|
6
|
+
// Rebuild the gutter elements, ensure the margin to the left of the
|
7
|
+
// code matches their width.
|
8
|
+
export function updateGutters(cm) {
|
9
|
+
let gutters = cm.display.gutters, specs = cm.options.gutters
|
10
|
+
removeChildren(gutters)
|
11
|
+
let i = 0
|
12
|
+
for (; i < specs.length; ++i) {
|
13
|
+
let gutterClass = specs[i]
|
14
|
+
let gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass))
|
15
|
+
if (gutterClass == "CodeMirror-linenumbers") {
|
16
|
+
cm.display.lineGutter = gElt
|
17
|
+
gElt.style.width = (cm.display.lineNumWidth || 1) + "px"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
gutters.style.display = i ? "" : "none"
|
21
|
+
updateGutterSpace(cm)
|
22
|
+
}
|
23
|
+
|
24
|
+
// Make sure the gutters options contains the element
|
25
|
+
// "CodeMirror-linenumbers" when the lineNumbers option is true.
|
26
|
+
export function setGuttersForLineNumbers(options) {
|
27
|
+
let found = indexOf(options.gutters, "CodeMirror-linenumbers")
|
28
|
+
if (found == -1 && options.lineNumbers) {
|
29
|
+
options.gutters = options.gutters.concat(["CodeMirror-linenumbers"])
|
30
|
+
} else if (found > -1 && !options.lineNumbers) {
|
31
|
+
options.gutters = options.gutters.slice(0)
|
32
|
+
options.gutters.splice(found, 1)
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { getContextBefore, highlightLine, processLine } from "../line/highlight.js"
|
2
|
+
import { copyState } from "../modes.js"
|
3
|
+
import { bind } from "../util/misc.js"
|
4
|
+
|
5
|
+
import { runInOp } from "./operations.js"
|
6
|
+
import { regLineChange } from "./view_tracking.js"
|
7
|
+
|
8
|
+
// HIGHLIGHT WORKER
|
9
|
+
|
10
|
+
export function startWorker(cm, time) {
|
11
|
+
if (cm.doc.highlightFrontier < cm.display.viewTo)
|
12
|
+
cm.state.highlight.set(time, bind(highlightWorker, cm))
|
13
|
+
}
|
14
|
+
|
15
|
+
function highlightWorker(cm) {
|
16
|
+
let doc = cm.doc
|
17
|
+
if (doc.highlightFrontier >= cm.display.viewTo) return
|
18
|
+
let end = +new Date + cm.options.workTime
|
19
|
+
let context = getContextBefore(cm, doc.highlightFrontier)
|
20
|
+
let changedLines = []
|
21
|
+
|
22
|
+
doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), line => {
|
23
|
+
if (context.line >= cm.display.viewFrom) { // Visible
|
24
|
+
let oldStyles = line.styles
|
25
|
+
let resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null
|
26
|
+
let highlighted = highlightLine(cm, line, context, true)
|
27
|
+
if (resetState) context.state = resetState
|
28
|
+
line.styles = highlighted.styles
|
29
|
+
let oldCls = line.styleClasses, newCls = highlighted.classes
|
30
|
+
if (newCls) line.styleClasses = newCls
|
31
|
+
else if (oldCls) line.styleClasses = null
|
32
|
+
let ischange = !oldStyles || oldStyles.length != line.styles.length ||
|
33
|
+
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass)
|
34
|
+
for (let i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]
|
35
|
+
if (ischange) changedLines.push(context.line)
|
36
|
+
line.stateAfter = context.save()
|
37
|
+
context.nextLine()
|
38
|
+
} else {
|
39
|
+
if (line.text.length <= cm.options.maxHighlightLength)
|
40
|
+
processLine(cm, line.text, context)
|
41
|
+
line.stateAfter = context.line % 5 == 0 ? context.save() : null
|
42
|
+
context.nextLine()
|
43
|
+
}
|
44
|
+
if (+new Date > end) {
|
45
|
+
startWorker(cm, cm.options.workDelay)
|
46
|
+
return true
|
47
|
+
}
|
48
|
+
})
|
49
|
+
doc.highlightFrontier = context.line
|
50
|
+
doc.modeFrontier = Math.max(doc.modeFrontier, context.line)
|
51
|
+
if (changedLines.length) runInOp(cm, () => {
|
52
|
+
for (let i = 0; i < changedLines.length; i++)
|
53
|
+
regLineChange(cm, changedLines[i], "text")
|
54
|
+
})
|
55
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { lineNumberFor } from "../line/utils_line.js"
|
2
|
+
import { compensateForHScroll } from "../measurement/position_measurement.js"
|
3
|
+
import { elt } from "../util/dom.js"
|
4
|
+
|
5
|
+
import { updateGutterSpace } from "./update_display.js"
|
6
|
+
|
7
|
+
// Re-align line numbers and gutter marks to compensate for
|
8
|
+
// horizontal scrolling.
|
9
|
+
export function alignHorizontally(cm) {
|
10
|
+
let display = cm.display, view = display.view
|
11
|
+
if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return
|
12
|
+
let comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft
|
13
|
+
let gutterW = display.gutters.offsetWidth, left = comp + "px"
|
14
|
+
for (let i = 0; i < view.length; i++) if (!view[i].hidden) {
|
15
|
+
if (cm.options.fixedGutter) {
|
16
|
+
if (view[i].gutter)
|
17
|
+
view[i].gutter.style.left = left
|
18
|
+
if (view[i].gutterBackground)
|
19
|
+
view[i].gutterBackground.style.left = left
|
20
|
+
}
|
21
|
+
let align = view[i].alignable
|
22
|
+
if (align) for (let j = 0; j < align.length; j++)
|
23
|
+
align[j].style.left = left
|
24
|
+
}
|
25
|
+
if (cm.options.fixedGutter)
|
26
|
+
display.gutters.style.left = (comp + gutterW) + "px"
|
27
|
+
}
|
28
|
+
|
29
|
+
// Used to ensure that the line number gutter is still the right
|
30
|
+
// size for the current document size. Returns true when an update
|
31
|
+
// is needed.
|
32
|
+
export function maybeUpdateLineNumberWidth(cm) {
|
33
|
+
if (!cm.options.lineNumbers) return false
|
34
|
+
let doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display
|
35
|
+
if (last.length != display.lineNumChars) {
|
36
|
+
let test = display.measure.appendChild(elt("div", [elt("div", last)],
|
37
|
+
"CodeMirror-linenumber CodeMirror-gutter-elt"))
|
38
|
+
let innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW
|
39
|
+
display.lineGutter.style.width = ""
|
40
|
+
display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1
|
41
|
+
display.lineNumWidth = display.lineNumInnerWidth + padding
|
42
|
+
display.lineNumChars = display.lineNumInnerWidth ? last.length : -1
|
43
|
+
display.lineGutter.style.width = display.lineNumWidth + "px"
|
44
|
+
updateGutterSpace(cm)
|
45
|
+
return true
|
46
|
+
}
|
47
|
+
return false
|
48
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { getMode } from "../modes.js"
|
2
|
+
|
3
|
+
import { startWorker } from "./highlight_worker.js"
|
4
|
+
import { regChange } from "./view_tracking.js"
|
5
|
+
|
6
|
+
// Used to get the editor into a consistent state again when options change.
|
7
|
+
|
8
|
+
export function loadMode(cm) {
|
9
|
+
cm.doc.mode = getMode(cm.options, cm.doc.modeOption)
|
10
|
+
resetModeState(cm)
|
11
|
+
}
|
12
|
+
|
13
|
+
export function resetModeState(cm) {
|
14
|
+
cm.doc.iter(line => {
|
15
|
+
if (line.stateAfter) line.stateAfter = null
|
16
|
+
if (line.styles) line.styles = null
|
17
|
+
})
|
18
|
+
cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first
|
19
|
+
startWorker(cm, 100)
|
20
|
+
cm.state.modeGen++
|
21
|
+
if (cm.curOp) regChange(cm)
|
22
|
+
}
|
@@ -0,0 +1,205 @@
|
|
1
|
+
import { clipPos } from "../line/pos.js"
|
2
|
+
import { findMaxLine } from "../line/spans.js"
|
3
|
+
import { displayWidth, measureChar, scrollGap } from "../measurement/position_measurement.js"
|
4
|
+
import { signal } from "../util/event.js"
|
5
|
+
import { activeElt } from "../util/dom.js"
|
6
|
+
import { finishOperation, pushOperation } from "../util/operation_group.js"
|
7
|
+
|
8
|
+
import { ensureFocus } from "./focus.js"
|
9
|
+
import { measureForScrollbars, updateScrollbars } from "./scrollbars.js"
|
10
|
+
import { restartBlink } from "./selection.js"
|
11
|
+
import { maybeScrollWindow, scrollPosIntoView, setScrollLeft, setScrollTop } from "./scrolling.js"
|
12
|
+
import { DisplayUpdate, maybeClipScrollbars, postUpdateDisplay, setDocumentHeight, updateDisplayIfNeeded } from "./update_display.js"
|
13
|
+
import { updateHeightsInViewport } from "./update_lines.js"
|
14
|
+
|
15
|
+
// Operations are used to wrap a series of changes to the editor
|
16
|
+
// state in such a way that each change won't have to update the
|
17
|
+
// cursor and display (which would be awkward, slow, and
|
18
|
+
// error-prone). Instead, display updates are batched and then all
|
19
|
+
// combined and executed at once.
|
20
|
+
|
21
|
+
let nextOpId = 0
|
22
|
+
// Start a new operation.
|
23
|
+
export function startOperation(cm) {
|
24
|
+
cm.curOp = {
|
25
|
+
cm: cm,
|
26
|
+
viewChanged: false, // Flag that indicates that lines might need to be redrawn
|
27
|
+
startHeight: cm.doc.height, // Used to detect need to update scrollbar
|
28
|
+
forceUpdate: false, // Used to force a redraw
|
29
|
+
updateInput: null, // Whether to reset the input textarea
|
30
|
+
typing: false, // Whether this reset should be careful to leave existing text (for compositing)
|
31
|
+
changeObjs: null, // Accumulated changes, for firing change events
|
32
|
+
cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
|
33
|
+
cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
|
34
|
+
selectionChanged: false, // Whether the selection needs to be redrawn
|
35
|
+
updateMaxLine: false, // Set when the widest line needs to be determined anew
|
36
|
+
scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
|
37
|
+
scrollToPos: null, // Used to scroll to a specific position
|
38
|
+
focus: false,
|
39
|
+
id: ++nextOpId // Unique ID
|
40
|
+
}
|
41
|
+
pushOperation(cm.curOp)
|
42
|
+
}
|
43
|
+
|
44
|
+
// Finish an operation, updating the display and signalling delayed events
|
45
|
+
export function endOperation(cm) {
|
46
|
+
let op = cm.curOp
|
47
|
+
if (op) finishOperation(op, group => {
|
48
|
+
for (let i = 0; i < group.ops.length; i++)
|
49
|
+
group.ops[i].cm.curOp = null
|
50
|
+
endOperations(group)
|
51
|
+
})
|
52
|
+
}
|
53
|
+
|
54
|
+
// The DOM updates done when an operation finishes are batched so
|
55
|
+
// that the minimum number of relayouts are required.
|
56
|
+
function endOperations(group) {
|
57
|
+
let ops = group.ops
|
58
|
+
for (let i = 0; i < ops.length; i++) // Read DOM
|
59
|
+
endOperation_R1(ops[i])
|
60
|
+
for (let i = 0; i < ops.length; i++) // Write DOM (maybe)
|
61
|
+
endOperation_W1(ops[i])
|
62
|
+
for (let i = 0; i < ops.length; i++) // Read DOM
|
63
|
+
endOperation_R2(ops[i])
|
64
|
+
for (let i = 0; i < ops.length; i++) // Write DOM (maybe)
|
65
|
+
endOperation_W2(ops[i])
|
66
|
+
for (let i = 0; i < ops.length; i++) // Read DOM
|
67
|
+
endOperation_finish(ops[i])
|
68
|
+
}
|
69
|
+
|
70
|
+
function endOperation_R1(op) {
|
71
|
+
let cm = op.cm, display = cm.display
|
72
|
+
maybeClipScrollbars(cm)
|
73
|
+
if (op.updateMaxLine) findMaxLine(cm)
|
74
|
+
|
75
|
+
op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
|
76
|
+
op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
|
77
|
+
op.scrollToPos.to.line >= display.viewTo) ||
|
78
|
+
display.maxLineChanged && cm.options.lineWrapping
|
79
|
+
op.update = op.mustUpdate &&
|
80
|
+
new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate)
|
81
|
+
}
|
82
|
+
|
83
|
+
function endOperation_W1(op) {
|
84
|
+
op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update)
|
85
|
+
}
|
86
|
+
|
87
|
+
function endOperation_R2(op) {
|
88
|
+
let cm = op.cm, display = cm.display
|
89
|
+
if (op.updatedDisplay) updateHeightsInViewport(cm)
|
90
|
+
|
91
|
+
op.barMeasure = measureForScrollbars(cm)
|
92
|
+
|
93
|
+
// If the max line changed since it was last measured, measure it,
|
94
|
+
// and ensure the document's width matches it.
|
95
|
+
// updateDisplay_W2 will use these properties to do the actual resizing
|
96
|
+
if (display.maxLineChanged && !cm.options.lineWrapping) {
|
97
|
+
op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3
|
98
|
+
cm.display.sizerWidth = op.adjustWidthTo
|
99
|
+
op.barMeasure.scrollWidth =
|
100
|
+
Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth)
|
101
|
+
op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm))
|
102
|
+
}
|
103
|
+
|
104
|
+
if (op.updatedDisplay || op.selectionChanged)
|
105
|
+
op.preparedSelection = display.input.prepareSelection()
|
106
|
+
}
|
107
|
+
|
108
|
+
function endOperation_W2(op) {
|
109
|
+
let cm = op.cm
|
110
|
+
|
111
|
+
if (op.adjustWidthTo != null) {
|
112
|
+
cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"
|
113
|
+
if (op.maxScrollLeft < cm.doc.scrollLeft)
|
114
|
+
setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true)
|
115
|
+
cm.display.maxLineChanged = false
|
116
|
+
}
|
117
|
+
|
118
|
+
let takeFocus = op.focus && op.focus == activeElt()
|
119
|
+
if (op.preparedSelection)
|
120
|
+
cm.display.input.showSelection(op.preparedSelection, takeFocus)
|
121
|
+
if (op.updatedDisplay || op.startHeight != cm.doc.height)
|
122
|
+
updateScrollbars(cm, op.barMeasure)
|
123
|
+
if (op.updatedDisplay)
|
124
|
+
setDocumentHeight(cm, op.barMeasure)
|
125
|
+
|
126
|
+
if (op.selectionChanged) restartBlink(cm)
|
127
|
+
|
128
|
+
if (cm.state.focused && op.updateInput)
|
129
|
+
cm.display.input.reset(op.typing)
|
130
|
+
if (takeFocus) ensureFocus(op.cm)
|
131
|
+
}
|
132
|
+
|
133
|
+
function endOperation_finish(op) {
|
134
|
+
let cm = op.cm, display = cm.display, doc = cm.doc
|
135
|
+
|
136
|
+
if (op.updatedDisplay) postUpdateDisplay(cm, op.update)
|
137
|
+
|
138
|
+
// Abort mouse wheel delta measurement, when scrolling explicitly
|
139
|
+
if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
|
140
|
+
display.wheelStartX = display.wheelStartY = null
|
141
|
+
|
142
|
+
// Propagate the scroll position to the actual DOM scroller
|
143
|
+
if (op.scrollTop != null) setScrollTop(cm, op.scrollTop, op.forceScroll)
|
144
|
+
|
145
|
+
if (op.scrollLeft != null) setScrollLeft(cm, op.scrollLeft, true, true)
|
146
|
+
// If we need to scroll a specific position into view, do so.
|
147
|
+
if (op.scrollToPos) {
|
148
|
+
let rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
|
149
|
+
clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin)
|
150
|
+
maybeScrollWindow(cm, rect)
|
151
|
+
}
|
152
|
+
|
153
|
+
// Fire events for markers that are hidden/unidden by editing or
|
154
|
+
// undoing
|
155
|
+
let hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers
|
156
|
+
if (hidden) for (let i = 0; i < hidden.length; ++i)
|
157
|
+
if (!hidden[i].lines.length) signal(hidden[i], "hide")
|
158
|
+
if (unhidden) for (let i = 0; i < unhidden.length; ++i)
|
159
|
+
if (unhidden[i].lines.length) signal(unhidden[i], "unhide")
|
160
|
+
|
161
|
+
if (display.wrapper.offsetHeight)
|
162
|
+
doc.scrollTop = cm.display.scroller.scrollTop
|
163
|
+
|
164
|
+
// Fire change events, and delayed event handlers
|
165
|
+
if (op.changeObjs)
|
166
|
+
signal(cm, "changes", cm, op.changeObjs)
|
167
|
+
if (op.update)
|
168
|
+
op.update.finish()
|
169
|
+
}
|
170
|
+
|
171
|
+
// Run the given function in an operation
|
172
|
+
export function runInOp(cm, f) {
|
173
|
+
if (cm.curOp) return f()
|
174
|
+
startOperation(cm)
|
175
|
+
try { return f() }
|
176
|
+
finally { endOperation(cm) }
|
177
|
+
}
|
178
|
+
// Wraps a function in an operation. Returns the wrapped function.
|
179
|
+
export function operation(cm, f) {
|
180
|
+
return function() {
|
181
|
+
if (cm.curOp) return f.apply(cm, arguments)
|
182
|
+
startOperation(cm)
|
183
|
+
try { return f.apply(cm, arguments) }
|
184
|
+
finally { endOperation(cm) }
|
185
|
+
}
|
186
|
+
}
|
187
|
+
// Used to add methods to editor and doc instances, wrapping them in
|
188
|
+
// operations.
|
189
|
+
export function methodOp(f) {
|
190
|
+
return function() {
|
191
|
+
if (this.curOp) return f.apply(this, arguments)
|
192
|
+
startOperation(this)
|
193
|
+
try { return f.apply(this, arguments) }
|
194
|
+
finally { endOperation(this) }
|
195
|
+
}
|
196
|
+
}
|
197
|
+
export function docMethodOp(f) {
|
198
|
+
return function() {
|
199
|
+
let cm = this.cm
|
200
|
+
if (!cm || cm.curOp) return f.apply(this, arguments)
|
201
|
+
startOperation(cm)
|
202
|
+
try { return f.apply(this, arguments) }
|
203
|
+
finally { endOperation(cm) }
|
204
|
+
}
|
205
|
+
}
|