administrate-field-simple_mde_markdown 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.
- 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,92 @@
|
|
1
|
+
# How to contribute
|
2
|
+
|
3
|
+
- [Getting help](#getting-help)
|
4
|
+
- [Submitting bug reports](#submitting-bug-reports)
|
5
|
+
- [Contributing code](#contributing-code)
|
6
|
+
|
7
|
+
## Getting help
|
8
|
+
|
9
|
+
Community discussion, questions, and informal bug reporting is done on the
|
10
|
+
[discuss.CodeMirror forum](http://discuss.codemirror.net).
|
11
|
+
|
12
|
+
## Submitting bug reports
|
13
|
+
|
14
|
+
The preferred way to report bugs is to use the
|
15
|
+
[GitHub issue tracker](http://github.com/codemirror/CodeMirror/issues). Before
|
16
|
+
reporting a bug, read these pointers.
|
17
|
+
|
18
|
+
**Note:** The issue tracker is for *bugs*, not requests for help. Questions
|
19
|
+
should be asked on the
|
20
|
+
[discuss.CodeMirror forum](http://discuss.codemirror.net) instead.
|
21
|
+
|
22
|
+
### Reporting bugs effectively
|
23
|
+
|
24
|
+
- CodeMirror is maintained by volunteers. They don't owe you anything, so be
|
25
|
+
polite. Reports with an indignant or belligerent tone tend to be moved to the
|
26
|
+
bottom of the pile.
|
27
|
+
|
28
|
+
- Include information about **the browser in which the problem occurred**. Even
|
29
|
+
if you tested several browsers, and the problem occurred in all of them,
|
30
|
+
mention this fact in the bug report. Also include browser version numbers and
|
31
|
+
the operating system that you're on.
|
32
|
+
|
33
|
+
- Mention which release of CodeMirror you're using. Preferably, try also with
|
34
|
+
the current development snapshot, to ensure the problem has not already been
|
35
|
+
fixed.
|
36
|
+
|
37
|
+
- Mention very precisely what went wrong. "X is broken" is not a good bug
|
38
|
+
report. What did you expect to happen? What happened instead? Describe the
|
39
|
+
exact steps a maintainer has to take to make the problem occur. We can not
|
40
|
+
fix something that we can not observe.
|
41
|
+
|
42
|
+
- If the problem can not be reproduced in any of the demos included in the
|
43
|
+
CodeMirror distribution, please provide an HTML document that demonstrates
|
44
|
+
the problem. The best way to do this is to go to
|
45
|
+
[jsbin.com](http://jsbin.com/ihunin/edit), enter it there, press save, and
|
46
|
+
include the resulting link in your bug report.
|
47
|
+
|
48
|
+
## Contributing code
|
49
|
+
|
50
|
+
Note that we are not accepting any new addons or modes into the main
|
51
|
+
distribution. If you've written such a module, please distribute it as
|
52
|
+
a separate NPM package.
|
53
|
+
|
54
|
+
- Make sure you have a [GitHub Account](https://github.com/signup/free)
|
55
|
+
- Fork [CodeMirror](https://github.com/codemirror/CodeMirror/)
|
56
|
+
([how to fork a repo](https://help.github.com/articles/fork-a-repo))
|
57
|
+
- Make your changes
|
58
|
+
- If your changes are easy to test or likely to regress, add tests.
|
59
|
+
Tests for the core go into `test/test.js`, some modes have their own
|
60
|
+
test suite under `mode/XXX/test.js`. Feel free to add new test
|
61
|
+
suites to modes that don't have one yet (be sure to link the new
|
62
|
+
tests into `test/index.html`).
|
63
|
+
- Follow the general code style of the rest of the project (see
|
64
|
+
below). Run `bin/lint` to verify that the linter is happy.
|
65
|
+
- Make sure all tests pass. Visit `test/index.html` in your browser to
|
66
|
+
run them.
|
67
|
+
- Submit a pull request
|
68
|
+
([how to create a pull request](https://help.github.com/articles/fork-a-repo)).
|
69
|
+
Don't put more than one feature/fix in a single pull request.
|
70
|
+
|
71
|
+
By contributing code to CodeMirror you
|
72
|
+
|
73
|
+
- agree to license the contributed code under CodeMirror's [MIT
|
74
|
+
license](https://codemirror.net/LICENSE).
|
75
|
+
|
76
|
+
- confirm that you have the right to contribute and license the code
|
77
|
+
in question. (Either you hold all rights on the code, or the rights
|
78
|
+
holder has explicitly granted the right to use it like this,
|
79
|
+
through a compatible open source license or through a direct
|
80
|
+
agreement with you.)
|
81
|
+
|
82
|
+
### Coding standards
|
83
|
+
|
84
|
+
- 2 spaces per indentation level, no tabs.
|
85
|
+
|
86
|
+
- Note that the linter (`bin/lint`) which is run after each commit
|
87
|
+
complains about unused variables and functions. Prefix their names
|
88
|
+
with an underscore to muffle it.
|
89
|
+
|
90
|
+
- CodeMirror does *not* follow JSHint or JSLint prescribed style.
|
91
|
+
Patches that try to 'fix' code to pass one of these linters will be
|
92
|
+
unceremoniously discarded.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# CodeMirror
|
2
|
+
|
3
|
+
[](https://travis-ci.org/codemirror/CodeMirror)
|
4
|
+
[](https://www.npmjs.org/package/codemirror)
|
5
|
+
[](https://gitter.im/codemirror/CodeMirror)
|
6
|
+
[Funding status: ](https://marijnhaverbeke.nl/fund/)
|
7
|
+
|
8
|
+
CodeMirror is a versatile text editor implemented in JavaScript for
|
9
|
+
the browser. It is specialized for editing code, and comes with over
|
10
|
+
100 language modes and various addons that implement more advanced
|
11
|
+
editing functionality. Every language comes with fully-featured code
|
12
|
+
and syntax highlighting to help with reading and editing complex code.
|
13
|
+
|
14
|
+
A rich programming API and a CSS theming system are available for
|
15
|
+
customizing CodeMirror to fit your application, and extending it with
|
16
|
+
new functionality.
|
17
|
+
|
18
|
+
You can find more information (and the
|
19
|
+
[manual](https://codemirror.net/doc/manual.html)) on the [project
|
20
|
+
page](https://codemirror.net). For questions and discussion, use the
|
21
|
+
[discussion forum](https://discuss.codemirror.net/).
|
22
|
+
|
23
|
+
See
|
24
|
+
[CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)
|
25
|
+
for contributing guidelines.
|
26
|
+
|
27
|
+
The CodeMirror community aims to be welcoming to everybody. We use the
|
28
|
+
[Contributor Covenant
|
29
|
+
(1.1)](http://contributor-covenant.org/version/1/1/0/) as our code of
|
30
|
+
conduct.
|
31
|
+
|
32
|
+
### Installation
|
33
|
+
|
34
|
+
Either get the [zip file](https://codemirror.net/codemirror.zip) with
|
35
|
+
the latest version, or make sure you have [Node](https://nodejs.org/)
|
36
|
+
installed and run:
|
37
|
+
|
38
|
+
npm install codemirror
|
39
|
+
|
40
|
+
**NOTE**: This is the source repository for the library, and not the
|
41
|
+
distribution channel. Cloning it is not the recommended way to install
|
42
|
+
the library, and will in fact not work unless you also run the build
|
43
|
+
step.
|
44
|
+
|
45
|
+
### Quickstart
|
46
|
+
|
47
|
+
To build the project, make sure you have Node.js installed (at least version 6)
|
48
|
+
and then `npm install`. To run, just open `index.html` in your
|
49
|
+
browser (you don't need to run a webserver). Run the tests with `npm test`.
|
@@ -0,0 +1,209 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
var noOptions = {};
|
15
|
+
var nonWS = /[^\s\u00a0]/;
|
16
|
+
var Pos = CodeMirror.Pos;
|
17
|
+
|
18
|
+
function firstNonWS(str) {
|
19
|
+
var found = str.search(nonWS);
|
20
|
+
return found == -1 ? 0 : found;
|
21
|
+
}
|
22
|
+
|
23
|
+
CodeMirror.commands.toggleComment = function(cm) {
|
24
|
+
cm.toggleComment();
|
25
|
+
};
|
26
|
+
|
27
|
+
CodeMirror.defineExtension("toggleComment", function(options) {
|
28
|
+
if (!options) options = noOptions;
|
29
|
+
var cm = this;
|
30
|
+
var minLine = Infinity, ranges = this.listSelections(), mode = null;
|
31
|
+
for (var i = ranges.length - 1; i >= 0; i--) {
|
32
|
+
var from = ranges[i].from(), to = ranges[i].to();
|
33
|
+
if (from.line >= minLine) continue;
|
34
|
+
if (to.line >= minLine) to = Pos(minLine, 0);
|
35
|
+
minLine = from.line;
|
36
|
+
if (mode == null) {
|
37
|
+
if (cm.uncomment(from, to, options)) mode = "un";
|
38
|
+
else { cm.lineComment(from, to, options); mode = "line"; }
|
39
|
+
} else if (mode == "un") {
|
40
|
+
cm.uncomment(from, to, options);
|
41
|
+
} else {
|
42
|
+
cm.lineComment(from, to, options);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
});
|
46
|
+
|
47
|
+
// Rough heuristic to try and detect lines that are part of multi-line string
|
48
|
+
function probablyInsideString(cm, pos, line) {
|
49
|
+
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
|
50
|
+
}
|
51
|
+
|
52
|
+
function getMode(cm, pos) {
|
53
|
+
var mode = cm.getMode()
|
54
|
+
return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
|
55
|
+
}
|
56
|
+
|
57
|
+
CodeMirror.defineExtension("lineComment", function(from, to, options) {
|
58
|
+
if (!options) options = noOptions;
|
59
|
+
var self = this, mode = getMode(self, from);
|
60
|
+
var firstLine = self.getLine(from.line);
|
61
|
+
if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
|
62
|
+
|
63
|
+
var commentString = options.lineComment || mode.lineComment;
|
64
|
+
if (!commentString) {
|
65
|
+
if (options.blockCommentStart || mode.blockCommentStart) {
|
66
|
+
options.fullLines = true;
|
67
|
+
self.blockComment(from, to, options);
|
68
|
+
}
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
|
72
|
+
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
|
73
|
+
var pad = options.padding == null ? " " : options.padding;
|
74
|
+
var blankLines = options.commentBlankLines || from.line == to.line;
|
75
|
+
|
76
|
+
self.operation(function() {
|
77
|
+
if (options.indent) {
|
78
|
+
var baseString = null;
|
79
|
+
for (var i = from.line; i < end; ++i) {
|
80
|
+
var line = self.getLine(i);
|
81
|
+
var whitespace = line.slice(0, firstNonWS(line));
|
82
|
+
if (baseString == null || baseString.length > whitespace.length) {
|
83
|
+
baseString = whitespace;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
for (var i = from.line; i < end; ++i) {
|
87
|
+
var line = self.getLine(i), cut = baseString.length;
|
88
|
+
if (!blankLines && !nonWS.test(line)) continue;
|
89
|
+
if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
|
90
|
+
self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
|
91
|
+
}
|
92
|
+
} else {
|
93
|
+
for (var i = from.line; i < end; ++i) {
|
94
|
+
if (blankLines || nonWS.test(self.getLine(i)))
|
95
|
+
self.replaceRange(commentString + pad, Pos(i, 0));
|
96
|
+
}
|
97
|
+
}
|
98
|
+
});
|
99
|
+
});
|
100
|
+
|
101
|
+
CodeMirror.defineExtension("blockComment", function(from, to, options) {
|
102
|
+
if (!options) options = noOptions;
|
103
|
+
var self = this, mode = getMode(self, from);
|
104
|
+
var startString = options.blockCommentStart || mode.blockCommentStart;
|
105
|
+
var endString = options.blockCommentEnd || mode.blockCommentEnd;
|
106
|
+
if (!startString || !endString) {
|
107
|
+
if ((options.lineComment || mode.lineComment) && options.fullLines != false)
|
108
|
+
self.lineComment(from, to, options);
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
|
112
|
+
|
113
|
+
var end = Math.min(to.line, self.lastLine());
|
114
|
+
if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
|
115
|
+
|
116
|
+
var pad = options.padding == null ? " " : options.padding;
|
117
|
+
if (from.line > end) return;
|
118
|
+
|
119
|
+
self.operation(function() {
|
120
|
+
if (options.fullLines != false) {
|
121
|
+
var lastLineHasText = nonWS.test(self.getLine(end));
|
122
|
+
self.replaceRange(pad + endString, Pos(end));
|
123
|
+
self.replaceRange(startString + pad, Pos(from.line, 0));
|
124
|
+
var lead = options.blockCommentLead || mode.blockCommentLead;
|
125
|
+
if (lead != null) for (var i = from.line + 1; i <= end; ++i)
|
126
|
+
if (i != end || lastLineHasText)
|
127
|
+
self.replaceRange(lead + pad, Pos(i, 0));
|
128
|
+
} else {
|
129
|
+
self.replaceRange(endString, to);
|
130
|
+
self.replaceRange(startString, from);
|
131
|
+
}
|
132
|
+
});
|
133
|
+
});
|
134
|
+
|
135
|
+
CodeMirror.defineExtension("uncomment", function(from, to, options) {
|
136
|
+
if (!options) options = noOptions;
|
137
|
+
var self = this, mode = getMode(self, from);
|
138
|
+
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
|
139
|
+
|
140
|
+
// Try finding line comments
|
141
|
+
var lineString = options.lineComment || mode.lineComment, lines = [];
|
142
|
+
var pad = options.padding == null ? " " : options.padding, didSomething;
|
143
|
+
lineComment: {
|
144
|
+
if (!lineString) break lineComment;
|
145
|
+
for (var i = start; i <= end; ++i) {
|
146
|
+
var line = self.getLine(i);
|
147
|
+
var found = line.indexOf(lineString);
|
148
|
+
if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
|
149
|
+
if (found == -1 && nonWS.test(line)) break lineComment;
|
150
|
+
if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
|
151
|
+
lines.push(line);
|
152
|
+
}
|
153
|
+
self.operation(function() {
|
154
|
+
for (var i = start; i <= end; ++i) {
|
155
|
+
var line = lines[i - start];
|
156
|
+
var pos = line.indexOf(lineString), endPos = pos + lineString.length;
|
157
|
+
if (pos < 0) continue;
|
158
|
+
if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
|
159
|
+
didSomething = true;
|
160
|
+
self.replaceRange("", Pos(i, pos), Pos(i, endPos));
|
161
|
+
}
|
162
|
+
});
|
163
|
+
if (didSomething) return true;
|
164
|
+
}
|
165
|
+
|
166
|
+
// Try block comments
|
167
|
+
var startString = options.blockCommentStart || mode.blockCommentStart;
|
168
|
+
var endString = options.blockCommentEnd || mode.blockCommentEnd;
|
169
|
+
if (!startString || !endString) return false;
|
170
|
+
var lead = options.blockCommentLead || mode.blockCommentLead;
|
171
|
+
var startLine = self.getLine(start), open = startLine.indexOf(startString)
|
172
|
+
if (open == -1) return false
|
173
|
+
var endLine = end == start ? startLine : self.getLine(end)
|
174
|
+
var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
|
175
|
+
var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
|
176
|
+
if (close == -1 ||
|
177
|
+
!/comment/.test(self.getTokenTypeAt(insideStart)) ||
|
178
|
+
!/comment/.test(self.getTokenTypeAt(insideEnd)) ||
|
179
|
+
self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
|
180
|
+
return false;
|
181
|
+
|
182
|
+
// Avoid killing block comments completely outside the selection.
|
183
|
+
// Positions of the last startString before the start of the selection, and the first endString after it.
|
184
|
+
var lastStart = startLine.lastIndexOf(startString, from.ch);
|
185
|
+
var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
|
186
|
+
if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
|
187
|
+
// Positions of the first endString after the end of the selection, and the last startString before it.
|
188
|
+
firstEnd = endLine.indexOf(endString, to.ch);
|
189
|
+
var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
|
190
|
+
lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
|
191
|
+
if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
|
192
|
+
|
193
|
+
self.operation(function() {
|
194
|
+
self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
|
195
|
+
Pos(end, close + endString.length));
|
196
|
+
var openEnd = open + startString.length;
|
197
|
+
if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
|
198
|
+
self.replaceRange("", Pos(start, open), Pos(start, openEnd));
|
199
|
+
if (lead) for (var i = start + 1; i <= end; ++i) {
|
200
|
+
var line = self.getLine(i), found = line.indexOf(lead);
|
201
|
+
if (found == -1 || nonWS.test(line.slice(0, found))) continue;
|
202
|
+
var foundEnd = found + lead.length;
|
203
|
+
if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
|
204
|
+
self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
|
205
|
+
}
|
206
|
+
});
|
207
|
+
return true;
|
208
|
+
});
|
209
|
+
});
|
@@ -0,0 +1,78 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
function continueComment(cm) {
|
13
|
+
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
14
|
+
var ranges = cm.listSelections(), mode, inserts = [];
|
15
|
+
for (var i = 0; i < ranges.length; i++) {
|
16
|
+
var pos = ranges[i].head
|
17
|
+
if (!/\bcomment\b/.test(cm.getTokenTypeAt(pos))) return CodeMirror.Pass;
|
18
|
+
var modeHere = cm.getModeAt(pos)
|
19
|
+
if (!mode) mode = modeHere;
|
20
|
+
else if (mode != modeHere) return CodeMirror.Pass;
|
21
|
+
|
22
|
+
var insert = null;
|
23
|
+
if (mode.blockCommentStart && mode.blockCommentContinue) {
|
24
|
+
var line = cm.getLine(pos.line).slice(0, pos.ch)
|
25
|
+
var end = line.lastIndexOf(mode.blockCommentEnd), found
|
26
|
+
if (end != -1 && end == pos.ch - mode.blockCommentEnd.length) {
|
27
|
+
// Comment ended, don't continue it
|
28
|
+
} else if ((found = line.lastIndexOf(mode.blockCommentStart)) > -1 && found > end) {
|
29
|
+
insert = line.slice(0, found)
|
30
|
+
if (/\S/.test(insert)) {
|
31
|
+
insert = ""
|
32
|
+
for (var j = 0; j < found; ++j) insert += " "
|
33
|
+
}
|
34
|
+
} else if ((found = line.indexOf(mode.blockCommentContinue)) > -1 && !/\S/.test(line.slice(0, found))) {
|
35
|
+
insert = line.slice(0, found)
|
36
|
+
}
|
37
|
+
if (insert != null) insert += mode.blockCommentContinue
|
38
|
+
}
|
39
|
+
if (insert == null && mode.lineComment && continueLineCommentEnabled(cm)) {
|
40
|
+
var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment);
|
41
|
+
if (found > -1) {
|
42
|
+
insert = line.slice(0, found);
|
43
|
+
if (/\S/.test(insert)) insert = null;
|
44
|
+
else insert += mode.lineComment + line.slice(found + mode.lineComment.length).match(/^\s*/)[0];
|
45
|
+
}
|
46
|
+
}
|
47
|
+
if (insert == null) return CodeMirror.Pass;
|
48
|
+
inserts[i] = "\n" + insert;
|
49
|
+
}
|
50
|
+
|
51
|
+
cm.operation(function() {
|
52
|
+
for (var i = ranges.length - 1; i >= 0; i--)
|
53
|
+
cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+insert");
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
57
|
+
function continueLineCommentEnabled(cm) {
|
58
|
+
var opt = cm.getOption("continueComments");
|
59
|
+
if (opt && typeof opt == "object")
|
60
|
+
return opt.continueLineComment !== false;
|
61
|
+
return true;
|
62
|
+
}
|
63
|
+
|
64
|
+
CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
|
65
|
+
if (prev && prev != CodeMirror.Init)
|
66
|
+
cm.removeKeyMap("continueComment");
|
67
|
+
if (val) {
|
68
|
+
var key = "Enter";
|
69
|
+
if (typeof val == "string")
|
70
|
+
key = val;
|
71
|
+
else if (typeof val == "object" && val.key)
|
72
|
+
key = val.key;
|
73
|
+
var map = {name: "continueComment"};
|
74
|
+
map[key] = continueComment;
|
75
|
+
cm.addKeyMap(map);
|
76
|
+
}
|
77
|
+
});
|
78
|
+
});
|