Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-froala-wysiwyg

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-froala-wysiwyg - npm Package Compare versions

Comparing version 2.9.3 to 2.9.4-1

627

dist/vue-froala.js

@@ -10,43 +10,87 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["vue-froala-wysiwyg"] = factory();
})(this, function() {
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })

@@ -56,345 +100,268 @@ /************************************************************************/

/* 0 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, __webpack_exports__, __webpack_require__) {
'use strict';
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = (function (Vue) {
var Options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var froalaEditorFunctionality = {
props: ['tag', 'value', 'config', 'onManualControllerReady'],
watch: {
value: function value() {
this.model = this.value;
this.updateValue();
}
},
render: function render(createElement) {
return createElement(this.currentTag, [this.$slots["default"]]);
},
created: function created() {
this.currentTag = this.tag || this.currentTag;
this.model = this.value;
},
// After first time render.
mounted: function mounted() {
if (this.SPECIAL_TAGS.indexOf(this.currentTag) != -1) {
this.hasSpecialTag = true;
}
Object.defineProperty(exports, "__esModule", {
value: true
});
if (this.onManualControllerReady) {
this.generateManualController();
} else {
this.createEditor();
}
},
beforeDestroy: function beforeDestroy() {
this.destroyEditor();
},
data: function data() {
return {
// Tag on which the editor is initialized.
currentTag: 'div',
listeningEvents: [],
// Jquery wrapped element.
_$element: null,
// Editor element.
_$editor: null,
// Current config.
currentConfig: null,
// Editor options config
defaultConfig: {
immediateVueModelUpdate: false,
vueIgnoreAttrs: null
},
editorInitialized: false,
SPECIAL_TAGS: ['img', 'button', 'input', 'a'],
INNER_HTML_ATTR: 'innerHTML',
hasSpecialTag: false,
model: null,
oldModel: null
};
},
methods: {
updateValue: function updateValue() {
if (JSON.stringify(this.oldModel) == JSON.stringify(this.model)) {
return;
}
var _stringify = __webpack_require__(1);
this.setContent();
},
createEditor: function createEditor() {
if (this.editorInitialized) {
return;
}
var _stringify2 = _interopRequireDefault(_stringify);
this.currentConfig = this.config || this.defaultConfig;
this._$element = jQuery(this.$el);
this.setContent(true);
this.registerEvents();
this._$editor = this._$element.froalaEditor(this.currentConfig).data('froala.editor').$el;
this.initListeners();
this.editorInitialized = true;
},
setContent: function setContent(firstTime) {
if (!this.editorInitialized && !firstTime) {
return;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
if (this.model || this.model == '') {
this.oldModel = this.model;
exports.default = function (Vue) {
var Options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (this.hasSpecialTag) {
this.setSpecialTagContent();
} else {
this.setNormalTagContent(firstTime);
}
}
},
setNormalTagContent: function setNormalTagContent(firstTime) {
var self = this;
var froalaEditorFunctionality = {
function htmlSet() {
self._$element.froalaEditor('html.set', self.model || '', true); //This will reset the undo stack everytime the model changes externally. Can we fix this?
props: ['tag', 'value', 'config', 'onManualControllerReady'],
watch: {
value: function value() {
this.model = this.value;
this.updateValue();
}
},
self._$element.froalaEditor('undo.saveStep');
render: function render(createElement) {
return createElement(this.currentTag, [this.$slots.default]);
},
self._$element.froalaEditor('undo.reset');
}
created: function created() {
this.currentTag = this.tag || this.currentTag;
this.model = this.value;
},
if (firstTime) {
this.registerEvent(this._$element, 'froalaEditor.initialized', function () {
htmlSet();
});
} else {
htmlSet();
}
},
setSpecialTagContent: function setSpecialTagContent() {
var tags = this.model; // add tags on element
mounted: function mounted() {
if (this.SPECIAL_TAGS.indexOf(this.currentTag) != -1) {
if (tags) {
for (var attr in tags) {
if (tags.hasOwnProperty(attr) && attr != this.INNER_HTML_ATTR) {
this._$element.attr(attr, tags[attr]);
}
}
this.hasSpecialTag = true;
}
if (tags.hasOwnProperty(this.INNER_HTML_ATTR)) {
this._$element[0].innerHTML = tags[this.INNER_HTML_ATTR];
}
}
},
destroyEditor: function destroyEditor() {
if (this._$element) {
this.listeningEvents && this._$element.off(this.listeningEvents.join(" "));
if (this.onManualControllerReady) {
this.generateManualController();
} else {
this.createEditor();
}
},
this._$editor.off('keyup');
beforeDestroy: function beforeDestroy() {
this.destroyEditor();
},
this._$element.froalaEditor('destroy');
data: function data() {
this.listeningEvents.length = 0;
this._$element = null;
this.editorInitialized = false;
}
},
getEditor: function getEditor() {
if (this._$element) {
return this._$element.froalaEditor.bind(this._$element);
}
return {
currentTag: 'div',
listeningEvents: [],
return null;
},
generateManualController: function generateManualController() {
var self = this;
var controls = {
initialize: this.createEditor,
destroy: this.destroyEditor,
getEditor: this.getEditor
};
this.onManualControllerReady(controls);
},
updateModel: function updateModel() {
var modelContent = '';
_$element: null,
if (this.hasSpecialTag) {
var attributeNodes = this._$element[0].attributes;
var attrs = {};
_$editor: null,
for (var i = 0; i < attributeNodes.length; i++) {
var attrName = attributeNodes[i].name;
currentConfig: null,
if (this.currentConfig.vueIgnoreAttrs && this.currentConfig.vueIgnoreAttrs.indexOf(attrName) != -1) {
continue;
}
defaultConfig: {
immediateVueModelUpdate: false,
vueIgnoreAttrs: null
},
attrs[attrName] = attributeNodes[i].value;
}
editorInitialized: false,
if (this._$element[0].innerHTML) {
attrs[this.INNER_HTML_ATTR] = this._$element[0].innerHTML;
}
SPECIAL_TAGS: ['img', 'button', 'input', 'a'],
INNER_HTML_ATTR: 'innerHTML',
hasSpecialTag: false,
modelContent = attrs;
} else {
var returnedHtml = this._$element.froalaEditor('html.get');
model: null,
oldModel: null
};
},
methods: {
updateValue: function updateValue() {
if ((0, _stringify2.default)(this.oldModel) == (0, _stringify2.default)(this.model)) {
return;
}
if (typeof returnedHtml === 'string') {
modelContent = returnedHtml;
}
}
this.setContent();
},
this.oldModel = modelContent;
this.$emit('input', modelContent);
},
initListeners: function initListeners() {
var self = this; // bind contentChange and keyup event to froalaModel
createEditor: function createEditor() {
this.registerEvent(this._$element, 'froalaEditor.contentChanged', function () {
self.updateModel();
});
if (this.editorInitialized) {
return;
}
if (this.currentConfig.immediateVueModelUpdate) {
this.registerEvent(this._$editor, 'keyup', function () {
self.updateModel();
});
}
},
// register event on jquery editor element
registerEvent: function registerEvent(element, eventName, callback) {
if (!element || !eventName || !callback) {
return;
}
this.currentConfig = this.config || this.defaultConfig;
this.listeningEvents.push(eventName);
element.on(eventName, callback);
},
registerEvents: function registerEvents() {
var events = this.currentConfig.events;
this._$element = $(this.$el);
if (!events) {
return;
}
this.setContent(true);
for (var event in events) {
if (events.hasOwnProperty(event)) {
this.registerEvent(this._$element, event, events[event]);
}
}
}
}
};
Vue.component('Froala', froalaEditorFunctionality);
var froalaViewFunctionality = {
props: ['tag', 'value'],
watch: {
value: function value(newValue) {
this._element.innerHTML = newValue;
}
},
created: function created() {
this.currentTag = this.tag || this.currentTag;
},
render: function render(createElement) {
return createElement(this.currentTag, {
"class": 'fr-view'
});
},
// After first time render.
mounted: function mounted() {
this._element = this.$el;
this.registerEvents();
this._$editor = this._$element.froalaEditor(this.currentConfig).data('froala.editor').$el;
this.initListeners();
if (this.value) {
this._element.innerHTML = this.value;
}
},
data: function data() {
return {
currentTag: 'div',
_element: null
};
}
};
Vue.component('FroalaView', froalaViewFunctionality);
});
this.editorInitialized = true;
},
setContent: function setContent(firstTime) {
if (!this.editorInitialized && !firstTime) {
return;
}
if (this.model || this.model == '') {
this.oldModel = this.model;
if (this.hasSpecialTag) {
this.setSpecialTagContent();
} else {
this.setNormalTagContent(firstTime);
}
}
},
setNormalTagContent: function setNormalTagContent(firstTime) {
var self = this;
function htmlSet() {
self._$element.froalaEditor('html.set', self.model || '', true);
self._$element.froalaEditor('undo.reset');
self._$element.froalaEditor('undo.saveStep');
}
if (firstTime) {
this.registerEvent(this._$element, 'froalaEditor.initialized', function () {
htmlSet();
});
} else {
htmlSet();
}
},
setSpecialTagContent: function setSpecialTagContent() {
var tags = this.model;
if (tags) {
for (var attr in tags) {
if (tags.hasOwnProperty(attr) && attr != this.INNER_HTML_ATTR) {
this._$element.attr(attr, tags[attr]);
}
}
if (tags.hasOwnProperty(this.INNER_HTML_ATTR)) {
this._$element[0].innerHTML = tags[this.INNER_HTML_ATTR];
}
}
},
destroyEditor: function destroyEditor() {
if (this._$element) {
this.listeningEvents && this._$element.off(this.listeningEvents.join(" "));
this._$editor.off('keyup');
this._$element.froalaEditor('destroy');
this.listeningEvents.length = 0;
this._$element = null;
this.editorInitialized = false;
}
},
getEditor: function getEditor() {
if (this._$element) {
return this._$element.froalaEditor.bind(this._$element);
}
return null;
},
generateManualController: function generateManualController() {
var self = this;
var controls = {
initialize: this.createEditor,
destroy: this.destroyEditor,
getEditor: this.getEditor
};
this.onManualControllerReady(controls);
},
updateModel: function updateModel() {
var modelContent = '';
if (this.hasSpecialTag) {
var attributeNodes = this._$element[0].attributes;
var attrs = {};
for (var i = 0; i < attributeNodes.length; i++) {
var attrName = attributeNodes[i].name;
if (this.currentConfig.vueIgnoreAttrs && this.currentConfig.vueIgnoreAttrs.indexOf(attrName) != -1) {
continue;
}
attrs[attrName] = attributeNodes[i].value;
}
if (this._$element[0].innerHTML) {
attrs[this.INNER_HTML_ATTR] = this._$element[0].innerHTML;
}
modelContent = attrs;
} else {
var returnedHtml = this._$element.froalaEditor('html.get');
if (typeof returnedHtml === 'string') {
modelContent = returnedHtml;
}
}
this.oldModel = modelContent;
this.$emit('input', modelContent);
},
initListeners: function initListeners() {
var self = this;
this.registerEvent(this._$element, 'froalaEditor.contentChanged', function () {
self.updateModel();
});
if (this.currentConfig.immediateVueModelUpdate) {
this.registerEvent(this._$editor, 'keyup', function () {
self.updateModel();
});
}
},
registerEvent: function registerEvent(element, eventName, callback) {
if (!element || !eventName || !callback) {
return;
}
this.listeningEvents.push(eventName);
element.on(eventName, callback);
},
registerEvents: function registerEvents() {
var events = this.currentConfig.events;
if (!events) {
return;
}
for (var event in events) {
if (events.hasOwnProperty(event)) {
this.registerEvent(this._$element, event, events[event]);
}
}
}
}
};
Vue.component('froala', froalaEditorFunctionality);
var froalaViewFunctionality = {
props: ['tag', 'value'],
watch: {
value: function value(newValue) {
this._element.innerHTML = newValue;
}
},
created: function created() {
this.currentTag = this.tag || this.currentTag;
},
render: function render(createElement) {
return createElement(this.currentTag, {
class: 'fr-view'
});
},
mounted: function mounted() {
this._element = this.$el;
if (this.value) {
this._element.innerHTML = this.value;
}
},
data: function data() {
return {
currentTag: 'div',
_element: null
};
}
};
Vue.component('froalaView', froalaViewFunctionality);
};
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(2), __esModule: true };
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(3)
, $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});
module.exports = function stringify(it){ // eslint-disable-line no-unused-vars
return $JSON.stringify.apply($JSON, arguments);
};
/***/ },
/* 3 */
/***/ function(module, exports) {
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ }
/******/ ])
});
;
/***/ })
/******/ ]);
});

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("vue-froala-wysiwyg",[],e):"object"==typeof exports?exports["vue-froala-wysiwyg"]=e():t["vue-froala-wysiwyg"]=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=i(1),o=n(r);e.default=function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{props:["tag","value","config","onManualControllerReady"],watch:{value:function(){this.model=this.value,this.updateValue()}},render:function(t){return t(this.currentTag,[this.$slots.default])},created:function(){this.currentTag=this.tag||this.currentTag,this.model=this.value},mounted:function(){this.SPECIAL_TAGS.indexOf(this.currentTag)!=-1&&(this.hasSpecialTag=!0),this.onManualControllerReady?this.generateManualController():this.createEditor()},beforeDestroy:function(){this.destroyEditor()},data:function(){return{currentTag:"div",listeningEvents:[],_$element:null,_$editor:null,currentConfig:null,defaultConfig:{immediateVueModelUpdate:!1,vueIgnoreAttrs:null},editorInitialized:!1,SPECIAL_TAGS:["img","button","input","a"],INNER_HTML_ATTR:"innerHTML",hasSpecialTag:!1,model:null,oldModel:null}},methods:{updateValue:function(){(0,o.default)(this.oldModel)!=(0,o.default)(this.model)&&this.setContent()},createEditor:function(){this.editorInitialized||(this.currentConfig=this.config||this.defaultConfig,this._$element=$(this.$el),this.setContent(!0),this.registerEvents(),this._$editor=this._$element.froalaEditor(this.currentConfig).data("froala.editor").$el,this.initListeners(),this.editorInitialized=!0)},setContent:function(t){(this.editorInitialized||t)&&(this.model||""==this.model)&&(this.oldModel=this.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))},setNormalTagContent:function(t){function e(){i._$element.froalaEditor("html.set",i.model||"",!0),i._$element.froalaEditor("undo.reset"),i._$element.froalaEditor("undo.saveStep")}var i=this;t?this.registerEvent(this._$element,"froalaEditor.initialized",function(){e()}):e()},setSpecialTagContent:function(){var t=this.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this._$element.attr(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this._$element[0].innerHTML=t[this.INNER_HTML_ATTR])}},destroyEditor:function(){this._$element&&(this.listeningEvents&&this._$element.off(this.listeningEvents.join(" ")),this._$editor.off("keyup"),this._$element.froalaEditor("destroy"),this.listeningEvents.length=0,this._$element=null,this.editorInitialized=!1)},getEditor:function(){return this._$element?this._$element.froalaEditor.bind(this._$element):null},generateManualController:function(){var t={initialize:this.createEditor,destroy:this.destroyEditor,getEditor:this.getEditor};this.onManualControllerReady(t)},updateModel:function(){var t="";if(this.hasSpecialTag){for(var e=this._$element[0].attributes,i={},n=0;n<e.length;n++){var r=e[n].name;this.currentConfig.vueIgnoreAttrs&&this.currentConfig.vueIgnoreAttrs.indexOf(r)!=-1||(i[r]=e[n].value)}this._$element[0].innerHTML&&(i[this.INNER_HTML_ATTR]=this._$element[0].innerHTML),t=i}else{var o=this._$element.froalaEditor("html.get");"string"==typeof o&&(t=o)}this.oldModel=t,this.$emit("input",t)},initListeners:function(){var t=this;this.registerEvent(this._$element,"froalaEditor.contentChanged",function(){t.updateModel()}),this.currentConfig.immediateVueModelUpdate&&this.registerEvent(this._$editor,"keyup",function(){t.updateModel()})},registerEvent:function(t,e,i){t&&e&&i&&(this.listeningEvents.push(e),t.on(e,i))},registerEvents:function(){var t=this.currentConfig.events;if(t)for(var e in t)t.hasOwnProperty(e)&&this.registerEvent(this._$element,e,t[e])}}});t.component("froala",e);var i={props:["tag","value"],watch:{value:function(t){this._element.innerHTML=t}},created:function(){this.currentTag=this.tag||this.currentTag},render:function(t){return t(this.currentTag,{class:"fr-view"})},mounted:function(){this._element=this.$el,this.value&&(this._element.innerHTML=this.value)},data:function(){return{currentTag:"div",_element:null}}};t.component("froalaView",i)}},function(t,e,i){t.exports={default:i(2),__esModule:!0}},function(t,e,i){var n=i(3),r=n.JSON||(n.JSON={stringify:JSON.stringify});t.exports=function(t){return r.stringify.apply(r,arguments)}},function(t,e){var i=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=i)}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("vue-froala-wysiwyg",[],e):"object"==typeof exports?exports["vue-froala-wysiwyg"]=e():t["vue-froala-wysiwyg"]=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),e.default=function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var e={props:["tag","value","config","onManualControllerReady"],watch:{value:function(){this.model=this.value,this.updateValue()}},render:function(t){return t(this.currentTag,[this.$slots.default])},created:function(){this.currentTag=this.tag||this.currentTag,this.model=this.value},mounted:function(){-1!=this.SPECIAL_TAGS.indexOf(this.currentTag)&&(this.hasSpecialTag=!0),this.onManualControllerReady?this.generateManualController():this.createEditor()},beforeDestroy:function(){this.destroyEditor()},data:function(){return{currentTag:"div",listeningEvents:[],_$element:null,_$editor:null,currentConfig:null,defaultConfig:{immediateVueModelUpdate:!1,vueIgnoreAttrs:null},editorInitialized:!1,SPECIAL_TAGS:["img","button","input","a"],INNER_HTML_ATTR:"innerHTML",hasSpecialTag:!1,model:null,oldModel:null}},methods:{updateValue:function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.model)&&this.setContent()},createEditor:function(){this.editorInitialized||(this.currentConfig=this.config||this.defaultConfig,this._$element=jQuery(this.$el),this.setContent(!0),this.registerEvents(),this._$editor=this._$element.froalaEditor(this.currentConfig).data("froala.editor").$el,this.initListeners(),this.editorInitialized=!0)},setContent:function(t){(this.editorInitialized||t)&&(this.model||""==this.model)&&(this.oldModel=this.model,this.hasSpecialTag?this.setSpecialTagContent():this.setNormalTagContent(t))},setNormalTagContent:function(t){var e=this;function n(){e._$element.froalaEditor("html.set",e.model||"",!0),e._$element.froalaEditor("undo.saveStep"),e._$element.froalaEditor("undo.reset")}t?this.registerEvent(this._$element,"froalaEditor.initialized",function(){n()}):n()},setSpecialTagContent:function(){var t=this.model;if(t){for(var e in t)t.hasOwnProperty(e)&&e!=this.INNER_HTML_ATTR&&this._$element.attr(e,t[e]);t.hasOwnProperty(this.INNER_HTML_ATTR)&&(this._$element[0].innerHTML=t[this.INNER_HTML_ATTR])}},destroyEditor:function(){this._$element&&(this.listeningEvents&&this._$element.off(this.listeningEvents.join(" ")),this._$editor.off("keyup"),this._$element.froalaEditor("destroy"),this.listeningEvents.length=0,this._$element=null,this.editorInitialized=!1)},getEditor:function(){return this._$element?this._$element.froalaEditor.bind(this._$element):null},generateManualController:function(){var t={initialize:this.createEditor,destroy:this.destroyEditor,getEditor:this.getEditor};this.onManualControllerReady(t)},updateModel:function(){var t="";if(this.hasSpecialTag){for(var e=this._$element[0].attributes,n={},i=0;i<e.length;i++){var r=e[i].name;this.currentConfig.vueIgnoreAttrs&&-1!=this.currentConfig.vueIgnoreAttrs.indexOf(r)||(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.$emit("input",t)},initListeners:function(){var t=this;this.registerEvent(this._$element,"froalaEditor.contentChanged",function(){t.updateModel()}),this.currentConfig.immediateVueModelUpdate&&this.registerEvent(this._$editor,"keyup",function(){t.updateModel()})},registerEvent:function(t,e,n){t&&e&&n&&(this.listeningEvents.push(e),t.on(e,n))},registerEvents:function(){var t=this.currentConfig.events;if(t)for(var e in t)t.hasOwnProperty(e)&&this.registerEvent(this._$element,e,t[e])}}};t.component("Froala",e);t.component("FroalaView",{props:["tag","value"],watch:{value:function(t){this._element.innerHTML=t}},created:function(){this.currentTag=this.tag||this.currentTag},render:function(t){return t(this.currentTag,{class:"fr-view"})},mounted:function(){this._element=this.$el,this.value&&(this._element.innerHTML=this.value)},data:function(){return{currentTag:"div",_element:null}}})}}])});

@@ -1,13 +0,16 @@

'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
_Object$defineProperty(exports, "__esModule", {
value: true
});
var _vueFroala = require('./vue-froala');
exports["default"] = void 0;
var _vueFroala2 = _interopRequireDefault(_vueFroala);
var _vueFroala = _interopRequireDefault(require("./vue-froala"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _vueFroala2.default;
var _default = _vueFroala["default"];
exports["default"] = _default;

@@ -1,29 +0,28 @@

'use strict';
"use strict";
var _vue = require('vue');
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
var _vue2 = _interopRequireDefault(_vue);
var _vue = _interopRequireDefault(require("vue"));
var _App = require('./examples/App');
var _App = _interopRequireDefault(require("./examples/App"));
var _App2 = _interopRequireDefault(_App);
var _src = _interopRequireDefault(require("src"));
var _src = require('src');
var _src2 = _interopRequireDefault(_src);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
// supports both of Vue 1.0 and Vue 2.0
require('froala-editor/js/froala_editor.pkgd.min');
require("froala-editor/css/froala_editor.pkgd.min.css");
require('font-awesome/css/font-awesome.css');
require('froala-editor/css/froala_style.min.css');
_vue2.default.use(_src2.default);
_vue["default"].use(_src["default"]);
new _vue2.default({
new _vue["default"]({
render: function render(h) {
return h(_App2.default);
return h(_App["default"]);
}
}).$mount('#app');

@@ -1,21 +0,19 @@

'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
_Object$defineProperty(exports, "__esModule", {
value: true
});
var _stringify = require('babel-runtime/core-js/json/stringify');
exports["default"] = void 0;
var _stringify2 = _interopRequireDefault(_stringify);
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (Vue) {
var _default = function _default(Vue) {
var Options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var froalaEditorFunctionality = {
props: ['tag', 'value', 'config', 'onManualControllerReady'],
watch: {

@@ -27,7 +25,5 @@ value: function value() {

},
render: function render(createElement) {
return createElement(this.currentTag, [this.$slots.default]);
return createElement(this.currentTag, [this.$slots["default"]]);
},
created: function created() {

@@ -37,6 +33,5 @@ this.currentTag = this.tag || this.currentTag;

},
// After first time render.
mounted: function mounted() {
if (this.SPECIAL_TAGS.indexOf(this.currentTag) != -1) {
this.hasSpecialTag = true;

@@ -51,19 +46,17 @@ }

},
beforeDestroy: function beforeDestroy() {
this.destroyEditor();
},
data: function data() {
return {
// Tag on which the editor is initialized.
currentTag: 'div',
listeningEvents: [],
// Jquery wrapped element.
_$element: null,
// Editor element.
_$editor: null,
// Current config.
currentConfig: null,
// Editor options config
defaultConfig: {

@@ -73,9 +66,6 @@ immediateVueModelUpdate: false,

},
editorInitialized: false,
SPECIAL_TAGS: ['img', 'button', 'input', 'a'],
INNER_HTML_ATTR: 'innerHTML',
hasSpecialTag: false,
model: null,

@@ -87,3 +77,3 @@ oldModel: null

updateValue: function updateValue() {
if ((0, _stringify2.default)(this.oldModel) == (0, _stringify2.default)(this.model)) {
if ((0, _stringify["default"])(this.oldModel) == (0, _stringify["default"])(this.model)) {
return;

@@ -94,5 +84,3 @@ }

},
createEditor: function createEditor() {
if (this.editorInitialized) {

@@ -103,16 +91,10 @@ return;

this.currentConfig = this.config || this.defaultConfig;
this._$element = $(this.$el);
this._$element = jQuery(this.$el);
this.setContent(true);
this.registerEvents();
this._$editor = this._$element.froalaEditor(this.currentConfig).data('froala.editor').$el;
this.initListeners();
this.editorInitialized = true;
},
setContent: function setContent(firstTime) {
if (!this.editorInitialized && !firstTime) {

@@ -123,3 +105,2 @@ return;

if (this.model || this.model == '') {
this.oldModel = this.model;

@@ -134,13 +115,12 @@

},
setNormalTagContent: function setNormalTagContent(firstTime) {
var self = this;
function htmlSet() {
self._$element.froalaEditor('html.set', self.model || '', true); //This will reset the undo stack everytime the model changes externally. Can we fix this?
self._$element.froalaEditor('html.set', self.model || '', true);
self._$element.froalaEditor('undo.saveStep');
self._$element.froalaEditor('undo.reset');
self._$element.froalaEditor('undo.saveStep');
}

@@ -156,9 +136,6 @@

},
setSpecialTagContent: function setSpecialTagContent() {
var tags = this.model; // add tags on element
var tags = this.model;
if (tags) {
for (var attr in tags) {

@@ -175,10 +152,10 @@ if (tags.hasOwnProperty(attr) && attr != this.INNER_HTML_ATTR) {

},
destroyEditor: function destroyEditor() {
if (this._$element) {
this.listeningEvents && this._$element.off(this.listeningEvents.join(" "));
this.listeningEvents && this._$element.off(this.listeningEvents.join(" "));
this._$editor.off('keyup');
this._$element.froalaEditor('destroy');
this.listeningEvents.length = 0;

@@ -189,13 +166,10 @@ this._$element = null;

},
getEditor: function getEditor() {
if (this._$element) {
return this._$element.froalaEditor.bind(this._$element);
}
return null;
},
generateManualController: function generateManualController() {
var self = this;

@@ -207,12 +181,8 @@ var controls = {

};
this.onManualControllerReady(controls);
},
updateModel: function updateModel() {
var modelContent = '';
if (this.hasSpecialTag) {
var attributeNodes = this._$element[0].attributes;

@@ -222,7 +192,8 @@ var attrs = {};

for (var i = 0; i < attributeNodes.length; i++) {
var attrName = attributeNodes[i].name;
var attrName = attributeNodes[i].name;
if (this.currentConfig.vueIgnoreAttrs && this.currentConfig.vueIgnoreAttrs.indexOf(attrName) != -1) {
continue;
}
attrs[attrName] = attributeNodes[i].value;

@@ -237,4 +208,4 @@ }

} else {
var returnedHtml = this._$element.froalaEditor('html.get');
var returnedHtml = this._$element.froalaEditor('html.get');
if (typeof returnedHtml === 'string') {

@@ -248,5 +219,4 @@ modelContent = returnedHtml;

},
initListeners: function initListeners() {
var self = this;
var self = this; // bind contentChange and keyup event to froalaModel

@@ -256,2 +226,3 @@ this.registerEvent(this._$element, 'froalaEditor.contentChanged', function () {

});
if (this.currentConfig.immediateVueModelUpdate) {

@@ -263,5 +234,4 @@ this.registerEvent(this._$editor, 'keyup', function () {

},
// register event on jquery editor element
registerEvent: function registerEvent(element, eventName, callback) {
if (!element || !eventName || !callback) {

@@ -274,6 +244,5 @@ return;

},
registerEvents: function registerEvents() {
var events = this.currentConfig.events;
var events = this.currentConfig.events;
if (!events) {

@@ -291,9 +260,5 @@ return;

};
Vue.component('froala', froalaEditorFunctionality);
Vue.component('Froala', froalaEditorFunctionality);
var froalaViewFunctionality = {
props: ['tag', 'value'],
watch: {

@@ -304,13 +269,11 @@ value: function value(newValue) {

},
created: function created() {
this.currentTag = this.tag || this.currentTag;
},
render: function render(createElement) {
return createElement(this.currentTag, {
class: 'fr-view'
"class": 'fr-view'
});
},
// After first time render.
mounted: function mounted() {

@@ -323,5 +286,3 @@ this._element = this.$el;

},
data: function data() {
return {

@@ -333,4 +294,5 @@ currentTag: 'div',

};
Vue.component('FroalaView', froalaViewFunctionality);
};
Vue.component('froalaView', froalaViewFunctionality);
};
exports["default"] = _default;
{
"name": "vue-froala-wysiwyg",
"version": "2.9.3",
"version": "2.9.4-1",
"description": "Vue plugin for Froala WYSIWYG HTML rich text editor.",

@@ -41,47 +41,53 @@ "author": "Froala Labs (https://www.froala.com/)",

"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"release": "webpack --progress --hide-modules --config ./build/webpack.release.js && NODE_ENV=production webpack --progress --hide-modules --config ./build/webpack.release.min.js",
"release": "SET NODE_ENV=production && webpack --progress --hide-modules --config ./build/webpack.release.js && webpack --progress --hide-modules --config ./build/webpack.release.min.js",
"prepublish": "yarn run build"
},
"dependencies": {
"froala-editor": "2.9.3",
"vue": "^2.2.4"
"babel-runtime": "^6.26.0",
"froala-editor": "2.9.4",
"vue": "2.6.6"
},
"devDependencies": {
"babel-cli": "^6.24.0",
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-stage-2": "^6.22.0",
"babel-runtime": "^6.23.0",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/helpers": "^7.3.1",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.4",
"@babel/runtime": "^7.3.4",
"@babel/runtime-corejs2": "^7.3.4",
"babel-helpers": "^6.24.1",
"babel-loader": "^8.0.5",
"connect-history-api-fallback": "^1.1.0",
"cross-env": "^3.2.4",
"cross-spawn": "^5.1.0",
"css-loader": "^0.27.3",
"cross-env": "^5.2.0",
"cross-spawn": "^6.0.5",
"css-loader": "^2.1.0",
"eventsource-polyfill": "^0.9.6",
"express": "^4.15.2",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.10.1",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^3.0.1",
"function-bind": "^1.0.2",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.4",
"inject-loader": "^3.0.0-beta4",
"html-webpack-plugin": "^3.2.0",
"http-proxy-middleware": "^0.19.1",
"inject-loader": "^4.0.1",
"isparta-loader": "^2.0.0",
"jasmine-core": "^2.5.2",
"jasmine-core": "^3.3.0",
"json-loader": "^0.5.4",
"lolex": "^1.6.0",
"nightwatch": "^0.9.13",
"ora": "^1.1.0",
"shelljs": "^0.7.7",
"url-loader": "^0.5.8",
"lolex": "^3.1.0",
"nightwatch": "^1.0.19",
"ora": "^3.1.0",
"shelljs": "^0.8.3",
"uglifyjs-webpack-plugin": "2.1.1",
"url-loader": "^1.1.2",
"vue-hot-reload-api": "^2.0.11",
"vue-html-loader": "^1.2.4",
"vue-loader": "^11.1.4",
"vue-style-loader": "^2.0.4",
"vue-template-compiler": "^2.2.4",
"webpack": "^1.13.2",
"webpack-dev-middleware": "^1.10.1",
"vue-loader": "15.6.2",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "2.6.6",
"webpack": "^4.29.3",
"webpack-cli": "3.2.3",
"webpack-dev-middleware": "^3.5.2",
"webpack-hot-middleware": "^2.17.1",
"webpack-merge": "1.1.1",
"yarn": "^0.21.3"
"webpack-merge": "4.2.1",
"yarn": "^1.13.0"
},

@@ -91,7 +97,2 @@ "engines": {

},
"babel": {
"presets": [
"es2015"
]
},
"browserify": {

@@ -98,0 +99,0 @@ "transform": [

@@ -35,3 +35,3 @@ # Vue JS Froala WYSIWYG Editor

// Require Froala Editor js file.
require('froala-editor/js/froala_editor.pkgd.min')
require('froala-editor/js/froala_editor.pkgd.min.js')

@@ -38,0 +38,0 @@ // Require Froala Editor css files.

@@ -95,4 +95,6 @@

this._$element = $(this.$el);
this._$element = jQuery(this.$el);
this.setContent(true);

@@ -130,7 +132,9 @@

function htmlSet() {
self._$element.froalaEditor('html.set', self.model || '', true);
//This will reset the undo stack everytime the model changes externally. Can we fix this?
self._$element.froalaEditor('undo.saveStep');
self._$element.froalaEditor('undo.reset');
self._$element.froalaEditor('undo.saveStep');
}

@@ -181,3 +185,2 @@

getEditor: function() {
if (this._$element) {

@@ -277,3 +280,3 @@ return this._$element.froalaEditor.bind(this._$element);

Vue.component('froala', froalaEditorFunctionality);
Vue.component('Froala', froalaEditorFunctionality);

@@ -321,3 +324,3 @@ var froalaViewFunctionality = {

Vue.component('froalaView', froalaViewFunctionality);
Vue.component('FroalaView', froalaViewFunctionality);
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc