gophish/static/js/ng-ckeditor.js
unknown 4488a7aaba Initial run of getting full CKEditor support into the HTML editors!
Still some work to be done, but I think it's in an improvement.
2015-02-12 22:21:50 -06:00

9 lines
2.2 KiB
JavaScript

/*! ngCkeditor v0.2.1 by Vitalii Savchuk(esvit666@gmail.com) - https://github.com/esvit/ng-ckeditor - New BSD License */
(function(b,c){if("function"===typeof define&&define.amd)define(["angular","ckeditor"],function(b){return c(b)});else return c(b)})(angular||null,function(b){var c=b.module("ngCkeditor",[]),g,f=!1;c.run(["$q","$timeout",function(c,m){function e(){"loaded"===CKEDITOR.status?(f=!0,g.resolve()):e()}g=c.defer();if(b.isUndefined(CKEDITOR))throw Error("CKEDITOR not found");CKEDITOR.disableAutoInline=!0;CKEDITOR.on("loaded",e);m(e,100)}]);c.directive("ckeditor",["$timeout","$q",function(c,m){return{restrict:"AC",
require:["ngModel","^?form"],scope:!1,link:function(e,h,s,a){var k=a[0],q=a[1]||null,r="textarea"===h[0].tagName.toLowerCase(),n=[],p=!1;r||h.attr("contenteditable",!0);a=function(){var a={toolbar:"full",toolbar_full:[{name:"basicstyles",items:["Bold","Italic","Strike","Underline"]},{name:"paragraph",items:["BulletedList","NumberedList","Blockquote"]},{name:"editing",items:["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"]},{name:"links",items:["Link","Unlink","Anchor"]},{name:"tools",
items:["SpellChecker","Maximize"]},"/",{name:"styles",items:"Format FontSize TextColor PasteText PasteFromWord RemoveFormat".split(" ")},{name:"insert",items:["Image","Table","SpecialChar"]},{name:"forms",items:["Outdent","Indent"]},{name:"clipboard",items:["Undo","Redo"]},{name:"document",items:["PageBreak","Source"]}],disableNativeSpellChecker:!1,uiColor:"#FAFAFA",height:"400px",width:"100%"},a=b.extend(a,e[s.ckeditor]),d=r?CKEDITOR.replace(h[0],a):CKEDITOR.inline(h[0],a),g=m.defer();h.bind("$destroy",
function(){d.destroy(!1)});var l=function(a){var b=d.getData();""===b&&(b=null);c(function(){!0===a&&b===k.$viewValue||k.$setViewValue(b);!0===a&&q&&q.$setPristine()},0)},f=function(a){if(n.length){var b=n.pop()||"<p></p>";p=!1;d.setData(b,function(){l(a);p=!0})}};d.on("change",l);d.on("blur",l);d.on("instanceReady",function(){e.$broadcast("ckeditor.ready");e.$apply(function(){f(!0)});d.document.on("keyup",l)});d.on("customConfigLoaded",function(){g.resolve()});k.$render=function(){n.push(k.$viewValue);
p&&f()}};"loaded"===CKEDITOR.status&&(f=!0);f?a():g.promise.then(a)}}}]);return c});
/*
//@ sourceMappingURL=ng-ckeditor.min.map
*/