statixite 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +145 -0
- data/Rakefile +26 -0
- data/app/assets/images/statixite/STATIXITE-logo.png +0 -0
- data/app/assets/images/statixite/favicon.ico +0 -0
- data/app/assets/images/statixite/jekyll.png +0 -0
- data/app/assets/images/statixite/md-editor.png +0 -0
- data/app/assets/images/statixite/ring-alt.gif +0 -0
- data/app/assets/javascripts/controllers/statixite/deployments_create.js +13 -0
- data/app/assets/javascripts/controllers/statixite/deployments_index.js +13 -0
- data/app/assets/javascripts/controllers/statixite/sites_create.js +27 -0
- data/app/assets/javascripts/controllers/statixite/sites_new.js +27 -0
- data/app/assets/javascripts/controllers/statixite/templates_edit.js +208 -0
- data/app/assets/javascripts/statixite/application.js +8 -0
- data/app/assets/javascripts/statixite/array-helpers.js +13 -0
- data/app/assets/javascripts/statixite/editor.js +244 -0
- data/app/assets/javascripts/statixite/loader.js +14 -0
- data/app/assets/javascripts/statixite/notify-defaults.js +5 -0
- data/app/assets/stylesheets/statixite/application.less +271 -0
- data/app/assets/stylesheets/statixite/bootstrap-glyphicons.less +305 -0
- data/app/assets/stylesheets/statixite/bootstrap.less +58 -0
- data/app/assets/stylesheets/statixite/bootstrap_and_overrides.less +2 -0
- data/app/assets/stylesheets/statixite/landing-page.less +156 -0
- data/app/controllers/statixite/application_controller.rb +22 -0
- data/app/controllers/statixite/deployments_controller.rb +61 -0
- data/app/controllers/statixite/media_controller.rb +61 -0
- data/app/controllers/statixite/posts_controller.rb +68 -0
- data/app/controllers/statixite/sites_controller.rb +141 -0
- data/app/controllers/statixite/templates_controller.rb +233 -0
- data/app/helpers/statixite/application_helper.rb +63 -0
- data/app/models/statixite/deployment.rb +5 -0
- data/app/models/statixite/media.rb +7 -0
- data/app/models/statixite/post.rb +76 -0
- data/app/models/statixite/site.rb +76 -0
- data/app/services/statixite/deployment_service.rb +73 -0
- data/app/services/statixite/git_service.rb +102 -0
- data/app/services/statixite/site_deactivation_service.rb +52 -0
- data/app/services/statixite/site_operation_service.rb +251 -0
- data/app/uploaders/statixite/file_uploader.rb +14 -0
- data/app/validators/statixite/jekyll_template_validator.rb +16 -0
- data/app/validators/statixite/liquid_validator.rb +11 -0
- data/app/views/layouts/statixite/_dash_nav.html.haml +20 -0
- data/app/views/layouts/statixite/_flash.html.haml +13 -0
- data/app/views/layouts/statixite/_head.html.haml +12 -0
- data/app/views/layouts/statixite/_header.html.haml +30 -0
- data/app/views/layouts/statixite/_site_sub_items.html.haml +38 -0
- data/app/views/layouts/statixite/dashboard.html.haml +27 -0
- data/app/views/statixite/deployments/_modal.html.haml +18 -0
- data/app/views/statixite/deployments/index.html.haml +39 -0
- data/app/views/statixite/kaminari/_first_page.html.haml +2 -0
- data/app/views/statixite/kaminari/_gap.html.haml +2 -0
- data/app/views/statixite/kaminari/_last_page.html.haml +2 -0
- data/app/views/statixite/kaminari/_next_page.html.haml +2 -0
- data/app/views/statixite/kaminari/_page.html.haml +6 -0
- data/app/views/statixite/kaminari/_paginator.html.haml +11 -0
- data/app/views/statixite/kaminari/_prev_page.html.haml +2 -0
- data/app/views/statixite/media/_index.html.haml +13 -0
- data/app/views/statixite/media/_paginate.html.haml +1 -0
- data/app/views/statixite/media/index.html.haml +39 -0
- data/app/views/statixite/media/index.js.haml +2 -0
- data/app/views/statixite/posts/_form.html.haml +65 -0
- data/app/views/statixite/posts/_image_modal.html.haml +21 -0
- data/app/views/statixite/posts/_modals.html.haml +111 -0
- data/app/views/statixite/posts/_posts.html.haml +15 -0
- data/app/views/statixite/posts/edit.html.haml +6 -0
- data/app/views/statixite/posts/index.html.haml +4 -0
- data/app/views/statixite/posts/index.js.haml +1 -0
- data/app/views/statixite/posts/new.html.haml +5 -0
- data/app/views/statixite/sites/_sites.html.haml +27 -0
- data/app/views/statixite/sites/_templates.html.haml +26 -0
- data/app/views/statixite/sites/build_and_preview.html.haml +24 -0
- data/app/views/statixite/sites/index.html.haml +4 -0
- data/app/views/statixite/sites/index.js.haml +1 -0
- data/app/views/statixite/sites/new.html.haml +45 -0
- data/app/views/statixite/sites/settings.html.haml +77 -0
- data/app/views/statixite/templates/edit.html.haml +93 -0
- data/app/views/statixite/templates/upload_files.js.haml +2 -0
- data/config/routes.rb +24 -0
- data/db/migrate/20150525171543_create_statixite_sites.rb +15 -0
- data/db/migrate/20150530041055_create_statixite_posts.rb +14 -0
- data/db/migrate/20150610024047_create_statixite_deployments.rb +11 -0
- data/db/migrate/20151013131224_create_statixite_media.rb +10 -0
- data/lib/assets/templates.yaml +734 -0
- data/lib/generators/statixite/statixite_generator.rb +49 -0
- data/lib/statixite.rb +14 -0
- data/lib/statixite/cloud_sync.rb +104 -0
- data/lib/statixite/engine.rb +49 -0
- data/lib/statixite/version.rb +3 -0
- data/lib/tasks/statixite_tasks.rake +4 -0
- data/vendor/assets/bower_components/bootstrap/CHANGELOG.md +5 -0
- data/vendor/assets/bower_components/bootstrap/Gruntfile.js +533 -0
- data/vendor/assets/bower_components/bootstrap/LICENSE +21 -0
- data/vendor/assets/bower_components/bootstrap/README.md +139 -0
- data/vendor/assets/bower_components/bootstrap/bower.json +34 -0
- data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.css +587 -0
- data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.css.map +1 -0
- data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.min.css +6 -0
- data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.min.css.map +1 -0
- data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.css +6760 -0
- data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.css.map +1 -0
- data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.min.css +6 -0
- data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.min.css.map +1 -0
- data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +288 -0
- data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/vendor/assets/bower_components/bootstrap/dist/js/bootstrap.js +2363 -0
- data/vendor/assets/bower_components/bootstrap/dist/js/bootstrap.min.js +7 -0
- data/vendor/assets/bower_components/bootstrap/dist/js/npm.js +13 -0
- data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
- data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/vendor/assets/bower_components/bootstrap/grunt/bs-commonjs-generator.js +30 -0
- data/vendor/assets/bower_components/bootstrap/grunt/bs-glyphicons-data-generator.js +42 -0
- data/vendor/assets/bower_components/bootstrap/grunt/bs-lessdoc-parser.js +237 -0
- data/vendor/assets/bower_components/bootstrap/grunt/bs-raw-files-generator.js +44 -0
- data/vendor/assets/bower_components/bootstrap/grunt/configBridge.json +46 -0
- data/vendor/assets/bower_components/bootstrap/grunt/sauce_browsers.yml +82 -0
- data/vendor/assets/bower_components/bootstrap/js/affix.js +162 -0
- data/vendor/assets/bower_components/bootstrap/js/alert.js +94 -0
- data/vendor/assets/bower_components/bootstrap/js/button.js +120 -0
- data/vendor/assets/bower_components/bootstrap/js/carousel.js +237 -0
- data/vendor/assets/bower_components/bootstrap/js/collapse.js +211 -0
- data/vendor/assets/bower_components/bootstrap/js/dropdown.js +165 -0
- data/vendor/assets/bower_components/bootstrap/js/modal.js +337 -0
- data/vendor/assets/bower_components/bootstrap/js/popover.js +108 -0
- data/vendor/assets/bower_components/bootstrap/js/scrollspy.js +172 -0
- data/vendor/assets/bower_components/bootstrap/js/tab.js +155 -0
- data/vendor/assets/bower_components/bootstrap/js/tooltip.js +514 -0
- data/vendor/assets/bower_components/bootstrap/js/transition.js +59 -0
- data/vendor/assets/bower_components/bootstrap/less/alerts.less +73 -0
- data/vendor/assets/bower_components/bootstrap/less/badges.less +66 -0
- data/vendor/assets/bower_components/bootstrap/less/bootstrap.less +56 -0
- data/vendor/assets/bower_components/bootstrap/less/breadcrumbs.less +26 -0
- data/vendor/assets/bower_components/bootstrap/less/button-groups.less +244 -0
- data/vendor/assets/bower_components/bootstrap/less/buttons.less +166 -0
- data/vendor/assets/bower_components/bootstrap/less/carousel.less +270 -0
- data/vendor/assets/bower_components/bootstrap/less/close.less +34 -0
- data/vendor/assets/bower_components/bootstrap/less/code.less +69 -0
- data/vendor/assets/bower_components/bootstrap/less/component-animations.less +33 -0
- data/vendor/assets/bower_components/bootstrap/less/dropdowns.less +216 -0
- data/vendor/assets/bower_components/bootstrap/less/forms.less +613 -0
- data/vendor/assets/bower_components/bootstrap/less/glyphicons.less +305 -0
- data/vendor/assets/bower_components/bootstrap/less/grid.less +84 -0
- data/vendor/assets/bower_components/bootstrap/less/input-groups.less +171 -0
- data/vendor/assets/bower_components/bootstrap/less/jumbotron.less +54 -0
- data/vendor/assets/bower_components/bootstrap/less/labels.less +64 -0
- data/vendor/assets/bower_components/bootstrap/less/list-group.less +130 -0
- data/vendor/assets/bower_components/bootstrap/less/media.less +66 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins.less +40 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/alerts.less +14 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/background-variant.less +9 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/border-radius.less +18 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/buttons.less +65 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/center-block.less +7 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/clearfix.less +22 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/forms.less +85 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/gradients.less +59 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/grid-framework.less +91 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/grid.less +122 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/hide-text.less +21 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/image.less +33 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/labels.less +12 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/list-group.less +30 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/nav-divider.less +10 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/nav-vertical-align.less +9 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/opacity.less +8 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/pagination.less +24 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/panels.less +24 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/progress-bar.less +10 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/reset-filter.less +8 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/reset-text.less +18 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/resize.less +6 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/responsive-visibility.less +15 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/size.less +10 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/tab-focus.less +9 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/table-row.less +28 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/text-emphasis.less +9 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/text-overflow.less +8 -0
- data/vendor/assets/bower_components/bootstrap/less/mixins/vendor-prefixes.less +227 -0
- data/vendor/assets/bower_components/bootstrap/less/modals.less +150 -0
- data/vendor/assets/bower_components/bootstrap/less/navbar.less +660 -0
- data/vendor/assets/bower_components/bootstrap/less/navs.less +242 -0
- data/vendor/assets/bower_components/bootstrap/less/normalize.less +424 -0
- data/vendor/assets/bower_components/bootstrap/less/pager.less +54 -0
- data/vendor/assets/bower_components/bootstrap/less/pagination.less +89 -0
- data/vendor/assets/bower_components/bootstrap/less/panels.less +271 -0
- data/vendor/assets/bower_components/bootstrap/less/popovers.less +131 -0
- data/vendor/assets/bower_components/bootstrap/less/print.less +101 -0
- data/vendor/assets/bower_components/bootstrap/less/progress-bars.less +87 -0
- data/vendor/assets/bower_components/bootstrap/less/responsive-embed.less +35 -0
- data/vendor/assets/bower_components/bootstrap/less/responsive-utilities.less +194 -0
- data/vendor/assets/bower_components/bootstrap/less/scaffolding.less +161 -0
- data/vendor/assets/bower_components/bootstrap/less/tables.less +234 -0
- data/vendor/assets/bower_components/bootstrap/less/theme.less +291 -0
- data/vendor/assets/bower_components/bootstrap/less/thumbnails.less +36 -0
- data/vendor/assets/bower_components/bootstrap/less/tooltip.less +101 -0
- data/vendor/assets/bower_components/bootstrap/less/type.less +302 -0
- data/vendor/assets/bower_components/bootstrap/less/utilities.less +55 -0
- data/vendor/assets/bower_components/bootstrap/less/variables.less +869 -0
- data/vendor/assets/bower_components/bootstrap/less/wells.less +29 -0
- data/vendor/assets/bower_components/bootstrap/nuget/MyGet.ps1 +8 -0
- data/vendor/assets/bower_components/bootstrap/nuget/bootstrap.less.nuspec +28 -0
- data/vendor/assets/bower_components/bootstrap/nuget/bootstrap.nuspec +28 -0
- data/vendor/assets/bower_components/bootstrap/package.js +32 -0
- data/vendor/assets/bower_components/bootstrap/package.json +87 -0
- data/vendor/assets/bower_components/jquery/AUTHORS.txt +275 -0
- data/vendor/assets/bower_components/jquery/LICENSE.txt +36 -0
- data/vendor/assets/bower_components/jquery/README.md +5 -0
- data/vendor/assets/bower_components/jquery/bower.json +14 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.js +9831 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.min.js +4 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.min.map +1 -0
- data/vendor/assets/bower_components/jquery/src/ajax.js +845 -0
- data/vendor/assets/bower_components/jquery/src/ajax/jsonp.js +100 -0
- data/vendor/assets/bower_components/jquery/src/ajax/load.js +83 -0
- data/vendor/assets/bower_components/jquery/src/ajax/parseJSON.js +13 -0
- data/vendor/assets/bower_components/jquery/src/ajax/parseXML.js +27 -0
- data/vendor/assets/bower_components/jquery/src/ajax/script.js +68 -0
- data/vendor/assets/bower_components/jquery/src/ajax/var/location.js +3 -0
- data/vendor/assets/bower_components/jquery/src/ajax/var/nonce.js +5 -0
- data/vendor/assets/bower_components/jquery/src/ajax/var/rquery.js +3 -0
- data/vendor/assets/bower_components/jquery/src/ajax/xhr.js +167 -0
- data/vendor/assets/bower_components/jquery/src/attributes.js +11 -0
- data/vendor/assets/bower_components/jquery/src/attributes/attr.js +142 -0
- data/vendor/assets/bower_components/jquery/src/attributes/classes.js +177 -0
- data/vendor/assets/bower_components/jquery/src/attributes/prop.js +109 -0
- data/vendor/assets/bower_components/jquery/src/attributes/support.js +36 -0
- data/vendor/assets/bower_components/jquery/src/attributes/val.js +170 -0
- data/vendor/assets/bower_components/jquery/src/callbacks.js +232 -0
- data/vendor/assets/bower_components/jquery/src/core.js +489 -0
- data/vendor/assets/bower_components/jquery/src/core/access.js +65 -0
- data/vendor/assets/bower_components/jquery/src/core/init.js +134 -0
- data/vendor/assets/bower_components/jquery/src/core/parseHTML.js +49 -0
- data/vendor/assets/bower_components/jquery/src/core/ready.js +103 -0
- data/vendor/assets/bower_components/jquery/src/core/support.js +18 -0
- data/vendor/assets/bower_components/jquery/src/core/var/rsingleTag.js +5 -0
- data/vendor/assets/bower_components/jquery/src/css.js +515 -0
- data/vendor/assets/bower_components/jquery/src/css/addGetHookIf.js +24 -0
- data/vendor/assets/bower_components/jquery/src/css/adjustCSS.js +65 -0
- data/vendor/assets/bower_components/jquery/src/css/curCSS.js +57 -0
- data/vendor/assets/bower_components/jquery/src/css/defaultDisplay.js +72 -0
- data/vendor/assets/bower_components/jquery/src/css/hiddenVisibleSelectors.js +18 -0
- data/vendor/assets/bower_components/jquery/src/css/showHide.js +48 -0
- data/vendor/assets/bower_components/jquery/src/css/support.js +121 -0
- data/vendor/assets/bower_components/jquery/src/css/var/cssExpand.js +3 -0
- data/vendor/assets/bower_components/jquery/src/css/var/getStyles.js +15 -0
- data/vendor/assets/bower_components/jquery/src/css/var/isHidden.js +16 -0
- data/vendor/assets/bower_components/jquery/src/css/var/rmargin.js +3 -0
- data/vendor/assets/bower_components/jquery/src/css/var/rnumnonpx.js +5 -0
- data/vendor/assets/bower_components/jquery/src/css/var/swap.js +24 -0
- data/vendor/assets/bower_components/jquery/src/data.js +187 -0
- data/vendor/assets/bower_components/jquery/src/data/Data.js +200 -0
- data/vendor/assets/bower_components/jquery/src/data/accepts.js +20 -0
- data/vendor/assets/bower_components/jquery/src/data/support.js +23 -0
- data/vendor/assets/bower_components/jquery/src/data/var/acceptData.js +18 -0
- data/vendor/assets/bower_components/jquery/src/data/var/dataPriv.js +5 -0
- data/vendor/assets/bower_components/jquery/src/data/var/dataUser.js +5 -0
- data/vendor/assets/bower_components/jquery/src/deferred.js +158 -0
- data/vendor/assets/bower_components/jquery/src/deprecated.js +32 -0
- data/vendor/assets/bower_components/jquery/src/dimensions.js +54 -0
- data/vendor/assets/bower_components/jquery/src/effects.js +629 -0
- data/vendor/assets/bower_components/jquery/src/effects/Tween.js +121 -0
- data/vendor/assets/bower_components/jquery/src/effects/animatedSelector.js +13 -0
- data/vendor/assets/bower_components/jquery/src/effects/support.js +58 -0
- data/vendor/assets/bower_components/jquery/src/event.js +710 -0
- data/vendor/assets/bower_components/jquery/src/event/ajax.js +20 -0
- data/vendor/assets/bower_components/jquery/src/event/alias.js +27 -0
- data/vendor/assets/bower_components/jquery/src/event/focusin.js +53 -0
- data/vendor/assets/bower_components/jquery/src/event/support.js +9 -0
- data/vendor/assets/bower_components/jquery/src/event/trigger.js +199 -0
- data/vendor/assets/bower_components/jquery/src/exports/amd.js +24 -0
- data/vendor/assets/bower_components/jquery/src/exports/global.js +26 -0
- data/vendor/assets/bower_components/jquery/src/intro.js +44 -0
- data/vendor/assets/bower_components/jquery/src/jquery.js +37 -0
- data/vendor/assets/bower_components/jquery/src/manipulation.js +481 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/_evalUrl.js +20 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/buildFragment.js +102 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/createSafeFragment.js +20 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/getAll.js +21 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/setGlobalEval.js +20 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/support.js +33 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/nodeNames.js +5 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/rleadingWhitespace.js +3 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/rscriptType.js +3 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/rtagName.js +3 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/wrapMap.js +27 -0
- data/vendor/assets/bower_components/jquery/src/offset.js +221 -0
- data/vendor/assets/bower_components/jquery/src/outro.js +2 -0
- data/vendor/assets/bower_components/jquery/src/queue.js +143 -0
- data/vendor/assets/bower_components/jquery/src/queue/delay.js +22 -0
- data/vendor/assets/bower_components/jquery/src/selector-native.js +211 -0
- data/vendor/assets/bower_components/jquery/src/selector-sizzle.js +14 -0
- data/vendor/assets/bower_components/jquery/src/selector.js +1 -0
- data/vendor/assets/bower_components/jquery/src/serialize.js +125 -0
- data/vendor/assets/bower_components/jquery/src/support.js +63 -0
- data/vendor/assets/bower_components/jquery/src/traversing.js +175 -0
- data/vendor/assets/bower_components/jquery/src/traversing/findFilter.js +100 -0
- data/vendor/assets/bower_components/jquery/src/traversing/var/dir.js +20 -0
- data/vendor/assets/bower_components/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/vendor/assets/bower_components/jquery/src/traversing/var/siblings.js +15 -0
- data/vendor/assets/bower_components/jquery/src/var/arr.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/class2type.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/concat.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/deletedIds.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/document.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/documentElement.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/hasOwn.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/indexOf.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/pnum.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/push.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/rcssNum.js +7 -0
- data/vendor/assets/bower_components/jquery/src/var/rnotwhite.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/slice.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/support.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/toString.js +5 -0
- data/vendor/assets/bower_components/jquery/src/wrap.js +79 -0
- data/vendor/assets/bower_components/jsoneditor/CONTRIBUTING.md +15 -0
- data/vendor/assets/bower_components/jsoneditor/HISTORY.md +457 -0
- data/vendor/assets/bower_components/jsoneditor/LICENSE +176 -0
- data/vendor/assets/bower_components/jsoneditor/NOTICE +17 -0
- data/vendor/assets/bower_components/jsoneditor/README.md +155 -0
- data/vendor/assets/bower_components/jsoneditor/bower.json +32 -0
- data/vendor/assets/bower_components/jsoneditor/dist/img/jsoneditor-icons.svg +893 -0
- data/vendor/assets/bower_components/jsoneditor/dist/jsoneditor-minimalist.js +9418 -0
- data/vendor/assets/bower_components/jsoneditor/dist/jsoneditor-minimalist.map +1 -0
- data/vendor/assets/bower_components/jsoneditor/dist/jsoneditor-minimalist.min.js +35 -0
- data/vendor/assets/bower_components/jsoneditor/dist/jsoneditor.css.less +879 -0
- data/vendor/assets/bower_components/jsoneditor/dist/jsoneditor.js +35095 -0
- data/vendor/assets/bower_components/jsoneditor/dist/jsoneditor.map +1 -0
- data/vendor/assets/bower_components/jsoneditor/dist/jsoneditor.min.css +1 -0
- data/vendor/assets/bower_components/jsoneditor/dist/jsoneditor.min.js +48 -0
- data/vendor/assets/bower_components/jsoneditor/dist/which files do I need.md +41 -0
- data/vendor/assets/bower_components/jsoneditor/docs/api.md +286 -0
- data/vendor/assets/bower_components/jsoneditor/docs/shortcut_keys.md +38 -0
- data/vendor/assets/bower_components/jsoneditor/docs/usage.md +117 -0
- data/vendor/assets/bower_components/jsoneditor/examples/01_basic_usage.html +49 -0
- data/vendor/assets/bower_components/jsoneditor/examples/02_viewer.html +44 -0
- data/vendor/assets/bower_components/jsoneditor/examples/03_switch_mode.html +66 -0
- data/vendor/assets/bower_components/jsoneditor/examples/04_load_and_save.html +62 -0
- data/vendor/assets/bower_components/jsoneditor/examples/05_custom_fields_editable.html +63 -0
- data/vendor/assets/bower_components/jsoneditor/examples/06_custom_styling.html +51 -0
- data/vendor/assets/bower_components/jsoneditor/examples/07_json_schema_validation.html +71 -0
- data/vendor/assets/bower_components/jsoneditor/examples/css/darktheme.css +76 -0
- data/vendor/assets/bower_components/jsoneditor/examples/requirejs_demo/requirejs_demo.html +21 -0
- data/vendor/assets/bower_components/jsoneditor/examples/requirejs_demo/scripts/main.js +25 -0
- data/vendor/assets/bower_components/jsoneditor/examples/requirejs_demo/scripts/require.js +36 -0
- data/vendor/assets/bower_components/jsoneditor/index.js +1 -0
- data/vendor/assets/bower_components/jsoneditor/package.json +41 -0
- data/vendor/assets/bower_components/jsoneditor/src/css/contextmenu.css +233 -0
- data/vendor/assets/bower_components/jsoneditor/src/css/img/description.txt +14 -0
- data/vendor/assets/bower_components/jsoneditor/src/css/img/jsoneditor-icons.svg +893 -0
- data/vendor/assets/bower_components/jsoneditor/src/css/jsoneditor.css +433 -0
- data/vendor/assets/bower_components/jsoneditor/src/css/menu.css +110 -0
- data/vendor/assets/bower_components/jsoneditor/src/css/searchbox.css +75 -0
- data/vendor/assets/bower_components/jsoneditor/src/docs/which files do I need.md +41 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/ContextMenu.js +455 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/Highlighter.js +84 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/History.js +252 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/JSONEditor.js +371 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/Node.js +3400 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/SearchBox.js +295 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/ace/index.js +9 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/ace/theme-jsoneditor.js +144 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/appendNodeFactory.js +226 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/assets/jsonlint/README.md +15 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/assets/jsonlint/jsonlint.js +418 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/header.js +29 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/modeswitcher.js +105 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/textmode.js +474 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/treemode.js +1150 -0
- data/vendor/assets/bower_components/jsoneditor/src/js/util.js +765 -0
- data/vendor/assets/bower_components/notifyjs/CHANGES.md +7 -0
- data/vendor/assets/bower_components/notifyjs/README.md +31 -0
- data/vendor/assets/bower_components/notifyjs/bower.json +14 -0
- data/vendor/assets/bower_components/notifyjs/dist/notify.js +586 -0
- data/vendor/assets/bower_components/notifyjs/dist/styles/metro/notify-metro.css +40 -0
- data/vendor/assets/bower_components/notifyjs/dist/styles/metro/notify-metro.js +39 -0
- data/vendor/assets/bower_components/notifyjs/examples/classes.html +49 -0
- data/vendor/assets/bower_components/notifyjs/examples/images/Mail.png +0 -0
- data/vendor/assets/bower_components/notifyjs/examples/inlines.html +111 -0
- data/vendor/assets/bower_components/notifyjs/examples/metro.html +37 -0
- data/vendor/assets/bower_components/notifyjs/examples/multi-text.html +55 -0
- data/vendor/assets/bower_components/notifyjs/examples/position.html +42 -0
- data/vendor/assets/bower_components/notifyjs/notify.jquery.json +28 -0
- data/vendor/assets/bower_components/notifyjs/package.json +18 -0
- data/vendor/assets/bower_components/vue/LICENSE +21 -0
- data/vendor/assets/bower_components/vue/bower.json +19 -0
- data/vendor/assets/bower_components/vue/dist/vue.js +10198 -0
- data/vendor/assets/bower_components/vue/dist/vue.min.js +8 -0
- data/vendor/assets/bower_components/vue/src/api/child.js +49 -0
- data/vendor/assets/bower_components/vue/src/api/data.js +159 -0
- data/vendor/assets/bower_components/vue/src/api/dom.js +226 -0
- data/vendor/assets/bower_components/vue/src/api/events.js +174 -0
- data/vendor/assets/bower_components/vue/src/api/global.js +129 -0
- data/vendor/assets/bower_components/vue/src/api/lifecycle.js +68 -0
- data/vendor/assets/bower_components/vue/src/batcher.js +98 -0
- data/vendor/assets/bower_components/vue/src/cache.js +112 -0
- data/vendor/assets/bower_components/vue/src/compiler/compile-props.js +183 -0
- data/vendor/assets/bower_components/vue/src/compiler/compile.js +630 -0
- data/vendor/assets/bower_components/vue/src/compiler/index.js +4 -0
- data/vendor/assets/bower_components/vue/src/compiler/transclude.js +144 -0
- data/vendor/assets/bower_components/vue/src/config.js +124 -0
- data/vendor/assets/bower_components/vue/src/directive.js +254 -0
- data/vendor/assets/bower_components/vue/src/directives/attr.js +59 -0
- data/vendor/assets/bower_components/vue/src/directives/class.js +70 -0
- data/vendor/assets/bower_components/vue/src/directives/cloak.js +10 -0
- data/vendor/assets/bower_components/vue/src/directives/component.js +344 -0
- data/vendor/assets/bower_components/vue/src/directives/el.js +12 -0
- data/vendor/assets/bower_components/vue/src/directives/html.js +40 -0
- data/vendor/assets/bower_components/vue/src/directives/if.js +125 -0
- data/vendor/assets/bower_components/vue/src/directives/index.js +24 -0
- data/vendor/assets/bower_components/vue/src/directives/model/checkbox.js +42 -0
- data/vendor/assets/bower_components/vue/src/directives/model/index.js +82 -0
- data/vendor/assets/bower_components/vue/src/directives/model/radio.js +33 -0
- data/vendor/assets/bower_components/vue/src/directives/model/select.js +236 -0
- data/vendor/assets/bower_components/vue/src/directives/model/text.js +132 -0
- data/vendor/assets/bower_components/vue/src/directives/on.js +59 -0
- data/vendor/assets/bower_components/vue/src/directives/prop.js +62 -0
- data/vendor/assets/bower_components/vue/src/directives/ref.js +22 -0
- data/vendor/assets/bower_components/vue/src/directives/repeat.js +770 -0
- data/vendor/assets/bower_components/vue/src/directives/show.js +8 -0
- data/vendor/assets/bower_components/vue/src/directives/style.js +110 -0
- data/vendor/assets/bower_components/vue/src/directives/text.js +14 -0
- data/vendor/assets/bower_components/vue/src/directives/transition.js +26 -0
- data/vendor/assets/bower_components/vue/src/element-directives/content.js +111 -0
- data/vendor/assets/bower_components/vue/src/element-directives/index.js +2 -0
- data/vendor/assets/bower_components/vue/src/element-directives/partial.js +73 -0
- data/vendor/assets/bower_components/vue/src/filters/array-filters.js +97 -0
- data/vendor/assets/bower_components/vue/src/filters/index.js +146 -0
- data/vendor/assets/bower_components/vue/src/instance/compile.js +200 -0
- data/vendor/assets/bower_components/vue/src/instance/events.js +139 -0
- data/vendor/assets/bower_components/vue/src/instance/init.js +89 -0
- data/vendor/assets/bower_components/vue/src/instance/misc.js +93 -0
- data/vendor/assets/bower_components/vue/src/instance/scope.js +282 -0
- data/vendor/assets/bower_components/vue/src/observer/array.js +98 -0
- data/vendor/assets/bower_components/vue/src/observer/dep.js +61 -0
- data/vendor/assets/bower_components/vue/src/observer/index.js +234 -0
- data/vendor/assets/bower_components/vue/src/observer/object.js +82 -0
- data/vendor/assets/bower_components/vue/src/parsers/directive.js +180 -0
- data/vendor/assets/bower_components/vue/src/parsers/expression.js +264 -0
- data/vendor/assets/bower_components/vue/src/parsers/path.js +348 -0
- data/vendor/assets/bower_components/vue/src/parsers/template.js +288 -0
- data/vendor/assets/bower_components/vue/src/parsers/text.js +178 -0
- data/vendor/assets/bower_components/vue/src/transition/index.js +128 -0
- data/vendor/assets/bower_components/vue/src/transition/queue.js +35 -0
- data/vendor/assets/bower_components/vue/src/transition/transition.js +357 -0
- data/vendor/assets/bower_components/vue/src/util/component.js +124 -0
- data/vendor/assets/bower_components/vue/src/util/debug.js +64 -0
- data/vendor/assets/bower_components/vue/src/util/dom.js +272 -0
- data/vendor/assets/bower_components/vue/src/util/env.js +85 -0
- data/vendor/assets/bower_components/vue/src/util/index.js +9 -0
- data/vendor/assets/bower_components/vue/src/util/lang.js +310 -0
- data/vendor/assets/bower_components/vue/src/util/options.js +357 -0
- data/vendor/assets/bower_components/vue/src/vue.js +89 -0
- data/vendor/assets/bower_components/vue/src/watcher.js +312 -0
- metadata +870 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
|
2
|
+
table.jsoneditor-search input,
|
3
|
+
table.jsoneditor-search div.jsoneditor-results {
|
4
|
+
font-family: arial, sans-serif;
|
5
|
+
font-size: 10pt;
|
6
|
+
color: #1A1A1A;
|
7
|
+
background: transparent; /* For Firefox */
|
8
|
+
}
|
9
|
+
|
10
|
+
table.jsoneditor-search {
|
11
|
+
position: absolute;
|
12
|
+
right: 2px;
|
13
|
+
top: 2px;
|
14
|
+
}
|
15
|
+
|
16
|
+
table.jsoneditor-search div.jsoneditor-frame {
|
17
|
+
border: 1px solid transparent;
|
18
|
+
background-color: white;
|
19
|
+
padding: 0 2px;
|
20
|
+
margin: 0;
|
21
|
+
}
|
22
|
+
|
23
|
+
table.jsoneditor-search div.jsoneditor-frame table {
|
24
|
+
border-collapse: collapse;
|
25
|
+
}
|
26
|
+
|
27
|
+
table.jsoneditor-search input {
|
28
|
+
width: 120px;
|
29
|
+
border: none;
|
30
|
+
outline: none;
|
31
|
+
margin: 1px;
|
32
|
+
line-height: 20px;
|
33
|
+
}
|
34
|
+
|
35
|
+
table.jsoneditor-search .jsoneditor-results {
|
36
|
+
color: #4d4d4d;
|
37
|
+
padding-right: 5px;
|
38
|
+
line-height: 24px;
|
39
|
+
}
|
40
|
+
|
41
|
+
table.jsoneditor-search button {
|
42
|
+
width: 16px;
|
43
|
+
height: 24px;
|
44
|
+
padding: 0;
|
45
|
+
margin: 0;
|
46
|
+
border: none;
|
47
|
+
background: url('img/jsoneditor-icons.svg');
|
48
|
+
vertical-align: top;
|
49
|
+
}
|
50
|
+
|
51
|
+
table.jsoneditor-search button:hover {
|
52
|
+
background-color: transparent;
|
53
|
+
}
|
54
|
+
|
55
|
+
table.jsoneditor-search button.jsoneditor-refresh {
|
56
|
+
width: 18px;
|
57
|
+
background-position: -99px -73px;
|
58
|
+
}
|
59
|
+
|
60
|
+
table.jsoneditor-search button.jsoneditor-next {
|
61
|
+
cursor: pointer;
|
62
|
+
background-position: -124px -73px;
|
63
|
+
}
|
64
|
+
table.jsoneditor-search button.jsoneditor-next:hover {
|
65
|
+
background-position: -124px -49px;
|
66
|
+
}
|
67
|
+
|
68
|
+
table.jsoneditor-search button.jsoneditor-previous {
|
69
|
+
cursor: pointer;
|
70
|
+
background-position: -148px -73px;
|
71
|
+
margin-right: 2px;
|
72
|
+
}
|
73
|
+
table.jsoneditor-search button.jsoneditor-previous:hover {
|
74
|
+
background-position: -148px -49px;
|
75
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Which files do I need?
|
2
|
+
|
3
|
+
Ehhh, that's quite some files in this dist folder. Which files do I need?
|
4
|
+
|
5
|
+
|
6
|
+
## Full version
|
7
|
+
|
8
|
+
If you're not sure which version to use, use the full version.
|
9
|
+
|
10
|
+
Which files are needed when using the full version?
|
11
|
+
|
12
|
+
- jsoneditor.min.js
|
13
|
+
- jsoneditor.map (optional, for debugging purposes only)
|
14
|
+
- jsoneditor.min.css
|
15
|
+
- img/jsoneditor-icons.svg
|
16
|
+
|
17
|
+
|
18
|
+
## Minimalist version
|
19
|
+
|
20
|
+
The minimalist version has excluded the following libraries:
|
21
|
+
|
22
|
+
- `ace` (via `brace`), used for the code editor.
|
23
|
+
- `ajv`, used for JSON schema validation.
|
24
|
+
|
25
|
+
This reduces the the size of the minified and gzipped JavaScript file from
|
26
|
+
about 160 kB to about 40 kB.
|
27
|
+
|
28
|
+
When to use the minimalist version?
|
29
|
+
|
30
|
+
- If you don't need the mode "code" and don't need JSON schema validation.
|
31
|
+
- Or if you want to provide `ace` and/or `ajv` yourself via the configuration
|
32
|
+
options, for example when you already use Ace in other parts of your
|
33
|
+
web application too and don't want to bundle the library twice.
|
34
|
+
|
35
|
+
Which files are needed when using the minimalist version?
|
36
|
+
|
37
|
+
- jsoneditor-minimalist.min.js
|
38
|
+
- jsoneditor-minimalist.map (optional, for debugging purposes only)
|
39
|
+
- jsoneditor.min.css
|
40
|
+
- img/jsoneditor-icons.svg
|
41
|
+
|
@@ -0,0 +1,455 @@
|
|
1
|
+
var util = require('./util');
|
2
|
+
|
3
|
+
/**
|
4
|
+
* A context menu
|
5
|
+
* @param {Object[]} items Array containing the menu structure
|
6
|
+
* TODO: describe structure
|
7
|
+
* @param {Object} [options] Object with options. Available options:
|
8
|
+
* {function} close Callback called when the
|
9
|
+
* context menu is being closed.
|
10
|
+
* @constructor
|
11
|
+
*/
|
12
|
+
function ContextMenu (items, options) {
|
13
|
+
this.dom = {};
|
14
|
+
|
15
|
+
var me = this;
|
16
|
+
var dom = this.dom;
|
17
|
+
this.anchor = undefined;
|
18
|
+
this.items = items;
|
19
|
+
this.eventListeners = {};
|
20
|
+
this.selection = undefined; // holds the selection before the menu was opened
|
21
|
+
this.onClose = options ? options.close : undefined;
|
22
|
+
|
23
|
+
// create root element
|
24
|
+
var root = document.createElement('div');
|
25
|
+
root.className = 'jsoneditor-contextmenu-root';
|
26
|
+
dom.root = root;
|
27
|
+
|
28
|
+
// create a container element
|
29
|
+
var menu = document.createElement('div');
|
30
|
+
menu.className = 'jsoneditor-contextmenu';
|
31
|
+
dom.menu = menu;
|
32
|
+
root.appendChild(menu);
|
33
|
+
|
34
|
+
// create a list to hold the menu items
|
35
|
+
var list = document.createElement('ul');
|
36
|
+
list.className = 'jsoneditor-menu';
|
37
|
+
menu.appendChild(list);
|
38
|
+
dom.list = list;
|
39
|
+
dom.items = []; // list with all buttons
|
40
|
+
|
41
|
+
// create a (non-visible) button to set the focus to the menu
|
42
|
+
var focusButton = document.createElement('button');
|
43
|
+
dom.focusButton = focusButton;
|
44
|
+
var li = document.createElement('li');
|
45
|
+
li.style.overflow = 'hidden';
|
46
|
+
li.style.height = '0';
|
47
|
+
li.appendChild(focusButton);
|
48
|
+
list.appendChild(li);
|
49
|
+
|
50
|
+
function createMenuItems (list, domItems, items) {
|
51
|
+
items.forEach(function (item) {
|
52
|
+
if (item.type == 'separator') {
|
53
|
+
// create a separator
|
54
|
+
var separator = document.createElement('div');
|
55
|
+
separator.className = 'jsoneditor-separator';
|
56
|
+
li = document.createElement('li');
|
57
|
+
li.appendChild(separator);
|
58
|
+
list.appendChild(li);
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
var domItem = {};
|
62
|
+
|
63
|
+
// create a menu item
|
64
|
+
var li = document.createElement('li');
|
65
|
+
list.appendChild(li);
|
66
|
+
|
67
|
+
// create a button in the menu item
|
68
|
+
var button = document.createElement('button');
|
69
|
+
button.className = item.className;
|
70
|
+
domItem.button = button;
|
71
|
+
if (item.title) {
|
72
|
+
button.title = item.title;
|
73
|
+
}
|
74
|
+
if (item.click) {
|
75
|
+
button.onclick = function (event) {
|
76
|
+
event.preventDefault();
|
77
|
+
me.hide();
|
78
|
+
item.click();
|
79
|
+
};
|
80
|
+
}
|
81
|
+
li.appendChild(button);
|
82
|
+
|
83
|
+
// create the contents of the button
|
84
|
+
if (item.submenu) {
|
85
|
+
// add the icon to the button
|
86
|
+
var divIcon = document.createElement('div');
|
87
|
+
divIcon.className = 'jsoneditor-icon';
|
88
|
+
button.appendChild(divIcon);
|
89
|
+
button.appendChild(document.createTextNode(item.text));
|
90
|
+
|
91
|
+
var buttonSubmenu;
|
92
|
+
if (item.click) {
|
93
|
+
// submenu and a button with a click handler
|
94
|
+
button.className += ' jsoneditor-default';
|
95
|
+
|
96
|
+
var buttonExpand = document.createElement('button');
|
97
|
+
domItem.buttonExpand = buttonExpand;
|
98
|
+
buttonExpand.className = 'jsoneditor-expand';
|
99
|
+
buttonExpand.innerHTML = '<div class="jsoneditor-expand"></div>';
|
100
|
+
li.appendChild(buttonExpand);
|
101
|
+
if (item.submenuTitle) {
|
102
|
+
buttonExpand.title = item.submenuTitle;
|
103
|
+
}
|
104
|
+
|
105
|
+
buttonSubmenu = buttonExpand;
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
// submenu and a button without a click handler
|
109
|
+
var divExpand = document.createElement('div');
|
110
|
+
divExpand.className = 'jsoneditor-expand';
|
111
|
+
button.appendChild(divExpand);
|
112
|
+
|
113
|
+
buttonSubmenu = button;
|
114
|
+
}
|
115
|
+
|
116
|
+
// attach a handler to expand/collapse the submenu
|
117
|
+
buttonSubmenu.onclick = function (event) {
|
118
|
+
event.preventDefault();
|
119
|
+
me._onExpandItem(domItem);
|
120
|
+
buttonSubmenu.focus();
|
121
|
+
};
|
122
|
+
|
123
|
+
// create the submenu
|
124
|
+
var domSubItems = [];
|
125
|
+
domItem.subItems = domSubItems;
|
126
|
+
var ul = document.createElement('ul');
|
127
|
+
domItem.ul = ul;
|
128
|
+
ul.className = 'jsoneditor-menu';
|
129
|
+
ul.style.height = '0';
|
130
|
+
li.appendChild(ul);
|
131
|
+
createMenuItems(ul, domSubItems, item.submenu);
|
132
|
+
}
|
133
|
+
else {
|
134
|
+
// no submenu, just a button with clickhandler
|
135
|
+
button.innerHTML = '<div class="jsoneditor-icon"></div>' + item.text;
|
136
|
+
}
|
137
|
+
|
138
|
+
domItems.push(domItem);
|
139
|
+
}
|
140
|
+
});
|
141
|
+
}
|
142
|
+
createMenuItems(list, this.dom.items, items);
|
143
|
+
|
144
|
+
// TODO: when the editor is small, show the submenu on the right instead of inline?
|
145
|
+
|
146
|
+
// calculate the max height of the menu with one submenu expanded
|
147
|
+
this.maxHeight = 0; // height in pixels
|
148
|
+
items.forEach(function (item) {
|
149
|
+
var height = (items.length + (item.submenu ? item.submenu.length : 0)) * 24;
|
150
|
+
me.maxHeight = Math.max(me.maxHeight, height);
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Get the currently visible buttons
|
156
|
+
* @return {Array.<HTMLElement>} buttons
|
157
|
+
* @private
|
158
|
+
*/
|
159
|
+
ContextMenu.prototype._getVisibleButtons = function () {
|
160
|
+
var buttons = [];
|
161
|
+
var me = this;
|
162
|
+
this.dom.items.forEach(function (item) {
|
163
|
+
buttons.push(item.button);
|
164
|
+
if (item.buttonExpand) {
|
165
|
+
buttons.push(item.buttonExpand);
|
166
|
+
}
|
167
|
+
if (item.subItems && item == me.expandedItem) {
|
168
|
+
item.subItems.forEach(function (subItem) {
|
169
|
+
buttons.push(subItem.button);
|
170
|
+
if (subItem.buttonExpand) {
|
171
|
+
buttons.push(subItem.buttonExpand);
|
172
|
+
}
|
173
|
+
// TODO: change to fully recursive method
|
174
|
+
});
|
175
|
+
}
|
176
|
+
});
|
177
|
+
|
178
|
+
return buttons;
|
179
|
+
};
|
180
|
+
|
181
|
+
// currently displayed context menu, a singleton. We may only have one visible context menu
|
182
|
+
ContextMenu.visibleMenu = undefined;
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Attach the menu to an anchor
|
186
|
+
* @param {HTMLElement} anchor Anchor where the menu will be attached
|
187
|
+
* as sibling.
|
188
|
+
* @param {HTMLElement} [contentWindow] The DIV with with the (scrollable) contents
|
189
|
+
*/
|
190
|
+
ContextMenu.prototype.show = function (anchor, contentWindow) {
|
191
|
+
this.hide();
|
192
|
+
|
193
|
+
// determine whether to display the menu below or above the anchor
|
194
|
+
var showBelow = true;
|
195
|
+
if (contentWindow) {
|
196
|
+
var anchorRect = anchor.getBoundingClientRect();
|
197
|
+
var contentRect = contentWindow.getBoundingClientRect();
|
198
|
+
|
199
|
+
if (anchorRect.bottom + this.maxHeight < contentRect.bottom) {
|
200
|
+
// fits below -> show below
|
201
|
+
}
|
202
|
+
else if (anchorRect.top - this.maxHeight > contentRect.top) {
|
203
|
+
// fits above -> show above
|
204
|
+
showBelow = false;
|
205
|
+
}
|
206
|
+
else {
|
207
|
+
// doesn't fit above nor below -> show below
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
// position the menu
|
212
|
+
if (showBelow) {
|
213
|
+
// display the menu below the anchor
|
214
|
+
var anchorHeight = anchor.offsetHeight;
|
215
|
+
this.dom.menu.style.left = '0px';
|
216
|
+
this.dom.menu.style.top = anchorHeight + 'px';
|
217
|
+
this.dom.menu.style.bottom = '';
|
218
|
+
}
|
219
|
+
else {
|
220
|
+
// display the menu above the anchor
|
221
|
+
this.dom.menu.style.left = '0px';
|
222
|
+
this.dom.menu.style.top = '';
|
223
|
+
this.dom.menu.style.bottom = '0px';
|
224
|
+
}
|
225
|
+
|
226
|
+
// attach the menu to the parent of the anchor
|
227
|
+
var parent = anchor.parentNode;
|
228
|
+
parent.insertBefore(this.dom.root, parent.firstChild);
|
229
|
+
|
230
|
+
// create and attach event listeners
|
231
|
+
var me = this;
|
232
|
+
var list = this.dom.list;
|
233
|
+
this.eventListeners.mousedown = util.addEventListener(window, 'mousedown', function (event) {
|
234
|
+
// hide menu on click outside of the menu
|
235
|
+
var target = event.target;
|
236
|
+
if ((target != list) && !me._isChildOf(target, list)) {
|
237
|
+
me.hide();
|
238
|
+
event.stopPropagation();
|
239
|
+
event.preventDefault();
|
240
|
+
}
|
241
|
+
});
|
242
|
+
this.eventListeners.keydown = util.addEventListener(window, 'keydown', function (event) {
|
243
|
+
me._onKeyDown(event);
|
244
|
+
});
|
245
|
+
|
246
|
+
// move focus to the first button in the context menu
|
247
|
+
this.selection = util.getSelection();
|
248
|
+
this.anchor = anchor;
|
249
|
+
setTimeout(function () {
|
250
|
+
me.dom.focusButton.focus();
|
251
|
+
}, 0);
|
252
|
+
|
253
|
+
if (ContextMenu.visibleMenu) {
|
254
|
+
ContextMenu.visibleMenu.hide();
|
255
|
+
}
|
256
|
+
ContextMenu.visibleMenu = this;
|
257
|
+
};
|
258
|
+
|
259
|
+
/**
|
260
|
+
* Hide the context menu if visible
|
261
|
+
*/
|
262
|
+
ContextMenu.prototype.hide = function () {
|
263
|
+
// remove the menu from the DOM
|
264
|
+
if (this.dom.root.parentNode) {
|
265
|
+
this.dom.root.parentNode.removeChild(this.dom.root);
|
266
|
+
if (this.onClose) {
|
267
|
+
this.onClose();
|
268
|
+
}
|
269
|
+
}
|
270
|
+
|
271
|
+
// remove all event listeners
|
272
|
+
// all event listeners are supposed to be attached to document.
|
273
|
+
for (var name in this.eventListeners) {
|
274
|
+
if (this.eventListeners.hasOwnProperty(name)) {
|
275
|
+
var fn = this.eventListeners[name];
|
276
|
+
if (fn) {
|
277
|
+
util.removeEventListener(window, name, fn);
|
278
|
+
}
|
279
|
+
delete this.eventListeners[name];
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
if (ContextMenu.visibleMenu == this) {
|
284
|
+
ContextMenu.visibleMenu = undefined;
|
285
|
+
}
|
286
|
+
};
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Expand a submenu
|
290
|
+
* Any currently expanded submenu will be hided.
|
291
|
+
* @param {Object} domItem
|
292
|
+
* @private
|
293
|
+
*/
|
294
|
+
ContextMenu.prototype._onExpandItem = function (domItem) {
|
295
|
+
var me = this;
|
296
|
+
var alreadyVisible = (domItem == this.expandedItem);
|
297
|
+
|
298
|
+
// hide the currently visible submenu
|
299
|
+
var expandedItem = this.expandedItem;
|
300
|
+
if (expandedItem) {
|
301
|
+
//var ul = expandedItem.ul;
|
302
|
+
expandedItem.ul.style.height = '0';
|
303
|
+
expandedItem.ul.style.padding = '';
|
304
|
+
setTimeout(function () {
|
305
|
+
if (me.expandedItem != expandedItem) {
|
306
|
+
expandedItem.ul.style.display = '';
|
307
|
+
util.removeClassName(expandedItem.ul.parentNode, 'jsoneditor-selected');
|
308
|
+
}
|
309
|
+
}, 300); // timeout duration must match the css transition duration
|
310
|
+
this.expandedItem = undefined;
|
311
|
+
}
|
312
|
+
|
313
|
+
if (!alreadyVisible) {
|
314
|
+
var ul = domItem.ul;
|
315
|
+
ul.style.display = 'block';
|
316
|
+
var height = ul.clientHeight; // force a reflow in Firefox
|
317
|
+
setTimeout(function () {
|
318
|
+
if (me.expandedItem == domItem) {
|
319
|
+
ul.style.height = (ul.childNodes.length * 24) + 'px';
|
320
|
+
ul.style.padding = '5px 10px';
|
321
|
+
}
|
322
|
+
}, 0);
|
323
|
+
util.addClassName(ul.parentNode, 'jsoneditor-selected');
|
324
|
+
this.expandedItem = domItem;
|
325
|
+
}
|
326
|
+
};
|
327
|
+
|
328
|
+
/**
|
329
|
+
* Handle onkeydown event
|
330
|
+
* @param {Event} event
|
331
|
+
* @private
|
332
|
+
*/
|
333
|
+
ContextMenu.prototype._onKeyDown = function (event) {
|
334
|
+
var target = event.target;
|
335
|
+
var keynum = event.which;
|
336
|
+
var handled = false;
|
337
|
+
var buttons, targetIndex, prevButton, nextButton;
|
338
|
+
|
339
|
+
if (keynum == 27) { // ESC
|
340
|
+
// hide the menu on ESC key
|
341
|
+
|
342
|
+
// restore previous selection and focus
|
343
|
+
if (this.selection) {
|
344
|
+
util.setSelection(this.selection);
|
345
|
+
}
|
346
|
+
if (this.anchor) {
|
347
|
+
this.anchor.focus();
|
348
|
+
}
|
349
|
+
|
350
|
+
this.hide();
|
351
|
+
|
352
|
+
handled = true;
|
353
|
+
}
|
354
|
+
else if (keynum == 9) { // Tab
|
355
|
+
if (!event.shiftKey) { // Tab
|
356
|
+
buttons = this._getVisibleButtons();
|
357
|
+
targetIndex = buttons.indexOf(target);
|
358
|
+
if (targetIndex == buttons.length - 1) {
|
359
|
+
// move to first button
|
360
|
+
buttons[0].focus();
|
361
|
+
handled = true;
|
362
|
+
}
|
363
|
+
}
|
364
|
+
else { // Shift+Tab
|
365
|
+
buttons = this._getVisibleButtons();
|
366
|
+
targetIndex = buttons.indexOf(target);
|
367
|
+
if (targetIndex == 0) {
|
368
|
+
// move to last button
|
369
|
+
buttons[buttons.length - 1].focus();
|
370
|
+
handled = true;
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
374
|
+
else if (keynum == 37) { // Arrow Left
|
375
|
+
if (target.className == 'jsoneditor-expand') {
|
376
|
+
buttons = this._getVisibleButtons();
|
377
|
+
targetIndex = buttons.indexOf(target);
|
378
|
+
prevButton = buttons[targetIndex - 1];
|
379
|
+
if (prevButton) {
|
380
|
+
prevButton.focus();
|
381
|
+
}
|
382
|
+
}
|
383
|
+
handled = true;
|
384
|
+
}
|
385
|
+
else if (keynum == 38) { // Arrow Up
|
386
|
+
buttons = this._getVisibleButtons();
|
387
|
+
targetIndex = buttons.indexOf(target);
|
388
|
+
prevButton = buttons[targetIndex - 1];
|
389
|
+
if (prevButton && prevButton.className == 'jsoneditor-expand') {
|
390
|
+
// skip expand button
|
391
|
+
prevButton = buttons[targetIndex - 2];
|
392
|
+
}
|
393
|
+
if (!prevButton) {
|
394
|
+
// move to last button
|
395
|
+
prevButton = buttons[buttons.length - 1];
|
396
|
+
}
|
397
|
+
if (prevButton) {
|
398
|
+
prevButton.focus();
|
399
|
+
}
|
400
|
+
handled = true;
|
401
|
+
}
|
402
|
+
else if (keynum == 39) { // Arrow Right
|
403
|
+
buttons = this._getVisibleButtons();
|
404
|
+
targetIndex = buttons.indexOf(target);
|
405
|
+
nextButton = buttons[targetIndex + 1];
|
406
|
+
if (nextButton && nextButton.className == 'jsoneditor-expand') {
|
407
|
+
nextButton.focus();
|
408
|
+
}
|
409
|
+
handled = true;
|
410
|
+
}
|
411
|
+
else if (keynum == 40) { // Arrow Down
|
412
|
+
buttons = this._getVisibleButtons();
|
413
|
+
targetIndex = buttons.indexOf(target);
|
414
|
+
nextButton = buttons[targetIndex + 1];
|
415
|
+
if (nextButton && nextButton.className == 'jsoneditor-expand') {
|
416
|
+
// skip expand button
|
417
|
+
nextButton = buttons[targetIndex + 2];
|
418
|
+
}
|
419
|
+
if (!nextButton) {
|
420
|
+
// move to first button
|
421
|
+
nextButton = buttons[0];
|
422
|
+
}
|
423
|
+
if (nextButton) {
|
424
|
+
nextButton.focus();
|
425
|
+
handled = true;
|
426
|
+
}
|
427
|
+
handled = true;
|
428
|
+
}
|
429
|
+
// TODO: arrow left and right
|
430
|
+
|
431
|
+
if (handled) {
|
432
|
+
event.stopPropagation();
|
433
|
+
event.preventDefault();
|
434
|
+
}
|
435
|
+
};
|
436
|
+
|
437
|
+
/**
|
438
|
+
* Test if an element is a child of a parent element.
|
439
|
+
* @param {Element} child
|
440
|
+
* @param {Element} parent
|
441
|
+
* @return {boolean} isChild
|
442
|
+
*/
|
443
|
+
ContextMenu.prototype._isChildOf = function (child, parent) {
|
444
|
+
var e = child.parentNode;
|
445
|
+
while (e) {
|
446
|
+
if (e == parent) {
|
447
|
+
return true;
|
448
|
+
}
|
449
|
+
e = e.parentNode;
|
450
|
+
}
|
451
|
+
|
452
|
+
return false;
|
453
|
+
};
|
454
|
+
|
455
|
+
module.exports = ContextMenu;
|