glebtv-ckeditor 4.6.0 → 4.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +15 -22
- data/MIT-LICENSE +0 -0
- data/README.md +2 -325
- data/Rakefile +1 -2
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/gal_add.jpg +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/gal_add.png +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/gal_del.png +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/gal_more.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/preloader.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/avi.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/ckfnothumb.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/doc.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/docx.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/exe.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/gz.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/htm.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/jpg.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/mp3.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/mpg.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/pdf.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/psd.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/rar.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/swf.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/tar.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/txt.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/unknown.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/wmv.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/xls.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/xlsx.gif +0 -0
- data/app/assets/{javascripts/ckeditor/filebrowser/images → images/ckeditor/filebrowser}/thumbs/zip.gif +0 -0
- data/app/assets/javascripts/ckeditor/application.js +0 -0
- data/app/assets/javascripts/ckeditor/config.js.erb +1 -2
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/{application.js.erb → application.js} +4 -6
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.endless-scroll.js +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.tmpl.min.js +0 -0
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/rails.js +0 -0
- data/app/assets/javascripts/ckeditor/init.js.erb +0 -0
- data/app/assets/stylesheets/ckeditor/application.css +1 -1
- data/app/assets/stylesheets/ckeditor/filebrowser/uploader.scss +172 -0
- data/app/controllers/ckeditor/application_controller.rb +9 -10
- data/app/controllers/ckeditor/attachment_files_controller.rb +11 -12
- data/app/controllers/ckeditor/pictures_controller.rb +10 -12
- data/app/helpers/ckeditor/application_helper.rb +1 -10
- data/app/views/ckeditor/attachment_files/index.html.erb +5 -5
- data/app/views/ckeditor/pictures/index.html.erb +5 -5
- data/app/views/ckeditor/shared/_asset.html.erb +18 -21
- data/app/views/ckeditor/shared/_asset_tmpl.html.erb +17 -20
- data/app/views/layouts/ckeditor/application.html.erb +3 -3
- data/config/locales/en.ckeditor.yml +0 -0
- data/config/locales/ru.ckeditor.yml +0 -0
- data/config/routes.rb +2 -2
- data/lib/ckeditor.rb +42 -34
- data/lib/ckeditor/asset_response.rb +74 -25
- data/lib/ckeditor/backend/carrierwave.rb +8 -5
- data/lib/ckeditor/backend/dragonfly.rb +5 -3
- data/lib/ckeditor/backend/paperclip.rb +15 -22
- data/lib/ckeditor/backend/refile.rb +6 -4
- data/lib/ckeditor/helpers/controllers.rb +15 -20
- data/lib/ckeditor/helpers/form_builder.rb +1 -1
- data/lib/ckeditor/helpers/form_helper.rb +0 -0
- data/lib/ckeditor/helpers/view_helper.rb +0 -0
- data/lib/ckeditor/hooks/cancan.rb +0 -2
- data/lib/ckeditor/hooks/formtastic.rb +2 -2
- data/lib/ckeditor/hooks/pundit.rb +1 -4
- data/lib/ckeditor/hooks/simple_form.rb +9 -14
- data/lib/ckeditor/http.rb +9 -11
- data/lib/ckeditor/orm/active_record.rb +1 -3
- data/lib/ckeditor/orm/base.rb +5 -5
- data/lib/ckeditor/orm/mongoid.rb +4 -6
- data/lib/ckeditor/paginatable.rb +3 -1
- data/lib/ckeditor/rails.rb +39 -0
- data/lib/ckeditor/text_area.rb +16 -15
- data/lib/ckeditor/utils.rb +45 -39
- data/lib/ckeditor/utils/content_type_detector.rb +7 -10
- data/lib/ckeditor/utils/javascript_code.rb +8 -3
- data/lib/ckeditor/version.rb +2 -2
- data/lib/generators/ckeditor/install_generator.rb +52 -30
- data/lib/generators/ckeditor/pundit_policy_generator.rb +1 -3
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb +2 -2
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +6 -10
- data/lib/generators/ckeditor/templates/active_record/carrierwave/migration_versioned.rb +22 -0
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb +1 -1
- data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb +4 -4
- data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +6 -10
- data/lib/generators/ckeditor/templates/active_record/dragonfly/migration_versioned.rb +23 -0
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb +3 -3
- data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb +5 -5
- data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +2 -5
- data/lib/generators/ckeditor/templates/active_record/paperclip/migration_versioned.rb +23 -0
- data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/asset.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/attachment_file.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/picture.rb +0 -0
- data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +7 -12
- data/lib/generators/ckeditor/templates/active_record/refile/migration_versioned.rb +23 -0
- data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +0 -0
- data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +4 -4
- data/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb +4 -5
- data/lib/generators/ckeditor/templates/ckeditor.rb +16 -7
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +2 -2
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb +1 -1
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb +1 -1
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb +0 -0
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb +5 -5
- data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb +5 -5
- data/lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb +2 -2
- data/lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb +2 -2
- data/lib/glebtv-ckeditor.rb +0 -0
- data/lib/tasks/ckeditor.rake +6 -14
- data/test/controllers/attachment_files_controller_test.rb +0 -0
- data/test/controllers/pictures_controller_test.rb +0 -0
- data/test/dummy/Rakefile +0 -0
- data/test/dummy/app/assets/javascripts/application.js +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +0 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +0 -0
- data/test/dummy/app/controllers/application_controller.rb +0 -0
- data/test/dummy/app/controllers/posts_controller.rb +0 -0
- data/test/dummy/app/helpers/application_helper.rb +0 -0
- data/test/dummy/app/helpers/posts_helper.rb +0 -0
- data/test/dummy/app/models/post.rb +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +0 -0
- data/test/dummy/app/views/posts/_form.html.erb +0 -0
- data/test/dummy/app/views/posts/edit.html.erb +0 -0
- data/test/dummy/app/views/posts/index.html.erb +0 -0
- data/test/dummy/app/views/posts/new.html.erb +0 -0
- data/test/dummy/app/views/posts/show.html.erb +0 -0
- data/test/dummy/config.ru +0 -0
- data/test/dummy/config/application.rb +0 -0
- data/test/dummy/config/boot.rb +0 -0
- data/test/dummy/config/database.yml +0 -0
- data/test/dummy/config/environment.rb +0 -0
- data/test/dummy/config/environments/development.rb +0 -0
- data/test/dummy/config/environments/production.rb +0 -0
- data/test/dummy/config/environments/test.rb +0 -0
- data/test/dummy/config/initializers/assets.rb +1 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/test/dummy/config/initializers/ckeditor.rb +0 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -0
- data/test/dummy/config/initializers/inflections.rb +0 -0
- data/test/dummy/config/initializers/mime_types.rb +0 -0
- data/test/dummy/config/initializers/paperclip.rb +3 -0
- data/test/dummy/config/initializers/session_store.rb +0 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/test/dummy/config/locales/en.yml +0 -0
- data/test/dummy/config/mongoid.yml +0 -0
- data/test/dummy/config/routes.rb +0 -0
- data/test/dummy/config/secrets.yml +0 -0
- data/test/dummy/db/migrate/20110623120047_create_posts.rb +0 -0
- data/test/dummy/public/404.html +0 -0
- data/test/dummy/public/422.html +0 -0
- data/test/dummy/public/500.html +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -0
- data/test/dummy/test/fixtures/files/rails.png +0 -0
- data/test/dummy/test/fixtures/files/rails.tar.gz +0 -0
- data/test/functional/posts_controller_test.rb +2 -3
- data/test/generators/install_generator_test.rb +2 -2
- data/test/integration/navigation_test.rb +0 -0
- data/test/models/attachment_file_test.rb +3 -8
- data/test/models/ckeditor_test.rb +1 -1
- data/test/models/picture_test.rb +0 -0
- data/test/models/utils_test.rb +6 -6
- data/test/orm/active_record.rb +0 -0
- data/test/orm/mongoid.rb +0 -0
- data/test/support/helpers.rb +0 -0
- data/test/support/integration_case.rb +0 -0
- data/test/support/raw_post.rb +0 -0
- data/test/support/routes.txt +0 -0
- data/test/test_helper.rb +1 -1
- data/vendor/assets/javascripts/ckeditor/CHANGES.md +1358 -0
- data/vendor/assets/javascripts/ckeditor/README.md +39 -0
- data/vendor/assets/javascripts/ckeditor/build-config.js +31 -30
- data/vendor/assets/javascripts/ckeditor/ckeditor.js +709 -675
- data/vendor/assets/javascripts/ckeditor/config.js +10 -0
- data/vendor/assets/javascripts/ckeditor/contents.css +208 -0
- data/vendor/assets/javascripts/ckeditor/lang/en.js +4 -4
- data/vendor/assets/javascripts/ckeditor/lang/ru.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +2 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +6 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +3 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -0
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +230 -74
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/abcdef.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/colorforth.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/dracula.css +2 -3
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-dark.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-light.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/icecoder.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/liquibyte.css +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/material.css +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mdn-like.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/midnight.css +0 -2
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/seti.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/the-matrix.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ttcn.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/yeti.css +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/lineheight/lang/ru.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +23 -23
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/icons/hidpi/loremipsum.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/icons/loremipsum.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/en.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/lang/ru.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/loremipsum/plugin.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/notification/plugin.js +13 -7
- data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +49 -39
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/dialog.css +23 -0
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +33 -19
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css +6 -1
- data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +4 -1
- data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +92 -23
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +81 -82
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/images/icon-hdpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/images/icon.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/lang/ru.js +2 -1
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/plugin.js +448 -448
- data/vendor/assets/javascripts/ckeditor/samples/css/samples.css +1632 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/github-top.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/header-bg.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/header-separator.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/logo.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/img/navigation-tip.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/index.html +128 -0
- data/vendor/assets/javascripts/ckeditor/samples/js/sample.js +53 -0
- data/vendor/assets/javascripts/ckeditor/samples/js/sf.js +17 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/ajax.html +85 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/api.html +210 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/appendto.html +59 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/inlineall/logo.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/outputxhtml/outputxhtml.css +204 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/posteddata.php +59 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/sample.jpg +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/assets/uilanguages/languages.js +7 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/datafiltering.html +508 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/dialog/assets/my_dialog.js +48 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/dialog/dialog.html +190 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/divreplace.html +144 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/enterkey/enterkey.html +106 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.fla +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.swf +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/swfobject.js +19 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputforflash.html +283 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputhtml.html +224 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/index.html +131 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/inlineall.html +314 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/inlinebycode.html +124 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/inlinetextarea.html +113 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/jquery.html +103 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/magicline/magicline.html +209 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/readonly.html +76 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/replacebyclass.html +60 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/replacebycode.html +59 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/sample.css +357 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/sample.js +50 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/sample_posteddata.php +16 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/tabindex.html +78 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/toolbar/toolbar.html +235 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/uicolor.html +72 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/uilanguages.html +122 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/wysiwygarea/fullpage.html +80 -0
- data/vendor/assets/javascripts/ckeditor/samples/old/xhtmlstyle.html +234 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/css/fontello.css +55 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt +10 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/config.json +28 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.eot +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.svg +14 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.ttf +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.woff +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/index.html +446 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js +13 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js +9 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js +33 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js +14 -0
- data/vendor/assets/javascripts/ckeditor/{plugins/codemirror/LICENSE.md → samples/toolbarconfigurator/lib/codemirror/LICENSE} +19 -21
- data/vendor/assets/javascripts/ckeditor/{plugins/codemirror/css → samples/toolbarconfigurator/lib/codemirror}/codemirror.css +325 -341
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js +288 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js +25 -0
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css +36 -0
- data/vendor/assets/javascripts/ckeditor/{plugins/codemirror/js/addon/hint → samples/toolbarconfigurator/lib/codemirror}/show-hint.css +38 -36
- data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js +16 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog_ie.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog_ie7.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog_ie8.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/dialog_iequirks.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +5 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/arrow.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/close.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/close.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock-open.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/refresh.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/lock-open.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/lock.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/images/refresh.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/minimalist/readme.md +7 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dev/icons16.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dev/icons16.svg +2374 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dev/icons32.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dev/icons32.svg +2722 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/dev/locations.json +145 -0
- 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 +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/skin.js +10 -0
- data/vendor/assets/javascripts/ckeditor/styles.js +1 -1
- metadata +182 -177
- data/app/assets/javascripts/ckeditor/filebrowser/stylesheets/uploader.css.erb +0 -128
- data/app/views/rails_admin/main/_form_ck_editor.html.haml +0 -10
- data/app/views/rails_admin/main/_form_ck_editorml.html.haml +0 -11
- data/config/locales/bg.ckeditor.yml +0 -9
- data/config/locales/cs.ckeditor.yml +0 -9
- data/config/locales/de.ckeditor.yml +0 -9
- data/config/locales/el-GR.cdkeditor.yml +0 -9
- data/config/locales/es.ckeditor.yml +0 -9
- data/config/locales/fr.ckeditor.yml +0 -9
- data/config/locales/hu.ckeditor.yml +0 -9
- data/config/locales/it.ckeditor.yml +0 -9
- data/config/locales/ja.ckeditor.yml +0 -9
- data/config/locales/nb.ckeditor.yml +0 -9
- data/config/locales/nl.ckeditor.yml +0 -9
- data/config/locales/pl.ckeditor.yml +0 -9
- data/config/locales/pt-BR.ckeditor.yml +0 -9
- data/config/locales/pt-PT.ckeditor.yml +0 -9
- data/config/locales/sv-SE.ckeditor.yml +0 -9
- data/config/locales/tr.ckeditor.yml +0 -9
- data/config/locales/uk.ckeditor.yml +0 -9
- data/config/locales/zh-CN.ckeditor.yml +0 -9
- data/config/locales/zh-TW.ckeditor.yml +0 -9
- data/lib/ckeditor/engine.rb +0 -46
- data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +0 -12
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.ckeditor.css +0 -183
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/comment/comment.js +0 -206
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/comment/continuecomment.js +0 -85
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.css +0 -32
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.js +0 -157
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closebrackets.js +0 -202
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closetag.js +0 -169
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js +0 -51
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchbrackets.js +0 -122
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchtags.js +0 -66
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/trailingspace.js +0 -27
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/brace-fold.js +0 -105
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/comment-fold.js +0 -59
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldcode.js +0 -150
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldgutter.css +0 -20
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldgutter.js +0 -146
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/indent-fold.js +0 -44
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/markdown-fold.js +0 -49
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/xml-fold.js +0 -182
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/autoFormatAll.js +0 -43
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/formatting.js +0 -226
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/anyword-hint.js +0 -41
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/css-hint.js +0 -60
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/html-hint.js +0 -348
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/javascript-hint.js +0 -155
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/show-hint.js +0 -438
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/sql-hint.js +0 -271
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/hint/xml-hint.js +0 -110
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/loadmode.js +0 -64
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/multiplex.js +0 -123
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/multiplex_test.js +0 -33
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/overlay.js +0 -85
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/mode/simple.js +0 -213
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/jump-to-line.js +0 -49
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/match-highlighter.js +0 -165
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/matchesonscrollbar.css +0 -8
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/matchesonscrollbar.js +0 -97
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/search.js +0 -252
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/searchcursor.js +0 -189
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/active-line.js +0 -74
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/mark-selection.js +0 -118
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/selection/selection-pointer.js +0 -98
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify-html.js +0 -952
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.js +0 -2087
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.js +0 -9109
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcode/bbcode.js +0 -137
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcode/index.html +0 -73
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcodemixed/bbcodemixed.js +0 -161
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/bbcodemixed/index.html +0 -128
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/clike.js +0 -785
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/index.html +0 -360
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/scala.html +0 -767
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/clike/test.js +0 -55
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/css.js +0 -825
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/gss.html +0 -103
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/gss_test.js +0 -17
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/index.html +0 -75
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/less.html +0 -152
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/less_test.js +0 -54
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/scss.html +0 -157
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/scss_test.js +0 -110
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/css/test.js +0 -200
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlembedded/htmlembedded.js +0 -28
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlembedded/index.html +0 -60
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlmixed/htmlmixed.js +0 -152
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/htmlmixed/index.html +0 -89
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/index.html +0 -114
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/javascript.js +0 -784
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/json-ld.html +0 -72
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/test.js +0 -247
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/javascript/typescript.html +0 -61
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/index.html +0 -64
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/php.js +0 -234
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/php/test.js +0 -154
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/index.html +0 -61
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/test.js +0 -51
- data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/mode/xml/xml.js +0 -394
- data/vendor/assets/javascripts/ckeditor/plugins/youtube/LICENSE.md +0 -15
@@ -1,89 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
|
3
|
-
<title>CodeMirror: HTML mixed mode</title>
|
4
|
-
<meta charset="utf-8"/>
|
5
|
-
<link rel=stylesheet href="../../doc/docs.css">
|
6
|
-
|
7
|
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
8
|
-
<script src="../../lib/codemirror.js"></script>
|
9
|
-
<script src="../../addon/selection/selection-pointer.js"></script>
|
10
|
-
<script src="../xml/xml.js"></script>
|
11
|
-
<script src="../javascript/javascript.js"></script>
|
12
|
-
<script src="../css/css.js"></script>
|
13
|
-
<script src="../vbscript/vbscript.js"></script>
|
14
|
-
<script src="htmlmixed.js"></script>
|
15
|
-
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
16
|
-
<div id=nav>
|
17
|
-
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
18
|
-
|
19
|
-
<ul>
|
20
|
-
<li><a href="../../index.html">Home</a>
|
21
|
-
<li><a href="../../doc/manual.html">Manual</a>
|
22
|
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
23
|
-
</ul>
|
24
|
-
<ul>
|
25
|
-
<li><a href="../index.html">Language modes</a>
|
26
|
-
<li><a class=active href="#">HTML mixed</a>
|
27
|
-
</ul>
|
28
|
-
</div>
|
29
|
-
|
30
|
-
<article>
|
31
|
-
<h2>HTML mixed mode</h2>
|
32
|
-
<form><textarea id="code" name="code">
|
33
|
-
<html style="color: green">
|
34
|
-
<!-- this is a comment -->
|
35
|
-
<head>
|
36
|
-
<title>Mixed HTML Example</title>
|
37
|
-
<style type="text/css">
|
38
|
-
h1 {font-family: comic sans; color: #f0f;}
|
39
|
-
div {background: yellow !important;}
|
40
|
-
body {
|
41
|
-
max-width: 50em;
|
42
|
-
margin: 1em 2em 1em 5em;
|
43
|
-
}
|
44
|
-
</style>
|
45
|
-
</head>
|
46
|
-
<body>
|
47
|
-
<h1>Mixed HTML Example</h1>
|
48
|
-
<script>
|
49
|
-
function jsFunc(arg1, arg2) {
|
50
|
-
if (arg1 && arg2) document.body.innerHTML = "achoo";
|
51
|
-
}
|
52
|
-
</script>
|
53
|
-
</body>
|
54
|
-
</html>
|
55
|
-
</textarea></form>
|
56
|
-
<script>
|
57
|
-
// Define an extended mixed-mode that understands vbscript and
|
58
|
-
// leaves mustache/handlebars embedded templates in html mode
|
59
|
-
var mixedMode = {
|
60
|
-
name: "htmlmixed",
|
61
|
-
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
|
62
|
-
mode: null},
|
63
|
-
{matches: /(text|application)\/(x-)?vb(a|script)/i,
|
64
|
-
mode: "vbscript"}]
|
65
|
-
};
|
66
|
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
67
|
-
mode: mixedMode,
|
68
|
-
selectionPointer: true
|
69
|
-
});
|
70
|
-
</script>
|
71
|
-
|
72
|
-
<p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
|
73
|
-
|
74
|
-
<p>It takes an optional mode configuration
|
75
|
-
option, <code>scriptTypes</code>, which can be used to add custom
|
76
|
-
behavior for specific <code><script type="..."></code> tags. If
|
77
|
-
given, it should hold an array of <code>{matches, mode}</code>
|
78
|
-
objects, where <code>matches</code> is a string or regexp that
|
79
|
-
matches the script type, and <code>mode</code> is
|
80
|
-
either <code>null</code>, for script types that should stay in
|
81
|
-
HTML mode, or a <a href="../../doc/manual.html#option_mode">mode
|
82
|
-
spec</a> corresponding to the mode that should be used for the
|
83
|
-
script.</p>
|
84
|
-
|
85
|
-
<p><strong>MIME types defined:</strong> <code>text/html</code>
|
86
|
-
(redefined, only takes effect if you load this parser after the
|
87
|
-
XML parser).</p>
|
88
|
-
|
89
|
-
</article>
|
@@ -1,114 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
|
3
|
-
<title>CodeMirror: JavaScript mode</title>
|
4
|
-
<meta charset="utf-8"/>
|
5
|
-
<link rel=stylesheet href="../../doc/docs.css">
|
6
|
-
|
7
|
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
8
|
-
<script src="../../lib/codemirror.js"></script>
|
9
|
-
<script src="../../addon/edit/matchbrackets.js"></script>
|
10
|
-
<script src="../../addon/comment/continuecomment.js"></script>
|
11
|
-
<script src="../../addon/comment/comment.js"></script>
|
12
|
-
<script src="javascript.js"></script>
|
13
|
-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
14
|
-
<div id=nav>
|
15
|
-
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
16
|
-
|
17
|
-
<ul>
|
18
|
-
<li><a href="../../index.html">Home</a>
|
19
|
-
<li><a href="../../doc/manual.html">Manual</a>
|
20
|
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21
|
-
</ul>
|
22
|
-
<ul>
|
23
|
-
<li><a href="../index.html">Language modes</a>
|
24
|
-
<li><a class=active href="#">JavaScript</a>
|
25
|
-
</ul>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<article>
|
29
|
-
<h2>JavaScript mode</h2>
|
30
|
-
|
31
|
-
|
32
|
-
<div><textarea id="code" name="code">
|
33
|
-
// Demo code (the actual new parser character stream implementation)
|
34
|
-
|
35
|
-
function StringStream(string) {
|
36
|
-
this.pos = 0;
|
37
|
-
this.string = string;
|
38
|
-
}
|
39
|
-
|
40
|
-
StringStream.prototype = {
|
41
|
-
done: function() {return this.pos >= this.string.length;},
|
42
|
-
peek: function() {return this.string.charAt(this.pos);},
|
43
|
-
next: function() {
|
44
|
-
if (this.pos < this.string.length)
|
45
|
-
return this.string.charAt(this.pos++);
|
46
|
-
},
|
47
|
-
eat: function(match) {
|
48
|
-
var ch = this.string.charAt(this.pos);
|
49
|
-
if (typeof match == "string") var ok = ch == match;
|
50
|
-
else var ok = ch && match.test ? match.test(ch) : match(ch);
|
51
|
-
if (ok) {this.pos++; return ch;}
|
52
|
-
},
|
53
|
-
eatWhile: function(match) {
|
54
|
-
var start = this.pos;
|
55
|
-
while (this.eat(match));
|
56
|
-
if (this.pos > start) return this.string.slice(start, this.pos);
|
57
|
-
},
|
58
|
-
backUp: function(n) {this.pos -= n;},
|
59
|
-
column: function() {return this.pos;},
|
60
|
-
eatSpace: function() {
|
61
|
-
var start = this.pos;
|
62
|
-
while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
|
63
|
-
return this.pos - start;
|
64
|
-
},
|
65
|
-
match: function(pattern, consume, caseInsensitive) {
|
66
|
-
if (typeof pattern == "string") {
|
67
|
-
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
|
68
|
-
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
|
69
|
-
if (consume !== false) this.pos += str.length;
|
70
|
-
return true;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
else {
|
74
|
-
var match = this.string.slice(this.pos).match(pattern);
|
75
|
-
if (match && consume !== false) this.pos += match[0].length;
|
76
|
-
return match;
|
77
|
-
}
|
78
|
-
}
|
79
|
-
};
|
80
|
-
</textarea></div>
|
81
|
-
|
82
|
-
<script>
|
83
|
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
84
|
-
lineNumbers: true,
|
85
|
-
matchBrackets: true,
|
86
|
-
continueComments: "Enter",
|
87
|
-
extraKeys: {"Ctrl-Q": "toggleComment"}
|
88
|
-
});
|
89
|
-
</script>
|
90
|
-
|
91
|
-
<p>
|
92
|
-
JavaScript mode supports several configuration options:
|
93
|
-
<ul>
|
94
|
-
<li><code>json</code> which will set the mode to expect JSON
|
95
|
-
data rather than a JavaScript program.</li>
|
96
|
-
<li><code>jsonld</code> which will set the mode to expect
|
97
|
-
<a href="http://json-ld.org">JSON-LD</a> linked data rather
|
98
|
-
than a JavaScript program (<a href="json-ld.html">demo</a>).</li>
|
99
|
-
<li><code>typescript</code> which will activate additional
|
100
|
-
syntax highlighting and some other things for TypeScript code
|
101
|
-
(<a href="typescript.html">demo</a>).</li>
|
102
|
-
<li><code>statementIndent</code> which (given a number) will
|
103
|
-
determine the amount of indentation to use for statements
|
104
|
-
continued on a new line.</li>
|
105
|
-
<li><code>wordCharacters</code>, a regexp that indicates which
|
106
|
-
characters should be considered part of an identifier.
|
107
|
-
Defaults to <code>/[\w$]/</code>, which does not handle
|
108
|
-
non-ASCII identifiers. Can be set to something more elaborate
|
109
|
-
to improve Unicode support.</li>
|
110
|
-
</ul>
|
111
|
-
</p>
|
112
|
-
|
113
|
-
<p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>, <code>application/ld+json</code>, <code>text/typescript</code>, <code>application/typescript</code>.</p>
|
114
|
-
</article>
|
@@ -1,784 +0,0 @@
|
|
1
|
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
-
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
-
|
4
|
-
(function(mod) {
|
5
|
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
-
mod(require("../../lib/codemirror"));
|
7
|
-
else if (typeof define == "function" && define.amd) // AMD
|
8
|
-
define(["../../lib/codemirror"], mod);
|
9
|
-
else // Plain browser env
|
10
|
-
mod(CodeMirror);
|
11
|
-
})(function(CodeMirror) {
|
12
|
-
"use strict";
|
13
|
-
|
14
|
-
function expressionAllowed(stream, state, backUp) {
|
15
|
-
return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
|
16
|
-
(state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
|
17
|
-
}
|
18
|
-
|
19
|
-
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
20
|
-
var indentUnit = config.indentUnit;
|
21
|
-
var statementIndent = parserConfig.statementIndent;
|
22
|
-
var jsonldMode = parserConfig.jsonld;
|
23
|
-
var jsonMode = parserConfig.json || jsonldMode;
|
24
|
-
var isTS = parserConfig.typescript;
|
25
|
-
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
|
26
|
-
|
27
|
-
// Tokenizer
|
28
|
-
|
29
|
-
var keywords = function(){
|
30
|
-
function kw(type) {return {type: type, style: "keyword"};}
|
31
|
-
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
32
|
-
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
33
|
-
|
34
|
-
var jsKeywords = {
|
35
|
-
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
36
|
-
"return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
|
37
|
-
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
38
|
-
"function": kw("function"), "catch": kw("catch"),
|
39
|
-
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
40
|
-
"in": operator, "typeof": operator, "instanceof": operator,
|
41
|
-
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
42
|
-
"this": kw("this"), "class": kw("class"), "super": kw("atom"),
|
43
|
-
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
|
44
|
-
"await": C, "async": kw("async")
|
45
|
-
};
|
46
|
-
|
47
|
-
// Extend the 'normal' keywords with the TypeScript language extensions
|
48
|
-
if (isTS) {
|
49
|
-
var type = {type: "variable", style: "variable-3"};
|
50
|
-
var tsKeywords = {
|
51
|
-
// object-like things
|
52
|
-
"interface": kw("class"),
|
53
|
-
"implements": C,
|
54
|
-
"namespace": C,
|
55
|
-
"module": kw("module"),
|
56
|
-
"enum": kw("module"),
|
57
|
-
"type": kw("type"),
|
58
|
-
|
59
|
-
// scope modifiers
|
60
|
-
"public": kw("modifier"),
|
61
|
-
"private": kw("modifier"),
|
62
|
-
"protected": kw("modifier"),
|
63
|
-
"abstract": kw("modifier"),
|
64
|
-
|
65
|
-
// operators
|
66
|
-
"as": operator,
|
67
|
-
|
68
|
-
// types
|
69
|
-
"string": type, "number": type, "boolean": type, "any": type
|
70
|
-
};
|
71
|
-
|
72
|
-
for (var attr in tsKeywords) {
|
73
|
-
jsKeywords[attr] = tsKeywords[attr];
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
return jsKeywords;
|
78
|
-
}();
|
79
|
-
|
80
|
-
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
|
81
|
-
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
|
82
|
-
|
83
|
-
function readRegexp(stream) {
|
84
|
-
var escaped = false, next, inSet = false;
|
85
|
-
while ((next = stream.next()) != null) {
|
86
|
-
if (!escaped) {
|
87
|
-
if (next == "/" && !inSet) return;
|
88
|
-
if (next == "[") inSet = true;
|
89
|
-
else if (inSet && next == "]") inSet = false;
|
90
|
-
}
|
91
|
-
escaped = !escaped && next == "\\";
|
92
|
-
}
|
93
|
-
}
|
94
|
-
|
95
|
-
// Used as scratch variables to communicate multiple values without
|
96
|
-
// consing up tons of objects.
|
97
|
-
var type, content;
|
98
|
-
function ret(tp, style, cont) {
|
99
|
-
type = tp; content = cont;
|
100
|
-
return style;
|
101
|
-
}
|
102
|
-
function tokenBase(stream, state) {
|
103
|
-
var ch = stream.next();
|
104
|
-
if (ch == '"' || ch == "'") {
|
105
|
-
state.tokenize = tokenString(ch);
|
106
|
-
return state.tokenize(stream, state);
|
107
|
-
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
|
108
|
-
return ret("number", "number");
|
109
|
-
} else if (ch == "." && stream.match("..")) {
|
110
|
-
return ret("spread", "meta");
|
111
|
-
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
112
|
-
return ret(ch);
|
113
|
-
} else if (ch == "=" && stream.eat(">")) {
|
114
|
-
return ret("=>", "operator");
|
115
|
-
} else if (ch == "0" && stream.eat(/x/i)) {
|
116
|
-
stream.eatWhile(/[\da-f]/i);
|
117
|
-
return ret("number", "number");
|
118
|
-
} else if (ch == "0" && stream.eat(/o/i)) {
|
119
|
-
stream.eatWhile(/[0-7]/i);
|
120
|
-
return ret("number", "number");
|
121
|
-
} else if (ch == "0" && stream.eat(/b/i)) {
|
122
|
-
stream.eatWhile(/[01]/i);
|
123
|
-
return ret("number", "number");
|
124
|
-
} else if (/\d/.test(ch)) {
|
125
|
-
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
126
|
-
return ret("number", "number");
|
127
|
-
} else if (ch == "/") {
|
128
|
-
if (stream.eat("*")) {
|
129
|
-
state.tokenize = tokenComment;
|
130
|
-
return tokenComment(stream, state);
|
131
|
-
} else if (stream.eat("/")) {
|
132
|
-
stream.skipToEnd();
|
133
|
-
return ret("comment", "comment");
|
134
|
-
} else if (expressionAllowed(stream, state, 1)) {
|
135
|
-
readRegexp(stream);
|
136
|
-
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
|
137
|
-
return ret("regexp", "string-2");
|
138
|
-
} else {
|
139
|
-
stream.eatWhile(isOperatorChar);
|
140
|
-
return ret("operator", "operator", stream.current());
|
141
|
-
}
|
142
|
-
} else if (ch == "`") {
|
143
|
-
state.tokenize = tokenQuasi;
|
144
|
-
return tokenQuasi(stream, state);
|
145
|
-
} else if (ch == "#") {
|
146
|
-
stream.skipToEnd();
|
147
|
-
return ret("error", "error");
|
148
|
-
} else if (isOperatorChar.test(ch)) {
|
149
|
-
stream.eatWhile(isOperatorChar);
|
150
|
-
return ret("operator", "operator", stream.current());
|
151
|
-
} else if (wordRE.test(ch)) {
|
152
|
-
stream.eatWhile(wordRE);
|
153
|
-
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
154
|
-
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
155
|
-
ret("variable", "variable", word);
|
156
|
-
}
|
157
|
-
}
|
158
|
-
|
159
|
-
function tokenString(quote) {
|
160
|
-
return function(stream, state) {
|
161
|
-
var escaped = false, next;
|
162
|
-
if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
|
163
|
-
state.tokenize = tokenBase;
|
164
|
-
return ret("jsonld-keyword", "meta");
|
165
|
-
}
|
166
|
-
while ((next = stream.next()) != null) {
|
167
|
-
if (next == quote && !escaped) break;
|
168
|
-
escaped = !escaped && next == "\\";
|
169
|
-
}
|
170
|
-
if (!escaped) state.tokenize = tokenBase;
|
171
|
-
return ret("string", "string");
|
172
|
-
};
|
173
|
-
}
|
174
|
-
|
175
|
-
function tokenComment(stream, state) {
|
176
|
-
var maybeEnd = false, ch;
|
177
|
-
while (ch = stream.next()) {
|
178
|
-
if (ch == "/" && maybeEnd) {
|
179
|
-
state.tokenize = tokenBase;
|
180
|
-
break;
|
181
|
-
}
|
182
|
-
maybeEnd = (ch == "*");
|
183
|
-
}
|
184
|
-
return ret("comment", "comment");
|
185
|
-
}
|
186
|
-
|
187
|
-
function tokenQuasi(stream, state) {
|
188
|
-
var escaped = false, next;
|
189
|
-
while ((next = stream.next()) != null) {
|
190
|
-
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
|
191
|
-
state.tokenize = tokenBase;
|
192
|
-
break;
|
193
|
-
}
|
194
|
-
escaped = !escaped && next == "\\";
|
195
|
-
}
|
196
|
-
return ret("quasi", "string-2", stream.current());
|
197
|
-
}
|
198
|
-
|
199
|
-
var brackets = "([{}])";
|
200
|
-
// This is a crude lookahead trick to try and notice that we're
|
201
|
-
// parsing the argument patterns for a fat-arrow function before we
|
202
|
-
// actually hit the arrow token. It only works if the arrow is on
|
203
|
-
// the same line as the arguments and there's no strange noise
|
204
|
-
// (comments) in between. Fallback is to only notice when we hit the
|
205
|
-
// arrow, and not declare the arguments as locals for the arrow
|
206
|
-
// body.
|
207
|
-
function findFatArrow(stream, state) {
|
208
|
-
if (state.fatArrowAt) state.fatArrowAt = null;
|
209
|
-
var arrow = stream.string.indexOf("=>", stream.start);
|
210
|
-
if (arrow < 0) return;
|
211
|
-
|
212
|
-
if (isTS) { // Try to skip TypeScript return type declarations after the arguments
|
213
|
-
var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
|
214
|
-
if (m) arrow = m.index
|
215
|
-
}
|
216
|
-
|
217
|
-
var depth = 0, sawSomething = false;
|
218
|
-
for (var pos = arrow - 1; pos >= 0; --pos) {
|
219
|
-
var ch = stream.string.charAt(pos);
|
220
|
-
var bracket = brackets.indexOf(ch);
|
221
|
-
if (bracket >= 0 && bracket < 3) {
|
222
|
-
if (!depth) { ++pos; break; }
|
223
|
-
if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
|
224
|
-
} else if (bracket >= 3 && bracket < 6) {
|
225
|
-
++depth;
|
226
|
-
} else if (wordRE.test(ch)) {
|
227
|
-
sawSomething = true;
|
228
|
-
} else if (/["'\/]/.test(ch)) {
|
229
|
-
return;
|
230
|
-
} else if (sawSomething && !depth) {
|
231
|
-
++pos;
|
232
|
-
break;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
if (sawSomething && !depth) state.fatArrowAt = pos;
|
236
|
-
}
|
237
|
-
|
238
|
-
// Parser
|
239
|
-
|
240
|
-
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
|
241
|
-
|
242
|
-
function JSLexical(indented, column, type, align, prev, info) {
|
243
|
-
this.indented = indented;
|
244
|
-
this.column = column;
|
245
|
-
this.type = type;
|
246
|
-
this.prev = prev;
|
247
|
-
this.info = info;
|
248
|
-
if (align != null) this.align = align;
|
249
|
-
}
|
250
|
-
|
251
|
-
function inScope(state, varname) {
|
252
|
-
for (var v = state.localVars; v; v = v.next)
|
253
|
-
if (v.name == varname) return true;
|
254
|
-
for (var cx = state.context; cx; cx = cx.prev) {
|
255
|
-
for (var v = cx.vars; v; v = v.next)
|
256
|
-
if (v.name == varname) return true;
|
257
|
-
}
|
258
|
-
}
|
259
|
-
|
260
|
-
function parseJS(state, style, type, content, stream) {
|
261
|
-
var cc = state.cc;
|
262
|
-
// Communicate our context to the combinators.
|
263
|
-
// (Less wasteful than consing up a hundred closures on every call.)
|
264
|
-
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
|
265
|
-
|
266
|
-
if (!state.lexical.hasOwnProperty("align"))
|
267
|
-
state.lexical.align = true;
|
268
|
-
|
269
|
-
while(true) {
|
270
|
-
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
271
|
-
if (combinator(type, content)) {
|
272
|
-
while(cc.length && cc[cc.length - 1].lex)
|
273
|
-
cc.pop()();
|
274
|
-
if (cx.marked) return cx.marked;
|
275
|
-
if (type == "variable" && inScope(state, content)) return "variable-2";
|
276
|
-
return style;
|
277
|
-
}
|
278
|
-
}
|
279
|
-
}
|
280
|
-
|
281
|
-
// Combinator utils
|
282
|
-
|
283
|
-
var cx = {state: null, column: null, marked: null, cc: null};
|
284
|
-
function pass() {
|
285
|
-
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
286
|
-
}
|
287
|
-
function cont() {
|
288
|
-
pass.apply(null, arguments);
|
289
|
-
return true;
|
290
|
-
}
|
291
|
-
function register(varname) {
|
292
|
-
function inList(list) {
|
293
|
-
for (var v = list; v; v = v.next)
|
294
|
-
if (v.name == varname) return true;
|
295
|
-
return false;
|
296
|
-
}
|
297
|
-
var state = cx.state;
|
298
|
-
cx.marked = "def";
|
299
|
-
if (state.context) {
|
300
|
-
if (inList(state.localVars)) return;
|
301
|
-
state.localVars = {name: varname, next: state.localVars};
|
302
|
-
} else {
|
303
|
-
if (inList(state.globalVars)) return;
|
304
|
-
if (parserConfig.globalVars)
|
305
|
-
state.globalVars = {name: varname, next: state.globalVars};
|
306
|
-
}
|
307
|
-
}
|
308
|
-
|
309
|
-
// Combinators
|
310
|
-
|
311
|
-
var defaultVars = {name: "this", next: {name: "arguments"}};
|
312
|
-
function pushcontext() {
|
313
|
-
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
314
|
-
cx.state.localVars = defaultVars;
|
315
|
-
}
|
316
|
-
function popcontext() {
|
317
|
-
cx.state.localVars = cx.state.context.vars;
|
318
|
-
cx.state.context = cx.state.context.prev;
|
319
|
-
}
|
320
|
-
function pushlex(type, info) {
|
321
|
-
var result = function() {
|
322
|
-
var state = cx.state, indent = state.indented;
|
323
|
-
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
324
|
-
else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
|
325
|
-
indent = outer.indented;
|
326
|
-
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
327
|
-
};
|
328
|
-
result.lex = true;
|
329
|
-
return result;
|
330
|
-
}
|
331
|
-
function poplex() {
|
332
|
-
var state = cx.state;
|
333
|
-
if (state.lexical.prev) {
|
334
|
-
if (state.lexical.type == ")")
|
335
|
-
state.indented = state.lexical.indented;
|
336
|
-
state.lexical = state.lexical.prev;
|
337
|
-
}
|
338
|
-
}
|
339
|
-
poplex.lex = true;
|
340
|
-
|
341
|
-
function expect(wanted) {
|
342
|
-
function exp(type) {
|
343
|
-
if (type == wanted) return cont();
|
344
|
-
else if (wanted == ";") return pass();
|
345
|
-
else return cont(exp);
|
346
|
-
};
|
347
|
-
return exp;
|
348
|
-
}
|
349
|
-
|
350
|
-
function statement(type, value) {
|
351
|
-
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
|
352
|
-
if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
|
353
|
-
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
354
|
-
if (type == "{") return cont(pushlex("}"), block, poplex);
|
355
|
-
if (type == ";") return cont();
|
356
|
-
if (type == "if") {
|
357
|
-
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
|
358
|
-
cx.state.cc.pop()();
|
359
|
-
return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
|
360
|
-
}
|
361
|
-
if (type == "function") return cont(functiondef);
|
362
|
-
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
|
363
|
-
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
364
|
-
if (type == "switch") return cont(pushlex("form"), parenExpr, pushlex("}", "switch"), expect("{"),
|
365
|
-
block, poplex, poplex);
|
366
|
-
if (type == "case") return cont(expression, expect(":"));
|
367
|
-
if (type == "default") return cont(expect(":"));
|
368
|
-
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
369
|
-
statement, poplex, popcontext);
|
370
|
-
if (type == "class") return cont(pushlex("form"), className, poplex);
|
371
|
-
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
372
|
-
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
373
|
-
if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
|
374
|
-
if (type == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
|
375
|
-
if (type == "async") return cont(statement)
|
376
|
-
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
377
|
-
}
|
378
|
-
function expression(type) {
|
379
|
-
return expressionInner(type, false);
|
380
|
-
}
|
381
|
-
function expressionNoComma(type) {
|
382
|
-
return expressionInner(type, true);
|
383
|
-
}
|
384
|
-
function parenExpr(type) {
|
385
|
-
if (type != "(") return pass()
|
386
|
-
return cont(pushlex(")"), expression, expect(")"), poplex)
|
387
|
-
}
|
388
|
-
function expressionInner(type, noComma) {
|
389
|
-
if (cx.state.fatArrowAt == cx.stream.start) {
|
390
|
-
var body = noComma ? arrowBodyNoComma : arrowBody;
|
391
|
-
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
|
392
|
-
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
|
393
|
-
}
|
394
|
-
|
395
|
-
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
396
|
-
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
397
|
-
if (type == "function") return cont(functiondef, maybeop);
|
398
|
-
if (type == "class") return cont(pushlex("form"), classExpression, poplex);
|
399
|
-
if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
400
|
-
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
|
401
|
-
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
402
|
-
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
|
403
|
-
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
|
404
|
-
if (type == "quasi") return pass(quasi, maybeop);
|
405
|
-
if (type == "new") return cont(maybeTarget(noComma));
|
406
|
-
return cont();
|
407
|
-
}
|
408
|
-
function maybeexpression(type) {
|
409
|
-
if (type.match(/[;\}\)\],]/)) return pass();
|
410
|
-
return pass(expression);
|
411
|
-
}
|
412
|
-
function maybeexpressionNoComma(type) {
|
413
|
-
if (type.match(/[;\}\)\],]/)) return pass();
|
414
|
-
return pass(expressionNoComma);
|
415
|
-
}
|
416
|
-
|
417
|
-
function maybeoperatorComma(type, value) {
|
418
|
-
if (type == ",") return cont(expression);
|
419
|
-
return maybeoperatorNoComma(type, value, false);
|
420
|
-
}
|
421
|
-
function maybeoperatorNoComma(type, value, noComma) {
|
422
|
-
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
423
|
-
var expr = noComma == false ? expression : expressionNoComma;
|
424
|
-
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
425
|
-
if (type == "operator") {
|
426
|
-
if (/\+\+|--/.test(value)) return cont(me);
|
427
|
-
if (value == "?") return cont(expression, expect(":"), expr);
|
428
|
-
return cont(expr);
|
429
|
-
}
|
430
|
-
if (type == "quasi") { return pass(quasi, me); }
|
431
|
-
if (type == ";") return;
|
432
|
-
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
|
433
|
-
if (type == ".") return cont(property, me);
|
434
|
-
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
435
|
-
}
|
436
|
-
function quasi(type, value) {
|
437
|
-
if (type != "quasi") return pass();
|
438
|
-
if (value.slice(value.length - 2) != "${") return cont(quasi);
|
439
|
-
return cont(expression, continueQuasi);
|
440
|
-
}
|
441
|
-
function continueQuasi(type) {
|
442
|
-
if (type == "}") {
|
443
|
-
cx.marked = "string-2";
|
444
|
-
cx.state.tokenize = tokenQuasi;
|
445
|
-
return cont(quasi);
|
446
|
-
}
|
447
|
-
}
|
448
|
-
function arrowBody(type) {
|
449
|
-
findFatArrow(cx.stream, cx.state);
|
450
|
-
return pass(type == "{" ? statement : expression);
|
451
|
-
}
|
452
|
-
function arrowBodyNoComma(type) {
|
453
|
-
findFatArrow(cx.stream, cx.state);
|
454
|
-
return pass(type == "{" ? statement : expressionNoComma);
|
455
|
-
}
|
456
|
-
function maybeTarget(noComma) {
|
457
|
-
return function(type) {
|
458
|
-
if (type == ".") return cont(noComma ? targetNoComma : target);
|
459
|
-
else return pass(noComma ? expressionNoComma : expression);
|
460
|
-
};
|
461
|
-
}
|
462
|
-
function target(_, value) {
|
463
|
-
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
|
464
|
-
}
|
465
|
-
function targetNoComma(_, value) {
|
466
|
-
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
|
467
|
-
}
|
468
|
-
function maybelabel(type) {
|
469
|
-
if (type == ":") return cont(poplex, statement);
|
470
|
-
return pass(maybeoperatorComma, expect(";"), poplex);
|
471
|
-
}
|
472
|
-
function property(type) {
|
473
|
-
if (type == "variable") {cx.marked = "property"; return cont();}
|
474
|
-
}
|
475
|
-
function objprop(type, value) {
|
476
|
-
if (type == "async") {
|
477
|
-
cx.marked = "property";
|
478
|
-
return cont(objprop);
|
479
|
-
} else if (type == "variable" || cx.style == "keyword") {
|
480
|
-
cx.marked = "property";
|
481
|
-
if (value == "get" || value == "set") return cont(getterSetter);
|
482
|
-
return cont(afterprop);
|
483
|
-
} else if (type == "number" || type == "string") {
|
484
|
-
cx.marked = jsonldMode ? "property" : (cx.style + " property");
|
485
|
-
return cont(afterprop);
|
486
|
-
} else if (type == "jsonld-keyword") {
|
487
|
-
return cont(afterprop);
|
488
|
-
} else if (type == "modifier") {
|
489
|
-
return cont(objprop)
|
490
|
-
} else if (type == "[") {
|
491
|
-
return cont(expression, expect("]"), afterprop);
|
492
|
-
} else if (type == "spread") {
|
493
|
-
return cont(expression);
|
494
|
-
} else if (type == ":") {
|
495
|
-
return pass(afterprop)
|
496
|
-
}
|
497
|
-
}
|
498
|
-
function getterSetter(type) {
|
499
|
-
if (type != "variable") return pass(afterprop);
|
500
|
-
cx.marked = "property";
|
501
|
-
return cont(functiondef);
|
502
|
-
}
|
503
|
-
function afterprop(type) {
|
504
|
-
if (type == ":") return cont(expressionNoComma);
|
505
|
-
if (type == "(") return pass(functiondef);
|
506
|
-
}
|
507
|
-
function commasep(what, end) {
|
508
|
-
function proceed(type, value) {
|
509
|
-
if (type == ",") {
|
510
|
-
var lex = cx.state.lexical;
|
511
|
-
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
512
|
-
return cont(function(type, value) {
|
513
|
-
if (type == end || value == end) return pass()
|
514
|
-
return pass(what)
|
515
|
-
}, proceed);
|
516
|
-
}
|
517
|
-
if (type == end || value == end) return cont();
|
518
|
-
return cont(expect(end));
|
519
|
-
}
|
520
|
-
return function(type, value) {
|
521
|
-
if (type == end || value == end) return cont();
|
522
|
-
return pass(what, proceed);
|
523
|
-
};
|
524
|
-
}
|
525
|
-
function contCommasep(what, end, info) {
|
526
|
-
for (var i = 3; i < arguments.length; i++)
|
527
|
-
cx.cc.push(arguments[i]);
|
528
|
-
return cont(pushlex(end, info), commasep(what, end), poplex);
|
529
|
-
}
|
530
|
-
function block(type) {
|
531
|
-
if (type == "}") return cont();
|
532
|
-
return pass(statement, block);
|
533
|
-
}
|
534
|
-
function maybetype(type, value) {
|
535
|
-
if (isTS) {
|
536
|
-
if (type == ":") return cont(typeexpr);
|
537
|
-
if (value == "?") return cont(maybetype);
|
538
|
-
}
|
539
|
-
}
|
540
|
-
function typeexpr(type) {
|
541
|
-
if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
|
542
|
-
if (type == "{") return cont(commasep(typeprop, "}"))
|
543
|
-
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
|
544
|
-
}
|
545
|
-
function maybeReturnType(type) {
|
546
|
-
if (type == "=>") return cont(typeexpr)
|
547
|
-
}
|
548
|
-
function typeprop(type) {
|
549
|
-
if (type == "variable" || cx.style == "keyword") {
|
550
|
-
cx.marked = "property"
|
551
|
-
return cont(typeprop)
|
552
|
-
} else if (type == ":") {
|
553
|
-
return cont(typeexpr)
|
554
|
-
}
|
555
|
-
}
|
556
|
-
function typearg(type) {
|
557
|
-
if (type == "variable") return cont(typearg)
|
558
|
-
else if (type == ":") return cont(typeexpr)
|
559
|
-
}
|
560
|
-
function afterType(type, value) {
|
561
|
-
if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
|
562
|
-
if (type == "[") return cont(expect("]"), afterType)
|
563
|
-
}
|
564
|
-
function vardef() {
|
565
|
-
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
566
|
-
}
|
567
|
-
function pattern(type, value) {
|
568
|
-
if (type == "modifier") return cont(pattern)
|
569
|
-
if (type == "variable") { register(value); return cont(); }
|
570
|
-
if (type == "spread") return cont(pattern);
|
571
|
-
if (type == "[") return contCommasep(pattern, "]");
|
572
|
-
if (type == "{") return contCommasep(proppattern, "}");
|
573
|
-
}
|
574
|
-
function proppattern(type, value) {
|
575
|
-
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
|
576
|
-
register(value);
|
577
|
-
return cont(maybeAssign);
|
578
|
-
}
|
579
|
-
if (type == "variable") cx.marked = "property";
|
580
|
-
if (type == "spread") return cont(pattern);
|
581
|
-
if (type == "}") return pass();
|
582
|
-
return cont(expect(":"), pattern, maybeAssign);
|
583
|
-
}
|
584
|
-
function maybeAssign(_type, value) {
|
585
|
-
if (value == "=") return cont(expressionNoComma);
|
586
|
-
}
|
587
|
-
function vardefCont(type) {
|
588
|
-
if (type == ",") return cont(vardef);
|
589
|
-
}
|
590
|
-
function maybeelse(type, value) {
|
591
|
-
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
|
592
|
-
}
|
593
|
-
function forspec(type) {
|
594
|
-
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
|
595
|
-
}
|
596
|
-
function forspec1(type) {
|
597
|
-
if (type == "var") return cont(vardef, expect(";"), forspec2);
|
598
|
-
if (type == ";") return cont(forspec2);
|
599
|
-
if (type == "variable") return cont(formaybeinof);
|
600
|
-
return pass(expression, expect(";"), forspec2);
|
601
|
-
}
|
602
|
-
function formaybeinof(_type, value) {
|
603
|
-
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
604
|
-
return cont(maybeoperatorComma, forspec2);
|
605
|
-
}
|
606
|
-
function forspec2(type, value) {
|
607
|
-
if (type == ";") return cont(forspec3);
|
608
|
-
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
609
|
-
return pass(expression, expect(";"), forspec3);
|
610
|
-
}
|
611
|
-
function forspec3(type) {
|
612
|
-
if (type != ")") cont(expression);
|
613
|
-
}
|
614
|
-
function functiondef(type, value) {
|
615
|
-
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
616
|
-
if (type == "variable") {register(value); return cont(functiondef);}
|
617
|
-
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
|
618
|
-
}
|
619
|
-
function funarg(type) {
|
620
|
-
if (type == "spread") return cont(funarg);
|
621
|
-
return pass(pattern, maybetype, maybeAssign);
|
622
|
-
}
|
623
|
-
function classExpression(type, value) {
|
624
|
-
// Class expressions may have an optional name.
|
625
|
-
if (type == "variable") return className(type, value);
|
626
|
-
return classNameAfter(type, value);
|
627
|
-
}
|
628
|
-
function className(type, value) {
|
629
|
-
if (type == "variable") {register(value); return cont(classNameAfter);}
|
630
|
-
}
|
631
|
-
function classNameAfter(type, value) {
|
632
|
-
if (value == "extends" || value == "implements") return cont(isTS ? typeexpr : expression, classNameAfter);
|
633
|
-
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
634
|
-
}
|
635
|
-
function classBody(type, value) {
|
636
|
-
if (type == "variable" || cx.style == "keyword") {
|
637
|
-
if ((value == "static" || value == "get" || value == "set" ||
|
638
|
-
(isTS && (value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract"))) &&
|
639
|
-
cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false)) {
|
640
|
-
cx.marked = "keyword";
|
641
|
-
return cont(classBody);
|
642
|
-
}
|
643
|
-
cx.marked = "property";
|
644
|
-
return cont(isTS ? classfield : functiondef, classBody);
|
645
|
-
}
|
646
|
-
if (value == "*") {
|
647
|
-
cx.marked = "keyword";
|
648
|
-
return cont(classBody);
|
649
|
-
}
|
650
|
-
if (type == ";") return cont(classBody);
|
651
|
-
if (type == "}") return cont();
|
652
|
-
}
|
653
|
-
function classfield(type, value) {
|
654
|
-
if (value == "?") return cont(classfield)
|
655
|
-
if (type == ":") return cont(typeexpr, maybeAssign)
|
656
|
-
return pass(functiondef)
|
657
|
-
}
|
658
|
-
function afterExport(_type, value) {
|
659
|
-
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
|
660
|
-
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
|
661
|
-
return pass(statement);
|
662
|
-
}
|
663
|
-
function afterImport(type) {
|
664
|
-
if (type == "string") return cont();
|
665
|
-
return pass(importSpec, maybeFrom);
|
666
|
-
}
|
667
|
-
function importSpec(type, value) {
|
668
|
-
if (type == "{") return contCommasep(importSpec, "}");
|
669
|
-
if (type == "variable") register(value);
|
670
|
-
if (value == "*") cx.marked = "keyword";
|
671
|
-
return cont(maybeAs);
|
672
|
-
}
|
673
|
-
function maybeAs(_type, value) {
|
674
|
-
if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
|
675
|
-
}
|
676
|
-
function maybeFrom(_type, value) {
|
677
|
-
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
|
678
|
-
}
|
679
|
-
function arrayLiteral(type) {
|
680
|
-
if (type == "]") return cont();
|
681
|
-
return pass(commasep(expressionNoComma, "]"));
|
682
|
-
}
|
683
|
-
|
684
|
-
function isContinuedStatement(state, textAfter) {
|
685
|
-
return state.lastType == "operator" || state.lastType == "," ||
|
686
|
-
isOperatorChar.test(textAfter.charAt(0)) ||
|
687
|
-
/[,.]/.test(textAfter.charAt(0));
|
688
|
-
}
|
689
|
-
|
690
|
-
// Interface
|
691
|
-
|
692
|
-
return {
|
693
|
-
startState: function(basecolumn) {
|
694
|
-
var state = {
|
695
|
-
tokenize: tokenBase,
|
696
|
-
lastType: "sof",
|
697
|
-
cc: [],
|
698
|
-
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
699
|
-
localVars: parserConfig.localVars,
|
700
|
-
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
701
|
-
indented: basecolumn || 0
|
702
|
-
};
|
703
|
-
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
|
704
|
-
state.globalVars = parserConfig.globalVars;
|
705
|
-
return state;
|
706
|
-
},
|
707
|
-
|
708
|
-
token: function(stream, state) {
|
709
|
-
if (stream.sol()) {
|
710
|
-
if (!state.lexical.hasOwnProperty("align"))
|
711
|
-
state.lexical.align = false;
|
712
|
-
state.indented = stream.indentation();
|
713
|
-
findFatArrow(stream, state);
|
714
|
-
}
|
715
|
-
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
|
716
|
-
var style = state.tokenize(stream, state);
|
717
|
-
if (type == "comment") return style;
|
718
|
-
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
719
|
-
return parseJS(state, style, type, content, stream);
|
720
|
-
},
|
721
|
-
|
722
|
-
indent: function(state, textAfter) {
|
723
|
-
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
724
|
-
if (state.tokenize != tokenBase) return 0;
|
725
|
-
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
|
726
|
-
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
727
|
-
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
|
728
|
-
var c = state.cc[i];
|
729
|
-
if (c == poplex) lexical = lexical.prev;
|
730
|
-
else if (c != maybeelse) break;
|
731
|
-
}
|
732
|
-
while ((lexical.type == "stat" || lexical.type == "form") &&
|
733
|
-
(firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
|
734
|
-
(top == maybeoperatorComma || top == maybeoperatorNoComma) &&
|
735
|
-
!/^[,\.=+\-*:?[\(]/.test(textAfter))))
|
736
|
-
lexical = lexical.prev;
|
737
|
-
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
738
|
-
lexical = lexical.prev;
|
739
|
-
var type = lexical.type, closing = firstChar == type;
|
740
|
-
|
741
|
-
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
|
742
|
-
else if (type == "form" && firstChar == "{") return lexical.indented;
|
743
|
-
else if (type == "form") return lexical.indented + indentUnit;
|
744
|
-
else if (type == "stat")
|
745
|
-
return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
|
746
|
-
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
747
|
-
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
748
|
-
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
749
|
-
else return lexical.indented + (closing ? 0 : indentUnit);
|
750
|
-
},
|
751
|
-
|
752
|
-
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
|
753
|
-
blockCommentStart: jsonMode ? null : "/*",
|
754
|
-
blockCommentEnd: jsonMode ? null : "*/",
|
755
|
-
lineComment: jsonMode ? null : "//",
|
756
|
-
fold: "brace",
|
757
|
-
closeBrackets: "()[]{}''\"\"``",
|
758
|
-
|
759
|
-
helperType: jsonMode ? "json" : "javascript",
|
760
|
-
jsonldMode: jsonldMode,
|
761
|
-
jsonMode: jsonMode,
|
762
|
-
|
763
|
-
expressionAllowed: expressionAllowed,
|
764
|
-
skipExpression: function(state) {
|
765
|
-
var top = state.cc[state.cc.length - 1]
|
766
|
-
if (top == expression || top == expressionNoComma) state.cc.pop()
|
767
|
-
}
|
768
|
-
};
|
769
|
-
});
|
770
|
-
|
771
|
-
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
|
772
|
-
|
773
|
-
CodeMirror.defineMIME("text/javascript", "javascript");
|
774
|
-
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
775
|
-
CodeMirror.defineMIME("application/javascript", "javascript");
|
776
|
-
CodeMirror.defineMIME("application/x-javascript", "javascript");
|
777
|
-
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
778
|
-
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
779
|
-
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
|
780
|
-
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
|
781
|
-
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
782
|
-
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
783
|
-
|
784
|
-
});
|