glebtv-ckeditor 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +63 -62
- data/app/assets/stylesheets/ckcontent.css +0 -0
- data/lib/ckeditor.rb +4 -3
- data/lib/ckeditor/engine.rb +1 -1
- data/lib/ckeditor/version.rb +2 -2
- data/vendor/assets/javascripts/ckeditor/CHANGES.md +27 -1
- data/vendor/assets/javascripts/ckeditor/README.md +1 -1
- data/vendor/assets/javascripts/ckeditor/build-config.js +10 -89
- data/vendor/assets/javascripts/ckeditor/ckeditor.js +286 -329
- data/vendor/assets/javascripts/ckeditor/config.js.erb +3 -8
- data/vendor/assets/javascripts/ckeditor/lang/en.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ru.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/CKCss/ckcss.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cs.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cy.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fa.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/km.js +9 -0
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ku.js +6 -6
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nl.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pl.js +6 -5
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt-br.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sv.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/th.js +9 -0
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/vi.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.ckeditor.css +74 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.css +16 -10
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/AutoFormat.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/CommentSelectedRange.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/icons/UncommentSelectedRange.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/{util → addon/dialog}/dialog.js +76 -75
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closebrackets.js +29 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/{util → addon/edit}/closetag.js +86 -85
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/{util → addon/edit}/continuelist.js +28 -28
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/{util → addon/edit}/matchbrackets.js +74 -63
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/{util → addon/foldcode}/foldcode.js +183 -182
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/autoFormatAll.js +43 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/{util → addon/format}/formatting.js +114 -108
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/match-highlighter.js +60 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/{util → addon/search}/search.js +131 -119
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/{util → addon/search}/searchcursor.js +131 -119
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.js +5384 -4553
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.modes.min.js +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.search-addons.min.js +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/css.js +465 -465
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/htmlmixed.js +104 -84
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/javascript.js +426 -411
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/xml.js +324 -324
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/af.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ar.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bg.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bn.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/bs.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ca.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/cs.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/cy.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/da.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/de.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/el.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-au.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-ca.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en-gb.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/en.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/eo.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/es.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/et.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/eu.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fa.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fi.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fo.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fr-ca.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/fr.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/gl.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/gu.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/he.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hi.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hr.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/hu.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/is.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/it.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ja.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ka.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/km.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ko.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ku.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/lt.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/lv.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/mk.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/mn.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ms.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/nb.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/nl.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/no.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pl.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pt-br.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/pt.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ro.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ru.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sk.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sl.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sr-latn.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sr.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/sv.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/th.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/tr.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/ug.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/uk.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/vi.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/zh-cn.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/lang/zh.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +249 -103
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance-mobile.css +6 -6
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +76 -76
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/blackboard.css +25 -25
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +18 -18
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +25 -25
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/elegant.css +10 -10
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +21 -21
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +44 -44
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +28 -28
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neat.css +9 -9
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +21 -21
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +21 -21
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +207 -207
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +26 -25
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +27 -27
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +46 -46
- data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +173 -173
- data/vendor/assets/javascripts/ckeditor/plugins/{MediaEmbed → mediaembed}/images/icon.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/{MediaEmbed → mediaembed}/plugin.js +16 -13
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/images/icon.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/de.js +5 -2
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/en.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/fr.js +9 -6
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/nl.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/ru.js +11 -8
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/libs/jquery.oembed.js +161 -30
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/libs/jquery.oembed.min.js +1 -4
- data/vendor/assets/javascripts/ckeditor/plugins/oembed/plugin.js +55 -59
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +11 -10
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fa.js +8 -9
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fr.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ku.js +9 -10
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pl.js +12 -0
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/th.js +13 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +5 -3
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_opera.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +52 -196
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
- metadata +29 -203
- data/vendor/assets/javascripts/ckeditor/contents.css +0 -99
- data/vendor/assets/javascripts/ckeditor/lang/af.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ar.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/bg.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/bn.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/bs.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ca.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/cs.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/cy.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/da.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/de.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/el.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/en-au.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/en-ca.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/en-gb.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/eo.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/es.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/et.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/eu.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/fa.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/fi.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/fo.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/fr-ca.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/fr.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/gl.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/gu.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/he.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/hi.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/hr.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/hu.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/is.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/it.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ja.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ka.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/km.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ko.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ku.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/lt.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/lv.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/mk.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/mn.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ms.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/nb.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/nl.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/no.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/pl.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/pt-br.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/pt.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ro.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/sk.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/sl.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/sr-latn.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/sr.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/sv.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/th.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/tr.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/ug.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/uk.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/vi.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/zh-cn.js +0 -5
- data/vendor/assets/javascripts/ckeditor/lang/zh.js +0 -5
- data/vendor/assets/javascripts/ckeditor/plugins/CKCss/CKCss.xml +0 -26
- data/vendor/assets/javascripts/ckeditor/plugins/CKCss/ckcss1.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/MediaEmbed/icons/mediaembed.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +0 -6
- data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/sourcecodepro-regular.eot +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/sourcecodepro-regular.otf +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/sourcecodepro-regular.svg +0 -242
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/sourcecodepro-regular.ttf +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/sourcecodepro-regular.woff +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/colorize.js +0 -29
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/continuecomment.js +0 -36
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/dialog.css +0 -32
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/javascript-hint.js +0 -137
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/loadmode.js +0 -51
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/match-highlighter.js +0 -46
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/multiplex.js +0 -95
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/overlay.js +0 -59
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/pig-hint.js +0 -117
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/runmode-standalone.js +0 -90
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/runmode.js +0 -52
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/simple-hint.css +0 -16
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/simple-hint.js +0 -102
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/util/xml-hint.js +0 -131
- data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +0 -13
- data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +0 -9
- data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +0 -24
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +0 -8
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +0 -8
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +0 -8
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +0 -8
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +0 -8
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +0 -20
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +0 -8
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +0 -10
- data/vendor/assets/javascripts/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/htmlbuttons/docs/install.html +0 -93
- data/vendor/assets/javascripts/ckeditor/plugins/htmlbuttons/docs/styles.css +0 -59
- data/vendor/assets/javascripts/ckeditor/plugins/htmlbuttons/icon1.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/htmlbuttons/icon2.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/htmlbuttons/icon3.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/htmlbuttons/plugin.js +0 -71
- data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +0 -10
- data/vendor/assets/javascripts/ckeditor/plugins/iframe/images/placeholder.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +0 -10
- data/vendor/assets/javascripts/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/preview/preview.html +0 -10
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +0 -10
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/envelope.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/heart.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/kiss.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +0 -84
- data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +0 -10
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +0 -6
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +0 -9
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +0 -9
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +0 -95
- data/vendor/assets/javascripts/ckeditor/samples/ajax.html +0 -82
- data/vendor/assets/javascripts/ckeditor/samples/api.html +0 -207
- data/vendor/assets/javascripts/ckeditor/samples/appendto.html +0 -57
- data/vendor/assets/javascripts/ckeditor/samples/assets/inlineall/logo.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/assets/outputxhtml/outputxhtml.css +0 -204
- data/vendor/assets/javascripts/ckeditor/samples/assets/posteddata.php +0 -59
- data/vendor/assets/javascripts/ckeditor/samples/assets/sample.css +0 -3
- data/vendor/assets/javascripts/ckeditor/samples/assets/sample.jpg +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/assets/uilanguages/languages.js +0 -7
- data/vendor/assets/javascripts/ckeditor/samples/divreplace.html +0 -141
- data/vendor/assets/javascripts/ckeditor/samples/index.html +0 -119
- data/vendor/assets/javascripts/ckeditor/samples/inlineall.html +0 -311
- data/vendor/assets/javascripts/ckeditor/samples/inlinebycode.html +0 -122
- data/vendor/assets/javascripts/ckeditor/samples/plugins/dialog/assets/my_dialog.js +0 -48
- data/vendor/assets/javascripts/ckeditor/samples/plugins/dialog/dialog.html +0 -187
- data/vendor/assets/javascripts/ckeditor/samples/plugins/enterkey/enterkey.html +0 -103
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/outputforflash.fla +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/outputforflash.swf +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/swfobject.js +0 -18
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/outputforflash.html +0 -280
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/outputhtml.html +0 -237
- data/vendor/assets/javascripts/ckeditor/samples/plugins/magicline/magicline.html +0 -203
- data/vendor/assets/javascripts/ckeditor/samples/plugins/toolbar/toolbar.html +0 -200
- data/vendor/assets/javascripts/ckeditor/samples/plugins/wysiwygarea/fullpage.html +0 -71
- data/vendor/assets/javascripts/ckeditor/samples/readonly.html +0 -73
- data/vendor/assets/javascripts/ckeditor/samples/replacebyclass.html +0 -57
- data/vendor/assets/javascripts/ckeditor/samples/replacebycode.html +0 -56
- data/vendor/assets/javascripts/ckeditor/samples/sample.css +0 -333
- data/vendor/assets/javascripts/ckeditor/samples/sample.js +0 -5
- data/vendor/assets/javascripts/ckeditor/samples/sample_posteddata.php +0 -16
- data/vendor/assets/javascripts/ckeditor/samples/tabindex.html +0 -75
- data/vendor/assets/javascripts/ckeditor/samples/uicolor.html +0 -69
- data/vendor/assets/javascripts/ckeditor/samples/uilanguages.html +0 -119
- data/vendor/assets/javascripts/ckeditor/samples/xhtmlstyle.html +0 -219
@@ -1,84 +1,104 @@
|
|
1
|
-
|
2
|
-
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
return {
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
1
|
+
CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
|
2
|
+
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
|
3
|
+
var cssMode = CodeMirror.getMode(config, "css");
|
4
|
+
|
5
|
+
var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes;
|
6
|
+
scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,
|
7
|
+
mode: CodeMirror.getMode(config, "javascript")});
|
8
|
+
if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) {
|
9
|
+
var conf = scriptTypesConf[i];
|
10
|
+
scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)});
|
11
|
+
}
|
12
|
+
scriptTypes.push({matches: /./,
|
13
|
+
mode: CodeMirror.getMode(config, "text/plain")});
|
14
|
+
|
15
|
+
function html(stream, state) {
|
16
|
+
var tagName = state.htmlState.tagName;
|
17
|
+
var style = htmlMode.token(stream, state.htmlState);
|
18
|
+
if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") {
|
19
|
+
// Script block: mode to change to depends on type attribute
|
20
|
+
var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);
|
21
|
+
scriptType = scriptType ? scriptType[1] : "";
|
22
|
+
if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1);
|
23
|
+
for (var i = 0; i < scriptTypes.length; ++i) {
|
24
|
+
var tp = scriptTypes[i];
|
25
|
+
if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) {
|
26
|
+
if (tp.mode) {
|
27
|
+
state.token = script;
|
28
|
+
state.localMode = tp.mode;
|
29
|
+
state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, ""));
|
30
|
+
}
|
31
|
+
break;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
} else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") {
|
35
|
+
state.token = css;
|
36
|
+
state.localMode = cssMode;
|
37
|
+
state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
|
38
|
+
}
|
39
|
+
return style;
|
40
|
+
}
|
41
|
+
function maybeBackup(stream, pat, style) {
|
42
|
+
var cur = stream.current();
|
43
|
+
var close = cur.search(pat), m;
|
44
|
+
if (close > -1) stream.backUp(cur.length - close);
|
45
|
+
else if (m = cur.match(/<\/?$/)) {
|
46
|
+
stream.backUp(cur.length);
|
47
|
+
if (!stream.match(pat, false)) stream.match(cur[0]);
|
48
|
+
}
|
49
|
+
return style;
|
50
|
+
}
|
51
|
+
function script(stream, state) {
|
52
|
+
if (stream.match(/^<\/\s*script\s*>/i, false)) {
|
53
|
+
state.token = html;
|
54
|
+
state.localState = state.localMode = null;
|
55
|
+
return html(stream, state);
|
56
|
+
}
|
57
|
+
return maybeBackup(stream, /<\/\s*script\s*>/,
|
58
|
+
state.localMode.token(stream, state.localState));
|
59
|
+
}
|
60
|
+
function css(stream, state) {
|
61
|
+
if (stream.match(/^<\/\s*style\s*>/i, false)) {
|
62
|
+
state.token = html;
|
63
|
+
state.localState = state.localMode = null;
|
64
|
+
return html(stream, state);
|
65
|
+
}
|
66
|
+
return maybeBackup(stream, /<\/\s*style\s*>/,
|
67
|
+
cssMode.token(stream, state.localState));
|
68
|
+
}
|
69
|
+
|
70
|
+
return {
|
71
|
+
startState: function() {
|
72
|
+
var state = htmlMode.startState();
|
73
|
+
return {token: html, localMode: null, localState: null, htmlState: state};
|
74
|
+
},
|
75
|
+
|
76
|
+
copyState: function(state) {
|
77
|
+
if (state.localState)
|
78
|
+
var local = CodeMirror.copyState(state.localMode, state.localState);
|
79
|
+
return {token: state.token, localMode: state.localMode, localState: local,
|
80
|
+
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
|
81
|
+
},
|
82
|
+
|
83
|
+
token: function(stream, state) {
|
84
|
+
return state.token(stream, state);
|
85
|
+
},
|
86
|
+
|
87
|
+
indent: function(state, textAfter) {
|
88
|
+
if (!state.localMode || /^\s*<\//.test(textAfter))
|
89
|
+
return htmlMode.indent(state.htmlState, textAfter);
|
90
|
+
else if (state.localMode.indent)
|
91
|
+
return state.localMode.indent(state.localState, textAfter);
|
92
|
+
else
|
93
|
+
return CodeMirror.Pass;
|
94
|
+
},
|
95
|
+
|
96
|
+
electricChars: "/{}:",
|
97
|
+
|
98
|
+
innerMode: function(state) {
|
99
|
+
return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
|
100
|
+
}
|
101
|
+
};
|
102
|
+
}, "xml", "javascript", "css");
|
103
|
+
|
104
|
+
CodeMirror.defineMIME("text/html", "htmlmixed");
|
@@ -1,411 +1,426 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
4
|
-
var indentUnit = config.indentUnit;
|
5
|
-
var jsonMode = parserConfig.json;
|
6
|
-
var isTS = parserConfig.typescript;
|
7
|
-
|
8
|
-
// Tokenizer
|
9
|
-
|
10
|
-
var keywords = function(){
|
11
|
-
function kw(type) {return {type: type, style: "keyword"};}
|
12
|
-
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
13
|
-
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
14
|
-
|
15
|
-
var jsKeywords = {
|
16
|
-
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
17
|
-
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
|
18
|
-
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
19
|
-
"function": kw("function"), "catch": kw("catch"),
|
20
|
-
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
21
|
-
"in": operator, "typeof": operator, "instanceof": operator,
|
22
|
-
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
|
23
|
-
};
|
24
|
-
|
25
|
-
// Extend the 'normal' keywords with the TypeScript language extensions
|
26
|
-
if (isTS) {
|
27
|
-
var type = {type: "variable", style: "variable-3"};
|
28
|
-
var tsKeywords = {
|
29
|
-
// object-like things
|
30
|
-
"interface": kw("interface"),
|
31
|
-
"class": kw("class"),
|
32
|
-
"extends": kw("extends"),
|
33
|
-
"constructor": kw("constructor"),
|
34
|
-
|
35
|
-
// scope modifiers
|
36
|
-
"public": kw("public"),
|
37
|
-
"private": kw("private"),
|
38
|
-
"protected": kw("protected"),
|
39
|
-
"static": kw("static"),
|
40
|
-
|
41
|
-
"super": kw("super"),
|
42
|
-
|
43
|
-
// types
|
44
|
-
"string": type, "number": type, "bool": type, "any": type
|
45
|
-
};
|
46
|
-
|
47
|
-
for (var attr in tsKeywords) {
|
48
|
-
jsKeywords[attr] = tsKeywords[attr];
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
return jsKeywords;
|
53
|
-
}();
|
54
|
-
|
55
|
-
var isOperatorChar = /[+\-*&%=<>!?|]/;
|
56
|
-
|
57
|
-
function chain(stream, state, f) {
|
58
|
-
state.tokenize = f;
|
59
|
-
return f(stream, state);
|
60
|
-
}
|
61
|
-
|
62
|
-
function nextUntilUnescaped(stream, end) {
|
63
|
-
var escaped = false, next;
|
64
|
-
while ((next = stream.next()) != null) {
|
65
|
-
if (next == end && !escaped)
|
66
|
-
return false;
|
67
|
-
escaped = !escaped && next == "\\";
|
68
|
-
}
|
69
|
-
return escaped;
|
70
|
-
}
|
71
|
-
|
72
|
-
// Used as scratch variables to communicate multiple values without
|
73
|
-
// consing up tons of objects.
|
74
|
-
var type, content;
|
75
|
-
function ret(tp, style, cont) {
|
76
|
-
type = tp; content = cont;
|
77
|
-
return style;
|
78
|
-
}
|
79
|
-
|
80
|
-
function jsTokenBase(stream, state) {
|
81
|
-
var ch = stream.next();
|
82
|
-
if (ch == '"' || ch == "'")
|
83
|
-
return chain(stream, state, jsTokenString(ch));
|
84
|
-
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
|
85
|
-
return ret(ch);
|
86
|
-
else if (ch == "0" && stream.eat(/x/i)) {
|
87
|
-
stream.eatWhile(/[\da-f]/i);
|
88
|
-
return ret("number", "number");
|
89
|
-
}
|
90
|
-
else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
|
91
|
-
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
92
|
-
return ret("number", "number");
|
93
|
-
}
|
94
|
-
else if (ch == "/") {
|
95
|
-
if (stream.eat("*")) {
|
96
|
-
return chain(stream, state, jsTokenComment);
|
97
|
-
}
|
98
|
-
else if (stream.eat("/")) {
|
99
|
-
stream.skipToEnd();
|
100
|
-
return ret("comment", "comment");
|
101
|
-
}
|
102
|
-
else if (state.lastType == "operator" || state.lastType == "keyword c" ||
|
103
|
-
/^[\[{}\(,;:]$/.test(state.lastType)) {
|
104
|
-
nextUntilUnescaped(stream, "/");
|
105
|
-
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
106
|
-
return ret("regexp", "string-2");
|
107
|
-
}
|
108
|
-
else {
|
109
|
-
stream.eatWhile(isOperatorChar);
|
110
|
-
return ret("operator", null, stream.current());
|
111
|
-
}
|
112
|
-
}
|
113
|
-
else if (ch == "#") {
|
114
|
-
|
115
|
-
|
116
|
-
}
|
117
|
-
else if (isOperatorChar.test(ch)) {
|
118
|
-
stream.eatWhile(isOperatorChar);
|
119
|
-
return ret("operator", null, stream.current());
|
120
|
-
}
|
121
|
-
else {
|
122
|
-
stream.eatWhile(/[\w\$_]/);
|
123
|
-
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
124
|
-
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
125
|
-
ret("variable", "variable", word);
|
126
|
-
}
|
127
|
-
}
|
128
|
-
|
129
|
-
function jsTokenString(quote) {
|
130
|
-
return function(stream, state) {
|
131
|
-
if (!nextUntilUnescaped(stream, quote))
|
132
|
-
state.tokenize = jsTokenBase;
|
133
|
-
return ret("string", "string");
|
134
|
-
};
|
135
|
-
}
|
136
|
-
|
137
|
-
function jsTokenComment(stream, state) {
|
138
|
-
var maybeEnd = false, ch;
|
139
|
-
while (ch = stream.next()) {
|
140
|
-
if (ch == "/" && maybeEnd) {
|
141
|
-
state.tokenize = jsTokenBase;
|
142
|
-
break;
|
143
|
-
}
|
144
|
-
maybeEnd = (ch == "*");
|
145
|
-
}
|
146
|
-
return ret("comment", "comment");
|
147
|
-
}
|
148
|
-
|
149
|
-
// Parser
|
150
|
-
|
151
|
-
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
|
152
|
-
|
153
|
-
function JSLexical(indented, column, type, align, prev, info) {
|
154
|
-
this.indented = indented;
|
155
|
-
this.column = column;
|
156
|
-
this.type = type;
|
157
|
-
this.prev = prev;
|
158
|
-
this.info = info;
|
159
|
-
if (align != null) this.align = align;
|
160
|
-
}
|
161
|
-
|
162
|
-
function inScope(state, varname) {
|
163
|
-
for (var v = state.localVars; v; v = v.next)
|
164
|
-
if (v.name == varname) return true;
|
165
|
-
}
|
166
|
-
|
167
|
-
function parseJS(state, style, type, content, stream) {
|
168
|
-
var cc = state.cc;
|
169
|
-
// Communicate our context to the combinators.
|
170
|
-
// (Less wasteful than consing up a hundred closures on every call.)
|
171
|
-
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
172
|
-
|
173
|
-
if (!state.lexical.hasOwnProperty("align"))
|
174
|
-
state.lexical.align = true;
|
175
|
-
|
176
|
-
while(true) {
|
177
|
-
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
178
|
-
if (combinator(type, content)) {
|
179
|
-
while(cc.length && cc[cc.length - 1].lex)
|
180
|
-
cc.pop()();
|
181
|
-
if (cx.marked) return cx.marked;
|
182
|
-
if (type == "variable" && inScope(state, content)) return "variable-2";
|
183
|
-
return style;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
}
|
187
|
-
|
188
|
-
// Combinator utils
|
189
|
-
|
190
|
-
var cx = {state: null, column: null, marked: null, cc: null};
|
191
|
-
function pass() {
|
192
|
-
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
193
|
-
}
|
194
|
-
function cont() {
|
195
|
-
pass.apply(null, arguments);
|
196
|
-
return true;
|
197
|
-
}
|
198
|
-
function register(varname) {
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
if (type == "
|
255
|
-
if (type == "
|
256
|
-
|
257
|
-
if (type == "
|
258
|
-
if (type == "
|
259
|
-
if (type == "
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
if (
|
265
|
-
if (type == "
|
266
|
-
if (type == "
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
return cont();
|
272
|
-
|
273
|
-
|
274
|
-
if (type
|
275
|
-
return
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
if (type
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
if (type == "
|
292
|
-
|
293
|
-
|
294
|
-
if (type == "
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
}
|
308
|
-
function
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
return
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
return pass();
|
326
|
-
}
|
327
|
-
function
|
328
|
-
if (
|
329
|
-
|
330
|
-
}
|
331
|
-
function
|
332
|
-
if (type == "
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
return cont(
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
if (
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
if (
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
1
|
+
// TODO actually recognize syntax of TypeScript constructs
|
2
|
+
|
3
|
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
4
|
+
var indentUnit = config.indentUnit;
|
5
|
+
var jsonMode = parserConfig.json;
|
6
|
+
var isTS = parserConfig.typescript;
|
7
|
+
|
8
|
+
// Tokenizer
|
9
|
+
|
10
|
+
var keywords = function(){
|
11
|
+
function kw(type) {return {type: type, style: "keyword"};}
|
12
|
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
13
|
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
14
|
+
|
15
|
+
var jsKeywords = {
|
16
|
+
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
17
|
+
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
|
18
|
+
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
19
|
+
"function": kw("function"), "catch": kw("catch"),
|
20
|
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
21
|
+
"in": operator, "typeof": operator, "instanceof": operator,
|
22
|
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
|
23
|
+
};
|
24
|
+
|
25
|
+
// Extend the 'normal' keywords with the TypeScript language extensions
|
26
|
+
if (isTS) {
|
27
|
+
var type = {type: "variable", style: "variable-3"};
|
28
|
+
var tsKeywords = {
|
29
|
+
// object-like things
|
30
|
+
"interface": kw("interface"),
|
31
|
+
"class": kw("class"),
|
32
|
+
"extends": kw("extends"),
|
33
|
+
"constructor": kw("constructor"),
|
34
|
+
|
35
|
+
// scope modifiers
|
36
|
+
"public": kw("public"),
|
37
|
+
"private": kw("private"),
|
38
|
+
"protected": kw("protected"),
|
39
|
+
"static": kw("static"),
|
40
|
+
|
41
|
+
"super": kw("super"),
|
42
|
+
|
43
|
+
// types
|
44
|
+
"string": type, "number": type, "bool": type, "any": type
|
45
|
+
};
|
46
|
+
|
47
|
+
for (var attr in tsKeywords) {
|
48
|
+
jsKeywords[attr] = tsKeywords[attr];
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
return jsKeywords;
|
53
|
+
}();
|
54
|
+
|
55
|
+
var isOperatorChar = /[+\-*&%=<>!?|]/;
|
56
|
+
|
57
|
+
function chain(stream, state, f) {
|
58
|
+
state.tokenize = f;
|
59
|
+
return f(stream, state);
|
60
|
+
}
|
61
|
+
|
62
|
+
function nextUntilUnescaped(stream, end) {
|
63
|
+
var escaped = false, next;
|
64
|
+
while ((next = stream.next()) != null) {
|
65
|
+
if (next == end && !escaped)
|
66
|
+
return false;
|
67
|
+
escaped = !escaped && next == "\\";
|
68
|
+
}
|
69
|
+
return escaped;
|
70
|
+
}
|
71
|
+
|
72
|
+
// Used as scratch variables to communicate multiple values without
|
73
|
+
// consing up tons of objects.
|
74
|
+
var type, content;
|
75
|
+
function ret(tp, style, cont) {
|
76
|
+
type = tp; content = cont;
|
77
|
+
return style;
|
78
|
+
}
|
79
|
+
|
80
|
+
function jsTokenBase(stream, state) {
|
81
|
+
var ch = stream.next();
|
82
|
+
if (ch == '"' || ch == "'")
|
83
|
+
return chain(stream, state, jsTokenString(ch));
|
84
|
+
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
|
85
|
+
return ret(ch);
|
86
|
+
else if (ch == "0" && stream.eat(/x/i)) {
|
87
|
+
stream.eatWhile(/[\da-f]/i);
|
88
|
+
return ret("number", "number");
|
89
|
+
}
|
90
|
+
else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
|
91
|
+
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
92
|
+
return ret("number", "number");
|
93
|
+
}
|
94
|
+
else if (ch == "/") {
|
95
|
+
if (stream.eat("*")) {
|
96
|
+
return chain(stream, state, jsTokenComment);
|
97
|
+
}
|
98
|
+
else if (stream.eat("/")) {
|
99
|
+
stream.skipToEnd();
|
100
|
+
return ret("comment", "comment");
|
101
|
+
}
|
102
|
+
else if (state.lastType == "operator" || state.lastType == "keyword c" ||
|
103
|
+
/^[\[{}\(,;:]$/.test(state.lastType)) {
|
104
|
+
nextUntilUnescaped(stream, "/");
|
105
|
+
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
106
|
+
return ret("regexp", "string-2");
|
107
|
+
}
|
108
|
+
else {
|
109
|
+
stream.eatWhile(isOperatorChar);
|
110
|
+
return ret("operator", null, stream.current());
|
111
|
+
}
|
112
|
+
}
|
113
|
+
else if (ch == "#") {
|
114
|
+
stream.skipToEnd();
|
115
|
+
return ret("error", "error");
|
116
|
+
}
|
117
|
+
else if (isOperatorChar.test(ch)) {
|
118
|
+
stream.eatWhile(isOperatorChar);
|
119
|
+
return ret("operator", null, stream.current());
|
120
|
+
}
|
121
|
+
else {
|
122
|
+
stream.eatWhile(/[\w\$_]/);
|
123
|
+
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
124
|
+
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
125
|
+
ret("variable", "variable", word);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
function jsTokenString(quote) {
|
130
|
+
return function(stream, state) {
|
131
|
+
if (!nextUntilUnescaped(stream, quote))
|
132
|
+
state.tokenize = jsTokenBase;
|
133
|
+
return ret("string", "string");
|
134
|
+
};
|
135
|
+
}
|
136
|
+
|
137
|
+
function jsTokenComment(stream, state) {
|
138
|
+
var maybeEnd = false, ch;
|
139
|
+
while (ch = stream.next()) {
|
140
|
+
if (ch == "/" && maybeEnd) {
|
141
|
+
state.tokenize = jsTokenBase;
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
maybeEnd = (ch == "*");
|
145
|
+
}
|
146
|
+
return ret("comment", "comment");
|
147
|
+
}
|
148
|
+
|
149
|
+
// Parser
|
150
|
+
|
151
|
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
|
152
|
+
|
153
|
+
function JSLexical(indented, column, type, align, prev, info) {
|
154
|
+
this.indented = indented;
|
155
|
+
this.column = column;
|
156
|
+
this.type = type;
|
157
|
+
this.prev = prev;
|
158
|
+
this.info = info;
|
159
|
+
if (align != null) this.align = align;
|
160
|
+
}
|
161
|
+
|
162
|
+
function inScope(state, varname) {
|
163
|
+
for (var v = state.localVars; v; v = v.next)
|
164
|
+
if (v.name == varname) return true;
|
165
|
+
}
|
166
|
+
|
167
|
+
function parseJS(state, style, type, content, stream) {
|
168
|
+
var cc = state.cc;
|
169
|
+
// Communicate our context to the combinators.
|
170
|
+
// (Less wasteful than consing up a hundred closures on every call.)
|
171
|
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
172
|
+
|
173
|
+
if (!state.lexical.hasOwnProperty("align"))
|
174
|
+
state.lexical.align = true;
|
175
|
+
|
176
|
+
while(true) {
|
177
|
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
178
|
+
if (combinator(type, content)) {
|
179
|
+
while(cc.length && cc[cc.length - 1].lex)
|
180
|
+
cc.pop()();
|
181
|
+
if (cx.marked) return cx.marked;
|
182
|
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
183
|
+
return style;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
// Combinator utils
|
189
|
+
|
190
|
+
var cx = {state: null, column: null, marked: null, cc: null};
|
191
|
+
function pass() {
|
192
|
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
193
|
+
}
|
194
|
+
function cont() {
|
195
|
+
pass.apply(null, arguments);
|
196
|
+
return true;
|
197
|
+
}
|
198
|
+
function register(varname) {
|
199
|
+
function inList(list) {
|
200
|
+
for (var v = list; v; v = v.next)
|
201
|
+
if (v.name == varname) return true;
|
202
|
+
return false;
|
203
|
+
}
|
204
|
+
var state = cx.state;
|
205
|
+
if (state.context) {
|
206
|
+
cx.marked = "def";
|
207
|
+
if (inList(state.localVars)) return;
|
208
|
+
state.localVars = {name: varname, next: state.localVars};
|
209
|
+
} else {
|
210
|
+
if (inList(state.globalVars)) return;
|
211
|
+
state.globalVars = {name: varname, next: state.globalVars};
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
// Combinators
|
216
|
+
|
217
|
+
var defaultVars = {name: "this", next: {name: "arguments"}};
|
218
|
+
function pushcontext() {
|
219
|
+
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
220
|
+
cx.state.localVars = defaultVars;
|
221
|
+
}
|
222
|
+
function popcontext() {
|
223
|
+
cx.state.localVars = cx.state.context.vars;
|
224
|
+
cx.state.context = cx.state.context.prev;
|
225
|
+
}
|
226
|
+
function pushlex(type, info) {
|
227
|
+
var result = function() {
|
228
|
+
var state = cx.state;
|
229
|
+
state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
|
230
|
+
};
|
231
|
+
result.lex = true;
|
232
|
+
return result;
|
233
|
+
}
|
234
|
+
function poplex() {
|
235
|
+
var state = cx.state;
|
236
|
+
if (state.lexical.prev) {
|
237
|
+
if (state.lexical.type == ")")
|
238
|
+
state.indented = state.lexical.indented;
|
239
|
+
state.lexical = state.lexical.prev;
|
240
|
+
}
|
241
|
+
}
|
242
|
+
poplex.lex = true;
|
243
|
+
|
244
|
+
function expect(wanted) {
|
245
|
+
return function(type) {
|
246
|
+
if (type == wanted) return cont();
|
247
|
+
else if (wanted == ";") return pass();
|
248
|
+
else return cont(arguments.callee);
|
249
|
+
};
|
250
|
+
}
|
251
|
+
|
252
|
+
function statement(type) {
|
253
|
+
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
|
254
|
+
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
255
|
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
256
|
+
if (type == "{") return cont(pushlex("}"), block, poplex);
|
257
|
+
if (type == ";") return cont();
|
258
|
+
if (type == "function") return cont(functiondef);
|
259
|
+
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
|
260
|
+
poplex, statement, poplex);
|
261
|
+
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
262
|
+
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
263
|
+
block, poplex, poplex);
|
264
|
+
if (type == "case") return cont(expression, expect(":"));
|
265
|
+
if (type == "default") return cont(expect(":"));
|
266
|
+
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
267
|
+
statement, poplex, popcontext);
|
268
|
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
269
|
+
}
|
270
|
+
function expression(type) {
|
271
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
|
272
|
+
if (type == "function") return cont(functiondef);
|
273
|
+
if (type == "keyword c") return cont(maybeexpression);
|
274
|
+
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
|
275
|
+
if (type == "operator") return cont(expression);
|
276
|
+
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
|
277
|
+
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
|
278
|
+
return cont();
|
279
|
+
}
|
280
|
+
function maybeexpression(type) {
|
281
|
+
if (type.match(/[;\}\)\],]/)) return pass();
|
282
|
+
return pass(expression);
|
283
|
+
}
|
284
|
+
|
285
|
+
function maybeoperator(type, value) {
|
286
|
+
if (type == "operator") {
|
287
|
+
if (/\+\+|--/.test(value)) return cont(maybeoperator);
|
288
|
+
if (value == "?") return cont(expression, expect(":"), expression);
|
289
|
+
return cont(expression);
|
290
|
+
}
|
291
|
+
if (type == ";") return;
|
292
|
+
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
|
293
|
+
if (type == ".") return cont(property, maybeoperator);
|
294
|
+
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
|
295
|
+
}
|
296
|
+
function maybelabel(type) {
|
297
|
+
if (type == ":") return cont(poplex, statement);
|
298
|
+
return pass(maybeoperator, expect(";"), poplex);
|
299
|
+
}
|
300
|
+
function property(type) {
|
301
|
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
302
|
+
}
|
303
|
+
function objprop(type) {
|
304
|
+
if (type == "variable") cx.marked = "property";
|
305
|
+
else if (type == "number" || type == "string") cx.marked = type + " property";
|
306
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
|
307
|
+
}
|
308
|
+
function commasep(what, end) {
|
309
|
+
function proceed(type) {
|
310
|
+
if (type == ",") return cont(what, proceed);
|
311
|
+
if (type == end) return cont();
|
312
|
+
return cont(expect(end));
|
313
|
+
}
|
314
|
+
return function(type) {
|
315
|
+
if (type == end) return cont();
|
316
|
+
else return pass(what, proceed);
|
317
|
+
};
|
318
|
+
}
|
319
|
+
function block(type) {
|
320
|
+
if (type == "}") return cont();
|
321
|
+
return pass(statement, block);
|
322
|
+
}
|
323
|
+
function maybetype(type) {
|
324
|
+
if (type == ":") return cont(typedef);
|
325
|
+
return pass();
|
326
|
+
}
|
327
|
+
function typedef(type) {
|
328
|
+
if (type == "variable"){cx.marked = "variable-3"; return cont();}
|
329
|
+
return pass();
|
330
|
+
}
|
331
|
+
function vardef1(type, value) {
|
332
|
+
if (type == "variable") {
|
333
|
+
register(value);
|
334
|
+
return isTS ? cont(maybetype, vardef2) : cont(vardef2);
|
335
|
+
}
|
336
|
+
return pass();
|
337
|
+
}
|
338
|
+
function vardef2(type, value) {
|
339
|
+
if (value == "=") return cont(expression, vardef2);
|
340
|
+
if (type == ",") return cont(vardef1);
|
341
|
+
}
|
342
|
+
function forspec1(type) {
|
343
|
+
if (type == "var") return cont(vardef1, expect(";"), forspec2);
|
344
|
+
if (type == ";") return cont(forspec2);
|
345
|
+
if (type == "variable") return cont(formaybein);
|
346
|
+
return cont(forspec2);
|
347
|
+
}
|
348
|
+
function formaybein(_type, value) {
|
349
|
+
if (value == "in") return cont(expression);
|
350
|
+
return cont(maybeoperator, forspec2);
|
351
|
+
}
|
352
|
+
function forspec2(type, value) {
|
353
|
+
if (type == ";") return cont(forspec3);
|
354
|
+
if (value == "in") return cont(expression);
|
355
|
+
return cont(expression, expect(";"), forspec3);
|
356
|
+
}
|
357
|
+
function forspec3(type) {
|
358
|
+
if (type != ")") cont(expression);
|
359
|
+
}
|
360
|
+
function functiondef(type, value) {
|
361
|
+
if (type == "variable") {register(value); return cont(functiondef);}
|
362
|
+
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
|
363
|
+
}
|
364
|
+
function funarg(type, value) {
|
365
|
+
if (type == "variable") {register(value); return isTS ? cont(maybetype) : cont();}
|
366
|
+
}
|
367
|
+
|
368
|
+
// Interface
|
369
|
+
|
370
|
+
return {
|
371
|
+
startState: function(basecolumn) {
|
372
|
+
return {
|
373
|
+
tokenize: jsTokenBase,
|
374
|
+
lastType: null,
|
375
|
+
cc: [],
|
376
|
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
377
|
+
localVars: parserConfig.localVars,
|
378
|
+
globalVars: parserConfig.globalVars,
|
379
|
+
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
380
|
+
indented: 0
|
381
|
+
};
|
382
|
+
},
|
383
|
+
|
384
|
+
token: function(stream, state) {
|
385
|
+
if (stream.sol()) {
|
386
|
+
if (!state.lexical.hasOwnProperty("align"))
|
387
|
+
state.lexical.align = false;
|
388
|
+
state.indented = stream.indentation();
|
389
|
+
}
|
390
|
+
if (stream.eatSpace()) return null;
|
391
|
+
var style = state.tokenize(stream, state);
|
392
|
+
if (type == "comment") return style;
|
393
|
+
state.lastType = type;
|
394
|
+
return parseJS(state, style, type, content, stream);
|
395
|
+
},
|
396
|
+
|
397
|
+
indent: function(state, textAfter) {
|
398
|
+
if (state.tokenize == jsTokenComment) return CodeMirror.Pass;
|
399
|
+
if (state.tokenize != jsTokenBase) return 0;
|
400
|
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
|
401
|
+
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
|
402
|
+
var type = lexical.type, closing = firstChar == type;
|
403
|
+
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? 4 : 0);
|
404
|
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
405
|
+
else if (type == "form") return lexical.indented + indentUnit;
|
406
|
+
else if (type == "stat")
|
407
|
+
return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? indentUnit : 0);
|
408
|
+
else if (lexical.info == "switch" && !closing)
|
409
|
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
410
|
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
411
|
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
412
|
+
},
|
413
|
+
|
414
|
+
electricChars: ":{}",
|
415
|
+
|
416
|
+
jsonMode: jsonMode
|
417
|
+
};
|
418
|
+
});
|
419
|
+
|
420
|
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
421
|
+
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
422
|
+
CodeMirror.defineMIME("application/javascript", "javascript");
|
423
|
+
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
424
|
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
425
|
+
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
426
|
+
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|