!function($, wysi) { "use strict"; var tpl = { "font-styles": function(locale, options) { var size = (options && options.size) ? ' btn-'+options.size : ''; return ""; }, "emphasis": function(locale, options) { var size = (options && options.size) ? ' btn-'+options.size : ''; return "
  • " + "
    " + "" + locale.emphasis.bold + "" + "" + locale.emphasis.italic + "" + "" + locale.emphasis.underline + "" + "
    " + "
  • "; }, "lists": function(locale, options) { var size = (options && options.size) ? ' btn-'+options.size : ''; return "
  • " + "
    " + "" + "" + "" + "" + "
    " + "
  • "; }, "link": function(locale, options) { var size = (options && options.size) ? ' btn-'+options.size : ''; return "
  • " + "" + "" + "
  • "; }, "image": function(locale, options) { var size = (options && options.size) ? ' btn-'+options.size : ''; return "
  • " + "" + "" + "
  • "; }, "html": function(locale, options) { var size = (options && options.size) ? ' btn-'+options.size : ''; return "
  • " + "
    " + "" + "
    " + "
  • "; }, "color": function(locale, options) { var size = (options && options.size) ? ' btn-'+options.size : ''; return ""; } }; var templates = function(key, locale, options) { return tpl[key](locale, options); }; var Wysihtml5 = function(el, options) { this.el = el; var toolbarOpts = options || defaultOptions; for(var t in toolbarOpts.customTemplates) { tpl[t] = toolbarOpts.customTemplates[t]; } this.toolbar = this.createToolbar(el, toolbarOpts); this.editor = this.createEditor(options); window.editor = this.editor; $('iframe.wysihtml5-sandbox').each(function(i, el){ $(el.contentWindow).off('focus.wysihtml5').on({ 'focus.wysihtml5' : function(){ $('li.dropdown').removeClass('open'); } }); }); }; Wysihtml5.prototype = { constructor: Wysihtml5, createEditor: function(options) { options = options || {}; // Add the toolbar to a clone of the options object so multiple instances // of the WYISYWG don't break because "toolbar" is already defined options = $.extend(true, {}, options); options.toolbar = this.toolbar[0]; var editor = new wysi.Editor(this.el[0], options); if(options && options.events) { for(var eventName in options.events) { editor.on(eventName, options.events[eventName]); } } return editor; }, createToolbar: function(el, options) { var self = this; var toolbar = $("