added html and css editors

This commit is contained in:
David Meincke
2022-03-26 20:44:52 +01:00
parent cda1b5c972
commit 6ed4b80c64
23 changed files with 548 additions and 144 deletions
+16
View File
@@ -67,6 +67,22 @@ export class BaseElement extends HTMLElement {
return null;
}
findVisible(tagName: string) {
var result = [];
var elements = document.getElementsByTagName(tagName);
for (let i = 0; i < elements.length; i++) {
const element = <HTMLElement>elements[i];
if (element.style.display !== "none") {
result.push(element);
}
}
return result;
}
hasChild(element: Element, startsWidth: boolean = false): boolean {
var ele = this;
+14
View File
@@ -8,4 +8,18 @@ export function createScript(value: string) {
document.body.appendChild(script);
executeDrawQueue();
}
export function createHtml(value: string) {
var div: HTMLDivElement = document.createElement("div");
div.innerHTML = value;
document.body.appendChild(div);
}
export function createCss(value: string) {
var style: HTMLStyleElement = document.createElement("style");
style.innerHTML = value;
document.body.appendChild(style);
}
+1 -1
View File
@@ -1,4 +1,4 @@
export function messageListener(fn: (type: 'script' | 'log' | 'info' | 'warn' | 'error' | 'syntax-error' | 'time' | 'response', value: string, id: number) => void): Function {
export function messageListener(fn: (type: 'script' | 'log' | 'info' | 'warn' | 'error' | 'syntax-error' | 'time' | 'response' | string, value: string, id: number) => void): Function {
var evt = function(e: any) {
if (!e.data || e.data === '' || e.data.type === 'webpackOk') {