{I" class:ETI"BundledAsset;FI"logical_path;TI"0bootstrap-wysihtml5/bootstrap3-wysihtml5.js;TI" pathname;TI"‹D:/Ruby215/lib/ruby/gems/2.1.0/gems/bootstrap-wysihtml5-rails-0.3.3.6/vendor/assets/javascripts/bootstrap-wysihtml5/bootstrap3-wysihtml5.js;TI"content_type;TI"application/javascript;TI" mtime;Tl+Í%çTI" length;Ti<#I" digest;TI"%8df3797891059d72d8a68609d510618e;FI" source;TI"<#/* jshint expr: true */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define('bootstrap.wysihtml5', ['jquery', 'wysihtml5', 'bootstrap', 'bootstrap.wysihtml5.templates', 'bootstrap.wysihtml5.commands'], factory); } else { // Browser globals factory(jQuery, wysihtml5); } }(function ($, wysihtml5) { var bsWysihtml5 = function($, wysihtml5) { 'use strict'; var templates = function(key, locale, options) { if(wysihtml5.tpl[key]) { return wysihtml5.tpl[key]({locale: locale, options: options}); } }; var Wysihtml5 = function(el, options) { this.el = el; var toolbarOpts = $.extend(true, {}, defaultOptions, options); for(var t in toolbarOpts.customTemplates) { wysihtml5.tpl[t] = toolbarOpts.customTemplates[t]; } this.toolbar = this.createToolbar(el, toolbarOpts); this.editor = this.createEditor(toolbarOpts); }; 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 wysihtml5.Editor(this.el[0], options); // #30 - body is in IE 10 not created by default, which leads to nullpointer // 2014/02/13 - adapted to wysihtml5-0.4, does not work in IE if(editor.composer.editableArea.contentDocument) { this.addMoreShortcuts(editor, editor.composer.editableArea.contentDocument.body || editor.composer.editableArea.contentDocument, options.shortcuts); } else { this.addMoreShortcuts(editor, editor.composer.editableArea, options.shortcuts); } if(options && options.events) { for(var eventName in options.events) { editor.on(eventName, options.events[eventName]); } } editor.on('beforeload', this.syncBootstrapDialogEvents); //syncBootstrapDialogEvents(); return editor; }, //sync wysihtml5 events for dialogs with bootstrap events syncBootstrapDialogEvents: function() { var editor = this; $.map(this.toolbar.commandMapping, function(value, index) { return [value]; }).filter(function(commandObj, idx, arr) { return commandObj.dialog; }).map(function(commandObj, idx, arr) { return commandObj.dialog; }).forEach(function(dialog, idx, arr) { dialog.on('show', function(event) { $(this.container).modal('show'); }); dialog.on('hide', function(event) { $(this.container).modal('hide'); editor.composer.focus(); }); $(dialog.container).on('shown.bs.modal', function () { $(this).find('input, select, textarea').first().focus(); }); }); }, createToolbar: function(el, options) { var self = this; var toolbar = $('