marty 2.4.7 → 2.4.8
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 +4 -4
- data/Dockerfile.dummy +8 -5
- data/Gemfile.lock +1 -1
- data/README.md +8 -0
- data/app/assets/javascripts/marty/application.js +1 -0
- data/app/assets/javascripts/marty/codemirror/codemirror.js +9730 -0
- data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/delorean/delorean.js +0 -0
- data/app/assets/javascripts/marty/codemirror/mode/javascript/javascript.js +900 -0
- data/app/assets/javascripts/marty/codemirror/mode/python/python.js +399 -0
- data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/ruby/ruby.js +135 -34
- data/app/{components/marty/script_form/client/Ext.ux.form.field.CodeMirror.js → assets/javascripts/marty/extjs/extensions/marty.js} +87 -6
- data/app/assets/stylesheets/marty/application.css +1 -13
- data/app/assets/stylesheets/marty/codemirror/codemirror.css +346 -0
- data/app/{components/marty/script_form/client → assets/stylesheets/marty/codemirror}/delorean.css +0 -0
- data/app/components/marty/auth_app/client/auth_app.js +82 -80
- data/app/components/marty/data_grid_view.rb +1 -54
- data/app/components/marty/data_grid_view/client/data_grid_view.js +49 -0
- data/app/components/marty/form.rb +1 -5
- data/app/components/marty/form/client/form.js +5 -0
- data/app/components/marty/grid.rb +1 -146
- data/app/components/marty/grid/client/grid.js +146 -0
- data/app/components/marty/import_view.rb +1 -32
- data/app/components/marty/import_view/client/import_view.js +32 -0
- data/app/components/marty/live_search_grid_panel.rb +1 -21
- data/app/components/marty/live_search_grid_panel/client/live_search_grid_panel.js +27 -0
- data/app/components/marty/main_auth_app.rb +4 -145
- data/app/components/marty/main_auth_app/client/main_auth_app.js +124 -0
- data/app/components/marty/mcfly_grid_panel.rb +1 -17
- data/app/components/marty/mcfly_grid_panel/client/mcfly_grid_panel.js +37 -0
- data/app/components/marty/new_posting_form.rb +1 -6
- data/app/components/marty/new_posting_form/client/new_posting_form.js +6 -0
- data/app/components/marty/panel.rb +1 -5
- data/app/components/marty/panel/client/panel.js +5 -0
- data/app/components/marty/posting_grid.rb +4 -55
- data/app/components/marty/posting_grid/client/posting_grid.js +50 -0
- data/app/components/marty/promise_view.rb +2 -75
- data/app/components/marty/promise_view/client/promise_view.css +12 -9
- data/app/components/marty/promise_view/client/promise_view.js +57 -0
- data/app/components/marty/report_form.rb +3 -69
- data/app/components/marty/report_form/client/report_form.js +78 -0
- data/app/components/marty/report_select.rb +1 -45
- data/app/components/marty/report_select/client/report_select.js +50 -0
- data/app/components/marty/reporting.rb +1 -8
- data/app/components/marty/reporting/client/reporting.js +8 -0
- data/app/components/marty/script_form.rb +2 -63
- data/app/components/marty/script_form/client/script_form.js +44 -0
- data/app/components/marty/script_tester.rb +1 -7
- data/app/components/marty/script_tester/client/script_tester.js +7 -0
- data/app/components/marty/scripting.rb +1 -55
- data/app/components/marty/scripting/client/scripting.js +62 -0
- data/app/components/marty/simple_app/client/simple_app.js +21 -13
- data/app/models/marty/promise.rb +22 -1
- data/app/views/layouts/marty/application.html.erb +8 -6
- data/docker-compose.dummy.yml +2 -0
- data/lib/marty/monkey.rb +0 -16
- data/lib/marty/version.rb +1 -1
- data/spec/dummy/config/initializers/assets.rb +1 -0
- data/spec/features/reporting_spec.rb +1 -0
- data/spec/features/scripting_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -0
- data/spec/support/chromedriver.rb +5 -1
- data/spec/support/shared_connection_db_helpers.rb +42 -2
- metadata +29 -168
- data/app/assets/images/marty/.gitkeep +0 -0
- data/app/components/marty/mcfly_grid_panel/client/dup_in_form.js +0 -20
- data/app/components/marty/script_form/client/codemirror.css +0 -172
- data/app/components/marty/script_form/client/codemirror.js +0 -3130
- data/app/components/marty/script_form/client/mode/clike/clike.js +0 -284
- data/app/components/marty/script_form/client/mode/clike/index.html +0 -102
- data/app/components/marty/script_form/client/mode/clike/scala.html +0 -766
- data/app/components/marty/script_form/client/mode/clojure/clojure.js +0 -206
- data/app/components/marty/script_form/client/mode/clojure/index.html +0 -67
- data/app/components/marty/script_form/client/mode/coffeescript/LICENSE +0 -22
- data/app/components/marty/script_form/client/mode/coffeescript/coffeescript.js +0 -346
- data/app/components/marty/script_form/client/mode/coffeescript/index.html +0 -728
- data/app/components/marty/script_form/client/mode/commonlisp/commonlisp.js +0 -101
- data/app/components/marty/script_form/client/mode/commonlisp/index.html +0 -165
- data/app/components/marty/script_form/client/mode/css/css.js +0 -448
- data/app/components/marty/script_form/client/mode/css/index.html +0 -58
- data/app/components/marty/script_form/client/mode/css/test.js +0 -501
- data/app/components/marty/script_form/client/mode/diff/diff.js +0 -32
- data/app/components/marty/script_form/client/mode/diff/index.html +0 -105
- data/app/components/marty/script_form/client/mode/ecl/ecl.js +0 -203
- data/app/components/marty/script_form/client/mode/ecl/index.html +0 -42
- data/app/components/marty/script_form/client/mode/erlang/erlang.js +0 -463
- data/app/components/marty/script_form/client/mode/erlang/index.html +0 -63
- data/app/components/marty/script_form/client/mode/gfm/gfm.js +0 -150
- data/app/components/marty/script_form/client/mode/gfm/index.html +0 -48
- data/app/components/marty/script_form/client/mode/go/go.js +0 -170
- data/app/components/marty/script_form/client/mode/go/index.html +0 -73
- data/app/components/marty/script_form/client/mode/groovy/groovy.js +0 -210
- data/app/components/marty/script_form/client/mode/groovy/index.html +0 -72
- data/app/components/marty/script_form/client/mode/haskell/haskell.js +0 -242
- data/app/components/marty/script_form/client/mode/haskell/index.html +0 -61
- data/app/components/marty/script_form/client/mode/haxe/haxe.js +0 -429
- data/app/components/marty/script_form/client/mode/haxe/index.html +0 -91
- data/app/components/marty/script_form/client/mode/htmlembedded/htmlembedded.js +0 -72
- data/app/components/marty/script_form/client/mode/htmlembedded/index.html +0 -50
- data/app/components/marty/script_form/client/mode/htmlmixed/htmlmixed.js +0 -84
- data/app/components/marty/script_form/client/mode/htmlmixed/index.html +0 -52
- data/app/components/marty/script_form/client/mode/javascript/index.html +0 -78
- data/app/components/marty/script_form/client/mode/javascript/javascript.js +0 -361
- data/app/components/marty/script_form/client/mode/jinja2/index.html +0 -38
- data/app/components/marty/script_form/client/mode/jinja2/jinja2.js +0 -42
- data/app/components/marty/script_form/client/mode/less/index.html +0 -740
- data/app/components/marty/script_form/client/mode/less/less.js +0 -266
- data/app/components/marty/script_form/client/mode/lua/index.html +0 -73
- data/app/components/marty/script_form/client/mode/lua/lua.js +0 -140
- data/app/components/marty/script_form/client/mode/markdown/index.html +0 -343
- data/app/components/marty/script_form/client/mode/markdown/markdown.js +0 -382
- data/app/components/marty/script_form/client/mode/markdown/test.js +0 -1084
- data/app/components/marty/script_form/client/mode/mysql/index.html +0 -42
- data/app/components/marty/script_form/client/mode/mysql/mysql.js +0 -186
- data/app/components/marty/script_form/client/mode/ntriples/index.html +0 -33
- data/app/components/marty/script_form/client/mode/ntriples/ntriples.js +0 -172
- data/app/components/marty/script_form/client/mode/ocaml/index.html +0 -130
- data/app/components/marty/script_form/client/mode/ocaml/ocaml.js +0 -114
- data/app/components/marty/script_form/client/mode/pascal/LICENSE +0 -7
- data/app/components/marty/script_form/client/mode/pascal/index.html +0 -49
- data/app/components/marty/script_form/client/mode/pascal/pascal.js +0 -94
- data/app/components/marty/script_form/client/mode/perl/LICENSE +0 -19
- data/app/components/marty/script_form/client/mode/perl/index.html +0 -63
- data/app/components/marty/script_form/client/mode/perl/perl.js +0 -816
- data/app/components/marty/script_form/client/mode/php/index.html +0 -49
- data/app/components/marty/script_form/client/mode/php/php.js +0 -148
- data/app/components/marty/script_form/client/mode/pig/index.html +0 -43
- data/app/components/marty/script_form/client/mode/pig/pig.js +0 -172
- data/app/components/marty/script_form/client/mode/plsql/index.html +0 -63
- data/app/components/marty/script_form/client/mode/plsql/plsql.js +0 -217
- data/app/components/marty/script_form/client/mode/properties/index.html +0 -41
- data/app/components/marty/script_form/client/mode/properties/properties.js +0 -63
- data/app/components/marty/script_form/client/mode/python/LICENSE.txt +0 -21
- data/app/components/marty/script_form/client/mode/python/index.html +0 -123
- data/app/components/marty/script_form/client/mode/python/python.js +0 -338
- data/app/components/marty/script_form/client/mode/r/LICENSE +0 -24
- data/app/components/marty/script_form/client/mode/r/index.html +0 -74
- data/app/components/marty/script_form/client/mode/r/r.js +0 -141
- data/app/components/marty/script_form/client/mode/rpm/changes/changes.js +0 -19
- data/app/components/marty/script_form/client/mode/rpm/changes/index.html +0 -54
- data/app/components/marty/script_form/client/mode/rpm/spec/index.html +0 -100
- data/app/components/marty/script_form/client/mode/rpm/spec/spec.css +0 -5
- data/app/components/marty/script_form/client/mode/rpm/spec/spec.js +0 -66
- data/app/components/marty/script_form/client/mode/rst/index.html +0 -526
- data/app/components/marty/script_form/client/mode/rst/rst.js +0 -326
- data/app/components/marty/script_form/client/mode/ruby/LICENSE +0 -24
- data/app/components/marty/script_form/client/mode/ruby/index.html +0 -172
- data/app/components/marty/script_form/client/mode/rust/index.html +0 -49
- data/app/components/marty/script_form/client/mode/rust/rust.js +0 -432
- data/app/components/marty/script_form/client/mode/scheme/index.html +0 -65
- data/app/components/marty/script_form/client/mode/scheme/scheme.js +0 -230
- data/app/components/marty/script_form/client/mode/shell/index.html +0 -50
- data/app/components/marty/script_form/client/mode/shell/shell.js +0 -118
- data/app/components/marty/script_form/client/mode/sieve/LICENSE +0 -23
- data/app/components/marty/script_form/client/mode/sieve/index.html +0 -81
- data/app/components/marty/script_form/client/mode/sieve/sieve.js +0 -156
- data/app/components/marty/script_form/client/mode/smalltalk/index.html +0 -56
- data/app/components/marty/script_form/client/mode/smalltalk/smalltalk.js +0 -139
- data/app/components/marty/script_form/client/mode/smarty/index.html +0 -83
- data/app/components/marty/script_form/client/mode/smarty/smarty.js +0 -148
- data/app/components/marty/script_form/client/mode/sparql/index.html +0 -41
- data/app/components/marty/script_form/client/mode/sparql/sparql.js +0 -143
- data/app/components/marty/script_form/client/mode/stex/index.html +0 -98
- data/app/components/marty/script_form/client/mode/stex/stex.js +0 -182
- data/app/components/marty/script_form/client/mode/stex/test.js +0 -343
- data/app/components/marty/script_form/client/mode/tiddlywiki/index.html +0 -141
- data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.css +0 -14
- data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.js +0 -384
- data/app/components/marty/script_form/client/mode/tiki/index.html +0 -83
- data/app/components/marty/script_form/client/mode/tiki/tiki.css +0 -26
- data/app/components/marty/script_form/client/mode/tiki/tiki.js +0 -309
- data/app/components/marty/script_form/client/mode/vb/LICENSE.txt +0 -21
- data/app/components/marty/script_form/client/mode/vb/index.html +0 -89
- data/app/components/marty/script_form/client/mode/vb/vb.js +0 -260
- data/app/components/marty/script_form/client/mode/vbscript/index.html +0 -43
- data/app/components/marty/script_form/client/mode/vbscript/vbscript.js +0 -26
- data/app/components/marty/script_form/client/mode/velocity/index.html +0 -104
- data/app/components/marty/script_form/client/mode/velocity/velocity.js +0 -146
- data/app/components/marty/script_form/client/mode/verilog/index.html +0 -211
- data/app/components/marty/script_form/client/mode/verilog/verilog.js +0 -194
- data/app/components/marty/script_form/client/mode/xml/index.html +0 -45
- data/app/components/marty/script_form/client/mode/xml/xml.js +0 -318
- data/app/components/marty/script_form/client/mode/xquery/LICENSE +0 -20
- data/app/components/marty/script_form/client/mode/xquery/index.html +0 -223
- data/app/components/marty/script_form/client/mode/xquery/test/index.html +0 -27
- data/app/components/marty/script_form/client/mode/xquery/test/testBase.js +0 -42
- data/app/components/marty/script_form/client/mode/xquery/test/testEmptySequenceKeyword.js +0 -16
- data/app/components/marty/script_form/client/mode/xquery/test/testMultiAttr.js +0 -16
- data/app/components/marty/script_form/client/mode/xquery/test/testNamespaces.js +0 -91
- data/app/components/marty/script_form/client/mode/xquery/test/testProcessingInstructions.js +0 -16
- data/app/components/marty/script_form/client/mode/xquery/test/testQuotes.js +0 -19
- data/app/components/marty/script_form/client/mode/xquery/xquery.js +0 -451
- data/app/components/marty/script_form/client/mode/yaml/index.html +0 -68
- data/app/components/marty/script_form/client/mode/yaml/yaml.js +0 -95
- data/app/components/marty/script_form/client/theme/ambiance.css +0 -81
- data/app/components/marty/script_form/client/theme/blackboard.css +0 -25
- data/app/components/marty/script_form/client/theme/cobalt.css +0 -18
- data/app/components/marty/script_form/client/theme/eclipse.css +0 -25
- data/app/components/marty/script_form/client/theme/elegant.css +0 -10
- data/app/components/marty/script_form/client/theme/erlang-dark.css +0 -21
- data/app/components/marty/script_form/client/theme/lesser-dark.css +0 -44
- data/app/components/marty/script_form/client/theme/monokai.css +0 -28
- data/app/components/marty/script_form/client/theme/neat.css +0 -9
- data/app/components/marty/script_form/client/theme/night.css +0 -21
- data/app/components/marty/script_form/client/theme/rubyblue.css +0 -21
- data/app/components/marty/script_form/client/theme/vibrant-ink.css +0 -27
- data/app/components/marty/script_form/client/theme/xq-dark.css +0 -46
- data/app/components/marty/script_form/client/util/closetag.js +0 -164
- data/app/components/marty/script_form/client/util/dialog.css +0 -27
- data/app/components/marty/script_form/client/util/dialog.js +0 -70
- data/app/components/marty/script_form/client/util/foldcode.js +0 -196
- data/app/components/marty/script_form/client/util/formatting.js +0 -193
- data/app/components/marty/script_form/client/util/javascript-hint.js +0 -134
- data/app/components/marty/script_form/client/util/loadmode.js +0 -51
- data/app/components/marty/script_form/client/util/match-highlighter.js +0 -44
- data/app/components/marty/script_form/client/util/multiplex.js +0 -77
- data/app/components/marty/script_form/client/util/overlay.js +0 -54
- data/app/components/marty/script_form/client/util/pig-hint.js +0 -123
- data/app/components/marty/script_form/client/util/runmode-standalone.js +0 -90
- data/app/components/marty/script_form/client/util/runmode.js +0 -53
- data/app/components/marty/script_form/client/util/search.js +0 -118
- data/app/components/marty/script_form/client/util/searchcursor.js +0 -119
- data/app/components/marty/script_form/client/util/simple-hint.css +0 -16
- data/app/components/marty/script_form/client/util/simple-hint.js +0 -97
- data/app/components/marty/script_form/client/util/xml-hint.js +0 -137
- data/lib/marty/javascript/grid_view_in_form.js +0 -81
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
|
|
2
|
-
|
|
3
|
-
.cm-s-rubyblue { background: #112435; color: white; }
|
|
4
|
-
.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
|
|
5
|
-
.cm-s-rubyblue .CodeMirror-gutter { background: #1F4661; border-right: 7px solid #3E7087; min-width:2.5em; }
|
|
6
|
-
.cm-s-rubyblue .CodeMirror-gutter-text { color: white; }
|
|
7
|
-
.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
|
|
8
|
-
|
|
9
|
-
.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
|
|
10
|
-
.cm-s-rubyblue span.cm-atom { color: #F4C20B; }
|
|
11
|
-
.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }
|
|
12
|
-
.cm-s-rubyblue span.cm-keyword { color: #F0F; }
|
|
13
|
-
.cm-s-rubyblue span.cm-string { color: #F08047; }
|
|
14
|
-
.cm-s-rubyblue span.cm-meta { color: #F0F; }
|
|
15
|
-
.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
|
|
16
|
-
.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }
|
|
17
|
-
.cm-s-rubyblue span.cm-error { color: #AF2018; }
|
|
18
|
-
.cm-s-rubyblue span.cm-bracket { color: #F0F; }
|
|
19
|
-
.cm-s-rubyblue span.cm-link { color: #F4C20B; }
|
|
20
|
-
.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
|
|
21
|
-
.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* Taken from the popular Visual Studio Vibrant Ink Schema */
|
|
2
|
-
|
|
3
|
-
.cm-s-vibrant-ink { background: black; color: white; }
|
|
4
|
-
.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
|
|
5
|
-
|
|
6
|
-
.cm-s-vibrant-ink .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
|
|
7
|
-
.cm-s-vibrant-ink .CodeMirror-gutter-text { color: #d0d0d0; }
|
|
8
|
-
.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; }
|
|
9
|
-
|
|
10
|
-
.cm-s-vibrant-ink .cm-keyword { color: #CC7832; }
|
|
11
|
-
.cm-s-vibrant-ink .cm-atom { color: #FC0; }
|
|
12
|
-
.cm-s-vibrant-ink .cm-number { color: #FFEE98; }
|
|
13
|
-
.cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
|
|
14
|
-
.cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D }
|
|
15
|
-
.cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D }
|
|
16
|
-
.cm-s-vibrant-ink .cm-operator { color: #888; }
|
|
17
|
-
.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
|
|
18
|
-
.cm-s-vibrant-ink .cm-string { color: #A5C25C }
|
|
19
|
-
.cm-s-vibrant-ink .cm-string-2 { color: red }
|
|
20
|
-
.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }
|
|
21
|
-
.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
|
|
22
|
-
.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }
|
|
23
|
-
.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }
|
|
24
|
-
.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
|
|
25
|
-
.cm-s-vibrant-ink .cm-header { color: #FF6400; }
|
|
26
|
-
.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
|
|
27
|
-
.cm-s-vibrant-ink .cm-link { color: blue; }
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2011 by MarkLogic Corporation
|
|
3
|
-
Author: Mike Brevoort <mike@brevoort.com>
|
|
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.
|
|
22
|
-
*/
|
|
23
|
-
.cm-s-xq-dark { background: #0a001f; color: #f8f8f8; }
|
|
24
|
-
.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
|
|
25
|
-
.cm-s-xq-dark .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
|
|
26
|
-
.cm-s-xq-dark .CodeMirror-gutter-text { color: #f8f8f8; }
|
|
27
|
-
.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
|
28
|
-
|
|
29
|
-
.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
|
|
30
|
-
.cm-s-xq-dark span.cm-atom {color: #6C8CD5;}
|
|
31
|
-
.cm-s-xq-dark span.cm-number {color: #164;}
|
|
32
|
-
.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}
|
|
33
|
-
.cm-s-xq-dark span.cm-variable {color: #FFF;}
|
|
34
|
-
.cm-s-xq-dark span.cm-variable-2 {color: #EEE;}
|
|
35
|
-
.cm-s-xq-dark span.cm-variable-3 {color: #DDD;}
|
|
36
|
-
.cm-s-xq-dark span.cm-property {}
|
|
37
|
-
.cm-s-xq-dark span.cm-operator {}
|
|
38
|
-
.cm-s-xq-dark span.cm-comment {color: gray;}
|
|
39
|
-
.cm-s-xq-dark span.cm-string {color: #9FEE00;}
|
|
40
|
-
.cm-s-xq-dark span.cm-meta {color: yellow;}
|
|
41
|
-
.cm-s-xq-dark span.cm-error {color: #f00;}
|
|
42
|
-
.cm-s-xq-dark span.cm-qualifier {color: #FFF700;}
|
|
43
|
-
.cm-s-xq-dark span.cm-builtin {color: #30a;}
|
|
44
|
-
.cm-s-xq-dark span.cm-bracket {color: #cc7;}
|
|
45
|
-
.cm-s-xq-dark span.cm-tag {color: #FFBD40;}
|
|
46
|
-
.cm-s-xq-dark span.cm-attribute {color: #FFF700;}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tag-closer extension for CodeMirror.
|
|
3
|
-
*
|
|
4
|
-
* This extension adds a "closeTag" utility function that can be used with key bindings to
|
|
5
|
-
* insert a matching end tag after the ">" character of a start tag has been typed. It can
|
|
6
|
-
* also complete "</" if a matching start tag is found. It will correctly ignore signal
|
|
7
|
-
* characters for empty tags, comments, CDATA, etc.
|
|
8
|
-
*
|
|
9
|
-
* The function depends on internal parser state to identify tags. It is compatible with the
|
|
10
|
-
* following CodeMirror modes and will ignore all others:
|
|
11
|
-
* - htmlmixed
|
|
12
|
-
* - xml
|
|
13
|
-
*
|
|
14
|
-
* See demos/closetag.html for a usage example.
|
|
15
|
-
*
|
|
16
|
-
* @author Nathan Williams <nathan@nlwillia.net>
|
|
17
|
-
* Contributed under the same license terms as CodeMirror.
|
|
18
|
-
*/
|
|
19
|
-
(function() {
|
|
20
|
-
/** Option that allows tag closing behavior to be toggled. Default is true. */
|
|
21
|
-
CodeMirror.defaults['closeTagEnabled'] = true;
|
|
22
|
-
|
|
23
|
-
/** Array of tag names to add indentation after the start tag for. Default is the list of block-level html tags. */
|
|
24
|
-
CodeMirror.defaults['closeTagIndent'] = ['applet', 'blockquote', 'body', 'button', 'div', 'dl', 'fieldset', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'iframe', 'layer', 'legend', 'object', 'ol', 'p', 'select', 'table', 'ul'];
|
|
25
|
-
|
|
26
|
-
/** Array of tag names where an end tag is forbidden. */
|
|
27
|
-
CodeMirror.defaults['closeTagVoid'] = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
28
|
-
|
|
29
|
-
function innerState(cm, state) {
|
|
30
|
-
return CodeMirror.innerMode(cm.getMode(), state).state;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Call during key processing to close tags. Handles the key event if the tag is closed, otherwise throws CodeMirror.Pass.
|
|
36
|
-
* - cm: The editor instance.
|
|
37
|
-
* - ch: The character being processed.
|
|
38
|
-
* - indent: Optional. An array of tag names to indent when closing. Omit or pass true to use the default indentation tag list defined in the 'closeTagIndent' option.
|
|
39
|
-
* Pass false to disable indentation. Pass an array to override the default list of tag names.
|
|
40
|
-
* - vd: Optional. An array of tag names that should not be closed. Omit to use the default void (end tag forbidden) tag list defined in the 'closeTagVoid' option. Ignored in xml mode.
|
|
41
|
-
*/
|
|
42
|
-
CodeMirror.defineExtension("closeTag", function(cm, ch, indent, vd) {
|
|
43
|
-
if (!cm.getOption('closeTagEnabled')) {
|
|
44
|
-
throw CodeMirror.Pass;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/*
|
|
48
|
-
* Relevant structure of token:
|
|
49
|
-
*
|
|
50
|
-
* htmlmixed
|
|
51
|
-
* className
|
|
52
|
-
* state
|
|
53
|
-
* htmlState
|
|
54
|
-
* type
|
|
55
|
-
* tagName
|
|
56
|
-
* context
|
|
57
|
-
* tagName
|
|
58
|
-
* mode
|
|
59
|
-
*
|
|
60
|
-
* xml
|
|
61
|
-
* className
|
|
62
|
-
* state
|
|
63
|
-
* tagName
|
|
64
|
-
* type
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
var pos = cm.getCursor();
|
|
68
|
-
var tok = cm.getTokenAt(pos);
|
|
69
|
-
var state = innerState(cm, tok.state);
|
|
70
|
-
|
|
71
|
-
if (state) {
|
|
72
|
-
|
|
73
|
-
if (ch == '>') {
|
|
74
|
-
var type = state.type;
|
|
75
|
-
|
|
76
|
-
if (tok.className == 'tag' && type == 'closeTag') {
|
|
77
|
-
throw CodeMirror.Pass; // Don't process the '>' at the end of an end-tag.
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
cm.replaceSelection('>'); // Mode state won't update until we finish the tag.
|
|
81
|
-
pos = {line: pos.line, ch: pos.ch + 1};
|
|
82
|
-
cm.setCursor(pos);
|
|
83
|
-
|
|
84
|
-
tok = cm.getTokenAt(cm.getCursor());
|
|
85
|
-
state = innerState(cm, tok.state);
|
|
86
|
-
if (!state) throw CodeMirror.Pass;
|
|
87
|
-
var type = state.type;
|
|
88
|
-
|
|
89
|
-
if (tok.className == 'tag' && type != 'selfcloseTag') {
|
|
90
|
-
var tagName = state.tagName;
|
|
91
|
-
if (tagName.length > 0 && shouldClose(cm, vd, tagName)) {
|
|
92
|
-
insertEndTag(cm, indent, pos, tagName);
|
|
93
|
-
}
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Undo the '>' insert and allow cm to handle the key instead.
|
|
98
|
-
cm.setSelection({line: pos.line, ch: pos.ch - 1}, pos);
|
|
99
|
-
cm.replaceSelection("");
|
|
100
|
-
|
|
101
|
-
} else if (ch == '/') {
|
|
102
|
-
if (tok.className == 'tag' && tok.string == '<') {
|
|
103
|
-
var ctx = state.context, tagName = ctx ? ctx.tagName : '';
|
|
104
|
-
if (tagName.length > 0) {
|
|
105
|
-
completeEndTag(cm, pos, tagName);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
throw CodeMirror.Pass; // Bubble if not handled
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
function insertEndTag(cm, indent, pos, tagName) {
|
|
117
|
-
if (shouldIndent(cm, indent, tagName)) {
|
|
118
|
-
cm.replaceSelection('\n\n</' + tagName + '>', 'end');
|
|
119
|
-
cm.indentLine(pos.line + 1);
|
|
120
|
-
cm.indentLine(pos.line + 2);
|
|
121
|
-
cm.setCursor({line: pos.line + 1, ch: cm.getLine(pos.line + 1).length});
|
|
122
|
-
} else {
|
|
123
|
-
cm.replaceSelection('</' + tagName + '>');
|
|
124
|
-
cm.setCursor(pos);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function shouldIndent(cm, indent, tagName) {
|
|
129
|
-
if (typeof indent == 'undefined' || indent == null || indent == true) {
|
|
130
|
-
indent = cm.getOption('closeTagIndent');
|
|
131
|
-
}
|
|
132
|
-
if (!indent) {
|
|
133
|
-
indent = [];
|
|
134
|
-
}
|
|
135
|
-
return indexOf(indent, tagName.toLowerCase()) != -1;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function shouldClose(cm, vd, tagName) {
|
|
139
|
-
if (cm.getOption('mode') == 'xml') {
|
|
140
|
-
return true; // always close xml tags
|
|
141
|
-
}
|
|
142
|
-
if (typeof vd == 'undefined' || vd == null) {
|
|
143
|
-
vd = cm.getOption('closeTagVoid');
|
|
144
|
-
}
|
|
145
|
-
if (!vd) {
|
|
146
|
-
vd = [];
|
|
147
|
-
}
|
|
148
|
-
return indexOf(vd, tagName.toLowerCase()) == -1;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// C&P from codemirror.js...would be nice if this were visible to utilities.
|
|
152
|
-
function indexOf(collection, elt) {
|
|
153
|
-
if (collection.indexOf) return collection.indexOf(elt);
|
|
154
|
-
for (var i = 0, e = collection.length; i < e; ++i)
|
|
155
|
-
if (collection[i] == elt) return i;
|
|
156
|
-
return -1;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function completeEndTag(cm, pos, tagName) {
|
|
160
|
-
cm.replaceSelection('/' + tagName + '>');
|
|
161
|
-
cm.setCursor({line: pos.line, ch: pos.ch + tagName.length + 2 });
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
})();
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
.CodeMirror-dialog {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.CodeMirror-dialog > div {
|
|
6
|
-
position: absolute;
|
|
7
|
-
top: 0; left: 0; right: 0;
|
|
8
|
-
background: white;
|
|
9
|
-
border-bottom: 1px solid #eee;
|
|
10
|
-
z-index: 15;
|
|
11
|
-
padding: .1em .8em;
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
color: #333;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.CodeMirror-dialog input {
|
|
17
|
-
border: none;
|
|
18
|
-
outline: none;
|
|
19
|
-
background: transparent;
|
|
20
|
-
width: 20em;
|
|
21
|
-
color: inherit;
|
|
22
|
-
font-family: monospace;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.CodeMirror-dialog button {
|
|
26
|
-
font-size: 70%;
|
|
27
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Open simple dialogs on top of an editor. Relies on dialog.css.
|
|
2
|
-
|
|
3
|
-
(function() {
|
|
4
|
-
function dialogDiv(cm, template) {
|
|
5
|
-
var wrap = cm.getWrapperElement();
|
|
6
|
-
var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild);
|
|
7
|
-
dialog.className = "CodeMirror-dialog";
|
|
8
|
-
dialog.innerHTML = '<div>' + template + '</div>';
|
|
9
|
-
return dialog;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
CodeMirror.defineExtension("openDialog", function(template, callback) {
|
|
13
|
-
var dialog = dialogDiv(this, template);
|
|
14
|
-
var closed = false, me = this;
|
|
15
|
-
function close() {
|
|
16
|
-
if (closed) return;
|
|
17
|
-
closed = true;
|
|
18
|
-
dialog.parentNode.removeChild(dialog);
|
|
19
|
-
}
|
|
20
|
-
var inp = dialog.getElementsByTagName("input")[0], button;
|
|
21
|
-
if (inp) {
|
|
22
|
-
CodeMirror.connect(inp, "keydown", function(e) {
|
|
23
|
-
if (e.keyCode == 13 || e.keyCode == 27) {
|
|
24
|
-
CodeMirror.e_stop(e);
|
|
25
|
-
close();
|
|
26
|
-
me.focus();
|
|
27
|
-
if (e.keyCode == 13) callback(inp.value);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
inp.focus();
|
|
31
|
-
CodeMirror.connect(inp, "blur", close);
|
|
32
|
-
} else if (button = dialog.getElementsByTagName("button")[0]) {
|
|
33
|
-
CodeMirror.connect(button, "click", function() {
|
|
34
|
-
close();
|
|
35
|
-
me.focus();
|
|
36
|
-
});
|
|
37
|
-
button.focus();
|
|
38
|
-
CodeMirror.connect(button, "blur", close);
|
|
39
|
-
}
|
|
40
|
-
return close;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
CodeMirror.defineExtension("openConfirm", function(template, callbacks) {
|
|
44
|
-
var dialog = dialogDiv(this, template);
|
|
45
|
-
var buttons = dialog.getElementsByTagName("button");
|
|
46
|
-
var closed = false, me = this, blurring = 1;
|
|
47
|
-
function close() {
|
|
48
|
-
if (closed) return;
|
|
49
|
-
closed = true;
|
|
50
|
-
dialog.parentNode.removeChild(dialog);
|
|
51
|
-
me.focus();
|
|
52
|
-
}
|
|
53
|
-
buttons[0].focus();
|
|
54
|
-
for (var i = 0; i < buttons.length; ++i) {
|
|
55
|
-
var b = buttons[i];
|
|
56
|
-
(function(callback) {
|
|
57
|
-
CodeMirror.connect(b, "click", function(e) {
|
|
58
|
-
CodeMirror.e_preventDefault(e);
|
|
59
|
-
close();
|
|
60
|
-
if (callback) callback(me);
|
|
61
|
-
});
|
|
62
|
-
})(callbacks[i]);
|
|
63
|
-
CodeMirror.connect(b, "blur", function() {
|
|
64
|
-
--blurring;
|
|
65
|
-
setTimeout(function() { if (blurring <= 0) close(); }, 200);
|
|
66
|
-
});
|
|
67
|
-
CodeMirror.connect(b, "focus", function() { ++blurring; });
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
})();
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
// the tagRangeFinder function is
|
|
2
|
-
// Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>
|
|
3
|
-
// released under the MIT license (../../LICENSE) like the rest of CodeMirror
|
|
4
|
-
CodeMirror.tagRangeFinder = function(cm, line, hideEnd) {
|
|
5
|
-
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
6
|
-
var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
7
|
-
var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");
|
|
8
|
-
|
|
9
|
-
var lineText = cm.getLine(line);
|
|
10
|
-
var found = false;
|
|
11
|
-
var tag = null;
|
|
12
|
-
var pos = 0;
|
|
13
|
-
while (!found) {
|
|
14
|
-
pos = lineText.indexOf("<", pos);
|
|
15
|
-
if (-1 == pos) // no tag on line
|
|
16
|
-
return;
|
|
17
|
-
if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag
|
|
18
|
-
pos++;
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
// ok we weem to have a start tag
|
|
22
|
-
if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...
|
|
23
|
-
pos++;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
var gtPos = lineText.indexOf(">", pos + 1);
|
|
27
|
-
if (-1 == gtPos) { // end of start tag not in line
|
|
28
|
-
var l = line + 1;
|
|
29
|
-
var foundGt = false;
|
|
30
|
-
var lastLine = cm.lineCount();
|
|
31
|
-
while (l < lastLine && !foundGt) {
|
|
32
|
-
var lt = cm.getLine(l);
|
|
33
|
-
var gt = lt.indexOf(">");
|
|
34
|
-
if (-1 != gt) { // found a >
|
|
35
|
-
foundGt = true;
|
|
36
|
-
var slash = lt.lastIndexOf("/", gt);
|
|
37
|
-
if (-1 != slash && slash < gt) {
|
|
38
|
-
var str = lineText.substr(slash, gt - slash + 1);
|
|
39
|
-
if (!str.match( /\/\s*\>/ )) { // yep, that's the end of empty tag
|
|
40
|
-
if (hideEnd === true) l++;
|
|
41
|
-
return l;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
l++;
|
|
46
|
-
}
|
|
47
|
-
found = true;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
var slashPos = lineText.lastIndexOf("/", gtPos);
|
|
51
|
-
if (-1 == slashPos) { // cannot be empty tag
|
|
52
|
-
found = true;
|
|
53
|
-
// don't continue
|
|
54
|
-
}
|
|
55
|
-
else { // empty tag?
|
|
56
|
-
// check if really empty tag
|
|
57
|
-
var str = lineText.substr(slashPos, gtPos - slashPos + 1);
|
|
58
|
-
if (!str.match( /\/\s*\>/ )) { // finally not empty
|
|
59
|
-
found = true;
|
|
60
|
-
// don't continue
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (found) {
|
|
65
|
-
var subLine = lineText.substr(pos + 1);
|
|
66
|
-
tag = subLine.match(xmlNAMERegExp);
|
|
67
|
-
if (tag) {
|
|
68
|
-
// we have an element name, wooohooo !
|
|
69
|
-
tag = tag[0];
|
|
70
|
-
// do we have the close tag on same line ???
|
|
71
|
-
if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep
|
|
72
|
-
{
|
|
73
|
-
found = false;
|
|
74
|
-
}
|
|
75
|
-
// we don't, so we have a candidate...
|
|
76
|
-
}
|
|
77
|
-
else
|
|
78
|
-
found = false;
|
|
79
|
-
}
|
|
80
|
-
if (!found)
|
|
81
|
-
pos++;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (found) {
|
|
85
|
-
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
|
|
86
|
-
var startTagRegExp = new RegExp(startTag, "g");
|
|
87
|
-
var endTag = "</" + tag + ">";
|
|
88
|
-
var depth = 1;
|
|
89
|
-
var l = line + 1;
|
|
90
|
-
var lastLine = cm.lineCount();
|
|
91
|
-
while (l < lastLine) {
|
|
92
|
-
lineText = cm.getLine(l);
|
|
93
|
-
var match = lineText.match(startTagRegExp);
|
|
94
|
-
if (match) {
|
|
95
|
-
for (var i = 0; i < match.length; i++) {
|
|
96
|
-
if (match[i] == endTag)
|
|
97
|
-
depth--;
|
|
98
|
-
else
|
|
99
|
-
depth++;
|
|
100
|
-
if (!depth) {
|
|
101
|
-
if (hideEnd === true) l++;
|
|
102
|
-
return l;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
l++;
|
|
107
|
-
}
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
CodeMirror.braceRangeFinder = function(cm, line, hideEnd) {
|
|
113
|
-
var lineText = cm.getLine(line), at = lineText.length, startChar, tokenType;
|
|
114
|
-
for (;;) {
|
|
115
|
-
var found = lineText.lastIndexOf("{", at);
|
|
116
|
-
if (found < 0) break;
|
|
117
|
-
tokenType = cm.getTokenAt({line: line, ch: found}).className;
|
|
118
|
-
if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
|
|
119
|
-
at = found - 1;
|
|
120
|
-
}
|
|
121
|
-
if (startChar == null || lineText.lastIndexOf("}") > startChar) return;
|
|
122
|
-
var count = 1, lastLine = cm.lineCount(), end;
|
|
123
|
-
outer: for (var i = line + 1; i < lastLine; ++i) {
|
|
124
|
-
var text = cm.getLine(i), pos = 0;
|
|
125
|
-
for (;;) {
|
|
126
|
-
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
|
|
127
|
-
if (nextOpen < 0) nextOpen = text.length;
|
|
128
|
-
if (nextClose < 0) nextClose = text.length;
|
|
129
|
-
pos = Math.min(nextOpen, nextClose);
|
|
130
|
-
if (pos == text.length) break;
|
|
131
|
-
if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) {
|
|
132
|
-
if (pos == nextOpen) ++count;
|
|
133
|
-
else if (!--count) { end = i; break outer; }
|
|
134
|
-
}
|
|
135
|
-
++pos;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (end == null || end == line + 1) return;
|
|
139
|
-
if (hideEnd === true) end++;
|
|
140
|
-
return end;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
CodeMirror.indentRangeFinder = function(cm, line) {
|
|
144
|
-
var tabSize = cm.getOption("tabSize");
|
|
145
|
-
var myIndent = cm.getLineHandle(line).indentation(tabSize), last;
|
|
146
|
-
for (var i = line + 1, end = cm.lineCount(); i < end; ++i) {
|
|
147
|
-
var handle = cm.getLineHandle(i);
|
|
148
|
-
if (!/^\s*$/.test(handle.text)) {
|
|
149
|
-
if (handle.indentation(tabSize) <= myIndent) break;
|
|
150
|
-
last = i;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (!last) return null;
|
|
154
|
-
return last + 1;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {
|
|
158
|
-
var folded = [];
|
|
159
|
-
if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">▼</div>%N%';
|
|
160
|
-
|
|
161
|
-
function isFolded(cm, n) {
|
|
162
|
-
for (var i = 0; i < folded.length; ++i) {
|
|
163
|
-
var start = cm.lineInfo(folded[i].start);
|
|
164
|
-
if (!start) folded.splice(i--, 1);
|
|
165
|
-
else if (start.line == n) return {pos: i, region: folded[i]};
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function expand(cm, region) {
|
|
170
|
-
cm.clearMarker(region.start);
|
|
171
|
-
for (var i = 0; i < region.hidden.length; ++i)
|
|
172
|
-
cm.showLine(region.hidden[i]);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return function(cm, line) {
|
|
176
|
-
cm.operation(function() {
|
|
177
|
-
var known = isFolded(cm, line);
|
|
178
|
-
if (known) {
|
|
179
|
-
folded.splice(known.pos, 1);
|
|
180
|
-
expand(cm, known.region);
|
|
181
|
-
} else {
|
|
182
|
-
var end = rangeFinder(cm, line, hideEnd);
|
|
183
|
-
if (end == null) return;
|
|
184
|
-
var hidden = [];
|
|
185
|
-
for (var i = line + 1; i < end; ++i) {
|
|
186
|
-
var handle = cm.hideLine(i);
|
|
187
|
-
if (handle) hidden.push(handle);
|
|
188
|
-
}
|
|
189
|
-
var first = cm.setMarker(line, markText);
|
|
190
|
-
var region = {start: first, hidden: hidden};
|
|
191
|
-
cm.onDeleteLine(first, function() { expand(cm, region); });
|
|
192
|
-
folded.push(region);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
};
|