no children item
This commit is contained in:
parent
9d4801e388
commit
537f1592b1
3 changed files with 29 additions and 4 deletions
|
@ -1,7 +1,8 @@
|
||||||
import browser from "webextension-polyfill";
|
import browser from "webextension-polyfill";
|
||||||
|
|
||||||
|
|
||||||
console.log("Hello from devtools!");
|
console.log("Hello from devtools!");
|
||||||
browser.devtools.panels.elements.createSidebarPane("My Sidebar").then((sidebar) => {
|
browser.devtools.panels.elements.createSidebarPane("Copy Panel").then((sidebar) => {
|
||||||
sidebar.setPage("src/sidebar.html");
|
sidebar.setPage("src/sidebar.html");
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error("Error creating sidebar:", error);
|
||||||
});
|
});
|
|
@ -2,6 +2,7 @@ import React from "react";
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
import Popup from "./pages/Popup";
|
import Popup from "./pages/Popup";
|
||||||
|
|
||||||
|
console.log("Hello from popup!");
|
||||||
ReactDOM.createRoot(document.querySelector("#app")!).render(
|
ReactDOM.createRoot(document.querySelector("#app")!).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<Popup />
|
<Popup />
|
||||||
|
|
|
@ -170,7 +170,7 @@ const HTMLComponentTable: { [key: string]: keyof JSX.IntrinsicElements } = {
|
||||||
"center": "center",
|
"center": "center",
|
||||||
"cite": "cite",
|
"cite": "cite",
|
||||||
"code": "code",
|
"code": "code",
|
||||||
"col": "col",
|
// "col": "col",
|
||||||
"colgroup": "colgroup",
|
"colgroup": "colgroup",
|
||||||
"data": "data",
|
"data": "data",
|
||||||
"datalist": "datalist",
|
"datalist": "datalist",
|
||||||
|
@ -203,7 +203,7 @@ const HTMLComponentTable: { [key: string]: keyof JSX.IntrinsicElements } = {
|
||||||
"i": "i",
|
"i": "i",
|
||||||
// "iframe": "iframe",
|
// "iframe": "iframe",
|
||||||
// "img": "img",
|
// "img": "img",
|
||||||
"input": "input",
|
// "input": "input",
|
||||||
"ins": "ins",
|
"ins": "ins",
|
||||||
"kbd": "kbd",
|
"kbd": "kbd",
|
||||||
"keygen": "keygen",
|
"keygen": "keygen",
|
||||||
|
@ -269,12 +269,35 @@ const HTMLComponentTable: { [key: string]: keyof JSX.IntrinsicElements } = {
|
||||||
"wbr": "wbr",
|
"wbr": "wbr",
|
||||||
"webview": "webview",
|
"webview": "webview",
|
||||||
}
|
}
|
||||||
|
const HTMLNonCHildrenComponentTable: { [key: string]: keyof JSX.IntrinsicElements } = {
|
||||||
|
"input": "input",
|
||||||
|
"img": "img",
|
||||||
|
"meta": "meta",
|
||||||
|
"link": "link",
|
||||||
|
"base": "base",
|
||||||
|
"area": "area",
|
||||||
|
"col": "col",
|
||||||
|
"embed": "embed",
|
||||||
|
"param": "param",
|
||||||
|
"source": "source",
|
||||||
|
"track": "track",
|
||||||
|
"br": "br",
|
||||||
|
"hr": "hr",
|
||||||
|
"wbr": "wbr",
|
||||||
|
"abbr": "abbr",
|
||||||
|
}
|
||||||
|
|
||||||
function VnodeToReact({ vnode }: { vnode: VNode }): React.ReactNode {
|
function VnodeToReact({ vnode }: { vnode: VNode }): React.ReactNode {
|
||||||
if (vnode.type === "text") {
|
if (vnode.type === "text") {
|
||||||
return vnode.text;
|
return vnode.text;
|
||||||
}
|
}
|
||||||
else if (vnode.type === "element") {
|
else if (vnode.type === "element") {
|
||||||
|
if (HTMLNonCHildrenComponentTable[vnode.tagName]) {
|
||||||
|
const Tag = HTMLNonCHildrenComponentTable[vnode.tagName] ?? "div";
|
||||||
|
const style = vnode.style;
|
||||||
|
|
||||||
|
return <Tag style={htmlStyleToReactStyle(style)} />;
|
||||||
|
}
|
||||||
// TODO: support svg
|
// TODO: support svg
|
||||||
const Tag = HTMLComponentTable[vnode.tagName] ?? "div";
|
const Tag = HTMLComponentTable[vnode.tagName] ?? "div";
|
||||||
const style = vnode.style;
|
const style = vnode.style;
|
||||||
|
|
Loading…
Add table
Reference in a new issue