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,228 @@
|
|
1
|
+
(function (root) {
|
2
|
+
|
3
|
+
// Store setTimeout reference so promise-polyfill will be unaffected by
|
4
|
+
// other code modifying setTimeout (like sinon.useFakeTimers())
|
5
|
+
var setTimeoutFunc = setTimeout;
|
6
|
+
|
7
|
+
function noop() {
|
8
|
+
}
|
9
|
+
|
10
|
+
// Use polyfill for setImmediate for performance gains
|
11
|
+
var asap = (typeof setImmediate === 'function' && setImmediate) ||
|
12
|
+
function (fn) {
|
13
|
+
setTimeoutFunc(fn, 1);
|
14
|
+
};
|
15
|
+
|
16
|
+
var onUnhandledRejection = function onUnhandledRejection(err) {
|
17
|
+
if (typeof console !== 'undefined' && console) {
|
18
|
+
console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
// Polyfill for Function.prototype.bind
|
23
|
+
function bind(fn, thisArg) {
|
24
|
+
return function () {
|
25
|
+
fn.apply(thisArg, arguments);
|
26
|
+
};
|
27
|
+
}
|
28
|
+
|
29
|
+
function Promise(fn) {
|
30
|
+
if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');
|
31
|
+
if (typeof fn !== 'function') throw new TypeError('not a function');
|
32
|
+
this._state = 0;
|
33
|
+
this._handled = false;
|
34
|
+
this._value = undefined;
|
35
|
+
this._deferreds = [];
|
36
|
+
|
37
|
+
doResolve(fn, this);
|
38
|
+
}
|
39
|
+
|
40
|
+
function handle(self, deferred) {
|
41
|
+
while (self._state === 3) {
|
42
|
+
self = self._value;
|
43
|
+
}
|
44
|
+
if (self._state === 0) {
|
45
|
+
self._deferreds.push(deferred);
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
self._handled = true;
|
49
|
+
asap(function () {
|
50
|
+
var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
|
51
|
+
if (cb === null) {
|
52
|
+
(self._state === 1 ? resolve : reject)(deferred.promise, self._value);
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
var ret;
|
56
|
+
try {
|
57
|
+
ret = cb(self._value);
|
58
|
+
} catch (e) {
|
59
|
+
reject(deferred.promise, e);
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
resolve(deferred.promise, ret);
|
63
|
+
});
|
64
|
+
}
|
65
|
+
|
66
|
+
function resolve(self, newValue) {
|
67
|
+
try {
|
68
|
+
// Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
|
69
|
+
if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.');
|
70
|
+
if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
|
71
|
+
var then = newValue.then;
|
72
|
+
if (newValue instanceof Promise) {
|
73
|
+
self._state = 3;
|
74
|
+
self._value = newValue;
|
75
|
+
finale(self);
|
76
|
+
return;
|
77
|
+
} else if (typeof then === 'function') {
|
78
|
+
doResolve(bind(then, newValue), self);
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
self._state = 1;
|
83
|
+
self._value = newValue;
|
84
|
+
finale(self);
|
85
|
+
} catch (e) {
|
86
|
+
reject(self, e);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
function reject(self, newValue) {
|
91
|
+
self._state = 2;
|
92
|
+
self._value = newValue;
|
93
|
+
finale(self);
|
94
|
+
}
|
95
|
+
|
96
|
+
function finale(self) {
|
97
|
+
if (self._state === 2 && self._deferreds.length === 0) {
|
98
|
+
setTimeout(function() {
|
99
|
+
if (!self._handled) {
|
100
|
+
onUnhandledRejection(self._value);
|
101
|
+
}
|
102
|
+
}, 1);
|
103
|
+
}
|
104
|
+
|
105
|
+
for (var i = 0, len = self._deferreds.length; i < len; i++) {
|
106
|
+
handle(self, self._deferreds[i]);
|
107
|
+
}
|
108
|
+
self._deferreds = null;
|
109
|
+
}
|
110
|
+
|
111
|
+
function Handler(onFulfilled, onRejected, promise) {
|
112
|
+
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
|
113
|
+
this.onRejected = typeof onRejected === 'function' ? onRejected : null;
|
114
|
+
this.promise = promise;
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Take a potentially misbehaving resolver function and make sure
|
119
|
+
* onFulfilled and onRejected are only called once.
|
120
|
+
*
|
121
|
+
* Makes no guarantees about asynchrony.
|
122
|
+
*/
|
123
|
+
function doResolve(fn, self) {
|
124
|
+
var done = false;
|
125
|
+
try {
|
126
|
+
fn(function (value) {
|
127
|
+
if (done) return;
|
128
|
+
done = true;
|
129
|
+
resolve(self, value);
|
130
|
+
}, function (reason) {
|
131
|
+
if (done) return;
|
132
|
+
done = true;
|
133
|
+
reject(self, reason);
|
134
|
+
});
|
135
|
+
} catch (ex) {
|
136
|
+
if (done) return;
|
137
|
+
done = true;
|
138
|
+
reject(self, ex);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
Promise.prototype['catch'] = function (onRejected) {
|
143
|
+
return this.then(null, onRejected);
|
144
|
+
};
|
145
|
+
|
146
|
+
Promise.prototype.then = function (onFulfilled, onRejected) {
|
147
|
+
var prom = new Promise(noop);
|
148
|
+
handle(this, new Handler(onFulfilled, onRejected, prom));
|
149
|
+
return prom;
|
150
|
+
};
|
151
|
+
|
152
|
+
Promise.all = function (arr) {
|
153
|
+
var args = Array.prototype.slice.call(arr);
|
154
|
+
|
155
|
+
return new Promise(function (resolve, reject) {
|
156
|
+
if (args.length === 0) return resolve([]);
|
157
|
+
var remaining = args.length;
|
158
|
+
|
159
|
+
function res(i, val) {
|
160
|
+
try {
|
161
|
+
if (val && (typeof val === 'object' || typeof val === 'function')) {
|
162
|
+
var then = val.then;
|
163
|
+
if (typeof then === 'function') {
|
164
|
+
then.call(val, function (val) {
|
165
|
+
res(i, val);
|
166
|
+
}, reject);
|
167
|
+
return;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
args[i] = val;
|
171
|
+
if (--remaining === 0) {
|
172
|
+
resolve(args);
|
173
|
+
}
|
174
|
+
} catch (ex) {
|
175
|
+
reject(ex);
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
for (var i = 0; i < args.length; i++) {
|
180
|
+
res(i, args[i]);
|
181
|
+
}
|
182
|
+
});
|
183
|
+
};
|
184
|
+
|
185
|
+
Promise.resolve = function (value) {
|
186
|
+
if (value && typeof value === 'object' && value.constructor === Promise) {
|
187
|
+
return value;
|
188
|
+
}
|
189
|
+
|
190
|
+
return new Promise(function (resolve) {
|
191
|
+
resolve(value);
|
192
|
+
});
|
193
|
+
};
|
194
|
+
|
195
|
+
Promise.reject = function (value) {
|
196
|
+
return new Promise(function (resolve, reject) {
|
197
|
+
reject(value);
|
198
|
+
});
|
199
|
+
};
|
200
|
+
|
201
|
+
Promise.race = function (values) {
|
202
|
+
return new Promise(function (resolve, reject) {
|
203
|
+
for (var i = 0, len = values.length; i < len; i++) {
|
204
|
+
values[i].then(resolve, reject);
|
205
|
+
}
|
206
|
+
});
|
207
|
+
};
|
208
|
+
|
209
|
+
/**
|
210
|
+
* Set the immediate function to execute callbacks
|
211
|
+
* @param fn {function} Function to execute
|
212
|
+
* @private
|
213
|
+
*/
|
214
|
+
Promise._setImmediateFn = function _setImmediateFn(fn) {
|
215
|
+
asap = fn;
|
216
|
+
};
|
217
|
+
|
218
|
+
Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
|
219
|
+
onUnhandledRejection = fn;
|
220
|
+
};
|
221
|
+
|
222
|
+
if (typeof module !== 'undefined' && module.exports) {
|
223
|
+
module.exports = Promise;
|
224
|
+
} else if (!root.Promise) {
|
225
|
+
root.Promise = Promise;
|
226
|
+
}
|
227
|
+
|
228
|
+
})(this);
|
@@ -0,0 +1 @@
|
|
1
|
+
0.10.1
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Trix.config.blockAttributes = attributes =
|
2
|
+
default:
|
3
|
+
tagName: "div"
|
4
|
+
parse: false
|
5
|
+
quote:
|
6
|
+
tagName: "blockquote"
|
7
|
+
nestable: true
|
8
|
+
heading1:
|
9
|
+
tagName: "h1"
|
10
|
+
terminal: true
|
11
|
+
breakOnReturn: true
|
12
|
+
group: false
|
13
|
+
code:
|
14
|
+
tagName: "pre"
|
15
|
+
terminal: true
|
16
|
+
text:
|
17
|
+
plaintext: true
|
18
|
+
bulletList:
|
19
|
+
tagName: "ul"
|
20
|
+
parse: false
|
21
|
+
bullet:
|
22
|
+
tagName: "li"
|
23
|
+
listAttribute: "bulletList"
|
24
|
+
group: false
|
25
|
+
nestable: true
|
26
|
+
test: (element) ->
|
27
|
+
Trix.tagName(element.parentNode) is attributes[@listAttribute].tagName
|
28
|
+
numberList:
|
29
|
+
tagName: "ol"
|
30
|
+
parse: false
|
31
|
+
number:
|
32
|
+
tagName: "li"
|
33
|
+
listAttribute: "numberList"
|
34
|
+
group: false
|
35
|
+
nestable: true
|
36
|
+
test: (element) ->
|
37
|
+
Trix.tagName(element.parentNode) is attributes[@listAttribute].tagName
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Trix.config.css =
|
2
|
+
classNames:
|
3
|
+
attachment:
|
4
|
+
container: "attachment"
|
5
|
+
typePrefix: "attachment-"
|
6
|
+
caption: "caption"
|
7
|
+
captionEdited: "caption-edited"
|
8
|
+
captionEditor: "caption-editor"
|
9
|
+
editingCaption: "caption-editing"
|
10
|
+
progressBar: "progress"
|
11
|
+
removeButton: "remove icon"
|
12
|
+
size: "size"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#= require trix/config/lang
|
2
|
+
|
3
|
+
{lang} = Trix.config
|
4
|
+
sizes = [lang.bytes, lang.KB, lang.MB, lang.GB, lang.TB, lang.PB]
|
5
|
+
|
6
|
+
Trix.config.fileSize =
|
7
|
+
prefix: "IEC"
|
8
|
+
precision: 2
|
9
|
+
|
10
|
+
formatter: (number) ->
|
11
|
+
switch number
|
12
|
+
when 0 then "0 #{lang.bytes}"
|
13
|
+
when 1 then "1 #{lang.byte}"
|
14
|
+
else
|
15
|
+
base = switch @prefix
|
16
|
+
when "SI" then 1000
|
17
|
+
when "IEC" then 1024
|
18
|
+
exp = Math.floor(Math.log(number) / Math.log(base))
|
19
|
+
humanSize = number / Math.pow(base, exp)
|
20
|
+
string = humanSize.toFixed(@precision)
|
21
|
+
withoutInsignificantZeros = string.replace(/0*$/, "").replace(/\.$/, "")
|
22
|
+
"#{withoutInsignificantZeros} #{sizes[exp]}"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#= require trix/config/lang
|
2
|
+
#= require trix/config/css
|
3
|
+
#= require trix/config/block_attributes
|
4
|
+
#= require trix/config/file_size_formatting
|
5
|
+
#= require trix/config/text_attributes
|
6
|
+
#= require trix/config/serialization
|
7
|
+
#= require trix/config/toolbar
|
8
|
+
#= require trix/config/undo_interval
|
9
|
+
#= require trix/config/selection_elements
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Trix.config.lang =
|
2
|
+
bold: "Bold"
|
3
|
+
bullets: "Bullets"
|
4
|
+
byte: "Byte"
|
5
|
+
bytes: "Bytes"
|
6
|
+
captionPlaceholder: "Type a caption here…"
|
7
|
+
captionPrompt: "Add a caption…"
|
8
|
+
code: "Code"
|
9
|
+
heading1: "Heading"
|
10
|
+
indent: "Increase Level"
|
11
|
+
italic: "Italic"
|
12
|
+
link: "Link"
|
13
|
+
numbers: "Numbers"
|
14
|
+
outdent: "Decrease Level"
|
15
|
+
quote: "Quote"
|
16
|
+
redo: "Redo"
|
17
|
+
remove: "Remove"
|
18
|
+
strike: "Strikethrough"
|
19
|
+
undo: "Undo"
|
20
|
+
unlink: "Unlink"
|
21
|
+
urlPlaceholder: "Enter a URL…"
|
22
|
+
GB: "GB"
|
23
|
+
KB: "KB"
|
24
|
+
MB: "MB"
|
25
|
+
PB: "PB"
|
26
|
+
TB: "TB"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{makeElement} = Trix
|
2
|
+
|
3
|
+
prototypes =
|
4
|
+
cursorTarget:
|
5
|
+
makeElement
|
6
|
+
tagName: "span"
|
7
|
+
textContent: Trix.ZERO_WIDTH_SPACE
|
8
|
+
data:
|
9
|
+
trixSelection: true
|
10
|
+
trixCursorTarget: true
|
11
|
+
trixSerialize: false
|
12
|
+
|
13
|
+
Trix.extend
|
14
|
+
selectionElements:
|
15
|
+
selector: "[data-trix-selection]"
|
16
|
+
|
17
|
+
cssText: """
|
18
|
+
font-size: 0 !important;
|
19
|
+
padding: 0 !important;
|
20
|
+
margin: 0 !important;
|
21
|
+
border: none !important;
|
22
|
+
line-height: 0 !important;
|
23
|
+
"""
|
24
|
+
|
25
|
+
create: (name) ->
|
26
|
+
prototypes[name].cloneNode(true)
|
@@ -0,0 +1,63 @@
|
|
1
|
+
unserializableElementSelector = "[data-trix-serialize=false]"
|
2
|
+
unserializableAttributeNames = ["contenteditable", "data-trix-id", "data-trix-store-key", "data-trix-mutable"]
|
3
|
+
serializedAttributesAttribute = "data-trix-serialized-attributes"
|
4
|
+
serializedAttributesSelector = "[#{serializedAttributesAttribute}]"
|
5
|
+
|
6
|
+
blockCommentPattern = new RegExp("<!--block-->", "g")
|
7
|
+
|
8
|
+
Trix.extend
|
9
|
+
serializers:
|
10
|
+
"application/json": (serializable) ->
|
11
|
+
if serializable instanceof Trix.Document
|
12
|
+
document = serializable
|
13
|
+
else if serializable instanceof HTMLElement
|
14
|
+
document = Trix.Document.fromHTML(serializable.innerHTML)
|
15
|
+
else
|
16
|
+
throw new Error "unserializable object"
|
17
|
+
|
18
|
+
document.toSerializableDocument().toJSONString()
|
19
|
+
|
20
|
+
"text/html": (serializable) ->
|
21
|
+
if serializable instanceof Trix.Document
|
22
|
+
element = Trix.DocumentView.render(serializable)
|
23
|
+
else if serializable instanceof HTMLElement
|
24
|
+
element = serializable.cloneNode(true)
|
25
|
+
else
|
26
|
+
throw new Error "unserializable object"
|
27
|
+
|
28
|
+
# Remove unserializable elements
|
29
|
+
for el in element.querySelectorAll(unserializableElementSelector)
|
30
|
+
el.parentNode.removeChild(el)
|
31
|
+
|
32
|
+
# Remove unserializable attributes
|
33
|
+
for attribute in unserializableAttributeNames
|
34
|
+
for el in element.querySelectorAll("[#{attribute}]")
|
35
|
+
el.removeAttribute(attribute)
|
36
|
+
|
37
|
+
# Rewrite elements with serialized attribute overrides
|
38
|
+
for el in element.querySelectorAll(serializedAttributesSelector) then try
|
39
|
+
attributes = JSON.parse(el.getAttribute(serializedAttributesAttribute))
|
40
|
+
el.removeAttribute(serializedAttributesAttribute)
|
41
|
+
for name, value of attributes
|
42
|
+
el.setAttribute(name, value)
|
43
|
+
|
44
|
+
element.innerHTML.replace(blockCommentPattern, "")
|
45
|
+
|
46
|
+
deserializers:
|
47
|
+
"application/json": (string) ->
|
48
|
+
Trix.Document.fromJSONString(string)
|
49
|
+
|
50
|
+
"text/html": (string) ->
|
51
|
+
Trix.Document.fromHTML(string)
|
52
|
+
|
53
|
+
serializeToContentType: (serializable, contentType) ->
|
54
|
+
if serializer = Trix.serializers[contentType]
|
55
|
+
serializer(serializable)
|
56
|
+
else
|
57
|
+
throw new Error "unknown content type: #{contentType}"
|
58
|
+
|
59
|
+
deserializeFromContentType: (string, contentType) ->
|
60
|
+
if deserializer = Trix.deserializers[contentType]
|
61
|
+
deserializer(string)
|
62
|
+
else
|
63
|
+
throw new Error "unknown content type: #{contentType}"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Trix.config.textAttributes =
|
2
|
+
bold:
|
3
|
+
tagName: "strong"
|
4
|
+
inheritable: true
|
5
|
+
parser: (element) ->
|
6
|
+
style = window.getComputedStyle(element)
|
7
|
+
style["fontWeight"] is "bold" or style["fontWeight"] >= 600
|
8
|
+
italic:
|
9
|
+
tagName: "em"
|
10
|
+
inheritable: true
|
11
|
+
parser: (element) ->
|
12
|
+
style = window.getComputedStyle(element)
|
13
|
+
style["fontStyle"] is "italic"
|
14
|
+
href:
|
15
|
+
groupTagName: "a"
|
16
|
+
parser: (element) ->
|
17
|
+
{attachmentSelector} = Trix.AttachmentView
|
18
|
+
matchingSelector = "a:not(#{attachmentSelector})"
|
19
|
+
if link = Trix.findClosestElementFromNode(element, {matchingSelector})
|
20
|
+
link.getAttribute("href")
|
21
|
+
strike:
|
22
|
+
tagName: "del"
|
23
|
+
inheritable: true
|
24
|
+
frozen:
|
25
|
+
style: { "backgroundColor": "highlight" }
|