/** * @license wysihtml5 v0.3.0 * https://github.com/xing/wysihtml5 * * Author: Christopher Blum (https://github.com/tiff) * * Copyright (C) 2012 XING AG * Licensed under the MIT license (MIT) * */ !function($, wysi) { "use strict"; var templates = { "font-styles": "", "emphasis": "
  • " + "
    " + "Bold" + "Italic" + "Underline" + "
    " + "
  • ", "lists": "
  • " + "
    " + "" + "" + "" + "" + "
    " + "
  • ", "link": "
  • " + "" + "" + "
  • ", "image": "
  • " + "" + "" + "
  • ", "html": "
  • " + "
    " + "" + "
    " + "
  • " }; var defaultOptions = { "font-styles": true, "emphasis": true, "lists": true, "html": false, "link": false, "image": false, events: {}, parserRules: { tags: { "b": {}, "i": {}, "br": {}, "ol": {}, "ul": {}, "li": {}, "h1": {}, "h2": {}, "u": 1, "img": { "check_attributes": { "width": "numbers", "alt": "alt", "src": "url", "height": "numbers" } }, "a": { set_attributes: { target: "_blank", rel: "nofollow" }, check_attributes: { href: "url" // important to avoid XSS } } } }, stylesheets: [] }; var Wysihtml5 = function(el, options) { this.el = el; this.toolbar = this.createToolbar(el, options || defaultOptions); 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 = $.extend(defaultOptions, 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 = $("