sanitize improvements

This commit is contained in:
Murod Khaydarov 2017-04-23 00:53:06 +03:00
parent bff230e7c7
commit 49a4290e8e
8 changed files with 26 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -3,7 +3,7 @@
* @description Module works with editor added Elements
*
* @author Codex Team
* @version 1.3.12
* @version 1.4.0
*/
module.exports = (function (callbacks) {
@ -933,7 +933,6 @@ module.exports = (function (callbacks) {
/** Temporary DIV that is used to work with childs as arrays item */
var div = editor.draw.node('DIV', '', {}),
cleaner = new editor.sanitizer.init(),
cleanData,
fragment;
@ -942,7 +941,8 @@ module.exports = (function (callbacks) {
if ( htmlData.trim() != '' ) {
cleanData = cleaner.clean(htmlData);
console.log('here');
cleanData = editor.sanitizer.clean(htmlData);
div.innerHTML = cleanData;
} else {

View file

@ -48,14 +48,30 @@ module.exports = (function (sanitizer) {
sanitizer.Config = Config;
sanitizer.init = function () {
let init_ = function (userCustomConfig) {
let configuration = Config.CUSTOM || Config.BASIC;
let configuration = userCustomConfig || Config.CUSTOM || Config.BASIC;
console.log(configuration);
return new janitor(configuration);
};
/**
* Cleans string from unwanted tags
* @protected
* @param {String} dirtyString - taint string
* @param {Object} customConfig - allowed tags
*/
sanitizer.clean = function(dirtyString, customConfig) {
console.log('her');
let janitorInstance = init_(customConfig);
return janitorInstance.clean(dirtyString);
};
return sanitizer;
})({});

View file

@ -1,6 +1,6 @@
{
"name": "codex.editor",
"version": "1.6.2",
"version": "1.6.3",
"description": "Codex Editor. Native JS, based on API and Open Source",
"main": "index.js",
"scripts": {

View file

@ -26,7 +26,6 @@ var ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {
"whatwg-fetch": "whatwg-fetch",
"codex-editor": "./codex"
},
output: {
@ -37,7 +36,7 @@ module.exports = {
watch: true,
watchOptions: {
aggregateTimeOut: 100
aggregateTimeOut: 50
},
devtool: NODE_ENV == 'development' ? "source-map" : null,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long