mosaico 1.0.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 +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,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Parses CSS declarations and supports the property language (-ko-*) found between them.
|
|
4
|
+
// Create KO bindings but doesn't depend on KO.
|
|
5
|
+
// Needs a bindingProvider.
|
|
6
|
+
|
|
7
|
+
var converterUtils = require("./utils.js");
|
|
8
|
+
var cssParse = require("mensch/lib/parser.js");
|
|
9
|
+
var console = require("console");
|
|
10
|
+
var domutils = require("./domutils.js");
|
|
11
|
+
|
|
12
|
+
var _declarationValueLookup = function(declarations, propertyname, templateUrlConverter) {
|
|
13
|
+
for (var i = declarations.length - 1; i >= 0; i--) {
|
|
14
|
+
if (declarations[i].type == 'property' && declarations[i].name == propertyname) {
|
|
15
|
+
return _declarationValueUrlPrefixer(declarations[i].value, templateUrlConverter);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var _propToCamelCase = function(propName) {
|
|
22
|
+
return propName.replace(/-([a-z])/g, function(match, contents, offset, s) {
|
|
23
|
+
return contents.toUpperCase();
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var _declarationValueUrlPrefixer = function(value, templateUrlConverter) {
|
|
28
|
+
if (value.match(/url\(.*\)/)) {
|
|
29
|
+
var replaced = value.replace(/(url\()([^\)]*)(\))/g, function(matched, prefix, url, postfix) {
|
|
30
|
+
var trimmed = url.trim();
|
|
31
|
+
var apice = url.trim().charAt(0);
|
|
32
|
+
if (apice == '\'' || apice == '"') {
|
|
33
|
+
trimmed = trimmed.substr(1, trimmed.length - 2);
|
|
34
|
+
} else {
|
|
35
|
+
apice = '';
|
|
36
|
+
}
|
|
37
|
+
var newUrl = templateUrlConverter(trimmed);
|
|
38
|
+
if (newUrl !== null) {
|
|
39
|
+
return prefix + apice + newUrl + apice + postfix;
|
|
40
|
+
} else {
|
|
41
|
+
return matched;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return replaced;
|
|
45
|
+
} else {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var elaborateDeclarations = function(style, declarations, templateUrlConverter, bindingProvider, element, basicBindings, removeDisplayNone) {
|
|
51
|
+
var newBindings = typeof basicBindings == 'object' && basicBindings !== null ? basicBindings : {};
|
|
52
|
+
var newStyle = null;
|
|
53
|
+
var skipLines = 0;
|
|
54
|
+
if (typeof declarations == 'undefined') {
|
|
55
|
+
var styleSheet = cssParse("#{\n" + style + "}", {
|
|
56
|
+
comments: true,
|
|
57
|
+
position: true
|
|
58
|
+
});
|
|
59
|
+
declarations = styleSheet.stylesheet.rules[0].declarations;
|
|
60
|
+
skipLines = 1;
|
|
61
|
+
}
|
|
62
|
+
for (var i = declarations.length - 1; i >= 0; i--)
|
|
63
|
+
if (declarations[i].type == 'property') {
|
|
64
|
+
if (removeDisplayNone === true && declarations[i].name == 'display' && declarations[i].value == 'none') {
|
|
65
|
+
if (newStyle === null) newStyle = style;
|
|
66
|
+
newStyle = converterUtils.removeStyle(newStyle, declarations[i].position.start, declarations[i].position.end, skipLines, 0, 0, '');
|
|
67
|
+
} else {
|
|
68
|
+
var decl = declarations[i].name.match(/^-ko-(bind-|attr-)?([a-z0-9-]*?)(-if|-ifnot)?$/);
|
|
69
|
+
if (decl !== null) {
|
|
70
|
+
// rimozione dello stile -ko- dall'attributo style.
|
|
71
|
+
if (newStyle === null && typeof style != 'undefined') newStyle = style;
|
|
72
|
+
|
|
73
|
+
var isAttr = decl[1] == 'attr-';
|
|
74
|
+
var isBind = decl[1] == 'bind-';
|
|
75
|
+
var propName = decl[2];
|
|
76
|
+
|
|
77
|
+
var isIf = decl[3] == '-if' || decl[3] == '-ifnot';
|
|
78
|
+
var condDecl;
|
|
79
|
+
var bindValue;
|
|
80
|
+
var propDefaultValue;
|
|
81
|
+
|
|
82
|
+
if (isIf) {
|
|
83
|
+
condDecl = declarations[i].name.substr(0, declarations[i].name.length - decl[3].length);
|
|
84
|
+
var conditionedDeclaration = _declarationValueLookup(declarations, condDecl, templateUrlConverter);
|
|
85
|
+
if (conditionedDeclaration === null) throw "Unable to find declaration " + condDecl + " for " + declarations[i].name;
|
|
86
|
+
} else {
|
|
87
|
+
|
|
88
|
+
if ((isAttr || isBind) && (typeof element == 'undefined' && typeof style != 'undefined')) throw "Attributes and bind declarations are only allowed in inline styles!";
|
|
89
|
+
|
|
90
|
+
var needDefaultValue = true;
|
|
91
|
+
var bindType;
|
|
92
|
+
if (isAttr) {
|
|
93
|
+
propDefaultValue = domutils.getAttribute(element, propName);
|
|
94
|
+
needDefaultValue = false;
|
|
95
|
+
bindType = 'virtualAttr';
|
|
96
|
+
} else if (!isBind) {
|
|
97
|
+
needDefaultValue = typeof style !== 'undefined';
|
|
98
|
+
if (needDefaultValue) propDefaultValue = _declarationValueLookup(declarations, propName, templateUrlConverter);
|
|
99
|
+
bindType = 'virtualStyle';
|
|
100
|
+
} else {
|
|
101
|
+
bindType = null;
|
|
102
|
+
if (propName == 'text') {
|
|
103
|
+
if (typeof element !== 'undefined') {
|
|
104
|
+
propDefaultValue = domutils.getInnerText(element);
|
|
105
|
+
} else {
|
|
106
|
+
needDefaultValue = false;
|
|
107
|
+
}
|
|
108
|
+
} else if (propName == 'html') {
|
|
109
|
+
if (typeof element !== 'undefined') {
|
|
110
|
+
propDefaultValue = domutils.getInnerHtml(element);
|
|
111
|
+
} else {
|
|
112
|
+
needDefaultValue = false;
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
needDefaultValue = false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (needDefaultValue && propDefaultValue === null) {
|
|
120
|
+
console.error("Cannot find default value for", declarations[i].name, declarations);
|
|
121
|
+
throw "Cannot find default value for " + declarations[i].name + ": " + declarations[i].value + " in " + element + " (" + typeof style + "/" + propName + ")";
|
|
122
|
+
}
|
|
123
|
+
var bindDefaultValue = propDefaultValue;
|
|
124
|
+
|
|
125
|
+
var bindName = _propToCamelCase(propName);
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
bindValue = converterUtils.expressionBinding(declarations[i].value, bindingProvider, bindDefaultValue);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
console.error("Model ensure path failed", e.stack, "name", declarations[i].name, "value", declarations[i].value, "default", propDefaultValue, "element", element);
|
|
131
|
+
throw e;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (bindType !== null && typeof newBindings[bindType] == 'undefined') newBindings[bindType] = {};
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// Special handling for HREFs
|
|
138
|
+
if (bindType == 'virtualAttr' && bindName == 'href') {
|
|
139
|
+
bindType = null;
|
|
140
|
+
bindName = 'wysiwygHref';
|
|
141
|
+
// We have to remove it, otherwise we ends up with 2 rules writing it.
|
|
142
|
+
if (typeof element != 'undefined' && element !== null) {
|
|
143
|
+
domutils.removeAttribute(element, "href");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// TODO evaluate the use of "-then" (and -else) postfixes to complete the -if instead of relaying
|
|
148
|
+
// on the same basic sintax (or maybe it is better to support ternary operator COND ? THEN : ELSE).
|
|
149
|
+
var declarationCondition = _declarationValueLookup(declarations, declarations[i].name + '-if', templateUrlConverter);
|
|
150
|
+
var not = false;
|
|
151
|
+
if (declarationCondition === null) {
|
|
152
|
+
declarationCondition = _declarationValueLookup(declarations, declarations[i].name + '-ifnot', templateUrlConverter);
|
|
153
|
+
not = true;
|
|
154
|
+
} else {
|
|
155
|
+
if (_declarationValueLookup(declarations, declarations[i].name + '-ifnot', templateUrlConverter) !== null) {
|
|
156
|
+
throw "Unexpected error: cannot use both -if and -ifnot property conditions";
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (declarationCondition !== null) {
|
|
160
|
+
try {
|
|
161
|
+
var bindingCond = converterUtils.conditionBinding(declarationCondition, bindingProvider);
|
|
162
|
+
bindValue = (not ? '!' : '') + "(" + bindingCond + ") ? " + bindValue + " : null";
|
|
163
|
+
} catch (e) {
|
|
164
|
+
console.error("Unable to deal with -ko style binding condition", declarationCondition, declarations[i].name);
|
|
165
|
+
throw e;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (bindType !== null) newBindings[bindType][bindName] = bindValue;
|
|
170
|
+
else newBindings[bindName] = bindValue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// parsing @supports :preview
|
|
174
|
+
if (newStyle !== null) {
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
// if "element" is defined then we are parsing an "inline" style and we want to remove it.
|
|
178
|
+
if (typeof element != 'undefined' && element !== null) {
|
|
179
|
+
newStyle = converterUtils.removeStyle(newStyle, declarations[i].position.start, declarations[i].position.end, skipLines, 0, 0, '');
|
|
180
|
+
} else {
|
|
181
|
+
// otherwise we are parsing a full stylesheet.. let's rewrite the full "prop: value" without caring about the original syntax.
|
|
182
|
+
var replacedWith = '';
|
|
183
|
+
// if it is an "if" we simply have to remove it, otherwise we replace the input code with "prop: value" generating expression.
|
|
184
|
+
if (!isIf) replacedWith = propName + ': <!-- ko text: ' + bindValue + ' -->' + propDefaultValue + '<!-- /ko -->';
|
|
185
|
+
newStyle = converterUtils.removeStyle(newStyle, declarations[i].position.start, declarations[i].position.end, skipLines, 0, 0, replacedWith);
|
|
186
|
+
}
|
|
187
|
+
} catch (e) {
|
|
188
|
+
console.warn("Remove style failed", e, "name", declarations[i]);
|
|
189
|
+
throw e;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
} else {
|
|
195
|
+
// prefixing urls
|
|
196
|
+
var replacedValue = _declarationValueUrlPrefixer(declarations[i].value, templateUrlConverter);
|
|
197
|
+
if (replacedValue != declarations[i].value) {
|
|
198
|
+
if (newStyle === null && typeof style !== 'undefined') newStyle = style;
|
|
199
|
+
if (newStyle !== null) {
|
|
200
|
+
try {
|
|
201
|
+
newStyle = converterUtils.removeStyle(newStyle, declarations[i].position.start, declarations[i].position.end, skipLines, 0, 0, declarations[i].name + ": " + replacedValue);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
console.log("Remove style failed replacing url", e, "name", declarations[i]);
|
|
204
|
+
throw e;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Style handling by concatenated "style attribute" (worse performance but more stable than direct style handling)
|
|
210
|
+
var bindName2 = _propToCamelCase(declarations[i].name);
|
|
211
|
+
var bind = 'virtualAttrStyle';
|
|
212
|
+
var bindVal2 = typeof newBindings['virtualStyle'] !== 'undefined' ? newBindings['virtualStyle'][bindName2] : undefined;
|
|
213
|
+
|
|
214
|
+
var dist = ' ';
|
|
215
|
+
if (typeof newBindings[bind] == 'undefined') {
|
|
216
|
+
newBindings[bind] = "''";
|
|
217
|
+
dist = '';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (typeof bindVal2 !== 'undefined') {
|
|
221
|
+
newBindings[bind] = "'" + declarations[i].name + ": '+(" + bindVal2 + ")+';" + dist + "'+" + newBindings[bind];
|
|
222
|
+
delete newBindings['virtualStyle'][bindName2];
|
|
223
|
+
} else {
|
|
224
|
+
newBindings[bind] = "'" + declarations[i].name + ": " + converterUtils.addSlashes(replacedValue) + ";" + dist + "'+" + newBindings[bind];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (typeof element != 'undefined' && element !== null) {
|
|
232
|
+
for (var prop in newBindings['virtualStyle'])
|
|
233
|
+
if (newBindings['virtualStyle'].hasOwnProperty(prop)) {
|
|
234
|
+
console.log("Unexpected virtualStyle binding after conversion to virtualAttr.style", prop, newBindings['virtualStyle'][prop], style);
|
|
235
|
+
throw "Unexpected virtualStyle binding after conversion to virtualAttr.style for " + prop;
|
|
236
|
+
}
|
|
237
|
+
delete newBindings['virtualStyle'];
|
|
238
|
+
|
|
239
|
+
var currentBindings = domutils.getAttribute(element, 'data-bind');
|
|
240
|
+
var dataBind = (currentBindings !== null ? currentBindings + ", " : "") + _bindingSerializer(newBindings);
|
|
241
|
+
domutils.setAttribute(element, 'data-bind', dataBind);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// TODO a function whose return type depends on the input parameters is very ugly.. please FIX ME.
|
|
245
|
+
if (typeof style == 'undefined') {
|
|
246
|
+
// clean virtualStyle if empty
|
|
247
|
+
var hasVirtualStyle = false;
|
|
248
|
+
for (var prop1 in newBindings['virtualStyle'])
|
|
249
|
+
if (newBindings['virtualStyle'].hasOwnProperty(prop1)) {
|
|
250
|
+
hasVirtualStyle = true;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
if (!hasVirtualStyle) delete newBindings['virtualStyle'];
|
|
254
|
+
else {
|
|
255
|
+
// remove and add back virtualAttrStyle so it gets appended BEFORE virtualAttrStyle (_bindingSerializer reverse them...)
|
|
256
|
+
if (typeof newBindings['virtualAttrStyle'] !== 'undefined') {
|
|
257
|
+
var vs = newBindings['virtualAttrStyle'];
|
|
258
|
+
delete newBindings['virtualAttrStyle'];
|
|
259
|
+
newBindings['virtualAttrStyle'] = vs;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// returns new serialized bindings
|
|
263
|
+
return _bindingSerializer(newBindings);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return newStyle;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
var _bindingSerializer = function(val) {
|
|
270
|
+
var res = [];
|
|
271
|
+
for (var prop in val)
|
|
272
|
+
if (val.hasOwnProperty(prop)) {
|
|
273
|
+
if (typeof val[prop] == 'object') res.push(prop + ": " + "{ " + _bindingSerializer(val[prop]) + " }");
|
|
274
|
+
else res.push(prop + ": " + val[prop]);
|
|
275
|
+
}
|
|
276
|
+
return res.reverse().join(', ');
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
module.exports = elaborateDeclarations;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// This deals with Cheerio/jQuery issues.
|
|
4
|
+
// Most of this could be done without jQuery, too, but jQuery is easier to be mocked with Cheerio
|
|
5
|
+
// Otherwise we would need jsDom to run the compiler in the server (without a real browser)
|
|
6
|
+
|
|
7
|
+
var $ = require("jquery");
|
|
8
|
+
|
|
9
|
+
function _extend(target, source) {
|
|
10
|
+
if (source) {
|
|
11
|
+
for (var prop in source) {
|
|
12
|
+
if (source.hasOwnProperty(prop)) {
|
|
13
|
+
target[prop] = source[prop];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return target;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var objExtend = function(obj, extender) {
|
|
21
|
+
if (typeof $.extend == 'function') {
|
|
22
|
+
return $.extend(true, obj, extender);
|
|
23
|
+
} else {
|
|
24
|
+
return _extend(obj, JSON.parse(JSON.stringify(extender)));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var getAttribute = function(element, attribute) {
|
|
29
|
+
var res = $(element).attr(attribute);
|
|
30
|
+
if (typeof res == 'undefined') res = null;
|
|
31
|
+
return res;
|
|
32
|
+
// return element.getAttribute(attribute);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var setAttribute = function(element, attribute, value) {
|
|
36
|
+
$(element).attr(attribute, value);
|
|
37
|
+
// element.setAttribute(attribute, value);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var removeAttribute = function(element, attribute) {
|
|
41
|
+
$(element).removeAttr(attribute);
|
|
42
|
+
// element.removeAttribute(attribute);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var getInnerText = function(element) {
|
|
46
|
+
return $(element).text();
|
|
47
|
+
// if (typeof element.innerText != 'undefined') return element.innerText;
|
|
48
|
+
// else return element.textContent;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var getInnerHtml = function(element) {
|
|
52
|
+
return $(element).html();
|
|
53
|
+
// return element.innerHTML;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var getLowerTagName = function(element) {
|
|
57
|
+
// sometimes cheerio doesn't have tagName but "name".
|
|
58
|
+
// Browsers have "name" with empty string
|
|
59
|
+
// Sometimes cheerio has tagName but no prop function.
|
|
60
|
+
if (element.tagName === '' && typeof element.name == 'string') return element.name.toLowerCase();
|
|
61
|
+
if (element.tagName !== '') return element.tagName.toLowerCase();
|
|
62
|
+
return $(element).prop("tagName").toLowerCase();
|
|
63
|
+
// return element.tagName.toLowerCase();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var setContent = function(element, content) {
|
|
67
|
+
$(element).html(content);
|
|
68
|
+
// element.innerHTML = content;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var replaceHtml = function(element, html) {
|
|
72
|
+
$(element).replaceWith(html);
|
|
73
|
+
// element.outerHTML = html;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var removeElements = function($elements, tryDetach) {
|
|
77
|
+
if (tryDetach && typeof $elements.detach !== 'undefined') $elements.detach();
|
|
78
|
+
// NOTE: we don't need an else, as detach is simply an optimization
|
|
79
|
+
$elements.remove();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
module.exports = {
|
|
83
|
+
getAttribute: getAttribute,
|
|
84
|
+
setAttribute: setAttribute,
|
|
85
|
+
removeAttribute: removeAttribute,
|
|
86
|
+
getInnerText: getInnerText,
|
|
87
|
+
getInnerHtml: getInnerHtml,
|
|
88
|
+
getLowerTagName: getLowerTagName,
|
|
89
|
+
setContent: setContent,
|
|
90
|
+
replaceHtml: replaceHtml,
|
|
91
|
+
removeElements: removeElements,
|
|
92
|
+
objExtend: objExtend
|
|
93
|
+
};
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var console = require("console");
|
|
4
|
+
var elaborateDeclarations = require("./declarations.js");
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
var modelDef = require('./model.js');
|
|
7
|
+
|
|
8
|
+
var _getOptionsObject = function(options) {
|
|
9
|
+
var optionsCouples = options.split('|');
|
|
10
|
+
var opts = {};
|
|
11
|
+
for (var i = 0; i < optionsCouples.length; i++) {
|
|
12
|
+
var opt = optionsCouples[i].split('=');
|
|
13
|
+
opts[opt[0]] = opt.length > 1 ? opt[1] : opt[0];
|
|
14
|
+
}
|
|
15
|
+
return opts;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// TODO this should not have hardcoded rules (we now have a way to declare them in the template definition)
|
|
19
|
+
// Category "style" is used by editType "styler"
|
|
20
|
+
// Cateogry "content" is used by editType "edit"
|
|
21
|
+
// TODO maybe we should use a common string here, and rely only on the original category.
|
|
22
|
+
var _filterProps = function(model, editType, level) {
|
|
23
|
+
var res = [];
|
|
24
|
+
for (var prop in model)
|
|
25
|
+
if (!prop.match(/^customStyle$/) && !prop.match(/^_/) && model.hasOwnProperty(prop)) {
|
|
26
|
+
var isStyleProp = model[prop] !== null && typeof model[prop]._category != 'undefined' && model[prop]._category == 'style';
|
|
27
|
+
if (prop == 'id' || prop == 'type' || prop.match(/Blocks$/)) {} else if (editType == 'styler') {
|
|
28
|
+
if (isStyleProp || level > 0) res.push(prop);
|
|
29
|
+
} else if (editType == 'edit') {
|
|
30
|
+
// Editing for properties in the "content" category but not defined in the context of a block
|
|
31
|
+
var isContentProp = model[prop] !== null && typeof model[prop]._category != 'undefined' && model[prop]._category == 'content' &&
|
|
32
|
+
(typeof model[prop]._context == 'undefined' || model[prop]._context != 'block');
|
|
33
|
+
if (isContentProp) res.push(prop);
|
|
34
|
+
} else if (typeof editType == 'undefined') {
|
|
35
|
+
res.push(prop);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return res;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var _propInput = function(model, prop, propAccessor, editType, widgets) {
|
|
42
|
+
var html = "";
|
|
43
|
+
var widget;
|
|
44
|
+
if (model !== null && typeof model._widget != 'undefined') widget = model._widget;
|
|
45
|
+
|
|
46
|
+
if (typeof widget == 'undefined') {
|
|
47
|
+
throw "Unknown data type for " + prop;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// For content editors we deal with focusing (clicking is handled by the container DIV).
|
|
51
|
+
var onfocusbinding = 'focusable: true';
|
|
52
|
+
if (editType == 'edit') {
|
|
53
|
+
onfocusbinding += ', event: { focus: function(ui, event) { $($element).click(); } } ';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
html += '<label class="data-' + widget + '"' + (widget == 'boolean' ? ' data-bind="event: { mousedown: function(ui, evt) { if (evt.button == 0) { var input = $($element).find(\'input\'); var ch = input.prop(\'checked\'); setTimeout(function() { input.click(); input.prop(\'checked\', !ch); input.trigger(\'change\'); }, 0); } } }, click: function(ui, evt) { evt.preventDefault(); }, clickBubble: false"' : '') + '>';
|
|
57
|
+
|
|
58
|
+
if (typeof widgets !== 'undefined' && typeof widgets[widget] !== 'undefined') {
|
|
59
|
+
var w = widgets[widget];
|
|
60
|
+
var parameters = {};
|
|
61
|
+
if (typeof w.parameters !== 'undefined')
|
|
62
|
+
for (var p in w.parameters)
|
|
63
|
+
if (w.parameters.hasOwnProperty(p) && typeof model['_'+p] !== 'undefined')
|
|
64
|
+
parameters[p] = model['_'+p];
|
|
65
|
+
html += w.html(propAccessor, onfocusbinding, parameters);
|
|
66
|
+
} else if (widget == 'boolean') {
|
|
67
|
+
html += '<input type="checkbox" value="nothing" data-bind="checked: ' + propAccessor + ', ' + onfocusbinding + '" />';
|
|
68
|
+
html += '<span class="checkbox-replacer" ></span>'; /* data-bind="css: { checked: '+propAccessor+' }" */
|
|
69
|
+
} else if (widget == 'color') {
|
|
70
|
+
html += '<input size="7" type="text" data-bind="colorpicker: { color: ' + propAccessor + ', strings: $root.t(\'Theme Colors,Standard Colors,Web Colors,Theme Colors,Back to Palette,History,No history yet.\') }, ' + ', ' + onfocusbinding + '" />';
|
|
71
|
+
} else if (widget == 'select') {
|
|
72
|
+
if (typeof model._options != 'undefined') {
|
|
73
|
+
var opts = _getOptionsObject(model._options);
|
|
74
|
+
// var opts = model._options;
|
|
75
|
+
html += '<select data-bind="value: ' + propAccessor + ', ' + onfocusbinding + '">';
|
|
76
|
+
for (var opt in opts)
|
|
77
|
+
if (opts.hasOwnProperty(opt)) {
|
|
78
|
+
html += '<option value="' + opt + '" data-bind="text: $root.ut(\'template\', \'' + utils.addSlashes(opts[opt]) + '\')">' + opts[opt] + '</option>';
|
|
79
|
+
}
|
|
80
|
+
html += '</select>';
|
|
81
|
+
}
|
|
82
|
+
} else if (widget == 'font') {
|
|
83
|
+
html += '<select type="text" data-bind="value: ' + propAccessor + ', ' + onfocusbinding + '">';
|
|
84
|
+
html += '<optgroup label="Sans-Serif Fonts">';
|
|
85
|
+
html += '<option value="Arial,Helvetica,sans-serif">Arial</option>';
|
|
86
|
+
html += '<option value="\'Comic Sans MS\',cursive,sans-serif">Comic Sans MS</option>';
|
|
87
|
+
html += '<option value="Impact,Charcoal,sans-serif">Impact</option>';
|
|
88
|
+
html += '<option value="\'Trebuchet MS\',Helvetica,sans-serif">Trebuchet MS</option>';
|
|
89
|
+
html += '<option value="Verdana,Geneva,sans-serif">Verdana</option>';
|
|
90
|
+
html += '</optgroup>';
|
|
91
|
+
html += '<optgroup label="Serif Fonts">';
|
|
92
|
+
html += '<option value="Georgia,serif">Georgia</option>';
|
|
93
|
+
html += '<option value="\'Times New Roman\',Times,serif">Times New Roman</option>';
|
|
94
|
+
html += '</optgroup>';
|
|
95
|
+
html += '<optgroup label="Monospace Fonts">';
|
|
96
|
+
html += '<option value="\'Courier New\',Courier,monospace">Courier New</option>';
|
|
97
|
+
html += '</optgroup>';
|
|
98
|
+
html += '</select>';
|
|
99
|
+
} else if (widget == 'url') {
|
|
100
|
+
html += '<div class="ui-textbutton">';
|
|
101
|
+
// <a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only" tabindex="-1" role="button"><span class="ui-button-text"><span class="ui-icon fa fa-fw caret-down">▼</span></span></a>
|
|
102
|
+
html += '<input class="ui-textbutton-input" size="7" type="url" pattern="(mailto:.+@.+|https?://.+\\..+|\\[.*\\].*)" value="nothing" data-bind="css: { withButton: typeof $root.linkDialog !== \'undefined\' }, validatedValue: ' + propAccessor + ', ' + onfocusbinding + '" />';
|
|
103
|
+
html += '<a class="ui-textbutton-button" data-bind="visible: typeof $root.linkDialog !== \'undefined\', click: typeof $root.linkDialog !== \'undefined\' ? $root.linkDialog.bind($element.previousSibling) : false, button: { icons: { primary: \'fa fa-fw fa-ellipsis-h\' }, label: \'Opzioni\', text: false }">Opzioni</a>';
|
|
104
|
+
html += '</div>';
|
|
105
|
+
} else if (widget == 'integer') {
|
|
106
|
+
// at this time the "step" depends on max being greater than 100.
|
|
107
|
+
// maybe we should expose "step" as a configuration, too
|
|
108
|
+
var min = 0;
|
|
109
|
+
var max = 1000;
|
|
110
|
+
if (model !== null && typeof model._max !== 'undefined') max = model._max;
|
|
111
|
+
if (model !== null && typeof model._min !== 'undefined') min = model._min;
|
|
112
|
+
var step = (max - min) >= 100 ? 10 : 1;
|
|
113
|
+
var page = step * 5;
|
|
114
|
+
html += '<input class="number-spinner" size="7" step="' + step + '" type="number" value="-1" data-bind="spinner: { min: ' + min + ', max: ' + max + ', page: ' + page + ', value: ' + propAccessor + ' }, valueUpdate: [\'change\', \'spin\']' + ', ' + onfocusbinding + '" />';
|
|
115
|
+
} else {
|
|
116
|
+
html += '<input size="7" type="text" value="nothing" data-bind="value: ' + propAccessor + ', ' + onfocusbinding + '" />';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
html += '</label>';
|
|
120
|
+
|
|
121
|
+
return html;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var _getGlobalStyleProp = function(globalStyles, model, prop, path) {
|
|
125
|
+
var globalStyleProp;
|
|
126
|
+
if (typeof model !== 'object' || model === null || typeof model._widget !== 'undefined') {
|
|
127
|
+
if (typeof prop !== 'undefined' && typeof path !== 'undefined' && path.length > 0 && typeof globalStyles == 'object' && typeof globalStyles[path] != 'undefined') {
|
|
128
|
+
globalStyleProp = globalStyles[path];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return globalStyleProp;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
var _propEditor = function(withBindingProvider, widgets, templateUrlConverter, model, themeModel, path, prop, editType, level, baseThreshold, globalStyles, globalStyleProp, trackUsage, rootPreviewBinding, previewBackground) {
|
|
135
|
+
if (typeof level == 'undefined') level = 0;
|
|
136
|
+
|
|
137
|
+
if (typeof prop !== 'undefined' && typeof model == 'object' && model !== null && typeof model._usecount === 'undefined') {
|
|
138
|
+
console.log("TODO EDITOR ignoring", path, "property because it is not used by the template", "prop:", prop, "type:", editType, "level:", level, withBindingProvider._templateName);
|
|
139
|
+
return "";
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var propAccessor = typeof globalStyleProp != 'undefined' ? prop + '._defaultComputed' : prop;
|
|
143
|
+
|
|
144
|
+
var html = "";
|
|
145
|
+
var title;
|
|
146
|
+
var ifSubsProp = propAccessor;
|
|
147
|
+
var ifSubsGutter = 1;
|
|
148
|
+
// typeof globalStyleProp != 'undefined' ? 1 : 2;
|
|
149
|
+
var ifSubsThreshold = 1;
|
|
150
|
+
|
|
151
|
+
// The visibility handling is a PITA
|
|
152
|
+
//
|
|
153
|
+
// Here are some "edge cases" to test whenever we change something here:
|
|
154
|
+
// LM social footer: removing shareVisibile must be reflected in the booleans sub-checks
|
|
155
|
+
// FLUID social block: multiple clicks on the "wand" should not make the editor invisible
|
|
156
|
+
// BIS heroMenu - By changing the menu visibility it should be reflected in style editors for the menu links
|
|
157
|
+
// FLUID almost every block with a color variant sometimes keeps showing style editor for the hidden variant.
|
|
158
|
+
if (typeof model == 'object' && model !== null && typeof model._widget == 'undefined') {
|
|
159
|
+
// Do nothing here
|
|
160
|
+
} else {
|
|
161
|
+
if (typeof globalStyleProp == 'undefined') {
|
|
162
|
+
ifSubsGutter += 1;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// NOTE baseThreshold is added only when globalStyle is not defined because when we have globalStyle
|
|
167
|
+
// we're going to bind the computed values and not the original and this way we don't add ourserf to the dependency
|
|
168
|
+
// tracking (subscriptionCount)
|
|
169
|
+
// NOTE baseThreshold is an "expression" and not a fixed number, so this is a concatenation
|
|
170
|
+
if (typeof globalStyleProp == 'undefined' && typeof baseThreshold !== 'undefined') ifSubsThreshold += baseThreshold;
|
|
171
|
+
|
|
172
|
+
if (typeof prop != 'undefined' && !!trackUsage) {
|
|
173
|
+
html += '<!-- ko ifSubs: { data: ' + ifSubsProp + ', threshold: ' + ifSubsThreshold + ', gutter: ' + ifSubsGutter + ' } -->';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (typeof prop != 'undefined' && (model === null || typeof model._name == 'undefined')) {
|
|
177
|
+
// TODO throw exception?
|
|
178
|
+
console.log("TODO WARN Missing label for property ", prop);
|
|
179
|
+
}
|
|
180
|
+
if (typeof prop == 'undefined' && model !== null && typeof model._name == 'undefined') {
|
|
181
|
+
console.log("TODO WARN Missing label for object ", model.type /*, model */ );
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (typeof model == 'object' && model !== null && typeof model._widget == 'undefined') {
|
|
185
|
+
var props = _filterProps(model, editType, level);
|
|
186
|
+
|
|
187
|
+
var hasCustomStyle = editType == 'styler' && model !== null && typeof model.customStyle !== 'undefined' && typeof globalStyleProp !== 'undefined';
|
|
188
|
+
var selectedItemBinding = '';
|
|
189
|
+
var additionalClasses = '';
|
|
190
|
+
if (typeof prop !== 'undefined' && editType == 'edit') {
|
|
191
|
+
selectedItemBinding = ', click: function(obj, evt) { $root.selectItem(' + prop + ', $data); return false }, clickBubble: false, css: { selecteditem: $root.isSelectedItem(' + prop + ') }, scrollIntoView: $root.isSelectedItem(' + prop + '), ';
|
|
192
|
+
additionalClasses += ' selectable';
|
|
193
|
+
}
|
|
194
|
+
if (hasCustomStyle) {
|
|
195
|
+
additionalClasses += ' supportsCustomStyles';
|
|
196
|
+
}
|
|
197
|
+
html += '<div class="objEdit level' + level + additionalClasses + '" data-bind="tooltips: {}' + selectedItemBinding + '">';
|
|
198
|
+
var modelName = (model !== null && typeof model._name != 'undefined' ? model._name : (typeof prop !== 'undefined' ? '[' + prop + ']' : ''));
|
|
199
|
+
if (hasCustomStyle) {
|
|
200
|
+
var themeSectionName = 'Stile';
|
|
201
|
+
if (typeof themeModel !== 'undefined' && themeModel !== null && typeof themeModel._name !== 'undefined') {
|
|
202
|
+
themeSectionName = themeModel._name;
|
|
203
|
+
} else {
|
|
204
|
+
console.log("TODO missing label for theme section ", prop, model !== null ? model.type : '-');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
modelName = '<span class="blockSelectionMethod" data-bind="text: customStyle() ? $root.ut(\'template\', \'' + utils.addSlashes(modelName) + '\') : $root.ut(\'template\', \'' + utils.addSlashes(themeSectionName) + '\')">Block</span>';
|
|
208
|
+
} else {
|
|
209
|
+
modelName = '<span data-bind="text: $root.ut(\'template\', \'' + utils.addSlashes(modelName) + '\')">' + modelName + '</span>';
|
|
210
|
+
}
|
|
211
|
+
title = model !== null && typeof model._help !== 'undefined' ? ' title="' + utils.addSlashes(model._help) + '" data-bind="attr: { title: $root.ut(\'template\', \'' + utils.addSlashes(model._help) + '\') }"' : '';
|
|
212
|
+
html += '<span' + title + ' class="objLabel level' + level + '">' + modelName + '</span>';
|
|
213
|
+
|
|
214
|
+
if (editType == 'edit' && typeof model._blockDescription !== 'undefined') {
|
|
215
|
+
html += '<div class="blockDescription" data-bind="html: $root.ut(\'template\', \'' + utils.addSlashes(model._blockDescription) + '\')">' + model._blockDescription + '</div>';
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* CUSTOM STYLE */
|
|
219
|
+
if (hasCustomStyle) {
|
|
220
|
+
html += '<label class="data-boolean blockCheck" data-bind="tooltips: { }">';
|
|
221
|
+
html += '<input type="checkbox" value="nothing" data-bind="focusable: true, checked: customStyle" />';
|
|
222
|
+
html += '<span title="Switch between global and block level styles editing" data-bind="attr: { title: $root.t(\'Switch between global and block level styles editing\') }" class="checkbox-replacer checkbox-replacer-onoff"></span>'; // data-bind="tooltip: { content: \'personalizza tutti\' }"
|
|
223
|
+
html += '</label>';
|
|
224
|
+
html += '<!-- ko template: { name: \'customstyle\', if: customStyle } --><!-- /ko -->';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (typeof prop != 'undefined') {
|
|
228
|
+
html += '<!-- ko with: ' + prop + ' -->';
|
|
229
|
+
|
|
230
|
+
/* PREVIEW */
|
|
231
|
+
if (level == 1 && typeof prop != 'undefined') {
|
|
232
|
+
if (typeof model._previewBindings != 'undefined' && typeof withBindingProvider != 'undefined') {
|
|
233
|
+
if (typeof rootPreviewBinding != 'undefined') html += '<!-- ko with: $root.content() --><div class="objPreview" data-bind="' + rootPreviewBinding + '"></div><!-- /ko -->';
|
|
234
|
+
if (typeof previewBackground != 'undefined') html += '<!-- ko with: $parent --><div class="objPreview" data-bind="' + previewBackground + '"></div><!-- /ko -->';
|
|
235
|
+
var previewBindings = elaborateDeclarations(undefined, model._previewBindings, templateUrlConverter, withBindingProvider.bind(this, path + '.'));
|
|
236
|
+
html += '<div class="objPreview"><div class="objPreviewInner" data-bind="' + previewBindings + '"></div></div>';
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* PREVIEW */
|
|
242
|
+
var previewBG;
|
|
243
|
+
if (level === 0) {
|
|
244
|
+
if (typeof model._previewBindings != 'undefined') {
|
|
245
|
+
previewBG = elaborateDeclarations(undefined, model._previewBindings, templateUrlConverter, withBindingProvider.bind(this, path.length > 0 ? path + '.' : ''));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
var i, newPath;
|
|
250
|
+
|
|
251
|
+
var before = html.length;
|
|
252
|
+
|
|
253
|
+
var newThemeModel;
|
|
254
|
+
var newGlobalStyleProp;
|
|
255
|
+
|
|
256
|
+
for (i = 0; i < props.length; i++) {
|
|
257
|
+
newPath = path.length > 0 ? path + "." + props[i] : props[i];
|
|
258
|
+
if (typeof model[props[i]] != 'object' || model[props[i]] === null || typeof model[props[i]]._widget != 'undefined') {
|
|
259
|
+
newGlobalStyleProp = undefined;
|
|
260
|
+
if (level === 0 && props[i] == 'theme')
|
|
261
|
+
html += _propEditor(withBindingProvider, widgets, templateUrlConverter, model[props[i]], newThemeModel, newPath, props[i], editType, 0, baseThreshold, undefined, undefined, trackUsage, rootPreviewBinding);
|
|
262
|
+
else {
|
|
263
|
+
newGlobalStyleProp = _getGlobalStyleProp(globalStyles, model[props[i]], props[i], newPath);
|
|
264
|
+
html += _propEditor(withBindingProvider, widgets, templateUrlConverter, model[props[i]], newThemeModel, newPath, props[i], editType, level + 1, baseThreshold, globalStyles, newGlobalStyleProp, trackUsage, rootPreviewBinding, previewBG);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
for (i = 0; i < props.length; i++) {
|
|
269
|
+
newPath = path.length > 0 ? path + "." + props[i] : props[i];
|
|
270
|
+
if (!(typeof model[props[i]] != 'object' || model[props[i]] === null || typeof model[props[i]]._widget != 'undefined')) {
|
|
271
|
+
newGlobalStyleProp = undefined;
|
|
272
|
+
if (level === 0 && props[i] == 'theme')
|
|
273
|
+
html += _propEditor(withBindingProvider, widgets, templateUrlConverter, model[props[i]], newThemeModel, newPath, props[i], editType, 0, baseThreshold, undefined, undefined, trackUsage, rootPreviewBinding);
|
|
274
|
+
else {
|
|
275
|
+
newGlobalStyleProp = _getGlobalStyleProp(globalStyles, model[props[i]], props[i], newPath);
|
|
276
|
+
html += _propEditor(withBindingProvider, widgets, templateUrlConverter, model[props[i]], newThemeModel, newPath, props[i], editType, level + 1, baseThreshold, globalStyles, newGlobalStyleProp, trackUsage, rootPreviewBinding, previewBG);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
var added = html.length - before;
|
|
282
|
+
if (added === 0) {
|
|
283
|
+
// No editable content: if this is in context "template" we leave it empty, otherwise we show an help.
|
|
284
|
+
if (typeof model == 'object' && model !== null && model._context == 'template') {
|
|
285
|
+
return '';
|
|
286
|
+
} else {
|
|
287
|
+
// TODO move me to a tmpl?
|
|
288
|
+
html += '<div class="objEmpty" data-bind="html: $root.t(\'Selected element has no editable properties\')">Selected element has no editable properties</div>';
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (typeof prop != 'undefined') {
|
|
293
|
+
html += '<!-- /ko -->';
|
|
294
|
+
}
|
|
295
|
+
html += '</div>';
|
|
296
|
+
|
|
297
|
+
} else {
|
|
298
|
+
var checkboxes = true;
|
|
299
|
+
|
|
300
|
+
if (typeof globalStyles == 'undefined') checkboxes = false;
|
|
301
|
+
|
|
302
|
+
if (model === null || typeof model != 'object' || typeof model._widget != 'undefined') {
|
|
303
|
+
var bindings = [];
|
|
304
|
+
|
|
305
|
+
if (typeof globalStyleProp != 'undefined') bindings.push('css: { notnull: ' + prop + '() !== null }');
|
|
306
|
+
title = model !== null && typeof model._help !== 'undefined' ? ' title="' + utils.addSlashes(model._help) + '" data-bind="attr: { title: $root.ut(\'template\', \'' + utils.addSlashes(model._help) + '\') }"' : '';
|
|
307
|
+
if (title.length > 0) bindings.push('tooltips: {}');
|
|
308
|
+
var bind = bindings.length > 0 ? 'data-bind="' + utils.addSlashes(bindings.join()) + '"' : '';
|
|
309
|
+
html += '<div class="propEditor ' + (checkboxes ? 'checkboxes' : '') + '"' + bind + '>';
|
|
310
|
+
|
|
311
|
+
var modelName2 = (model !== null && typeof model._name != 'undefined' ? model._name : (typeof prop !== 'undefined' ? '[' + prop + ']' : ''));
|
|
312
|
+
modelName2 = '<span data-bind="text: $root.ut(\'template\', \'' + utils.addSlashes(modelName2) + '\')">' + modelName2 + '</span>';
|
|
313
|
+
html += '<span' + title + ' class="propLabel">' + modelName2 + '</span>';
|
|
314
|
+
html += '<div class="propInput ' + (typeof globalStyles != 'undefined' ? 'local' : '') + '" data-bind="css: { default: ' + prop + '() === null }">';
|
|
315
|
+
html += _propInput(model, prop, propAccessor, editType, widgets);
|
|
316
|
+
html += '</div>';
|
|
317
|
+
if (typeof globalStyleProp != 'undefined') {
|
|
318
|
+
html += '<div class="propInput global" data-bind="css: { overridden: ' + prop + '() !== null }">';
|
|
319
|
+
html += _propInput(model, prop, globalStyleProp, editType, widgets);
|
|
320
|
+
html += '</div>';
|
|
321
|
+
|
|
322
|
+
if (checkboxes) {
|
|
323
|
+
html += '<div class="propCheck"><label data-bind="tooltips: {}"><input type="checkbox" data-bind="focusable: true, click: function(evt, obj) { $root.localGlobalSwitch(' + prop + ', ' + globalStyleProp + '); return true; }, checked: ' + prop + '() !== null">';
|
|
324
|
+
html += '<span class="checkbox-replacer" data-bind="css: { checked: ' + prop + '() !== null }, attr: { title: $root.t(\'This style is specific for this block: click here to remove the custom style and revert to the theme value\') }"></span>';
|
|
325
|
+
html += '</label></div>';
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
html += '</div>';
|
|
329
|
+
} else if (model === null || typeof model != 'object') {
|
|
330
|
+
// TODO remove debug output
|
|
331
|
+
html += '<div class="propEditor unknown">[A|' + prop + "|" + typeof model + ']</div>';
|
|
332
|
+
} else {
|
|
333
|
+
// TODO remove debug output
|
|
334
|
+
html += '<div class="propEditor unknown">[B|' + prop + "|" + typeof model + ']</div>';
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (typeof prop != 'undefined' && !!trackUsage) {
|
|
341
|
+
html += '<!-- /ko -->';
|
|
342
|
+
html += '<!-- ko ifSubs: { not: true, data: ' + ifSubsProp + ', threshold: ' + ifSubsThreshold + ', gutter: 0 } -->';
|
|
343
|
+
html += '<span class="label notused">(' + prop + ')</span>';
|
|
344
|
+
html += '<!-- /ko -->';
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return html;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
var createBlockEditor = function(defs, widgets, themeUpdater, templateUrlConverter, rootModelName, templateName, editType, templateCreator, baseThreshold, trackGlobalStyles, trackUsage, fromLevel) {
|
|
352
|
+
if (typeof trackUsage == 'undefined') trackUsage = true;
|
|
353
|
+
var model = modelDef.getDef(defs, templateName);
|
|
354
|
+
|
|
355
|
+
var rootModel = modelDef.getDef(defs, rootModelName);
|
|
356
|
+
var rootPreviewBindings;
|
|
357
|
+
if (typeof rootModel._previewBindings != 'undefined' && templateName != 'thaeme' && editType == 'styler') {
|
|
358
|
+
rootPreviewBindings = elaborateDeclarations(undefined, rootModel._previewBindings, templateUrlConverter, modelDef.getBindValue.bind(undefined, defs, themeUpdater, rootModelName, rootModelName, ''));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
var globalStyles = typeof trackGlobalStyles != 'undefined' && trackGlobalStyles ? defs[templateName]._globalStyles : undefined;
|
|
362
|
+
var globalStyleProp = typeof trackGlobalStyles != 'undefined' && trackGlobalStyles ? defs[templateName]._globalStyle : undefined;
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
var themeModel;
|
|
366
|
+
if (typeof globalStyleProp !== 'undefined') {
|
|
367
|
+
var mm = modelDef.getDef(defs, 'theme');
|
|
368
|
+
// TODO remove deprecated $theme
|
|
369
|
+
themeModel = mm[globalStyleProp.replace(/^(\$theme|_theme_)\./, '')];
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
var withBindingProvider = modelDef.getBindValue.bind(undefined, defs, themeUpdater, rootModelName, templateName);
|
|
374
|
+
withBindingProvider._templateName = templateName;
|
|
375
|
+
|
|
376
|
+
var html = '<div class="editor">';
|
|
377
|
+
html += "<div class=\"blockType" + (typeof globalStyles != 'undefined' ? " withdefaults" : "") + "\">" + model.type + "</div>";
|
|
378
|
+
|
|
379
|
+
var editorContent = _propEditor(withBindingProvider, widgets, templateUrlConverter, model, themeModel, "", undefined, editType, fromLevel, baseThreshold, globalStyles, globalStyleProp, trackUsage, rootPreviewBindings);
|
|
380
|
+
if (editorContent.length > 0) {
|
|
381
|
+
html += editorContent;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
html += '</div>';
|
|
385
|
+
|
|
386
|
+
templateCreator(html, templateName, editType);
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
var createBlockEditors = function(defs, widgets, themeUpdater, templateUrlConverter, rootModelName, templateName, templateCreator, baseThreshold) {
|
|
390
|
+
createBlockEditor(defs, widgets, themeUpdater, templateUrlConverter, rootModelName, templateName, 'edit', templateCreator, baseThreshold);
|
|
391
|
+
createBlockEditor(defs, widgets, themeUpdater, templateUrlConverter, rootModelName, templateName, 'styler', templateCreator, baseThreshold, true);
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
var generateEditors = function(templateDef, widgets, templateUrlConverter, templateCreator, baseThreshold) {
|
|
395
|
+
var defs = templateDef._defs;
|
|
396
|
+
var templateName = templateDef.templateName;
|
|
397
|
+
var blocks = templateDef._blocks;
|
|
398
|
+
var idx;
|
|
399
|
+
var blockDefs = [];
|
|
400
|
+
for (idx = 0; idx < blocks.length; idx++) {
|
|
401
|
+
if (typeof blocks[idx].container !== 'undefined') {
|
|
402
|
+
blockDefs.push(modelDef.generateModel(defs, blocks[idx].block));
|
|
403
|
+
}
|
|
404
|
+
createBlockEditors(defs, widgets, undefined, templateUrlConverter, blocks[idx].root, blocks[idx].block, templateCreator, baseThreshold);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (typeof defs['theme'] != 'undefined') createBlockEditor(defs, widgets, undefined, templateUrlConverter, templateName, 'theme', 'styler', templateCreator, undefined, false, false, -1);
|
|
408
|
+
return blockDefs;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
module.exports = generateEditors;
|