-
Notifications
You must be signed in to change notification settings - Fork 2
/
bootstrap-ckeditor.min.js
1 lines (1 loc) · 2.54 KB
/
bootstrap-ckeditor.min.js
1
angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/ckeditor/ckeditor.html",'<div class="form-group" ng-class="{\'has-error\': hasError()}"><label class="control-label" ng-show="showTitle()">{{form.title}}</label> <textarea ng-show="form.key" style="background-color: white" type="text" class="form-control" schema-validate="form" ng-model="$$value$$" ckeditor="form.ckeditor"></textarea> <span class="help-block">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span></div>')}]),angular.module("schemaForm").config(["schemaFormProvider","schemaFormDecoratorsProvider","sfPathProvider",function(e,t,r){var o=function(t,o,n){if("string"===o.type&&"ckeditor"===o.format){var a=e.stdFormObj(t,o,n);return a.key=n.path,a.type="ckeditor",n.lookup[r.stringify(n.path)]=a,a}};e.defaults.string.unshift(o),t.addMapping("bootstrapDecorator","ckeditor","directives/decorators/bootstrap/ckeditor/ckeditor.html"),t.createDirective("ckeditor","directives/decorators/bootstrap/ckeditor/ckeditor.html")}]),function(e,t){return"function"==typeof define&&define.amd?void define(["angular","ckeditor"],function(e){return t(e)}):t(e)}(angular||null,function(e){var t,r=e.module("schemaForm"),o=!1;return r.run(["$q","$timeout",function(r,n){function a(){"loaded"==CKEDITOR.status?(o=!0,t.resolve()):a()}if(t=r.defer(),e.isUndefined(CKEDITOR))throw new Error("CKEDITOR not found");CKEDITOR.disableAutoInline=!0,CKEDITOR.on("loaded",a),n(a,100)}]),r.directive("ckeditor",["$timeout","$q",function(r,n){"use strict";return{restrict:"AC",require:["ngModel","^?form"],scope:!1,link:function(a,i,c,d){var s=d[0],l=d[1]||null,u="<p></p>",f="textarea"==i[0].tagName.toLowerCase(),m=[],p=!1;f||i.attr("contenteditable",!0);var h=function(){var t={toolbar:"full",disableNativeSpellChecker:!1,uiColor:"#FAFAFA",height:"400px",width:"100%"};if(c.ckeditor){var o=a.$eval(c.ckeditor);t=e.extend(t,o)}var d=f?CKEDITOR.replace(i[0],t):CKEDITOR.inline(i[0],t),h=n.defer();i.bind("$destroy",function(){d.destroy(!1)});var v=function(e){var t=d.getData();""==t&&(t=null),r(function(){(e!==!0||t!=s.$viewValue)&&s.$setViewValue(t),e===!0&&l&&l.$setPristine()},0)},k=function(e){if(m.length){var t=m.pop()||u;p=!1,d.setData(t,function(){v(e),p=!0})}};d.on("change",v),d.on("blur",v),d.on("instanceReady",function(){a.$broadcast("ckeditor.ready"),a.$apply(function(){k(!0)}),d.document.on("keyup",v)}),d.on("customConfigLoaded",function(){h.resolve()}),s.$render=function(){m.push(s.$viewValue),p&&k()}};"loaded"==CKEDITOR.status&&(o=!0),o?h():t.promise.then(h)}}}]),r});