mirror of
https://github.com/webislife/wc-wysiwyg.git
synced 2025-07-21 11:32:22 +00:00
Merge pull request #10 from webislife/v1
minor updates for el function after habr.com feedback
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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",
|
||||
"main": "dist/wc-wysiwyg.js",
|
||||
"type": "module",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Short
|
||||
* Short for document.createElement
|
||||
* @param tagName element tag name
|
||||
* @param params list of object params for document.createElements
|
||||
* @returns
|
||||
@ -27,11 +27,7 @@
|
||||
}
|
||||
// element.style[prop]
|
||||
if(styles) {
|
||||
const stylesKeys = Object.keys(styles);
|
||||
for (let i = 0; i < stylesKeys.length; i++) {
|
||||
const key = stylesKeys[i];
|
||||
element.style[key] = styles[key];
|
||||
}
|
||||
Object.assign(element.style, styles);
|
||||
}
|
||||
// element[prop]
|
||||
if(props) {
|
||||
@ -51,11 +47,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
if(append) {
|
||||
for (let i = 0; i < append.length; i++) {
|
||||
const appendEl = append[i];
|
||||
element.append(appendEl);
|
||||
}
|
||||
//append child elements
|
||||
if(append.length) {
|
||||
element.append(...append);
|
||||
}
|
||||
return element;
|
||||
};
|
Reference in New Issue
Block a user