aurelia-froala-editor
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -1,2 +0,2 @@ | ||
define(['exports', 'aurelia-framework', 'aurelia-binding', './froala-editor-config', 'froala-editor/js/froala_editor.pkgd.min.js'], function (exports, _aureliaFramework, _aureliaBinding, _froalaEditorConfig, _froala_editorPkgdMin) { | ||
define(['exports', 'aurelia-framework', 'aurelia-binding', './froala-editor-config', 'froala-editor'], function (exports, _aureliaFramework, _aureliaBinding, _froalaEditorConfig, _froalaEditor) { | ||
'use strict'; | ||
@@ -9,3 +9,3 @@ | ||
var _froala_editorPkgdMin2 = _interopRequireDefault(_froala_editorPkgdMin); | ||
var _froalaEditor2 = _interopRequireDefault(_froalaEditor); | ||
@@ -67,8 +67,6 @@ function _interopRequireDefault(obj) { | ||
var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3; | ||
var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4; | ||
var FroalaEditor1 = exports.FroalaEditor1 = (_dec = (0, _aureliaFramework.customElement)('froala-editor'), _dec2 = (0, _aureliaFramework.inject)(Element, _froalaEditorConfig.Config, _aureliaBinding.ObserverLocator), _dec(_class = _dec2(_class = (_class2 = function () { | ||
function FroalaEditor1(element, config, observerLocator) { | ||
var _this = this; | ||
_classCallCheck(this, FroalaEditor1); | ||
@@ -82,65 +80,69 @@ | ||
_initDefineProp(this, 'editor', _descriptor4, this); | ||
this.element = element; | ||
this.config = config.options(); | ||
this.subscriptions = [observerLocator.getObserver(this, 'value').subscribe(function (newValue, oldValue) { | ||
if (_this.instance && _this.instance.html.get() != newValue) { | ||
_this.instance.html(newValue); | ||
} | ||
})]; | ||
this.observerLocator = observerLocator; | ||
} | ||
FroalaEditor1.prototype.tearUp = function tearUp() { | ||
var _this2 = this; | ||
FroalaEditor1.prototype.bind = function bind(bindingContext, overrideContext) { | ||
this.parent = bindingContext; | ||
}; | ||
if (this.config.iframe) { | ||
this.instance = this.element.getElementsByTagName('textarea')[0]; | ||
} else { | ||
this.instance = this.element.getElementsByTagName('div')[0]; | ||
} | ||
FroalaEditor1.prototype.attached = function attached() { | ||
var _this = this; | ||
if (this.instance['data-froala.editor']) { | ||
var editorSelector = this.config.iframe ? 'textarea' : 'div'; | ||
var editor = this; | ||
if (this.editor != null) { | ||
return; | ||
} | ||
this.instance.innerHTML = this.value; | ||
this.subscriptions = [this.observerLocator.getObserver(this, 'value').subscribe(function (newValue, oldValue) { | ||
if (_this.editor && _this.editor.html.get() != newValue) { | ||
_this.editor.html.set(newValue); | ||
} | ||
})]; | ||
if (this.eventHandlers && this.eventHandlers.length != 0) { | ||
var _loop = function _loop(eventHandlerName) { | ||
var handler = _this2.eventHandlers[eventHandlerName]; | ||
_this2.instance.addEventListener('' + eventHandlerName, function () { | ||
var p = arguments; | ||
return handler.apply(this, p); | ||
}); | ||
}; | ||
for (var eventHandlerName in this.eventHandlers) { | ||
_loop(eventHandlerName); | ||
this.config.events = { | ||
contentChanged: function contentChanged(e) { | ||
return editor.value = this.html.get(); | ||
}, | ||
blur: function blur(e) { | ||
return editor.value = this.html.get(); | ||
} | ||
} | ||
this.instance.addEventListener('contentChanged', function (e, editor) { | ||
return _this2.value = editor.html.get(); | ||
}); | ||
this.instance.addEventListener('blur', function (e, editor) { | ||
return _this2.value = editor.html.get(); | ||
}); | ||
}; | ||
this.instance = new _froala_editorPkgdMin2.default(this.element, Object.assign({}, this.config)); | ||
}; | ||
this.editor = new _froalaEditor2.default(this.element, Object.assign({}, this.config), function () { | ||
_this.editor.html.set(_this.value); | ||
FroalaEditor1.prototype.tearDown = function tearDown() { | ||
if (this.instance && this.instance['data-froala.editor']) { | ||
this.instance.destroy(); | ||
} | ||
if (_this.eventHandlers && _this.eventHandlers.length != 0) { | ||
var _loop = function _loop(eventHandlerName) { | ||
var handler = _this.eventHandlers[eventHandlerName]; | ||
if (eventHandlerName === 'initialized') { | ||
handler.apply(_this.parent); | ||
} else { | ||
_this.editor.events.on('' + eventHandlerName, function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
this.instance = null; | ||
}; | ||
return handler.apply(_this.parent, args); | ||
}); | ||
} | ||
}; | ||
FroalaEditor1.prototype.attached = function attached() { | ||
this.tearUp(); | ||
for (var eventHandlerName in _this.eventHandlers) { | ||
_loop(eventHandlerName); | ||
} | ||
} | ||
}); | ||
}; | ||
FroalaEditor1.prototype.detached = function detached() { | ||
this.tearDown(); | ||
if (this.editor != null) { | ||
this.editor.destroy(); | ||
this.editor = null; | ||
} | ||
}; | ||
@@ -162,3 +164,6 @@ | ||
} | ||
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'editor', [_aureliaFramework.bindable], { | ||
enumerable: true, | ||
initializer: null | ||
})), _class2)) || _class) || _class); | ||
}); |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3; | ||
var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4; | ||
@@ -17,5 +17,5 @@ var _aureliaFramework = require('aurelia-framework'); | ||
var _froala_editorPkgdMin = require('froala-editor/js/froala_editor.pkgd.min.js'); | ||
var _froalaEditor = require('froala-editor'); | ||
var _froala_editorPkgdMin2 = _interopRequireDefault(_froala_editorPkgdMin); | ||
var _froalaEditor2 = _interopRequireDefault(_froalaEditor); | ||
@@ -71,4 +71,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function FroalaEditor1(element, config, observerLocator) { | ||
var _this = this; | ||
_classCallCheck(this, FroalaEditor1); | ||
@@ -82,65 +80,69 @@ | ||
_initDefineProp(this, 'editor', _descriptor4, this); | ||
this.element = element; | ||
this.config = config.options(); | ||
this.subscriptions = [observerLocator.getObserver(this, 'value').subscribe(function (newValue, oldValue) { | ||
if (_this.instance && _this.instance.html.get() != newValue) { | ||
_this.instance.html(newValue); | ||
} | ||
})]; | ||
this.observerLocator = observerLocator; | ||
} | ||
FroalaEditor1.prototype.tearUp = function tearUp() { | ||
var _this2 = this; | ||
FroalaEditor1.prototype.bind = function bind(bindingContext, overrideContext) { | ||
this.parent = bindingContext; | ||
}; | ||
if (this.config.iframe) { | ||
this.instance = this.element.getElementsByTagName('textarea')[0]; | ||
} else { | ||
this.instance = this.element.getElementsByTagName('div')[0]; | ||
} | ||
FroalaEditor1.prototype.attached = function attached() { | ||
var _this = this; | ||
if (this.instance['data-froala.editor']) { | ||
var editorSelector = this.config.iframe ? 'textarea' : 'div'; | ||
var editor = this; | ||
if (this.editor != null) { | ||
return; | ||
} | ||
this.instance.innerHTML = this.value; | ||
this.subscriptions = [this.observerLocator.getObserver(this, 'value').subscribe(function (newValue, oldValue) { | ||
if (_this.editor && _this.editor.html.get() != newValue) { | ||
_this.editor.html.set(newValue); | ||
} | ||
})]; | ||
if (this.eventHandlers && this.eventHandlers.length != 0) { | ||
var _loop = function _loop(eventHandlerName) { | ||
var handler = _this2.eventHandlers[eventHandlerName]; | ||
_this2.instance.addEventListener('' + eventHandlerName, function () { | ||
var p = arguments; | ||
return handler.apply(this, p); | ||
}); | ||
}; | ||
for (var eventHandlerName in this.eventHandlers) { | ||
_loop(eventHandlerName); | ||
this.config.events = { | ||
contentChanged: function contentChanged(e) { | ||
return editor.value = this.html.get(); | ||
}, | ||
blur: function blur(e) { | ||
return editor.value = this.html.get(); | ||
} | ||
} | ||
this.instance.addEventListener('contentChanged', function (e, editor) { | ||
return _this2.value = editor.html.get(); | ||
}); | ||
this.instance.addEventListener('blur', function (e, editor) { | ||
return _this2.value = editor.html.get(); | ||
}); | ||
}; | ||
this.instance = new _froala_editorPkgdMin2.default(this.element, Object.assign({}, this.config)); | ||
}; | ||
this.editor = new _froalaEditor2.default(this.element, Object.assign({}, this.config), function () { | ||
_this.editor.html.set(_this.value); | ||
FroalaEditor1.prototype.tearDown = function tearDown() { | ||
if (this.instance && this.instance['data-froala.editor']) { | ||
this.instance.destroy(); | ||
} | ||
if (_this.eventHandlers && _this.eventHandlers.length != 0) { | ||
var _loop = function _loop(eventHandlerName) { | ||
var handler = _this.eventHandlers[eventHandlerName]; | ||
if (eventHandlerName === 'initialized') { | ||
handler.apply(_this.parent); | ||
} else { | ||
_this.editor.events.on('' + eventHandlerName, function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
this.instance = null; | ||
}; | ||
return handler.apply(_this.parent, args); | ||
}); | ||
} | ||
}; | ||
FroalaEditor1.prototype.attached = function attached() { | ||
this.tearUp(); | ||
for (var eventHandlerName in _this.eventHandlers) { | ||
_loop(eventHandlerName); | ||
} | ||
} | ||
}); | ||
}; | ||
FroalaEditor1.prototype.detached = function detached() { | ||
this.tearDown(); | ||
if (this.editor != null) { | ||
this.editor.destroy(); | ||
this.editor = null; | ||
} | ||
}; | ||
@@ -162,2 +164,5 @@ | ||
} | ||
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'editor', [_aureliaFramework.bindable], { | ||
enumerable: true, | ||
initializer: null | ||
})), _class2)) || _class) || _class); |
@@ -1,2 +0,2 @@ | ||
var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3; | ||
var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4; | ||
@@ -48,6 +48,5 @@ function _initDefineProp(target, property, descriptor, context) { | ||
import { ObserverLocator } from "aurelia-binding"; | ||
import { Config } from './froala-editor-config'; | ||
import FroalaEditor from 'froala-editor/js/froala_editor.pkgd.min.js'; | ||
import FroalaEditor from 'froala-editor'; | ||
@@ -63,55 +62,59 @@ export let FroalaEditor1 = (_dec = customElement('froala-editor'), _dec2 = inject(Element, Config, ObserverLocator), _dec(_class = _dec2(_class = (_class2 = class FroalaEditor1 { | ||
_initDefineProp(this, 'editor', _descriptor4, this); | ||
this.element = element; | ||
this.config = config.options(); | ||
this.observerLocator = observerLocator; | ||
} | ||
this.subscriptions = [observerLocator.getObserver(this, 'value').subscribe((newValue, oldValue) => { | ||
if (this.instance && this.instance.html.get() != newValue) { | ||
this.instance.html(newValue); | ||
} | ||
})]; | ||
bind(bindingContext, overrideContext) { | ||
this.parent = bindingContext; | ||
} | ||
tearUp() { | ||
if (this.config.iframe) { | ||
this.instance = this.element.getElementsByTagName('textarea')[0]; | ||
} else { | ||
this.instance = this.element.getElementsByTagName('div')[0]; | ||
} | ||
attached() { | ||
const editorSelector = this.config.iframe ? 'textarea' : 'div'; | ||
let editor = this; | ||
if (this.instance['data-froala.editor']) { | ||
if (this.editor != null) { | ||
return; | ||
} | ||
this.instance.innerHTML = this.value; | ||
this.subscriptions = [this.observerLocator.getObserver(this, 'value').subscribe((newValue, oldValue) => { | ||
if (this.editor && this.editor.html.get() != newValue) { | ||
this.editor.html.set(newValue); | ||
} | ||
})]; | ||
if (this.eventHandlers && this.eventHandlers.length != 0) { | ||
for (let eventHandlerName in this.eventHandlers) { | ||
let handler = this.eventHandlers[eventHandlerName]; | ||
this.instance.addEventListener(`${eventHandlerName}`, function () { | ||
let p = arguments; | ||
return handler.apply(this, p); | ||
}); | ||
this.config.events = { | ||
contentChanged: function contentChanged(e) { | ||
return editor.value = this.html.get(); | ||
}, | ||
blur: function blur(e) { | ||
return editor.value = this.html.get(); | ||
} | ||
} | ||
this.instance.addEventListener('contentChanged', (e, editor) => this.value = editor.html.get()); | ||
this.instance.addEventListener('blur', (e, editor) => this.value = editor.html.get()); | ||
}; | ||
this.instance = new FroalaEditor(this.element, Object.assign({}, this.config)); | ||
} | ||
this.editor = new FroalaEditor(this.element, Object.assign({}, this.config), () => { | ||
this.editor.html.set(this.value); | ||
tearDown() { | ||
if (this.instance && this.instance['data-froala.editor']) { | ||
this.instance.destroy(); | ||
} | ||
this.instance = null; | ||
if (this.eventHandlers && this.eventHandlers.length != 0) { | ||
for (let eventHandlerName in this.eventHandlers) { | ||
let handler = this.eventHandlers[eventHandlerName]; | ||
if (eventHandlerName === 'initialized') { | ||
handler.apply(this.parent); | ||
} else { | ||
this.editor.events.on(`${eventHandlerName}`, (...args) => { | ||
return handler.apply(this.parent, args); | ||
}); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
attached() { | ||
this.tearUp(); | ||
} | ||
detached() { | ||
this.tearDown(); | ||
if (this.editor != null) { | ||
this.editor.destroy(); | ||
this.editor = null; | ||
} | ||
} | ||
@@ -131,2 +134,5 @@ }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'value', [bindable], { | ||
} | ||
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'editor', [bindable], { | ||
enumerable: true, | ||
initializer: null | ||
})), _class2)) || _class) || _class); |
'use strict'; | ||
System.register(['aurelia-framework', 'aurelia-binding', './froala-editor-config', 'froala-editor/js/froala_editor.pkgd.min.js'], function (_export, _context) { | ||
System.register(['aurelia-framework', 'aurelia-binding', './froala-editor-config', 'froala-editor'], function (_export, _context) { | ||
"use strict"; | ||
var inject, customElement, bindable, ObserverLocator, Config, FroalaEditor, _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, FroalaEditor1; | ||
var inject, customElement, bindable, ObserverLocator, Config, FroalaEditor, _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, FroalaEditor1; | ||
@@ -66,4 +66,4 @@ function _initDefineProp(target, property, descriptor, context) { | ||
Config = _froalaEditorConfig.Config; | ||
}, function (_froalaEditorJsFroala_editorPkgdMinJs) { | ||
FroalaEditor = _froalaEditorJsFroala_editorPkgdMinJs.default; | ||
}, function (_froalaEditor) { | ||
FroalaEditor = _froalaEditor.default; | ||
}], | ||
@@ -73,4 +73,2 @@ execute: function () { | ||
function FroalaEditor1(element, config, observerLocator) { | ||
var _this = this; | ||
_classCallCheck(this, FroalaEditor1); | ||
@@ -84,65 +82,69 @@ | ||
_initDefineProp(this, 'editor', _descriptor4, this); | ||
this.element = element; | ||
this.config = config.options(); | ||
this.subscriptions = [observerLocator.getObserver(this, 'value').subscribe(function (newValue, oldValue) { | ||
if (_this.instance && _this.instance.html.get() != newValue) { | ||
_this.instance.html(newValue); | ||
} | ||
})]; | ||
this.observerLocator = observerLocator; | ||
} | ||
FroalaEditor1.prototype.tearUp = function tearUp() { | ||
var _this2 = this; | ||
FroalaEditor1.prototype.bind = function bind(bindingContext, overrideContext) { | ||
this.parent = bindingContext; | ||
}; | ||
if (this.config.iframe) { | ||
this.instance = this.element.getElementsByTagName('textarea')[0]; | ||
} else { | ||
this.instance = this.element.getElementsByTagName('div')[0]; | ||
} | ||
FroalaEditor1.prototype.attached = function attached() { | ||
var _this = this; | ||
if (this.instance['data-froala.editor']) { | ||
var editorSelector = this.config.iframe ? 'textarea' : 'div'; | ||
var editor = this; | ||
if (this.editor != null) { | ||
return; | ||
} | ||
this.instance.innerHTML = this.value; | ||
this.subscriptions = [this.observerLocator.getObserver(this, 'value').subscribe(function (newValue, oldValue) { | ||
if (_this.editor && _this.editor.html.get() != newValue) { | ||
_this.editor.html.set(newValue); | ||
} | ||
})]; | ||
if (this.eventHandlers && this.eventHandlers.length != 0) { | ||
var _loop = function _loop(eventHandlerName) { | ||
var handler = _this2.eventHandlers[eventHandlerName]; | ||
_this2.instance.addEventListener('' + eventHandlerName, function () { | ||
var p = arguments; | ||
return handler.apply(this, p); | ||
}); | ||
}; | ||
for (var eventHandlerName in this.eventHandlers) { | ||
_loop(eventHandlerName); | ||
this.config.events = { | ||
contentChanged: function contentChanged(e) { | ||
return editor.value = this.html.get(); | ||
}, | ||
blur: function blur(e) { | ||
return editor.value = this.html.get(); | ||
} | ||
} | ||
this.instance.addEventListener('contentChanged', function (e, editor) { | ||
return _this2.value = editor.html.get(); | ||
}); | ||
this.instance.addEventListener('blur', function (e, editor) { | ||
return _this2.value = editor.html.get(); | ||
}); | ||
}; | ||
this.instance = new FroalaEditor(this.element, Object.assign({}, this.config)); | ||
}; | ||
this.editor = new FroalaEditor(this.element, Object.assign({}, this.config), function () { | ||
_this.editor.html.set(_this.value); | ||
FroalaEditor1.prototype.tearDown = function tearDown() { | ||
if (this.instance && this.instance['data-froala.editor']) { | ||
this.instance.destroy(); | ||
} | ||
if (_this.eventHandlers && _this.eventHandlers.length != 0) { | ||
var _loop = function _loop(eventHandlerName) { | ||
var handler = _this.eventHandlers[eventHandlerName]; | ||
if (eventHandlerName === 'initialized') { | ||
handler.apply(_this.parent); | ||
} else { | ||
_this.editor.events.on('' + eventHandlerName, function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
this.instance = null; | ||
}; | ||
return handler.apply(_this.parent, args); | ||
}); | ||
} | ||
}; | ||
FroalaEditor1.prototype.attached = function attached() { | ||
this.tearUp(); | ||
for (var eventHandlerName in _this.eventHandlers) { | ||
_loop(eventHandlerName); | ||
} | ||
} | ||
}); | ||
}; | ||
FroalaEditor1.prototype.detached = function detached() { | ||
this.tearDown(); | ||
if (this.editor != null) { | ||
this.editor.destroy(); | ||
this.editor = null; | ||
} | ||
}; | ||
@@ -164,2 +166,5 @@ | ||
} | ||
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'editor', [bindable], { | ||
enumerable: true, | ||
initializer: null | ||
})), _class2)) || _class) || _class)); | ||
@@ -166,0 +171,0 @@ |
{ | ||
"name": "aurelia-froala-editor", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "Aurelia plugin for Froala WYSIWYG HTML rich text editor.", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"del": "^3.0.0", | ||
"gulp": "^4.0.0", | ||
"gulp": "^3.9.1", | ||
"gulp-babel": "^6.1.2", | ||
@@ -63,3 +63,3 @@ "gulp-bump": "^2.7.0", | ||
"aurelia-framework": "^1.3.0", | ||
"froala-editor": "3.2.1" | ||
"froala-editor": "3.2.2" | ||
}, | ||
@@ -66,0 +66,0 @@ "jspm": { |
import {inject, customElement, bindable} from 'aurelia-framework'; | ||
import {ObserverLocator} from "aurelia-binding"; | ||
import {Config} from './froala-editor-config'; | ||
// Import Froala Editor | ||
import FroalaEditor from 'froala-editor/js/froala_editor.pkgd.min.js' | ||
import FroalaEditor from 'froala-editor' | ||
@@ -13,81 +12,78 @@ @customElement('froala-editor') | ||
@bindable value; | ||
@bindable config = {} | ||
@bindable eventHandlers = {} | ||
@bindable config = {}; | ||
@bindable eventHandlers = {}; | ||
@bindable editor; | ||
parent; | ||
element; | ||
instance; | ||
constructor (element, config, observerLocator) { | ||
// Store element. | ||
this.element = element; | ||
this.config = config.options(); | ||
this.observerLocator = observerLocator; | ||
} | ||
// Read config. | ||
this.config = config.options(); | ||
// Get parent context to use in eventhandlers | ||
bind(bindingContext, overrideContext) { | ||
this.parent = bindingContext; | ||
} | ||
// Observe value. | ||
// Setup | ||
attached() { | ||
// Get element. | ||
const editorSelector = this.config.iframe ? 'textarea' : 'div'; | ||
let editor = this | ||
// Check if editor isn't already initialized. | ||
if (this.editor != null) { return; } | ||
// Observe value. | ||
this.subscriptions = [ | ||
observerLocator | ||
this.observerLocator | ||
.getObserver(this, 'value') | ||
.subscribe((newValue, oldValue) => { | ||
if (this.instance && this.instance.html.get() != newValue) { | ||
this.instance.html(newValue); | ||
if (this.editor && this.editor.html.get() != newValue) { | ||
this.editor.html.set(newValue); | ||
} | ||
}) | ||
]; | ||
} | ||
]; | ||
// Will be registered when editor is initialized. | ||
this.config.events = { | ||
contentChanged: function contentChanged(e) { | ||
return editor.value = this.html.get(); | ||
}, | ||
blur: function blur(e) { | ||
return editor.value = this.html.get(); | ||
} | ||
}; | ||
// Starting poing. | ||
tearUp () { | ||
// Get element. | ||
if (this.config.iframe) { | ||
this.instance = this.element.getElementsByTagName('textarea')[0]; | ||
} | ||
else { | ||
this.instance = this.element.getElementsByTagName('div')[0]; | ||
} | ||
// Initialize editor. | ||
this.editor = new FroalaEditor(this.element, Object.assign({}, this.config), () => { | ||
// Set initial HTML value. | ||
this.editor.html.set(this.value); | ||
// Check if editor isn't already initialized. | ||
if (this.instance['data-froala.editor']) { | ||
return; | ||
} | ||
// Set the HTML for the inner element. | ||
this.instance.innerHTML = this.value; | ||
// Set events. | ||
if (this.eventHandlers && this.eventHandlers.length != 0) { | ||
for(let eventHandlerName in this.eventHandlers) { | ||
let handler = this.eventHandlers[eventHandlerName]; | ||
this.instance.addEventListener(`${eventHandlerName}`, function() { | ||
let p = arguments; | ||
return handler.apply(this, p) | ||
}); | ||
// Set Events | ||
if (this.eventHandlers && this.eventHandlers.length != 0) { | ||
for(let eventHandlerName in this.eventHandlers) { | ||
let handler = this.eventHandlers[eventHandlerName]; | ||
if (eventHandlerName === 'initialized') { | ||
handler.apply(this.parent); | ||
} else { | ||
this.editor.events.on(`${eventHandlerName}`, (...args) => { | ||
return handler.apply(this.parent, args); | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
this.instance.addEventListener('contentChanged', (e, editor) => this.value = editor.html.get()); | ||
this.instance.addEventListener('blur', (e, editor) => this.value = editor.html.get()) | ||
// Initialize editor. | ||
this.instance = new FroalaEditor(this.element, Object.assign({}, this.config)); | ||
}); | ||
} | ||
// Destroy. | ||
tearDown () { | ||
if (this.instance && this.instance['data-froala.editor']) { | ||
this.instance.destroy(); | ||
} | ||
this.instance = null; | ||
} | ||
// Setup. | ||
attached () { | ||
this.tearUp(); | ||
} | ||
// Destroy. | ||
// Destroy | ||
detached () { | ||
this.tearDown(); | ||
if (this.editor != null) { | ||
this.editor.destroy(); | ||
this.editor = null; | ||
} | ||
} | ||
} | ||
} |
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
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
50829
1115
+ Addedfroala-editor@3.2.2(transitive)
- Removedfroala-editor@3.2.1(transitive)
Updatedfroala-editor@3.2.2