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,151 @@
|
|
1
|
+
{assert, clickToolbarButton, clickToolbarDialogButton, collapseSelection, expandSelection, insertString, insertText, isToolbarButtonActive, isToolbarButtonDisabled, isToolbarDialogActive, moveCursor, pressKey, test, testGroup, typeCharacters, typeInToolbarDialog, typeToolbarKeyCommand} = Trix.TestHelpers
|
2
|
+
|
3
|
+
testGroup "Text formatting", template: "editor_empty", ->
|
4
|
+
test "applying attributes to text", (done) ->
|
5
|
+
typeCharacters "abc", ->
|
6
|
+
expandSelection "left", ->
|
7
|
+
clickToolbarButton attribute: "bold", ->
|
8
|
+
assert.textAttributes([0, 2], {})
|
9
|
+
assert.textAttributes([2, 3], bold: true)
|
10
|
+
assert.textAttributes([3, 4], blockBreak: true)
|
11
|
+
done()
|
12
|
+
|
13
|
+
test "applying a link to text", (done) ->
|
14
|
+
typeCharacters "abc", ->
|
15
|
+
moveCursor "left", ->
|
16
|
+
expandSelection "left", ->
|
17
|
+
clickToolbarButton attribute: "href", ->
|
18
|
+
assert.ok isToolbarDialogActive(attribute: "href")
|
19
|
+
typeInToolbarDialog "http://example.com", attribute: "href", ->
|
20
|
+
assert.textAttributes([0, 1], {})
|
21
|
+
assert.textAttributes([1, 2], href: "http://example.com")
|
22
|
+
assert.textAttributes([2, 3], {})
|
23
|
+
done()
|
24
|
+
|
25
|
+
test "inserting a link", (expectDocument) ->
|
26
|
+
typeCharacters "a", ->
|
27
|
+
clickToolbarButton attribute: "href", ->
|
28
|
+
assert.ok isToolbarDialogActive(attribute: "href")
|
29
|
+
typeInToolbarDialog "http://example.com", attribute: "href", ->
|
30
|
+
assert.textAttributes([0, 1], {})
|
31
|
+
assert.textAttributes([1, 19], href: "http://example.com")
|
32
|
+
expectDocument("ahttp://example.com\n")
|
33
|
+
|
34
|
+
test "editing a link", (done) ->
|
35
|
+
insertString("a")
|
36
|
+
text = Trix.Text.textForStringWithAttributes("bc", href: "http://example.com")
|
37
|
+
insertText(text)
|
38
|
+
insertString("d")
|
39
|
+
moveCursor direction: "left", times: 2, ->
|
40
|
+
clickToolbarButton attribute: "href", ->
|
41
|
+
assert.ok isToolbarDialogActive(attribute: "href")
|
42
|
+
assert.locationRange({index: 0, offset: 1}, {index: 0, offset: 3})
|
43
|
+
typeInToolbarDialog "http://example.org", attribute: "href", ->
|
44
|
+
assert.textAttributes([0, 1], {})
|
45
|
+
assert.textAttributes([1, 3], href: "http://example.org")
|
46
|
+
assert.textAttributes([3, 4], {})
|
47
|
+
done()
|
48
|
+
|
49
|
+
test "removing a link", (done) ->
|
50
|
+
text = Trix.Text.textForStringWithAttributes("ab", href: "http://example.com")
|
51
|
+
insertText(text)
|
52
|
+
assert.textAttributes([0, 2], href: "http://example.com")
|
53
|
+
expandSelection direction: "left", times: 2, ->
|
54
|
+
clickToolbarButton attribute: "href", ->
|
55
|
+
clickToolbarDialogButton method: "removeAttribute", ->
|
56
|
+
assert.textAttributes([0, 2], {})
|
57
|
+
done()
|
58
|
+
|
59
|
+
test "applying a link to an attachment with a host-provided href", (done) ->
|
60
|
+
text = fixtures["file attachment"].document.getBlockAtIndex(0).getTextWithoutBlockBreak()
|
61
|
+
insertText(text)
|
62
|
+
typeCharacters "a", ->
|
63
|
+
assert.notOk isToolbarButtonDisabled(attribute: "href")
|
64
|
+
expandSelection "left", ->
|
65
|
+
assert.notOk isToolbarButtonDisabled(attribute: "href")
|
66
|
+
expandSelection "left", ->
|
67
|
+
assert.ok isToolbarButtonDisabled(attribute: "href")
|
68
|
+
done()
|
69
|
+
|
70
|
+
test "typing after a link", (done) ->
|
71
|
+
typeCharacters "ab", ->
|
72
|
+
expandSelection direction: "left", times: 2, ->
|
73
|
+
clickToolbarButton attribute: "href", ->
|
74
|
+
typeInToolbarDialog "http://example.com", attribute: "href", ->
|
75
|
+
collapseSelection "right", ->
|
76
|
+
assert.locationRange(index: 0, offset: 2)
|
77
|
+
typeCharacters "c", ->
|
78
|
+
assert.textAttributes([0, 2], href: "http://example.com")
|
79
|
+
assert.textAttributes([2, 3], {})
|
80
|
+
moveCursor "left", ->
|
81
|
+
assert.notOk isToolbarButtonActive(attribute: "href")
|
82
|
+
moveCursor "left", ->
|
83
|
+
assert.ok isToolbarButtonActive(attribute: "href")
|
84
|
+
done()
|
85
|
+
|
86
|
+
test "applying formatting and then typing", (done) ->
|
87
|
+
typeCharacters "a", ->
|
88
|
+
clickToolbarButton attribute: "bold", ->
|
89
|
+
typeCharacters "bcd", ->
|
90
|
+
clickToolbarButton attribute: "bold", ->
|
91
|
+
typeCharacters "e", ->
|
92
|
+
assert.textAttributes([0, 1], {})
|
93
|
+
assert.textAttributes([1, 4], bold: true)
|
94
|
+
assert.textAttributes([4, 5], {})
|
95
|
+
done()
|
96
|
+
|
97
|
+
test "applying formatting and then moving the cursor away", (done) ->
|
98
|
+
typeCharacters "abc", ->
|
99
|
+
moveCursor "left", ->
|
100
|
+
assert.notOk isToolbarButtonActive(attribute: "bold")
|
101
|
+
clickToolbarButton attribute: "bold", ->
|
102
|
+
assert.ok isToolbarButtonActive(attribute: "bold")
|
103
|
+
moveCursor "right", ->
|
104
|
+
assert.notOk isToolbarButtonActive(attribute: "bold")
|
105
|
+
moveCursor "left", ->
|
106
|
+
assert.notOk isToolbarButtonActive(attribute: "bold")
|
107
|
+
assert.textAttributes([0, 3], {})
|
108
|
+
assert.textAttributes([3, 4], blockBreak: true)
|
109
|
+
done()
|
110
|
+
|
111
|
+
test "applying formatting to an unfocused editor", (done) ->
|
112
|
+
input = Trix.makeElement("input", type: "text")
|
113
|
+
document.body.appendChild(input)
|
114
|
+
input.focus()
|
115
|
+
|
116
|
+
clickToolbarButton attribute: "bold", ->
|
117
|
+
typeCharacters "a", ->
|
118
|
+
assert.textAttributes([0, 1], bold: true)
|
119
|
+
document.body.removeChild(input)
|
120
|
+
done()
|
121
|
+
|
122
|
+
test "editing formatted text", (done) ->
|
123
|
+
clickToolbarButton attribute: "bold", ->
|
124
|
+
typeCharacters "ab", ->
|
125
|
+
clickToolbarButton attribute: "bold", ->
|
126
|
+
typeCharacters "c", ->
|
127
|
+
assert.notOk isToolbarButtonActive(attribute: "bold")
|
128
|
+
moveCursor "left", ->
|
129
|
+
assert.ok isToolbarButtonActive(attribute: "bold")
|
130
|
+
moveCursor "left", ->
|
131
|
+
assert.ok isToolbarButtonActive(attribute: "bold")
|
132
|
+
typeCharacters "Z", ->
|
133
|
+
assert.ok isToolbarButtonActive(attribute: "bold")
|
134
|
+
assert.textAttributes([0, 3], bold: true)
|
135
|
+
assert.textAttributes([3, 4], {})
|
136
|
+
assert.textAttributes([4, 5], blockBreak: true)
|
137
|
+
moveCursor "right", ->
|
138
|
+
assert.ok isToolbarButtonActive(attribute: "bold")
|
139
|
+
moveCursor "right", ->
|
140
|
+
assert.notOk isToolbarButtonActive(attribute: "bold")
|
141
|
+
done()
|
142
|
+
|
143
|
+
test "key command activates toolbar button", (done) ->
|
144
|
+
typeToolbarKeyCommand attribute: "bold", ->
|
145
|
+
assert.ok isToolbarButtonActive(attribute: "bold")
|
146
|
+
done()
|
147
|
+
|
148
|
+
test "backspacing newline after text", (expectDocument) ->
|
149
|
+
typeCharacters "a\n", ->
|
150
|
+
pressKey "backspace", ->
|
151
|
+
expectDocument("a\n")
|
@@ -0,0 +1,48 @@
|
|
1
|
+
{assert, clickToolbarButton, expandSelection, moveCursor, test, testGroup, typeCharacters} = Trix.TestHelpers
|
2
|
+
|
3
|
+
testGroup "Undo/Redo", template: "editor_empty", ->
|
4
|
+
test "typing and undoing", (done) ->
|
5
|
+
first = getDocument().copy()
|
6
|
+
typeCharacters "abc", ->
|
7
|
+
assert.notOk getDocument().isEqualTo(first)
|
8
|
+
clickToolbarButton action: "undo", ->
|
9
|
+
assert.ok getDocument().isEqualTo(first)
|
10
|
+
done()
|
11
|
+
|
12
|
+
test "typing, formatting, typing, and undoing", (done) ->
|
13
|
+
first = getDocument().copy()
|
14
|
+
typeCharacters "abc", ->
|
15
|
+
second = getDocument().copy()
|
16
|
+
clickToolbarButton attribute: "bold", ->
|
17
|
+
typeCharacters "def", ->
|
18
|
+
third = getDocument().copy()
|
19
|
+
clickToolbarButton action: "undo", ->
|
20
|
+
assert.ok getDocument().isEqualTo(second)
|
21
|
+
clickToolbarButton action: "undo", ->
|
22
|
+
assert.ok getDocument().isEqualTo(first)
|
23
|
+
clickToolbarButton action: "redo", ->
|
24
|
+
assert.ok getDocument().isEqualTo(second)
|
25
|
+
clickToolbarButton action: "redo", ->
|
26
|
+
assert.ok getDocument().isEqualTo(third)
|
27
|
+
done()
|
28
|
+
|
29
|
+
test "formatting changes are batched by location range", (done) ->
|
30
|
+
typeCharacters "abc", ->
|
31
|
+
first = getDocument().copy()
|
32
|
+
expandSelection "left", ->
|
33
|
+
clickToolbarButton attribute: "bold", ->
|
34
|
+
clickToolbarButton attribute: "italic", ->
|
35
|
+
second = getDocument().copy()
|
36
|
+
moveCursor "left", ->
|
37
|
+
expandSelection "left", ->
|
38
|
+
clickToolbarButton attribute: "italic", ->
|
39
|
+
third = getDocument().copy()
|
40
|
+
clickToolbarButton action: "undo", ->
|
41
|
+
assert.ok getDocument().isEqualTo(second)
|
42
|
+
clickToolbarButton action: "undo", ->
|
43
|
+
assert.ok getDocument().isEqualTo(first)
|
44
|
+
clickToolbarButton action: "redo", ->
|
45
|
+
assert.ok getDocument().isEqualTo(second)
|
46
|
+
clickToolbarButton action: "redo", ->
|
47
|
+
assert.ok getDocument().isEqualTo(third)
|
48
|
+
done()
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#= require trix/core/helpers/global
|
2
|
+
#= require ./test_helpers/index
|
3
|
+
#= require_tree ./system
|
4
|
+
#= require_tree ./unit
|
5
|
+
|
6
|
+
Trix.config.undoInterval = 0
|
7
|
+
|
8
|
+
document.head.insertAdjacentHTML "beforeend", """
|
9
|
+
<style type="text/css">
|
10
|
+
#trix-container { height: 150px; }
|
11
|
+
trix-toolbar { margin-bottom: 10px; }
|
12
|
+
trix-toolbar button { border: 1px solid #ccc; background: #fff; }
|
13
|
+
trix-toolbar button.active { background: #d3e6fd; }
|
14
|
+
trix-toolbar button:disabled { color: #ccc; }
|
15
|
+
</style>
|
16
|
+
"""
|
@@ -0,0 +1,38 @@
|
|
1
|
+
{normalizeRange, rangesAreEqual} = Trix
|
2
|
+
|
3
|
+
helpers = Trix.TestHelpers
|
4
|
+
helpers.assert = QUnit.assert
|
5
|
+
|
6
|
+
helpers.assert.locationRange = (start, end) ->
|
7
|
+
expectedLocationRange = normalizeRange([start, end])
|
8
|
+
actualLocationRange = getEditorController().getLocationRange()
|
9
|
+
@deepEqual(actualLocationRange, expectedLocationRange)
|
10
|
+
|
11
|
+
helpers.assert.textAttributes = (range, attributes) ->
|
12
|
+
document = getDocument().getDocumentAtRange(range)
|
13
|
+
blocks = document.getBlocks()
|
14
|
+
throw "range #{JSON.stringify(range)} spans more than one block" unless blocks.length is 1
|
15
|
+
|
16
|
+
locationRange = getDocument().locationRangeFromRange(range)
|
17
|
+
textIndex = locationRange[0].index
|
18
|
+
textRange = [locationRange[0].offset, locationRange[1].offset]
|
19
|
+
text = getDocument().getTextAtIndex(textIndex).getTextAtRange(textRange)
|
20
|
+
pieces = text.getPieces()
|
21
|
+
throw "range #{JSON.stringify(range)} must only span one piece" unless pieces.length is 1
|
22
|
+
|
23
|
+
piece = pieces[0]
|
24
|
+
@deepEqual piece.getAttributes(), attributes
|
25
|
+
|
26
|
+
helpers.assert.blockAttributes = (range, attributes) ->
|
27
|
+
document = getDocument().getDocumentAtRange(range)
|
28
|
+
blocks = document.getBlocks()
|
29
|
+
throw "range #{JSON.stringify(range)} spans more than one block" unless blocks.length is 1
|
30
|
+
|
31
|
+
block = blocks[0]
|
32
|
+
@deepEqual block.getAttributes(), attributes
|
33
|
+
|
34
|
+
helpers.assert.documentHTMLEqual = (trixDocument, html) ->
|
35
|
+
@equal helpers.getHTML(trixDocument), html
|
36
|
+
|
37
|
+
helpers.getHTML = (trixDocument) ->
|
38
|
+
Trix.DocumentView.render(trixDocument).innerHTML
|
@@ -0,0 +1,37 @@
|
|
1
|
+
helpers = Trix.TestHelpers
|
2
|
+
|
3
|
+
helpers.extend
|
4
|
+
insertString: (string) ->
|
5
|
+
getComposition().insertString(string)
|
6
|
+
render()
|
7
|
+
|
8
|
+
insertText: (text) ->
|
9
|
+
getComposition().insertText(text)
|
10
|
+
render()
|
11
|
+
|
12
|
+
insertDocument: (document) ->
|
13
|
+
getComposition().insertDocument(document)
|
14
|
+
render()
|
15
|
+
|
16
|
+
insertFile: (file) ->
|
17
|
+
getComposition().insertFile(file)
|
18
|
+
render()
|
19
|
+
|
20
|
+
insertImageAttachment: (attributes) ->
|
21
|
+
attributes ?=
|
22
|
+
url: TEST_IMAGE_URL
|
23
|
+
width: 10
|
24
|
+
height: 10
|
25
|
+
filename: "image.gif"
|
26
|
+
contentType: "image/gif"
|
27
|
+
|
28
|
+
attachment = new Trix.Attachment attributes
|
29
|
+
text = Trix.Text.textForAttachmentWithAttributes(attachment)
|
30
|
+
helpers.insertText(text)
|
31
|
+
|
32
|
+
replaceDocument: (document) ->
|
33
|
+
getComposition().setDocument(document)
|
34
|
+
render()
|
35
|
+
|
36
|
+
render = ->
|
37
|
+
getEditorController().render()
|
@@ -0,0 +1 @@
|
|
1
|
+
<trix-editor autofocus placeholder="Say hello..."></trix-editor>
|
data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_toolbar_and_input.jst.eco
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
<ul id="my_editor">
|
2
|
+
<li><trix-toolbar id="my_toolbar"></trix-toolbar></li>
|
3
|
+
<li><trix-editor toolbar="my_toolbar" input="my_input" autofocus placeholder="Say hello..."></trix-editor></li>
|
4
|
+
<li><input id="my_input" type="hidden" value="<div>Hello world</div>"></li>
|
5
|
+
</ul>
|
@@ -0,0 +1,536 @@
|
|
1
|
+
{classNames} = Trix.config.css
|
2
|
+
|
3
|
+
@TEST_IMAGE_URL = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs="
|
4
|
+
|
5
|
+
createDocument = (parts...) ->
|
6
|
+
blocks = for part in parts
|
7
|
+
[string, textAttributes, blockAttributes] = part
|
8
|
+
text = Trix.Text.textForStringWithAttributes(string, textAttributes)
|
9
|
+
new Trix.Block text, blockAttributes
|
10
|
+
new Trix.Document blocks
|
11
|
+
|
12
|
+
blockComment = "<!--block-->"
|
13
|
+
|
14
|
+
cursorTarget = Trix.makeElement(
|
15
|
+
tagName: "span"
|
16
|
+
textContent: Trix.ZERO_WIDTH_SPACE
|
17
|
+
data: trixSelection: true, trixCursorTarget: true, trixSerialize: false
|
18
|
+
).outerHTML
|
19
|
+
|
20
|
+
removeWhitespace = (string) ->
|
21
|
+
string.replace(/\s/g, "")
|
22
|
+
|
23
|
+
@fixtures =
|
24
|
+
"bold text":
|
25
|
+
document: createDocument(["abc", bold: true])
|
26
|
+
html: "<div>#{blockComment}<strong>abc</strong></div>"
|
27
|
+
serializedHTML: "<div><strong>abc</strong></div>"
|
28
|
+
|
29
|
+
"bold, italic text":
|
30
|
+
document: createDocument(["abc", bold: true, italic: true])
|
31
|
+
html: "<div>#{blockComment}<strong><em>abc</em></strong></div>"
|
32
|
+
|
33
|
+
"text with newline":
|
34
|
+
document: createDocument(["ab\nc"])
|
35
|
+
html: "<div>#{blockComment}ab<br>c</div>"
|
36
|
+
|
37
|
+
"text with link":
|
38
|
+
document: createDocument(["abc", href: "http://example.com"])
|
39
|
+
html: """<div>#{blockComment}<a href="http://example.com">abc</a></div>"""
|
40
|
+
|
41
|
+
"text with link and formatting":
|
42
|
+
document: createDocument(["abc", italic: true, href: "http://example.com"])
|
43
|
+
html: """<div>#{blockComment}<a href="http://example.com"><em>abc</em></a></div>"""
|
44
|
+
|
45
|
+
"partially formatted link":
|
46
|
+
document: new Trix.Document [
|
47
|
+
new Trix.Block new Trix.Text [
|
48
|
+
new Trix.StringPiece "ab", href: "http://example.com"
|
49
|
+
new Trix.StringPiece "c", href: "http://example.com", italic: true
|
50
|
+
]
|
51
|
+
]
|
52
|
+
html: """<div>#{blockComment}<a href="http://example.com">ab<em>c</em></a></div>"""
|
53
|
+
|
54
|
+
"spaces 1":
|
55
|
+
document: createDocument([" a"])
|
56
|
+
html: """<div>#{blockComment} a</div>"""
|
57
|
+
|
58
|
+
"spaces 2":
|
59
|
+
document: createDocument([" a"])
|
60
|
+
html: """<div>#{blockComment} a</div>"""
|
61
|
+
|
62
|
+
"spaces 3":
|
63
|
+
document: createDocument([" a"])
|
64
|
+
html: """<div>#{blockComment} a</div>"""
|
65
|
+
|
66
|
+
"spaces 4":
|
67
|
+
document: createDocument([" a "])
|
68
|
+
html: """<div>#{blockComment} a </div>"""
|
69
|
+
|
70
|
+
"spaces 5":
|
71
|
+
document: createDocument(["a b"])
|
72
|
+
html: """<div>#{blockComment}a b</div>"""
|
73
|
+
|
74
|
+
"spaces 6":
|
75
|
+
document: createDocument(["a b"])
|
76
|
+
html: """<div>#{blockComment}a b</div>"""
|
77
|
+
|
78
|
+
"spaces 7":
|
79
|
+
document: createDocument(["a b"])
|
80
|
+
html: """<div>#{blockComment}a b</div>"""
|
81
|
+
|
82
|
+
"spaces 8":
|
83
|
+
document: createDocument(["a b "])
|
84
|
+
html: """<div>#{blockComment}a b </div>"""
|
85
|
+
|
86
|
+
"spaces 9":
|
87
|
+
document: createDocument(["a b c"])
|
88
|
+
html: """<div>#{blockComment}a b c</div>"""
|
89
|
+
|
90
|
+
"spaces 10":
|
91
|
+
document: createDocument(["a "])
|
92
|
+
html: """<div>#{blockComment}a </div>"""
|
93
|
+
|
94
|
+
"spaces 11":
|
95
|
+
document: createDocument(["a "])
|
96
|
+
html: """<div>#{blockComment}a </div>"""
|
97
|
+
|
98
|
+
"spaces and formatting":
|
99
|
+
document: new Trix.Document [
|
100
|
+
new Trix.Block new Trix.Text [
|
101
|
+
new Trix.StringPiece " a "
|
102
|
+
new Trix.StringPiece "b", href: "http://b.com"
|
103
|
+
new Trix.StringPiece " "
|
104
|
+
new Trix.StringPiece "c", bold: true
|
105
|
+
new Trix.StringPiece " d"
|
106
|
+
new Trix.StringPiece " e ", italic: true
|
107
|
+
new Trix.StringPiece " f "
|
108
|
+
]
|
109
|
+
]
|
110
|
+
html: """<div>#{blockComment} a <a href="http://b.com">b</a> <strong>c</strong> d<em> e </em> f </div>"""
|
111
|
+
|
112
|
+
"quote formatted block":
|
113
|
+
document: createDocument(["abc", {}, ["quote"]])
|
114
|
+
html: "<blockquote>#{blockComment}abc</blockquote>"
|
115
|
+
|
116
|
+
"code formatted block":
|
117
|
+
document: createDocument(["123", {}, ["code"]])
|
118
|
+
html: "<pre>#{blockComment}123</pre>"
|
119
|
+
|
120
|
+
"code with newline":
|
121
|
+
document: createDocument(["12\n3", {}, ["code"]])
|
122
|
+
html: "<pre>#{blockComment}12\n3</pre>"
|
123
|
+
|
124
|
+
"multiple blocks with block comments in their text":
|
125
|
+
document: createDocument(["a#{blockComment}b", {}, ["quote"]], ["#{blockComment}c", {}, ["code"]])
|
126
|
+
html: "<blockquote>#{blockComment}a<!--block-->b</blockquote><pre>#{blockComment}<!--block-->c</pre>"
|
127
|
+
serializedHTML: "<blockquote>a<!--block-->b</blockquote><pre><!--block-->c</pre>"
|
128
|
+
|
129
|
+
"unordered list with one item":
|
130
|
+
document: createDocument(["a", {}, ["bulletList", "bullet"]])
|
131
|
+
html: "<ul><li>#{blockComment}a</li></ul>"
|
132
|
+
|
133
|
+
"unordered list with bold text":
|
134
|
+
document: createDocument(["a", { bold: true }, ["bulletList", "bullet"]])
|
135
|
+
html: "<ul><li>#{blockComment}<strong>a</strong></li></ul>"
|
136
|
+
|
137
|
+
"unordered list with partially formatted text":
|
138
|
+
document: new Trix.Document [
|
139
|
+
new Trix.Block(
|
140
|
+
new Trix.Text([
|
141
|
+
new Trix.StringPiece("a")
|
142
|
+
new Trix.StringPiece("b", italic: true)
|
143
|
+
]),
|
144
|
+
["bulletList", "bullet"]
|
145
|
+
)
|
146
|
+
]
|
147
|
+
html: "<ul><li>#{blockComment}a<em>b</em></li></ul>"
|
148
|
+
|
149
|
+
"unordered list with two items":
|
150
|
+
document: createDocument(["a", {}, ["bulletList", "bullet"]], ["b", {}, ["bulletList", "bullet"]])
|
151
|
+
html: "<ul><li>#{blockComment}a</li><li>#{blockComment}b</li></ul>"
|
152
|
+
|
153
|
+
"unordered list surrounded by unformatted blocks":
|
154
|
+
document: createDocument(["a"], ["b", {}, ["bulletList", "bullet"]], ["c"])
|
155
|
+
html: "<div>#{blockComment}a</div><ul><li>#{blockComment}b</li></ul><div>#{blockComment}c</div>"
|
156
|
+
|
157
|
+
"ordered list":
|
158
|
+
document: createDocument(["a", {}, ["numberList", "number"]])
|
159
|
+
html: "<ol><li>#{blockComment}a</li></ol>"
|
160
|
+
|
161
|
+
"ordered list and an unordered list":
|
162
|
+
document: createDocument(["a", {}, ["bulletList", "bullet"]], ["b", {}, ["numberList", "number"]])
|
163
|
+
html: "<ul><li>#{blockComment}a</li></ul><ol><li>#{blockComment}b</li></ol>"
|
164
|
+
|
165
|
+
"empty block with attributes":
|
166
|
+
document: createDocument(["", {}, ["quote"]])
|
167
|
+
html: "<blockquote>#{blockComment}<br></blockquote>"
|
168
|
+
|
169
|
+
"image attachment": do ->
|
170
|
+
attrs = url: TEST_IMAGE_URL, filename: "example.png", filesize: 98203, contentType: "image/png", width: 1, height: 1
|
171
|
+
attachment = new Trix.Attachment attrs
|
172
|
+
text = Trix.Text.textForAttachmentWithAttributes(attachment)
|
173
|
+
|
174
|
+
image = Trix.makeElement("img", src: attrs.url, "data-trix-mutable": true, width: 1, height: 1)
|
175
|
+
image.dataset.trixStoreKey = ["imageElement", attachment.id, image.src, image.width, image.height].join("/")
|
176
|
+
|
177
|
+
caption = Trix.makeElement(tagName: "figcaption", className: classNames.attachment.caption)
|
178
|
+
caption.innerHTML = """#{attrs.filename} <span class="#{classNames.attachment.size}">95.9 KB</span>"""
|
179
|
+
|
180
|
+
figure = Trix.makeElement
|
181
|
+
tagName: "figure"
|
182
|
+
className: "attachment attachment-preview png"
|
183
|
+
|
184
|
+
data =
|
185
|
+
trixAttachment: JSON.stringify(attachment)
|
186
|
+
trixContentType: "image/png"
|
187
|
+
trixId: attachment.id
|
188
|
+
|
189
|
+
figure.dataset[key] = value for key, value of data
|
190
|
+
figure.setAttribute("contenteditable", false)
|
191
|
+
figure.appendChild(image)
|
192
|
+
figure.appendChild(caption)
|
193
|
+
|
194
|
+
serializedFigure = figure.cloneNode(true)
|
195
|
+
for attribute in ["data-trix-id", "data-trix-mutable", "data-trix-store-key", "contenteditable"]
|
196
|
+
serializedFigure.removeAttribute(attribute)
|
197
|
+
for element in serializedFigure.querySelectorAll("[#{attribute}]")
|
198
|
+
element.removeAttribute(attribute)
|
199
|
+
|
200
|
+
html: "<div>#{blockComment}#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"
|
201
|
+
serializedHTML: "<div>#{serializedFigure.outerHTML}</div>"
|
202
|
+
document: new Trix.Document [new Trix.Block text]
|
203
|
+
|
204
|
+
"text with newlines and image attachment": do ->
|
205
|
+
stringText = Trix.Text.textForStringWithAttributes("a\nb")
|
206
|
+
|
207
|
+
attrs = url: TEST_IMAGE_URL, filename: "example.png", filesize: 98203, contentType: "image/png", width: 1, height: 1
|
208
|
+
attachment = new Trix.Attachment attrs
|
209
|
+
attachmentText = Trix.Text.textForAttachmentWithAttributes(attachment)
|
210
|
+
|
211
|
+
image = Trix.makeElement("img", src: attrs.url, "data-trix-mutable": true, width: 1, height: 1)
|
212
|
+
image.dataset.trixStoreKey = ["imageElement", attachment.id, image.src, image.width, image.height].join("/")
|
213
|
+
|
214
|
+
caption = Trix.makeElement(tagName: "figcaption", className: classNames.attachment.caption)
|
215
|
+
caption.innerHTML = """#{attrs.filename} <span class="#{classNames.attachment.size}">95.9 KB</span>"""
|
216
|
+
|
217
|
+
figure = Trix.makeElement
|
218
|
+
tagName: "figure"
|
219
|
+
className: "attachment attachment-preview png"
|
220
|
+
|
221
|
+
data =
|
222
|
+
trixAttachment: JSON.stringify(attachment)
|
223
|
+
trixContentType: "image/png"
|
224
|
+
trixId: attachment.id
|
225
|
+
|
226
|
+
figure.dataset[key] = value for key, value of data
|
227
|
+
figure.setAttribute("contenteditable", false)
|
228
|
+
figure.appendChild(image)
|
229
|
+
figure.appendChild(caption)
|
230
|
+
|
231
|
+
serializedFigure = figure.cloneNode(true)
|
232
|
+
for attribute in ["data-trix-id", "data-trix-mutable", "data-trix-store-key", "contenteditable"]
|
233
|
+
serializedFigure.removeAttribute(attribute)
|
234
|
+
for element in serializedFigure.querySelectorAll("[#{attribute}]")
|
235
|
+
element.removeAttribute(attribute)
|
236
|
+
|
237
|
+
text = stringText.appendText(attachmentText)
|
238
|
+
|
239
|
+
html: "<div>#{blockComment}a<br>b#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"
|
240
|
+
serializedHTML: "<div>a<br>b#{serializedFigure.outerHTML}</div>"
|
241
|
+
document: new Trix.Document [new Trix.Block text]
|
242
|
+
|
243
|
+
"image attachment with edited caption": do ->
|
244
|
+
attrs = url: TEST_IMAGE_URL, filename: "example.png", filesize: 123, contentType: "image/png", width: 1, height: 1
|
245
|
+
attachment = new Trix.Attachment attrs
|
246
|
+
textAttrs = caption: "Example"
|
247
|
+
text = Trix.Text.textForAttachmentWithAttributes(attachment, textAttrs)
|
248
|
+
|
249
|
+
image = Trix.makeElement("img", src: attrs.url, "data-trix-mutable": true, width: 1, height: 1)
|
250
|
+
image.dataset.trixStoreKey = ["imageElement", attachment.id, image.src, image.width, image.height].join("/")
|
251
|
+
|
252
|
+
caption = Trix.makeElement(tagName: "figcaption", className: "#{classNames.attachment.caption} #{classNames.attachment.captionEdited}", textContent: "Example")
|
253
|
+
|
254
|
+
figure = Trix.makeElement
|
255
|
+
tagName: "figure"
|
256
|
+
className: "attachment attachment-preview png"
|
257
|
+
|
258
|
+
data =
|
259
|
+
trixAttachment: JSON.stringify(attachment)
|
260
|
+
trixContentType: "image/png"
|
261
|
+
trixId: attachment.id
|
262
|
+
trixAttributes: JSON.stringify(textAttrs)
|
263
|
+
|
264
|
+
figure.dataset[key] = value for key, value of data
|
265
|
+
figure.setAttribute("contenteditable", false)
|
266
|
+
figure.appendChild(image)
|
267
|
+
figure.appendChild(caption)
|
268
|
+
|
269
|
+
html: "<div>#{blockComment}#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"
|
270
|
+
document: new Trix.Document [new Trix.Block text]
|
271
|
+
|
272
|
+
"file attachment": do ->
|
273
|
+
attrs = href: "http://example.com/example.pdf", filename: "example.pdf", filesize: 34038769, contentType: "application/pdf"
|
274
|
+
attachment = new Trix.Attachment attrs
|
275
|
+
text = Trix.Text.textForAttachmentWithAttributes(attachment)
|
276
|
+
|
277
|
+
figure = Trix.makeElement
|
278
|
+
tagName: "figure"
|
279
|
+
className: "attachment attachment-file pdf"
|
280
|
+
|
281
|
+
data =
|
282
|
+
trixAttachment: JSON.stringify(attachment)
|
283
|
+
trixContentType: "application/pdf"
|
284
|
+
trixId: attachment.id
|
285
|
+
|
286
|
+
link = Trix.makeElement("a", href: attrs.href)
|
287
|
+
link.dataset[key] = value for key, value of data
|
288
|
+
link.setAttribute("contenteditable", false)
|
289
|
+
link.appendChild(figure)
|
290
|
+
|
291
|
+
caption = """<figcaption class="#{classNames.attachment.caption}">#{attrs.filename} <span class="#{classNames.attachment.size}">32.46 MB</span></figcaption>"""
|
292
|
+
figure.innerHTML = caption
|
293
|
+
|
294
|
+
html: """<div>#{blockComment}#{cursorTarget}#{link.outerHTML}#{cursorTarget}</div>"""
|
295
|
+
document: new Trix.Document [new Trix.Block text]
|
296
|
+
|
297
|
+
"pending file attachment": do ->
|
298
|
+
attrs = filename: "example.pdf", filesize: 34038769, contentType: "application/pdf"
|
299
|
+
attachment = new Trix.Attachment attrs
|
300
|
+
attachment.file = {}
|
301
|
+
text = Trix.Text.textForAttachmentWithAttributes(attachment)
|
302
|
+
|
303
|
+
figure = Trix.makeElement
|
304
|
+
tagName: "figure"
|
305
|
+
className: "attachment attachment-file pdf"
|
306
|
+
|
307
|
+
data =
|
308
|
+
trixAttachment: JSON.stringify(attachment)
|
309
|
+
trixContentType: "application/pdf"
|
310
|
+
trixId: attachment.id
|
311
|
+
trixSerialize: false
|
312
|
+
|
313
|
+
figure.dataset[key] = value for key, value of data
|
314
|
+
figure.setAttribute("contenteditable", false)
|
315
|
+
|
316
|
+
progress = Trix.makeElement
|
317
|
+
tagName: "progress"
|
318
|
+
attributes:
|
319
|
+
class: "progress"
|
320
|
+
value: 0
|
321
|
+
max: 100
|
322
|
+
data:
|
323
|
+
trixMutable: true
|
324
|
+
trixStoreKey: ["progressElement", attachment.id].join("/")
|
325
|
+
|
326
|
+
caption = """<figcaption class="#{classNames.attachment.caption}">#{attrs.filename} <span class="#{classNames.attachment.size}">32.46 MB</span></figcaption>"""
|
327
|
+
figure.innerHTML = caption + progress.outerHTML
|
328
|
+
|
329
|
+
html: """<div>#{blockComment}#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"""
|
330
|
+
document: new Trix.Document [new Trix.Block text]
|
331
|
+
|
332
|
+
"content attachment": do ->
|
333
|
+
content = """<blockquote class="twitter-tweet" data-cards="hidden"><p>ruby-build 20150413 is out, with definitions for 2.2.2, 2.1.6, and 2.0.0-p645 to address recent security issues: <a href="https://t.co/YEwV6NtRD8">https://t.co/YEwV6NtRD8</a></p>— Sam Stephenson (@sstephenson) <a href="https://twitter.com/sstephenson/status/587715996783218688">April 13, 2015</a></blockquote>"""
|
334
|
+
href = "https://twitter.com/sstephenson/status/587715996783218688"
|
335
|
+
contentType = "embed/twitter"
|
336
|
+
|
337
|
+
attachment = new Trix.Attachment {content, contentType, href}
|
338
|
+
text = Trix.Text.textForAttachmentWithAttributes(attachment)
|
339
|
+
|
340
|
+
figure = Trix.makeElement
|
341
|
+
tagName: "figure"
|
342
|
+
className: "attachment attachment-content"
|
343
|
+
|
344
|
+
figure.innerHTML = content
|
345
|
+
|
346
|
+
caption = Trix.makeElement(tagName: "figcaption", className: classNames.attachment.caption)
|
347
|
+
figure.appendChild(caption)
|
348
|
+
|
349
|
+
data =
|
350
|
+
trixAttachment: JSON.stringify(attachment)
|
351
|
+
trixContentType: contentType
|
352
|
+
trixId: attachment.id
|
353
|
+
|
354
|
+
figure.dataset[key] = value for key, value of data
|
355
|
+
figure.setAttribute("contenteditable", false)
|
356
|
+
|
357
|
+
html: """<div>#{blockComment}#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"""
|
358
|
+
document: new Trix.Document [new Trix.Block text]
|
359
|
+
|
360
|
+
"nested quote and code formatted block":
|
361
|
+
document: createDocument(["ab3", {}, ["quote", "code"]])
|
362
|
+
html: "<blockquote><pre>#{blockComment}ab3</pre></blockquote>"
|
363
|
+
|
364
|
+
"nested code and quote formatted block":
|
365
|
+
document: createDocument(["ab3", {}, ["code", "quote"]])
|
366
|
+
html: "<pre><blockquote>#{blockComment}ab3</blockquote></pre>"
|
367
|
+
|
368
|
+
"nested code blocks in quote":
|
369
|
+
document: createDocument(
|
370
|
+
["a\n", {}, ["quote"]],
|
371
|
+
["b", {}, ["quote", "code"]],
|
372
|
+
["\nc\n", {}, ["quote"]],
|
373
|
+
["d", {}, ["quote", "code"]]
|
374
|
+
)
|
375
|
+
html: removeWhitespace """
|
376
|
+
<blockquote>
|
377
|
+
#{blockComment}
|
378
|
+
a
|
379
|
+
<br>
|
380
|
+
<br>
|
381
|
+
<pre>
|
382
|
+
#{blockComment}
|
383
|
+
b
|
384
|
+
</pre>
|
385
|
+
#{blockComment}
|
386
|
+
<br>
|
387
|
+
c
|
388
|
+
<br>
|
389
|
+
<br>
|
390
|
+
<pre>
|
391
|
+
#{blockComment}
|
392
|
+
d
|
393
|
+
</pre>
|
394
|
+
</blockquote>
|
395
|
+
"""
|
396
|
+
serializedHTML: removeWhitespace """
|
397
|
+
<blockquote>
|
398
|
+
a
|
399
|
+
<br>
|
400
|
+
<br>
|
401
|
+
<pre>
|
402
|
+
b
|
403
|
+
</pre>
|
404
|
+
<br>
|
405
|
+
c
|
406
|
+
<br>
|
407
|
+
<br>
|
408
|
+
<pre>
|
409
|
+
d
|
410
|
+
</pre>
|
411
|
+
</blockquote>
|
412
|
+
"""
|
413
|
+
|
414
|
+
"nested code, quote, and list in quote":
|
415
|
+
document: createDocument(
|
416
|
+
["a\n", {}, ["quote"]],
|
417
|
+
["b", {}, ["quote", "code"]],
|
418
|
+
["\nc\n", {}, ["quote"]],
|
419
|
+
["d", {}, ["quote", "quote"]],
|
420
|
+
["\ne\n", {}, ["quote"]],
|
421
|
+
["f", {}, ["quote", "bulletList", "bullet"]]
|
422
|
+
)
|
423
|
+
html: removeWhitespace """
|
424
|
+
<blockquote>
|
425
|
+
#{blockComment}
|
426
|
+
a
|
427
|
+
<br>
|
428
|
+
<br>
|
429
|
+
<pre>
|
430
|
+
#{blockComment}
|
431
|
+
b
|
432
|
+
</pre>
|
433
|
+
#{blockComment}
|
434
|
+
<br>
|
435
|
+
c
|
436
|
+
<br>
|
437
|
+
<br>
|
438
|
+
<blockquote>
|
439
|
+
#{blockComment}
|
440
|
+
d
|
441
|
+
</blockquote>
|
442
|
+
#{blockComment}
|
443
|
+
<br>
|
444
|
+
e
|
445
|
+
<br>
|
446
|
+
<br>
|
447
|
+
<ul>
|
448
|
+
<li>
|
449
|
+
#{blockComment}
|
450
|
+
f
|
451
|
+
</li>
|
452
|
+
</ul>
|
453
|
+
</blockquote>
|
454
|
+
"""
|
455
|
+
serializedHTML: removeWhitespace """
|
456
|
+
<blockquote>
|
457
|
+
a
|
458
|
+
<br>
|
459
|
+
<br>
|
460
|
+
<pre>
|
461
|
+
b
|
462
|
+
</pre>
|
463
|
+
<br>
|
464
|
+
c
|
465
|
+
<br>
|
466
|
+
<br>
|
467
|
+
<blockquote>
|
468
|
+
d
|
469
|
+
</blockquote>
|
470
|
+
<br>
|
471
|
+
e
|
472
|
+
<br>
|
473
|
+
<br>
|
474
|
+
<ul>
|
475
|
+
<li>
|
476
|
+
f
|
477
|
+
</li>
|
478
|
+
</ul>
|
479
|
+
</blockquote>
|
480
|
+
"""
|
481
|
+
|
482
|
+
"nested quote and list":
|
483
|
+
document: createDocument(["ab3", {}, ["quote", "bulletList", "bullet"]])
|
484
|
+
html: "<blockquote><ul><li>#{blockComment}ab3</li></ul></blockquote>"
|
485
|
+
|
486
|
+
"nested list and quote":
|
487
|
+
document: createDocument(["ab3", {}, ["bulletList", "bullet", "quote"]])
|
488
|
+
html: "<ul><li><blockquote>#{blockComment}ab3</blockquote></li></ul>"
|
489
|
+
|
490
|
+
"nested lists and quotes":
|
491
|
+
document: createDocument(["a", {}, ["bulletList", "bullet", "quote"]], ["b", {}, ["bulletList", "bullet", "quote"]])
|
492
|
+
html: "<ul><li><blockquote>#{blockComment}a</blockquote></li><li><blockquote>#{blockComment}b</blockquote></li></ul>"
|
493
|
+
|
494
|
+
"nested quote and list with two items":
|
495
|
+
document: createDocument(["a", {}, ["quote", "bulletList", "bullet"]], ["b", {}, ["quote", "bulletList", "bullet"]])
|
496
|
+
html: "<blockquote><ul><li>#{blockComment}a</li><li>#{blockComment}b</li></ul></blockquote>"
|
497
|
+
|
498
|
+
"nested unordered lists":
|
499
|
+
document: createDocument(["a", {}, ["bulletList", "bullet"]], ["b", {}, ["bulletList", "bullet", "bulletList", "bullet"]], ["c", {}, ["bulletList", "bullet", "bulletList", "bullet"]])
|
500
|
+
html: "<ul><li>#{blockComment}a<ul><li>#{blockComment}b</li><li>#{blockComment}c</li></ul></li></ul>"
|
501
|
+
|
502
|
+
"nested lists":
|
503
|
+
document: createDocument(["a", {}, ["numberList", "number"]], ["b", {}, ["numberList", "number", "bulletList", "bullet"]], ["c", {}, ["numberList", "number", "bulletList", "bullet"]])
|
504
|
+
html: "<ol><li>#{blockComment}a<ul><li>#{blockComment}b</li><li>#{blockComment}c</li></ul></li></ol>"
|
505
|
+
|
506
|
+
"blocks beginning with newlines":
|
507
|
+
document: createDocument(["\na", {}, ["quote"]], ["\nb", {}, []], ["\nc", {}, ["quote"]])
|
508
|
+
html: "<blockquote>#{blockComment}<br>a</blockquote><div>#{blockComment}<br>b</div><blockquote>#{blockComment}<br>c</blockquote>"
|
509
|
+
|
510
|
+
"blocks beginning with formatted text":
|
511
|
+
document: createDocument(["a", { bold: true }, ["quote"]], ["b", { italic: true }, []], ["c", { bold: true }, ["quote"]])
|
512
|
+
html: "<blockquote>#{blockComment}<strong>a</strong></blockquote><div>#{blockComment}<em>b</em></div><blockquote>#{blockComment}<strong>c</strong></blockquote>"
|
513
|
+
|
514
|
+
"text with newlines before block":
|
515
|
+
document: createDocument(["a\nb"], ["c", {}, ["quote"]])
|
516
|
+
html: "<div>#{blockComment}a<br>b</div><blockquote>#{blockComment}c</blockquote>"
|
517
|
+
|
518
|
+
"empty heading block":
|
519
|
+
document: createDocument(["", {}, ["heading1"]])
|
520
|
+
html: "<h1>#{blockComment}<br></h1>"
|
521
|
+
|
522
|
+
"two adjacent headings":
|
523
|
+
document: createDocument( ["a", {}, ["heading1"]], ["b", {}, ["heading1"]])
|
524
|
+
html: "<h1>#{blockComment}a</h1><h1>#{blockComment}b</h1>"
|
525
|
+
|
526
|
+
"heading in ordered list":
|
527
|
+
document: createDocument(["a", {}, ["numberList", "number", "heading1"]])
|
528
|
+
html: "<ol><li><h1>#{blockComment}a</h1></li></ol>"
|
529
|
+
|
530
|
+
"headings with formatted text":
|
531
|
+
document: createDocument(["a", { bold: true }, ["heading1"]], ["b", { italic: true, bold: true }, ["heading1"]])
|
532
|
+
html: "<h1>#{blockComment}<strong>a</strong></h1><h1>#{blockComment}<strong><em>b</em></strong></h1>"
|
533
|
+
|
534
|
+
@eachFixture = (callback) ->
|
535
|
+
for name, details of @fixtures
|
536
|
+
callback(name, details)
|