/** * angular-medium-editor * @version v1.2.1 - 2017-01-16 * @link https://github.com/thijsw/angular-medium-editor * @author Thijs Wijnmaalen * @license MIT License, http://www.opensource.org/licenses/MIT */ "use strict";angular.module("angular-medium-editor",[]).directive("mediumEditor",function(){function a(a){var b,c=document.createElement("div");return c.innerHTML=a,b=c.textContent||"",b.trim()}return{require:"ngModel",restrict:"AE",scope:{bindOptions:"="},link:function(b,c,d,e){angular.element(c).addClass("angular-medium-editor"),e.editor=new MediumEditor(c,b.bindOptions),e.$render=function(){e.editor.setContent(e.$viewValue||"");var a=e.editor.getExtensionByName("placeholder");a&&a.updatePlaceholder(c[0])},e.$isEmpty=function(b){return/[<>]/.test(b)?0===a(b).length:b?0===b.length:!0},e.editor.subscribe("editableInput",function(a,b){e.$setViewValue(b.innerHTML.trim())}),b.$watch("bindOptions",function(a){e.editor.init(c,a)}),b.$on("$destroy",function(){e.editor.destroy()})}}});