mirror of
https://github.com/codex-team/editor.js
synced 2026-03-16 07:35:48 +01:00
Eslint --fix for project files (#280)
This commit is contained in:
parent
640e44b091
commit
1853cfa78a
28 changed files with 10401 additions and 7648 deletions
|
|
@ -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;
|
||||
})({});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue