diff --git a/src/bootstrap-fa-wysihtml5.js b/src/bootstrap-fa-wysihtml5.js new file mode 100644 index 0000000..bec5eed --- /dev/null +++ b/src/bootstrap-fa-wysihtml5.js @@ -0,0 +1,458 @@ +!function($, wysi) { + "use strict"; + + var templates = function(key, locale) { + + var tpl = { + "font-styles": + "", + + "emphasis": + "
  • " + + "
    " + + "" + locale.emphasis.bold + "" + + "" + locale.emphasis.italic + "" + + "" + locale.emphasis.underline + "" + + "
    " + + "
  • ", + + "lists": + "
  • " + + "
    " + + "" + + "" + + "" + + "" + + "
    " + + "
  • ", + + "link": + "
  • " + + "" + + "" + + "
  • ", + + "image": + "
  • " + + "" + + "" + + "
  • ", + + "html": + "
  • " + + "
    " + + "" + + "
    " + + "
  • ", + + "color": + "" + }; + return tpl[key]; + }; + + + 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 = 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 = $("