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,57 @@
|
|
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.registerGlobalHelper("fold", "comment", function(mode) {
|
15
|
+
return mode.blockCommentStart && mode.blockCommentEnd;
|
16
|
+
}, function(cm, start) {
|
17
|
+
var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd;
|
18
|
+
if (!startToken || !endToken) return;
|
19
|
+
var line = start.line, lineText = cm.getLine(line);
|
20
|
+
|
21
|
+
var startCh;
|
22
|
+
for (var at = start.ch, pass = 0;;) {
|
23
|
+
var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1);
|
24
|
+
if (found == -1) {
|
25
|
+
if (pass == 1) return;
|
26
|
+
pass = 1;
|
27
|
+
at = lineText.length;
|
28
|
+
continue;
|
29
|
+
}
|
30
|
+
if (pass == 1 && found < start.ch) return;
|
31
|
+
if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) {
|
32
|
+
startCh = found + startToken.length;
|
33
|
+
break;
|
34
|
+
}
|
35
|
+
at = found - 1;
|
36
|
+
}
|
37
|
+
|
38
|
+
var depth = 1, lastLine = cm.lastLine(), end, endCh;
|
39
|
+
outer: for (var i = line; i <= lastLine; ++i) {
|
40
|
+
var text = cm.getLine(i), pos = i == line ? startCh : 0;
|
41
|
+
for (;;) {
|
42
|
+
var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
|
43
|
+
if (nextOpen < 0) nextOpen = text.length;
|
44
|
+
if (nextClose < 0) nextClose = text.length;
|
45
|
+
pos = Math.min(nextOpen, nextClose);
|
46
|
+
if (pos == text.length) break;
|
47
|
+
if (pos == nextOpen) ++depth;
|
48
|
+
else if (!--depth) { end = i; endCh = pos; break outer; }
|
49
|
+
++pos;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
if (end == null || line == end && endCh == startCh) return;
|
53
|
+
return {from: CodeMirror.Pos(line, startCh),
|
54
|
+
to: CodeMirror.Pos(end, endCh)};
|
55
|
+
});
|
56
|
+
|
57
|
+
});
|
@@ -0,0 +1,149 @@
|
|
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 doFold(cm, pos, options, force) {
|
15
|
+
if (options && options.call) {
|
16
|
+
var finder = options;
|
17
|
+
options = null;
|
18
|
+
} else {
|
19
|
+
var finder = getOption(cm, options, "rangeFinder");
|
20
|
+
}
|
21
|
+
if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
|
22
|
+
var minSize = getOption(cm, options, "minFoldSize");
|
23
|
+
|
24
|
+
function getRange(allowFolded) {
|
25
|
+
var range = finder(cm, pos);
|
26
|
+
if (!range || range.to.line - range.from.line < minSize) return null;
|
27
|
+
var marks = cm.findMarksAt(range.from);
|
28
|
+
for (var i = 0; i < marks.length; ++i) {
|
29
|
+
if (marks[i].__isFold && force !== "fold") {
|
30
|
+
if (!allowFolded) return null;
|
31
|
+
range.cleared = true;
|
32
|
+
marks[i].clear();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
return range;
|
36
|
+
}
|
37
|
+
|
38
|
+
var range = getRange(true);
|
39
|
+
if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) {
|
40
|
+
pos = CodeMirror.Pos(pos.line - 1, 0);
|
41
|
+
range = getRange(false);
|
42
|
+
}
|
43
|
+
if (!range || range.cleared || force === "unfold") return;
|
44
|
+
|
45
|
+
var myWidget = makeWidget(cm, options);
|
46
|
+
CodeMirror.on(myWidget, "mousedown", function(e) {
|
47
|
+
myRange.clear();
|
48
|
+
CodeMirror.e_preventDefault(e);
|
49
|
+
});
|
50
|
+
var myRange = cm.markText(range.from, range.to, {
|
51
|
+
replacedWith: myWidget,
|
52
|
+
clearOnEnter: true,
|
53
|
+
__isFold: true
|
54
|
+
});
|
55
|
+
myRange.on("clear", function(from, to) {
|
56
|
+
CodeMirror.signal(cm, "unfold", cm, from, to);
|
57
|
+
});
|
58
|
+
CodeMirror.signal(cm, "fold", cm, range.from, range.to);
|
59
|
+
}
|
60
|
+
|
61
|
+
function makeWidget(cm, options) {
|
62
|
+
var widget = getOption(cm, options, "widget");
|
63
|
+
if (typeof widget == "string") {
|
64
|
+
var text = document.createTextNode(widget);
|
65
|
+
widget = document.createElement("span");
|
66
|
+
widget.appendChild(text);
|
67
|
+
widget.className = "CodeMirror-foldmarker";
|
68
|
+
}
|
69
|
+
return widget;
|
70
|
+
}
|
71
|
+
|
72
|
+
// Clumsy backwards-compatible interface
|
73
|
+
CodeMirror.newFoldFunction = function(rangeFinder, widget) {
|
74
|
+
return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); };
|
75
|
+
};
|
76
|
+
|
77
|
+
// New-style interface
|
78
|
+
CodeMirror.defineExtension("foldCode", function(pos, options, force) {
|
79
|
+
doFold(this, pos, options, force);
|
80
|
+
});
|
81
|
+
|
82
|
+
CodeMirror.defineExtension("isFolded", function(pos) {
|
83
|
+
var marks = this.findMarksAt(pos);
|
84
|
+
for (var i = 0; i < marks.length; ++i)
|
85
|
+
if (marks[i].__isFold) return true;
|
86
|
+
});
|
87
|
+
|
88
|
+
CodeMirror.commands.toggleFold = function(cm) {
|
89
|
+
cm.foldCode(cm.getCursor());
|
90
|
+
};
|
91
|
+
CodeMirror.commands.fold = function(cm) {
|
92
|
+
cm.foldCode(cm.getCursor(), null, "fold");
|
93
|
+
};
|
94
|
+
CodeMirror.commands.unfold = function(cm) {
|
95
|
+
cm.foldCode(cm.getCursor(), null, "unfold");
|
96
|
+
};
|
97
|
+
CodeMirror.commands.foldAll = function(cm) {
|
98
|
+
cm.operation(function() {
|
99
|
+
for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
|
100
|
+
cm.foldCode(CodeMirror.Pos(i, 0), null, "fold");
|
101
|
+
});
|
102
|
+
};
|
103
|
+
CodeMirror.commands.unfoldAll = function(cm) {
|
104
|
+
cm.operation(function() {
|
105
|
+
for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
|
106
|
+
cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold");
|
107
|
+
});
|
108
|
+
};
|
109
|
+
|
110
|
+
CodeMirror.registerHelper("fold", "combine", function() {
|
111
|
+
var funcs = Array.prototype.slice.call(arguments, 0);
|
112
|
+
return function(cm, start) {
|
113
|
+
for (var i = 0; i < funcs.length; ++i) {
|
114
|
+
var found = funcs[i](cm, start);
|
115
|
+
if (found) return found;
|
116
|
+
}
|
117
|
+
};
|
118
|
+
});
|
119
|
+
|
120
|
+
CodeMirror.registerHelper("fold", "auto", function(cm, start) {
|
121
|
+
var helpers = cm.getHelpers(start, "fold");
|
122
|
+
for (var i = 0; i < helpers.length; i++) {
|
123
|
+
var cur = helpers[i](cm, start);
|
124
|
+
if (cur) return cur;
|
125
|
+
}
|
126
|
+
});
|
127
|
+
|
128
|
+
var defaultOptions = {
|
129
|
+
rangeFinder: CodeMirror.fold.auto,
|
130
|
+
widget: "\u2194",
|
131
|
+
minFoldSize: 0,
|
132
|
+
scanUp: false
|
133
|
+
};
|
134
|
+
|
135
|
+
CodeMirror.defineOption("foldOptions", null);
|
136
|
+
|
137
|
+
function getOption(cm, options, name) {
|
138
|
+
if (options && options[name] !== undefined)
|
139
|
+
return options[name];
|
140
|
+
var editorOptions = cm.options.foldOptions;
|
141
|
+
if (editorOptions && editorOptions[name] !== undefined)
|
142
|
+
return editorOptions[name];
|
143
|
+
return defaultOptions[name];
|
144
|
+
}
|
145
|
+
|
146
|
+
CodeMirror.defineExtension("foldOption", function(options, name) {
|
147
|
+
return getOption(this, options, name);
|
148
|
+
});
|
149
|
+
});
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.CodeMirror-foldmarker {
|
2
|
+
color: blue;
|
3
|
+
text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
|
4
|
+
font-family: arial;
|
5
|
+
line-height: .3;
|
6
|
+
cursor: pointer;
|
7
|
+
}
|
8
|
+
.CodeMirror-foldgutter {
|
9
|
+
width: .7em;
|
10
|
+
}
|
11
|
+
.CodeMirror-foldgutter-open,
|
12
|
+
.CodeMirror-foldgutter-folded {
|
13
|
+
cursor: pointer;
|
14
|
+
}
|
15
|
+
.CodeMirror-foldgutter-open:after {
|
16
|
+
content: "\25BE";
|
17
|
+
}
|
18
|
+
.CodeMirror-foldgutter-folded:after {
|
19
|
+
content: "\25B8";
|
20
|
+
}
|
@@ -0,0 +1,146 @@
|
|
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"), require("./foldcode"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "./foldcode"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineOption("foldGutter", false, function(cm, val, old) {
|
15
|
+
if (old && old != CodeMirror.Init) {
|
16
|
+
cm.clearGutter(cm.state.foldGutter.options.gutter);
|
17
|
+
cm.state.foldGutter = null;
|
18
|
+
cm.off("gutterClick", onGutterClick);
|
19
|
+
cm.off("change", onChange);
|
20
|
+
cm.off("viewportChange", onViewportChange);
|
21
|
+
cm.off("fold", onFold);
|
22
|
+
cm.off("unfold", onFold);
|
23
|
+
cm.off("swapDoc", updateInViewport);
|
24
|
+
}
|
25
|
+
if (val) {
|
26
|
+
cm.state.foldGutter = new State(parseOptions(val));
|
27
|
+
updateInViewport(cm);
|
28
|
+
cm.on("gutterClick", onGutterClick);
|
29
|
+
cm.on("change", onChange);
|
30
|
+
cm.on("viewportChange", onViewportChange);
|
31
|
+
cm.on("fold", onFold);
|
32
|
+
cm.on("unfold", onFold);
|
33
|
+
cm.on("swapDoc", updateInViewport);
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
var Pos = CodeMirror.Pos;
|
38
|
+
|
39
|
+
function State(options) {
|
40
|
+
this.options = options;
|
41
|
+
this.from = this.to = 0;
|
42
|
+
}
|
43
|
+
|
44
|
+
function parseOptions(opts) {
|
45
|
+
if (opts === true) opts = {};
|
46
|
+
if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter";
|
47
|
+
if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open";
|
48
|
+
if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded";
|
49
|
+
return opts;
|
50
|
+
}
|
51
|
+
|
52
|
+
function isFolded(cm, line) {
|
53
|
+
var marks = cm.findMarksAt(Pos(line));
|
54
|
+
for (var i = 0; i < marks.length; ++i)
|
55
|
+
if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i];
|
56
|
+
}
|
57
|
+
|
58
|
+
function marker(spec) {
|
59
|
+
if (typeof spec == "string") {
|
60
|
+
var elt = document.createElement("div");
|
61
|
+
elt.className = spec + " CodeMirror-guttermarker-subtle";
|
62
|
+
return elt;
|
63
|
+
} else {
|
64
|
+
return spec.cloneNode(true);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
function updateFoldInfo(cm, from, to) {
|
69
|
+
var opts = cm.state.foldGutter.options, cur = from;
|
70
|
+
var minSize = cm.foldOption(opts, "minFoldSize");
|
71
|
+
var func = cm.foldOption(opts, "rangeFinder");
|
72
|
+
cm.eachLine(from, to, function(line) {
|
73
|
+
var mark = null;
|
74
|
+
if (isFolded(cm, cur)) {
|
75
|
+
mark = marker(opts.indicatorFolded);
|
76
|
+
} else {
|
77
|
+
var pos = Pos(cur, 0);
|
78
|
+
var range = func && func(cm, pos);
|
79
|
+
if (range && range.to.line - range.from.line >= minSize)
|
80
|
+
mark = marker(opts.indicatorOpen);
|
81
|
+
}
|
82
|
+
cm.setGutterMarker(line, opts.gutter, mark);
|
83
|
+
++cur;
|
84
|
+
});
|
85
|
+
}
|
86
|
+
|
87
|
+
function updateInViewport(cm) {
|
88
|
+
var vp = cm.getViewport(), state = cm.state.foldGutter;
|
89
|
+
if (!state) return;
|
90
|
+
cm.operation(function() {
|
91
|
+
updateFoldInfo(cm, vp.from, vp.to);
|
92
|
+
});
|
93
|
+
state.from = vp.from; state.to = vp.to;
|
94
|
+
}
|
95
|
+
|
96
|
+
function onGutterClick(cm, line, gutter) {
|
97
|
+
var state = cm.state.foldGutter;
|
98
|
+
if (!state) return;
|
99
|
+
var opts = state.options;
|
100
|
+
if (gutter != opts.gutter) return;
|
101
|
+
var folded = isFolded(cm, line);
|
102
|
+
if (folded) folded.clear();
|
103
|
+
else cm.foldCode(Pos(line, 0), opts.rangeFinder);
|
104
|
+
}
|
105
|
+
|
106
|
+
function onChange(cm) {
|
107
|
+
var state = cm.state.foldGutter;
|
108
|
+
if (!state) return;
|
109
|
+
var opts = state.options;
|
110
|
+
state.from = state.to = 0;
|
111
|
+
clearTimeout(state.changeUpdate);
|
112
|
+
state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);
|
113
|
+
}
|
114
|
+
|
115
|
+
function onViewportChange(cm) {
|
116
|
+
var state = cm.state.foldGutter;
|
117
|
+
if (!state) return;
|
118
|
+
var opts = state.options;
|
119
|
+
clearTimeout(state.changeUpdate);
|
120
|
+
state.changeUpdate = setTimeout(function() {
|
121
|
+
var vp = cm.getViewport();
|
122
|
+
if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
|
123
|
+
updateInViewport(cm);
|
124
|
+
} else {
|
125
|
+
cm.operation(function() {
|
126
|
+
if (vp.from < state.from) {
|
127
|
+
updateFoldInfo(cm, vp.from, state.from);
|
128
|
+
state.from = vp.from;
|
129
|
+
}
|
130
|
+
if (vp.to > state.to) {
|
131
|
+
updateFoldInfo(cm, state.to, vp.to);
|
132
|
+
state.to = vp.to;
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
}, opts.updateViewportTimeSpan || 400);
|
137
|
+
}
|
138
|
+
|
139
|
+
function onFold(cm, from) {
|
140
|
+
var state = cm.state.foldGutter;
|
141
|
+
if (!state) return;
|
142
|
+
var line = from.line;
|
143
|
+
if (line >= state.from && line < state.to)
|
144
|
+
updateFoldInfo(cm, line, line + 1);
|
145
|
+
}
|
146
|
+
});
|
@@ -0,0 +1,44 @@
|
|
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.registerHelper("fold", "indent", function(cm, start) {
|
15
|
+
var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line);
|
16
|
+
if (!/\S/.test(firstLine)) return;
|
17
|
+
var getIndent = function(line) {
|
18
|
+
return CodeMirror.countColumn(line, null, tabSize);
|
19
|
+
};
|
20
|
+
var myIndent = getIndent(firstLine);
|
21
|
+
var lastLineInFold = null;
|
22
|
+
// Go through lines until we find a line that definitely doesn't belong in
|
23
|
+
// the block we're folding, or to the end.
|
24
|
+
for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) {
|
25
|
+
var curLine = cm.getLine(i);
|
26
|
+
var curIndent = getIndent(curLine);
|
27
|
+
if (curIndent > myIndent) {
|
28
|
+
// Lines with a greater indent are considered part of the block.
|
29
|
+
lastLineInFold = i;
|
30
|
+
} else if (!/\S/.test(curLine)) {
|
31
|
+
// Empty lines might be breaks within the block we're trying to fold.
|
32
|
+
} else {
|
33
|
+
// A non-empty line at an indent equal to or less than ours marks the
|
34
|
+
// start of another block.
|
35
|
+
break;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
if (lastLineInFold) return {
|
39
|
+
from: CodeMirror.Pos(start.line, firstLine.length),
|
40
|
+
to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length)
|
41
|
+
};
|
42
|
+
});
|
43
|
+
|
44
|
+
});
|
@@ -0,0 +1,49 @@
|
|
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.registerHelper("fold", "markdown", function(cm, start) {
|
15
|
+
var maxDepth = 100;
|
16
|
+
|
17
|
+
function isHeader(lineNo) {
|
18
|
+
var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0));
|
19
|
+
return tokentype && /\bheader\b/.test(tokentype);
|
20
|
+
}
|
21
|
+
|
22
|
+
function headerLevel(lineNo, line, nextLine) {
|
23
|
+
var match = line && line.match(/^#+/);
|
24
|
+
if (match && isHeader(lineNo)) return match[0].length;
|
25
|
+
match = nextLine && nextLine.match(/^[=\-]+\s*$/);
|
26
|
+
if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2;
|
27
|
+
return maxDepth;
|
28
|
+
}
|
29
|
+
|
30
|
+
var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1);
|
31
|
+
var level = headerLevel(start.line, firstLine, nextLine);
|
32
|
+
if (level === maxDepth) return undefined;
|
33
|
+
|
34
|
+
var lastLineNo = cm.lastLine();
|
35
|
+
var end = start.line, nextNextLine = cm.getLine(end + 2);
|
36
|
+
while (end < lastLineNo) {
|
37
|
+
if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break;
|
38
|
+
++end;
|
39
|
+
nextLine = nextNextLine;
|
40
|
+
nextNextLine = cm.getLine(end + 2);
|
41
|
+
}
|
42
|
+
|
43
|
+
return {
|
44
|
+
from: CodeMirror.Pos(start.line, firstLine.length),
|
45
|
+
to: CodeMirror.Pos(end, cm.getLine(end).length)
|
46
|
+
};
|
47
|
+
});
|
48
|
+
|
49
|
+
});
|