xmt_froala 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/xmt_froala.js +31 -0
- data/app/assets/stylesheets/xmt_froala.css +17 -0
- data/app/controllers/xmt_froala/application_controller.rb +5 -0
- data/app/controllers/xmt_froala/assets_controller.rb +94 -0
- data/app/models/xmt_froala/asset_uploader.rb +107 -0
- data/app/models/xmt_froala/file_uploader.rb +10 -0
- data/app/models/xmt_froala/flash_uploader.rb +10 -0
- data/app/models/xmt_froala/image_uploader.rb +10 -0
- data/app/models/xmt_froala/media_uploader.rb +10 -0
- data/config/routes.rb +6 -0
- data/lib/generators/xmt_froala/install/USAGE +10 -0
- data/lib/generators/xmt_froala/install/install_generator.rb +23 -0
- data/lib/generators/xmt_froala/install/templates/application.js +17 -0
- data/lib/generators/xmt_froala/install/templates/xmt_froala.rb +29 -0
- data/lib/generators/xmt_froala/migration/USAGE +14 -0
- data/lib/generators/xmt_froala/migration/migration_generator.rb +36 -0
- data/lib/generators/xmt_froala/migration/templates/migration/migration.rb +18 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/asset.rb +14 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/file.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/flash.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/image.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/media.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/asset.rb +27 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/file.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/flash.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/image.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/media.rb +3 -0
- data/lib/tasks/xmt_froala_tasks.rake +9 -0
- data/lib/xmt_froala.rb +65 -0
- data/lib/xmt_froala/active_record.rb +14 -0
- data/lib/xmt_froala/engine.rb +32 -0
- data/lib/xmt_froala/formtastic.rb +12 -0
- data/lib/xmt_froala/helper.rb +105 -0
- data/lib/xmt_froala/simple_form.rb +11 -0
- data/lib/xmt_froala/version.rb +3 -0
- data/vendor/assets/javascripts/xmt_froala/froala_editor.js +0 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ar.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/bs.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/cs.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/da.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/de.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/en_ca.js +262 -0
- data/vendor/assets/javascripts/xmt_froala/languages/en_gb.js +262 -0
- data/vendor/assets/javascripts/xmt_froala/languages/es.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/et.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fa.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fi.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/he.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/hr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/hu.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/id.js +319 -0
- data/vendor/assets/javascripts/xmt_froala/languages/it.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ja.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ko.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/me.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/nb.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/nl.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pl.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pt_br.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pt_pt.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ro.js +319 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ru.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sk.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sv.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/th.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/tr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/uk.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/vi.js +258 -0
- data/vendor/assets/javascripts/xmt_froala/languages/zh_cn.js +320 -0
- data/vendor/assets/javascripts/xmt_froala/languages/zh_tw.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/align.js +139 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/align.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.js +154 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.js +3270 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_view.js +393 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_view.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/colors.js +492 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/colors.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/draggable.js +459 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/draggable.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.js +509 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/entities.js +121 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/entities.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/file.js +736 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/file.min.js +239 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_family.js +182 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_family.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_size.js +118 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_size.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/forms.js +430 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/forms.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.js +274 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/help.js +216 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/help.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image.js +3323 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.js +1056 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.js +94 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.js +537 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/link.js +1157 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/link.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/lists.js +462 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/lists.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.js +290 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.js +144 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/plain_paste.js +96 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/print.js +137 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/print.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_format.js +89 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.js +478 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quote.js +141 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quote.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/save.js +189 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/save.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.js +781 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/table.js +4194 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/table.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/url.js +194 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/url.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/video.js +2342 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/video.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.js +1403 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/embedly.js +543 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/embedly.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.js +163 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.js +222 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/xmt_froala.js +15172 -0
- data/vendor/assets/stylesheets/xmt_froala/css/font-awesome.css +2546 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.css +2902 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_style.css +413 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_style.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.css +57 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.css +112 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.css +155 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.css +43 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.css +42 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.css +146 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.css +28 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.css +52 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.css +244 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.css +266 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.css +37 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.css +70 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.css +51 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.css +181 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.css +231 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/red.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/red.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.css +64 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.css +72 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/xmt_froala.css +1423 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.svg +2671 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff2 +0 -0
- metadata +273 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(m){m.FE.PLUGINS.lists=function(d){function g(e){return'<span class="fr-open-'+e.toLowerCase()+'"></span>'}function c(e){return'<span class="fr-close-'+e.toLowerCase()+'"></span>'}function a(e,t){!function(e,t){for(var n=[],a=0;a<e.length;a++){var r=e[a].parentNode;"LI"==e[a].tagName&&r.tagName!=t&&n.indexOf(r)<0&&n.push(r)}for(a=n.length-1;0<=a;a--){var i=m(n[a]);i.replaceWith("<"+t.toLowerCase()+" "+d.node.attributes(i.get(0))+">"+i.html()+"</"+t.toLowerCase()+">")}}(e,t);var n,a=d.html.defaultTag(),r=null;e.length&&(n="rtl"==d.opts.direction||"rtl"==m(e[0]).css("direction")?"margin-right":"margin-left");for(var i=0;i<e.length;i++)if("LI"!=e[i].tagName){var o=d.helpers.getPX(m(e[i]).css(n))||0;(e[i].style.marginLeft=null)===r&&(r=o);var l=0<r?"<"+t+' style="'+n+": "+r+'px;">':"<"+t+">",s="</"+t+">";for(o-=r;0<o/d.opts.indentMargin;)l+="<"+t+">",s+=s,o-=d.opts.indentMargin;a&&e[i].tagName.toLowerCase()==a?m(e[i]).replaceWith(l+"<li"+d.node.attributes(e[i])+">"+m(e[i]).html()+"</li>"+s):m(e[i]).wrap(l+"<li></li>"+s)}d.clean.lists()}function r(e){var t,n;for(t=e.length-1;0<=t;t--)for(n=t-1;0<=n;n--)if(m(e[n]).find(e[t]).length||e[n]==e[t]){e.splice(t,1);break}var a=[];for(t=0;t<e.length;t++){var r=m(e[t]),i=e[t].parentNode,o=r.attr("class");if(r.before(c(i.tagName)),"LI"==i.parentNode.tagName)r.before(c("LI")),r.after(g("LI"));else{var l="";o&&(l+=' class="'+o+'"');var s="rtl"==d.opts.direction||"rtl"==r.css("direction")?"margin-right":"margin-left";d.helpers.getPX(m(i).css(s))&&0<=(m(i).attr("style")||"").indexOf(s+":")&&(l+=' style="'+s+":"+d.helpers.getPX(m(i).css(s))+'px;"'),d.html.defaultTag()&&0===r.find(d.html.blockTagsQuery()).length&&r.wrapInner("<"+d.html.defaultTag()+l+"></"+d.html.defaultTag()+">"),d.node.isEmpty(r.get(0),!0)||0!==r.find(d.html.blockTagsQuery()).length||r.append("<br>"),r.append(g("LI")),r.prepend(c("LI"))}r.after(g(i.tagName)),"LI"==i.parentNode.tagName&&(i=i.parentNode.parentNode),a.indexOf(i)<0&&a.push(i)}for(t=0;t<a.length;t++){var f=m(a[t]),p=f.html();p=(p=p.replace(/<span class="fr-close-([a-z]*)"><\/span>/g,"</$1>")).replace(/<span class="fr-open-([a-z]*)"><\/span>/g,"<$1>"),f.replaceWith(d.node.openTagString(f.get(0))+p+d.node.closeTagString(f.get(0)))}d.$el.find("li:empty").remove(),d.$el.find("ul:empty, ol:empty").remove(),d.clean.lists(),d.html.wrap()}function i(e){d.selection.save();for(var t=0;t<e.length;t++){var n=e[t].previousSibling;if(n){var a=m(e[t]).find("> ul, > ol").last().get(0);if(a){for(var r=m("<li>").prependTo(m(a)),i=d.node.contents(e[t])[0];i&&!d.node.isList(i);){var o=i.nextSibling;r.append(i),i=o}m(n).append(m(a)),m(e[t]).remove()}else{var l=m(n).find("> ul, > ol").last().get(0);if(l)m(l).append(m(e[t]));else{var s=m("<"+e[t].parentNode.tagName+">");m(n).append(s),s.append(m(e[t]))}}}}d.clean.lists(),d.selection.restore()}function o(e){d.selection.save(),r(e),d.selection.restore()}function e(e){if("indent"==e||"outdent"==e){for(var t=!1,n=d.selection.blocks(),a=[],r=0;r<n.length;r++)"LI"==n[r].tagName?(t=!0,a.push(n[r])):"LI"==n[r].parentNode.tagName&&(t=!0,a.push(n[r].parentNode));t&&("indent"==e?i(a):o(a))}}return{_init:function(){d.events.on("commands.after",e),d.events.on("keydown",function(e){if(e.which==m.FE.KEYCODE.TAB){for(var t=d.selection.blocks(),n=[],a=0;a<t.length;a++)"LI"==t[a].tagName?n.push(t[a]):"LI"==t[a].parentNode.tagName&&n.push(t[a].parentNode);if(1<n.length||n.length&&(d.selection.info(n[0]).atStart||d.node.isEmpty(n[0])))return e.preventDefault(),e.stopPropagation(),e.shiftKey?o(n):i(n),!1}},!0)},format:function(e){d.selection.save(),d.html.wrap(!0,!0,!0,!0),d.selection.restore();for(var t=d.selection.blocks(),n=0;n<t.length;n++)"LI"!=t[n].tagName&&"LI"==t[n].parentNode.tagName&&(t[n]=t[n].parentNode);d.selection.save(),function(e,t){for(var n=!0,a=0;a<e.length;a++){if("LI"!=e[a].tagName)return!1;e[a].parentNode.tagName!=t&&(n=!1)}return n}(t,e)?r(t):a(t,e),d.html.unwrap(),d.selection.restore()},refresh:function(e,t){var n=m(d.selection.element());if(n.get(0)!=d.el){var a=n.get(0);(a="LI"!=a.tagName&&a.firstElementChild&&"LI"!=a.firstElementChild.tagName?n.parents("li").get(0):"LI"==a.tagName||a.firstElementChild?a.firstElementChild&&"LI"==a.firstElementChild.tagName?n.get(0).firstChild:n.get(0):n.parents("li").get(0))&&a.parentNode.tagName==t&&d.el.contains(a.parentNode)&&e.addClass("fr-active")}}}},m.FE.RegisterCommand("formatUL",{title:"Unordered List",refresh:function(e){this.lists.refresh(e,"UL")},callback:function(){this.lists.format("UL")},plugin:"lists"}),m.FE.RegisterCommand("formatOL",{title:"Ordered List",refresh:function(e){this.lists.refresh(e,"OL")},callback:function(){this.lists.format("OL")},plugin:"lists"}),m.FE.DefineIcon("formatUL",{NAME:"list-ul"}),m.FE.DefineIcon("formatOL",{NAME:"list-ol"})});
|
@@ -0,0 +1,290 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function (factory) {
|
8
|
+
if (typeof define === 'function' && define.amd) {
|
9
|
+
// AMD. Register as an anonymous module.
|
10
|
+
define(['jquery'], factory);
|
11
|
+
} else if (typeof module === 'object' && module.exports) {
|
12
|
+
// Node/CommonJS
|
13
|
+
module.exports = function( root, jQuery ) {
|
14
|
+
if ( jQuery === undefined ) {
|
15
|
+
// require('jQuery') returns a factory that requires window to
|
16
|
+
// build a jQuery instance, we normalize how we use modules
|
17
|
+
// that require this pattern but the window provided is a noop
|
18
|
+
// if it's defined (how jquery works)
|
19
|
+
if ( typeof window !== 'undefined' ) {
|
20
|
+
jQuery = require('jquery');
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
jQuery = require('jquery')(root);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return factory(jQuery);
|
27
|
+
};
|
28
|
+
} else {
|
29
|
+
// Browser globals
|
30
|
+
factory(window.jQuery);
|
31
|
+
}
|
32
|
+
}(function ($) {
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
$.extend($.FE.DEFAULTS, {
|
37
|
+
paragraphFormat: {
|
38
|
+
N: 'Normal',
|
39
|
+
H1: 'Heading 1',
|
40
|
+
H2: 'Heading 2',
|
41
|
+
H3: 'Heading 3',
|
42
|
+
H4: 'Heading 4',
|
43
|
+
PRE: 'Code'
|
44
|
+
},
|
45
|
+
paragraphFormatSelection: false,
|
46
|
+
paragraphDefaultSelection: 'Paragraph Format'
|
47
|
+
})
|
48
|
+
|
49
|
+
$.FE.PLUGINS.paragraphFormat = function (editor) {
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Style content inside LI when LI is selected.
|
53
|
+
* This case happens only when the LI contains a nested list or when it has no block tag inside.
|
54
|
+
*/
|
55
|
+
function _styleLiWithoutBlocks($li, val) {
|
56
|
+
var defaultTag = editor.html.defaultTag();
|
57
|
+
|
58
|
+
// If val is null or default tag already do nothing.
|
59
|
+
if (val && val.toLowerCase() != defaultTag) {
|
60
|
+
|
61
|
+
// Deal with nested lists.
|
62
|
+
if ($li.find('ul, ol').length > 0) {
|
63
|
+
var $el = $('<' + val + '>');
|
64
|
+
$li.prepend($el);
|
65
|
+
var node = editor.node.contents($li.get(0))[0];
|
66
|
+
|
67
|
+
while (node && ['UL', 'OL'].indexOf(node.tagName) < 0) {
|
68
|
+
var next_node = node.nextSibling;
|
69
|
+
$el.append(node);
|
70
|
+
node = next_node;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
// Wrap list content.
|
75
|
+
else {
|
76
|
+
$li.html('<' + val + '>' + $li.html() + '</' + val + '>');
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Style content inside LI.
|
83
|
+
*/
|
84
|
+
function _styleLiWithBlocks($blk, val) {
|
85
|
+
var defaultTag = editor.html.defaultTag();
|
86
|
+
|
87
|
+
// Prepare a temp div.
|
88
|
+
if (!val || val.toLowerCase() == defaultTag) val = 'div class="fr-temp-div"';
|
89
|
+
|
90
|
+
$blk.replaceWith($('<' + val + '>').html($blk.html()));
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Style content inside TD.
|
95
|
+
*/
|
96
|
+
function _styleTdWithBlocks($blk, val) {
|
97
|
+
var defaultTag = editor.html.defaultTag();
|
98
|
+
|
99
|
+
// Prepare a temp div.
|
100
|
+
if (!val) val = 'div class="fr-temp-div"' + (editor.node.isEmpty($blk.get(0), true) ? ' data-empty="true"' : '');
|
101
|
+
|
102
|
+
// Return to the regular case. We don't use P inside TD/TH.
|
103
|
+
if (val.toLowerCase() == defaultTag) {
|
104
|
+
|
105
|
+
// If node is not empty, then add a BR.
|
106
|
+
if (!editor.node.isEmpty($blk.get(0), true)) {
|
107
|
+
$blk.append('<br/>');
|
108
|
+
}
|
109
|
+
|
110
|
+
$blk.replaceWith($blk.html());
|
111
|
+
}
|
112
|
+
|
113
|
+
// Replace with the new tag.
|
114
|
+
else {
|
115
|
+
$blk.replaceWith($('<' + val + '>').html($blk.html()));
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Basic style.
|
121
|
+
*/
|
122
|
+
function _style($blk, val) {
|
123
|
+
if (!val) val = 'div class="fr-temp-div"' + (editor.node.isEmpty($blk.get(0), true) ? ' data-empty="true"' : '');
|
124
|
+
$blk.replaceWith($('<' + val + ' ' + editor.node.attributes($blk.get(0)) + '>').html($blk.html()).removeAttr('data-empty'));
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Apply style.
|
129
|
+
*/
|
130
|
+
function apply (val) {
|
131
|
+
|
132
|
+
// Normal.
|
133
|
+
if (val == 'N') val = editor.html.defaultTag();
|
134
|
+
|
135
|
+
// Wrap.
|
136
|
+
editor.selection.save();
|
137
|
+
editor.html.wrap(true, true, !editor.opts.paragraphFormat.BLOCKQUOTE, true, true);
|
138
|
+
editor.selection.restore();
|
139
|
+
|
140
|
+
// Get blocks.
|
141
|
+
var blocks = editor.selection.blocks();
|
142
|
+
|
143
|
+
// Save selection to restore it later.
|
144
|
+
editor.selection.save();
|
145
|
+
|
146
|
+
editor.$el.find('pre').attr('skip', true);
|
147
|
+
|
148
|
+
// Go through each block and apply style to it.
|
149
|
+
for (var i = 0; i < blocks.length; i++) {
|
150
|
+
if (blocks[i].tagName != val && !editor.node.isList(blocks[i])) {
|
151
|
+
var $blk = $(blocks[i]);
|
152
|
+
|
153
|
+
// Style the content inside LI when there is selection right in LI.
|
154
|
+
if (blocks[i].tagName == 'LI') {
|
155
|
+
_styleLiWithoutBlocks($blk, val);
|
156
|
+
}
|
157
|
+
|
158
|
+
// Style the content inside LI when we have other tag in LI.
|
159
|
+
else if (blocks[i].parentNode.tagName == 'LI' && blocks[i]) {
|
160
|
+
_styleLiWithBlocks($blk, val);
|
161
|
+
}
|
162
|
+
|
163
|
+
// Style the content inside TD/TH.
|
164
|
+
else if (['TD', 'TH'].indexOf(blocks[i].parentNode.tagName) >= 0) {
|
165
|
+
_styleTdWithBlocks($blk, val);
|
166
|
+
}
|
167
|
+
|
168
|
+
// Regular case.
|
169
|
+
else {
|
170
|
+
_style($blk, val);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
// Join PRE together.
|
176
|
+
editor.$el.find('pre:not([skip="true"]) + pre:not([skip="true"])').each(function () {
|
177
|
+
$(this).prev().append('<br>' + $(this).html());
|
178
|
+
$(this).remove();
|
179
|
+
});
|
180
|
+
editor.$el.find('pre').removeAttr('skip');
|
181
|
+
|
182
|
+
// Unwrap temp divs.
|
183
|
+
editor.html.unwrap();
|
184
|
+
|
185
|
+
// Restore selection.
|
186
|
+
editor.selection.restore();
|
187
|
+
}
|
188
|
+
|
189
|
+
function refreshOnShow($btn, $dropdown) {
|
190
|
+
var blocks = editor.selection.blocks();
|
191
|
+
|
192
|
+
if (blocks.length) {
|
193
|
+
var blk = blocks[0];
|
194
|
+
var tag = 'N';
|
195
|
+
var default_tag = editor.html.defaultTag();
|
196
|
+
|
197
|
+
if (blk.tagName.toLowerCase() != default_tag && blk != editor.el) {
|
198
|
+
tag = blk.tagName;
|
199
|
+
}
|
200
|
+
|
201
|
+
$dropdown.find('.fr-command[data-param1="' + tag + '"]').addClass('fr-active').attr('aria-selected', true);
|
202
|
+
}
|
203
|
+
else {
|
204
|
+
$dropdown.find('.fr-command[data-param1="N"]').addClass('fr-active').attr('aria-selected', true);
|
205
|
+
}
|
206
|
+
}
|
207
|
+
|
208
|
+
function refresh ($btn) {
|
209
|
+
if (editor.opts.paragraphFormatSelection) {
|
210
|
+
var blocks = editor.selection.blocks();
|
211
|
+
|
212
|
+
if (blocks.length) {
|
213
|
+
var blk = blocks[0];
|
214
|
+
var tag = 'N';
|
215
|
+
var default_tag = editor.html.defaultTag();
|
216
|
+
|
217
|
+
if (blk.tagName.toLowerCase() != default_tag && blk != editor.el) {
|
218
|
+
tag = blk.tagName;
|
219
|
+
}
|
220
|
+
|
221
|
+
if (['LI', 'TD', 'TH'].indexOf(tag) >= 0) {
|
222
|
+
tag = 'N';
|
223
|
+
}
|
224
|
+
|
225
|
+
$btn.find('> span').text(editor.language.translate(editor.opts.paragraphFormat[tag]));
|
226
|
+
}
|
227
|
+
else {
|
228
|
+
$btn.find('> span').text(editor.language.translate(editor.opts.paragraphFormat.N));
|
229
|
+
}
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
233
|
+
return {
|
234
|
+
apply: apply,
|
235
|
+
refreshOnShow: refreshOnShow,
|
236
|
+
refresh: refresh
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
// Register the font size command.
|
241
|
+
$.FE.RegisterCommand('paragraphFormat', {
|
242
|
+
type: 'dropdown',
|
243
|
+
displaySelection: function (editor) {
|
244
|
+
return editor.opts.paragraphFormatSelection;
|
245
|
+
},
|
246
|
+
defaultSelection: function (editor) {
|
247
|
+
return editor.language.translate(editor.opts.paragraphDefaultSelection);
|
248
|
+
},
|
249
|
+
displaySelectionWidth: 125,
|
250
|
+
html: function () {
|
251
|
+
var c = '<ul class="fr-dropdown-list" role="presentation">';
|
252
|
+
var options = this.opts.paragraphFormat;
|
253
|
+
|
254
|
+
for (var val in options) {
|
255
|
+
if (options.hasOwnProperty(val)) {
|
256
|
+
var shortcut = this.shortcuts.get('paragraphFormat.' + val);
|
257
|
+
|
258
|
+
if (shortcut) {
|
259
|
+
shortcut = '<span class="fr-shortcut">' + shortcut + '</span>';
|
260
|
+
}
|
261
|
+
else {
|
262
|
+
shortcut = '';
|
263
|
+
}
|
264
|
+
|
265
|
+
c += '<li role="presentation"><' + (val == 'N' ? this.html.defaultTag() || 'DIV' : val) + ' style="padding: 0 !important; margin: 0 !important;" role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="paragraphFormat" data-param1="' + val + '" title="' + this.language.translate(options[val]) + '">' + this.language.translate(options[val]) + '</a></' + (val == 'N' ? this.html.defaultTag() || 'DIV' : val) + '></li>';
|
266
|
+
}
|
267
|
+
}
|
268
|
+
c += '</ul>';
|
269
|
+
|
270
|
+
return c;
|
271
|
+
},
|
272
|
+
title: 'Paragraph Format',
|
273
|
+
callback: function (cmd, val) {
|
274
|
+
this.paragraphFormat.apply(val);
|
275
|
+
},
|
276
|
+
refresh: function ($btn) {
|
277
|
+
this.paragraphFormat.refresh($btn);
|
278
|
+
},
|
279
|
+
refreshOnShow: function ($btn, $dropdown) {
|
280
|
+
this.paragraphFormat.refreshOnShow($btn, $dropdown);
|
281
|
+
},
|
282
|
+
plugin: 'paragraphFormat'
|
283
|
+
})
|
284
|
+
|
285
|
+
// Add the font size icon.
|
286
|
+
$.FE.DefineIcon('paragraphFormat', {
|
287
|
+
NAME: 'paragraph'
|
288
|
+
});
|
289
|
+
|
290
|
+
}));
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(a,e){return e===undefined&&(e="undefined"!=typeof window?require("jquery"):require("jquery")(a)),t(e)}:t(window.jQuery)}(function(g){g.extend(g.FE.DEFAULTS,{paragraphFormat:{N:"Normal",H1:"Heading 1",H2:"Heading 2",H3:"Heading 3",H4:"Heading 4",PRE:"Code"},paragraphFormatSelection:!1,paragraphDefaultSelection:"Paragraph Format"}),g.FE.PLUGINS.paragraphFormat=function(h){function f(a,e){var t=h.html.defaultTag();if(e&&e.toLowerCase()!=t)if(0<a.find("ul, ol").length){var r=g("<"+e+">");a.prepend(r);for(var n=h.node.contents(a.get(0))[0];n&&["UL","OL"].indexOf(n.tagName)<0;){var o=n.nextSibling;r.append(n),n=o}}else a.html("<"+e+">"+a.html()+"</"+e+">")}return{apply:function(a){"N"==a&&(a=h.html.defaultTag()),h.selection.save(),h.html.wrap(!0,!0,!h.opts.paragraphFormat.BLOCKQUOTE,!0,!0),h.selection.restore();var e,t,r,n,o,i,p,l,s=h.selection.blocks();h.selection.save(),h.$el.find("pre").attr("skip",!0);for(var d=0;d<s.length;d++)if(s[d].tagName!=a&&!h.node.isList(s[d])){var m=g(s[d]);"LI"==s[d].tagName?f(m,a):"LI"==s[d].parentNode.tagName&&s[d]?(i=m,p=a,l=h.html.defaultTag(),p&&p.toLowerCase()!=l||(p='div class="fr-temp-div"'),i.replaceWith(g("<"+p+">").html(i.html()))):0<=["TD","TH"].indexOf(s[d].parentNode.tagName)?(r=m,n=a,o=h.html.defaultTag(),n||(n='div class="fr-temp-div"'+(h.node.isEmpty(r.get(0),!0)?' data-empty="true"':"")),n.toLowerCase()==o?(h.node.isEmpty(r.get(0),!0)||r.append("<br/>"),r.replaceWith(r.html())):r.replaceWith(g("<"+n+">").html(r.html()))):(e=m,(t=a)||(t='div class="fr-temp-div"'+(h.node.isEmpty(e.get(0),!0)?' data-empty="true"':"")),e.replaceWith(g("<"+t+" "+h.node.attributes(e.get(0))+">").html(e.html()).removeAttr("data-empty")))}h.$el.find('pre:not([skip="true"]) + pre:not([skip="true"])').each(function(){g(this).prev().append("<br>"+g(this).html()),g(this).remove()}),h.$el.find("pre").removeAttr("skip"),h.html.unwrap(),h.selection.restore()},refreshOnShow:function(a,e){var t=h.selection.blocks();if(t.length){var r=t[0],n="N",o=h.html.defaultTag();r.tagName.toLowerCase()!=o&&r!=h.el&&(n=r.tagName),e.find('.fr-command[data-param1="'+n+'"]').addClass("fr-active").attr("aria-selected",!0)}else e.find('.fr-command[data-param1="N"]').addClass("fr-active").attr("aria-selected",!0)},refresh:function(a){if(h.opts.paragraphFormatSelection){var e=h.selection.blocks();if(e.length){var t=e[0],r="N",n=h.html.defaultTag();t.tagName.toLowerCase()!=n&&t!=h.el&&(r=t.tagName),0<=["LI","TD","TH"].indexOf(r)&&(r="N"),a.find("> span").text(h.language.translate(h.opts.paragraphFormat[r]))}else a.find("> span").text(h.language.translate(h.opts.paragraphFormat.N))}}}},g.FE.RegisterCommand("paragraphFormat",{type:"dropdown",displaySelection:function(a){return a.opts.paragraphFormatSelection},defaultSelection:function(a){return a.language.translate(a.opts.paragraphDefaultSelection)},displaySelectionWidth:125,html:function(){var a='<ul class="fr-dropdown-list" role="presentation">',e=this.opts.paragraphFormat;for(var t in e)if(e.hasOwnProperty(t)){var r=this.shortcuts.get("paragraphFormat."+t);r=r?'<span class="fr-shortcut">'+r+"</span>":"",a+='<li role="presentation"><'+("N"==t?this.html.defaultTag()||"DIV":t)+' style="padding: 0 !important; margin: 0 !important;" role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="paragraphFormat" data-param1="'+t+'" title="'+this.language.translate(e[t])+'">'+this.language.translate(e[t])+"</a></"+("N"==t?this.html.defaultTag()||"DIV":t)+"></li>"}return a+="</ul>"},title:"Paragraph Format",callback:function(a,e){this.paragraphFormat.apply(e)},refresh:function(a){this.paragraphFormat.refresh(a)},refreshOnShow:function(a,e){this.paragraphFormat.refreshOnShow(a,e)},plugin:"paragraphFormat"}),g.FE.DefineIcon("paragraphFormat",{NAME:"paragraph"})});
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function (factory) {
|
8
|
+
if (typeof define === 'function' && define.amd) {
|
9
|
+
// AMD. Register as an anonymous module.
|
10
|
+
define(['jquery'], factory);
|
11
|
+
} else if (typeof module === 'object' && module.exports) {
|
12
|
+
// Node/CommonJS
|
13
|
+
module.exports = function( root, jQuery ) {
|
14
|
+
if ( jQuery === undefined ) {
|
15
|
+
// require('jQuery') returns a factory that requires window to
|
16
|
+
// build a jQuery instance, we normalize how we use modules
|
17
|
+
// that require this pattern but the window provided is a noop
|
18
|
+
// if it's defined (how jquery works)
|
19
|
+
if ( typeof window !== 'undefined' ) {
|
20
|
+
jQuery = require('jquery');
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
jQuery = require('jquery')(root);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return factory(jQuery);
|
27
|
+
};
|
28
|
+
} else {
|
29
|
+
// Browser globals
|
30
|
+
factory(window.jQuery);
|
31
|
+
}
|
32
|
+
}(function ($) {
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
$.extend($.FE.DEFAULTS, {
|
37
|
+
paragraphStyles: {
|
38
|
+
'fr-text-gray': 'Gray',
|
39
|
+
'fr-text-bordered': 'Bordered',
|
40
|
+
'fr-text-spaced': 'Spaced',
|
41
|
+
'fr-text-uppercase': 'Uppercase'
|
42
|
+
},
|
43
|
+
paragraphMultipleStyles: true
|
44
|
+
});
|
45
|
+
|
46
|
+
$.FE.PLUGINS.paragraphStyle = function (editor) {
|
47
|
+
/**
|
48
|
+
* Apply style.
|
49
|
+
*/
|
50
|
+
function apply (val, paragraphStyles, paragraphMultipleStyles) {
|
51
|
+
if (typeof paragraphStyles == 'undefined') paragraphStyles = editor.opts.paragraphStyles;
|
52
|
+
|
53
|
+
if (typeof paragraphMultipleStyles == 'undefined') paragraphMultipleStyles = editor.opts.paragraphMultipleStyles;
|
54
|
+
|
55
|
+
var styles = '';
|
56
|
+
|
57
|
+
// Remove multiple styles.
|
58
|
+
if (!paragraphMultipleStyles) {
|
59
|
+
styles = Object.keys(paragraphStyles);
|
60
|
+
styles.splice(styles.indexOf(val), 1);
|
61
|
+
styles = styles.join(' ');
|
62
|
+
}
|
63
|
+
editor.selection.save();
|
64
|
+
editor.html.wrap(true, true, true, true);
|
65
|
+
editor.selection.restore();
|
66
|
+
|
67
|
+
var blocks = editor.selection.blocks();
|
68
|
+
|
69
|
+
// Save selection to restore it later.
|
70
|
+
editor.selection.save();
|
71
|
+
|
72
|
+
var hasClass = $(blocks[0]).hasClass(val);
|
73
|
+
|
74
|
+
for (var i = 0; i < blocks.length; i++) {
|
75
|
+
$(blocks[i]).removeClass(styles).toggleClass(val, !hasClass);
|
76
|
+
|
77
|
+
if ($(blocks[i]).hasClass('fr-temp-div')) $(blocks[i]).removeClass('fr-temp-div');
|
78
|
+
|
79
|
+
if ($(blocks[i]).attr('class') === '') $(blocks[i]).removeAttr('class');
|
80
|
+
}
|
81
|
+
|
82
|
+
// Unwrap temp divs.
|
83
|
+
editor.html.unwrap();
|
84
|
+
|
85
|
+
// Restore selection.
|
86
|
+
editor.selection.restore();
|
87
|
+
}
|
88
|
+
|
89
|
+
function refreshOnShow($btn, $dropdown) {
|
90
|
+
var blocks = editor.selection.blocks();
|
91
|
+
|
92
|
+
if (blocks.length) {
|
93
|
+
var $blk = $(blocks[0]);
|
94
|
+
|
95
|
+
$dropdown.find('.fr-command').each (function () {
|
96
|
+
var cls = $(this).data('param1');
|
97
|
+
var active = $blk.hasClass(cls);
|
98
|
+
$(this).toggleClass('fr-active', active).attr('aria-selected', active);
|
99
|
+
})
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
function _init () {
|
104
|
+
}
|
105
|
+
|
106
|
+
return {
|
107
|
+
_init: _init,
|
108
|
+
apply: apply,
|
109
|
+
refreshOnShow: refreshOnShow
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
// Register the font size command.
|
114
|
+
$.FE.RegisterCommand('paragraphStyle', {
|
115
|
+
type: 'dropdown',
|
116
|
+
html: function () {
|
117
|
+
var c = '<ul class="fr-dropdown-list" role="presentation">';
|
118
|
+
var options = this.opts.paragraphStyles;
|
119
|
+
|
120
|
+
for (var val in options) {
|
121
|
+
if (options.hasOwnProperty(val)) {
|
122
|
+
c += '<li role="presentation"><a class="fr-command ' + val + '" tabIndex="-1" role="option" data-cmd="paragraphStyle" data-param1="' + val + '" title="' + this.language.translate(options[val]) + '">' + this.language.translate(options[val]) + '</a></li>';
|
123
|
+
}
|
124
|
+
}
|
125
|
+
c += '</ul>';
|
126
|
+
|
127
|
+
return c;
|
128
|
+
},
|
129
|
+
title: 'Paragraph Style',
|
130
|
+
callback: function (cmd, val) {
|
131
|
+
this.paragraphStyle.apply(val);
|
132
|
+
},
|
133
|
+
refreshOnShow: function ($btn, $dropdown) {
|
134
|
+
this.paragraphStyle.refreshOnShow($btn, $dropdown);
|
135
|
+
},
|
136
|
+
plugin: 'paragraphStyle'
|
137
|
+
})
|
138
|
+
|
139
|
+
// Add the font size icon.
|
140
|
+
$.FE.DefineIcon('paragraphStyle', {
|
141
|
+
NAME: 'magic'
|
142
|
+
});
|
143
|
+
|
144
|
+
}));
|