angular-froala-wysiwyg-base
Advanced tools
Comparing version 3.1.1 to 3.2.1-1
{ | ||
"name": "angular-froala-wysiwyg-base", | ||
"version": "3.1.1", | ||
"version": "3.2.1-1", | ||
"description": "Angular 4, 5, 6, 7, 8 and 9 bindings for Froala WYSIWYG HTML rich text editor", | ||
@@ -53,3 +53,3 @@ "main": "bundles/angular-froala-wysiwyg.umd.js", | ||
"font-awesome": "^4.7.0", | ||
"froala-editor": "^3.1.1", | ||
"froala-editor": "^3.2.1", | ||
"tslib": "^1.9.0" | ||
@@ -56,0 +56,0 @@ }, |
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms"; | ||
import { Directive, ElementRef, EventEmitter, Input, NgZone, Optional, Output, Renderer, forwardRef } from '@angular/core'; | ||
import { Directive, ElementRef, EventEmitter, Input, NgZone, Output, forwardRef } from '@angular/core'; | ||
@@ -67,5 +67,54 @@ import FroalaEditor from 'froala-editor'; | ||
@Input() set froalaEditor(opts: any) { | ||
this._opts = opts || this._opts; | ||
this._opts = this.clone( opts || this._opts); | ||
this._opts = {...this._opts}; | ||
} | ||
// TODO: replace clone method with better possible alternate | ||
private clone(item) { | ||
const me = this; | ||
if (!item) { return item; } // null, undefined values check | ||
let types = [ Number, String, Boolean ], | ||
result; | ||
// normalizing primitives if someone did new String('aaa'), or new Number('444'); | ||
types.forEach(function(type) { | ||
if (item instanceof type) { | ||
result = type( item ); | ||
} | ||
}); | ||
if (typeof result == "undefined") { | ||
if (Object.prototype.toString.call( item ) === "[object Array]") { | ||
result = []; | ||
item.forEach(function(child, index, array) { | ||
result[index] = me.clone( child ); | ||
}); | ||
} else if (typeof item == "object") { | ||
// testing that this is DOM | ||
if (item.nodeType && typeof item.cloneNode == "function") { | ||
result = item.cloneNode( true ); | ||
} else if (!item.prototype) { // check that this is a literal | ||
if (item instanceof Date) { | ||
result = new Date(item); | ||
} else { | ||
// it is an object literal | ||
result = {}; | ||
for (var i in item) { | ||
result[i] = me.clone( item[i] ); | ||
} | ||
} | ||
} else { | ||
if (false && item.constructor) { | ||
result = new item.constructor(); | ||
} else { | ||
result = item; | ||
} | ||
} | ||
} else { | ||
result = item; | ||
} | ||
} | ||
return result; | ||
} | ||
// froalaModel directive as input: store initial editor content | ||
@@ -72,0 +121,0 @@ @Input() set froalaModel(content: any) { |
@@ -11,5 +11,5 @@ import { NgModule, ModuleWithProviders } from '@angular/core'; | ||
export class FroalaEditorModule { | ||
public static forRoot(): ModuleWithProviders { | ||
public static forRoot(): ModuleWithProviders<FroalaEditorModule> { | ||
return {ngModule: FroalaEditorModule, providers: []}; | ||
} | ||
} |
{ | ||
"name": "angular-froala-wysiwyg", | ||
"version": "3.1.1", | ||
"version": "3.2.1", | ||
"dependencies": { | ||
"froala-editor": "3.1.1" | ||
"froala-editor": "3.2.1" | ||
} | ||
} |
@@ -10,5 +10,5 @@ import { NgModule, ModuleWithProviders } from '@angular/core'; | ||
export class FroalaViewModule { | ||
public static forRoot(): ModuleWithProviders { | ||
public static forRoot(): ModuleWithProviders<FroalaViewModule> { | ||
return {ngModule: FroalaViewModule, providers: []}; | ||
} | ||
} |
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
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
76190
32
1148
2
Updatedfroala-editor@^3.2.1