vapid 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.gitmodules +6 -0
- data/.rspec +2 -0
- data/.rubocop.yml +133 -0
- data/.travis.yml +5 -0
- data/Gemfile +10 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/vapid +7 -0
- data/lib/vapid.rb +24 -0
- data/lib/vapid/assets/javascripts/vapid/admin.coffee +2 -0
- data/lib/vapid/assets/stylesheets/vapid/admin.scss +72 -0
- data/lib/vapid/builder.rb +70 -0
- data/lib/vapid/cli.rb +96 -0
- data/lib/vapid/controllers/admin_controller.rb +282 -0
- data/lib/vapid/controllers/project_controller.rb +41 -0
- data/lib/vapid/db/migrate/20170202182310_create_groups.rb +12 -0
- data/lib/vapid/db/migrate/20170202183017_create_records.rb +11 -0
- data/lib/vapid/db/migrate/20170202185150_create_users.rb +11 -0
- data/lib/vapid/directive.rb +168 -0
- data/lib/vapid/directives.rb +30 -0
- data/lib/vapid/directives/audio.rb +27 -0
- data/lib/vapid/directives/group.rb +71 -0
- data/lib/vapid/directives/hide.rb +11 -0
- data/lib/vapid/directives/href.rb +11 -0
- data/lib/vapid/directives/image.rb +14 -0
- data/lib/vapid/directives/richtext.rb +15 -0
- data/lib/vapid/directives/show.rb +11 -0
- data/lib/vapid/directives/text.rb +24 -0
- data/lib/vapid/directives/video.rb +28 -0
- data/lib/vapid/generator_template/.gitignore +21 -0
- data/lib/vapid/generator_template/Gemfile.tt +13 -0
- data/lib/vapid/generator_template/README.md +0 -0
- data/lib/vapid/generator_template/assets/favicon.ico +0 -0
- data/lib/vapid/generator_template/assets/images/.keep +0 -0
- data/lib/vapid/generator_template/assets/javascripts/.keep +0 -0
- data/lib/vapid/generator_template/assets/stylesheets/.keep +0 -0
- data/lib/vapid/generator_template/assets/stylesheets/application.css +120 -0
- data/lib/vapid/generator_template/config.ru +3 -0
- data/lib/vapid/generator_template/config/database.yml +12 -0
- data/lib/vapid/generator_template/config/settings.yml.tt +11 -0
- data/lib/vapid/generator_template/templates/index.html.erb +25 -0
- data/lib/vapid/generator_template/templates/layouts/default.html.erb +22 -0
- data/lib/vapid/models.rb +18 -0
- data/lib/vapid/models/group.rb +36 -0
- data/lib/vapid/models/record.rb +30 -0
- data/lib/vapid/models/user.rb +16 -0
- data/lib/vapid/server.rb +93 -0
- data/lib/vapid/settings.rb +13 -0
- data/lib/vapid/template.rb +79 -0
- data/lib/vapid/template/node.rb +91 -0
- data/lib/vapid/template/parser.rb +50 -0
- data/lib/vapid/vendor/semantic-ui/.versions +4 -0
- data/lib/vapid/vendor/semantic-ui/LICENSE +22 -0
- data/lib/vapid/vendor/semantic-ui/README.md +7 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.css +252 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.js +610 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/ad.css +275 -0
- data/lib/vapid/vendor/semantic-ui/components/ad.min.css +10 -0
- data/lib/vapid/vendor/semantic-ui/components/api.js +1167 -0
- data/lib/vapid/vendor/semantic-ui/components/api.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/breadcrumb.css +124 -0
- data/lib/vapid/vendor/semantic-ui/components/breadcrumb.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/button.css +3450 -0
- data/lib/vapid/vendor/semantic-ui/components/button.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/card.css +964 -0
- data/lib/vapid/vendor/semantic-ui/components/card.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.css +625 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.js +831 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/colorize.js +274 -0
- data/lib/vapid/vendor/semantic-ui/components/colorize.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/comment.css +270 -0
- data/lib/vapid/vendor/semantic-ui/components/comment.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/container.css +147 -0
- data/lib/vapid/vendor/semantic-ui/components/container.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.css +200 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.js +708 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/divider.css +260 -0
- data/lib/vapid/vendor/semantic-ui/components/divider.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.css +1442 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.js +3767 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.css +166 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.js +696 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/feed.css +296 -0
- data/lib/vapid/vendor/semantic-ui/components/feed.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/flag.css +1031 -0
- data/lib/vapid/vendor/semantic-ui/components/flag.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/form.css +1067 -0
- data/lib/vapid/vendor/semantic-ui/components/form.js +1603 -0
- data/lib/vapid/vendor/semantic-ui/components/form.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/form.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/grid.css +2002 -0
- data/lib/vapid/vendor/semantic-ui/components/grid.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/header.css +721 -0
- data/lib/vapid/vendor/semantic-ui/components/header.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/icon.css +3292 -0
- data/lib/vapid/vendor/semantic-ui/components/icon.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/image.css +306 -0
- data/lib/vapid/vendor/semantic-ui/components/image.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/input.css +510 -0
- data/lib/vapid/vendor/semantic-ui/components/input.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/item.css +486 -0
- data/lib/vapid/vendor/semantic-ui/components/item.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/label.css +1307 -0
- data/lib/vapid/vendor/semantic-ui/components/label.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/list.css +951 -0
- data/lib/vapid/vendor/semantic-ui/components/list.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/loader.css +347 -0
- data/lib/vapid/vendor/semantic-ui/components/loader.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/menu.css +2002 -0
- data/lib/vapid/vendor/semantic-ui/components/menu.min.css +1 -0
- data/lib/vapid/vendor/semantic-ui/components/message.css +477 -0
- data/lib/vapid/vendor/semantic-ui/components/message.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.css +502 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.js +913 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.css +147 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.js +507 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.css +733 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.js +1475 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.css +516 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.js +931 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/rail.css +152 -0
- data/lib/vapid/vendor/semantic-ui/components/rail.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.css +263 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.js +508 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/reset.css +424 -0
- data/lib/vapid/vendor/semantic-ui/components/reset.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/reveal.css +284 -0
- data/lib/vapid/vendor/semantic-ui/components/reveal.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/search.css +408 -0
- data/lib/vapid/vendor/semantic-ui/components/search.js +1442 -0
- data/lib/vapid/vendor/semantic-ui/components/search.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/search.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/segment.css +798 -0
- data/lib/vapid/vendor/semantic-ui/components/segment.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.css +157 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.js +921 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.css +634 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.js +1036 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/site.css +160 -0
- data/lib/vapid/vendor/semantic-ui/components/site.js +487 -0
- data/lib/vapid/vendor/semantic-ui/components/site.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/site.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/state.js +708 -0
- data/lib/vapid/vendor/semantic-ui/components/state.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/statistic.css +569 -0
- data/lib/vapid/vendor/semantic-ui/components/statistic.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/step.css +623 -0
- data/lib/vapid/vendor/semantic-ui/components/step.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.css +78 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.js +942 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.css +91 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.js +952 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/table.css +1108 -0
- data/lib/vapid/vendor/semantic-ui/components/table.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.css +1964 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.js +1095 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/video.css +125 -0
- data/lib/vapid/vendor/semantic-ui/components/video.js +532 -0
- data/lib/vapid/vendor/semantic-ui/components/video.min.css +10 -0
- data/lib/vapid/vendor/semantic-ui/components/video.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/visibility.js +1288 -0
- data/lib/vapid/vendor/semantic-ui/components/visibility.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/visit.js +517 -0
- data/lib/vapid/vendor/semantic-ui/components/visit.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/package.js +34 -0
- data/lib/vapid/vendor/semantic-ui/package.json +20 -0
- data/lib/vapid/vendor/semantic-ui/semantic.css +36844 -0
- data/lib/vapid/vendor/semantic-ui/semantic.js +22617 -0
- data/lib/vapid/vendor/semantic-ui/semantic.min.css +364 -0
- data/lib/vapid/vendor/semantic-ui/semantic.min.js +19 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.eot +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.otf +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.svg +2671 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.ttf +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/images/flags.png +0 -0
- data/lib/vapid/vendor/trix/.blade.yml +45 -0
- data/lib/vapid/vendor/trix/.github/ISSUE_TEMPLATE.md +13 -0
- data/lib/vapid/vendor/trix/.gitignore +3 -0
- data/lib/vapid/vendor/trix/.ruby-version +1 -0
- data/lib/vapid/vendor/trix/.travis.yml +6 -0
- data/lib/vapid/vendor/trix/CONDUCT.md +79 -0
- data/lib/vapid/vendor/trix/Gemfile +17 -0
- data/lib/vapid/vendor/trix/Gemfile.lock +152 -0
- data/lib/vapid/vendor/trix/LICENSE +20 -0
- data/lib/vapid/vendor/trix/README.md +382 -0
- data/lib/vapid/vendor/trix/assets/index.html +55 -0
- data/lib/vapid/vendor/trix/assets/trix-core.coffee +2 -0
- data/lib/vapid/vendor/trix/assets/trix.coffee +3 -0
- data/lib/vapid/vendor/trix/assets/trix.scss +5 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.coffee.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.scss.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.txt.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/images/README.md +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/attach.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/bold.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/bullets.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/code.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/heading_1.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/italic.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/link.svg +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_decrease.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_increase.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/numbers.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/quote.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/redo.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/remove.svg +4 -0
- data/lib/vapid/vendor/trix/assets/trix/images/strike.svg +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/trash.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/undo.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/attachments.scss +112 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/content.scss +88 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/editor.scss +8 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/icons.scss +14 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/media-queries.scss +7 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/toolbar.scss +194 -0
- data/lib/vapid/vendor/trix/bin/blade +16 -0
- data/lib/vapid/vendor/trix/bin/ci +21 -0
- data/lib/vapid/vendor/trix/bin/rackup +16 -0
- data/lib/vapid/vendor/trix/bin/rake +16 -0
- data/lib/vapid/vendor/trix/bin/release +139 -0
- data/lib/vapid/vendor/trix/bin/setup +69 -0
- data/lib/vapid/vendor/trix/bin/update-status-image +100 -0
- data/lib/vapid/vendor/trix/bower.json +34 -0
- data/lib/vapid/vendor/trix/config.ru +32 -0
- data/lib/vapid/vendor/trix/dist/trix-core.js +11 -0
- data/lib/vapid/vendor/trix/dist/trix.css +286 -0
- data/lib/vapid/vendor/trix/dist/trix.js +20 -0
- data/lib/vapid/vendor/trix/package.json +29 -0
- data/lib/vapid/vendor/trix/polyfills/polyfills.coffee +3 -0
- data/lib/vapid/vendor/trix/polyfills/set.coffee +24 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/CustomElements.js +1029 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/README.md +2 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/promise.js +228 -0
- data/lib/vapid/vendor/trix/src/trix/VERSION +1 -0
- data/lib/vapid/vendor/trix/src/trix/config/block_attributes.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/config/css.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/config/file_size_formatting.coffee +22 -0
- data/lib/vapid/vendor/trix/src/trix/config/index.coffee +9 -0
- data/lib/vapid/vendor/trix/src/trix/config/lang.coffee +26 -0
- data/lib/vapid/vendor/trix/src/trix/config/selection_elements.coffee +26 -0
- data/lib/vapid/vendor/trix/src/trix/config/serialization.coffee +63 -0
- data/lib/vapid/vendor/trix/src/trix/config/text_attributes.coffee +25 -0
- data/lib/vapid/vendor/trix/src/trix/config/toolbar.coffee +41 -0
- data/lib/vapid/vendor/trix/src/trix/config/undo_interval.coffee +7 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/attachment_editor_controller.coffee +104 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/composition_controller.coffee +117 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/controller.coffee +3 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/editor_controller.coffee +369 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/input/composition_input.coffee +57 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/input_controller.coffee +473 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/toolbar_controller.coffee +173 -0
- data/lib/vapid/vendor/trix/src/trix/core/basic_object.coffee +44 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/element_store.coffee +21 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/hash.coffee +98 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/index.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/object_group.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/object_map.coffee +10 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/arrays.coffee +34 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/config.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/custom_elements.coffee +45 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/dom.coffee +185 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/extend.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/functions.coffee +3 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/global.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/index.coffee +10 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/objects.coffee +11 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/ranges.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/selection.coffee +25 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/strings.coffee +46 -0
- data/lib/vapid/vendor/trix/src/trix/core/index.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/object.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/index.coffee +2 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/operation.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/utf16_string.coffee +93 -0
- data/lib/vapid/vendor/trix/src/trix/elements/trix_editor_element.coffee +166 -0
- data/lib/vapid/vendor/trix/src/trix/elements/trix_toolbar_element.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/index.coffee.erb +14 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/control_element.coffee +60 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/debugger.coffee +104 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/element.coffee +86 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/index.coffee +17 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/polyfills/vendor/details-element-polyfill.js +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/debug.jst.eco +17 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/document.jst.eco +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/performance.jst.eco +10 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/render.jst.eco +1 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/selection.jst.eco +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/undo.jst.eco +13 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/view.coffee +58 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/debug_view.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/document_view.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/performance_view.coffee +51 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/render_view.coffee +21 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/selection_view.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/undo_view.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/deserializer.coffee +55 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/index.coffee +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player.coffee +60 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee +43 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee +32 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_view.coffee +133 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recorder.coffee +82 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recording.coffee +54 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/serializer.coffee +61 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment.coffee +157 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment_manager.coffee +24 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment_piece.coffee +47 -0
- data/lib/vapid/vendor/trix/src/trix/models/block.coffee +230 -0
- data/lib/vapid/vendor/trix/src/trix/models/composition.coffee +521 -0
- data/lib/vapid/vendor/trix/src/trix/models/document.coffee +538 -0
- data/lib/vapid/vendor/trix/src/trix/models/editor.coffee +141 -0
- data/lib/vapid/vendor/trix/src/trix/models/html_parser.coffee +335 -0
- data/lib/vapid/vendor/trix/src/trix/models/line_break_insertion.coffee +31 -0
- data/lib/vapid/vendor/trix/src/trix/models/location_mapper.coffee +156 -0
- data/lib/vapid/vendor/trix/src/trix/models/managed_attachment.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/models/piece.coffee +95 -0
- data/lib/vapid/vendor/trix/src/trix/models/point_mapper.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/models/selection_manager.coffee +129 -0
- data/lib/vapid/vendor/trix/src/trix/models/splittable_list.coffee +168 -0
- data/lib/vapid/vendor/trix/src/trix/models/string_piece.coffee +49 -0
- data/lib/vapid/vendor/trix/src/trix/models/text.coffee +168 -0
- data/lib/vapid/vendor/trix/src/trix/models/undo_manager.coffee +40 -0
- data/lib/vapid/vendor/trix/src/trix/observers/mutation_observer.coffee +131 -0
- data/lib/vapid/vendor/trix/src/trix/observers/selection_change_observer.coffee +56 -0
- data/lib/vapid/vendor/trix/src/trix/operations/file_verification_operation.coffee +15 -0
- data/lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee +15 -0
- data/lib/vapid/vendor/trix/src/trix/views/attachment_view.coffee +99 -0
- data/lib/vapid/vendor/trix/src/trix/views/block_view.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/views/document_view.coffee +68 -0
- data/lib/vapid/vendor/trix/src/trix/views/object_group_view.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/views/object_view.coffee +86 -0
- data/lib/vapid/vendor/trix/src/trix/views/piece_view.coffee +97 -0
- data/lib/vapid/vendor/trix/src/trix/views/previewable_attachment_view.coffee +49 -0
- data/lib/vapid/vendor/trix/src/trix/views/text_view.coffee +30 -0
- data/lib/vapid/vendor/trix/test/.gitignore +1 -0
- data/lib/vapid/vendor/trix/test/src/system/attachment_test.coffee +70 -0
- data/lib/vapid/vendor/trix/test/src/system/basic_input_test.coffee +68 -0
- data/lib/vapid/vendor/trix/test/src/system/block_formatting_test.coffee +602 -0
- data/lib/vapid/vendor/trix/test/src/system/caching_test.coffee +21 -0
- data/lib/vapid/vendor/trix/test/src/system/composition_input_test.coffee +138 -0
- data/lib/vapid/vendor/trix/test/src/system/cursor_movement_test.coffee +54 -0
- data/lib/vapid/vendor/trix/test/src/system/custom_element_test.coffee +314 -0
- data/lib/vapid/vendor/trix/test/src/system/html_loading_test.coffee +62 -0
- data/lib/vapid/vendor/trix/test/src/system/html_replacement_test.coffee +101 -0
- data/lib/vapid/vendor/trix/test/src/system/installation_process_test.coffee +59 -0
- data/lib/vapid/vendor/trix/test/src/system/list_formatting_test.coffee +70 -0
- data/lib/vapid/vendor/trix/test/src/system/mutation_input_test.coffee +73 -0
- data/lib/vapid/vendor/trix/test/src/system/pasting_test.coffee +215 -0
- data/lib/vapid/vendor/trix/test/src/system/text_formatting_test.coffee +151 -0
- data/lib/vapid/vendor/trix/test/src/system/undo_test.coffee +48 -0
- data/lib/vapid/vendor/trix/test/src/test.coffee +16 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/assertions.coffee +38 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/editor_helpers.coffee +37 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_empty.jst.eco +1 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_html.jst.eco +2 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_in_table.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_block_styles.jst.eco +6 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_bold_styles.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_image.jst.eco +2 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_styled_content.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_toolbar_and_input.jst.eco +5 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/fixtures.coffee +536 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/logo.png +0 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/index.coffee +18 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/input_helpers.coffee +183 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/selection_helpers.coffee +91 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/test_helpers.coffee +72 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/test_stubs.coffee +31 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/toolbar_helpers.coffee +45 -0
- data/lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee +23 -0
- data/lib/vapid/vendor/trix/test/src/unit/block_test.coffee +22 -0
- data/lib/vapid/vendor/trix/test/src/unit/composition_test.coffee +13 -0
- data/lib/vapid/vendor/trix/test/src/unit/document_test.coffee +11 -0
- data/lib/vapid/vendor/trix/test/src/unit/document_view_test.coffee +6 -0
- data/lib/vapid/vendor/trix/test/src/unit/html_parser_test.coffee +162 -0
- data/lib/vapid/vendor/trix/test/src/unit/location_mapper_test.coffee +185 -0
- data/lib/vapid/vendor/trix/test/src/unit/mutation_observer_test.coffee +84 -0
- data/lib/vapid/vendor/trix/test/src/unit/serialization_test.coffee +7 -0
- data/lib/vapid/vendor/trix/test/src/unit/string_change_summary_test.coffee +57 -0
- data/lib/vapid/vendor/trix/test/src/unit/text_test.coffee +19 -0
- data/lib/vapid/vendor/trix/test/vendor/rangy-core.js +3845 -0
- data/lib/vapid/vendor/trix/test/vendor/rangy-textrange.js +1930 -0
- data/lib/vapid/version.rb +4 -0
- data/lib/vapid/views/admin/install.html.erb +19 -0
- data/lib/vapid/views/admin/login.html.erb +11 -0
- data/lib/vapid/views/admin/overview/index.html.erb +1 -0
- data/lib/vapid/views/admin/records/_form.erb +9 -0
- data/lib/vapid/views/admin/records/edit.html.erb +5 -0
- data/lib/vapid/views/admin/records/index.html.erb +38 -0
- data/lib/vapid/views/admin/records/new.html.erb +3 -0
- data/lib/vapid/views/errors/404.html.erb +1 -0
- data/lib/vapid/views/errors/500.html.erb +1 -0
- data/lib/vapid/views/layouts/admin.html.erb +41 -0
- data/lib/vapid/views/layouts/admin_form.html.erb +22 -0
- data/lib/vapid/views/layouts/error.html.erb +11 -0
- data/vapid.gemspec +48 -0
- metadata +811 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
class Trix.Operation extends Trix.BasicObject
|
2
|
+
isPerforming: ->
|
3
|
+
@performing is true
|
4
|
+
|
5
|
+
hasPerformed: ->
|
6
|
+
@performed is true
|
7
|
+
|
8
|
+
hasSucceeded: ->
|
9
|
+
@performed and @succeeded
|
10
|
+
|
11
|
+
hasFailed: ->
|
12
|
+
@performed and not @succeeded
|
13
|
+
|
14
|
+
getPromise: ->
|
15
|
+
@promise ?= new Promise (resolve, reject) =>
|
16
|
+
@performing = true
|
17
|
+
@perform (@succeeded, result) =>
|
18
|
+
@performing = false
|
19
|
+
@performed = true
|
20
|
+
|
21
|
+
if @succeeded
|
22
|
+
resolve(result)
|
23
|
+
else
|
24
|
+
reject(result)
|
25
|
+
|
26
|
+
perform: (callback) ->
|
27
|
+
callback(false)
|
28
|
+
|
29
|
+
release: ->
|
30
|
+
@promise?.cancel?()
|
31
|
+
@promise = null
|
32
|
+
@performing = null
|
33
|
+
@performed = null
|
34
|
+
@succeeded = null
|
35
|
+
|
36
|
+
@proxyMethod "getPromise().then"
|
37
|
+
@proxyMethod "getPromise().catch"
|
@@ -0,0 +1,93 @@
|
|
1
|
+
class Trix.UTF16String extends Trix.BasicObject
|
2
|
+
@box: (value = "") ->
|
3
|
+
if value instanceof this
|
4
|
+
value
|
5
|
+
else
|
6
|
+
@fromUCS2String(value?.toString())
|
7
|
+
|
8
|
+
@fromUCS2String: (ucs2String) ->
|
9
|
+
new this ucs2String, ucs2decode(ucs2String)
|
10
|
+
|
11
|
+
@fromCodepoints: (codepoints) ->
|
12
|
+
new this ucs2encode(codepoints), codepoints
|
13
|
+
|
14
|
+
constructor: (@ucs2String, @codepoints) ->
|
15
|
+
@length = @codepoints.length
|
16
|
+
@ucs2Length = @ucs2String.length
|
17
|
+
|
18
|
+
offsetToUCS2Offset: (offset) ->
|
19
|
+
ucs2encode(@codepoints.slice(0, Math.max(0, offset))).length
|
20
|
+
|
21
|
+
offsetFromUCS2Offset: (ucs2Offset) ->
|
22
|
+
ucs2decode(@ucs2String.slice(0, Math.max(0, ucs2Offset))).length
|
23
|
+
|
24
|
+
slice: ->
|
25
|
+
@constructor.fromCodepoints(@codepoints.slice(arguments...))
|
26
|
+
|
27
|
+
charAt: (offset) ->
|
28
|
+
@slice(offset, offset + 1)
|
29
|
+
|
30
|
+
isEqualTo: (value) ->
|
31
|
+
@constructor.box(value).ucs2String is @ucs2String
|
32
|
+
|
33
|
+
toJSON: ->
|
34
|
+
@ucs2String
|
35
|
+
|
36
|
+
getCacheKey: ->
|
37
|
+
@ucs2String
|
38
|
+
|
39
|
+
toString: ->
|
40
|
+
@ucs2String
|
41
|
+
|
42
|
+
hasArrayFrom = Array.from?("\ud83d\udc7c").length is 1
|
43
|
+
hasStringCodePointAt = " ".codePointAt?(0)?
|
44
|
+
hasStringFromCodePoint = String.fromCodePoint?(32, 128124) is " \ud83d\udc7c"
|
45
|
+
|
46
|
+
# UCS-2 conversion helpers ported from Mathias Bynens' Punycode.js:
|
47
|
+
# https://github.com/bestiejs/punycode.js#punycodeucs2
|
48
|
+
|
49
|
+
# Creates an array containing the numeric code points of each Unicode
|
50
|
+
# character in the string. While JavaScript uses UCS-2 internally,
|
51
|
+
# this function will convert a pair of surrogate halves (each of which
|
52
|
+
# UCS-2 exposes as separate characters) into a single code point,
|
53
|
+
# matching UTF-16.
|
54
|
+
if hasArrayFrom and hasStringCodePointAt
|
55
|
+
ucs2decode = (string) ->
|
56
|
+
Array.from(string).map (char) -> char.codePointAt(0)
|
57
|
+
else
|
58
|
+
ucs2decode = (string) ->
|
59
|
+
output = []
|
60
|
+
counter = 0
|
61
|
+
length = string.length
|
62
|
+
|
63
|
+
while counter < length
|
64
|
+
value = string.charCodeAt(counter++)
|
65
|
+
if 0xD800 <= value <= 0xDBFF && counter < length
|
66
|
+
# high surrogate, and there is a next character
|
67
|
+
extra = string.charCodeAt(counter++)
|
68
|
+
if (extra & 0xFC00) is 0xDC00
|
69
|
+
# low surrogate
|
70
|
+
value = ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000
|
71
|
+
else
|
72
|
+
# unmatched surrogate; only append this code unit, in case the
|
73
|
+
# next code unit is the high surrogate of a surrogate pair
|
74
|
+
counter--
|
75
|
+
output.push(value)
|
76
|
+
|
77
|
+
output
|
78
|
+
|
79
|
+
# Creates a string based on an array of numeric code points.
|
80
|
+
if hasStringFromCodePoint
|
81
|
+
ucs2encode = (array) ->
|
82
|
+
String.fromCodePoint(array...)
|
83
|
+
else
|
84
|
+
ucs2encode = (array) ->
|
85
|
+
characters = for value in array
|
86
|
+
output = ""
|
87
|
+
if value > 0xFFFF
|
88
|
+
value -= 0x10000
|
89
|
+
output += String.fromCharCode(value >>> 10 & 0x3FF | 0xD800)
|
90
|
+
value = 0xDC00 | value & 0x3FF
|
91
|
+
output + String.fromCharCode(value)
|
92
|
+
|
93
|
+
characters.join("")
|
@@ -0,0 +1,166 @@
|
|
1
|
+
#= require trix/elements/trix_toolbar_element
|
2
|
+
#= require trix/controllers/editor_controller
|
3
|
+
|
4
|
+
{makeElement, selectionElements, triggerEvent, handleEvent, handleEventOnce} = Trix
|
5
|
+
|
6
|
+
{attachmentSelector} = Trix.AttachmentView
|
7
|
+
|
8
|
+
Trix.registerElement "trix-editor", do ->
|
9
|
+
id = 0
|
10
|
+
|
11
|
+
# Contenteditable support helpers
|
12
|
+
|
13
|
+
autofocus = (element) ->
|
14
|
+
unless document.querySelector(":focus")
|
15
|
+
if element.hasAttribute("autofocus") and document.querySelector("[autofocus]") is element
|
16
|
+
element.focus()
|
17
|
+
|
18
|
+
makeEditable = (element) ->
|
19
|
+
return if element.hasAttribute("contenteditable")
|
20
|
+
element.setAttribute("contenteditable", "")
|
21
|
+
handleEventOnce("focus", onElement: element, withCallback: -> configureContentEditable(element))
|
22
|
+
|
23
|
+
configureContentEditable = (element) ->
|
24
|
+
disableObjectResizing(element)
|
25
|
+
setDefaultParagraphSeparator(element)
|
26
|
+
|
27
|
+
disableObjectResizing = (element) ->
|
28
|
+
if document.queryCommandSupported?("enableObjectResizing")
|
29
|
+
document.execCommand("enableObjectResizing", false, false)
|
30
|
+
handleEvent("mscontrolselect", onElement: element, preventDefault: true)
|
31
|
+
|
32
|
+
setDefaultParagraphSeparator = (element) ->
|
33
|
+
if document.queryCommandSupported?("DefaultParagraphSeparator")
|
34
|
+
{tagName} = Trix.config.blockAttributes.default
|
35
|
+
if tagName in ["div", "p"]
|
36
|
+
document.execCommand("DefaultParagraphSeparator", false, tagName)
|
37
|
+
|
38
|
+
# Style
|
39
|
+
|
40
|
+
defaultCSS: """
|
41
|
+
%t:empty:not(:focus)::before {
|
42
|
+
content: attr(placeholder);
|
43
|
+
color: graytext;
|
44
|
+
}
|
45
|
+
|
46
|
+
%t a[contenteditable=false] {
|
47
|
+
cursor: text;
|
48
|
+
}
|
49
|
+
|
50
|
+
%t img {
|
51
|
+
max-width: 100%;
|
52
|
+
height: auto;
|
53
|
+
}
|
54
|
+
|
55
|
+
%t #{attachmentSelector} figcaption textarea {
|
56
|
+
resize: none;
|
57
|
+
}
|
58
|
+
|
59
|
+
%t #{attachmentSelector} figcaption textarea.trix-autoresize-clone {
|
60
|
+
position: absolute;
|
61
|
+
left: -9999px;
|
62
|
+
max-height: 0px;
|
63
|
+
}
|
64
|
+
|
65
|
+
%t #{attachmentSelector}[data-trix-mutable] figcaption:empty::before {
|
66
|
+
content: "#{Trix.config.lang.captionPrompt}";
|
67
|
+
color: graytext;
|
68
|
+
}
|
69
|
+
|
70
|
+
%t #{selectionElements.selector} { #{selectionElements.cssText} }
|
71
|
+
"""
|
72
|
+
|
73
|
+
# Properties
|
74
|
+
|
75
|
+
trixId:
|
76
|
+
get: ->
|
77
|
+
if @hasAttribute("trix-id")
|
78
|
+
@getAttribute("trix-id")
|
79
|
+
else
|
80
|
+
@setAttribute("trix-id", ++id)
|
81
|
+
@trixId
|
82
|
+
|
83
|
+
toolbarElement:
|
84
|
+
get: ->
|
85
|
+
if @hasAttribute("toolbar")
|
86
|
+
@ownerDocument?.getElementById(@getAttribute("toolbar"))
|
87
|
+
else if @parentElement
|
88
|
+
toolbarId = "trix-toolbar-#{@trixId}"
|
89
|
+
@setAttribute("toolbar", toolbarId)
|
90
|
+
element = makeElement("trix-toolbar", id: toolbarId)
|
91
|
+
@parentElement.insertBefore(element, this)
|
92
|
+
element
|
93
|
+
|
94
|
+
inputElement:
|
95
|
+
get: ->
|
96
|
+
if @hasAttribute("input")
|
97
|
+
@ownerDocument?.getElementById(@getAttribute("input"))
|
98
|
+
else if @parentElement
|
99
|
+
inputId = "trix-input-#{@trixId}"
|
100
|
+
@setAttribute("input", inputId)
|
101
|
+
element = makeElement("input", type: "hidden", id: inputId)
|
102
|
+
@parentElement.insertBefore(element, @nextElementSibling)
|
103
|
+
element
|
104
|
+
|
105
|
+
editor:
|
106
|
+
get: ->
|
107
|
+
@editorController?.editor
|
108
|
+
|
109
|
+
name:
|
110
|
+
get: ->
|
111
|
+
@inputElement?.name
|
112
|
+
|
113
|
+
value:
|
114
|
+
get: ->
|
115
|
+
@inputElement?.value
|
116
|
+
set: (@defaultValue) ->
|
117
|
+
@editor?.loadHTML(@defaultValue)
|
118
|
+
|
119
|
+
# Controller delegate methods
|
120
|
+
|
121
|
+
notify: (message, data) ->
|
122
|
+
switch message
|
123
|
+
when "document-change"
|
124
|
+
@documentChangedSinceLastRender = true
|
125
|
+
when "render"
|
126
|
+
if @documentChangedSinceLastRender
|
127
|
+
@documentChangedSinceLastRender = false
|
128
|
+
@notify("change")
|
129
|
+
when "change", "attachment-add", "attachment-edit", "attachment-remove"
|
130
|
+
@inputElement?.value = Trix.serializeToContentType(this, "text/html")
|
131
|
+
|
132
|
+
if @editorController
|
133
|
+
triggerEvent("trix-#{message}", onElement: this, attributes: data)
|
134
|
+
|
135
|
+
# Element lifecycle
|
136
|
+
|
137
|
+
createdCallback: ->
|
138
|
+
makeEditable(this)
|
139
|
+
|
140
|
+
attachedCallback: ->
|
141
|
+
unless @hasAttribute("data-trix-internal")
|
142
|
+
@editorController ?= new Trix.EditorController(editorElement: this, html: @defaultValue = @value)
|
143
|
+
@editorController.registerSelectionManager()
|
144
|
+
@registerResetListener()
|
145
|
+
autofocus(this)
|
146
|
+
requestAnimationFrame => @notify("initialize")
|
147
|
+
|
148
|
+
detachedCallback: ->
|
149
|
+
@editorController?.unregisterSelectionManager()
|
150
|
+
@unregisterResetListener()
|
151
|
+
|
152
|
+
# Form reset support
|
153
|
+
|
154
|
+
registerResetListener: ->
|
155
|
+
@resetListener = @resetBubbled.bind(this)
|
156
|
+
window.addEventListener("reset", @resetListener, false)
|
157
|
+
|
158
|
+
unregisterResetListener: ->
|
159
|
+
window.removeEventListener("reset", @resetListener, false)
|
160
|
+
|
161
|
+
resetBubbled: (event) ->
|
162
|
+
if event.target is @inputElement?.form
|
163
|
+
@reset() unless event.defaultPrevented
|
164
|
+
|
165
|
+
reset: ->
|
166
|
+
@value = @defaultValue
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{cloneFragment} = Trix
|
2
|
+
|
3
|
+
Trix.registerElement "trix-toolbar",
|
4
|
+
defaultCSS: """
|
5
|
+
%t {
|
6
|
+
white-space: collapse;
|
7
|
+
}
|
8
|
+
|
9
|
+
%t .dialog {
|
10
|
+
display: none;
|
11
|
+
}
|
12
|
+
|
13
|
+
%t .dialog.active {
|
14
|
+
display: block;
|
15
|
+
}
|
16
|
+
|
17
|
+
%t .dialog input.validate:invalid {
|
18
|
+
background-color: #ffdddd;
|
19
|
+
}
|
20
|
+
|
21
|
+
%t[native] {
|
22
|
+
display: none;
|
23
|
+
}
|
24
|
+
"""
|
25
|
+
|
26
|
+
createdCallback: ->
|
27
|
+
if @innerHTML is ""
|
28
|
+
@appendChild(cloneFragment(Trix.config.toolbar.content))
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#= export Trix
|
2
|
+
#= require_self
|
3
|
+
#= require trix/core
|
4
|
+
#= require trix/config
|
5
|
+
#= require trix/elements/trix_editor_element
|
6
|
+
|
7
|
+
@Trix =
|
8
|
+
VERSION: "<%= depend_on_asset("trix/VERSION").to_s.chomp %>"
|
9
|
+
|
10
|
+
ZERO_WIDTH_SPACE: "\uFEFF"
|
11
|
+
NON_BREAKING_SPACE: "\u00A0"
|
12
|
+
OBJECT_REPLACEMENT_CHARACTER: "\uFFFC"
|
13
|
+
|
14
|
+
config: {}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class Trix.Inspector.ControlElement
|
2
|
+
keyEvents = "keydown keypress input".split(" ")
|
3
|
+
compositionEvents = "compositionstart compositionupdate compositionend textInput".split(" ")
|
4
|
+
|
5
|
+
observerOptions =
|
6
|
+
attributes: true
|
7
|
+
childList: true
|
8
|
+
characterData: true
|
9
|
+
characterDataOldValue: true
|
10
|
+
subtree: true
|
11
|
+
|
12
|
+
constructor: (@editorElement) ->
|
13
|
+
@install()
|
14
|
+
|
15
|
+
install: ->
|
16
|
+
@createElement()
|
17
|
+
@logInputEvents()
|
18
|
+
@logMutations()
|
19
|
+
|
20
|
+
uninstall: ->
|
21
|
+
@observer.disconnect()
|
22
|
+
@element.parentNode.removeChild(@element)
|
23
|
+
|
24
|
+
createElement: ->
|
25
|
+
@element = document.createElement("div")
|
26
|
+
@element.setAttribute("contenteditable", "")
|
27
|
+
@element.style.width = getComputedStyle(@editorElement).width
|
28
|
+
@element.style.minHeight = "50px"
|
29
|
+
@element.style.border = "1px solid green"
|
30
|
+
@editorElement.parentNode.insertBefore(@element, @editorElement.nextSibling)
|
31
|
+
|
32
|
+
logInputEvents: ->
|
33
|
+
for eventName in keyEvents
|
34
|
+
@element.addEventListener eventName, (event) ->
|
35
|
+
console.log "#{event.type}: keyCode = #{event.keyCode}"
|
36
|
+
|
37
|
+
for eventName in compositionEvents
|
38
|
+
@element.addEventListener eventName, (event) ->
|
39
|
+
console.log "#{event.type}: data = #{JSON.stringify(event.data)}"
|
40
|
+
|
41
|
+
logMutations: ->
|
42
|
+
@observer = new window.MutationObserver @didMutate
|
43
|
+
@observer.observe(@element, observerOptions)
|
44
|
+
|
45
|
+
didMutate: (mutations) =>
|
46
|
+
console.log "Mutations (#{mutations.length}):"
|
47
|
+
for mutation, index in mutations
|
48
|
+
console.log " #{index + 1}. #{mutation.type}:"
|
49
|
+
switch mutation.type
|
50
|
+
when "characterData"
|
51
|
+
console.log " oldValue = #{JSON.stringify(mutation.oldValue)}, newValue = #{JSON.stringify(mutation.target.data)}"
|
52
|
+
when "childList"
|
53
|
+
console.log " node added #{inspectNode(node)}" for node in mutation.addedNodes
|
54
|
+
console.log " node removed #{inspectNode(node)}" for node in mutation.removedNodes
|
55
|
+
|
56
|
+
inspectNode = (node) ->
|
57
|
+
if node.data?
|
58
|
+
JSON.stringify(node.data)
|
59
|
+
else
|
60
|
+
JSON.stringify(node.outerHTML)
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# This file is not included in the main Trix bundle and
|
2
|
+
# should be explicitly required to enable the debugger.
|
3
|
+
|
4
|
+
DEBUG_METHODS =
|
5
|
+
"Trix.AttachmentEditorController": "
|
6
|
+
didClickRemoveButton
|
7
|
+
uninstall
|
8
|
+
"
|
9
|
+
|
10
|
+
"Trix.CompositionController": "
|
11
|
+
didClickAttachment
|
12
|
+
"
|
13
|
+
|
14
|
+
"Trix.EditorController": "
|
15
|
+
setEditor
|
16
|
+
loadDocument
|
17
|
+
"
|
18
|
+
|
19
|
+
"Trix.InputController": "
|
20
|
+
elementDidMutate
|
21
|
+
events.keydown
|
22
|
+
events.keypress
|
23
|
+
events.dragstart
|
24
|
+
events.dragover
|
25
|
+
events.dragend
|
26
|
+
events.drop
|
27
|
+
events.cut
|
28
|
+
events.paste
|
29
|
+
events.compositionstart
|
30
|
+
events.compositionend
|
31
|
+
"
|
32
|
+
|
33
|
+
"Trix.ToolbarController": "
|
34
|
+
didClickActionButton
|
35
|
+
didClickAttributeButton
|
36
|
+
didClickDialogButton
|
37
|
+
didKeyDownDialogInput
|
38
|
+
"
|
39
|
+
|
40
|
+
{findClosestElementFromNode} = Trix
|
41
|
+
|
42
|
+
errorListeners = []
|
43
|
+
|
44
|
+
Trix.Debugger =
|
45
|
+
addErrorListener: (listener) ->
|
46
|
+
unless listener in errorListeners
|
47
|
+
errorListeners.push(listener)
|
48
|
+
|
49
|
+
removeErrorListener: (listener) ->
|
50
|
+
errorListeners = (l for l in errorListeners when l isnt listener)
|
51
|
+
|
52
|
+
installMethodDebugger = (className, methodName) ->
|
53
|
+
[objectName, constructorNames...] = className.split(".")
|
54
|
+
[propertyNames..., methodName] = methodName.split(".")
|
55
|
+
|
56
|
+
object = @[objectName]
|
57
|
+
object = object[constructorName] for constructorName in constructorNames
|
58
|
+
object = object.prototype
|
59
|
+
object = object[propertyName] for propertyName in propertyNames
|
60
|
+
|
61
|
+
if typeof object?[methodName] is "function"
|
62
|
+
object[methodName] = wrapFunctionWithErrorHandler(object[methodName])
|
63
|
+
else
|
64
|
+
throw new Error "Can't install on non-function"
|
65
|
+
|
66
|
+
wrapFunctionWithErrorHandler = (fn) ->
|
67
|
+
trixDebugWrapper = ->
|
68
|
+
try
|
69
|
+
fn.apply(this, arguments)
|
70
|
+
catch error
|
71
|
+
reportError(error)
|
72
|
+
throw error
|
73
|
+
trixDebugWrapper
|
74
|
+
|
75
|
+
reportError = (error) ->
|
76
|
+
Trix.Debugger.lastError = error
|
77
|
+
|
78
|
+
console.error "Trix error!"
|
79
|
+
console.log error.stack
|
80
|
+
|
81
|
+
activeElement = document.activeElement
|
82
|
+
editorElement = findClosestElementFromNode(activeElement, matchingSelector: "trix-editor")
|
83
|
+
|
84
|
+
if editorElement
|
85
|
+
notifyErrorListeners(error, editorElement)
|
86
|
+
else
|
87
|
+
console.warn "Can't find <trix-editor> element. document.activeElement =", activeElement
|
88
|
+
|
89
|
+
notifyErrorListeners = (error, element) ->
|
90
|
+
for listener in errorListeners
|
91
|
+
try listener(error, element)
|
92
|
+
|
93
|
+
do ->
|
94
|
+
console.groupCollapsed("Trix debugger")
|
95
|
+
|
96
|
+
for className, methodNames of DEBUG_METHODS
|
97
|
+
for methodName in methodNames.split(/\s/)
|
98
|
+
try
|
99
|
+
installMethodDebugger(className, methodName)
|
100
|
+
console.log "✓ #{className}##{methodName}"
|
101
|
+
catch error
|
102
|
+
console.warn "✗ #{className}##{methodName}:", error.message
|
103
|
+
|
104
|
+
console.groupEnd()
|