angular2-froala-wysiwyg
Advanced tools
Comparing version 2.5.1-2 to 2.6.0
@@ -235,7 +235,11 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
this.registerEvent(this._$element, 'froalaEditor.contentChanged', function () { | ||
self.updateModel(); | ||
setTimeout(function () { | ||
self.updateModel(); | ||
}, 0); | ||
}); | ||
if (this._opts.immediateAngularModelUpdate) { | ||
this.registerEvent(this._editor, 'keyup', function () { | ||
self.updateModel(); | ||
setTimeout(function () { | ||
self.updateModel(); | ||
}, 0); | ||
}); | ||
@@ -242,0 +246,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("@angular/forms")):"function"==typeof define&&define.amd?define(["@angular/core","@angular/forms"],e):"object"==typeof exports?exports["angular2-froala-wysiwyg.umd.min"]=e(require("@angular/core"),require("@angular/forms")):t["angular2-froala-wysiwyg.umd.min"]=e(t["@angular/core"],t["@angular/forms"])}(this,function(t,e){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=8)}([function(e,n){e.exports=t},function(t,e,n){"use strict";var i=n(3);n.d(e,"a",function(){return i.a});var r=n(5);n.d(e,"b",function(){return r.a})},function(t,e,n){"use strict";var i=n(4);n.d(e,"a",function(){return i.a});var r=n(6);n.d(e,"b",function(){return r.a})},function(t,e,n){"use strict";var i=n(0),r=(n.n(i),n(7));n.n(r);n.d(e,"a",function(){return s});var o=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this._opts={immediateAngularModelUpdate:!1,angularIgnoreAttrs:null},this.SPECIAL_TAGS=["img","button","input","a"],this.INNER_HTML_ATTR="innerHTML",this._hasSpecialTag=!1,this._listeningEvents=[],this._editorInitialized=!1,this._oldModel=null,this.onChange=function(t){},this.onTouched=function(){},this.froalaModelChange=new i.EventEmitter,this.froalaInit=new i.EventEmitter;var e=t.nativeElement;this.SPECIAL_TAGS.indexOf(e.tagName.toLowerCase())!=-1&&(this._hasSpecialTag=!0),this._$element=$(e)}return t.prototype.writeValue=function(t){this.updateEditor(t)},t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},Object.defineProperty(t.prototype,"froalaEditor",{set:function(t){this._opts=t||this._opts},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"froalaModel",{set:function(t){this.updateEditor(t)},enumerable:!0,configurable:!0}),t.prototype.updateEditor=function(t){JSON.stringify(this._oldModel)!=JSON.stringify(t)&&(this._model=t,this._editorInitialized&&this.setContent())},t.prototype.updateModel=function(){var t=null;if(this._hasSpecialTag){for(var e=this._$element[0].attributes,n={},i=0;i<e.length;i++){var r=e[i].name;this._opts.angularIgnoreAttrs&&this._opts.angularIgnoreAttrs.indexOf(r)!=-1||(n[r]=e[i].value)}this._$element[0].innerHTML&&(n[this.INNER_HTML_ATTR]=this._$element[0].innerHTML),t=n}else{var o=this._$element.froalaEditor("html.get");"string"==typeof o&&(t=o)}this._oldModel=t,this.froalaModelChange.emit(t),this.onChange(t)},t.prototype.registerEvent=function(t,e,n){t&&e&&n&&(this._listeningEvents.push(e),t.on(e,n))},t.prototype.initListeners=function(){var t=this;this.registerEvent(this._$element,"froalaEditor.contentChanged",function(){t.updateModel()}),this._opts.immediateAngularModelUpdate&&this.registerEvent(this._editor,"keyup",function(){t.updateModel()})},t.prototype.registerFroalaEvents=function(){if(this._opts.events)for(var t in this._opts.events)this._opts.events.hasOwnProperty(t)&&this.registerEvent(this._$element,t,this._opts.events[t])},t.prototype.createEditor=function(){this._editorInitialized||(this.setContent(!0),this.registerFroalaEvents(),this._editor=this._$element.froalaEditor(this._opts).data("froala.editor").$el,this.initListeners(),this._editorInitialized=!0)},t.prototype.setHtml=function(){this._$element.froalaEditor("html.set",this._model||"",!0),this._$element.froalaEditor("undo.reset"),this._$element.froalaEditor("undo.saveStep")},t.prototype.setContent=function(t){void 0===t&&(t=!1);var e=this;if(this._model||""==this._model)if(this._oldModel=this._model,this._hasSpecialTag){var n=this._model;if(n){for(var i in n)n.hasOwnProperty(i)&&i!=this.INNER_HTML_ATTR&&this._$element.attr(i,n[i]);n.hasOwnProperty(this.INNER_HTML_ATTR)&&(this._$element[0].innerHTML=n[this.INNER_HTML_ATTR])}}else t?this.registerEvent(this._$element,"froalaEditor.initialized",function(){e.setHtml()}):e.setHtml()},t.prototype.destroyEditor=function(){this._editorInitialized&&(this._$element.off(this._listeningEvents.join(" ")),this._editor.off("keyup"),this._$element.froalaEditor("destroy"),this._listeningEvents.length=0,this._editorInitialized=!1)},t.prototype.getEditor=function(){return this._$element?this._$element.froalaEditor.bind(this._$element):null},t.prototype.generateManualController=function(){var t={initialize:this.createEditor.bind(this),destroy:this.destroyEditor.bind(this),getEditor:this.getEditor.bind(this)};this.froalaInit.emit(t)},t.prototype.ngOnInit=function(){this.froalaInit.observers.length?this.generateManualController():this.createEditor()},t.prototype.ngOnDestroy=function(){this.destroyEditor()},o([n.i(i.Input)(),a("design:type",Object),a("design:paramtypes",[Object])],t.prototype,"froalaEditor",null),o([n.i(i.Input)(),a("design:type",Object),a("design:paramtypes",[Object])],t.prototype,"froalaModel",null),o([n.i(i.Output)(),a("design:type",i.EventEmitter)],t.prototype,"froalaModelChange",void 0),o([n.i(i.Output)(),a("design:type",i.EventEmitter)],t.prototype,"froalaInit",void 0),t=o([n.i(i.Directive)({selector:"[froalaEditor]",providers:[{provide:r.NG_VALUE_ACCESSOR,useExisting:n.i(i.forwardRef)(function(){return t}),multi:!0}]}),a("design:paramtypes",[i.ElementRef])],t)}()},function(t,e,n){"use strict";var i=n(0);n.n(i);n.d(e,"a",function(){return a});var r=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},o=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(t,e){this.renderer=t,this._element=e.nativeElement}return Object.defineProperty(t.prototype,"froalaView",{set:function(t){this._element.innerHTML=t},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){this.renderer.setElementClass(this._element,"fr-view",!0)},r([n.i(i.Input)(),o("design:type",String),o("design:paramtypes",[String])],t.prototype,"froalaView",null),t=r([n.i(i.Directive)({selector:"[froalaView]"}),o("design:paramtypes",[i.Renderer,i.ElementRef])],t)}()},function(t,e,n){"use strict";var i=n(0),r=(n.n(i),n(3));n.d(e,"a",function(){return s});var o=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t=o([n.i(i.NgModule)({declarations:[r.a],exports:[r.a]}),a("design:paramtypes",[])],t)}()},function(t,e,n){"use strict";var i=n(0),r=(n.n(i),n(4));n.d(e,"a",function(){return s});var o=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t=o([n.i(i.NgModule)({declarations:[r.a],exports:[r.a]}),a("design:paramtypes",[])],t)}()},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=(n.n(i),n(1)),o=n(2);n.d(e,"FroalaEditorDirective",function(){return r.a}),n.d(e,"FroalaEditorModule",function(){return r.b}),n.d(e,"FroalaViewDirective",function(){return o.a}),n.d(e,"FroalaViewModule",function(){return o.b}),n.d(e,"FERootModule",function(){return l});var a=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f=[r.b,o.b],l=function(){function t(){}return t=a([n.i(i.NgModule)({imports:[r.b.forRoot(),o.b.forRoot()],exports:f}),s("design:paramtypes",[])],t)}()}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("@angular/forms")):"function"==typeof define&&define.amd?define(["@angular/core","@angular/forms"],e):"object"==typeof exports?exports["angular2-froala-wysiwyg.umd.min"]=e(require("@angular/core"),require("@angular/forms")):t["angular2-froala-wysiwyg.umd.min"]=e(t["@angular/core"],t["@angular/forms"])}(this,function(t,e){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=8)}([function(e,n){e.exports=t},function(t,e,n){"use strict";var i=n(3);n.d(e,"a",function(){return i.a});var r=n(5);n.d(e,"b",function(){return r.a})},function(t,e,n){"use strict";var i=n(4);n.d(e,"a",function(){return i.a});var r=n(6);n.d(e,"b",function(){return r.a})},function(t,e,n){"use strict";var i=n(0),r=(n.n(i),n(7));n.n(r);n.d(e,"a",function(){return s});var o=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this._opts={immediateAngularModelUpdate:!1,angularIgnoreAttrs:null},this.SPECIAL_TAGS=["img","button","input","a"],this.INNER_HTML_ATTR="innerHTML",this._hasSpecialTag=!1,this._listeningEvents=[],this._editorInitialized=!1,this._oldModel=null,this.onChange=function(t){},this.onTouched=function(){},this.froalaModelChange=new i.EventEmitter,this.froalaInit=new i.EventEmitter;var e=t.nativeElement;this.SPECIAL_TAGS.indexOf(e.tagName.toLowerCase())!=-1&&(this._hasSpecialTag=!0),this._$element=$(e)}return t.prototype.writeValue=function(t){this.updateEditor(t)},t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},Object.defineProperty(t.prototype,"froalaEditor",{set:function(t){this._opts=t||this._opts},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"froalaModel",{set:function(t){this.updateEditor(t)},enumerable:!0,configurable:!0}),t.prototype.updateEditor=function(t){JSON.stringify(this._oldModel)!=JSON.stringify(t)&&(this._model=t,this._editorInitialized&&this.setContent())},t.prototype.updateModel=function(){var t=null;if(this._hasSpecialTag){for(var e=this._$element[0].attributes,n={},i=0;i<e.length;i++){var r=e[i].name;this._opts.angularIgnoreAttrs&&this._opts.angularIgnoreAttrs.indexOf(r)!=-1||(n[r]=e[i].value)}this._$element[0].innerHTML&&(n[this.INNER_HTML_ATTR]=this._$element[0].innerHTML),t=n}else{var o=this._$element.froalaEditor("html.get");"string"==typeof o&&(t=o)}this._oldModel=t,this.froalaModelChange.emit(t),this.onChange(t)},t.prototype.registerEvent=function(t,e,n){t&&e&&n&&(this._listeningEvents.push(e),t.on(e,n))},t.prototype.initListeners=function(){var t=this;this.registerEvent(this._$element,"froalaEditor.contentChanged",function(){setTimeout(function(){t.updateModel()},0)}),this._opts.immediateAngularModelUpdate&&this.registerEvent(this._editor,"keyup",function(){setTimeout(function(){t.updateModel()},0)})},t.prototype.registerFroalaEvents=function(){if(this._opts.events)for(var t in this._opts.events)this._opts.events.hasOwnProperty(t)&&this.registerEvent(this._$element,t,this._opts.events[t])},t.prototype.createEditor=function(){this._editorInitialized||(this.setContent(!0),this.registerFroalaEvents(),this._editor=this._$element.froalaEditor(this._opts).data("froala.editor").$el,this.initListeners(),this._editorInitialized=!0)},t.prototype.setHtml=function(){this._$element.froalaEditor("html.set",this._model||"",!0),this._$element.froalaEditor("undo.reset"),this._$element.froalaEditor("undo.saveStep")},t.prototype.setContent=function(t){void 0===t&&(t=!1);var e=this;if(this._model||""==this._model)if(this._oldModel=this._model,this._hasSpecialTag){var n=this._model;if(n){for(var i in n)n.hasOwnProperty(i)&&i!=this.INNER_HTML_ATTR&&this._$element.attr(i,n[i]);n.hasOwnProperty(this.INNER_HTML_ATTR)&&(this._$element[0].innerHTML=n[this.INNER_HTML_ATTR])}}else t?this.registerEvent(this._$element,"froalaEditor.initialized",function(){e.setHtml()}):e.setHtml()},t.prototype.destroyEditor=function(){this._editorInitialized&&(this._$element.off(this._listeningEvents.join(" ")),this._editor.off("keyup"),this._$element.froalaEditor("destroy"),this._listeningEvents.length=0,this._editorInitialized=!1)},t.prototype.getEditor=function(){return this._$element?this._$element.froalaEditor.bind(this._$element):null},t.prototype.generateManualController=function(){var t={initialize:this.createEditor.bind(this),destroy:this.destroyEditor.bind(this),getEditor:this.getEditor.bind(this)};this.froalaInit.emit(t)},t.prototype.ngOnInit=function(){this.froalaInit.observers.length?this.generateManualController():this.createEditor()},t.prototype.ngOnDestroy=function(){this.destroyEditor()},o([n.i(i.Input)(),a("design:type",Object),a("design:paramtypes",[Object])],t.prototype,"froalaEditor",null),o([n.i(i.Input)(),a("design:type",Object),a("design:paramtypes",[Object])],t.prototype,"froalaModel",null),o([n.i(i.Output)(),a("design:type",i.EventEmitter)],t.prototype,"froalaModelChange",void 0),o([n.i(i.Output)(),a("design:type",i.EventEmitter)],t.prototype,"froalaInit",void 0),t=o([n.i(i.Directive)({selector:"[froalaEditor]",providers:[{provide:r.NG_VALUE_ACCESSOR,useExisting:n.i(i.forwardRef)(function(){return t}),multi:!0}]}),a("design:paramtypes",[i.ElementRef])],t)}()},function(t,e,n){"use strict";var i=n(0);n.n(i);n.d(e,"a",function(){return a});var r=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},o=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(t,e){this.renderer=t,this._element=e.nativeElement}return Object.defineProperty(t.prototype,"froalaView",{set:function(t){this._element.innerHTML=t},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){this.renderer.setElementClass(this._element,"fr-view",!0)},r([n.i(i.Input)(),o("design:type",String),o("design:paramtypes",[String])],t.prototype,"froalaView",null),t=r([n.i(i.Directive)({selector:"[froalaView]"}),o("design:paramtypes",[i.Renderer,i.ElementRef])],t)}()},function(t,e,n){"use strict";var i=n(0),r=(n.n(i),n(3));n.d(e,"a",function(){return s});var o=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t=o([n.i(i.NgModule)({declarations:[r.a],exports:[r.a]}),a("design:paramtypes",[])],t)}()},function(t,e,n){"use strict";var i=n(0),r=(n.n(i),n(4));n.d(e,"a",function(){return s});var o=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t=o([n.i(i.NgModule)({declarations:[r.a],exports:[r.a]}),a("design:paramtypes",[])],t)}()},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=(n.n(i),n(1)),o=n(2);n.d(e,"FroalaEditorDirective",function(){return r.a}),n.d(e,"FroalaEditorModule",function(){return r.b}),n.d(e,"FroalaViewDirective",function(){return o.a}),n.d(e,"FroalaViewModule",function(){return o.b}),n.d(e,"FERootModule",function(){return l});var a=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f=[r.b,o.b],l=function(){function t(){}return t=a([n.i(i.NgModule)({imports:[r.b.forRoot(),o.b.forRoot()],exports:f}),s("design:paramtypes",[])],t)}()}])}); |
@@ -106,7 +106,11 @@ import { Directive, ElementRef, Input, Output, EventEmitter, forwardRef } from '@angular/core'; | ||
this.registerEvent(this._$element, 'froalaEditor.contentChanged', function () { | ||
self.updateModel(); | ||
setTimeout(function () { | ||
self.updateModel(); | ||
}, 0); | ||
}); | ||
if (this._opts.immediateAngularModelUpdate) { | ||
this.registerEvent(this._editor, 'keyup', function () { | ||
self.updateModel(); | ||
setTimeout(function () { | ||
self.updateModel(); | ||
}, 0); | ||
}); | ||
@@ -113,0 +117,0 @@ } |
{ | ||
"main": "bundles/angular2-froala-wysiwyg.umd.js", | ||
"version": "2.5.1-2", | ||
"version": "2.6.0", | ||
"description": "Angular2 bindings for Froala WYSIWYG HTML rich text editor", | ||
@@ -38,7 +38,7 @@ "module": "index.js", | ||
"dependencies": { | ||
"froala-editor": ">=2.5.1", | ||
"froala-editor": "^2.6.0", | ||
"@types/jquery": "^2.0.40" | ||
}, | ||
"_id": "angular2-froala-wysiwyg@2.5.1-2", | ||
"_id": "angular2-froala-wysiwyg@2.6.0", | ||
"devDependencies": {} | ||
} |
104
README.md
@@ -1,4 +0,9 @@ | ||
# angular2-froala-wyswiyg | ||
>angular2-froala-wyswiyg provides Angular2 bindings to the Froala WYSIWYG editor VERSION 2. | ||
![WYSIWYG HTML Editor](https://raw.githubusercontent.com/froala/wysiwyg-editor/master/editor.jpg) | ||
| ||
# Angular 2 Froala WYSIWYG Editor - [Demo](https://www.froala.com/wysiwyg-editor) | ||
>angular2-froala-wyswiyg provides Angular2 bindings to the Froala WYSIWYG editor. | ||
## Table of contents | ||
@@ -8,2 +13,3 @@ 1. [Installation instructions](#installation-instructions) | ||
- [angular-cli](#use-with-angular-cli) | ||
- [ionic v2](#use-with-ionic-v2) | ||
- [webpack](#use-with-webpack) | ||
@@ -113,4 +119,96 @@ - [angular-seed](#use-with-angular-seed) | ||
### Use with `ionic v2` | ||
#### Adding ionic2-froala-wysiwyg | ||
Installing Froala Wysiwyg Editor in Ionic is fairly easy, it can be done using npm: | ||
```bash | ||
npm install angular2-froala-wysiwyg --save | ||
``` | ||
- open `src/app/app.module.ts` and add | ||
```typescript | ||
# Import Froala Editor. | ||
import "froala-editor/js/froala_editor.pkgd.min.js"; | ||
# Import Angular2 plugin. | ||
import { FroalaEditorModule, FroalaViewModule } from 'angular2-froala-wysiwyg'; | ||
... | ||
@NgModule({ | ||
... | ||
imports: [FroalaEditorModule.forRoot(), FroalaViewModule.forRoot() ... ], | ||
... | ||
}) | ||
``` | ||
- open `src/app/main.ts` and add | ||
```javascript | ||
import * as $ from 'jquery'; | ||
window["$"] = $; | ||
window["jQuery"] = $; | ||
``` | ||
This install will come with Font Awesome as a dependency so there are needed a few more steps to finish the install. | ||
1. In the package.json from your project add this: | ||
```json | ||
"config": { | ||
"ionic_copy": "./config/copy.config.js", | ||
"ionic_sass": "./config/sass.config.js" | ||
} | ||
``` | ||
2. On the root of your project you need to create a new folder called config and place inside 2 files:copy.config.js & sass.config.js". These files can be copied to new config folder from node_modules/@ionic/app-scripts/config/{{name_of_file}}.js | ||
3. Modify the copied files. In sass.config.js add the reference to font-awesome, verify that you have something similar to this: | ||
```javascript | ||
/** | ||
* includePaths: Used by node-sass for additional | ||
* paths to search for sass imports by just name. | ||
*/ | ||
includePaths: [ | ||
'node_modules/ionic-angular/themes', | ||
'node_modules/ionicons/dist/scss', | ||
'node_modules/ionic-angular/fonts', | ||
'node_modules/font-awesome/scss' // <------ Newly added. | ||
], | ||
``` | ||
In copy.config add this before `copyAssets` property: | ||
```javascript | ||
copyFroalaEditorCss: { | ||
src: '{{ROOT}}/node_modules/froala-editor/css/froala_editor.pkgd.min.css', | ||
dest: '{{SRC}}/assets/' | ||
}, | ||
copyFontAwesome: { | ||
src: '{{ROOT}}/node_modules/font-awesome/css/font-awesome.min.css', | ||
dest: '{{SRC}}/assets/' | ||
}, | ||
copyFontsAwesomeFonts: { | ||
src: 'node_modules/font-awesome/fonts/*', | ||
dest: '{{WWW}}/fonts/' | ||
}, | ||
copyAssets: { //<-------- this should be last. | ||
src: ['{{SRC}}/assets/**/*'], | ||
dest: '{{WWW}}/assets' | ||
} | ||
``` | ||
You should have the files in your {{ROOT}} and {{WWW}} folders ready for further development. | ||
4. The last step is to add in file `src/theme/variables.css`:, | ||
```html | ||
@import "font-awesome"; | ||
``` | ||
Refrence the new scripts on your view html file and everything should work fine. | ||
```html | ||
<link rel="stylesheet" href="/assets/font-awesome.min.css"> | ||
<link rel="stylesheet" href="/assets/froala_editor.pkgd.min.css"> | ||
``` | ||
In your desired view add the Froala Editor like this: | ||
```html | ||
<div [froalaEditor]>Hello, Froala!</div> | ||
``` | ||
### Use with `webpack` | ||
@@ -459,2 +557,4 @@ | ||
If you want to wrap froalaEditor directive into a component that supports reactive forms please see [froala.component.ts](demo/src/app/froala.component.ts) from demo. | ||
### Special tags | ||
@@ -461,0 +561,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
123885
914
2
666
1
+ Addedfont-awesome@4.7.0(transitive)
+ Addedfroala-editor@2.9.8(transitive)
+ Addedjquery@3.7.1(transitive)
- Removedfroala-editor@4.3.1(transitive)
Updatedfroala-editor@^2.6.0