@firestitch/froala
Version:
The next generation Javascript WYSIWYG HTML rich text editor made by devs for devs. High performance and modern design make it easy to use for developers and loved by users.
3 lines (2 loc) • 2.13 kB
JavaScript
!function(a,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],e):e(a.FroalaEditor)}(this,function(a){"use strict";a=a&&a.hasOwnProperty("default")?a.default:a,Object.assign(a.DEFAULTS,{paragraphStyles:{"fr-text-gray":"Gray","fr-text-bordered":"Bordered","fr-text-spaced":"Spaced","fr-text-uppercase":"Uppercase"},paragraphMultipleStyles:!0}),a.PLUGINS.paragraphStyle=function(o){var i=o.$;return{_init:function(){},apply:function(a,e,t){void 0===e&&(e=o.opts.paragraphStyles);var r="",l=((t=void 0===t?o.opts.paragraphMultipleStyles:t)||((r=Object.keys(e)).splice(r.indexOf(a),1),r=r.join(" ")),o.selection.save(),o.html.wrap(!0,!0,!0,!0),o.selection.restore(),o.selection.blocks());o.selection.save();for(var n=i(l[0]).hasClass(a),s=0;s<l.length;s++)i(l[s]).removeClass(r).toggleClass(a,!n),i(l[s]).hasClass("fr-temp-div")&&i(l[s]).removeClass("fr-temp-div"),""===i(l[s]).attr("class")&&i(l[s]).removeAttr("class");1===l.length&&"fr-text-bordered"===a&&null===l[0].nextSibling&&(t=i("<br>"),l[0].after(t[0])),o.html.unwrap(),o.selection.restore()},refreshOnShow:function(a,e){var t,r=o.selection.blocks();r.length&&(t=i(r[0]),e.find(".fr-command").each(function(){var a=i(this).data("param1"),a=t.hasClass(a);i(this).toggleClass("fr-active",a).attr("aria-selected",a)}))}}},a.RegisterCommand("paragraphStyle",{type:"dropdown",html:function(){var a,e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.paragraphStyles;for(a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command '.concat(a,'" tabIndex="-1" role="option" data-cmd="paragraphStyle" data-param1="').concat(a,'" title="').concat(this.language.translate(t[a]),'">').concat(this.language.translate(t[a]),"</a></li>"));return e+"</ul>"},title:"Paragraph Style",callback:function(a,e){this.paragraphStyle.apply(e)},refreshOnShow:function(a,e){this.paragraphStyle.refreshOnShow(a,e)},plugin:"paragraphStyle"}),a.DefineIcon("paragraphStyle",{NAME:"magic",SVG_KEY:"paragraphStyle"})});
//# sourceMappingURL=paragraph_style.min.min.js.map