mirror of
https://github.com/codex-team/editor.js
synced 2026-03-16 23:55:49 +01:00
Fix
This commit is contained in:
parent
85de7b903e
commit
5f89e54908
6 changed files with 9 additions and 39 deletions
|
|
@ -72,7 +72,7 @@
|
|||
"FormData": true,
|
||||
"XMLHttpRequest": true,
|
||||
"ActiveXObject": true,
|
||||
"RegExp": true
|
||||
|
||||
"RegExp": true,
|
||||
"Node": true
|
||||
}
|
||||
}
|
||||
|
|
@ -3104,7 +3104,7 @@ var CodexEditor =
|
|||
return null;
|
||||
} else {
|
||||
|
||||
while (!node.classList.contains(this.CSS.block)) {
|
||||
while (node.classList && !node.classList.contains(this.CSS.block)) {
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
|
@ -4016,7 +4016,7 @@ var CodexEditor =
|
|||
* @return {Element}
|
||||
*/
|
||||
value: function make(tagName) {
|
||||
var classNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var classNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
|
||||
|
|
@ -4083,18 +4083,7 @@ var CodexEditor =
|
|||
key: 'isNode',
|
||||
value: function isNode(node) {
|
||||
|
||||
return node && (typeof node === 'undefined' ? 'undefined' : _typeof(node)) === 'object' && node.nodeType && node.nodeType === Dom.nodeTypes.TAG;
|
||||
}
|
||||
}, {
|
||||
key: 'nodeTypes',
|
||||
get: function get() {
|
||||
|
||||
return {
|
||||
TAG: 1,
|
||||
TEXT: 3,
|
||||
COMMENT: 8,
|
||||
DOCUMENT_FRAGMENT: 11
|
||||
};
|
||||
return node && (typeof node === 'undefined' ? 'undefined' : _typeof(node)) === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;
|
||||
}
|
||||
}]);
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -2493,14 +2493,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
|
|
|
|||
|
|
@ -3,17 +3,6 @@
|
|||
*/
|
||||
export default class Dom {
|
||||
|
||||
static get nodeTypes() {
|
||||
|
||||
return {
|
||||
TAG : 1,
|
||||
TEXT : 3,
|
||||
COMMENT : 8,
|
||||
DOCUMENT_FRAGMENT: 11
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for making Elements with classname and attributes
|
||||
*
|
||||
|
|
@ -22,7 +11,7 @@ export default class Dom {
|
|||
* @param {Object} attributes - any attributes
|
||||
* @return {Element}
|
||||
*/
|
||||
static make(tagName, classNames='', attributes={}) {
|
||||
static make(tagName, classNames = null, attributes = {}) {
|
||||
|
||||
var el = document.createElement(tagName);
|
||||
|
||||
|
|
@ -79,7 +68,7 @@ export default class Dom {
|
|||
|
||||
static isNode(node) {
|
||||
|
||||
return node && typeof node === 'object' && node.nodeType && node.nodeType === Dom.nodeTypes.TAG;
|
||||
return node && typeof node === 'object' && node.nodeType && node.nodeType === Node.ELEMENT_NODE;
|
||||
|
||||
}
|
||||
};
|
||||
|
|
@ -130,7 +130,7 @@ module.exports = class Content {
|
|||
|
||||
} else {
|
||||
|
||||
while(!node.classList.contains(this.CSS.block)) {
|
||||
while(node.classList && !node.classList.contains(this.CSS.block)) {
|
||||
|
||||
node = node.parentNode;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue