mirror of
https://github.com/webislife/wc-wysiwyg.git
synced 2025-07-21 11:32:22 +00:00
minor updates for el function after habr.com feedback
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@webislife/wc-wysiwyg",
|
"name": "@webislife/wc-wysiwyg",
|
||||||
"version": "0.9.32",
|
"version": "0.9.33",
|
||||||
"description": "WYWSIWYG HTML5 Editor written in ts and designed by web-componennt, support all JS frameworks and browsers",
|
"description": "WYWSIWYG HTML5 Editor written in ts and designed by web-componennt, support all JS frameworks and browsers",
|
||||||
"main": "dist/wc-wysiwyg.js",
|
"main": "dist/wc-wysiwyg.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Short
|
* Short for document.createElement
|
||||||
* @param tagName element tag name
|
* @param tagName element tag name
|
||||||
* @param params list of object params for document.createElements
|
* @param params list of object params for document.createElements
|
||||||
* @returns
|
* @returns
|
||||||
@ -27,11 +27,7 @@
|
|||||||
}
|
}
|
||||||
// element.style[prop]
|
// element.style[prop]
|
||||||
if(styles) {
|
if(styles) {
|
||||||
const stylesKeys = Object.keys(styles);
|
Object.assign(element.style, styles);
|
||||||
for (let i = 0; i < stylesKeys.length; i++) {
|
|
||||||
const key = stylesKeys[i];
|
|
||||||
element.style[key] = styles[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// element[prop]
|
// element[prop]
|
||||||
if(props) {
|
if(props) {
|
||||||
@ -51,11 +47,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(append) {
|
//append child elements
|
||||||
for (let i = 0; i < append.length; i++) {
|
if(append.length) {
|
||||||
const appendEl = append[i];
|
element.append(...append);
|
||||||
element.append(appendEl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return element;
|
return element;
|
||||||
};
|
};
|
Reference in New Issue
Block a user