1 /*! ngCkeditor v0.2.1 by Vitalii Savchuk(esvit666@gmail.com) - https://github.com/esvit/ng-ckeditor - New BSD License */
5 return "function" == typeof define && define.amd ? void define(["angular", "ckeditor"], function(a) {
8 }(angular || null, function(a) {
9 var b, c = a.module("ngCkeditor", ["ui.bootstrap"]),
11 return c.run(["$q", "$timeout", function(c, e) {
13 "loaded" === CKEDITOR.status ? (d = !0, b.resolve()) : f()
15 if (b = c.defer(), a.isUndefined(CKEDITOR)) throw new Error("CKEDITOR not found");
16 CKEDITOR.disableAutoInline = !0, CKEDITOR.on("loaded", f), e(f, 100)
17 }]), c.directive("ckeditor", ["$timeout", "$q", "$uibModal", function(c, e, $uibModal) {
20 require: ["ngModel", "^?form"],
22 link: function(f, g, h, i) {
26 m = "textarea" === g[0].tagName.toLowerCase(),
29 m || g.attr("contenteditable", !0);
35 items: ["Bold", "Italic", "Strike", "Underline"]
38 items: ["BulletedList", "NumberedList", "Blockquote"]
41 items: ["JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock"]
44 items: ["Link", "Unlink", "Anchor"]
47 items: ["SpellChecker", "Maximize"]
50 items: ["Format", "FontSize", "TextColor", "PasteText", "PasteFromWord", "RemoveFormat"]
53 items: ["Image", "Table", "SpecialChar"]
56 items: ["Outdent", "Indent"]
59 items: ["Undo", "Redo"]
62 items: ["PageBreak", "Source"]
64 disableNativeSpellChecker: !1,
69 b = a.extend(b, f[h.ckeditor].editorOptions);
70 var d = m ? CKEDITOR.replace(g[0], b) : CKEDITOR.inline(g[0], b),
72 g.bind("$destroy", function() {
73 d && CKEDITOR.instances[d.name] && CKEDITOR.instances[d.name].destroy()
77 "" === b && (b = null), c(function() {
78 (a !== !0 || b !== j.$viewValue) && j.$setViewValue(b), a === !0 && k && k.$setPristine()
84 o = !1, d.setData(b, function() {
90 d.on("angularfilepicker", function() {
91 var modalInstance = $uibModal.open({
92 templateUrl: Global.Theme.getURLPortal() + Liferay.ThemeDisplay.getPathJavaScript() + "/angularjs/file-selector/file-selector.html?t="+Liferay.extTimestamp,
93 controller: "FileSelectorController",
94 controllerAs: "FileSelectorCtrl",
96 parameters :function(){
98 authorizedExtensions: EntSavoie.imageExtensionArray,
99 isBase64Expected: true
105 modalInstance.result.then(function(attachFiles) {
107 for (index = 0 ; index < attachFiles.length ; ++ index) {
108 d.insertHtml("<img src='" + attachFiles[index].fileBase64 + "' alt='" + attachFiles[index].fileName + "'/>");
111 // Cancel file selection so don't do anything
115 d.on("change", p), d.on("blur", p), d.on("instanceReady", function() {
116 f.$broadcast("ckeditor.ready"), f.$apply(function() {
118 }), d.document.on("keyup", p)
119 }), d.on("customConfigLoaded", function() {
121 }), j.$render = function() {
122 n.push(j.$viewValue), o && q()
125 "loaded" === CKEDITOR.status && (d = !0), d ? p() : b.promise.then(p)
130 // sourceMappingURL=ng-ckeditor.min.js.map