bedrock_sass 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -5
- data/assets/_vendor/ace/ace.js +21635 -0
- data/assets/_vendor/ace/ext-beautify.js +318 -0
- data/assets/_vendor/ace/ext-elastic_tabstops_lite.js +277 -0
- data/assets/_vendor/ace/ext-emmet.js +1226 -0
- data/assets/_vendor/ace/ext-error_marker.js +10 -0
- data/assets/_vendor/ace/ext-keybinding_menu.js +189 -0
- data/assets/_vendor/ace/ext-language_tools.js +1997 -0
- data/assets/_vendor/ace/ext-linking.js +65 -0
- data/assets/_vendor/ace/ext-modelist.js +228 -0
- data/assets/_vendor/ace/ext-options.js +750 -0
- data/assets/_vendor/ace/ext-rtl.js +110 -0
- data/assets/_vendor/ace/ext-searchbox.js +512 -0
- data/assets/_vendor/ace/ext-settings_menu.js +771 -0
- data/assets/_vendor/ace/ext-spellcheck.js +75 -0
- data/assets/_vendor/ace/ext-split.js +208 -0
- data/assets/_vendor/ace/ext-static_highlight.js +226 -0
- data/assets/_vendor/ace/ext-statusbar.js +57 -0
- data/assets/_vendor/ace/ext-textarea.js +567 -0
- data/assets/_vendor/ace/ext-themelist.js +67 -0
- data/assets/_vendor/ace/ext-whitespace.js +210 -0
- data/assets/_vendor/ace/keybinding-emacs.js +1165 -0
- data/assets/_vendor/ace/keybinding-vim.js +5673 -0
- data/assets/_vendor/ace/mode-abap.js +222 -0
- data/assets/_vendor/ace/mode-abc.js +267 -0
- data/assets/_vendor/ace/mode-actionscript.js +274 -0
- data/assets/_vendor/ace/mode-ada.js +138 -0
- data/assets/_vendor/ace/mode-apache_conf.js +363 -0
- data/assets/_vendor/ace/mode-applescript.js +279 -0
- data/assets/_vendor/ace/mode-asciidoc.js +349 -0
- data/assets/_vendor/ace/mode-asl.js +422 -0
- data/assets/_vendor/ace/mode-assembly_x86.js +193 -0
- data/assets/_vendor/ace/mode-autohotkey.js +243 -0
- data/assets/_vendor/ace/mode-batchfile.js +230 -0
- data/assets/_vendor/ace/mode-bro.js +334 -0
- data/assets/_vendor/ace/mode-c9search.js +294 -0
- data/assets/_vendor/ace/mode-c_cpp.js +502 -0
- data/assets/_vendor/ace/mode-cirru.js +211 -0
- data/assets/_vendor/ace/mode-clojure.js +314 -0
- data/assets/_vendor/ace/mode-cobol.js +102 -0
- data/assets/_vendor/ace/mode-coffee.js +400 -0
- data/assets/_vendor/ace/mode-coldfusion.js +2596 -0
- data/assets/_vendor/ace/mode-csharp.js +502 -0
- data/assets/_vendor/ace/mode-csound_document.js +3749 -0
- data/assets/_vendor/ace/mode-csound_orchestra.js +2687 -0
- data/assets/_vendor/ace/mode-csound_score.js +454 -0
- data/assets/_vendor/ace/mode-csp.js +60 -0
- data/assets/_vendor/ace/mode-css.js +723 -0
- data/assets/_vendor/ace/mode-curly.js +2564 -0
- data/assets/_vendor/ace/mode-d.js +520 -0
- data/assets/_vendor/ace/mode-dart.js +703 -0
- data/assets/_vendor/ace/mode-diff.js +146 -0
- data/assets/_vendor/ace/mode-django.js +2594 -0
- data/assets/_vendor/ace/mode-dockerfile.js +498 -0
- data/assets/_vendor/ace/mode-dot.js +418 -0
- data/assets/_vendor/ace/mode-drools.js +496 -0
- data/assets/_vendor/ace/mode-edifact.js +165 -0
- data/assets/_vendor/ace/mode-eiffel.js +136 -0
- data/assets/_vendor/ace/mode-ejs.js +3026 -0
- data/assets/_vendor/ace/mode-elixir.js +501 -0
- data/assets/_vendor/ace/mode-elm.js +307 -0
- data/assets/_vendor/ace/mode-erlang.js +1009 -0
- data/assets/_vendor/ace/mode-forth.js +297 -0
- data/assets/_vendor/ace/mode-fortran.js +431 -0
- data/assets/_vendor/ace/mode-fsharp.js +314 -0
- data/assets/_vendor/ace/mode-ftl.js +1192 -0
- data/assets/_vendor/ace/mode-gcode.js +94 -0
- data/assets/_vendor/ace/mode-gherkin.js +172 -0
- data/assets/_vendor/ace/mode-gitignore.js +60 -0
- data/assets/_vendor/ace/mode-glsl.js +579 -0
- data/assets/_vendor/ace/mode-gobstones.js +929 -0
- data/assets/_vendor/ace/mode-golang.js +414 -0
- data/assets/_vendor/ace/mode-graphqlschema.js +214 -0
- data/assets/_vendor/ace/mode-groovy.js +986 -0
- data/assets/_vendor/ace/mode-haml.js +1555 -0
- data/assets/_vendor/ace/mode-handlebars.js +2622 -0
- data/assets/_vendor/ace/mode-haskell.js +379 -0
- data/assets/_vendor/ace/mode-haskell_cabal.js +142 -0
- data/assets/_vendor/ace/mode-haxe.js +386 -0
- data/assets/_vendor/ace/mode-hjson.js +353 -0
- data/assets/_vendor/ace/mode-html.js +2509 -0
- data/assets/_vendor/ace/mode-html_elixir.js +3087 -0
- data/assets/_vendor/ace/mode-html_ruby.js +3043 -0
- data/assets/_vendor/ace/mode-ini.js +163 -0
- data/assets/_vendor/ace/mode-io.js +253 -0
- data/assets/_vendor/ace/mode-jack.js +347 -0
- data/assets/_vendor/ace/mode-jade.js +2126 -0
- data/assets/_vendor/ace/mode-java.js +975 -0
- data/assets/_vendor/ace/mode-javascript.js +797 -0
- data/assets/_vendor/ace/mode-json.js +327 -0
- data/assets/_vendor/ace/mode-jsoniq.js +4940 -0
- data/assets/_vendor/ace/mode-jsp.js +1430 -0
- data/assets/_vendor/ace/mode-jssm.js +325 -0
- data/assets/_vendor/ace/mode-jsx.js +412 -0
- data/assets/_vendor/ace/mode-julia.js +303 -0
- data/assets/_vendor/ace/mode-kotlin.js +795 -0
- data/assets/_vendor/ace/mode-latex.js +297 -0
- data/assets/_vendor/ace/mode-less.js +841 -0
- data/assets/_vendor/ace/mode-liquid.js +1193 -0
- data/assets/_vendor/ace/mode-lisp.js +112 -0
- data/assets/_vendor/ace/mode-livescript.js +280 -0
- data/assets/_vendor/ace/mode-logiql.js +317 -0
- data/assets/_vendor/ace/mode-lsl.js +343 -0
- data/assets/_vendor/ace/mode-lua.js +432 -0
- data/assets/_vendor/ace/mode-luapage.js +3007 -0
- data/assets/_vendor/ace/mode-lucene.js +87 -0
- data/assets/_vendor/ace/mode-makefile.js +410 -0
- data/assets/_vendor/ace/mode-markdown.js +3189 -0
- data/assets/_vendor/ace/mode-mask.js +1802 -0
- data/assets/_vendor/ace/mode-matlab.js +264 -0
- data/assets/_vendor/ace/mode-maze.js +291 -0
- data/assets/_vendor/ace/mode-mel.js +263 -0
- data/assets/_vendor/ace/mode-mixal.js +123 -0
- data/assets/_vendor/ace/mode-mushcode.js +681 -0
- data/assets/_vendor/ace/mode-mysql.js +168 -0
- data/assets/_vendor/ace/mode-nix.js +646 -0
- data/assets/_vendor/ace/mode-nsis.js +312 -0
- data/assets/_vendor/ace/mode-objectivec.js +739 -0
- data/assets/_vendor/ace/mode-ocaml.js +422 -0
- data/assets/_vendor/ace/mode-pascal.js +205 -0
- data/assets/_vendor/ace/mode-perl.js +380 -0
- data/assets/_vendor/ace/mode-pgsql.js +1508 -0
- data/assets/_vendor/ace/mode-php.js +13088 -0
- data/assets/_vendor/ace/mode-php_laravel_blade.js +13289 -0
- data/assets/_vendor/ace/mode-pig.js +310 -0
- data/assets/_vendor/ace/mode-plain_text.js +33 -0
- data/assets/_vendor/ace/mode-powershell.js +418 -0
- data/assets/_vendor/ace/mode-praat.js +478 -0
- data/assets/_vendor/ace/mode-prolog.js +371 -0
- data/assets/_vendor/ace/mode-properties.js +81 -0
- data/assets/_vendor/ace/mode-protobuf.js +592 -0
- data/assets/_vendor/ace/mode-puppet.js +370 -0
- data/assets/_vendor/ace/mode-python.js +273 -0
- data/assets/_vendor/ace/mode-r.js +310 -0
- data/assets/_vendor/ace/mode-razor.js +2869 -0
- data/assets/_vendor/ace/mode-rdoc.js +243 -0
- data/assets/_vendor/ace/mode-red.js +450 -0
- data/assets/_vendor/ace/mode-redshift.js +361 -0
- data/assets/_vendor/ace/mode-rhtml.js +2806 -0
- data/assets/_vendor/ace/mode-rst.js +257 -0
- data/assets/_vendor/ace/mode-ruby.js +497 -0
- data/assets/_vendor/ace/mode-rust.js +279 -0
- data/assets/_vendor/ace/mode-sass.js +441 -0
- data/assets/_vendor/ace/mode-scad.js +414 -0
- data/assets/_vendor/ace/mode-scala.js +982 -0
- data/assets/_vendor/ace/mode-scheme.js +232 -0
- data/assets/_vendor/ace/mode-scss.js +606 -0
- data/assets/_vendor/ace/mode-sh.js +447 -0
- data/assets/_vendor/ace/mode-sjs.js +1014 -0
- data/assets/_vendor/ace/mode-slim.js +4736 -0
- data/assets/_vendor/ace/mode-smarty.js +2635 -0
- data/assets/_vendor/ace/mode-snippets.js +207 -0
- data/assets/_vendor/ace/mode-soy_template.js +2847 -0
- data/assets/_vendor/ace/mode-space.js +168 -0
- data/assets/_vendor/ace/mode-sparql.js +320 -0
- data/assets/_vendor/ace/mode-sql.js +111 -0
- data/assets/_vendor/ace/mode-sqlserver.js +444 -0
- data/assets/_vendor/ace/mode-stylus.js +471 -0
- data/assets/_vendor/ace/mode-svg.js +1581 -0
- data/assets/_vendor/ace/mode-swift.js +390 -0
- data/assets/_vendor/ace/mode-tcl.js +383 -0
- data/assets/_vendor/ace/mode-terraform.js +398 -0
- data/assets/_vendor/ace/mode-tex.js +159 -0
- data/assets/_vendor/ace/mode-text.js +10 -0
- data/assets/_vendor/ace/mode-textile.js +150 -0
- data/assets/_vendor/ace/mode-toml.js +154 -0
- data/assets/_vendor/ace/mode-tsx.js +887 -0
- data/assets/_vendor/ace/mode-turtle.js +296 -0
- data/assets/_vendor/ace/mode-twig.js +2693 -0
- data/assets/_vendor/ace/mode-typescript.js +868 -0
- data/assets/_vendor/ace/mode-vala.js +676 -0
- data/assets/_vendor/ace/mode-vbscript.js +207 -0
- data/assets/_vendor/ace/mode-velocity.js +2790 -0
- data/assets/_vendor/ace/mode-verilog.js +119 -0
- data/assets/_vendor/ace/mode-vhdl.js +118 -0
- data/assets/_vendor/ace/mode-wollok.js +911 -0
- data/assets/_vendor/ace/mode-xml.js +677 -0
- data/assets/_vendor/ace/mode-xquery.js +4922 -0
- data/assets/_vendor/ace/mode-yaml.js +300 -0
- data/assets/_vendor/ace/snippets/abap.js +15 -0
- data/assets/_vendor/ace/snippets/abc.js +46 -0
- data/assets/_vendor/ace/snippets/actionscript.js +172 -0
- data/assets/_vendor/ace/snippets/ada.js +15 -0
- data/assets/_vendor/ace/snippets/apache_conf.js +15 -0
- data/assets/_vendor/ace/snippets/applescript.js +15 -0
- data/assets/_vendor/ace/snippets/asciidoc.js +15 -0
- data/assets/_vendor/ace/snippets/asl.js +14 -0
- data/assets/_vendor/ace/snippets/assembly_x86.js +15 -0
- data/assets/_vendor/ace/snippets/autohotkey.js +15 -0
- data/assets/_vendor/ace/snippets/batchfile.js +15 -0
- data/assets/_vendor/ace/snippets/bro.js +15 -0
- data/assets/_vendor/ace/snippets/c9search.js +15 -0
- data/assets/_vendor/ace/snippets/c_cpp.js +146 -0
- data/assets/_vendor/ace/snippets/cirru.js +15 -0
- data/assets/_vendor/ace/snippets/clojure.js +105 -0
- data/assets/_vendor/ace/snippets/cobol.js +15 -0
- data/assets/_vendor/ace/snippets/coffee.js +110 -0
- data/assets/_vendor/ace/snippets/coldfusion.js +15 -0
- data/assets/_vendor/ace/snippets/csharp.js +15 -0
- data/assets/_vendor/ace/snippets/csound_document.js +25 -0
- data/assets/_vendor/ace/snippets/csound_orchestra.js +62 -0
- data/assets/_vendor/ace/snippets/csound_score.js +15 -0
- data/assets/_vendor/ace/snippets/csp.js +15 -0
- data/assets/_vendor/ace/snippets/css.js +982 -0
- data/assets/_vendor/ace/snippets/curly.js +15 -0
- data/assets/_vendor/ace/snippets/d.js +15 -0
- data/assets/_vendor/ace/snippets/dart.js +98 -0
- data/assets/_vendor/ace/snippets/diff.js +26 -0
- data/assets/_vendor/ace/snippets/django.js +123 -0
- data/assets/_vendor/ace/snippets/dockerfile.js +15 -0
- data/assets/_vendor/ace/snippets/dot.js +15 -0
- data/assets/_vendor/ace/snippets/drools.js +34 -0
- data/assets/_vendor/ace/snippets/edifact.js +255 -0
- data/assets/_vendor/ace/snippets/eiffel.js +15 -0
- data/assets/_vendor/ace/snippets/ejs.js +15 -0
- data/assets/_vendor/ace/snippets/elixir.js +15 -0
- data/assets/_vendor/ace/snippets/elm.js +15 -0
- data/assets/_vendor/ace/snippets/erlang.js +175 -0
- data/assets/_vendor/ace/snippets/forth.js +15 -0
- data/assets/_vendor/ace/snippets/fortran.js +15 -0
- data/assets/_vendor/ace/snippets/fsharp.js +15 -0
- data/assets/_vendor/ace/snippets/ftl.js +15 -0
- data/assets/_vendor/ace/snippets/gcode.js +15 -0
- data/assets/_vendor/ace/snippets/gherkin.js +15 -0
- data/assets/_vendor/ace/snippets/gitignore.js +15 -0
- data/assets/_vendor/ace/snippets/glsl.js +15 -0
- data/assets/_vendor/ace/snippets/gobstones.js +49 -0
- data/assets/_vendor/ace/snippets/golang.js +15 -0
- data/assets/_vendor/ace/snippets/graphqlschema.js +47 -0
- data/assets/_vendor/ace/snippets/groovy.js +15 -0
- data/assets/_vendor/ace/snippets/haml.js +35 -0
- data/assets/_vendor/ace/snippets/handlebars.js +15 -0
- data/assets/_vendor/ace/snippets/haskell.js +97 -0
- data/assets/_vendor/ace/snippets/haskell_cabal.js +15 -0
- data/assets/_vendor/ace/snippets/haxe.js +15 -0
- data/assets/_vendor/ace/snippets/hjson.js +15 -0
- data/assets/_vendor/ace/snippets/html.js +870 -0
- data/assets/_vendor/ace/snippets/html_elixir.js +15 -0
- data/assets/_vendor/ace/snippets/html_ruby.js +15 -0
- data/assets/_vendor/ace/snippets/ini.js +15 -0
- data/assets/_vendor/ace/snippets/io.js +77 -0
- data/assets/_vendor/ace/snippets/jack.js +15 -0
- data/assets/_vendor/ace/snippets/jade.js +15 -0
- data/assets/_vendor/ace/snippets/java.js +255 -0
- data/assets/_vendor/ace/snippets/javascript.js +210 -0
- data/assets/_vendor/ace/snippets/json.js +15 -0
- data/assets/_vendor/ace/snippets/jsoniq.js +76 -0
- data/assets/_vendor/ace/snippets/jsp.js +114 -0
- data/assets/_vendor/ace/snippets/jssm.js +15 -0
- data/assets/_vendor/ace/snippets/jsx.js +15 -0
- data/assets/_vendor/ace/snippets/julia.js +15 -0
- data/assets/_vendor/ace/snippets/kotlin.js +15 -0
- data/assets/_vendor/ace/snippets/latex.js +15 -0
- data/assets/_vendor/ace/snippets/less.js +15 -0
- data/assets/_vendor/ace/snippets/liquid.js +15 -0
- data/assets/_vendor/ace/snippets/lisp.js +15 -0
- data/assets/_vendor/ace/snippets/livescript.js +15 -0
- data/assets/_vendor/ace/snippets/logiql.js +15 -0
- data/assets/_vendor/ace/snippets/lsl.js +1247 -0
- data/assets/_vendor/ace/snippets/lua.js +36 -0
- data/assets/_vendor/ace/snippets/luapage.js +15 -0
- data/assets/_vendor/ace/snippets/lucene.js +15 -0
- data/assets/_vendor/ace/snippets/makefile.js +19 -0
- data/assets/_vendor/ace/snippets/markdown.js +103 -0
- data/assets/_vendor/ace/snippets/mask.js +15 -0
- data/assets/_vendor/ace/snippets/matlab.js +15 -0
- data/assets/_vendor/ace/snippets/maze.js +24 -0
- data/assets/_vendor/ace/snippets/mel.js +15 -0
- data/assets/_vendor/ace/snippets/mixal.js +15 -0
- data/assets/_vendor/ace/snippets/mushcode.js +15 -0
- data/assets/_vendor/ace/snippets/mysql.js +15 -0
- data/assets/_vendor/ace/snippets/nix.js +15 -0
- data/assets/_vendor/ace/snippets/nsis.js +15 -0
- data/assets/_vendor/ace/snippets/objectivec.js +15 -0
- data/assets/_vendor/ace/snippets/ocaml.js +15 -0
- data/assets/_vendor/ace/snippets/pascal.js +15 -0
- data/assets/_vendor/ace/snippets/perl.js +362 -0
- data/assets/_vendor/ace/snippets/pgsql.js +15 -0
- data/assets/_vendor/ace/snippets/php.js +398 -0
- data/assets/_vendor/ace/snippets/php_laravel_blade.js +15 -0
- data/assets/_vendor/ace/snippets/pig.js +15 -0
- data/assets/_vendor/ace/snippets/plain_text.js +15 -0
- data/assets/_vendor/ace/snippets/powershell.js +15 -0
- data/assets/_vendor/ace/snippets/praat.js +15 -0
- data/assets/_vendor/ace/snippets/prolog.js +15 -0
- data/assets/_vendor/ace/snippets/properties.js +15 -0
- data/assets/_vendor/ace/snippets/protobuf.js +15 -0
- data/assets/_vendor/ace/snippets/puppet.js +15 -0
- data/assets/_vendor/ace/snippets/python.js +173 -0
- data/assets/_vendor/ace/snippets/r.js +136 -0
- data/assets/_vendor/ace/snippets/razor.js +18 -0
- data/assets/_vendor/ace/snippets/rdoc.js +15 -0
- data/assets/_vendor/ace/snippets/red.js +15 -0
- data/assets/_vendor/ace/snippets/redshift.js +15 -0
- data/assets/_vendor/ace/snippets/rhtml.js +15 -0
- data/assets/_vendor/ace/snippets/rst.js +37 -0
- data/assets/_vendor/ace/snippets/ruby.js +943 -0
- data/assets/_vendor/ace/snippets/rust.js +15 -0
- data/assets/_vendor/ace/snippets/sass.js +15 -0
- data/assets/_vendor/ace/snippets/scad.js +15 -0
- data/assets/_vendor/ace/snippets/scala.js +15 -0
- data/assets/_vendor/ace/snippets/scheme.js +15 -0
- data/assets/_vendor/ace/snippets/scss.js +15 -0
- data/assets/_vendor/ace/snippets/sh.js +98 -0
- data/assets/_vendor/ace/snippets/sjs.js +15 -0
- data/assets/_vendor/ace/snippets/slim.js +15 -0
- data/assets/_vendor/ace/snippets/smarty.js +15 -0
- data/assets/_vendor/ace/snippets/snippets.js +24 -0
- data/assets/_vendor/ace/snippets/soy_template.js +15 -0
- data/assets/_vendor/ace/snippets/space.js +15 -0
- data/assets/_vendor/ace/snippets/sparql.js +15 -0
- data/assets/_vendor/ace/snippets/sql.js +41 -0
- data/assets/_vendor/ace/snippets/sqlserver.js +84 -0
- data/assets/_vendor/ace/snippets/stylus.js +15 -0
- data/assets/_vendor/ace/snippets/svg.js +15 -0
- data/assets/_vendor/ace/snippets/swift.js +15 -0
- data/assets/_vendor/ace/snippets/tcl.js +107 -0
- data/assets/_vendor/ace/snippets/terraform.js +15 -0
- data/assets/_vendor/ace/snippets/tex.js +205 -0
- data/assets/_vendor/ace/snippets/text.js +15 -0
- data/assets/_vendor/ace/snippets/textile.js +45 -0
- data/assets/_vendor/ace/snippets/toml.js +15 -0
- data/assets/_vendor/ace/snippets/tsx.js +15 -0
- data/assets/_vendor/ace/snippets/turtle.js +15 -0
- data/assets/_vendor/ace/snippets/twig.js +15 -0
- data/assets/_vendor/ace/snippets/typescript.js +15 -0
- data/assets/_vendor/ace/snippets/vala.js +201 -0
- data/assets/_vendor/ace/snippets/vbscript.js +15 -0
- data/assets/_vendor/ace/snippets/velocity.js +44 -0
- data/assets/_vendor/ace/snippets/verilog.js +15 -0
- data/assets/_vendor/ace/snippets/vhdl.js +15 -0
- data/assets/_vendor/ace/snippets/wollok.js +99 -0
- data/assets/_vendor/ace/snippets/xml.js +15 -0
- data/assets/_vendor/ace/snippets/xquery.js +76 -0
- data/assets/_vendor/ace/snippets/yaml.js +15 -0
- data/assets/_vendor/ace/theme-ambiance.js +185 -0
- data/assets/_vendor/ace/theme-chaos.js +164 -0
- data/assets/_vendor/ace/theme-chrome.js +136 -0
- data/assets/_vendor/ace/theme-clouds.js +103 -0
- data/assets/_vendor/ace/theme-clouds_midnight.js +104 -0
- data/assets/_vendor/ace/theme-cobalt.js +121 -0
- data/assets/_vendor/ace/theme-crimson_editor.js +126 -0
- data/assets/_vendor/ace/theme-dawn.js +116 -0
- data/assets/_vendor/ace/theme-dracula.js +136 -0
- data/assets/_vendor/ace/theme-dreamweaver.js +149 -0
- data/assets/_vendor/ace/theme-eclipse.js +106 -0
- data/assets/_vendor/ace/theme-github.js +110 -0
- data/assets/_vendor/ace/theme-gob.js +120 -0
- data/assets/_vendor/ace/theme-gruvbox.js +90 -0
- data/assets/_vendor/ace/theme-idle_fingers.js +104 -0
- data/assets/_vendor/ace/theme-iplastic.js +129 -0
- data/assets/_vendor/ace/theme-katzenmilch.js +129 -0
- data/assets/_vendor/ace/theme-kr_theme.js +112 -0
- data/assets/_vendor/ace/theme-kuroir.js +69 -0
- data/assets/_vendor/ace/theme-merbivore.js +103 -0
- data/assets/_vendor/ace/theme-merbivore_soft.js +104 -0
- data/assets/_vendor/ace/theme-mono_industrial.js +115 -0
- data/assets/_vendor/ace/theme-monokai.js +113 -0
- data/assets/_vendor/ace/theme-pastel_on_dark.js +116 -0
- data/assets/_vendor/ace/theme-solarized_dark.js +96 -0
- data/assets/_vendor/ace/theme-solarized_light.js +99 -0
- data/assets/_vendor/ace/theme-sqlserver.js +146 -0
- data/assets/_vendor/ace/theme-terminal.js +122 -0
- data/assets/_vendor/ace/theme-textmate.js +138 -0
- data/assets/_vendor/ace/theme-tomorrow.js +116 -0
- data/assets/_vendor/ace/theme-tomorrow_night.js +116 -0
- data/assets/_vendor/ace/theme-tomorrow_night_blue.js +114 -0
- data/assets/_vendor/ace/theme-tomorrow_night_bright.js +129 -0
- data/assets/_vendor/ace/theme-tomorrow_night_eighties.js +116 -0
- data/assets/_vendor/ace/theme-twilight.js +117 -0
- data/assets/_vendor/ace/theme-vibrant_ink.js +102 -0
- data/assets/_vendor/ace/theme-xcode.js +96 -0
- data/assets/_vendor/ace/worker-coffee.js +2165 -0
- data/assets/_vendor/ace/worker-css.js +8764 -0
- data/assets/_vendor/ace/worker-html.js +11614 -0
- data/assets/_vendor/ace/worker-javascript.js +12491 -0
- data/assets/_vendor/ace/worker-json.js +2396 -0
- data/assets/_vendor/ace/worker-lua.js +3637 -0
- data/assets/_vendor/ace/worker-php.js +4313 -0
- data/assets/_vendor/ace/worker-xml.js +3899 -0
- data/assets/_vendor/ace/worker-xquery.js +70688 -0
- data/assets/_vendor/motion-ui/_settings.scss +1 -0
- data/assets/_vendor/motion-ui/effects/_fade.scss +1 -4
- data/assets/_vendor/motion-ui/effects/_hinge.scss +4 -3
- data/assets/_vendor/motion-ui/effects/_shake.scss +1 -1
- data/assets/_vendor/motion-ui/effects/_slide.scss +4 -3
- data/assets/_vendor/motion-ui/effects/_spin.scss +4 -3
- data/assets/_vendor/motion-ui/effects/_wiggle.scss +1 -1
- data/assets/_vendor/motion-ui/effects/_zoom.scss +2 -2
- data/assets/_vendor/motion-ui/motion-ui.scss +2 -0
- data/assets/_vendor/motion-ui/transitions/_fade.scss +6 -4
- data/assets/_vendor/motion-ui/transitions/_hinge.scss +3 -2
- data/assets/_vendor/motion-ui/transitions/_slide.scss +3 -2
- data/assets/_vendor/motion-ui/transitions/_spin.scss +2 -1
- data/assets/_vendor/motion-ui/transitions/_zoom.scss +6 -4
- data/assets/_vendor/motion-ui/util/_animation.scss +1 -1
- data/assets/_vendor/motion-ui/util/_args.scss +2 -2
- data/assets/_vendor/motion-ui/util/_function.scss +94 -0
- data/assets/_vendor/motion-ui/util/_keyframe.scss +5 -5
- data/assets/_vendor/motion-ui/util/_series.scss +20 -17
- data/assets/_vendor/motion-ui/util/_string.scss +36 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.js +136 -404
- data/assets/_vendor/tinymce/plugins/advlist/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/anchor/plugin.js +103 -323
- data/assets/_vendor/tinymce/plugins/anchor/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/autolink/plugin.js +153 -377
- data/assets/_vendor/tinymce/plugins/autolink/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +145 -427
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/autosave/plugin.js +197 -579
- data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +88 -251
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/charmap/plugin.js +1243 -818
- data/assets/_vendor/tinymce/plugins/charmap/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/code/plugin.js +82 -326
- data/assets/_vendor/tinymce/plugins/code/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/codesample/plugin.js +829 -1444
- data/assets/_vendor/tinymce/plugins/codesample/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +111 -257
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +141 -469
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/directionality/plugin.js +57 -261
- data/assets/_vendor/tinymce/plugins/directionality/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +78 -247
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +463 -906
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +149 -427
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/help/plugin.js +634 -1434
- data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/hr/plugin.js +29 -185
- data/assets/_vendor/tinymce/plugins/hr/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/image/plugin.js +1147 -1508
- data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +3319 -4079
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +1 -2
- data/assets/_vendor/tinymce/plugins/importcss/plugin.js +230 -543
- data/assets/_vendor/tinymce/plugins/importcss/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +151 -460
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +204 -379
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/link/plugin.js +644 -1162
- data/assets/_vendor/tinymce/plugins/link/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/lists/plugin.js +1005 -1875
- data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/media/plugin.js +1066 -1926
- data/assets/_vendor/tinymce/plugins/media/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +70 -298
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +96 -294
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +92 -337
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/paste/plugin.js +1363 -2801
- data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/preview/plugin.js +106 -393
- data/assets/_vendor/tinymce/plugins/preview/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/print/plugin.js +29 -185
- data/assets/_vendor/tinymce/plugins/print/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/save/plugin.js +100 -350
- data/assets/_vendor/tinymce/plugins/save/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +491 -865
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +630 -1292
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +96 -391
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/table/plugin.js +9537 -14920
- data/assets/_vendor/tinymce/plugins/table/plugin.min.js +1 -5
- data/assets/_vendor/tinymce/plugins/template/plugin.js +309 -771
- data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +319 -592
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +326 -674
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/toc/plugin.js +199 -530
- data/assets/_vendor/tinymce/plugins/toc/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +112 -436
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +428 -1248
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +307 -699
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -1
- data/assets/_vendor/tinymce/skins/lightgray/content.inline.min.css +1 -1
- data/assets/_vendor/tinymce/skins/lightgray/content.min.css +1 -1
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +1 -1
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -1
- data/assets/_vendor/tinymce/skins/lightgray/skin.mobile.min.css +1 -1
- data/assets/_vendor/tinymce/themes/inlite/theme.js +9693 -18245
- data/assets/_vendor/tinymce/themes/inlite/theme.min.js +1 -5
- data/assets/_vendor/tinymce/themes/mobile/theme.js +12629 -22467
- data/assets/_vendor/tinymce/themes/mobile/theme.min.js +1 -8
- data/assets/_vendor/tinymce/themes/modern/theme.js +9510 -17780
- data/assets/_vendor/tinymce/themes/modern/theme.min.js +1 -5
- data/assets/_vendor/tinymce/tinymce.js +25087 -42606
- data/assets/_vendor/yoastseo/css/_icons.scss +7 -7
- data/assets/_vendor/yoastseo/css/_snippet-editor.scss +1 -1
- data/assets/bedrock/js/bedrock.js +1 -71697
- data/assets/bedrock/scss/_bedrock-components.scss +20 -0
- data/assets/bedrock/scss/_bedrock-settings.scss +12 -4
- data/assets/bedrock/scss/_foundation-settings.scss +4 -2
- data/assets/bedrock/scss/components/ace-editor.scss +21 -0
- data/assets/bedrock/scss/components/attachments-grid.scss +18 -15
- data/assets/bedrock/scss/components/date-picker.scss +146 -0
- data/assets/bedrock/scss/components/dropzone-upload.scss +7 -0
- data/assets/bedrock/scss/components/file-input.scss +7 -0
- data/assets/bedrock/scss/components/file-preview.scss +36 -0
- data/assets/bedrock/scss/components/frame-embed.scss +23 -0
- data/assets/bedrock/scss/components/global.scss +27 -0
- data/assets/bedrock/scss/components/helper-classes.scss +1 -0
- data/assets/bedrock/scss/components/icon-box.scss +38 -0
- data/assets/bedrock/scss/components/item-list.scss +66 -0
- data/assets/bedrock/scss/components/lists.scss +58 -0
- data/assets/bedrock/scss/components/off-canvas-menu.scss +27 -15
- data/assets/bedrock/scss/components/place-autocomplete.scss +90 -0
- data/assets/bedrock/scss/components/rrule-generator.scss +102 -0
- data/assets/bedrock/scss/components/rrule-reveal.scss +14 -0
- data/assets/bedrock/scss/components/select-box.scss +1 -0
- data/assets/bedrock/scss/components/seo-analysis.scss +5 -0
- data/assets/bedrock/scss/components/textarea.scss +14 -2
- data/assets/bedrock/scss/components/tiny-mce-editor.scss +5 -16
- data/lib/bedrock_sass.rb +5 -0
- data/lib/bedrock_sass/version.rb +1 -1
- data/lib/tasks/before_assets_precompile.rake +1 -0
- metadata +395 -4
- data/CODE_OF_CONDUCT.md +0 -74
@@ -0,0 +1,189 @@
|
|
1
|
+
define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
|
2
|
+
'use strict';
|
3
|
+
var dom = require("../../lib/dom");
|
4
|
+
var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
|
5
|
+
background-color: #F7F7F7;\
|
6
|
+
color: black;\
|
7
|
+
box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
|
8
|
+
padding: 1em 0.5em 2em 1em;\
|
9
|
+
overflow: auto;\
|
10
|
+
position: absolute;\
|
11
|
+
margin: 0;\
|
12
|
+
bottom: 0;\
|
13
|
+
right: 0;\
|
14
|
+
top: 0;\
|
15
|
+
z-index: 9991;\
|
16
|
+
cursor: default;\
|
17
|
+
}\
|
18
|
+
.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
|
19
|
+
box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
|
20
|
+
background-color: rgba(255, 255, 255, 0.6);\
|
21
|
+
color: black;\
|
22
|
+
}\
|
23
|
+
.ace_optionsMenuEntry:hover {\
|
24
|
+
background-color: rgba(100, 100, 100, 0.1);\
|
25
|
+
transition: all 0.3s\
|
26
|
+
}\
|
27
|
+
.ace_closeButton {\
|
28
|
+
background: rgba(245, 146, 146, 0.5);\
|
29
|
+
border: 1px solid #F48A8A;\
|
30
|
+
border-radius: 50%;\
|
31
|
+
padding: 7px;\
|
32
|
+
position: absolute;\
|
33
|
+
right: -8px;\
|
34
|
+
top: -8px;\
|
35
|
+
z-index: 100000;\
|
36
|
+
}\
|
37
|
+
.ace_closeButton{\
|
38
|
+
background: rgba(245, 146, 146, 0.9);\
|
39
|
+
}\
|
40
|
+
.ace_optionsMenuKey {\
|
41
|
+
color: darkslateblue;\
|
42
|
+
font-weight: bold;\
|
43
|
+
}\
|
44
|
+
.ace_optionsMenuCommand {\
|
45
|
+
color: darkcyan;\
|
46
|
+
font-weight: normal;\
|
47
|
+
}\
|
48
|
+
.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {\
|
49
|
+
vertical-align: middle;\
|
50
|
+
}\
|
51
|
+
.ace_optionsMenuEntry button[ace_selected_button=true] {\
|
52
|
+
background: #e7e7e7;\
|
53
|
+
box-shadow: 1px 0px 2px 0px #adadad inset;\
|
54
|
+
border-color: #adadad;\
|
55
|
+
}\
|
56
|
+
.ace_optionsMenuEntry button {\
|
57
|
+
background: white;\
|
58
|
+
border: 1px solid lightgray;\
|
59
|
+
margin: 0px;\
|
60
|
+
}\
|
61
|
+
.ace_optionsMenuEntry button:hover{\
|
62
|
+
background: #f0f0f0;\
|
63
|
+
}";
|
64
|
+
dom.importCssString(cssText);
|
65
|
+
module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
|
66
|
+
top = top ? 'top: ' + top + ';' : '';
|
67
|
+
bottom = bottom ? 'bottom: ' + bottom + ';' : '';
|
68
|
+
right = right ? 'right: ' + right + ';' : '';
|
69
|
+
left = left ? 'left: ' + left + ';' : '';
|
70
|
+
|
71
|
+
var closer = document.createElement('div');
|
72
|
+
var contentContainer = document.createElement('div');
|
73
|
+
|
74
|
+
function documentEscListener(e) {
|
75
|
+
if (e.keyCode === 27) {
|
76
|
+
closer.click();
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
closer.style.cssText = 'margin: 0; padding: 0; ' +
|
81
|
+
'position: fixed; top:0; bottom:0; left:0; right:0;' +
|
82
|
+
'z-index: 9990; ' +
|
83
|
+
'background-color: rgba(0, 0, 0, 0.3);';
|
84
|
+
closer.addEventListener('click', function() {
|
85
|
+
document.removeEventListener('keydown', documentEscListener);
|
86
|
+
closer.parentNode.removeChild(closer);
|
87
|
+
editor.focus();
|
88
|
+
closer = null;
|
89
|
+
});
|
90
|
+
document.addEventListener('keydown', documentEscListener);
|
91
|
+
|
92
|
+
contentContainer.style.cssText = top + right + bottom + left;
|
93
|
+
contentContainer.addEventListener('click', function(e) {
|
94
|
+
e.stopPropagation();
|
95
|
+
});
|
96
|
+
|
97
|
+
var wrapper = dom.createElement("div");
|
98
|
+
wrapper.style.position = "relative";
|
99
|
+
|
100
|
+
var closeButton = dom.createElement("div");
|
101
|
+
closeButton.className = "ace_closeButton";
|
102
|
+
closeButton.addEventListener('click', function() {
|
103
|
+
closer.click();
|
104
|
+
});
|
105
|
+
|
106
|
+
wrapper.appendChild(closeButton);
|
107
|
+
contentContainer.appendChild(wrapper);
|
108
|
+
|
109
|
+
contentContainer.appendChild(contentElement);
|
110
|
+
closer.appendChild(contentContainer);
|
111
|
+
document.body.appendChild(closer);
|
112
|
+
editor.blur();
|
113
|
+
};
|
114
|
+
|
115
|
+
});
|
116
|
+
|
117
|
+
define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",["require","exports","module","ace/lib/keys"], function(require, exports, module) {
|
118
|
+
"use strict";
|
119
|
+
var keys = require("../../lib/keys");
|
120
|
+
module.exports.getEditorKeybordShortcuts = function(editor) {
|
121
|
+
var KEY_MODS = keys.KEY_MODS;
|
122
|
+
var keybindings = [];
|
123
|
+
var commandMap = {};
|
124
|
+
editor.keyBinding.$handlers.forEach(function(handler) {
|
125
|
+
var ckb = handler.commandKeyBinding;
|
126
|
+
for (var i in ckb) {
|
127
|
+
var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase(); });
|
128
|
+
var commands = ckb[i];
|
129
|
+
if (!Array.isArray(commands))
|
130
|
+
commands = [commands];
|
131
|
+
commands.forEach(function(command) {
|
132
|
+
if (typeof command != "string")
|
133
|
+
command = command.name;
|
134
|
+
if (commandMap[command]) {
|
135
|
+
commandMap[command].key += "|" + key;
|
136
|
+
} else {
|
137
|
+
commandMap[command] = {key: key, command: command};
|
138
|
+
keybindings.push(commandMap[command]);
|
139
|
+
}
|
140
|
+
});
|
141
|
+
}
|
142
|
+
});
|
143
|
+
return keybindings;
|
144
|
+
};
|
145
|
+
|
146
|
+
});
|
147
|
+
|
148
|
+
define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace/ext/menu_tools/overlay_page","ace/ext/menu_tools/get_editor_keyboard_shortcuts"], function(require, exports, module) {
|
149
|
+
"use strict";
|
150
|
+
var Editor = require("ace/editor").Editor;
|
151
|
+
function showKeyboardShortcuts (editor) {
|
152
|
+
if(!document.getElementById('kbshortcutmenu')) {
|
153
|
+
var overlayPage = require('./menu_tools/overlay_page').overlayPage;
|
154
|
+
var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts;
|
155
|
+
var kb = getEditorKeybordShortcuts(editor);
|
156
|
+
var el = document.createElement('div');
|
157
|
+
var commands = kb.reduce(function(previous, current) {
|
158
|
+
return previous + '<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">'
|
159
|
+
+ current.command + '</span> : '
|
160
|
+
+ '<span class="ace_optionsMenuKey">' + current.key + '</span></div>';
|
161
|
+
}, '');
|
162
|
+
|
163
|
+
el.id = 'kbshortcutmenu';
|
164
|
+
el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>';
|
165
|
+
overlayPage(editor, el, '0', '0', '0', null);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
module.exports.init = function(editor) {
|
169
|
+
Editor.prototype.showKeyboardShortcuts = function() {
|
170
|
+
showKeyboardShortcuts(this);
|
171
|
+
};
|
172
|
+
editor.commands.addCommands([{
|
173
|
+
name: "showKeyboardShortcuts",
|
174
|
+
bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
|
175
|
+
exec: function(editor, line) {
|
176
|
+
editor.showKeyboardShortcuts();
|
177
|
+
}
|
178
|
+
}]);
|
179
|
+
};
|
180
|
+
|
181
|
+
});
|
182
|
+
(function() {
|
183
|
+
window.require(["ace/ext/keybinding_menu"], function(m) {
|
184
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
185
|
+
module.exports = m;
|
186
|
+
}
|
187
|
+
});
|
188
|
+
})();
|
189
|
+
|
@@ -0,0 +1,1997 @@
|
|
1
|
+
define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/anchor","ace/keyboard/hash_handler","ace/tokenizer","ace/lib/dom","ace/editor"], function(require, exports, module) {
|
2
|
+
"use strict";
|
3
|
+
var oop = require("./lib/oop");
|
4
|
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
5
|
+
var lang = require("./lib/lang");
|
6
|
+
var Range = require("./range").Range;
|
7
|
+
var Anchor = require("./anchor").Anchor;
|
8
|
+
var HashHandler = require("./keyboard/hash_handler").HashHandler;
|
9
|
+
var Tokenizer = require("./tokenizer").Tokenizer;
|
10
|
+
var comparePoints = Range.comparePoints;
|
11
|
+
|
12
|
+
var SnippetManager = function() {
|
13
|
+
this.snippetMap = {};
|
14
|
+
this.snippetNameMap = {};
|
15
|
+
};
|
16
|
+
|
17
|
+
(function() {
|
18
|
+
oop.implement(this, EventEmitter);
|
19
|
+
|
20
|
+
this.getTokenizer = function() {
|
21
|
+
function TabstopToken(str, _, stack) {
|
22
|
+
str = str.substr(1);
|
23
|
+
if (/^\d+$/.test(str) && !stack.inFormatString)
|
24
|
+
return [{tabstopId: parseInt(str, 10)}];
|
25
|
+
return [{text: str}];
|
26
|
+
}
|
27
|
+
function escape(ch) {
|
28
|
+
return "(?:[^\\\\" + ch + "]|\\\\.)";
|
29
|
+
}
|
30
|
+
SnippetManager.$tokenizer = new Tokenizer({
|
31
|
+
start: [
|
32
|
+
{regex: /:/, onMatch: function(val, state, stack) {
|
33
|
+
if (stack.length && stack[0].expectIf) {
|
34
|
+
stack[0].expectIf = false;
|
35
|
+
stack[0].elseBranch = stack[0];
|
36
|
+
return [stack[0]];
|
37
|
+
}
|
38
|
+
return ":";
|
39
|
+
}},
|
40
|
+
{regex: /\\./, onMatch: function(val, state, stack) {
|
41
|
+
var ch = val[1];
|
42
|
+
if (ch == "}" && stack.length) {
|
43
|
+
val = ch;
|
44
|
+
}else if ("`$\\".indexOf(ch) != -1) {
|
45
|
+
val = ch;
|
46
|
+
} else if (stack.inFormatString) {
|
47
|
+
if (ch == "n")
|
48
|
+
val = "\n";
|
49
|
+
else if (ch == "t")
|
50
|
+
val = "\n";
|
51
|
+
else if ("ulULE".indexOf(ch) != -1) {
|
52
|
+
val = {changeCase: ch, local: ch > "a"};
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
return [val];
|
57
|
+
}},
|
58
|
+
{regex: /}/, onMatch: function(val, state, stack) {
|
59
|
+
return [stack.length ? stack.shift() : val];
|
60
|
+
}},
|
61
|
+
{regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken},
|
62
|
+
{regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
|
63
|
+
var t = TabstopToken(str.substr(1), state, stack);
|
64
|
+
stack.unshift(t[0]);
|
65
|
+
return t;
|
66
|
+
}, next: "snippetVar"},
|
67
|
+
{regex: /\n/, token: "newline", merge: false}
|
68
|
+
],
|
69
|
+
snippetVar: [
|
70
|
+
{regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
|
71
|
+
stack[0].choices = val.slice(1, -1).split(",");
|
72
|
+
}, next: "start"},
|
73
|
+
{regex: "/(" + escape("/") + "+)/(?:(" + escape("/") + "*)/)(\\w*):?",
|
74
|
+
onMatch: function(val, state, stack) {
|
75
|
+
var ts = stack[0];
|
76
|
+
ts.fmtString = val;
|
77
|
+
|
78
|
+
val = this.splitRegex.exec(val);
|
79
|
+
ts.guard = val[1];
|
80
|
+
ts.fmt = val[2];
|
81
|
+
ts.flag = val[3];
|
82
|
+
return "";
|
83
|
+
}, next: "start"},
|
84
|
+
{regex: "`" + escape("`") + "*`", onMatch: function(val, state, stack) {
|
85
|
+
stack[0].code = val.splice(1, -1);
|
86
|
+
return "";
|
87
|
+
}, next: "start"},
|
88
|
+
{regex: "\\?", onMatch: function(val, state, stack) {
|
89
|
+
if (stack[0])
|
90
|
+
stack[0].expectIf = true;
|
91
|
+
}, next: "start"},
|
92
|
+
{regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
|
93
|
+
],
|
94
|
+
formatString: [
|
95
|
+
{regex: "/(" + escape("/") + "+)/", token: "regex"},
|
96
|
+
{regex: "", onMatch: function(val, state, stack) {
|
97
|
+
stack.inFormatString = true;
|
98
|
+
}, next: "start"}
|
99
|
+
]
|
100
|
+
});
|
101
|
+
SnippetManager.prototype.getTokenizer = function() {
|
102
|
+
return SnippetManager.$tokenizer;
|
103
|
+
};
|
104
|
+
return SnippetManager.$tokenizer;
|
105
|
+
};
|
106
|
+
|
107
|
+
this.tokenizeTmSnippet = function(str, startState) {
|
108
|
+
return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) {
|
109
|
+
return x.value || x;
|
110
|
+
});
|
111
|
+
};
|
112
|
+
|
113
|
+
this.$getDefaultValue = function(editor, name) {
|
114
|
+
if (/^[A-Z]\d+$/.test(name)) {
|
115
|
+
var i = name.substr(1);
|
116
|
+
return (this.variables[name[0] + "__"] || {})[i];
|
117
|
+
}
|
118
|
+
if (/^\d+$/.test(name)) {
|
119
|
+
return (this.variables.__ || {})[name];
|
120
|
+
}
|
121
|
+
name = name.replace(/^TM_/, "");
|
122
|
+
|
123
|
+
if (!editor)
|
124
|
+
return;
|
125
|
+
var s = editor.session;
|
126
|
+
switch(name) {
|
127
|
+
case "CURRENT_WORD":
|
128
|
+
var r = s.getWordRange();
|
129
|
+
case "SELECTION":
|
130
|
+
case "SELECTED_TEXT":
|
131
|
+
return s.getTextRange(r);
|
132
|
+
case "CURRENT_LINE":
|
133
|
+
return s.getLine(editor.getCursorPosition().row);
|
134
|
+
case "PREV_LINE": // not possible in textmate
|
135
|
+
return s.getLine(editor.getCursorPosition().row - 1);
|
136
|
+
case "LINE_INDEX":
|
137
|
+
return editor.getCursorPosition().column;
|
138
|
+
case "LINE_NUMBER":
|
139
|
+
return editor.getCursorPosition().row + 1;
|
140
|
+
case "SOFT_TABS":
|
141
|
+
return s.getUseSoftTabs() ? "YES" : "NO";
|
142
|
+
case "TAB_SIZE":
|
143
|
+
return s.getTabSize();
|
144
|
+
case "FILENAME":
|
145
|
+
case "FILEPATH":
|
146
|
+
return "";
|
147
|
+
case "FULLNAME":
|
148
|
+
return "Ace";
|
149
|
+
}
|
150
|
+
};
|
151
|
+
this.variables = {};
|
152
|
+
this.getVariableValue = function(editor, varName) {
|
153
|
+
if (this.variables.hasOwnProperty(varName))
|
154
|
+
return this.variables[varName](editor, varName) || "";
|
155
|
+
return this.$getDefaultValue(editor, varName) || "";
|
156
|
+
};
|
157
|
+
this.tmStrFormat = function(str, ch, editor) {
|
158
|
+
var flag = ch.flag || "";
|
159
|
+
var re = ch.guard;
|
160
|
+
re = new RegExp(re, flag.replace(/[^gi]/, ""));
|
161
|
+
var fmtTokens = this.tokenizeTmSnippet(ch.fmt, "formatString");
|
162
|
+
var _self = this;
|
163
|
+
var formatted = str.replace(re, function() {
|
164
|
+
_self.variables.__ = arguments;
|
165
|
+
var fmtParts = _self.resolveVariables(fmtTokens, editor);
|
166
|
+
var gChangeCase = "E";
|
167
|
+
for (var i = 0; i < fmtParts.length; i++) {
|
168
|
+
var ch = fmtParts[i];
|
169
|
+
if (typeof ch == "object") {
|
170
|
+
fmtParts[i] = "";
|
171
|
+
if (ch.changeCase && ch.local) {
|
172
|
+
var next = fmtParts[i + 1];
|
173
|
+
if (next && typeof next == "string") {
|
174
|
+
if (ch.changeCase == "u")
|
175
|
+
fmtParts[i] = next[0].toUpperCase();
|
176
|
+
else
|
177
|
+
fmtParts[i] = next[0].toLowerCase();
|
178
|
+
fmtParts[i + 1] = next.substr(1);
|
179
|
+
}
|
180
|
+
} else if (ch.changeCase) {
|
181
|
+
gChangeCase = ch.changeCase;
|
182
|
+
}
|
183
|
+
} else if (gChangeCase == "U") {
|
184
|
+
fmtParts[i] = ch.toUpperCase();
|
185
|
+
} else if (gChangeCase == "L") {
|
186
|
+
fmtParts[i] = ch.toLowerCase();
|
187
|
+
}
|
188
|
+
}
|
189
|
+
return fmtParts.join("");
|
190
|
+
});
|
191
|
+
this.variables.__ = null;
|
192
|
+
return formatted;
|
193
|
+
};
|
194
|
+
|
195
|
+
this.resolveVariables = function(snippet, editor) {
|
196
|
+
var result = [];
|
197
|
+
for (var i = 0; i < snippet.length; i++) {
|
198
|
+
var ch = snippet[i];
|
199
|
+
if (typeof ch == "string") {
|
200
|
+
result.push(ch);
|
201
|
+
} else if (typeof ch != "object") {
|
202
|
+
continue;
|
203
|
+
} else if (ch.skip) {
|
204
|
+
gotoNext(ch);
|
205
|
+
} else if (ch.processed < i) {
|
206
|
+
continue;
|
207
|
+
} else if (ch.text) {
|
208
|
+
var value = this.getVariableValue(editor, ch.text);
|
209
|
+
if (value && ch.fmtString)
|
210
|
+
value = this.tmStrFormat(value, ch);
|
211
|
+
ch.processed = i;
|
212
|
+
if (ch.expectIf == null) {
|
213
|
+
if (value) {
|
214
|
+
result.push(value);
|
215
|
+
gotoNext(ch);
|
216
|
+
}
|
217
|
+
} else {
|
218
|
+
if (value) {
|
219
|
+
ch.skip = ch.elseBranch;
|
220
|
+
} else
|
221
|
+
gotoNext(ch);
|
222
|
+
}
|
223
|
+
} else if (ch.tabstopId != null) {
|
224
|
+
result.push(ch);
|
225
|
+
} else if (ch.changeCase != null) {
|
226
|
+
result.push(ch);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
function gotoNext(ch) {
|
230
|
+
var i1 = snippet.indexOf(ch, i + 1);
|
231
|
+
if (i1 != -1)
|
232
|
+
i = i1;
|
233
|
+
}
|
234
|
+
return result;
|
235
|
+
};
|
236
|
+
|
237
|
+
this.insertSnippetForSelection = function(editor, snippetText) {
|
238
|
+
var cursor = editor.getCursorPosition();
|
239
|
+
var line = editor.session.getLine(cursor.row);
|
240
|
+
var tabString = editor.session.getTabString();
|
241
|
+
var indentString = line.match(/^\s*/)[0];
|
242
|
+
|
243
|
+
if (cursor.column < indentString.length)
|
244
|
+
indentString = indentString.slice(0, cursor.column);
|
245
|
+
|
246
|
+
snippetText = snippetText.replace(/\r/g, "");
|
247
|
+
var tokens = this.tokenizeTmSnippet(snippetText);
|
248
|
+
tokens = this.resolveVariables(tokens, editor);
|
249
|
+
tokens = tokens.map(function(x) {
|
250
|
+
if (x == "\n")
|
251
|
+
return x + indentString;
|
252
|
+
if (typeof x == "string")
|
253
|
+
return x.replace(/\t/g, tabString);
|
254
|
+
return x;
|
255
|
+
});
|
256
|
+
var tabstops = [];
|
257
|
+
tokens.forEach(function(p, i) {
|
258
|
+
if (typeof p != "object")
|
259
|
+
return;
|
260
|
+
var id = p.tabstopId;
|
261
|
+
var ts = tabstops[id];
|
262
|
+
if (!ts) {
|
263
|
+
ts = tabstops[id] = [];
|
264
|
+
ts.index = id;
|
265
|
+
ts.value = "";
|
266
|
+
}
|
267
|
+
if (ts.indexOf(p) !== -1)
|
268
|
+
return;
|
269
|
+
ts.push(p);
|
270
|
+
var i1 = tokens.indexOf(p, i + 1);
|
271
|
+
if (i1 === -1)
|
272
|
+
return;
|
273
|
+
|
274
|
+
var value = tokens.slice(i + 1, i1);
|
275
|
+
var isNested = value.some(function(t) {return typeof t === "object";});
|
276
|
+
if (isNested && !ts.value) {
|
277
|
+
ts.value = value;
|
278
|
+
} else if (value.length && (!ts.value || typeof ts.value !== "string")) {
|
279
|
+
ts.value = value.join("");
|
280
|
+
}
|
281
|
+
});
|
282
|
+
tabstops.forEach(function(ts) {ts.length = 0;});
|
283
|
+
var expanding = {};
|
284
|
+
function copyValue(val) {
|
285
|
+
var copy = [];
|
286
|
+
for (var i = 0; i < val.length; i++) {
|
287
|
+
var p = val[i];
|
288
|
+
if (typeof p == "object") {
|
289
|
+
if (expanding[p.tabstopId])
|
290
|
+
continue;
|
291
|
+
var j = val.lastIndexOf(p, i - 1);
|
292
|
+
p = copy[j] || {tabstopId: p.tabstopId};
|
293
|
+
}
|
294
|
+
copy[i] = p;
|
295
|
+
}
|
296
|
+
return copy;
|
297
|
+
}
|
298
|
+
for (var i = 0; i < tokens.length; i++) {
|
299
|
+
var p = tokens[i];
|
300
|
+
if (typeof p != "object")
|
301
|
+
continue;
|
302
|
+
var id = p.tabstopId;
|
303
|
+
var i1 = tokens.indexOf(p, i + 1);
|
304
|
+
if (expanding[id]) {
|
305
|
+
if (expanding[id] === p)
|
306
|
+
expanding[id] = null;
|
307
|
+
continue;
|
308
|
+
}
|
309
|
+
|
310
|
+
var ts = tabstops[id];
|
311
|
+
var arg = typeof ts.value == "string" ? [ts.value] : copyValue(ts.value);
|
312
|
+
arg.unshift(i + 1, Math.max(0, i1 - i));
|
313
|
+
arg.push(p);
|
314
|
+
expanding[id] = p;
|
315
|
+
tokens.splice.apply(tokens, arg);
|
316
|
+
|
317
|
+
if (ts.indexOf(p) === -1)
|
318
|
+
ts.push(p);
|
319
|
+
}
|
320
|
+
var row = 0, column = 0;
|
321
|
+
var text = "";
|
322
|
+
tokens.forEach(function(t) {
|
323
|
+
if (typeof t === "string") {
|
324
|
+
var lines = t.split("\n");
|
325
|
+
if (lines.length > 1){
|
326
|
+
column = lines[lines.length - 1].length;
|
327
|
+
row += lines.length - 1;
|
328
|
+
} else
|
329
|
+
column += t.length;
|
330
|
+
text += t;
|
331
|
+
} else {
|
332
|
+
if (!t.start)
|
333
|
+
t.start = {row: row, column: column};
|
334
|
+
else
|
335
|
+
t.end = {row: row, column: column};
|
336
|
+
}
|
337
|
+
});
|
338
|
+
var range = editor.getSelectionRange();
|
339
|
+
var end = editor.session.replace(range, text);
|
340
|
+
|
341
|
+
var tabstopManager = new TabstopManager(editor);
|
342
|
+
var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
|
343
|
+
tabstopManager.addTabstops(tabstops, range.start, end, selectionId);
|
344
|
+
};
|
345
|
+
|
346
|
+
this.insertSnippet = function(editor, snippetText) {
|
347
|
+
var self = this;
|
348
|
+
if (editor.inVirtualSelectionMode)
|
349
|
+
return self.insertSnippetForSelection(editor, snippetText);
|
350
|
+
|
351
|
+
editor.forEachSelection(function() {
|
352
|
+
self.insertSnippetForSelection(editor, snippetText);
|
353
|
+
}, null, {keepOrder: true});
|
354
|
+
|
355
|
+
if (editor.tabstopManager)
|
356
|
+
editor.tabstopManager.tabNext();
|
357
|
+
};
|
358
|
+
|
359
|
+
this.$getScope = function(editor) {
|
360
|
+
var scope = editor.session.$mode.$id || "";
|
361
|
+
scope = scope.split("/").pop();
|
362
|
+
if (scope === "html" || scope === "php") {
|
363
|
+
if (scope === "php" && !editor.session.$mode.inlinePhp)
|
364
|
+
scope = "html";
|
365
|
+
var c = editor.getCursorPosition();
|
366
|
+
var state = editor.session.getState(c.row);
|
367
|
+
if (typeof state === "object") {
|
368
|
+
state = state[0];
|
369
|
+
}
|
370
|
+
if (state.substring) {
|
371
|
+
if (state.substring(0, 3) == "js-")
|
372
|
+
scope = "javascript";
|
373
|
+
else if (state.substring(0, 4) == "css-")
|
374
|
+
scope = "css";
|
375
|
+
else if (state.substring(0, 4) == "php-")
|
376
|
+
scope = "php";
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
380
|
+
return scope;
|
381
|
+
};
|
382
|
+
|
383
|
+
this.getActiveScopes = function(editor) {
|
384
|
+
var scope = this.$getScope(editor);
|
385
|
+
var scopes = [scope];
|
386
|
+
var snippetMap = this.snippetMap;
|
387
|
+
if (snippetMap[scope] && snippetMap[scope].includeScopes) {
|
388
|
+
scopes.push.apply(scopes, snippetMap[scope].includeScopes);
|
389
|
+
}
|
390
|
+
scopes.push("_");
|
391
|
+
return scopes;
|
392
|
+
};
|
393
|
+
|
394
|
+
this.expandWithTab = function(editor, options) {
|
395
|
+
var self = this;
|
396
|
+
var result = editor.forEachSelection(function() {
|
397
|
+
return self.expandSnippetForSelection(editor, options);
|
398
|
+
}, null, {keepOrder: true});
|
399
|
+
if (result && editor.tabstopManager)
|
400
|
+
editor.tabstopManager.tabNext();
|
401
|
+
return result;
|
402
|
+
};
|
403
|
+
|
404
|
+
this.expandSnippetForSelection = function(editor, options) {
|
405
|
+
var cursor = editor.getCursorPosition();
|
406
|
+
var line = editor.session.getLine(cursor.row);
|
407
|
+
var before = line.substring(0, cursor.column);
|
408
|
+
var after = line.substr(cursor.column);
|
409
|
+
|
410
|
+
var snippetMap = this.snippetMap;
|
411
|
+
var snippet;
|
412
|
+
this.getActiveScopes(editor).some(function(scope) {
|
413
|
+
var snippets = snippetMap[scope];
|
414
|
+
if (snippets)
|
415
|
+
snippet = this.findMatchingSnippet(snippets, before, after);
|
416
|
+
return !!snippet;
|
417
|
+
}, this);
|
418
|
+
if (!snippet)
|
419
|
+
return false;
|
420
|
+
if (options && options.dryRun)
|
421
|
+
return true;
|
422
|
+
editor.session.doc.removeInLine(cursor.row,
|
423
|
+
cursor.column - snippet.replaceBefore.length,
|
424
|
+
cursor.column + snippet.replaceAfter.length
|
425
|
+
);
|
426
|
+
|
427
|
+
this.variables.M__ = snippet.matchBefore;
|
428
|
+
this.variables.T__ = snippet.matchAfter;
|
429
|
+
this.insertSnippetForSelection(editor, snippet.content);
|
430
|
+
|
431
|
+
this.variables.M__ = this.variables.T__ = null;
|
432
|
+
return true;
|
433
|
+
};
|
434
|
+
|
435
|
+
this.findMatchingSnippet = function(snippetList, before, after) {
|
436
|
+
for (var i = snippetList.length; i--;) {
|
437
|
+
var s = snippetList[i];
|
438
|
+
if (s.startRe && !s.startRe.test(before))
|
439
|
+
continue;
|
440
|
+
if (s.endRe && !s.endRe.test(after))
|
441
|
+
continue;
|
442
|
+
if (!s.startRe && !s.endRe)
|
443
|
+
continue;
|
444
|
+
|
445
|
+
s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
|
446
|
+
s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
|
447
|
+
s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
|
448
|
+
s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
|
449
|
+
return s;
|
450
|
+
}
|
451
|
+
};
|
452
|
+
|
453
|
+
this.snippetMap = {};
|
454
|
+
this.snippetNameMap = {};
|
455
|
+
this.register = function(snippets, scope) {
|
456
|
+
var snippetMap = this.snippetMap;
|
457
|
+
var snippetNameMap = this.snippetNameMap;
|
458
|
+
var self = this;
|
459
|
+
|
460
|
+
if (!snippets)
|
461
|
+
snippets = [];
|
462
|
+
|
463
|
+
function wrapRegexp(src) {
|
464
|
+
if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
|
465
|
+
src = "(?:" + src + ")";
|
466
|
+
|
467
|
+
return src || "";
|
468
|
+
}
|
469
|
+
function guardedRegexp(re, guard, opening) {
|
470
|
+
re = wrapRegexp(re);
|
471
|
+
guard = wrapRegexp(guard);
|
472
|
+
if (opening) {
|
473
|
+
re = guard + re;
|
474
|
+
if (re && re[re.length - 1] != "$")
|
475
|
+
re = re + "$";
|
476
|
+
} else {
|
477
|
+
re = re + guard;
|
478
|
+
if (re && re[0] != "^")
|
479
|
+
re = "^" + re;
|
480
|
+
}
|
481
|
+
return new RegExp(re);
|
482
|
+
}
|
483
|
+
|
484
|
+
function addSnippet(s) {
|
485
|
+
if (!s.scope)
|
486
|
+
s.scope = scope || "_";
|
487
|
+
scope = s.scope;
|
488
|
+
if (!snippetMap[scope]) {
|
489
|
+
snippetMap[scope] = [];
|
490
|
+
snippetNameMap[scope] = {};
|
491
|
+
}
|
492
|
+
|
493
|
+
var map = snippetNameMap[scope];
|
494
|
+
if (s.name) {
|
495
|
+
var old = map[s.name];
|
496
|
+
if (old)
|
497
|
+
self.unregister(old);
|
498
|
+
map[s.name] = s;
|
499
|
+
}
|
500
|
+
snippetMap[scope].push(s);
|
501
|
+
|
502
|
+
if (s.tabTrigger && !s.trigger) {
|
503
|
+
if (!s.guard && /^\w/.test(s.tabTrigger))
|
504
|
+
s.guard = "\\b";
|
505
|
+
s.trigger = lang.escapeRegExp(s.tabTrigger);
|
506
|
+
}
|
507
|
+
|
508
|
+
if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
|
509
|
+
return;
|
510
|
+
|
511
|
+
s.startRe = guardedRegexp(s.trigger, s.guard, true);
|
512
|
+
s.triggerRe = new RegExp(s.trigger);
|
513
|
+
|
514
|
+
s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
|
515
|
+
s.endTriggerRe = new RegExp(s.endTrigger);
|
516
|
+
}
|
517
|
+
|
518
|
+
if (snippets && snippets.content)
|
519
|
+
addSnippet(snippets);
|
520
|
+
else if (Array.isArray(snippets))
|
521
|
+
snippets.forEach(addSnippet);
|
522
|
+
|
523
|
+
this._signal("registerSnippets", {scope: scope});
|
524
|
+
};
|
525
|
+
this.unregister = function(snippets, scope) {
|
526
|
+
var snippetMap = this.snippetMap;
|
527
|
+
var snippetNameMap = this.snippetNameMap;
|
528
|
+
|
529
|
+
function removeSnippet(s) {
|
530
|
+
var nameMap = snippetNameMap[s.scope||scope];
|
531
|
+
if (nameMap && nameMap[s.name]) {
|
532
|
+
delete nameMap[s.name];
|
533
|
+
var map = snippetMap[s.scope||scope];
|
534
|
+
var i = map && map.indexOf(s);
|
535
|
+
if (i >= 0)
|
536
|
+
map.splice(i, 1);
|
537
|
+
}
|
538
|
+
}
|
539
|
+
if (snippets.content)
|
540
|
+
removeSnippet(snippets);
|
541
|
+
else if (Array.isArray(snippets))
|
542
|
+
snippets.forEach(removeSnippet);
|
543
|
+
};
|
544
|
+
this.parseSnippetFile = function(str) {
|
545
|
+
str = str.replace(/\r/g, "");
|
546
|
+
var list = [], snippet = {};
|
547
|
+
var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
|
548
|
+
var m;
|
549
|
+
while (m = re.exec(str)) {
|
550
|
+
if (m[1]) {
|
551
|
+
try {
|
552
|
+
snippet = JSON.parse(m[1]);
|
553
|
+
list.push(snippet);
|
554
|
+
} catch (e) {}
|
555
|
+
} if (m[4]) {
|
556
|
+
snippet.content = m[4].replace(/^\t/gm, "");
|
557
|
+
list.push(snippet);
|
558
|
+
snippet = {};
|
559
|
+
} else {
|
560
|
+
var key = m[2], val = m[3];
|
561
|
+
if (key == "regex") {
|
562
|
+
var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
|
563
|
+
snippet.guard = guardRe.exec(val)[1];
|
564
|
+
snippet.trigger = guardRe.exec(val)[1];
|
565
|
+
snippet.endTrigger = guardRe.exec(val)[1];
|
566
|
+
snippet.endGuard = guardRe.exec(val)[1];
|
567
|
+
} else if (key == "snippet") {
|
568
|
+
snippet.tabTrigger = val.match(/^\S*/)[0];
|
569
|
+
if (!snippet.name)
|
570
|
+
snippet.name = val;
|
571
|
+
} else {
|
572
|
+
snippet[key] = val;
|
573
|
+
}
|
574
|
+
}
|
575
|
+
}
|
576
|
+
return list;
|
577
|
+
};
|
578
|
+
this.getSnippetByName = function(name, editor) {
|
579
|
+
var snippetMap = this.snippetNameMap;
|
580
|
+
var snippet;
|
581
|
+
this.getActiveScopes(editor).some(function(scope) {
|
582
|
+
var snippets = snippetMap[scope];
|
583
|
+
if (snippets)
|
584
|
+
snippet = snippets[name];
|
585
|
+
return !!snippet;
|
586
|
+
}, this);
|
587
|
+
return snippet;
|
588
|
+
};
|
589
|
+
|
590
|
+
}).call(SnippetManager.prototype);
|
591
|
+
|
592
|
+
|
593
|
+
var TabstopManager = function(editor) {
|
594
|
+
if (editor.tabstopManager)
|
595
|
+
return editor.tabstopManager;
|
596
|
+
editor.tabstopManager = this;
|
597
|
+
this.$onChange = this.onChange.bind(this);
|
598
|
+
this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
|
599
|
+
this.$onChangeSession = this.onChangeSession.bind(this);
|
600
|
+
this.$onAfterExec = this.onAfterExec.bind(this);
|
601
|
+
this.attach(editor);
|
602
|
+
};
|
603
|
+
(function() {
|
604
|
+
this.attach = function(editor) {
|
605
|
+
this.index = 0;
|
606
|
+
this.ranges = [];
|
607
|
+
this.tabstops = [];
|
608
|
+
this.$openTabstops = null;
|
609
|
+
this.selectedTabstop = null;
|
610
|
+
|
611
|
+
this.editor = editor;
|
612
|
+
this.editor.on("change", this.$onChange);
|
613
|
+
this.editor.on("changeSelection", this.$onChangeSelection);
|
614
|
+
this.editor.on("changeSession", this.$onChangeSession);
|
615
|
+
this.editor.commands.on("afterExec", this.$onAfterExec);
|
616
|
+
this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
617
|
+
};
|
618
|
+
this.detach = function() {
|
619
|
+
this.tabstops.forEach(this.removeTabstopMarkers, this);
|
620
|
+
this.ranges = null;
|
621
|
+
this.tabstops = null;
|
622
|
+
this.selectedTabstop = null;
|
623
|
+
this.editor.removeListener("change", this.$onChange);
|
624
|
+
this.editor.removeListener("changeSelection", this.$onChangeSelection);
|
625
|
+
this.editor.removeListener("changeSession", this.$onChangeSession);
|
626
|
+
this.editor.commands.removeListener("afterExec", this.$onAfterExec);
|
627
|
+
this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
|
628
|
+
this.editor.tabstopManager = null;
|
629
|
+
this.editor = null;
|
630
|
+
};
|
631
|
+
|
632
|
+
this.onChange = function(delta) {
|
633
|
+
var changeRange = delta;
|
634
|
+
var isRemove = delta.action[0] == "r";
|
635
|
+
var start = delta.start;
|
636
|
+
var end = delta.end;
|
637
|
+
var startRow = start.row;
|
638
|
+
var endRow = end.row;
|
639
|
+
var lineDif = endRow - startRow;
|
640
|
+
var colDiff = end.column - start.column;
|
641
|
+
|
642
|
+
if (isRemove) {
|
643
|
+
lineDif = -lineDif;
|
644
|
+
colDiff = -colDiff;
|
645
|
+
}
|
646
|
+
if (!this.$inChange && isRemove) {
|
647
|
+
var ts = this.selectedTabstop;
|
648
|
+
var changedOutside = ts && !ts.some(function(r) {
|
649
|
+
return comparePoints(r.start, start) <= 0 && comparePoints(r.end, end) >= 0;
|
650
|
+
});
|
651
|
+
if (changedOutside)
|
652
|
+
return this.detach();
|
653
|
+
}
|
654
|
+
var ranges = this.ranges;
|
655
|
+
for (var i = 0; i < ranges.length; i++) {
|
656
|
+
var r = ranges[i];
|
657
|
+
if (r.end.row < start.row)
|
658
|
+
continue;
|
659
|
+
|
660
|
+
if (isRemove && comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {
|
661
|
+
this.removeRange(r);
|
662
|
+
i--;
|
663
|
+
continue;
|
664
|
+
}
|
665
|
+
|
666
|
+
if (r.start.row == startRow && r.start.column > start.column)
|
667
|
+
r.start.column += colDiff;
|
668
|
+
if (r.end.row == startRow && r.end.column >= start.column)
|
669
|
+
r.end.column += colDiff;
|
670
|
+
if (r.start.row >= startRow)
|
671
|
+
r.start.row += lineDif;
|
672
|
+
if (r.end.row >= startRow)
|
673
|
+
r.end.row += lineDif;
|
674
|
+
|
675
|
+
if (comparePoints(r.start, r.end) > 0)
|
676
|
+
this.removeRange(r);
|
677
|
+
}
|
678
|
+
if (!ranges.length)
|
679
|
+
this.detach();
|
680
|
+
};
|
681
|
+
this.updateLinkedFields = function() {
|
682
|
+
var ts = this.selectedTabstop;
|
683
|
+
if (!ts || !ts.hasLinkedRanges)
|
684
|
+
return;
|
685
|
+
this.$inChange = true;
|
686
|
+
var session = this.editor.session;
|
687
|
+
var text = session.getTextRange(ts.firstNonLinked);
|
688
|
+
for (var i = ts.length; i--;) {
|
689
|
+
var range = ts[i];
|
690
|
+
if (!range.linked)
|
691
|
+
continue;
|
692
|
+
var fmt = exports.snippetManager.tmStrFormat(text, range.original);
|
693
|
+
session.replace(range, fmt);
|
694
|
+
}
|
695
|
+
this.$inChange = false;
|
696
|
+
};
|
697
|
+
this.onAfterExec = function(e) {
|
698
|
+
if (e.command && !e.command.readOnly)
|
699
|
+
this.updateLinkedFields();
|
700
|
+
};
|
701
|
+
this.onChangeSelection = function() {
|
702
|
+
if (!this.editor)
|
703
|
+
return;
|
704
|
+
var lead = this.editor.selection.lead;
|
705
|
+
var anchor = this.editor.selection.anchor;
|
706
|
+
var isEmpty = this.editor.selection.isEmpty();
|
707
|
+
for (var i = this.ranges.length; i--;) {
|
708
|
+
if (this.ranges[i].linked)
|
709
|
+
continue;
|
710
|
+
var containsLead = this.ranges[i].contains(lead.row, lead.column);
|
711
|
+
var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
|
712
|
+
if (containsLead && containsAnchor)
|
713
|
+
return;
|
714
|
+
}
|
715
|
+
this.detach();
|
716
|
+
};
|
717
|
+
this.onChangeSession = function() {
|
718
|
+
this.detach();
|
719
|
+
};
|
720
|
+
this.tabNext = function(dir) {
|
721
|
+
var max = this.tabstops.length;
|
722
|
+
var index = this.index + (dir || 1);
|
723
|
+
index = Math.min(Math.max(index, 1), max);
|
724
|
+
if (index == max)
|
725
|
+
index = 0;
|
726
|
+
this.selectTabstop(index);
|
727
|
+
if (index === 0)
|
728
|
+
this.detach();
|
729
|
+
};
|
730
|
+
this.selectTabstop = function(index) {
|
731
|
+
this.$openTabstops = null;
|
732
|
+
var ts = this.tabstops[this.index];
|
733
|
+
if (ts)
|
734
|
+
this.addTabstopMarkers(ts);
|
735
|
+
this.index = index;
|
736
|
+
ts = this.tabstops[this.index];
|
737
|
+
if (!ts || !ts.length)
|
738
|
+
return;
|
739
|
+
|
740
|
+
this.selectedTabstop = ts;
|
741
|
+
if (!this.editor.inVirtualSelectionMode) {
|
742
|
+
var sel = this.editor.multiSelect;
|
743
|
+
sel.toSingleRange(ts.firstNonLinked.clone());
|
744
|
+
for (var i = ts.length; i--;) {
|
745
|
+
if (ts.hasLinkedRanges && ts[i].linked)
|
746
|
+
continue;
|
747
|
+
sel.addRange(ts[i].clone(), true);
|
748
|
+
}
|
749
|
+
if (sel.ranges[0])
|
750
|
+
sel.addRange(sel.ranges[0].clone());
|
751
|
+
} else {
|
752
|
+
this.editor.selection.setRange(ts.firstNonLinked);
|
753
|
+
}
|
754
|
+
|
755
|
+
this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
756
|
+
};
|
757
|
+
this.addTabstops = function(tabstops, start, end) {
|
758
|
+
if (!this.$openTabstops)
|
759
|
+
this.$openTabstops = [];
|
760
|
+
if (!tabstops[0]) {
|
761
|
+
var p = Range.fromPoints(end, end);
|
762
|
+
moveRelative(p.start, start);
|
763
|
+
moveRelative(p.end, start);
|
764
|
+
tabstops[0] = [p];
|
765
|
+
tabstops[0].index = 0;
|
766
|
+
}
|
767
|
+
|
768
|
+
var i = this.index;
|
769
|
+
var arg = [i + 1, 0];
|
770
|
+
var ranges = this.ranges;
|
771
|
+
tabstops.forEach(function(ts, index) {
|
772
|
+
var dest = this.$openTabstops[index] || ts;
|
773
|
+
|
774
|
+
for (var i = ts.length; i--;) {
|
775
|
+
var p = ts[i];
|
776
|
+
var range = Range.fromPoints(p.start, p.end || p.start);
|
777
|
+
movePoint(range.start, start);
|
778
|
+
movePoint(range.end, start);
|
779
|
+
range.original = p;
|
780
|
+
range.tabstop = dest;
|
781
|
+
ranges.push(range);
|
782
|
+
if (dest != ts)
|
783
|
+
dest.unshift(range);
|
784
|
+
else
|
785
|
+
dest[i] = range;
|
786
|
+
if (p.fmtString) {
|
787
|
+
range.linked = true;
|
788
|
+
dest.hasLinkedRanges = true;
|
789
|
+
} else if (!dest.firstNonLinked)
|
790
|
+
dest.firstNonLinked = range;
|
791
|
+
}
|
792
|
+
if (!dest.firstNonLinked)
|
793
|
+
dest.hasLinkedRanges = false;
|
794
|
+
if (dest === ts) {
|
795
|
+
arg.push(dest);
|
796
|
+
this.$openTabstops[index] = dest;
|
797
|
+
}
|
798
|
+
this.addTabstopMarkers(dest);
|
799
|
+
}, this);
|
800
|
+
|
801
|
+
if (arg.length > 2) {
|
802
|
+
if (this.tabstops.length)
|
803
|
+
arg.push(arg.splice(2, 1)[0]);
|
804
|
+
this.tabstops.splice.apply(this.tabstops, arg);
|
805
|
+
}
|
806
|
+
};
|
807
|
+
|
808
|
+
this.addTabstopMarkers = function(ts) {
|
809
|
+
var session = this.editor.session;
|
810
|
+
ts.forEach(function(range) {
|
811
|
+
if (!range.markerId)
|
812
|
+
range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
|
813
|
+
});
|
814
|
+
};
|
815
|
+
this.removeTabstopMarkers = function(ts) {
|
816
|
+
var session = this.editor.session;
|
817
|
+
ts.forEach(function(range) {
|
818
|
+
session.removeMarker(range.markerId);
|
819
|
+
range.markerId = null;
|
820
|
+
});
|
821
|
+
};
|
822
|
+
this.removeRange = function(range) {
|
823
|
+
var i = range.tabstop.indexOf(range);
|
824
|
+
range.tabstop.splice(i, 1);
|
825
|
+
i = this.ranges.indexOf(range);
|
826
|
+
this.ranges.splice(i, 1);
|
827
|
+
this.editor.session.removeMarker(range.markerId);
|
828
|
+
if (!range.tabstop.length) {
|
829
|
+
i = this.tabstops.indexOf(range.tabstop);
|
830
|
+
if (i != -1)
|
831
|
+
this.tabstops.splice(i, 1);
|
832
|
+
if (!this.tabstops.length)
|
833
|
+
this.detach();
|
834
|
+
}
|
835
|
+
};
|
836
|
+
|
837
|
+
this.keyboardHandler = new HashHandler();
|
838
|
+
this.keyboardHandler.bindKeys({
|
839
|
+
"Tab": function(ed) {
|
840
|
+
if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
|
841
|
+
return;
|
842
|
+
}
|
843
|
+
|
844
|
+
ed.tabstopManager.tabNext(1);
|
845
|
+
},
|
846
|
+
"Shift-Tab": function(ed) {
|
847
|
+
ed.tabstopManager.tabNext(-1);
|
848
|
+
},
|
849
|
+
"Esc": function(ed) {
|
850
|
+
ed.tabstopManager.detach();
|
851
|
+
},
|
852
|
+
"Return": function(ed) {
|
853
|
+
return false;
|
854
|
+
}
|
855
|
+
});
|
856
|
+
}).call(TabstopManager.prototype);
|
857
|
+
|
858
|
+
|
859
|
+
|
860
|
+
var changeTracker = {};
|
861
|
+
changeTracker.onChange = Anchor.prototype.onChange;
|
862
|
+
changeTracker.setPosition = function(row, column) {
|
863
|
+
this.pos.row = row;
|
864
|
+
this.pos.column = column;
|
865
|
+
};
|
866
|
+
changeTracker.update = function(pos, delta, $insertRight) {
|
867
|
+
this.$insertRight = $insertRight;
|
868
|
+
this.pos = pos;
|
869
|
+
this.onChange(delta);
|
870
|
+
};
|
871
|
+
|
872
|
+
var movePoint = function(point, diff) {
|
873
|
+
if (point.row == 0)
|
874
|
+
point.column += diff.column;
|
875
|
+
point.row += diff.row;
|
876
|
+
};
|
877
|
+
|
878
|
+
var moveRelative = function(point, start) {
|
879
|
+
if (point.row == start.row)
|
880
|
+
point.column -= start.column;
|
881
|
+
point.row -= start.row;
|
882
|
+
};
|
883
|
+
|
884
|
+
|
885
|
+
require("./lib/dom").importCssString("\
|
886
|
+
.ace_snippet-marker {\
|
887
|
+
-moz-box-sizing: border-box;\
|
888
|
+
box-sizing: border-box;\
|
889
|
+
background: rgba(194, 193, 208, 0.09);\
|
890
|
+
border: 1px dotted rgba(211, 208, 235, 0.62);\
|
891
|
+
position: absolute;\
|
892
|
+
}");
|
893
|
+
|
894
|
+
exports.snippetManager = new SnippetManager();
|
895
|
+
|
896
|
+
|
897
|
+
var Editor = require("./editor").Editor;
|
898
|
+
(function() {
|
899
|
+
this.insertSnippet = function(content, options) {
|
900
|
+
return exports.snippetManager.insertSnippet(this, content, options);
|
901
|
+
};
|
902
|
+
this.expandSnippet = function(options) {
|
903
|
+
return exports.snippetManager.expandWithTab(this, options);
|
904
|
+
};
|
905
|
+
}).call(Editor.prototype);
|
906
|
+
|
907
|
+
});
|
908
|
+
|
909
|
+
define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom"], function(require, exports, module) {
|
910
|
+
"use strict";
|
911
|
+
|
912
|
+
var Renderer = require("../virtual_renderer").VirtualRenderer;
|
913
|
+
var Editor = require("../editor").Editor;
|
914
|
+
var Range = require("../range").Range;
|
915
|
+
var event = require("../lib/event");
|
916
|
+
var lang = require("../lib/lang");
|
917
|
+
var dom = require("../lib/dom");
|
918
|
+
|
919
|
+
var $singleLineEditor = function(el) {
|
920
|
+
var renderer = new Renderer(el);
|
921
|
+
|
922
|
+
renderer.$maxLines = 4;
|
923
|
+
|
924
|
+
var editor = new Editor(renderer);
|
925
|
+
|
926
|
+
editor.setHighlightActiveLine(false);
|
927
|
+
editor.setShowPrintMargin(false);
|
928
|
+
editor.renderer.setShowGutter(false);
|
929
|
+
editor.renderer.setHighlightGutterLine(false);
|
930
|
+
|
931
|
+
editor.$mouseHandler.$focusTimeout = 0;
|
932
|
+
editor.$highlightTagPending = true;
|
933
|
+
|
934
|
+
return editor;
|
935
|
+
};
|
936
|
+
|
937
|
+
var AcePopup = function(parentNode) {
|
938
|
+
var el = dom.createElement("div");
|
939
|
+
var popup = new $singleLineEditor(el);
|
940
|
+
|
941
|
+
if (parentNode)
|
942
|
+
parentNode.appendChild(el);
|
943
|
+
el.style.display = "none";
|
944
|
+
popup.renderer.content.style.cursor = "default";
|
945
|
+
popup.renderer.setStyle("ace_autocomplete");
|
946
|
+
|
947
|
+
popup.setOption("displayIndentGuides", false);
|
948
|
+
popup.setOption("dragDelay", 150);
|
949
|
+
|
950
|
+
var noop = function(){};
|
951
|
+
|
952
|
+
popup.focus = noop;
|
953
|
+
popup.$isFocused = true;
|
954
|
+
|
955
|
+
popup.renderer.$cursorLayer.restartTimer = noop;
|
956
|
+
popup.renderer.$cursorLayer.element.style.opacity = 0;
|
957
|
+
|
958
|
+
popup.renderer.$maxLines = 8;
|
959
|
+
popup.renderer.$keepTextAreaAtCursor = false;
|
960
|
+
|
961
|
+
popup.setHighlightActiveLine(false);
|
962
|
+
popup.session.highlight("");
|
963
|
+
popup.session.$searchHighlight.clazz = "ace_highlight-marker";
|
964
|
+
|
965
|
+
popup.on("mousedown", function(e) {
|
966
|
+
var pos = e.getDocumentPosition();
|
967
|
+
popup.selection.moveToPosition(pos);
|
968
|
+
selectionMarker.start.row = selectionMarker.end.row = pos.row;
|
969
|
+
e.stop();
|
970
|
+
});
|
971
|
+
|
972
|
+
var lastMouseEvent;
|
973
|
+
var hoverMarker = new Range(-1,0,-1,Infinity);
|
974
|
+
var selectionMarker = new Range(-1,0,-1,Infinity);
|
975
|
+
selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
|
976
|
+
popup.setSelectOnHover = function(val) {
|
977
|
+
if (!val) {
|
978
|
+
hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
|
979
|
+
} else if (hoverMarker.id) {
|
980
|
+
popup.session.removeMarker(hoverMarker.id);
|
981
|
+
hoverMarker.id = null;
|
982
|
+
}
|
983
|
+
};
|
984
|
+
popup.setSelectOnHover(false);
|
985
|
+
popup.on("mousemove", function(e) {
|
986
|
+
if (!lastMouseEvent) {
|
987
|
+
lastMouseEvent = e;
|
988
|
+
return;
|
989
|
+
}
|
990
|
+
if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
|
991
|
+
return;
|
992
|
+
}
|
993
|
+
lastMouseEvent = e;
|
994
|
+
lastMouseEvent.scrollTop = popup.renderer.scrollTop;
|
995
|
+
var row = lastMouseEvent.getDocumentPosition().row;
|
996
|
+
if (hoverMarker.start.row != row) {
|
997
|
+
if (!hoverMarker.id)
|
998
|
+
popup.setRow(row);
|
999
|
+
setHoverMarker(row);
|
1000
|
+
}
|
1001
|
+
});
|
1002
|
+
popup.renderer.on("beforeRender", function() {
|
1003
|
+
if (lastMouseEvent && hoverMarker.start.row != -1) {
|
1004
|
+
lastMouseEvent.$pos = null;
|
1005
|
+
var row = lastMouseEvent.getDocumentPosition().row;
|
1006
|
+
if (!hoverMarker.id)
|
1007
|
+
popup.setRow(row);
|
1008
|
+
setHoverMarker(row, true);
|
1009
|
+
}
|
1010
|
+
});
|
1011
|
+
popup.renderer.on("afterRender", function() {
|
1012
|
+
var row = popup.getRow();
|
1013
|
+
var t = popup.renderer.$textLayer;
|
1014
|
+
var selected = t.element.childNodes[row - t.config.firstRow];
|
1015
|
+
if (selected == t.selectedNode)
|
1016
|
+
return;
|
1017
|
+
if (t.selectedNode)
|
1018
|
+
dom.removeCssClass(t.selectedNode, "ace_selected");
|
1019
|
+
t.selectedNode = selected;
|
1020
|
+
if (selected)
|
1021
|
+
dom.addCssClass(selected, "ace_selected");
|
1022
|
+
});
|
1023
|
+
var hideHoverMarker = function() { setHoverMarker(-1); };
|
1024
|
+
var setHoverMarker = function(row, suppressRedraw) {
|
1025
|
+
if (row !== hoverMarker.start.row) {
|
1026
|
+
hoverMarker.start.row = hoverMarker.end.row = row;
|
1027
|
+
if (!suppressRedraw)
|
1028
|
+
popup.session._emit("changeBackMarker");
|
1029
|
+
popup._emit("changeHoverMarker");
|
1030
|
+
}
|
1031
|
+
};
|
1032
|
+
popup.getHoveredRow = function() {
|
1033
|
+
return hoverMarker.start.row;
|
1034
|
+
};
|
1035
|
+
|
1036
|
+
event.addListener(popup.container, "mouseout", hideHoverMarker);
|
1037
|
+
popup.on("hide", hideHoverMarker);
|
1038
|
+
popup.on("changeSelection", hideHoverMarker);
|
1039
|
+
|
1040
|
+
popup.session.doc.getLength = function() {
|
1041
|
+
return popup.data.length;
|
1042
|
+
};
|
1043
|
+
popup.session.doc.getLine = function(i) {
|
1044
|
+
var data = popup.data[i];
|
1045
|
+
if (typeof data == "string")
|
1046
|
+
return data;
|
1047
|
+
return (data && data.value) || "";
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
var bgTokenizer = popup.session.bgTokenizer;
|
1051
|
+
bgTokenizer.$tokenizeRow = function(row) {
|
1052
|
+
var data = popup.data[row];
|
1053
|
+
var tokens = [];
|
1054
|
+
if (!data)
|
1055
|
+
return tokens;
|
1056
|
+
if (typeof data == "string")
|
1057
|
+
data = {value: data};
|
1058
|
+
var caption = data.caption || data.value || data.name;
|
1059
|
+
|
1060
|
+
function addToken(value, className) {
|
1061
|
+
value && tokens.push({
|
1062
|
+
type: (data.className || "") + (className || ""),
|
1063
|
+
value: value
|
1064
|
+
});
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
var lower = caption.toLowerCase();
|
1068
|
+
var filterText = (popup.filterText || "").toLowerCase();
|
1069
|
+
var lastIndex = 0;
|
1070
|
+
var lastI = 0;
|
1071
|
+
for (var i = 0; i <= filterText.length; i++) {
|
1072
|
+
if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
|
1073
|
+
var sub = filterText.slice(lastI, i);
|
1074
|
+
lastI = i;
|
1075
|
+
var index = lower.indexOf(sub);
|
1076
|
+
if (index == -1) continue;
|
1077
|
+
addToken(caption.slice(lastIndex, index), "");
|
1078
|
+
lastIndex = index + sub.length;
|
1079
|
+
addToken(caption.slice(index, lastIndex), "completion-highlight");
|
1080
|
+
}
|
1081
|
+
}
|
1082
|
+
addToken(caption.slice(lastIndex, caption.length), "");
|
1083
|
+
|
1084
|
+
if (data.meta)
|
1085
|
+
tokens.push({type: "completion-meta", value: data.meta});
|
1086
|
+
|
1087
|
+
return tokens;
|
1088
|
+
};
|
1089
|
+
bgTokenizer.$updateOnChange = noop;
|
1090
|
+
bgTokenizer.start = noop;
|
1091
|
+
|
1092
|
+
popup.session.$computeWidth = function() {
|
1093
|
+
return this.screenWidth = 0;
|
1094
|
+
};
|
1095
|
+
popup.isOpen = false;
|
1096
|
+
popup.isTopdown = false;
|
1097
|
+
popup.autoSelect = true;
|
1098
|
+
popup.filterText = "";
|
1099
|
+
|
1100
|
+
popup.data = [];
|
1101
|
+
popup.setData = function(list, filterText) {
|
1102
|
+
popup.filterText = filterText || "";
|
1103
|
+
popup.setValue(lang.stringRepeat("\n", list.length), -1);
|
1104
|
+
popup.data = list || [];
|
1105
|
+
popup.setRow(0);
|
1106
|
+
};
|
1107
|
+
popup.getData = function(row) {
|
1108
|
+
return popup.data[row];
|
1109
|
+
};
|
1110
|
+
|
1111
|
+
popup.getRow = function() {
|
1112
|
+
return selectionMarker.start.row;
|
1113
|
+
};
|
1114
|
+
popup.setRow = function(line) {
|
1115
|
+
line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length, line));
|
1116
|
+
if (selectionMarker.start.row != line) {
|
1117
|
+
popup.selection.clearSelection();
|
1118
|
+
selectionMarker.start.row = selectionMarker.end.row = line || 0;
|
1119
|
+
popup.session._emit("changeBackMarker");
|
1120
|
+
popup.moveCursorTo(line || 0, 0);
|
1121
|
+
if (popup.isOpen)
|
1122
|
+
popup._signal("select");
|
1123
|
+
}
|
1124
|
+
};
|
1125
|
+
|
1126
|
+
popup.on("changeSelection", function() {
|
1127
|
+
if (popup.isOpen)
|
1128
|
+
popup.setRow(popup.selection.lead.row);
|
1129
|
+
popup.renderer.scrollCursorIntoView();
|
1130
|
+
});
|
1131
|
+
|
1132
|
+
popup.hide = function() {
|
1133
|
+
this.container.style.display = "none";
|
1134
|
+
this._signal("hide");
|
1135
|
+
popup.isOpen = false;
|
1136
|
+
};
|
1137
|
+
popup.show = function(pos, lineHeight, topdownOnly) {
|
1138
|
+
var el = this.container;
|
1139
|
+
var screenHeight = window.innerHeight;
|
1140
|
+
var screenWidth = window.innerWidth;
|
1141
|
+
var renderer = this.renderer;
|
1142
|
+
var maxH = renderer.$maxLines * lineHeight * 1.4;
|
1143
|
+
var top = pos.top + this.$borderSize;
|
1144
|
+
var allowTopdown = top > screenHeight / 2 && !topdownOnly;
|
1145
|
+
if (allowTopdown && top + lineHeight + maxH > screenHeight) {
|
1146
|
+
renderer.$maxPixelHeight = top - 2 * this.$borderSize;
|
1147
|
+
el.style.top = "";
|
1148
|
+
el.style.bottom = screenHeight - top + "px";
|
1149
|
+
popup.isTopdown = false;
|
1150
|
+
} else {
|
1151
|
+
top += lineHeight;
|
1152
|
+
renderer.$maxPixelHeight = screenHeight - top - 0.2 * lineHeight;
|
1153
|
+
el.style.top = top + "px";
|
1154
|
+
el.style.bottom = "";
|
1155
|
+
popup.isTopdown = true;
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
el.style.display = "";
|
1159
|
+
this.renderer.$textLayer.checkForSizeChanges();
|
1160
|
+
|
1161
|
+
var left = pos.left;
|
1162
|
+
if (left + el.offsetWidth > screenWidth)
|
1163
|
+
left = screenWidth - el.offsetWidth;
|
1164
|
+
|
1165
|
+
el.style.left = left + "px";
|
1166
|
+
|
1167
|
+
this._signal("show");
|
1168
|
+
lastMouseEvent = null;
|
1169
|
+
popup.isOpen = true;
|
1170
|
+
};
|
1171
|
+
|
1172
|
+
popup.getTextLeftOffset = function() {
|
1173
|
+
return this.$borderSize + this.renderer.$padding + this.$imageSize;
|
1174
|
+
};
|
1175
|
+
|
1176
|
+
popup.$imageSize = 0;
|
1177
|
+
popup.$borderSize = 1;
|
1178
|
+
|
1179
|
+
return popup;
|
1180
|
+
};
|
1181
|
+
|
1182
|
+
dom.importCssString("\
|
1183
|
+
.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
|
1184
|
+
background-color: #CAD6FA;\
|
1185
|
+
z-index: 1;\
|
1186
|
+
}\
|
1187
|
+
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
|
1188
|
+
background-color: #3a674e;\
|
1189
|
+
}\
|
1190
|
+
.ace_editor.ace_autocomplete .ace_line-hover {\
|
1191
|
+
border: 1px solid #abbffe;\
|
1192
|
+
margin-top: -1px;\
|
1193
|
+
background: rgba(233,233,253,0.4);\
|
1194
|
+
position: absolute;\
|
1195
|
+
z-index: 2;\
|
1196
|
+
}\
|
1197
|
+
.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\
|
1198
|
+
border: 1px solid rgba(109, 150, 13, 0.8);\
|
1199
|
+
background: rgba(58, 103, 78, 0.62);\
|
1200
|
+
}\
|
1201
|
+
.ace_completion-meta {\
|
1202
|
+
opacity: 0.5;\
|
1203
|
+
margin: 0.9em;\
|
1204
|
+
}\
|
1205
|
+
.ace_editor.ace_autocomplete .ace_completion-highlight{\
|
1206
|
+
color: #2d69c7;\
|
1207
|
+
}\
|
1208
|
+
.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\
|
1209
|
+
color: #93ca12;\
|
1210
|
+
}\
|
1211
|
+
.ace_editor.ace_autocomplete {\
|
1212
|
+
width: 300px;\
|
1213
|
+
z-index: 200000;\
|
1214
|
+
border: 1px lightgray solid;\
|
1215
|
+
position: fixed;\
|
1216
|
+
box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
|
1217
|
+
line-height: 1.4;\
|
1218
|
+
background: #fefefe;\
|
1219
|
+
color: #111;\
|
1220
|
+
}\
|
1221
|
+
.ace_dark.ace_editor.ace_autocomplete {\
|
1222
|
+
border: 1px #484747 solid;\
|
1223
|
+
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\
|
1224
|
+
line-height: 1.4;\
|
1225
|
+
background: #25282c;\
|
1226
|
+
color: #c1c1c1;\
|
1227
|
+
}", "autocompletion.css");
|
1228
|
+
|
1229
|
+
exports.AcePopup = AcePopup;
|
1230
|
+
|
1231
|
+
});
|
1232
|
+
|
1233
|
+
define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module) {
|
1234
|
+
"use strict";
|
1235
|
+
|
1236
|
+
exports.parForEach = function(array, fn, callback) {
|
1237
|
+
var completed = 0;
|
1238
|
+
var arLength = array.length;
|
1239
|
+
if (arLength === 0)
|
1240
|
+
callback();
|
1241
|
+
for (var i = 0; i < arLength; i++) {
|
1242
|
+
fn(array[i], function(result, err) {
|
1243
|
+
completed++;
|
1244
|
+
if (completed === arLength)
|
1245
|
+
callback(result, err);
|
1246
|
+
});
|
1247
|
+
}
|
1248
|
+
};
|
1249
|
+
|
1250
|
+
var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;
|
1251
|
+
|
1252
|
+
exports.retrievePrecedingIdentifier = function(text, pos, regex) {
|
1253
|
+
regex = regex || ID_REGEX;
|
1254
|
+
var buf = [];
|
1255
|
+
for (var i = pos-1; i >= 0; i--) {
|
1256
|
+
if (regex.test(text[i]))
|
1257
|
+
buf.push(text[i]);
|
1258
|
+
else
|
1259
|
+
break;
|
1260
|
+
}
|
1261
|
+
return buf.reverse().join("");
|
1262
|
+
};
|
1263
|
+
|
1264
|
+
exports.retrieveFollowingIdentifier = function(text, pos, regex) {
|
1265
|
+
regex = regex || ID_REGEX;
|
1266
|
+
var buf = [];
|
1267
|
+
for (var i = pos; i < text.length; i++) {
|
1268
|
+
if (regex.test(text[i]))
|
1269
|
+
buf.push(text[i]);
|
1270
|
+
else
|
1271
|
+
break;
|
1272
|
+
}
|
1273
|
+
return buf;
|
1274
|
+
};
|
1275
|
+
|
1276
|
+
exports.getCompletionPrefix = function (editor) {
|
1277
|
+
var pos = editor.getCursorPosition();
|
1278
|
+
var line = editor.session.getLine(pos.row);
|
1279
|
+
var prefix;
|
1280
|
+
editor.completers.forEach(function(completer) {
|
1281
|
+
if (completer.identifierRegexps) {
|
1282
|
+
completer.identifierRegexps.forEach(function(identifierRegex) {
|
1283
|
+
if (!prefix && identifierRegex)
|
1284
|
+
prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
|
1285
|
+
}.bind(this));
|
1286
|
+
}
|
1287
|
+
}.bind(this));
|
1288
|
+
return prefix || this.retrievePrecedingIdentifier(line, pos.column);
|
1289
|
+
};
|
1290
|
+
|
1291
|
+
});
|
1292
|
+
|
1293
|
+
define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/snippets"], function(require, exports, module) {
|
1294
|
+
"use strict";
|
1295
|
+
|
1296
|
+
var HashHandler = require("./keyboard/hash_handler").HashHandler;
|
1297
|
+
var AcePopup = require("./autocomplete/popup").AcePopup;
|
1298
|
+
var util = require("./autocomplete/util");
|
1299
|
+
var event = require("./lib/event");
|
1300
|
+
var lang = require("./lib/lang");
|
1301
|
+
var dom = require("./lib/dom");
|
1302
|
+
var snippetManager = require("./snippets").snippetManager;
|
1303
|
+
|
1304
|
+
var Autocomplete = function() {
|
1305
|
+
this.autoInsert = false;
|
1306
|
+
this.autoSelect = true;
|
1307
|
+
this.exactMatch = false;
|
1308
|
+
this.gatherCompletionsId = 0;
|
1309
|
+
this.keyboardHandler = new HashHandler();
|
1310
|
+
this.keyboardHandler.bindKeys(this.commands);
|
1311
|
+
|
1312
|
+
this.blurListener = this.blurListener.bind(this);
|
1313
|
+
this.changeListener = this.changeListener.bind(this);
|
1314
|
+
this.mousedownListener = this.mousedownListener.bind(this);
|
1315
|
+
this.mousewheelListener = this.mousewheelListener.bind(this);
|
1316
|
+
|
1317
|
+
this.changeTimer = lang.delayedCall(function() {
|
1318
|
+
this.updateCompletions(true);
|
1319
|
+
}.bind(this));
|
1320
|
+
|
1321
|
+
this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
|
1322
|
+
};
|
1323
|
+
|
1324
|
+
(function() {
|
1325
|
+
|
1326
|
+
this.$init = function() {
|
1327
|
+
this.popup = new AcePopup(document.body || document.documentElement);
|
1328
|
+
this.popup.on("click", function(e) {
|
1329
|
+
this.insertMatch();
|
1330
|
+
e.stop();
|
1331
|
+
}.bind(this));
|
1332
|
+
this.popup.focus = this.editor.focus.bind(this.editor);
|
1333
|
+
this.popup.on("show", this.tooltipTimer.bind(null, null));
|
1334
|
+
this.popup.on("select", this.tooltipTimer.bind(null, null));
|
1335
|
+
this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
|
1336
|
+
return this.popup;
|
1337
|
+
};
|
1338
|
+
|
1339
|
+
this.getPopup = function() {
|
1340
|
+
return this.popup || this.$init();
|
1341
|
+
};
|
1342
|
+
|
1343
|
+
this.openPopup = function(editor, prefix, keepPopupPosition) {
|
1344
|
+
if (!this.popup)
|
1345
|
+
this.$init();
|
1346
|
+
|
1347
|
+
this.popup.autoSelect = this.autoSelect;
|
1348
|
+
|
1349
|
+
this.popup.setData(this.completions.filtered, this.completions.filterText);
|
1350
|
+
|
1351
|
+
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
1352
|
+
|
1353
|
+
var renderer = editor.renderer;
|
1354
|
+
this.popup.setRow(this.autoSelect ? 0 : -1);
|
1355
|
+
if (!keepPopupPosition) {
|
1356
|
+
this.popup.setTheme(editor.getTheme());
|
1357
|
+
this.popup.setFontSize(editor.getFontSize());
|
1358
|
+
|
1359
|
+
var lineHeight = renderer.layerConfig.lineHeight;
|
1360
|
+
|
1361
|
+
var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
|
1362
|
+
pos.left -= this.popup.getTextLeftOffset();
|
1363
|
+
|
1364
|
+
var rect = editor.container.getBoundingClientRect();
|
1365
|
+
pos.top += rect.top - renderer.layerConfig.offset;
|
1366
|
+
pos.left += rect.left - editor.renderer.scrollLeft;
|
1367
|
+
pos.left += renderer.gutterWidth;
|
1368
|
+
|
1369
|
+
this.popup.show(pos, lineHeight);
|
1370
|
+
} else if (keepPopupPosition && !prefix) {
|
1371
|
+
this.detach();
|
1372
|
+
}
|
1373
|
+
};
|
1374
|
+
|
1375
|
+
this.detach = function() {
|
1376
|
+
this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
|
1377
|
+
this.editor.off("changeSelection", this.changeListener);
|
1378
|
+
this.editor.off("blur", this.blurListener);
|
1379
|
+
this.editor.off("mousedown", this.mousedownListener);
|
1380
|
+
this.editor.off("mousewheel", this.mousewheelListener);
|
1381
|
+
this.changeTimer.cancel();
|
1382
|
+
this.hideDocTooltip();
|
1383
|
+
|
1384
|
+
this.gatherCompletionsId += 1;
|
1385
|
+
if (this.popup && this.popup.isOpen)
|
1386
|
+
this.popup.hide();
|
1387
|
+
|
1388
|
+
if (this.base)
|
1389
|
+
this.base.detach();
|
1390
|
+
this.activated = false;
|
1391
|
+
this.completions = this.base = null;
|
1392
|
+
};
|
1393
|
+
|
1394
|
+
this.changeListener = function(e) {
|
1395
|
+
var cursor = this.editor.selection.lead;
|
1396
|
+
if (cursor.row != this.base.row || cursor.column < this.base.column) {
|
1397
|
+
this.detach();
|
1398
|
+
}
|
1399
|
+
if (this.activated)
|
1400
|
+
this.changeTimer.schedule();
|
1401
|
+
else
|
1402
|
+
this.detach();
|
1403
|
+
};
|
1404
|
+
|
1405
|
+
this.blurListener = function(e) {
|
1406
|
+
var el = document.activeElement;
|
1407
|
+
var text = this.editor.textInput.getElement();
|
1408
|
+
var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);
|
1409
|
+
var container = this.popup && this.popup.container;
|
1410
|
+
if (el != text && el.parentNode != container && !fromTooltip
|
1411
|
+
&& el != this.tooltipNode && e.relatedTarget != text
|
1412
|
+
) {
|
1413
|
+
this.detach();
|
1414
|
+
}
|
1415
|
+
};
|
1416
|
+
|
1417
|
+
this.mousedownListener = function(e) {
|
1418
|
+
this.detach();
|
1419
|
+
};
|
1420
|
+
|
1421
|
+
this.mousewheelListener = function(e) {
|
1422
|
+
this.detach();
|
1423
|
+
};
|
1424
|
+
|
1425
|
+
this.goTo = function(where) {
|
1426
|
+
var row = this.popup.getRow();
|
1427
|
+
var max = this.popup.session.getLength() - 1;
|
1428
|
+
|
1429
|
+
switch(where) {
|
1430
|
+
case "up": row = row <= 0 ? max : row - 1; break;
|
1431
|
+
case "down": row = row >= max ? -1 : row + 1; break;
|
1432
|
+
case "start": row = 0; break;
|
1433
|
+
case "end": row = max; break;
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
this.popup.setRow(row);
|
1437
|
+
};
|
1438
|
+
|
1439
|
+
this.insertMatch = function(data, options) {
|
1440
|
+
if (!data)
|
1441
|
+
data = this.popup.getData(this.popup.getRow());
|
1442
|
+
if (!data)
|
1443
|
+
return false;
|
1444
|
+
|
1445
|
+
if (data.completer && data.completer.insertMatch) {
|
1446
|
+
data.completer.insertMatch(this.editor, data);
|
1447
|
+
} else {
|
1448
|
+
if (this.completions.filterText) {
|
1449
|
+
var ranges = this.editor.selection.getAllRanges();
|
1450
|
+
for (var i = 0, range; range = ranges[i]; i++) {
|
1451
|
+
range.start.column -= this.completions.filterText.length;
|
1452
|
+
this.editor.session.remove(range);
|
1453
|
+
}
|
1454
|
+
}
|
1455
|
+
if (data.snippet)
|
1456
|
+
snippetManager.insertSnippet(this.editor, data.snippet);
|
1457
|
+
else
|
1458
|
+
this.editor.execCommand("insertstring", data.value || data);
|
1459
|
+
}
|
1460
|
+
this.detach();
|
1461
|
+
};
|
1462
|
+
|
1463
|
+
|
1464
|
+
this.commands = {
|
1465
|
+
"Up": function(editor) { editor.completer.goTo("up"); },
|
1466
|
+
"Down": function(editor) { editor.completer.goTo("down"); },
|
1467
|
+
"Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); },
|
1468
|
+
"Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); },
|
1469
|
+
|
1470
|
+
"Esc": function(editor) { editor.completer.detach(); },
|
1471
|
+
"Return": function(editor) { return editor.completer.insertMatch(); },
|
1472
|
+
"Shift-Return": function(editor) { editor.completer.insertMatch(null, {deleteSuffix: true}); },
|
1473
|
+
"Tab": function(editor) {
|
1474
|
+
var result = editor.completer.insertMatch();
|
1475
|
+
if (!result && !editor.tabstopManager)
|
1476
|
+
editor.completer.goTo("down");
|
1477
|
+
else
|
1478
|
+
return result;
|
1479
|
+
},
|
1480
|
+
|
1481
|
+
"PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
|
1482
|
+
"PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
|
1483
|
+
};
|
1484
|
+
|
1485
|
+
this.gatherCompletions = function(editor, callback) {
|
1486
|
+
var session = editor.getSession();
|
1487
|
+
var pos = editor.getCursorPosition();
|
1488
|
+
|
1489
|
+
var prefix = util.getCompletionPrefix(editor);
|
1490
|
+
|
1491
|
+
this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
|
1492
|
+
this.base.$insertRight = true;
|
1493
|
+
|
1494
|
+
var matches = [];
|
1495
|
+
var total = editor.completers.length;
|
1496
|
+
editor.completers.forEach(function(completer, i) {
|
1497
|
+
completer.getCompletions(editor, session, pos, prefix, function(err, results) {
|
1498
|
+
if (!err && results)
|
1499
|
+
matches = matches.concat(results);
|
1500
|
+
callback(null, {
|
1501
|
+
prefix: util.getCompletionPrefix(editor),
|
1502
|
+
matches: matches,
|
1503
|
+
finished: (--total === 0)
|
1504
|
+
});
|
1505
|
+
});
|
1506
|
+
});
|
1507
|
+
return true;
|
1508
|
+
};
|
1509
|
+
|
1510
|
+
this.showPopup = function(editor) {
|
1511
|
+
if (this.editor)
|
1512
|
+
this.detach();
|
1513
|
+
|
1514
|
+
this.activated = true;
|
1515
|
+
|
1516
|
+
this.editor = editor;
|
1517
|
+
if (editor.completer != this) {
|
1518
|
+
if (editor.completer)
|
1519
|
+
editor.completer.detach();
|
1520
|
+
editor.completer = this;
|
1521
|
+
}
|
1522
|
+
|
1523
|
+
editor.on("changeSelection", this.changeListener);
|
1524
|
+
editor.on("blur", this.blurListener);
|
1525
|
+
editor.on("mousedown", this.mousedownListener);
|
1526
|
+
editor.on("mousewheel", this.mousewheelListener);
|
1527
|
+
|
1528
|
+
this.updateCompletions();
|
1529
|
+
};
|
1530
|
+
|
1531
|
+
this.updateCompletions = function(keepPopupPosition) {
|
1532
|
+
if (keepPopupPosition && this.base && this.completions) {
|
1533
|
+
var pos = this.editor.getCursorPosition();
|
1534
|
+
var prefix = this.editor.session.getTextRange({start: this.base, end: pos});
|
1535
|
+
if (prefix == this.completions.filterText)
|
1536
|
+
return;
|
1537
|
+
this.completions.setFilter(prefix);
|
1538
|
+
if (!this.completions.filtered.length)
|
1539
|
+
return this.detach();
|
1540
|
+
if (this.completions.filtered.length == 1
|
1541
|
+
&& this.completions.filtered[0].value == prefix
|
1542
|
+
&& !this.completions.filtered[0].snippet)
|
1543
|
+
return this.detach();
|
1544
|
+
this.openPopup(this.editor, prefix, keepPopupPosition);
|
1545
|
+
return;
|
1546
|
+
}
|
1547
|
+
var _id = this.gatherCompletionsId;
|
1548
|
+
this.gatherCompletions(this.editor, function(err, results) {
|
1549
|
+
var detachIfFinished = function() {
|
1550
|
+
if (!results.finished) return;
|
1551
|
+
return this.detach();
|
1552
|
+
}.bind(this);
|
1553
|
+
|
1554
|
+
var prefix = results.prefix;
|
1555
|
+
var matches = results && results.matches;
|
1556
|
+
|
1557
|
+
if (!matches || !matches.length)
|
1558
|
+
return detachIfFinished();
|
1559
|
+
if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)
|
1560
|
+
return;
|
1561
|
+
|
1562
|
+
this.completions = new FilteredList(matches);
|
1563
|
+
|
1564
|
+
if (this.exactMatch)
|
1565
|
+
this.completions.exactMatch = true;
|
1566
|
+
|
1567
|
+
this.completions.setFilter(prefix);
|
1568
|
+
var filtered = this.completions.filtered;
|
1569
|
+
if (!filtered.length)
|
1570
|
+
return detachIfFinished();
|
1571
|
+
if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
|
1572
|
+
return detachIfFinished();
|
1573
|
+
if (this.autoInsert && filtered.length == 1 && results.finished)
|
1574
|
+
return this.insertMatch(filtered[0]);
|
1575
|
+
|
1576
|
+
this.openPopup(this.editor, prefix, keepPopupPosition);
|
1577
|
+
}.bind(this));
|
1578
|
+
};
|
1579
|
+
|
1580
|
+
this.cancelContextMenu = function() {
|
1581
|
+
this.editor.$mouseHandler.cancelContextMenu();
|
1582
|
+
};
|
1583
|
+
|
1584
|
+
this.updateDocTooltip = function() {
|
1585
|
+
var popup = this.popup;
|
1586
|
+
var all = popup.data;
|
1587
|
+
var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
|
1588
|
+
var doc = null;
|
1589
|
+
if (!selected || !this.editor || !this.popup.isOpen)
|
1590
|
+
return this.hideDocTooltip();
|
1591
|
+
this.editor.completers.some(function(completer) {
|
1592
|
+
if (completer.getDocTooltip)
|
1593
|
+
doc = completer.getDocTooltip(selected);
|
1594
|
+
return doc;
|
1595
|
+
});
|
1596
|
+
if (!doc)
|
1597
|
+
doc = selected;
|
1598
|
+
|
1599
|
+
if (typeof doc == "string")
|
1600
|
+
doc = {docText: doc};
|
1601
|
+
if (!doc || !(doc.docHTML || doc.docText))
|
1602
|
+
return this.hideDocTooltip();
|
1603
|
+
this.showDocTooltip(doc);
|
1604
|
+
};
|
1605
|
+
|
1606
|
+
this.showDocTooltip = function(item) {
|
1607
|
+
if (!this.tooltipNode) {
|
1608
|
+
this.tooltipNode = dom.createElement("div");
|
1609
|
+
this.tooltipNode.className = "ace_tooltip ace_doc-tooltip";
|
1610
|
+
this.tooltipNode.style.margin = 0;
|
1611
|
+
this.tooltipNode.style.pointerEvents = "auto";
|
1612
|
+
this.tooltipNode.tabIndex = -1;
|
1613
|
+
this.tooltipNode.onblur = this.blurListener.bind(this);
|
1614
|
+
this.tooltipNode.onclick = this.onTooltipClick.bind(this);
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
var tooltipNode = this.tooltipNode;
|
1618
|
+
if (item.docHTML) {
|
1619
|
+
tooltipNode.innerHTML = item.docHTML;
|
1620
|
+
} else if (item.docText) {
|
1621
|
+
tooltipNode.textContent = item.docText;
|
1622
|
+
}
|
1623
|
+
|
1624
|
+
if (!tooltipNode.parentNode)
|
1625
|
+
document.body.appendChild(tooltipNode);
|
1626
|
+
var popup = this.popup;
|
1627
|
+
var rect = popup.container.getBoundingClientRect();
|
1628
|
+
tooltipNode.style.top = popup.container.style.top;
|
1629
|
+
tooltipNode.style.bottom = popup.container.style.bottom;
|
1630
|
+
|
1631
|
+
tooltipNode.style.display = "block";
|
1632
|
+
if (window.innerWidth - rect.right < 320) {
|
1633
|
+
if (rect.left < 320) {
|
1634
|
+
if(popup.isTopdown) {
|
1635
|
+
tooltipNode.style.top = rect.bottom + "px";
|
1636
|
+
tooltipNode.style.left = rect.left + "px";
|
1637
|
+
tooltipNode.style.right = "";
|
1638
|
+
tooltipNode.style.bottom = "";
|
1639
|
+
} else {
|
1640
|
+
tooltipNode.style.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
|
1641
|
+
tooltipNode.style.left = rect.left + "px";
|
1642
|
+
tooltipNode.style.right = "";
|
1643
|
+
tooltipNode.style.bottom = "";
|
1644
|
+
}
|
1645
|
+
} else {
|
1646
|
+
tooltipNode.style.right = window.innerWidth - rect.left + "px";
|
1647
|
+
tooltipNode.style.left = "";
|
1648
|
+
}
|
1649
|
+
} else {
|
1650
|
+
tooltipNode.style.left = (rect.right + 1) + "px";
|
1651
|
+
tooltipNode.style.right = "";
|
1652
|
+
}
|
1653
|
+
};
|
1654
|
+
|
1655
|
+
this.hideDocTooltip = function() {
|
1656
|
+
this.tooltipTimer.cancel();
|
1657
|
+
if (!this.tooltipNode) return;
|
1658
|
+
var el = this.tooltipNode;
|
1659
|
+
if (!this.editor.isFocused() && document.activeElement == el)
|
1660
|
+
this.editor.focus();
|
1661
|
+
this.tooltipNode = null;
|
1662
|
+
if (el.parentNode)
|
1663
|
+
el.parentNode.removeChild(el);
|
1664
|
+
};
|
1665
|
+
|
1666
|
+
this.onTooltipClick = function(e) {
|
1667
|
+
var a = e.target;
|
1668
|
+
while (a && a != this.tooltipNode) {
|
1669
|
+
if (a.nodeName == "A" && a.href) {
|
1670
|
+
a.rel = "noreferrer";
|
1671
|
+
a.target = "_blank";
|
1672
|
+
break;
|
1673
|
+
}
|
1674
|
+
a = a.parentNode;
|
1675
|
+
}
|
1676
|
+
};
|
1677
|
+
|
1678
|
+
}).call(Autocomplete.prototype);
|
1679
|
+
|
1680
|
+
Autocomplete.startCommand = {
|
1681
|
+
name: "startAutocomplete",
|
1682
|
+
exec: function(editor) {
|
1683
|
+
if (!editor.completer)
|
1684
|
+
editor.completer = new Autocomplete();
|
1685
|
+
editor.completer.autoInsert = false;
|
1686
|
+
editor.completer.autoSelect = true;
|
1687
|
+
editor.completer.showPopup(editor);
|
1688
|
+
editor.completer.cancelContextMenu();
|
1689
|
+
},
|
1690
|
+
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
|
1691
|
+
};
|
1692
|
+
|
1693
|
+
var FilteredList = function(array, filterText) {
|
1694
|
+
this.all = array;
|
1695
|
+
this.filtered = array;
|
1696
|
+
this.filterText = filterText || "";
|
1697
|
+
this.exactMatch = false;
|
1698
|
+
};
|
1699
|
+
(function(){
|
1700
|
+
this.setFilter = function(str) {
|
1701
|
+
if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
|
1702
|
+
var matches = this.filtered;
|
1703
|
+
else
|
1704
|
+
var matches = this.all;
|
1705
|
+
|
1706
|
+
this.filterText = str;
|
1707
|
+
matches = this.filterCompletions(matches, this.filterText);
|
1708
|
+
matches = matches.sort(function(a, b) {
|
1709
|
+
return b.exactMatch - a.exactMatch || b.$score - a.$score
|
1710
|
+
|| (a.caption || a.value) < (b.caption || b.value);
|
1711
|
+
});
|
1712
|
+
var prev = null;
|
1713
|
+
matches = matches.filter(function(item){
|
1714
|
+
var caption = item.snippet || item.caption || item.value;
|
1715
|
+
if (caption === prev) return false;
|
1716
|
+
prev = caption;
|
1717
|
+
return true;
|
1718
|
+
});
|
1719
|
+
|
1720
|
+
this.filtered = matches;
|
1721
|
+
};
|
1722
|
+
this.filterCompletions = function(items, needle) {
|
1723
|
+
var results = [];
|
1724
|
+
var upper = needle.toUpperCase();
|
1725
|
+
var lower = needle.toLowerCase();
|
1726
|
+
loop: for (var i = 0, item; item = items[i]; i++) {
|
1727
|
+
var caption = item.caption || item.value || item.snippet;
|
1728
|
+
if (!caption) continue;
|
1729
|
+
var lastIndex = -1;
|
1730
|
+
var matchMask = 0;
|
1731
|
+
var penalty = 0;
|
1732
|
+
var index, distance;
|
1733
|
+
|
1734
|
+
if (this.exactMatch) {
|
1735
|
+
if (needle !== caption.substr(0, needle.length))
|
1736
|
+
continue loop;
|
1737
|
+
} else {
|
1738
|
+
var fullMatchIndex = caption.toLowerCase().indexOf(lower);
|
1739
|
+
if (fullMatchIndex > -1) {
|
1740
|
+
penalty = fullMatchIndex;
|
1741
|
+
} else {
|
1742
|
+
for (var j = 0; j < needle.length; j++) {
|
1743
|
+
var i1 = caption.indexOf(lower[j], lastIndex + 1);
|
1744
|
+
var i2 = caption.indexOf(upper[j], lastIndex + 1);
|
1745
|
+
index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
|
1746
|
+
if (index < 0)
|
1747
|
+
continue loop;
|
1748
|
+
distance = index - lastIndex - 1;
|
1749
|
+
if (distance > 0) {
|
1750
|
+
if (lastIndex === -1)
|
1751
|
+
penalty += 10;
|
1752
|
+
penalty += distance;
|
1753
|
+
matchMask = matchMask | (1 << j);
|
1754
|
+
}
|
1755
|
+
lastIndex = index;
|
1756
|
+
}
|
1757
|
+
}
|
1758
|
+
}
|
1759
|
+
item.matchMask = matchMask;
|
1760
|
+
item.exactMatch = penalty ? 0 : 1;
|
1761
|
+
item.$score = (item.score || 0) - penalty;
|
1762
|
+
results.push(item);
|
1763
|
+
}
|
1764
|
+
return results;
|
1765
|
+
};
|
1766
|
+
}).call(FilteredList.prototype);
|
1767
|
+
|
1768
|
+
exports.Autocomplete = Autocomplete;
|
1769
|
+
exports.FilteredList = FilteredList;
|
1770
|
+
|
1771
|
+
});
|
1772
|
+
|
1773
|
+
define("ace/autocomplete/text_completer",["require","exports","module","ace/range"], function(require, exports, module) {
|
1774
|
+
var Range = require("../range").Range;
|
1775
|
+
|
1776
|
+
var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
|
1777
|
+
|
1778
|
+
function getWordIndex(doc, pos) {
|
1779
|
+
var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos));
|
1780
|
+
return textBefore.split(splitRegex).length - 1;
|
1781
|
+
}
|
1782
|
+
function wordDistance(doc, pos) {
|
1783
|
+
var prefixPos = getWordIndex(doc, pos);
|
1784
|
+
var words = doc.getValue().split(splitRegex);
|
1785
|
+
var wordScores = Object.create(null);
|
1786
|
+
|
1787
|
+
var currentWord = words[prefixPos];
|
1788
|
+
|
1789
|
+
words.forEach(function(word, idx) {
|
1790
|
+
if (!word || word === currentWord) return;
|
1791
|
+
|
1792
|
+
var distance = Math.abs(prefixPos - idx);
|
1793
|
+
var score = words.length - distance;
|
1794
|
+
if (wordScores[word]) {
|
1795
|
+
wordScores[word] = Math.max(score, wordScores[word]);
|
1796
|
+
} else {
|
1797
|
+
wordScores[word] = score;
|
1798
|
+
}
|
1799
|
+
});
|
1800
|
+
return wordScores;
|
1801
|
+
}
|
1802
|
+
|
1803
|
+
exports.getCompletions = function(editor, session, pos, prefix, callback) {
|
1804
|
+
var wordScore = wordDistance(session, pos);
|
1805
|
+
var wordList = Object.keys(wordScore);
|
1806
|
+
callback(null, wordList.map(function(word) {
|
1807
|
+
return {
|
1808
|
+
caption: word,
|
1809
|
+
value: word,
|
1810
|
+
score: wordScore[word],
|
1811
|
+
meta: "local"
|
1812
|
+
};
|
1813
|
+
}));
|
1814
|
+
};
|
1815
|
+
});
|
1816
|
+
|
1817
|
+
define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"], function(require, exports, module) {
|
1818
|
+
"use strict";
|
1819
|
+
|
1820
|
+
var snippetManager = require("../snippets").snippetManager;
|
1821
|
+
var Autocomplete = require("../autocomplete").Autocomplete;
|
1822
|
+
var config = require("../config");
|
1823
|
+
var lang = require("../lib/lang");
|
1824
|
+
var util = require("../autocomplete/util");
|
1825
|
+
|
1826
|
+
var textCompleter = require("../autocomplete/text_completer");
|
1827
|
+
var keyWordCompleter = {
|
1828
|
+
getCompletions: function(editor, session, pos, prefix, callback) {
|
1829
|
+
if (session.$mode.completer) {
|
1830
|
+
return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback);
|
1831
|
+
}
|
1832
|
+
var state = editor.session.getState(pos.row);
|
1833
|
+
var completions = session.$mode.getCompletions(state, session, pos, prefix);
|
1834
|
+
callback(null, completions);
|
1835
|
+
}
|
1836
|
+
};
|
1837
|
+
|
1838
|
+
var snippetCompleter = {
|
1839
|
+
getCompletions: function(editor, session, pos, prefix, callback) {
|
1840
|
+
var scopes = [];
|
1841
|
+
var token = session.getTokenAt(pos.row, pos.column);
|
1842
|
+
if (token && token.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/))
|
1843
|
+
scopes.push('html-tag');
|
1844
|
+
else
|
1845
|
+
scopes = snippetManager.getActiveScopes(editor);
|
1846
|
+
|
1847
|
+
var snippetMap = snippetManager.snippetMap;
|
1848
|
+
var completions = [];
|
1849
|
+
scopes.forEach(function(scope) {
|
1850
|
+
var snippets = snippetMap[scope] || [];
|
1851
|
+
for (var i = snippets.length; i--;) {
|
1852
|
+
var s = snippets[i];
|
1853
|
+
var caption = s.name || s.tabTrigger;
|
1854
|
+
if (!caption)
|
1855
|
+
continue;
|
1856
|
+
completions.push({
|
1857
|
+
caption: caption,
|
1858
|
+
snippet: s.content,
|
1859
|
+
meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet",
|
1860
|
+
type: "snippet"
|
1861
|
+
});
|
1862
|
+
}
|
1863
|
+
}, this);
|
1864
|
+
callback(null, completions);
|
1865
|
+
},
|
1866
|
+
getDocTooltip: function(item) {
|
1867
|
+
if (item.type == "snippet" && !item.docHTML) {
|
1868
|
+
item.docHTML = [
|
1869
|
+
"<b>", lang.escapeHTML(item.caption), "</b>", "<hr></hr>",
|
1870
|
+
lang.escapeHTML(item.snippet)
|
1871
|
+
].join("");
|
1872
|
+
}
|
1873
|
+
}
|
1874
|
+
};
|
1875
|
+
|
1876
|
+
var completers = [snippetCompleter, textCompleter, keyWordCompleter];
|
1877
|
+
exports.setCompleters = function(val) {
|
1878
|
+
completers.length = 0;
|
1879
|
+
if (val) completers.push.apply(completers, val);
|
1880
|
+
};
|
1881
|
+
exports.addCompleter = function(completer) {
|
1882
|
+
completers.push(completer);
|
1883
|
+
};
|
1884
|
+
exports.textCompleter = textCompleter;
|
1885
|
+
exports.keyWordCompleter = keyWordCompleter;
|
1886
|
+
exports.snippetCompleter = snippetCompleter;
|
1887
|
+
|
1888
|
+
var expandSnippet = {
|
1889
|
+
name: "expandSnippet",
|
1890
|
+
exec: function(editor) {
|
1891
|
+
return snippetManager.expandWithTab(editor);
|
1892
|
+
},
|
1893
|
+
bindKey: "Tab"
|
1894
|
+
};
|
1895
|
+
|
1896
|
+
var onChangeMode = function(e, editor) {
|
1897
|
+
loadSnippetsForMode(editor.session.$mode);
|
1898
|
+
};
|
1899
|
+
|
1900
|
+
var loadSnippetsForMode = function(mode) {
|
1901
|
+
var id = mode.$id;
|
1902
|
+
if (!snippetManager.files)
|
1903
|
+
snippetManager.files = {};
|
1904
|
+
loadSnippetFile(id);
|
1905
|
+
if (mode.modes)
|
1906
|
+
mode.modes.forEach(loadSnippetsForMode);
|
1907
|
+
};
|
1908
|
+
|
1909
|
+
var loadSnippetFile = function(id) {
|
1910
|
+
if (!id || snippetManager.files[id])
|
1911
|
+
return;
|
1912
|
+
var snippetFilePath = id.replace("mode", "snippets");
|
1913
|
+
snippetManager.files[id] = {};
|
1914
|
+
config.loadModule(snippetFilePath, function(m) {
|
1915
|
+
if (m) {
|
1916
|
+
snippetManager.files[id] = m;
|
1917
|
+
if (!m.snippets && m.snippetText)
|
1918
|
+
m.snippets = snippetManager.parseSnippetFile(m.snippetText);
|
1919
|
+
snippetManager.register(m.snippets || [], m.scope);
|
1920
|
+
if (m.includeScopes) {
|
1921
|
+
snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
|
1922
|
+
m.includeScopes.forEach(function(x) {
|
1923
|
+
loadSnippetFile("ace/mode/" + x);
|
1924
|
+
});
|
1925
|
+
}
|
1926
|
+
}
|
1927
|
+
});
|
1928
|
+
};
|
1929
|
+
|
1930
|
+
var doLiveAutocomplete = function(e) {
|
1931
|
+
var editor = e.editor;
|
1932
|
+
var hasCompleter = editor.completer && editor.completer.activated;
|
1933
|
+
if (e.command.name === "backspace") {
|
1934
|
+
if (hasCompleter && !util.getCompletionPrefix(editor))
|
1935
|
+
editor.completer.detach();
|
1936
|
+
}
|
1937
|
+
else if (e.command.name === "insertstring") {
|
1938
|
+
var prefix = util.getCompletionPrefix(editor);
|
1939
|
+
if (prefix && !hasCompleter) {
|
1940
|
+
if (!editor.completer) {
|
1941
|
+
editor.completer = new Autocomplete();
|
1942
|
+
}
|
1943
|
+
editor.completer.autoInsert = false;
|
1944
|
+
editor.completer.showPopup(editor);
|
1945
|
+
}
|
1946
|
+
}
|
1947
|
+
};
|
1948
|
+
|
1949
|
+
var Editor = require("../editor").Editor;
|
1950
|
+
require("../config").defineOptions(Editor.prototype, "editor", {
|
1951
|
+
enableBasicAutocompletion: {
|
1952
|
+
set: function(val) {
|
1953
|
+
if (val) {
|
1954
|
+
if (!this.completers)
|
1955
|
+
this.completers = Array.isArray(val)? val: completers;
|
1956
|
+
this.commands.addCommand(Autocomplete.startCommand);
|
1957
|
+
} else {
|
1958
|
+
this.commands.removeCommand(Autocomplete.startCommand);
|
1959
|
+
}
|
1960
|
+
},
|
1961
|
+
value: false
|
1962
|
+
},
|
1963
|
+
enableLiveAutocompletion: {
|
1964
|
+
set: function(val) {
|
1965
|
+
if (val) {
|
1966
|
+
if (!this.completers)
|
1967
|
+
this.completers = Array.isArray(val)? val: completers;
|
1968
|
+
this.commands.on('afterExec', doLiveAutocomplete);
|
1969
|
+
} else {
|
1970
|
+
this.commands.removeListener('afterExec', doLiveAutocomplete);
|
1971
|
+
}
|
1972
|
+
},
|
1973
|
+
value: false
|
1974
|
+
},
|
1975
|
+
enableSnippets: {
|
1976
|
+
set: function(val) {
|
1977
|
+
if (val) {
|
1978
|
+
this.commands.addCommand(expandSnippet);
|
1979
|
+
this.on("changeMode", onChangeMode);
|
1980
|
+
onChangeMode(null, this);
|
1981
|
+
} else {
|
1982
|
+
this.commands.removeCommand(expandSnippet);
|
1983
|
+
this.off("changeMode", onChangeMode);
|
1984
|
+
}
|
1985
|
+
},
|
1986
|
+
value: false
|
1987
|
+
}
|
1988
|
+
});
|
1989
|
+
});
|
1990
|
+
(function() {
|
1991
|
+
window.require(["ace/ext/language_tools"], function(m) {
|
1992
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
1993
|
+
module.exports = m;
|
1994
|
+
}
|
1995
|
+
});
|
1996
|
+
})();
|
1997
|
+
|