Merge branch 'master' into release.1.6

This commit is contained in:
Murod Khaydarov 2017-04-23 01:29:48 +03:00
commit 262f2d04fe
12 changed files with 182 additions and 23 deletions

2
.gitignore vendored
View file

@ -8,3 +8,5 @@ Thumbs.db
node_modules/*
/server/
/uploads/
plugins/personality/

132
.stylelintrc Normal file
View file

@ -0,0 +1,132 @@
{
"rules": {
"at-rule-empty-line-before": [ "always", {
except: [
"blockless-after-same-name-blockless",
"first-nested",
],
ignore: ["after-comment"],
} ],
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always-single-line",
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-empty-line-before": "never",
"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always-multi-line",
"block-closing-brace-space-before": "always-single-line",
"block-no-empty": true,
"block-opening-brace-newline-after": "always-multi-line",
"block-opening-brace-space-after": "always-single-line",
"block-opening-brace-space-before": "always",
"color-hex-case": "lower",
"color-hex-length": "short",
"color-no-invalid-hex": true,
"comment-empty-line-before": [ "always", {
except: ["first-nested"],
ignore: ["stylelint-commands"],
} ],
"comment-no-empty": true,
"comment-whitespace-inside": "always",
"custom-property-empty-line-before": [ "always", {
except: [
"after-custom-property",
"first-nested",
],
ignore: [
"after-comment",
"inside-single-line-block",
],
} ],
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-block-no-duplicate-properties": [ true, {
ignore: ["consecutive-duplicates-with-different-values"],
} ],
"declaration-block-no-redundant-longhand-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"declaration-colon-newline-after": "always-multi-line",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"declaration-empty-line-before": [ "always", {
except: [
"after-declaration",
"first-nested",
],
ignore: [
"after-comment",
"inside-single-line-block",
],
} ],
"font-family-no-duplicate-names": true,
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "always-multi-line",
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-max-empty-lines": 0,
"function-name-case": "lower",
"function-parentheses-newline-inside": "always-multi-line",
"function-parentheses-space-inside": "never-single-line",
"function-whitespace-after": "always",
"indentation": 4,
"keyframe-declaration-no-important": true,
"length-zero-no-unit": true,
"max-empty-lines": 1,
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-name-case": "lower",
"media-feature-name-no-unknown": true,
"media-feature-parentheses-space-inside": "never",
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"media-query-list-comma-newline-after": "always-multi-line",
"media-query-list-comma-space-after": "always-single-line",
"media-query-list-comma-space-before": "never",
"no-empty-source": true,
"no-eol-whitespace": true,
"no-extra-semicolons": true,
"no-invalid-double-slash-comments": true,
"no-missing-end-of-source-newline": true,
"number-leading-zero": "always",
"number-no-trailing-zeros": true,
"property-case": "lower",
"property-no-unknown": true,
"rule-nested-empty-line-before": [ "always-multi-line", {
except: ["first-nested"],
ignore: ["after-comment"],
} ],
"rule-non-nested-empty-line-before": [ "always-multi-line", {
ignore: ["after-comment"],
} ],
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-descendant-combinator-no-non-space": true,
"selector-list-comma-newline-after": "always",
"selector-list-comma-space-before": "never",
"selector-max-empty-lines": 0,
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-no-unknown": true,
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-pseudo-element-case": "lower",
"selector-pseudo-element-colon-notation": "double",
"selector-pseudo-element-no-unknown": true,
"selector-type-case": "lower",
"selector-type-no-unknown": true,
"shorthand-property-no-redundant-values": true,
"string-no-newline": true,
"unit-case": "lower",
"unit-no-unknown": true,
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
"value-list-max-empty-lines": 0,
},
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -20,8 +20,7 @@
<script src="codex-editor.js?v=108"></script>
<link rel="stylesheet" href="codex-editor.css?v=11000">
<script src="plugins/paragraph/paragraph.js"></script>
<script src="plugins/paragraph/paragraph.js?v=100"></script>
<link rel="stylesheet" href="plugins/paragraph/paragraph.css">
<script src="plugins/header/header.js"></script>
@ -62,11 +61,6 @@
holderId : "codex-editor",
initialBlockPlugin : 'paragraph',
hideToolbar: false,
sanitizer : {
tags : {
p : {}
}
},
tools : {
paragraph: {
type: 'paragraph',

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,7 @@ module.exports = (function (callbacks) {
if ( htmlData.trim() != '' ) {
cleanData = cleaner.clean(htmlData);
cleanData = editor.sanitizer.clean(htmlData);
div.innerHTML = cleanData;
} else {

View file

@ -48,14 +48,38 @@ module.exports = (function (sanitizer) {
sanitizer.Config = Config;
sanitizer.init = function () {
/**
*
* @param userCustomConfig
* @returns {*}
* @private
*
* @description If developer uses editor's API, then he can customize sane restrictions.
* Or, sane config can be defined globally in editors initialization. That config will be used everywhere
* At least, if there is no config overrides, that API uses BASIC Default configation
*/
let init_ = function (userCustomConfig) {
let configuration = Config.CUSTOM || Config.BASIC;
let configuration = userCustomConfig || Config.CUSTOM || Config.BASIC;
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) {
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

@ -80,10 +80,22 @@ var paragraph = (function(paragraph_plugin) {
*/
paragraph_plugin.save = function (blockContent){
var wrappedText = codex.editor.content.wrapTextWithParagraphs(blockContent.innerHTML);
var wrappedText = codex.editor.content.wrapTextWithParagraphs(blockContent.innerHTML),
sanitizerConfig = {
tags : {
p : {},
a: {
href: true,
target: '_blank',
rel: 'nofollow'
},
i: {},
b: {},
}
};
var data = {
"text": wrappedText,
"text": codex.editor.sanitizer.clean(wrappedText, sanitizerConfig),
"format": "html",
"introText": '<<same>>'
};

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