Eslint --fix for project files (#280)

This commit is contained in:
George Berezhnoy 2018-07-15 16:04:59 +03:00 committed by GitHub
commit 1853cfa78a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 10401 additions and 7648 deletions

View file

@ -3,25 +3,23 @@
* Creates code tag and adds content to this tag
*/
var code = (function(code_plugin) {
var code = (function (code_plugin) {
var baseClass = 'ce-code';
var baseClass = "ce-code";
/**
/**
* Make initial header block
* @param {object} JSON with block data
* @return {Element} element to append
*/
var make_ = function (data) {
var make_ = function (data) {
var tag = codex.editor.draw.node('TEXTAREA', [ baseClass ], {});
var tag = codex.editor.draw.node('TEXTAREA', [baseClass], {});
if (data && data.text) {
tag.value = data.text;
}
if (data && data.text) {
tag.value = data.text;
}
return tag;
};
return tag;
};
/**
* Escapes HTML chars
@ -29,54 +27,45 @@ var code = (function(code_plugin) {
* @param {string} input
* @return {string} escaped string
*/
var escapeHTML_ = function (input) {
var escapeHTML_ = function (input) {
var div = document.createElement('DIV'),
text = document.createTextNode(input);
var div = document.createElement('DIV'),
text = document.createTextNode(input);
div.appendChild(text);
div.appendChild(text);
return div.innerHTML;
};
return div.innerHTML;
};
/**
* Method to render HTML block from JSON
*/
code_plugin.render = function (data) {
code_plugin.render = function (data) {
return make_(data);
};
return make_(data);
};
/**
/**
* Method to extract JSON data from HTML block
*/
code_plugin.save = function (blockContent) {
var escaped = escapeHTML_(blockContent.value),
data = {
text : escaped
};
code_plugin.save = function (blockContent) {
var escaped = escapeHTML_(blockContent.value),
data = {
text : escaped
};
return data;
return data;
};
};
code_plugin.validate = function (data) {
if (data.text.trim() == '')
return;
code_plugin.validate = function (data) {
return true;
};
if (data.text.trim() == '')
return;
return true;
};
code_plugin.destroy = function () {
code = null;
};
return code_plugin;
code_plugin.destroy = function () {
code = null;
};
return code_plugin;
})({});