mosaico 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +7 -0
- data/LICENSE +680 -0
- data/README.md +179 -0
- data/Rakefile +5 -0
- data/app/assets/images/mosaico/logo_transparent.png +0 -0
- data/app/assets/javascripts/mosaico/application.js.erb +51 -0
- data/app/assets/javascripts/mosaico/plugins/debug.js.erb +10 -0
- data/app/assets/javascripts/mosaico/plugins/logo.js.erb +10 -0
- data/app/assets/javascripts/mosaico/plugins/preview.js +85 -0
- data/app/assets/javascripts/mosaico/plugins/save.js.erb +72 -0
- data/app/assets/javascripts/mosaico/plugins/template_path.js.erb +22 -0
- data/app/assets/javascripts/mosaico/plugins/translations.js +10 -0
- data/app/assets/javascripts/mosaico/utilities.js +25 -0
- data/app/assets/stylesheets/mosaico/application.css +6 -0
- data/app/controllers/mosaico/application_controller.rb +17 -0
- data/app/controllers/mosaico/images_controller.rb +142 -0
- data/app/controllers/mosaico/projects_controller.rb +31 -0
- data/app/controllers/mosaico/templates_controller.rb +8 -0
- data/app/helpers/mosaico/application_helper.rb +7 -0
- data/app/models/mosaico/image.rb +9 -0
- data/app/models/mosaico/placeholder_image.rb +9 -0
- data/app/models/mosaico/project.rb +13 -0
- data/app/models/mosaico/uploaded_image.rb +26 -0
- data/app/views/layouts/mosaico/application.html.erb +13 -0
- data/app/views/mosaico/projects/new.html.erb +1 -0
- data/app/views/mosaico/projects/show.html.erb +1 -0
- data/app/views/mosaico/shared/_metadata.html.erb +12 -0
- data/config/routes.rb +12 -0
- data/db/migrate/20170817202255_add_images.rb +14 -0
- data/db/migrate/20170824233755_add_projects.rb +11 -0
- data/lib/mosaico.rb +100 -0
- data/lib/mosaico/engine.rb +72 -0
- data/lib/mosaico/local_backend.rb +23 -0
- data/lib/mosaico/local_image_backend.rb +7 -0
- data/lib/mosaico/local_placeholder_backend.rb +7 -0
- data/lib/mosaico/placeholder.png +0 -0
- data/lib/mosaico/template.rb +89 -0
- data/lib/mosaico/versafix_template.rb +43 -0
- data/lib/mosaico/version.rb +4 -0
- data/lib/tasks/makeThumbs.js.erb +57 -0
- data/lib/tasks/thumbs.rake +35 -0
- data/mosaico.gemspec +22 -0
- data/screenshot.png +0 -0
- data/vendor/assets/fonts/LiberationSans-Regular.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.jsbeautifyrc +6 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.jshintrc +8 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.travis.yml +6 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/CONTRIBUTING.md +37 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/Dockerfile +21 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/Gruntfile.js +241 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/LICENSE +680 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/NOTICE.txt +87 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/README.md +73 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/backend/README.txt +23 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/backend/main.js +162 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/bower.json +76 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico-material.css +7425 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.css +7133 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.debug.js +1517 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.js +12828 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/templates.js +15 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.svg +685 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/byvoxmail.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico-badge.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico-v.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico32.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaicologo.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/screenshot-orig.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/screenshot.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/README.md +26 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-de.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-en.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-es.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-fr.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-it.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-nl.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-sv.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico-material.min.css +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico-material.min.css.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.css +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.css.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.js +1517 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.js.map +147 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/canvas-to-blob.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery-ui.min.css +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery-ui.min.js +13 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-image.js +324 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-process.js +175 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-validate.js +122 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload.js +1482 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.iframe-transport.js +217 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.min.js +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.min.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.ui.touch-punch.min.js +11 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/knockout-jqueryui.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/knockout.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/load-image.all.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/stylesheet.css +9 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/advlist/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/advlist/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/anchor/plugin.js +55 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/anchor/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autolink/plugin.js +204 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autolink/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autoresize/plugin.js +162 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autoresize/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autosave/plugin.js +165 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autosave/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/bbcode/plugin.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/bbcode/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/charmap/plugin.js +462 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/charmap/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js +60 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/css/prism.css +138 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/plugin.js +1319 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/colorpicker/plugin.js +112 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/colorpicker/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/contextmenu/plugin.js +100 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/contextmenu/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/directionality/plugin.js +64 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/directionality/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js +65 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullpage/plugin.js +490 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullpage/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullscreen/plugin.js +154 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullscreen/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/hr/plugin.js +30 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/hr/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/image/plugin.js +630 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/image/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/imagetools/plugin.js +2944 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/imagetools/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/importcss/plugin.js +273 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/importcss/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/insertdatetime/plugin.js +121 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/insertdatetime/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/layer/plugin.js +225 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/layer/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/legacyoutput/plugin.js +208 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/legacyoutput/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/link/plugin.js +403 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/link/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/lists/plugin.js +965 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/lists/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/moxieplayer.swf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/plugin.js +879 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/nonbreaking/plugin.js +53 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/nonbreaking/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/noneditable/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/noneditable/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/pagebreak/plugin.js +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/pagebreak/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/paste/plugin.js +1844 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/paste/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/preview/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/preview/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/print/plugin.js +32 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/print/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/save/plugin.js +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/save/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/searchreplace/plugin.js +609 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/searchreplace/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/spellchecker/plugin.js +1031 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/spellchecker/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/tabfocus/plugin.js +120 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/tabfocus/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/table/plugin.js +4400 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/table/plugin.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/template/plugin.js +276 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/template/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textcolor/plugin.js +297 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textcolor/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textpattern/plugin.js +268 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textpattern/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/css/visualblocks.css +135 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/plugin.js +86 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualchars/plugin.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualchars/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/wordcount/plugin.js +69 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/wordcount/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/Variables.less +196 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/readme.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.json +1277 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.json +1972 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.svg +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.json +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.svg +129 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/inlite/theme.js +1828 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/inlite/theme.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/modern/theme.js +934 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/modern/theme.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/tinymce.min.js +14 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/editor.html +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/favicon.ico +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/index.html +368 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/package.json +92 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/byvoxmail.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico-badge.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico-v.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico32.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaicologo.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/screenshot-orig.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/screenshot.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/README.md +26 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-de.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-en.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-es.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-fr.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-it.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-nl.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-sv.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/Variables.less +196 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/readme.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.json +1277 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.json +1972 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.svg +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.json +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/server-config.js +12 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/converter-spec.js +115 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/data/template-versafix-1.model.json +137 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/declarations-spec.js +282 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/mensch-spec.js +114 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/model-spec.js +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/stylesheet-spec.js +177 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/app_standalone.less +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/app_standalone_material.less +350 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/safarihack.css +17 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements.less +497 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_jquery.less +344 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_mixins.less +406 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_moxie.less +130 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico.less +529 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico_content.less +391 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico_tools.less +1043 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_reset.less +45 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_variables.less +156 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/app.js +167 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/bind-iframe.js +64 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/blocks.js +118 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/choose-template.js +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/colorpicker.js +58 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/csstext.js +16 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/droppable.js +87 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/eventable.js +33 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/extender-pagination.js +60 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/extsortables.js +103 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/fileupload.js +373 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/if-subs.js +110 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js +31 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-tabs.js +17 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/script-template.js +30 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/scrollfix.js +48 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/scrollintoview.js +83 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/string-template.js +76 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/tooltips.js +36 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/validated-value.js +40 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/virtuals.js +102 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/wysiwygs.js +304 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/checkmodel.js +114 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/declarations.js +279 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/domutils.js +93 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/editor.js +411 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/main.js +42 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/model.js +536 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/parser.js +485 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/stylesheet.js +205 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/utils.js +156 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/wrapper.js +308 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/color.js +53 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/inliner.js +35 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/localstorage.js +100 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ko-bindings.js +22 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/template-loader.js +446 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/timed-call.js +31 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/undomanager/undomain.js +49 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/undomanager/undoserializer.js +120 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/viewmodel.js +595 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/array.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/block-show.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/block-wysiwyg.tmpl.html +18 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/blocks-show.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/blocks-wysiwyg.tmpl.html +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/customstyle.tmpl.html +3 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/empty.tmpl.html +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/error.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/gallery-images.tmpl.html +16 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/img-wysiwyg.tmpl.html +43 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/main.tmpl.html +102 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/toolbox.tmpl.html +111 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/combineKOTemplates.js +24 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/lib/phantom-thumbnailer-editor.js +168 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/makeThumbs.js +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/README.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/footerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/headerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/heroBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/socialBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/threetwoBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/twoColumnBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/template-tedc15.html +567 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/HeaderAndText.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/fixedlist.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/mosaico-tutorial.md +335 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/mosaico-tutorial.pdf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_384.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_385.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_386.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_387.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_407.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_408.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/template-tutorial.html +68 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/buttonBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/doubleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/doubleImageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/hrBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/imageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/logoBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/sideArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/singleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/socialBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/spacerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/textBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/titleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/tripleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/tripleImageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/facebook_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/facebook_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/flickr_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/flickr_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/google+_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/google+_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/instagram_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/instagram_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/linkedin_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/linkedin_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/twitter_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/twitter_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/vimeo_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/vimeo_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/web_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/web_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/youtube_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/youtube_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/sponsor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/template-versafix-1.html +1531 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/uploads/README.md +1 -0
- metadata +536 -0
@@ -0,0 +1,102 @@
|
|
1
|
+
"use strict";
|
2
|
+
/* globals global:false */
|
3
|
+
|
4
|
+
var ko = require("knockout");
|
5
|
+
var console = require("console");
|
6
|
+
|
7
|
+
ko.bindingHandlers['uniqueId'] = {
|
8
|
+
currentIndex: 0,
|
9
|
+
'init': function(element, valueAccessor) {
|
10
|
+
var data = ko.utils.unwrapObservable(valueAccessor()) || {};
|
11
|
+
if (data.id() === '') {
|
12
|
+
var id, el, prefix;
|
13
|
+
// TODO we need a better prefix
|
14
|
+
prefix = 'ko_' + (typeof data.type !== 'undefined' ? ko.utils.unwrapObservable(data.type) : 'block');
|
15
|
+
// when loading an exising model, IDs could be already assigned.
|
16
|
+
do {
|
17
|
+
id = prefix + '_' + (++ko.bindingHandlers['uniqueId'].currentIndex);
|
18
|
+
el = global.document.getElementById(id);
|
19
|
+
if (el) {
|
20
|
+
// when loading an existing model my "currentIndex" is empty.
|
21
|
+
// but we have existing blocks, so I must be sure I don't reuse their IDs.
|
22
|
+
// We use different prefixes (per block type) so that a hidden block
|
23
|
+
// (for which we have no id in the page, e.g: preheader in versafix-1)
|
24
|
+
// will break everthing once we reuse its name.
|
25
|
+
}
|
26
|
+
} while (el);
|
27
|
+
data.id(id);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
};
|
31
|
+
ko.virtualElements.allowedBindings['uniqueId'] = true;
|
32
|
+
|
33
|
+
ko.bindingHandlers['virtualAttr'] = {
|
34
|
+
update: function(element, valueAccessor) {
|
35
|
+
if (element.nodeType !== 8) {
|
36
|
+
ko.bindingHandlers['attr'].update(element, valueAccessor);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
};
|
40
|
+
ko.virtualElements.allowedBindings['virtualAttr'] = true;
|
41
|
+
|
42
|
+
ko.bindingHandlers['virtualAttrStyle'] = {
|
43
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
44
|
+
if (element.nodeType !== 8) {
|
45
|
+
// In "preview" we also set "replacedstyle" so to have an attribute to be used by IE (IE breaks the STYLE) to do the export.
|
46
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
47
|
+
var attrs = ["style"];
|
48
|
+
if (isNotWysiwygMode) attrs.push("replacedstyle");
|
49
|
+
var attrValue = ko.utils.unwrapObservable(valueAccessor());
|
50
|
+
for (var i = 0; i < attrs.length; i++) {
|
51
|
+
var attrName = attrs[i];
|
52
|
+
var toRemove = (attrValue === false) || (attrValue === null) || (attrValue === undefined);
|
53
|
+
if (toRemove)
|
54
|
+
element.removeAttribute(attrName);
|
55
|
+
else
|
56
|
+
element.setAttribute(attrName, attrValue.toString());
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
};
|
61
|
+
ko.virtualElements.allowedBindings['virtualAttrStyle'] = true;
|
62
|
+
|
63
|
+
ko.bindingHandlers['virtualStyle'] = {
|
64
|
+
update: function(element, valueAccessor) {
|
65
|
+
if (element.nodeType !== 8) {
|
66
|
+
ko.bindingHandlers['style'].update(element, valueAccessor);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
};
|
70
|
+
ko.virtualElements.allowedBindings['virtualStyle'] = true;
|
71
|
+
|
72
|
+
|
73
|
+
ko.bindingHandlers['virtualHtml'] = {
|
74
|
+
init: ko.bindingHandlers['html'].init,
|
75
|
+
update: function(element, valueAccessor) {
|
76
|
+
if (element.nodeType === 8) {
|
77
|
+
var html = ko.utils.unwrapObservable(valueAccessor());
|
78
|
+
|
79
|
+
ko.virtualElements.emptyNode(element);
|
80
|
+
if ((html !== null) && (html !== undefined)) {
|
81
|
+
if (typeof html !== 'string') {
|
82
|
+
html = html.toString();
|
83
|
+
}
|
84
|
+
|
85
|
+
var parsedNodes = ko.utils.parseHtmlFragment(html);
|
86
|
+
if (parsedNodes) {
|
87
|
+
var endCommentNode = element.nextSibling;
|
88
|
+
for (var i = 0, j = parsedNodes.length; i < j; i++)
|
89
|
+
endCommentNode.parentNode.insertBefore(parsedNodes[i], endCommentNode);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
} else { // plain node
|
93
|
+
ko.bindingHandlers['html'].update(element, valueAccessor);
|
94
|
+
}
|
95
|
+
|
96
|
+
// Content for virtualHTML must not be parsed by KO, it is simple content.
|
97
|
+
return {
|
98
|
+
controlsDescendantBindings: true
|
99
|
+
};
|
100
|
+
}
|
101
|
+
};
|
102
|
+
ko.virtualElements.allowedBindings['virtualHtml'] = true;
|
@@ -0,0 +1,304 @@
|
|
1
|
+
"use strict";
|
2
|
+
/* global global: false */
|
3
|
+
|
4
|
+
var tinymce = require("tinymce");
|
5
|
+
var $ = require("jquery");
|
6
|
+
var ko = require("knockout");
|
7
|
+
var console = require("console");
|
8
|
+
require("./eventable.js");
|
9
|
+
|
10
|
+
ko.bindingHandlers.wysiwygOrHtml = {
|
11
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
12
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
13
|
+
|
14
|
+
if (isNotWysiwygMode)
|
15
|
+
return ko.bindingHandlers['virtualHtml'].init();
|
16
|
+
else
|
17
|
+
return ko.bindingHandlers.wysiwyg.init(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
|
18
|
+
},
|
19
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
20
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
21
|
+
if (isNotWysiwygMode)
|
22
|
+
return ko.bindingHandlers['virtualHtml'].update(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
|
23
|
+
//else
|
24
|
+
// return ko.bindingHandlers.wysiwyg.update(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
|
25
|
+
}
|
26
|
+
};
|
27
|
+
ko.virtualElements.allowedBindings['wysiwygOrHtml'] = true;
|
28
|
+
|
29
|
+
ko.bindingHandlers.wysiwygHref = {
|
30
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
31
|
+
if (element.nodeType !== 8) {
|
32
|
+
var v = valueAccessor();
|
33
|
+
|
34
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
35
|
+
// console.log("XXX", bindingContext.templateMode, isNotWysiwygMode, element.getAttribute("href"));
|
36
|
+
if (isNotWysiwygMode) {
|
37
|
+
element.setAttribute('target', '_new');
|
38
|
+
} else {
|
39
|
+
/*jshint scripturl:true*/
|
40
|
+
// 20150226: removed href to work around FF issues with <a href=""><div contenteditable="true">..</div></a>
|
41
|
+
// element.setAttribute('href', 'javascript:void(0)');
|
42
|
+
// 20150309: on IE, an editable <a href="" data-editable=""> prevent tinymce toolbar to be shown.
|
43
|
+
// so I change behaviour based on the use of "wysiwygOrHtml"
|
44
|
+
// @see: http://www.tinymce.com/develop/bugtracker_view.php?id=7432
|
45
|
+
var allbindings = allBindingsAccessor();
|
46
|
+
if (typeof allbindings.wysiwygOrHtml !== 'undefined') {
|
47
|
+
element.setAttribute('href', 'javascript:void(0)');
|
48
|
+
} else {
|
49
|
+
element.removeAttribute('href');
|
50
|
+
element.setAttribute('disabledhref', '#');
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
},
|
55
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
56
|
+
if (element.nodeType !== 8) {
|
57
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
58
|
+
// NOTE this unwrap is needed also in "wysiwyg" mode, otherwise dependency tracking dies.
|
59
|
+
var attrValue = ko.utils.unwrapObservable(valueAccessor());
|
60
|
+
if (isNotWysiwygMode) {
|
61
|
+
if ((attrValue === false) || (attrValue === null) || (attrValue === undefined))
|
62
|
+
element.removeAttribute('href');
|
63
|
+
else
|
64
|
+
element.setAttribute('href', attrValue.toString());
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
};
|
69
|
+
ko.virtualElements.allowedBindings['wysiwygHref'] = true;
|
70
|
+
|
71
|
+
ko.bindingHandlers.wysiwygSrc = {
|
72
|
+
convertedUrl: function(src, method, width, height) {
|
73
|
+
var res = src + "?method=" + method + "&width=" + width + (height !== null ? "&height=" + height : '');
|
74
|
+
console.log("basic converterUrl", res);
|
75
|
+
return res;
|
76
|
+
},
|
77
|
+
placeholderUrl: function(plwidth, plheight, pltext) {
|
78
|
+
var placeholdersrc = "'http://lorempixel.com/g/'+" + plwidth + "+'/'+" + plheight + "+'/abstract/'+encodeURIComponent(" + pltext + ")";
|
79
|
+
// http://placehold.it/200x150.png/cccccc/333333&text=placehold.it#sthash.nA3r26vR.dpuf
|
80
|
+
// placeholdersrc = "'http://placehold.it/'+"+width+"+'x'+"+height+"+'.png/cccccc/333333&text='+"+size;
|
81
|
+
// placeholdersrc = "'"+converterUtils.addSlashes(defaultValue)+"'";
|
82
|
+
},
|
83
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
84
|
+
var value = ko.utils.unwrapObservable(valueAccessor());
|
85
|
+
var attrValue = ko.utils.unwrapObservable(value.src);
|
86
|
+
var placeholderValue = ko.utils.unwrapObservable(value.placeholder);
|
87
|
+
var width = ko.utils.unwrapObservable(value.width);
|
88
|
+
var height = ko.utils.unwrapObservable(value.height);
|
89
|
+
if ((attrValue === false) || (attrValue === null) || (attrValue === undefined) || (attrValue === '')) {
|
90
|
+
if (typeof placeholderValue == 'object' && placeholderValue !== null) element.setAttribute('src', ko.bindingHandlers.wysiwygSrc.placeholderUrl(placeholderValue.width, placeholderValue.height, placeholderValue.text));
|
91
|
+
else element.removeAttribute('src');
|
92
|
+
} else {
|
93
|
+
var method = ko.utils.unwrapObservable(value.method);
|
94
|
+
if (!method) method = width > 0 && height > 0 ? 'cover' : 'resize';
|
95
|
+
var src = ko.bindingHandlers.wysiwygSrc.convertedUrl(attrValue.toString(), method, width, height);
|
96
|
+
element.setAttribute('src', src);
|
97
|
+
}
|
98
|
+
if (typeof width !== 'undefined' && width !== null) element.setAttribute("width", width);
|
99
|
+
else element.removeAttribute("width");
|
100
|
+
if (typeof height !== 'undefined' && height !== null) element.setAttribute("height", height);
|
101
|
+
else element.removeAttribute("height");
|
102
|
+
}
|
103
|
+
};
|
104
|
+
|
105
|
+
ko.bindingHandlers.wysiwygId = {
|
106
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
107
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
108
|
+
if (!isNotWysiwygMode)
|
109
|
+
element.setAttribute('id', ko.utils.unwrapObservable(valueAccessor()));
|
110
|
+
},
|
111
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
112
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
113
|
+
if (!isNotWysiwygMode)
|
114
|
+
element.setAttribute('id', ko.utils.unwrapObservable(valueAccessor()));
|
115
|
+
}
|
116
|
+
};
|
117
|
+
ko.virtualElements.allowedBindings['wysiwygId'] = true;
|
118
|
+
|
119
|
+
// used on editable "item" so to bind clicks only in wysiwyg mode.
|
120
|
+
ko.bindingHandlers.wysiwygClick = {
|
121
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
122
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
123
|
+
if (!isNotWysiwygMode)
|
124
|
+
ko.bindingHandlers.click.init(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
|
125
|
+
}
|
126
|
+
};
|
127
|
+
ko.virtualElements.allowedBindings['wysiwygClick'] = true;
|
128
|
+
|
129
|
+
// used on editable "item" so to bind css only in wysiwyg mode.
|
130
|
+
ko.bindingHandlers.wysiwygCss = {
|
131
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
132
|
+
var isNotWysiwygMode = (typeof bindingContext.templateMode == 'undefined' || bindingContext.templateMode != 'wysiwyg');
|
133
|
+
if (!isNotWysiwygMode)
|
134
|
+
ko.bindingHandlers.css.update(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
|
135
|
+
}
|
136
|
+
};
|
137
|
+
ko.virtualElements.allowedBindings['wysiwygCss'] = true;
|
138
|
+
|
139
|
+
ko.bindingHandlers.wysiwygImg = {
|
140
|
+
makeTemplateValueAccessor: function(valueAccessor, bindingContext) {
|
141
|
+
return function() {
|
142
|
+
var isWysiwygMode = (typeof bindingContext.templateMode != 'undefined' && bindingContext.templateMode == 'wysiwyg');
|
143
|
+
|
144
|
+
var modelValue = valueAccessor(),
|
145
|
+
unwrappedValue = ko.utils.peekObservable(modelValue); // Unwrap without setting a dependency here
|
146
|
+
|
147
|
+
// If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates
|
148
|
+
ko.utils.unwrapObservable(modelValue);
|
149
|
+
|
150
|
+
return {
|
151
|
+
'name': isWysiwygMode ? unwrappedValue['_editTemplate'] : unwrappedValue['_template'],
|
152
|
+
'templateEngine': ko.nativeTemplateEngine.instance
|
153
|
+
};
|
154
|
+
};
|
155
|
+
},
|
156
|
+
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
157
|
+
return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['wysiwygImg'].makeTemplateValueAccessor(valueAccessor, bindingContext));
|
158
|
+
},
|
159
|
+
'update': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
160
|
+
bindingContext = bindingContext['extend'](valueAccessor());
|
161
|
+
return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['wysiwygImg'].makeTemplateValueAccessor(valueAccessor, bindingContext), allBindings, viewModel, bindingContext);
|
162
|
+
}
|
163
|
+
};
|
164
|
+
ko.virtualElements.allowedBindings['wysiwygImg'] = true;
|
165
|
+
|
166
|
+
// NOTE: there are issues with the "raw" format and trash left around by tinymce workarounds for contenteditable issues.
|
167
|
+
// setting "forced_root_block: false" disable the default behaviour of adding a wrapper <p> when needed and this seems to fix many issues in IE.
|
168
|
+
// also, maybe we should use the "raw" only for the "before SetContent" and instead read the "non-raw" content (the raw content sometimes have data- attributes and too many ending <br> in the code)
|
169
|
+
ko.bindingHandlers.wysiwyg = {
|
170
|
+
currentIndex: 0,
|
171
|
+
standardOptions: {},
|
172
|
+
fullOptions: {
|
173
|
+
toolbar1: 'bold italic forecolor backcolor hr styleselect removeformat | link unlink | pastetext code',
|
174
|
+
//toolbar1: "bold italic | forecolor backcolor | link unlink | hr | pastetext code", // | newsletter_profile newsletter_optlink newsletter_unsubscribe newsletter_showlink";
|
175
|
+
//toolbar2: "formatselect fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | bullist numlist",
|
176
|
+
plugins: ["link hr paste lists textcolor code"],
|
177
|
+
// valid_elements: 'strong/b,em/i,*[*]',
|
178
|
+
// extended_valid_elements: 'strong/b,em/i,*[*]',
|
179
|
+
// Removed: image fullscreen contextmenu
|
180
|
+
// download custom:
|
181
|
+
// jquery version con legacyoutput, anchor, code, importcss, link, paste, textcolor, hr, lists
|
182
|
+
},
|
183
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
184
|
+
// TODO ugly, but works...
|
185
|
+
ko.bindingHandlers.focusable.init(element);
|
186
|
+
|
187
|
+
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
|
188
|
+
tinymce.remove('#' + element.getAttribute('id'));
|
189
|
+
});
|
190
|
+
|
191
|
+
var value = valueAccessor();
|
192
|
+
|
193
|
+
if (!ko.isObservable(value)) throw "Wysiwyg binding called with non observable";
|
194
|
+
if (element.nodeType === 8) throw "Wysiwyg binding called on virtual node, ignoring...." + element.innerHTML;
|
195
|
+
|
196
|
+
var selectorId = element.getAttribute('id');
|
197
|
+
if (!selectorId) {
|
198
|
+
selectorId = 'wysiwyg_' + (++ko.bindingHandlers['wysiwyg'].currentIndex);
|
199
|
+
element.setAttribute('id', selectorId);
|
200
|
+
}
|
201
|
+
|
202
|
+
var fullEditor = element.tagName == 'DIV' || element.tagName == 'TD';
|
203
|
+
var isSubscriberChange = false;
|
204
|
+
var thisEditor;
|
205
|
+
var isEditorChange = false;
|
206
|
+
|
207
|
+
var options = {
|
208
|
+
selector: '#' + selectorId,
|
209
|
+
inline: true,
|
210
|
+
// maybe not needed, but won't hurt.
|
211
|
+
hidden_input: false,
|
212
|
+
plugins: ["paste"],
|
213
|
+
toolbar1: "bold italic",
|
214
|
+
toolbar2: "",
|
215
|
+
// we have to disable preview_styles otherwise tinymce push inline every style he things will be applied and this makes the style menu to inherit color/font-family and more.
|
216
|
+
preview_styles: false,
|
217
|
+
paste_as_text: true,
|
218
|
+
language: 'en',
|
219
|
+
schema: "html5",
|
220
|
+
extended_valid_elements: 'strong/b,em/i,*[*]',
|
221
|
+
menubar: false,
|
222
|
+
skin: 'gray-flat',
|
223
|
+
setup: function(editor) {
|
224
|
+
// TODO change sometimes doesn't trigger (we have to document when)
|
225
|
+
// listening on keyup would increase correctness but we would need a rateLimit to avoid flooding.
|
226
|
+
editor.on('change redo undo', function() {
|
227
|
+
if (!isSubscriberChange) {
|
228
|
+
isEditorChange = true;
|
229
|
+
// we failed with other ways to do this:
|
230
|
+
// value($(element).html());
|
231
|
+
// value(element.innerHTML);
|
232
|
+
value(editor.getContent({
|
233
|
+
format: 'raw'
|
234
|
+
}));
|
235
|
+
isEditorChange = false;
|
236
|
+
}
|
237
|
+
});
|
238
|
+
// Clicking on the element on focus change allow the "clic" code to be triggered and propagate the selection.
|
239
|
+
// Not elegant, maybe we have better options.
|
240
|
+
editor.on('focus', function() {
|
241
|
+
// Used by scrollfix.js (maybe this is not needed by new scrollfix.js)
|
242
|
+
editor.nodeChanged();
|
243
|
+
editor.getElement().click();
|
244
|
+
});
|
245
|
+
|
246
|
+
// NOTE: this fixes issue with "leading spaces" in default content that were lost during initialization.
|
247
|
+
editor.on('BeforeSetContent', function(args) {
|
248
|
+
if (args.initial) args.format = 'raw';
|
249
|
+
});
|
250
|
+
|
251
|
+
/* NOTE: disabling "ENTER" in tiny editor, not a good thing but may be needed to work around contenteditable issues
|
252
|
+
if (!fullEditor) {
|
253
|
+
// se non abbiamo il "full Editor", disabilitiamo l'invio. (vari bug)
|
254
|
+
editor.on('keydown', function(e) {
|
255
|
+
if (e.keyCode == 13) { e.preventDefault(); }
|
256
|
+
});
|
257
|
+
}
|
258
|
+
*/
|
259
|
+
|
260
|
+
thisEditor = editor;
|
261
|
+
|
262
|
+
}
|
263
|
+
};
|
264
|
+
|
265
|
+
ko.utils.extend(options, ko.bindingHandlers.wysiwyg.standardOptions);
|
266
|
+
if (fullEditor) ko.utils.extend(options, ko.bindingHandlers.wysiwyg.fullOptions);
|
267
|
+
|
268
|
+
// we have to put initialization in a settimeout, otherwise switching from "1" to "2" columns blocks
|
269
|
+
// will start the new editors before disposing the old ones and IDs get temporarily duplicated.
|
270
|
+
// using setTimeout the dispose/create order is correct on every browser tested.
|
271
|
+
global.setTimeout(function() {
|
272
|
+
tinymce.init(options);
|
273
|
+
});
|
274
|
+
|
275
|
+
ko.computed(function() {
|
276
|
+
var content = ko.utils.unwrapObservable(valueAccessor());
|
277
|
+
if (!isEditorChange) {
|
278
|
+
try {
|
279
|
+
isSubscriberChange = true;
|
280
|
+
// we failed setting contents in other ways...
|
281
|
+
// $(element).html(content);
|
282
|
+
if (typeof thisEditor !== 'undefined') {
|
283
|
+
thisEditor.setContent(content, {
|
284
|
+
format: 'raw'
|
285
|
+
});
|
286
|
+
} else {
|
287
|
+
ko.utils.setHtml(element, content);
|
288
|
+
}
|
289
|
+
} catch (e) {
|
290
|
+
console.log("TODO exception setting content to editable element", typeof thisEditor, e);
|
291
|
+
}
|
292
|
+
isSubscriberChange = false;
|
293
|
+
}
|
294
|
+
}, null, {
|
295
|
+
disposeWhenNodeIsRemoved: element
|
296
|
+
});
|
297
|
+
|
298
|
+
// do not parse html content for KO bindings!!
|
299
|
+
return {
|
300
|
+
controlsDescendantBindings: true
|
301
|
+
};
|
302
|
+
|
303
|
+
}
|
304
|
+
};
|
@@ -0,0 +1,114 @@
|
|
1
|
+
"use strict";
|
2
|
+
var console = require("console");
|
3
|
+
|
4
|
+
// returns 0 if equal (0.0.x release), 1 with backward compatible additions (0.x.0 release), 2 on lost data or incompatible data (x.0.0 release)
|
5
|
+
var checkModel = function(reference, blockDefs, model, origPrefix, reverse) {
|
6
|
+
var blockDefsObj, i, prefix;
|
7
|
+
var valid = 0;
|
8
|
+
if (typeof reverse == 'undefined') reverse = false;
|
9
|
+
if (typeof blockDefs !== 'undefined' && typeof blockDefs.splice == 'function') {
|
10
|
+
blockDefsObj = {};
|
11
|
+
for (i = 0; i < blockDefs.length; i++) blockDefsObj[blockDefs[i].type] = blockDefs[i];
|
12
|
+
} else {
|
13
|
+
blockDefsObj = blockDefs;
|
14
|
+
}
|
15
|
+
for (var prop in reference)
|
16
|
+
if (reference.hasOwnProperty(prop)) {
|
17
|
+
prefix = typeof origPrefix !== 'undefined' ? origPrefix + "." + prop : prop;
|
18
|
+
if (!model.hasOwnProperty(prop)) {
|
19
|
+
if (reverse) {
|
20
|
+
console.warn("WARN Property ", prefix, "found in model is not defined by template: removing it!");
|
21
|
+
valid = Math.max(valid, 2);
|
22
|
+
delete reference[prop];
|
23
|
+
} else {
|
24
|
+
console.log("INFO Property ", prefix, "missing in model, cloning from reference!");
|
25
|
+
valid = Math.max(valid, 1);
|
26
|
+
model[prop] = reference[prop];
|
27
|
+
}
|
28
|
+
} else if (typeof model[prop] != typeof reference[prop]) {
|
29
|
+
// se sono di tipo diverso allora provo a vedere se l'altro, convertito di tipo mantiene un valore equivalente.
|
30
|
+
if (model[prop] !== null && reference[prop] !== null) {
|
31
|
+
if (typeof model[prop] == 'string') {
|
32
|
+
if (String(reference[prop]) != reference[prop]) {
|
33
|
+
console.log("TODO Different type 1 ", prefix, typeof model[prop], typeof reference[prop], model[prop], reference[prop]);
|
34
|
+
valid = Math.max(valid, 2);
|
35
|
+
}
|
36
|
+
} else if (typeof model[prop] == 'number') {
|
37
|
+
if (Number(reference[prop]) != reference[prop]) {
|
38
|
+
console.log("TODO Different type 2 ", prefix, typeof model[prop], typeof reference[prop], model[prop], reference[prop]);
|
39
|
+
valid = Math.max(valid, 2);
|
40
|
+
}
|
41
|
+
} else {
|
42
|
+
console.log("TODO Different type 3 ", prefix, typeof model[prop], typeof reference[prop], model[prop], reference[prop]);
|
43
|
+
valid = Math.max(valid, 2);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
} else if (typeof reference[prop] == 'object') {
|
47
|
+
if (reference[prop] !== null) {
|
48
|
+
if (typeof reference[prop].splice !== 'undefined') {
|
49
|
+
if (reference[prop].length > 0) {
|
50
|
+
if (model[prop].length > 0) {
|
51
|
+
// TODO needs sorting?
|
52
|
+
var j = 0;
|
53
|
+
for (i = 0; i < model[prop].length; i++) {
|
54
|
+
if (typeof model[prop][i].type == 'string') {
|
55
|
+
while (j < reference[prop].length && reference[prop][j].type !== model[prop][i].type) {
|
56
|
+
console.log("ignoring ", prefix, reference[prop][j].type, " block type in reference not found in model");
|
57
|
+
j++;
|
58
|
+
}
|
59
|
+
if (j >= reference[prop].length) {
|
60
|
+
console.log("WARN cannot find ", prefix, model[prop][i].type, " block in reference");
|
61
|
+
valid = Math.max(valid, 2);
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
// reverse condition so to skip "deep traversing" on error
|
65
|
+
valid = Math.max(valid, checkModel(reference[prop][j], undefined, model[prop][i], prefix + "[" + i + "." + model[prop][i].type + "]"));
|
66
|
+
}
|
67
|
+
}
|
68
|
+
} else {
|
69
|
+
// in the case of different array we check blockDefs
|
70
|
+
for (i = 0; i < reference[prop].length; i++) {
|
71
|
+
if (typeof reference[prop][i].type !== 'string') {
|
72
|
+
console.log("TODO found an object with no type", prefix, reference[prop][i]);
|
73
|
+
valid = Math.max(valid, 2);
|
74
|
+
} else if (!blockDefsObj.hasOwnProperty(reference[prop][i].type)) {
|
75
|
+
console.warn("TODO the model uses a block type not defined by the template. REMOVING IT!!", prefix, reference[prop][i]);
|
76
|
+
reference[prop].splice(i, 1);
|
77
|
+
i--;
|
78
|
+
valid = Math.max(valid, 2);
|
79
|
+
} else {
|
80
|
+
valid = Math.max(valid, checkModel(blockDefsObj[reference[prop][i].type], blockDefsObj, reference[prop][i], prefix + "[" + i + "." + reference[prop][i].type + "]"));
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
} else {
|
86
|
+
if (model[prop] === null) {
|
87
|
+
if (reverse) {
|
88
|
+
console.log("WARN Null object in model ", prefix, "instead of", reference[prop], "deleting it");
|
89
|
+
valid = Math.max(valid, 2);
|
90
|
+
delete reference[prop];
|
91
|
+
} else {
|
92
|
+
console.log("INFO Null object in model ", prefix, "instead of", reference[prop], "cloning it from the reference");
|
93
|
+
valid = Math.max(valid, 1);
|
94
|
+
model[prop] = reference[prop];
|
95
|
+
}
|
96
|
+
} else {
|
97
|
+
valid = Math.max(valid, checkModel(reference[prop], blockDefsObj, model[prop], prefix, reverse));
|
98
|
+
}
|
99
|
+
}
|
100
|
+
} else if (model[prop] !== null) {
|
101
|
+
console.log("TODO Null in reference but not null in model", prefix, model[prop]);
|
102
|
+
valid = Math.max(valid, 2);
|
103
|
+
}
|
104
|
+
} else if (typeof reference[prop] !== 'string' && typeof reference[prop] !== 'boolean' && typeof reference[prop] !== 'number') {
|
105
|
+
console.log("TODO unsupported type", prefix, typeof reference[prop]);
|
106
|
+
valid = Math.max(valid, 2);
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|
110
|
+
if (!reverse) valid = Math.max(valid, checkModel(model, blockDefs, reference, typeof origPrefix !== 'undefined' ? origPrefix + "!R" : "!R", true));
|
111
|
+
return valid;
|
112
|
+
};
|
113
|
+
|
114
|
+
module.exports = checkModel;
|