locomotivecms 4.1.1 → 4.2.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +4 -3
- data/Rakefile +4 -0
- data/app/api/locomotive/api.rb +1 -1
- data/app/assets/config/locomotive_manifest.js +2 -0
- data/app/assets/javascripts/locomotive.js +2 -2
- data/app/assets/stylesheets/locomotive/account.scss +0 -1
- data/app/assets/stylesheets/locomotive/application.scss +0 -1
- data/app/assets/stylesheets/locomotive/live_editing_error.scss +0 -1
- data/app/assets/stylesheets/locomotive/live_editing_iframe.scss +0 -1
- data/app/controllers/locomotive/base_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/authorization_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +1 -1
- data/app/controllers/locomotive/errors_controller.rb +1 -1
- data/app/controllers/locomotive/my_account_controller.rb +1 -1
- data/app/controllers/locomotive/passwords_controller.rb +3 -1
- data/app/controllers/locomotive/registrations_controller.rb +3 -1
- data/app/controllers/locomotive/sessions_controller.rb +3 -1
- data/app/controllers/locomotive/sites_controller.rb +1 -1
- data/app/helpers/locomotive/base_helper.rb +2 -2
- data/app/helpers/locomotive/custom_fields_helper.rb +2 -2
- data/app/helpers/locomotive/shared/activities_helper.rb +1 -1
- data/app/inputs/locomotive/api_key_input.rb +1 -1
- data/app/mailers/locomotive/notifications.rb +1 -1
- data/app/models/locomotive/account.rb +1 -1
- data/app/models/locomotive/concerns/account/api_key.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/csv.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/slug.rb +5 -5
- data/app/models/locomotive/concerns/content_type/entry_template.rb +3 -3
- data/app/models/locomotive/concerns/page/templatized.rb +1 -1
- data/app/models/locomotive/concerns/shared/json_attribute.rb +21 -2
- data/app/models/locomotive/concerns/site/routes.rb +1 -1
- data/app/models/locomotive/content_entry.rb +2 -2
- data/app/models/locomotive/page.rb +3 -3
- data/app/models/locomotive/section.rb +1 -1
- data/app/models/locomotive/snippet.rb +1 -1
- data/app/models/locomotive/translation.rb +1 -1
- data/app/services/locomotive/content_entry_import_service.rb +1 -1
- data/app/services/locomotive/content_entry_service.rb +2 -2
- data/app/services/locomotive/content_type_service.rb +13 -3
- data/app/services/locomotive/custom_field_service.rb +2 -2
- data/app/services/locomotive/editor_service.rb +1 -1
- data/app/uploaders/locomotive/base_uploader.rb +0 -10
- data/app/views/locomotive/dashboard/_activity.html.slim +1 -1
- data/app/views/locomotive/page_content/_edit.json.jbuilder +50 -0
- data/app/views/locomotive/page_content/edit.html.erb +1 -1
- data/app/views/locomotive/page_content/edit.json.jbuilder +52 -50
- data/config/initializers/devise.rb +5 -2
- data/lib/generators/locomotive/install/templates/locomotive.rb +0 -5
- data/lib/locomotive/action_controller/responder.rb +1 -1
- data/lib/locomotive/configuration.rb +2 -2
- data/lib/locomotive/dependencies.rb +0 -2
- data/lib/locomotive/engine.rb +14 -2
- data/lib/locomotive/mongoid/patches.rb +25 -65
- data/lib/locomotive/steam/services/api_entry_submission_service.rb +1 -0
- data/lib/locomotive/version.rb +1 -1
- data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/comment.js +203 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/autorefresh.js +47 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/panel.js +112 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/placeholder.js +62 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/rulers.js +51 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closebrackets.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/comment-fold.js +59 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldcode.js +150 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/show-hint.js +437 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/sql-hint.js +271 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/html-lint.js +46 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/lint.js +239 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/merge/merge.js +773 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/simple.js +213 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.node.js +179 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/annotatescrollbar.js +118 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/scrollpastend.js +48 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/simplescrollbars.js +152 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/jump-to-line.js +49 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/match-highlighter.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/search.js +249 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/active-line.js +74 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/tern.js +701 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/worker.js +44 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/wrap/hardwrap.js +144 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/emacs.js +412 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/sublime.js +580 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/vim.js +5065 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/apl.js +174 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asciiarmor.js +73 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asn.1.js +204 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asterisk.js +196 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/brainfuck.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/clike.js +786 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/clojure.js +306 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cmake.js +97 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cobol.js +255 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/coffeescript.js +355 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/commonlisp.js +123 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/crystal.js +391 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/css.js +825 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cypher.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/d.js +218 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dart.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/diff.js +47 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/django.js +356 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dockerfile.js +79 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dtd.js +142 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dylan.js +344 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ebnf.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ecl.js +206 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/eiffel.js +160 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/elm.js +205 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/erlang.js +618 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/factor.js +83 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/fcl.js +173 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/forth.js +180 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/fortran.js +188 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gas.js +345 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gfm.js +130 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gherkin.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/go.js +185 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/groovy.js +230 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haml.js +161 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/handlebars.js +62 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell-literate.js +43 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell.js +267 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haxe.js +515 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlmixed.js +152 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/http.js +113 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/idl.js +290 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jade.js +590 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/javascript.js +748 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jinja2.js +142 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jsx.js +147 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/julia.js +392 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/livescript.js +280 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/lua.js +159 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/markdown.js +797 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mathematica.js +176 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mbox.js +129 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mirc.js +193 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mllike.js +205 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/modelica.js +245 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mscgen.js +169 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mumps.js +148 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/nginx.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/nsis.js +95 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ntriples.js +186 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/octave.js +135 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/oz.js +252 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pascal.js +109 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pegjs.js +114 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/perl.js +837 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/php.js +234 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pig.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/powershell.js +396 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/properties.js +78 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/protobuf.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/puppet.js +220 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/python.js +340 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/q.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/r.js +164 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rpm.js +109 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rst.js +557 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ruby.js +285 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rust.js +71 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sas.js +315 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sass.js +414 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/scheme.js +249 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/shell.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sieve.js +193 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/slim.js +575 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/smalltalk.js +168 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/smarty.js +225 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/solr.js +104 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/soy.js +199 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sparql.js +180 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/spreadsheet.js +112 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sql.js +413 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/stex.js +251 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/stylus.js +769 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/swift.js +202 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tcl.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/textile.js +469 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tiddlywiki.js +308 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tiki.js +312 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/toml.js +88 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tornado.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/troff.js +84 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn-cfg.js +214 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn.js +283 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/turtle.js +162 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/twig.js +141 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vb.js +276 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vbscript.js +350 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/velocity.js +201 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/verilog.js +537 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vhdl.js +189 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vue.js +69 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/webidl.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/xml.js +394 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/xquery.js +437 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yacas.js +204 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml-frontmatter.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml.js +117 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/z80.js +116 -0
- data/vendor/assets/javascripts/locomotive/codemirror.js +8922 -0
- data/vendor/assets/javascripts/locomotive/select2.js +436 -175
- data/vendor/assets/javascripts/locomotive/wysihtml5x-toolbar.js +1346 -564
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/dialog/dialog.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/display/fullscreen.css +6 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/fold/foldgutter.css +20 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/hint/show-hint.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/lint/lint.css +73 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/merge/merge.css +113 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/tern/tern.css +87 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiddlywiki.css +14 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiki.css +26 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-day.css +41 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-night.css +39 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/abcdef.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance-mobile.css +5 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance.css +74 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-dark.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-light.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/bespin.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/blackboard.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/cobalt.css +25 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/colorforth.css +33 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/dracula.css +41 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/eclipse.css +23 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/elegant.css +13 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/erlang-dark.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/hopscotch.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/icecoder.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/isotope.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/lesser-dark.css +47 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/liquibyte.css +95 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/material.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/mbo.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/mdn-like.css +46 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/midnight.css +45 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/monokai.css +36 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/neat.css +12 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/neo.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/night.css +27 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-dark.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-light.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/pastel-on-dark.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/railscasts.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/rubyblue.css +25 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/seti.css +44 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/solarized.css +169 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/the-matrix.css +30 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-bright.css +35 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-eighties.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ttcn.css +64 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/twilight.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/vibrant-ink.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-dark.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-light.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/yeti.css +44 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/zenburn.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror.css +347 -0
- data/vendor/assets/stylesheets/locomotive/select2.css +3 -6
- metadata +349 -128
@@ -0,0 +1,195 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
var defaults = {
|
13
|
+
pairs: "()[]{}''\"\"",
|
14
|
+
triples: "",
|
15
|
+
explode: "[]{}"
|
16
|
+
};
|
17
|
+
|
18
|
+
var Pos = CodeMirror.Pos;
|
19
|
+
|
20
|
+
CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
|
21
|
+
if (old && old != CodeMirror.Init) {
|
22
|
+
cm.removeKeyMap(keyMap);
|
23
|
+
cm.state.closeBrackets = null;
|
24
|
+
}
|
25
|
+
if (val) {
|
26
|
+
cm.state.closeBrackets = val;
|
27
|
+
cm.addKeyMap(keyMap);
|
28
|
+
}
|
29
|
+
});
|
30
|
+
|
31
|
+
function getOption(conf, name) {
|
32
|
+
if (name == "pairs" && typeof conf == "string") return conf;
|
33
|
+
if (typeof conf == "object" && conf[name] != null) return conf[name];
|
34
|
+
return defaults[name];
|
35
|
+
}
|
36
|
+
|
37
|
+
var bind = defaults.pairs + "`";
|
38
|
+
var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
|
39
|
+
for (var i = 0; i < bind.length; i++)
|
40
|
+
keyMap["'" + bind.charAt(i) + "'"] = handler(bind.charAt(i));
|
41
|
+
|
42
|
+
function handler(ch) {
|
43
|
+
return function(cm) { return handleChar(cm, ch); };
|
44
|
+
}
|
45
|
+
|
46
|
+
function getConfig(cm) {
|
47
|
+
var deflt = cm.state.closeBrackets;
|
48
|
+
if (!deflt) return null;
|
49
|
+
var mode = cm.getModeAt(cm.getCursor());
|
50
|
+
return mode.closeBrackets || deflt;
|
51
|
+
}
|
52
|
+
|
53
|
+
function handleBackspace(cm) {
|
54
|
+
var conf = getConfig(cm);
|
55
|
+
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
56
|
+
|
57
|
+
var pairs = getOption(conf, "pairs");
|
58
|
+
var ranges = cm.listSelections();
|
59
|
+
for (var i = 0; i < ranges.length; i++) {
|
60
|
+
if (!ranges[i].empty()) return CodeMirror.Pass;
|
61
|
+
var around = charsAround(cm, ranges[i].head);
|
62
|
+
if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
|
63
|
+
}
|
64
|
+
for (var i = ranges.length - 1; i >= 0; i--) {
|
65
|
+
var cur = ranges[i].head;
|
66
|
+
cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete");
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
function handleEnter(cm) {
|
71
|
+
var conf = getConfig(cm);
|
72
|
+
var explode = conf && getOption(conf, "explode");
|
73
|
+
if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass;
|
74
|
+
|
75
|
+
var ranges = cm.listSelections();
|
76
|
+
for (var i = 0; i < ranges.length; i++) {
|
77
|
+
if (!ranges[i].empty()) return CodeMirror.Pass;
|
78
|
+
var around = charsAround(cm, ranges[i].head);
|
79
|
+
if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
|
80
|
+
}
|
81
|
+
cm.operation(function() {
|
82
|
+
cm.replaceSelection("\n\n", null);
|
83
|
+
cm.execCommand("goCharLeft");
|
84
|
+
ranges = cm.listSelections();
|
85
|
+
for (var i = 0; i < ranges.length; i++) {
|
86
|
+
var line = ranges[i].head.line;
|
87
|
+
cm.indentLine(line, null, true);
|
88
|
+
cm.indentLine(line + 1, null, true);
|
89
|
+
}
|
90
|
+
});
|
91
|
+
}
|
92
|
+
|
93
|
+
function contractSelection(sel) {
|
94
|
+
var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
|
95
|
+
return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
|
96
|
+
head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))};
|
97
|
+
}
|
98
|
+
|
99
|
+
function handleChar(cm, ch) {
|
100
|
+
var conf = getConfig(cm);
|
101
|
+
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
102
|
+
|
103
|
+
var pairs = getOption(conf, "pairs");
|
104
|
+
var pos = pairs.indexOf(ch);
|
105
|
+
if (pos == -1) return CodeMirror.Pass;
|
106
|
+
var triples = getOption(conf, "triples");
|
107
|
+
|
108
|
+
var identical = pairs.charAt(pos + 1) == ch;
|
109
|
+
var ranges = cm.listSelections();
|
110
|
+
var opening = pos % 2 == 0;
|
111
|
+
|
112
|
+
var type;
|
113
|
+
for (var i = 0; i < ranges.length; i++) {
|
114
|
+
var range = ranges[i], cur = range.head, curType;
|
115
|
+
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
|
116
|
+
if (opening && !range.empty()) {
|
117
|
+
curType = "surround";
|
118
|
+
} else if ((identical || !opening) && next == ch) {
|
119
|
+
if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch)
|
120
|
+
curType = "skipThree";
|
121
|
+
else
|
122
|
+
curType = "skip";
|
123
|
+
} else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 &&
|
124
|
+
cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch &&
|
125
|
+
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) {
|
126
|
+
curType = "addFour";
|
127
|
+
} else if (identical) {
|
128
|
+
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both";
|
129
|
+
else return CodeMirror.Pass;
|
130
|
+
} else if (opening && (cm.getLine(cur.line).length == cur.ch ||
|
131
|
+
isClosingBracket(next, pairs) ||
|
132
|
+
/\s/.test(next))) {
|
133
|
+
curType = "both";
|
134
|
+
} else {
|
135
|
+
return CodeMirror.Pass;
|
136
|
+
}
|
137
|
+
if (!type) type = curType;
|
138
|
+
else if (type != curType) return CodeMirror.Pass;
|
139
|
+
}
|
140
|
+
|
141
|
+
var left = pos % 2 ? pairs.charAt(pos - 1) : ch;
|
142
|
+
var right = pos % 2 ? ch : pairs.charAt(pos + 1);
|
143
|
+
cm.operation(function() {
|
144
|
+
if (type == "skip") {
|
145
|
+
cm.execCommand("goCharRight");
|
146
|
+
} else if (type == "skipThree") {
|
147
|
+
for (var i = 0; i < 3; i++)
|
148
|
+
cm.execCommand("goCharRight");
|
149
|
+
} else if (type == "surround") {
|
150
|
+
var sels = cm.getSelections();
|
151
|
+
for (var i = 0; i < sels.length; i++)
|
152
|
+
sels[i] = left + sels[i] + right;
|
153
|
+
cm.replaceSelections(sels, "around");
|
154
|
+
sels = cm.listSelections().slice();
|
155
|
+
for (var i = 0; i < sels.length; i++)
|
156
|
+
sels[i] = contractSelection(sels[i]);
|
157
|
+
cm.setSelections(sels);
|
158
|
+
} else if (type == "both") {
|
159
|
+
cm.replaceSelection(left + right, null);
|
160
|
+
cm.triggerElectric(left + right);
|
161
|
+
cm.execCommand("goCharLeft");
|
162
|
+
} else if (type == "addFour") {
|
163
|
+
cm.replaceSelection(left + left + left + left, "before");
|
164
|
+
cm.execCommand("goCharRight");
|
165
|
+
}
|
166
|
+
});
|
167
|
+
}
|
168
|
+
|
169
|
+
function isClosingBracket(ch, pairs) {
|
170
|
+
var pos = pairs.lastIndexOf(ch);
|
171
|
+
return pos > -1 && pos % 2 == 1;
|
172
|
+
}
|
173
|
+
|
174
|
+
function charsAround(cm, pos) {
|
175
|
+
var str = cm.getRange(Pos(pos.line, pos.ch - 1),
|
176
|
+
Pos(pos.line, pos.ch + 1));
|
177
|
+
return str.length == 2 ? str : null;
|
178
|
+
}
|
179
|
+
|
180
|
+
// Project the token type that will exists after the given char is
|
181
|
+
// typed, and use it to determine whether it would cause the start
|
182
|
+
// of a string token.
|
183
|
+
function enteringString(cm, pos, ch) {
|
184
|
+
var line = cm.getLine(pos.line);
|
185
|
+
var token = cm.getTokenAt(pos);
|
186
|
+
if (/\bstring2?\b/.test(token.type)) return false;
|
187
|
+
var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
|
188
|
+
stream.pos = stream.start = token.start;
|
189
|
+
for (;;) {
|
190
|
+
var type1 = cm.getMode().token(stream, token.state);
|
191
|
+
if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1);
|
192
|
+
stream.start = stream.pos;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
});
|
@@ -0,0 +1,169 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Tag-closer extension for CodeMirror.
|
6
|
+
*
|
7
|
+
* This extension adds an "autoCloseTags" option that can be set to
|
8
|
+
* either true to get the default behavior, or an object to further
|
9
|
+
* configure its behavior.
|
10
|
+
*
|
11
|
+
* These are supported options:
|
12
|
+
*
|
13
|
+
* `whenClosing` (default true)
|
14
|
+
* Whether to autoclose when the '/' of a closing tag is typed.
|
15
|
+
* `whenOpening` (default true)
|
16
|
+
* Whether to autoclose the tag when the final '>' of an opening
|
17
|
+
* tag is typed.
|
18
|
+
* `dontCloseTags` (default is empty tags for HTML, none for XML)
|
19
|
+
* An array of tag names that should not be autoclosed.
|
20
|
+
* `indentTags` (default is block tags for HTML, none for XML)
|
21
|
+
* An array of tag names that should, when opened, cause a
|
22
|
+
* blank line to be added inside the tag, and the blank line and
|
23
|
+
* closing line to be indented.
|
24
|
+
*
|
25
|
+
* See demos/closetag.html for a usage example.
|
26
|
+
*/
|
27
|
+
|
28
|
+
(function(mod) {
|
29
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
30
|
+
mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
|
31
|
+
else if (typeof define == "function" && define.amd) // AMD
|
32
|
+
define(["../../lib/codemirror", "../fold/xml-fold"], mod);
|
33
|
+
else // Plain browser env
|
34
|
+
mod(CodeMirror);
|
35
|
+
})(function(CodeMirror) {
|
36
|
+
CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
|
37
|
+
if (old != CodeMirror.Init && old)
|
38
|
+
cm.removeKeyMap("autoCloseTags");
|
39
|
+
if (!val) return;
|
40
|
+
var map = {name: "autoCloseTags"};
|
41
|
+
if (typeof val != "object" || val.whenClosing)
|
42
|
+
map["'/'"] = function(cm) { return autoCloseSlash(cm); };
|
43
|
+
if (typeof val != "object" || val.whenOpening)
|
44
|
+
map["'>'"] = function(cm) { return autoCloseGT(cm); };
|
45
|
+
cm.addKeyMap(map);
|
46
|
+
});
|
47
|
+
|
48
|
+
var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
|
49
|
+
"source", "track", "wbr"];
|
50
|
+
var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
|
51
|
+
"h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
|
52
|
+
|
53
|
+
function autoCloseGT(cm) {
|
54
|
+
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
55
|
+
var ranges = cm.listSelections(), replacements = [];
|
56
|
+
for (var i = 0; i < ranges.length; i++) {
|
57
|
+
if (!ranges[i].empty()) return CodeMirror.Pass;
|
58
|
+
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
|
59
|
+
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
60
|
+
if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass;
|
61
|
+
|
62
|
+
var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
|
63
|
+
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
|
64
|
+
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
|
65
|
+
|
66
|
+
var tagName = state.tagName;
|
67
|
+
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
|
68
|
+
var lowerTagName = tagName.toLowerCase();
|
69
|
+
// Don't process the '>' at the end of an end-tag or self-closing tag
|
70
|
+
if (!tagName ||
|
71
|
+
tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
|
72
|
+
tok.type == "tag" && state.type == "closeTag" ||
|
73
|
+
tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
|
74
|
+
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
|
75
|
+
closingTagExists(cm, tagName, pos, state, true))
|
76
|
+
return CodeMirror.Pass;
|
77
|
+
|
78
|
+
var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
|
79
|
+
replacements[i] = {indent: indent,
|
80
|
+
text: ">" + (indent ? "\n\n" : "") + "</" + tagName + ">",
|
81
|
+
newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};
|
82
|
+
}
|
83
|
+
|
84
|
+
for (var i = ranges.length - 1; i >= 0; i--) {
|
85
|
+
var info = replacements[i];
|
86
|
+
cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert");
|
87
|
+
var sel = cm.listSelections().slice(0);
|
88
|
+
sel[i] = {head: info.newPos, anchor: info.newPos};
|
89
|
+
cm.setSelections(sel);
|
90
|
+
if (info.indent) {
|
91
|
+
cm.indentLine(info.newPos.line, null, true);
|
92
|
+
cm.indentLine(info.newPos.line + 1, null, true);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
function autoCloseCurrent(cm, typingSlash) {
|
98
|
+
var ranges = cm.listSelections(), replacements = [];
|
99
|
+
var head = typingSlash ? "/" : "</";
|
100
|
+
for (var i = 0; i < ranges.length; i++) {
|
101
|
+
if (!ranges[i].empty()) return CodeMirror.Pass;
|
102
|
+
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
|
103
|
+
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
104
|
+
if (typingSlash && (tok.type == "string" || tok.string.charAt(0) != "<" ||
|
105
|
+
tok.start != pos.ch - 1))
|
106
|
+
return CodeMirror.Pass;
|
107
|
+
// Kludge to get around the fact that we are not in XML mode
|
108
|
+
// when completing in JS/CSS snippet in htmlmixed mode. Does not
|
109
|
+
// work for other XML embedded languages (there is no general
|
110
|
+
// way to go from a mixed mode to its current XML state).
|
111
|
+
var replacement;
|
112
|
+
if (inner.mode.name != "xml") {
|
113
|
+
if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript")
|
114
|
+
replacement = head + "script";
|
115
|
+
else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css")
|
116
|
+
replacement = head + "style";
|
117
|
+
else
|
118
|
+
return CodeMirror.Pass;
|
119
|
+
} else {
|
120
|
+
if (!state.context || !state.context.tagName ||
|
121
|
+
closingTagExists(cm, state.context.tagName, pos, state))
|
122
|
+
return CodeMirror.Pass;
|
123
|
+
replacement = head + state.context.tagName;
|
124
|
+
}
|
125
|
+
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
|
126
|
+
replacements[i] = replacement;
|
127
|
+
}
|
128
|
+
cm.replaceSelections(replacements);
|
129
|
+
ranges = cm.listSelections();
|
130
|
+
for (var i = 0; i < ranges.length; i++)
|
131
|
+
if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)
|
132
|
+
cm.indentLine(ranges[i].head.line);
|
133
|
+
}
|
134
|
+
|
135
|
+
function autoCloseSlash(cm) {
|
136
|
+
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
137
|
+
return autoCloseCurrent(cm, true);
|
138
|
+
}
|
139
|
+
|
140
|
+
CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); };
|
141
|
+
|
142
|
+
function indexOf(collection, elt) {
|
143
|
+
if (collection.indexOf) return collection.indexOf(elt);
|
144
|
+
for (var i = 0, e = collection.length; i < e; ++i)
|
145
|
+
if (collection[i] == elt) return i;
|
146
|
+
return -1;
|
147
|
+
}
|
148
|
+
|
149
|
+
// If xml-fold is loaded, we use its functionality to try and verify
|
150
|
+
// whether a given tag is actually unclosed.
|
151
|
+
function closingTagExists(cm, tagName, pos, state, newTag) {
|
152
|
+
if (!CodeMirror.scanForClosingTag) return false;
|
153
|
+
var end = Math.min(cm.lastLine() + 1, pos.line + 500);
|
154
|
+
var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
|
155
|
+
if (!nextClose || nextClose.tag != tagName) return false;
|
156
|
+
var cx = state.context;
|
157
|
+
// If the immediate wrapping context contains onCx instances of
|
158
|
+
// the same tag, a closing tag only exists if there are at least
|
159
|
+
// that many closing tags of that type following.
|
160
|
+
for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx;
|
161
|
+
pos = nextClose.to;
|
162
|
+
for (var i = 1; i < onCx; i++) {
|
163
|
+
var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
|
164
|
+
if (!next || next.tag != tagName) return false;
|
165
|
+
pos = next.to;
|
166
|
+
}
|
167
|
+
return true;
|
168
|
+
}
|
169
|
+
});
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
var listRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/,
|
15
|
+
emptyListRE = /^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/,
|
16
|
+
unorderedListRE = /[*+-]\s/;
|
17
|
+
|
18
|
+
CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
|
19
|
+
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
20
|
+
var ranges = cm.listSelections(), replacements = [];
|
21
|
+
for (var i = 0; i < ranges.length; i++) {
|
22
|
+
var pos = ranges[i].head;
|
23
|
+
var eolState = cm.getStateAfter(pos.line);
|
24
|
+
var inList = eolState.list !== false;
|
25
|
+
var inQuote = eolState.quote !== 0;
|
26
|
+
|
27
|
+
var line = cm.getLine(pos.line), match = listRE.exec(line);
|
28
|
+
if (!ranges[i].empty() || (!inList && !inQuote) || !match) {
|
29
|
+
cm.execCommand("newlineAndIndent");
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
if (emptyListRE.test(line)) {
|
33
|
+
cm.replaceRange("", {
|
34
|
+
line: pos.line, ch: 0
|
35
|
+
}, {
|
36
|
+
line: pos.line, ch: pos.ch + 1
|
37
|
+
});
|
38
|
+
replacements[i] = "\n";
|
39
|
+
} else {
|
40
|
+
var indent = match[1], after = match[5];
|
41
|
+
var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0
|
42
|
+
? match[2]
|
43
|
+
: (parseInt(match[3], 10) + 1) + match[4];
|
44
|
+
|
45
|
+
replacements[i] = "\n" + indent + bullet + after;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
cm.replaceSelections(replacements);
|
50
|
+
};
|
51
|
+
});
|
@@ -0,0 +1,120 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
|
13
|
+
(document.documentMode == null || document.documentMode < 8);
|
14
|
+
|
15
|
+
var Pos = CodeMirror.Pos;
|
16
|
+
|
17
|
+
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
|
18
|
+
|
19
|
+
function findMatchingBracket(cm, where, strict, config) {
|
20
|
+
var line = cm.getLineHandle(where.line), pos = where.ch - 1;
|
21
|
+
var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
|
22
|
+
if (!match) return null;
|
23
|
+
var dir = match.charAt(1) == ">" ? 1 : -1;
|
24
|
+
if (strict && (dir > 0) != (pos == where.ch)) return null;
|
25
|
+
var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
|
26
|
+
|
27
|
+
var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
|
28
|
+
if (found == null) return null;
|
29
|
+
return {from: Pos(where.line, pos), to: found && found.pos,
|
30
|
+
match: found && found.ch == match.charAt(0), forward: dir > 0};
|
31
|
+
}
|
32
|
+
|
33
|
+
// bracketRegex is used to specify which type of bracket to scan
|
34
|
+
// should be a regexp, e.g. /[[\]]/
|
35
|
+
//
|
36
|
+
// Note: If "where" is on an open bracket, then this bracket is ignored.
|
37
|
+
//
|
38
|
+
// Returns false when no bracket was found, null when it reached
|
39
|
+
// maxScanLines and gave up
|
40
|
+
function scanForBracket(cm, where, dir, style, config) {
|
41
|
+
var maxScanLen = (config && config.maxScanLineLength) || 10000;
|
42
|
+
var maxScanLines = (config && config.maxScanLines) || 1000;
|
43
|
+
|
44
|
+
var stack = [];
|
45
|
+
var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/;
|
46
|
+
var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
|
47
|
+
: Math.max(cm.firstLine() - 1, where.line - maxScanLines);
|
48
|
+
for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
|
49
|
+
var line = cm.getLine(lineNo);
|
50
|
+
if (!line) continue;
|
51
|
+
var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
|
52
|
+
if (line.length > maxScanLen) continue;
|
53
|
+
if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
|
54
|
+
for (; pos != end; pos += dir) {
|
55
|
+
var ch = line.charAt(pos);
|
56
|
+
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
|
57
|
+
var match = matching[ch];
|
58
|
+
if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
|
59
|
+
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
|
60
|
+
else stack.pop();
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
|
65
|
+
}
|
66
|
+
|
67
|
+
function matchBrackets(cm, autoclear, config) {
|
68
|
+
// Disable brace matching in long lines, since it'll cause hugely slow updates
|
69
|
+
var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
|
70
|
+
var marks = [], ranges = cm.listSelections();
|
71
|
+
for (var i = 0; i < ranges.length; i++) {
|
72
|
+
var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config);
|
73
|
+
if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
|
74
|
+
var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
|
75
|
+
marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
|
76
|
+
if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
|
77
|
+
marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
if (marks.length) {
|
82
|
+
// Kludge to work around the IE bug from issue #1193, where text
|
83
|
+
// input stops going to the textare whever this fires.
|
84
|
+
if (ie_lt8 && cm.state.focused) cm.focus();
|
85
|
+
|
86
|
+
var clear = function() {
|
87
|
+
cm.operation(function() {
|
88
|
+
for (var i = 0; i < marks.length; i++) marks[i].clear();
|
89
|
+
});
|
90
|
+
};
|
91
|
+
if (autoclear) setTimeout(clear, 800);
|
92
|
+
else return clear;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
var currentlyHighlighted = null;
|
97
|
+
function doMatchBrackets(cm) {
|
98
|
+
cm.operation(function() {
|
99
|
+
if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
|
100
|
+
currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
|
101
|
+
});
|
102
|
+
}
|
103
|
+
|
104
|
+
CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
|
105
|
+
if (old && old != CodeMirror.Init)
|
106
|
+
cm.off("cursorActivity", doMatchBrackets);
|
107
|
+
if (val) {
|
108
|
+
cm.state.matchBrackets = typeof val == "object" ? val : {};
|
109
|
+
cm.on("cursorActivity", doMatchBrackets);
|
110
|
+
}
|
111
|
+
});
|
112
|
+
|
113
|
+
CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
|
114
|
+
CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config){
|
115
|
+
return findMatchingBracket(this, pos, strict, config);
|
116
|
+
});
|
117
|
+
CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
|
118
|
+
return scanForBracket(this, pos, dir, style, config);
|
119
|
+
});
|
120
|
+
});
|
@@ -0,0 +1,66 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "../fold/xml-fold"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
|
15
|
+
if (old && old != CodeMirror.Init) {
|
16
|
+
cm.off("cursorActivity", doMatchTags);
|
17
|
+
cm.off("viewportChange", maybeUpdateMatch);
|
18
|
+
clear(cm);
|
19
|
+
}
|
20
|
+
if (val) {
|
21
|
+
cm.state.matchBothTags = typeof val == "object" && val.bothTags;
|
22
|
+
cm.on("cursorActivity", doMatchTags);
|
23
|
+
cm.on("viewportChange", maybeUpdateMatch);
|
24
|
+
doMatchTags(cm);
|
25
|
+
}
|
26
|
+
});
|
27
|
+
|
28
|
+
function clear(cm) {
|
29
|
+
if (cm.state.tagHit) cm.state.tagHit.clear();
|
30
|
+
if (cm.state.tagOther) cm.state.tagOther.clear();
|
31
|
+
cm.state.tagHit = cm.state.tagOther = null;
|
32
|
+
}
|
33
|
+
|
34
|
+
function doMatchTags(cm) {
|
35
|
+
cm.state.failedTagMatch = false;
|
36
|
+
cm.operation(function() {
|
37
|
+
clear(cm);
|
38
|
+
if (cm.somethingSelected()) return;
|
39
|
+
var cur = cm.getCursor(), range = cm.getViewport();
|
40
|
+
range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
|
41
|
+
var match = CodeMirror.findMatchingTag(cm, cur, range);
|
42
|
+
if (!match) return;
|
43
|
+
if (cm.state.matchBothTags) {
|
44
|
+
var hit = match.at == "open" ? match.open : match.close;
|
45
|
+
if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
|
46
|
+
}
|
47
|
+
var other = match.at == "close" ? match.open : match.close;
|
48
|
+
if (other)
|
49
|
+
cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
|
50
|
+
else
|
51
|
+
cm.state.failedTagMatch = true;
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
function maybeUpdateMatch(cm) {
|
56
|
+
if (cm.state.failedTagMatch) doMatchTags(cm);
|
57
|
+
}
|
58
|
+
|
59
|
+
CodeMirror.commands.toMatchingTag = function(cm) {
|
60
|
+
var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
|
61
|
+
if (found) {
|
62
|
+
var other = found.at == "close" ? found.open : found.close;
|
63
|
+
if (other) cm.extendSelection(other.to, other.from);
|
64
|
+
}
|
65
|
+
};
|
66
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {
|
13
|
+
if (prev == CodeMirror.Init) prev = false;
|
14
|
+
if (prev && !val)
|
15
|
+
cm.removeOverlay("trailingspace");
|
16
|
+
else if (!prev && val)
|
17
|
+
cm.addOverlay({
|
18
|
+
token: function(stream) {
|
19
|
+
for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {}
|
20
|
+
if (i > stream.pos) { stream.pos = i; return null; }
|
21
|
+
stream.pos = l;
|
22
|
+
return "trailingspace";
|
23
|
+
},
|
24
|
+
name: "trailingspace"
|
25
|
+
});
|
26
|
+
});
|
27
|
+
});
|