active_admin_pro 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +5 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/active_admin_pro.js +41 -0
- data/app/assets/javascripts/active_admin_pro/actions/new.js +8 -0
- data/app/assets/javascripts/active_admin_pro/actions/show.js +12 -0
- data/app/assets/javascripts/active_admin_pro/components/codemirror_input.js +92 -0
- data/app/assets/javascripts/active_admin_pro/components/flashes.js +9 -0
- data/app/assets/javascripts/active_admin_pro/components/link.js +23 -0
- data/app/assets/javascripts/active_admin_pro/components/phone_input.js +52 -0
- data/app/assets/javascripts/active_admin_pro/components/select_input.js +31 -0
- data/app/assets/javascripts/active_admin_pro/components/sortable_handle.js +8 -0
- data/app/assets/javascripts/active_admin_pro/components/summernote_input.js +132 -0
- data/app/assets/javascripts/active_admin_pro/components/text_input.js +47 -0
- data/app/assets/javascripts/active_admin_pro/components/time_zone_input.js +51 -0
- data/app/assets/javascripts/active_admin_pro/components/title_to_slug.js +16 -0
- data/app/assets/stylesheets/active_admin_pro.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/breakpoints.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/components/_input_variables.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/components/actions.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/components/boolean_input.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/components/button.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/components/check_boxes_input.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/components/codemirror_input.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/components/comments.scss +17 -0
- data/app/assets/stylesheets/active_admin_pro/components/datepicker.scss +108 -0
- data/app/assets/stylesheets/active_admin_pro/components/dialog.scss +66 -0
- data/app/assets/stylesheets/active_admin_pro/components/dropdown_menu_button.scss +40 -0
- data/app/assets/stylesheets/active_admin_pro/components/fieldset.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/components/file_input.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/components/has_many_fields.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/components/inline_errors.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/components/link.scss +16 -0
- data/app/assets/stylesheets/active_admin_pro/components/panel.scss +62 -0
- data/app/assets/stylesheets/active_admin_pro/components/phone_input.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/components/radio_input.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/components/segmented_control.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/components/select_input.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/components/sortable_handle.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/components/string_input.scss +85 -0
- data/app/assets/stylesheets/active_admin_pro/components/summernote_input.scss +190 -0
- data/app/assets/stylesheets/active_admin_pro/components/table.scss +100 -0
- data/app/assets/stylesheets/active_admin_pro/components/text_input.scss +55 -0
- data/app/assets/stylesheets/active_admin_pro/functions/color.scss +130 -0
- data/app/assets/stylesheets/active_admin_pro/functions/text-color.scss +35 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/comments.scss +14 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/index.scss +88 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/show.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/layout/body.scss +60 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/action_items.scss +32 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/actions/comments.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/active_admin_content.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/breadcrumbs.scss +57 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/navigation.scss +197 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/sidebar.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/title_bar.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/wrapper.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/filters.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/layout/flashes.scss +52 -0
- data/app/assets/stylesheets/active_admin_pro/layout/footer.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/layout/mobile/actions/index.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/dashboard.scss +105 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/index.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/show.scss +78 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/active_admin_content.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/flashes.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/navigation.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/title_bar.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/mixins/button.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/variables.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon.scss +87 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/_bourbon-deprecated-upcoming.scss +411 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-color.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-radius.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-style.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-width.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_buttons.scss +64 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_clearfix.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_ellipsis.scss +30 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_font-stacks.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_hide-text.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_margin.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_padding.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_position.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_prefixer.scss +66 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_retina-image.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_size.scss +51 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_text-inputs.scss +113 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_timing-functions.scss +34 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_triangle.scss +63 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_word-wrap.scss +29 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_animation.scss +43 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_appearance.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_backface-visibility.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background-image.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background.scss +55 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_border-image.scss +59 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_calc.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_columns.scss +47 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_filter.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_flex-box.scss +287 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-face.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-feature-settings.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hidpi-media-query.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hyphens.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_image-rendering.scss +14 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_keyframes.scss +36 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_linear-gradient.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_perspective.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_placeholder.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_radial-gradient.scss +39 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_selection.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_text-decoration.scss +19 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transform.scss +15 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transition.scss +71 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_user-select.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_assign-inputs.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains-falsy.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-length.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-light.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-number.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-size.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_modular-scale.scss +69 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-em.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-rem.scss +15 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_shade.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_strip-units.scss +17 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_tint.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_transition-property-name.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_unpack.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_convert-units.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_directional-values.scss +96 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_font-source-declaration.scss +43 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_gradient-positions-parser.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-angle-parser.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-gradient-parser.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-positions-parser.scss +61 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-side-corner-parser.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-arg-parser.scss +69 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-gradient-parser.scss +50 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-positions-parser.scss +18 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_render-gradients.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_shape-size-stripper.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_str-to-num.scss +50 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_asset-pipeline.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_prefixer.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_px-to-em.scss +1 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/_neat-helpers.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_new-breakpoint.scss +49 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_private.scss +108 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_box-sizing.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_direction-context.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_display-context.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_fill-parent.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_media.scss +92 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_omega.scss +91 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_outer-container.scss +36 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_pad.scss +23 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_private.scss +35 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_row.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_span-columns.scss +90 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_to-deprecate.scss +105 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_visual-grid.scss +40 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_disable-warnings.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_grid.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_visual-grid.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/normalize.css +423 -0
- data/app/assets/stylesheets/codemirror/themes/activeadmin_pro.scss +117 -0
- data/app/inputs/codemirror_input.rb +27 -0
- data/app/inputs/datepicker_input.rb +16 -0
- data/app/inputs/phone_input.rb +5 -0
- data/app/inputs/summernote_input.rb +5 -0
- data/app/inputs/time_zone_input.rb +43 -0
- data/app/models/activeadmin_pro/summernote_image.rb +5 -0
- data/config/initializers/active_admin.rb +50 -0
- data/config/locales/en.yml +55 -0
- data/lib/active_admin_pro/admin_user/admin_user.rb +52 -0
- data/lib/active_admin_pro/engine.rb +8 -0
- data/lib/active_admin_pro/summernote_image/summernote_image.rb +61 -0
- data/lib/active_admin_pro/user/user.rb +53 -0
- data/lib/active_admin_pro/version.rb +3 -0
- data/lib/activeadmin_pro.rb +9 -0
- data/lib/generators/activeadmin_pro/install_generator.rb +14 -0
- data/lib/tasks/activeadmin_pro_tasks.rake +4 -0
- data/spec/spec_helper.rb +34 -0
- data/vendor/assets/javascripts/bootstrap.js +1243 -0
- data/vendor/assets/javascripts/codemirror.js +8887 -0
- data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +183 -0
- data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.css +32 -0
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/codemirror/addons/display/autorefresh.js +47 -0
- data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.css +6 -0
- data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/display/panel.js +112 -0
- data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +60 -0
- data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +63 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +195 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +57 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +149 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.css +20 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.css +38 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +386 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +254 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/html-lint.js +46 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.css +73 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +231 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.css +112 -0
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +775 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex_test.js +33 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/simple.js +213 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +178 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js +115 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +46 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +147 -0
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +128 -0
- data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +228 -0
- data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +71 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.css +87 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +700 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +44 -0
- data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +366 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +823 -0
- data/vendor/assets/javascripts/codemirror/modes/diff.js +47 -0
- data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +79 -0
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +130 -0
- data/vendor/assets/javascripts/codemirror/modes/go.js +185 -0
- data/vendor/assets/javascripts/codemirror/modes/haml.js +159 -0
- data/vendor/assets/javascripts/codemirror/modes/handlebars.js +53 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +150 -0
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +708 -0
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +792 -0
- data/vendor/assets/javascripts/codemirror/modes/nginx.js +178 -0
- data/vendor/assets/javascripts/codemirror/modes/php.js +234 -0
- data/vendor/assets/javascripts/codemirror/modes/python.js +358 -0
- data/vendor/assets/javascripts/codemirror/modes/ruby.js +285 -0
- data/vendor/assets/javascripts/codemirror/modes/rust.js +58 -0
- data/vendor/assets/javascripts/codemirror/modes/sass.js +414 -0
- data/vendor/assets/javascripts/codemirror/modes/shell.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/xml.js +385 -0
- data/vendor/assets/javascripts/codemirror/modes/yaml.js +117 -0
- data/vendor/assets/javascripts/intl-tel-input.js +963 -0
- data/vendor/assets/javascripts/intl-tel-utils.js +480 -0
- data/vendor/assets/javascripts/slug.js +212 -0
- data/vendor/assets/javascripts/summernote.js +6939 -0
- data/vendor/assets/stylesheets/codemirror.css +334 -0
- data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/dracula.css +41 -0
- data/vendor/assets/stylesheets/codemirror/themes/material.css +53 -0
- data/vendor/assets/stylesheets/codemirror/themes/monokai.css +35 -0
- data/vendor/assets/stylesheets/codemirror/themes/solarized.css +163 -0
- data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +34 -0
- data/vendor/assets/stylesheets/intl-tel-input.scss +1054 -0
- data/vendor/assets/stylesheets/summernote-bs3.css +5425 -0
- data/vendor/assets/stylesheets/summernote.css +1 -0
- metadata +604 -0
@@ -0,0 +1,47 @@
|
|
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
|
+
CodeMirror.defineOption("autoRefresh", false, function(cm, val) {
|
15
|
+
if (cm.state.autoRefresh) {
|
16
|
+
stopListening(cm, cm.state.autoRefresh)
|
17
|
+
cm.state.autoRefresh = null
|
18
|
+
}
|
19
|
+
if (val && cm.display.wrapper.offsetHeight == 0)
|
20
|
+
startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250})
|
21
|
+
})
|
22
|
+
|
23
|
+
function startListening(cm, state) {
|
24
|
+
function check() {
|
25
|
+
if (cm.display.wrapper.offsetHeight) {
|
26
|
+
stopListening(cm, state)
|
27
|
+
if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight)
|
28
|
+
cm.refresh()
|
29
|
+
} else {
|
30
|
+
state.timeout = setTimeout(check, state.delay)
|
31
|
+
}
|
32
|
+
}
|
33
|
+
state.timeout = setTimeout(check, state.delay)
|
34
|
+
state.hurry = function() {
|
35
|
+
clearTimeout(state.timeout)
|
36
|
+
state.timeout = setTimeout(check, 50)
|
37
|
+
}
|
38
|
+
CodeMirror.on(window, "mouseup", state.hurry)
|
39
|
+
CodeMirror.on(window, "keyup", state.hurry)
|
40
|
+
}
|
41
|
+
|
42
|
+
function stopListening(_cm, state) {
|
43
|
+
clearTimeout(state.timeout)
|
44
|
+
CodeMirror.off(window, "mouseup", state.hurry)
|
45
|
+
CodeMirror.off(window, "keyup", state.hurry)
|
46
|
+
}
|
47
|
+
});
|
@@ -0,0 +1,41 @@
|
|
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
|
+
CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {
|
15
|
+
if (old == CodeMirror.Init) old = false;
|
16
|
+
if (!old == !val) return;
|
17
|
+
if (val) setFullscreen(cm);
|
18
|
+
else setNormal(cm);
|
19
|
+
});
|
20
|
+
|
21
|
+
function setFullscreen(cm) {
|
22
|
+
var wrap = cm.getWrapperElement();
|
23
|
+
cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
|
24
|
+
width: wrap.style.width, height: wrap.style.height};
|
25
|
+
wrap.style.width = "";
|
26
|
+
wrap.style.height = "auto";
|
27
|
+
wrap.className += " CodeMirror-fullscreen";
|
28
|
+
document.documentElement.style.overflow = "hidden";
|
29
|
+
cm.refresh();
|
30
|
+
}
|
31
|
+
|
32
|
+
function setNormal(cm) {
|
33
|
+
var wrap = cm.getWrapperElement();
|
34
|
+
wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
|
35
|
+
document.documentElement.style.overflow = "";
|
36
|
+
var info = cm.state.fullScreenRestore;
|
37
|
+
wrap.style.width = info.width; wrap.style.height = info.height;
|
38
|
+
window.scrollTo(info.scrollLeft, info.scrollTop);
|
39
|
+
cm.refresh();
|
40
|
+
}
|
41
|
+
});
|
@@ -0,0 +1,112 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
CodeMirror.defineExtension("addPanel", function(node, options) {
|
13
|
+
options = options || {};
|
14
|
+
|
15
|
+
if (!this.state.panels) initPanels(this);
|
16
|
+
|
17
|
+
var info = this.state.panels;
|
18
|
+
var wrapper = info.wrapper;
|
19
|
+
var cmWrapper = this.getWrapperElement();
|
20
|
+
|
21
|
+
if (options.after instanceof Panel && !options.after.cleared) {
|
22
|
+
wrapper.insertBefore(node, options.before.node.nextSibling);
|
23
|
+
} else if (options.before instanceof Panel && !options.before.cleared) {
|
24
|
+
wrapper.insertBefore(node, options.before.node);
|
25
|
+
} else if (options.replace instanceof Panel && !options.replace.cleared) {
|
26
|
+
wrapper.insertBefore(node, options.replace.node);
|
27
|
+
options.replace.clear();
|
28
|
+
} else if (options.position == "bottom") {
|
29
|
+
wrapper.appendChild(node);
|
30
|
+
} else if (options.position == "before-bottom") {
|
31
|
+
wrapper.insertBefore(node, cmWrapper.nextSibling);
|
32
|
+
} else if (options.position == "after-top") {
|
33
|
+
wrapper.insertBefore(node, cmWrapper);
|
34
|
+
} else {
|
35
|
+
wrapper.insertBefore(node, wrapper.firstChild);
|
36
|
+
}
|
37
|
+
|
38
|
+
var height = (options && options.height) || node.offsetHeight;
|
39
|
+
this._setSize(null, info.heightLeft -= height);
|
40
|
+
info.panels++;
|
41
|
+
return new Panel(this, node, options, height);
|
42
|
+
});
|
43
|
+
|
44
|
+
function Panel(cm, node, options, height) {
|
45
|
+
this.cm = cm;
|
46
|
+
this.node = node;
|
47
|
+
this.options = options;
|
48
|
+
this.height = height;
|
49
|
+
this.cleared = false;
|
50
|
+
}
|
51
|
+
|
52
|
+
Panel.prototype.clear = function() {
|
53
|
+
if (this.cleared) return;
|
54
|
+
this.cleared = true;
|
55
|
+
var info = this.cm.state.panels;
|
56
|
+
this.cm._setSize(null, info.heightLeft += this.height);
|
57
|
+
info.wrapper.removeChild(this.node);
|
58
|
+
if (--info.panels == 0) removePanels(this.cm);
|
59
|
+
};
|
60
|
+
|
61
|
+
Panel.prototype.changed = function(height) {
|
62
|
+
var newHeight = height == null ? this.node.offsetHeight : height;
|
63
|
+
var info = this.cm.state.panels;
|
64
|
+
this.cm._setSize(null, info.height += (newHeight - this.height));
|
65
|
+
this.height = newHeight;
|
66
|
+
};
|
67
|
+
|
68
|
+
function initPanels(cm) {
|
69
|
+
var wrap = cm.getWrapperElement();
|
70
|
+
var style = window.getComputedStyle ? window.getComputedStyle(wrap) : wrap.currentStyle;
|
71
|
+
var height = parseInt(style.height);
|
72
|
+
var info = cm.state.panels = {
|
73
|
+
setHeight: wrap.style.height,
|
74
|
+
heightLeft: height,
|
75
|
+
panels: 0,
|
76
|
+
wrapper: document.createElement("div")
|
77
|
+
};
|
78
|
+
wrap.parentNode.insertBefore(info.wrapper, wrap);
|
79
|
+
var hasFocus = cm.hasFocus();
|
80
|
+
info.wrapper.appendChild(wrap);
|
81
|
+
if (hasFocus) cm.focus();
|
82
|
+
|
83
|
+
cm._setSize = cm.setSize;
|
84
|
+
if (height != null) cm.setSize = function(width, newHeight) {
|
85
|
+
if (newHeight == null) return this._setSize(width, newHeight);
|
86
|
+
info.setHeight = newHeight;
|
87
|
+
if (typeof newHeight != "number") {
|
88
|
+
var px = /^(\d+\.?\d*)px$/.exec(newHeight);
|
89
|
+
if (px) {
|
90
|
+
newHeight = Number(px[1]);
|
91
|
+
} else {
|
92
|
+
info.wrapper.style.height = newHeight;
|
93
|
+
newHeight = info.wrapper.offsetHeight;
|
94
|
+
info.wrapper.style.height = "";
|
95
|
+
}
|
96
|
+
}
|
97
|
+
cm._setSize(width, info.heightLeft += (newHeight - height));
|
98
|
+
height = newHeight;
|
99
|
+
};
|
100
|
+
}
|
101
|
+
|
102
|
+
function removePanels(cm) {
|
103
|
+
var info = cm.state.panels;
|
104
|
+
cm.state.panels = null;
|
105
|
+
|
106
|
+
var wrap = cm.getWrapperElement();
|
107
|
+
info.wrapper.parentNode.replaceChild(wrap, info.wrapper);
|
108
|
+
wrap.style.height = info.setHeight;
|
109
|
+
cm.setSize = cm._setSize;
|
110
|
+
cm.setSize();
|
111
|
+
}
|
112
|
+
});
|
@@ -0,0 +1,60 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
|
13
|
+
var prev = old && old != CodeMirror.Init;
|
14
|
+
if (val && !prev) {
|
15
|
+
cm.on("blur", onBlur);
|
16
|
+
cm.on("change", onChange);
|
17
|
+
onChange(cm);
|
18
|
+
} else if (!val && prev) {
|
19
|
+
cm.off("blur", onBlur);
|
20
|
+
cm.off("change", onChange);
|
21
|
+
clearPlaceholder(cm);
|
22
|
+
var wrapper = cm.getWrapperElement();
|
23
|
+
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
|
24
|
+
}
|
25
|
+
|
26
|
+
if (val && !cm.hasFocus()) onBlur(cm);
|
27
|
+
});
|
28
|
+
|
29
|
+
function clearPlaceholder(cm) {
|
30
|
+
if (cm.state.placeholder) {
|
31
|
+
cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
|
32
|
+
cm.state.placeholder = null;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
function setPlaceholder(cm) {
|
36
|
+
clearPlaceholder(cm);
|
37
|
+
var elt = cm.state.placeholder = document.createElement("pre");
|
38
|
+
elt.style.cssText = "height: 0; overflow: visible";
|
39
|
+
elt.className = "CodeMirror-placeholder";
|
40
|
+
var placeHolder = cm.getOption("placeholder")
|
41
|
+
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
|
42
|
+
elt.appendChild(placeHolder)
|
43
|
+
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
|
44
|
+
}
|
45
|
+
|
46
|
+
function onBlur(cm) {
|
47
|
+
if (isEmpty(cm)) setPlaceholder(cm);
|
48
|
+
}
|
49
|
+
function onChange(cm) {
|
50
|
+
var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
|
51
|
+
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
|
52
|
+
|
53
|
+
if (empty) setPlaceholder(cm);
|
54
|
+
else clearPlaceholder(cm);
|
55
|
+
}
|
56
|
+
|
57
|
+
function isEmpty(cm) {
|
58
|
+
return (cm.lineCount() === 1) && (cm.getLine(0) === "");
|
59
|
+
}
|
60
|
+
});
|
@@ -0,0 +1,63 @@
|
|
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
|
+
CodeMirror.defineOption("rulers", false, function(cm, val, old) {
|
15
|
+
if (old && old != CodeMirror.Init) {
|
16
|
+
clearRulers(cm);
|
17
|
+
cm.off("refresh", refreshRulers);
|
18
|
+
}
|
19
|
+
if (val && val.length) {
|
20
|
+
setRulers(cm);
|
21
|
+
cm.on("refresh", refreshRulers);
|
22
|
+
}
|
23
|
+
});
|
24
|
+
|
25
|
+
function clearRulers(cm) {
|
26
|
+
for (var i = cm.display.lineSpace.childNodes.length - 1; i >= 0; i--) {
|
27
|
+
var node = cm.display.lineSpace.childNodes[i];
|
28
|
+
if (/(^|\s)CodeMirror-ruler($|\s)/.test(node.className))
|
29
|
+
node.parentNode.removeChild(node);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
function setRulers(cm) {
|
34
|
+
var val = cm.getOption("rulers");
|
35
|
+
var cw = cm.defaultCharWidth();
|
36
|
+
var left = cm.charCoords(CodeMirror.Pos(cm.firstLine(), 0), "div").left;
|
37
|
+
var minH = cm.display.scroller.offsetHeight + 30;
|
38
|
+
for (var i = 0; i < val.length; i++) {
|
39
|
+
var elt = document.createElement("div");
|
40
|
+
elt.className = "CodeMirror-ruler";
|
41
|
+
var col, conf = val[i];
|
42
|
+
if (typeof conf == "number") {
|
43
|
+
col = conf;
|
44
|
+
} else {
|
45
|
+
col = conf.column;
|
46
|
+
if (conf.className) elt.className += " " + conf.className;
|
47
|
+
if (conf.color) elt.style.borderColor = conf.color;
|
48
|
+
if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
|
49
|
+
if (conf.width) elt.style.borderLeftWidth = conf.width;
|
50
|
+
}
|
51
|
+
elt.style.left = (left + col * cw) + "px";
|
52
|
+
elt.style.top = "-50px";
|
53
|
+
elt.style.bottom = "-20px";
|
54
|
+
elt.style.minHeight = minH + "px";
|
55
|
+
cm.display.lineSpace.insertBefore(elt, cm.display.cursorDiv);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
function refreshRulers(cm) {
|
60
|
+
clearRulers(cm);
|
61
|
+
setRulers(cm);
|
62
|
+
}
|
63
|
+
});
|
@@ -0,0 +1,195 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
var defaults = {
|
13
|
+
pairs: "()[]{}''\"\"",
|
14
|
+
triples: "",
|
15
|
+
explode: "[]{}"
|
16
|
+
};
|
17
|
+
|
18
|
+
var Pos = CodeMirror.Pos;
|
19
|
+
|
20
|
+
CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
|
21
|
+
if (old && old != CodeMirror.Init) {
|
22
|
+
cm.removeKeyMap(keyMap);
|
23
|
+
cm.state.closeBrackets = null;
|
24
|
+
}
|
25
|
+
if (val) {
|
26
|
+
cm.state.closeBrackets = val;
|
27
|
+
cm.addKeyMap(keyMap);
|
28
|
+
}
|
29
|
+
});
|
30
|
+
|
31
|
+
function getOption(conf, name) {
|
32
|
+
if (name == "pairs" && typeof conf == "string") return conf;
|
33
|
+
if (typeof conf == "object" && conf[name] != null) return conf[name];
|
34
|
+
return defaults[name];
|
35
|
+
}
|
36
|
+
|
37
|
+
var bind = defaults.pairs + "`";
|
38
|
+
var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
|
39
|
+
for (var i = 0; i < bind.length; i++)
|
40
|
+
keyMap["'" + bind.charAt(i) + "'"] = handler(bind.charAt(i));
|
41
|
+
|
42
|
+
function handler(ch) {
|
43
|
+
return function(cm) { return handleChar(cm, ch); };
|
44
|
+
}
|
45
|
+
|
46
|
+
function getConfig(cm) {
|
47
|
+
var deflt = cm.state.closeBrackets;
|
48
|
+
if (!deflt) return null;
|
49
|
+
var mode = cm.getModeAt(cm.getCursor());
|
50
|
+
return mode.closeBrackets || deflt;
|
51
|
+
}
|
52
|
+
|
53
|
+
function handleBackspace(cm) {
|
54
|
+
var conf = getConfig(cm);
|
55
|
+
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
56
|
+
|
57
|
+
var pairs = getOption(conf, "pairs");
|
58
|
+
var ranges = cm.listSelections();
|
59
|
+
for (var i = 0; i < ranges.length; i++) {
|
60
|
+
if (!ranges[i].empty()) return CodeMirror.Pass;
|
61
|
+
var around = charsAround(cm, ranges[i].head);
|
62
|
+
if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
|
63
|
+
}
|
64
|
+
for (var i = ranges.length - 1; i >= 0; i--) {
|
65
|
+
var cur = ranges[i].head;
|
66
|
+
cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
function handleEnter(cm) {
|
71
|
+
var conf = getConfig(cm);
|
72
|
+
var explode = conf && getOption(conf, "explode");
|
73
|
+
if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass;
|
74
|
+
|
75
|
+
var ranges = cm.listSelections();
|
76
|
+
for (var i = 0; i < ranges.length; i++) {
|
77
|
+
if (!ranges[i].empty()) return CodeMirror.Pass;
|
78
|
+
var around = charsAround(cm, ranges[i].head);
|
79
|
+
if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
|
80
|
+
}
|
81
|
+
cm.operation(function() {
|
82
|
+
cm.replaceSelection("\n\n", null);
|
83
|
+
cm.execCommand("goCharLeft");
|
84
|
+
ranges = cm.listSelections();
|
85
|
+
for (var i = 0; i < ranges.length; i++) {
|
86
|
+
var line = ranges[i].head.line;
|
87
|
+
cm.indentLine(line, null, true);
|
88
|
+
cm.indentLine(line + 1, null, true);
|
89
|
+
}
|
90
|
+
});
|
91
|
+
}
|
92
|
+
|
93
|
+
function contractSelection(sel) {
|
94
|
+
var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
|
95
|
+
return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
|
96
|
+
head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))};
|
97
|
+
}
|
98
|
+
|
99
|
+
function handleChar(cm, ch) {
|
100
|
+
var conf = getConfig(cm);
|
101
|
+
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
102
|
+
|
103
|
+
var pairs = getOption(conf, "pairs");
|
104
|
+
var pos = pairs.indexOf(ch);
|
105
|
+
if (pos == -1) return CodeMirror.Pass;
|
106
|
+
var triples = getOption(conf, "triples");
|
107
|
+
|
108
|
+
var identical = pairs.charAt(pos + 1) == ch;
|
109
|
+
var ranges = cm.listSelections();
|
110
|
+
var opening = pos % 2 == 0;
|
111
|
+
|
112
|
+
var type, next;
|
113
|
+
for (var i = 0; i < ranges.length; i++) {
|
114
|
+
var range = ranges[i], cur = range.head, curType;
|
115
|
+
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
|
116
|
+
if (opening && !range.empty()) {
|
117
|
+
curType = "surround";
|
118
|
+
} else if ((identical || !opening) && next == ch) {
|
119
|
+
if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch)
|
120
|
+
curType = "skipThree";
|
121
|
+
else
|
122
|
+
curType = "skip";
|
123
|
+
} else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 &&
|
124
|
+
cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch &&
|
125
|
+
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) {
|
126
|
+
curType = "addFour";
|
127
|
+
} else if (identical) {
|
128
|
+
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both";
|
129
|
+
else return CodeMirror.Pass;
|
130
|
+
} else if (opening && (cm.getLine(cur.line).length == cur.ch ||
|
131
|
+
isClosingBracket(next, pairs) ||
|
132
|
+
/\s/.test(next))) {
|
133
|
+
curType = "both";
|
134
|
+
} else {
|
135
|
+
return CodeMirror.Pass;
|
136
|
+
}
|
137
|
+
if (!type) type = curType;
|
138
|
+
else if (type != curType) return CodeMirror.Pass;
|
139
|
+
}
|
140
|
+
|
141
|
+
var left = pos % 2 ? pairs.charAt(pos - 1) : ch;
|
142
|
+
var right = pos % 2 ? ch : pairs.charAt(pos + 1);
|
143
|
+
cm.operation(function() {
|
144
|
+
if (type == "skip") {
|
145
|
+
cm.execCommand("goCharRight");
|
146
|
+
} else if (type == "skipThree") {
|
147
|
+
for (var i = 0; i < 3; i++)
|
148
|
+
cm.execCommand("goCharRight");
|
149
|
+
} else if (type == "surround") {
|
150
|
+
var sels = cm.getSelections();
|
151
|
+
for (var i = 0; i < sels.length; i++)
|
152
|
+
sels[i] = left + sels[i] + right;
|
153
|
+
cm.replaceSelections(sels, "around");
|
154
|
+
sels = cm.listSelections().slice();
|
155
|
+
for (var i = 0; i < sels.length; i++)
|
156
|
+
sels[i] = contractSelection(sels[i]);
|
157
|
+
cm.setSelections(sels);
|
158
|
+
} else if (type == "both") {
|
159
|
+
cm.replaceSelection(left + right, null);
|
160
|
+
cm.triggerElectric(left + right);
|
161
|
+
cm.execCommand("goCharLeft");
|
162
|
+
} else if (type == "addFour") {
|
163
|
+
cm.replaceSelection(left + left + left + left, "before");
|
164
|
+
cm.execCommand("goCharRight");
|
165
|
+
}
|
166
|
+
});
|
167
|
+
}
|
168
|
+
|
169
|
+
function isClosingBracket(ch, pairs) {
|
170
|
+
var pos = pairs.lastIndexOf(ch);
|
171
|
+
return pos > -1 && pos % 2 == 1;
|
172
|
+
}
|
173
|
+
|
174
|
+
function charsAround(cm, pos) {
|
175
|
+
var str = cm.getRange(Pos(pos.line, pos.ch - 1),
|
176
|
+
Pos(pos.line, pos.ch + 1));
|
177
|
+
return str.length == 2 ? str : null;
|
178
|
+
}
|
179
|
+
|
180
|
+
// Project the token type that will exists after the given char is
|
181
|
+
// typed, and use it to determine whether it would cause the start
|
182
|
+
// of a string token.
|
183
|
+
function enteringString(cm, pos, ch) {
|
184
|
+
var line = cm.getLine(pos.line);
|
185
|
+
var token = cm.getTokenAt(pos);
|
186
|
+
if (/\bstring2?\b/.test(token.type)) return false;
|
187
|
+
var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
|
188
|
+
stream.pos = stream.start = token.start;
|
189
|
+
for (;;) {
|
190
|
+
var type1 = cm.getMode().token(stream, token.state);
|
191
|
+
if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1);
|
192
|
+
stream.start = stream.pos;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
});
|