mirror of
https://github.com/codex-team/editor.js
synced 2024-06-08 00:42:31 +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
|
||||
*
|
||||
* @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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
})({});
|
|
@ -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": {
|
||||
|
|
|
@ -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
Loading…
Reference in a new issue