mirror of
https://github.com/codex-team/editor.js
synced 2024-06-01 13:32:43 +02:00
sanitize improvements
This commit is contained in:
parent
bff230e7c7
commit
49a4290e8e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
||||||
* @description Module works with editor added Elements
|
* @description Module works with editor added Elements
|
||||||
*
|
*
|
||||||
* @author Codex Team
|
* @author Codex Team
|
||||||
* @version 1.3.12
|
* @version 1.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = (function (callbacks) {
|
module.exports = (function (callbacks) {
|
||||||
|
@ -933,7 +933,6 @@ module.exports = (function (callbacks) {
|
||||||
|
|
||||||
/** Temporary DIV that is used to work with childs as arrays item */
|
/** Temporary DIV that is used to work with childs as arrays item */
|
||||||
var div = editor.draw.node('DIV', '', {}),
|
var div = editor.draw.node('DIV', '', {}),
|
||||||
cleaner = new editor.sanitizer.init(),
|
|
||||||
cleanData,
|
cleanData,
|
||||||
fragment;
|
fragment;
|
||||||
|
|
||||||
|
@ -942,7 +941,8 @@ module.exports = (function (callbacks) {
|
||||||
|
|
||||||
if ( htmlData.trim() != '' ) {
|
if ( htmlData.trim() != '' ) {
|
||||||
|
|
||||||
cleanData = cleaner.clean(htmlData);
|
console.log('here');
|
||||||
|
cleanData = editor.sanitizer.clean(htmlData);
|
||||||
div.innerHTML = cleanData;
|
div.innerHTML = cleanData;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -48,14 +48,30 @@ module.exports = (function (sanitizer) {
|
||||||
|
|
||||||
sanitizer.Config = Config;
|
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);
|
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;
|
return sanitizer;
|
||||||
|
|
||||||
})({});
|
})({});
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "codex.editor",
|
"name": "codex.editor",
|
||||||
"version": "1.6.2",
|
"version": "1.6.3",
|
||||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -26,7 +26,6 @@ var ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
"whatwg-fetch": "whatwg-fetch",
|
|
||||||
"codex-editor": "./codex"
|
"codex-editor": "./codex"
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
|
@ -37,7 +36,7 @@ module.exports = {
|
||||||
watch: true,
|
watch: true,
|
||||||
|
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
aggregateTimeOut: 100
|
aggregateTimeOut: 50
|
||||||
},
|
},
|
||||||
|
|
||||||
devtool: NODE_ENV == 'development' ? "source-map" : null,
|
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
Loading…
Reference in a new issue