Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the Shadow DOM, the link cannot be created correctly. #427

Open
zstsr opened this issue Sep 12, 2024 · 0 comments
Open

In the Shadow DOM, the link cannot be created correctly. #427

zstsr opened this issue Sep 12, 2024 · 0 comments

Comments

@zstsr
Copy link

zstsr commented Sep 12, 2024

<title>Document</title>
    <style>
        html,
        body {
            margin: 0;
        }

        #editor {
            width: 100vw;
            height: 100vh;
        }
    </style>
</head>
<body>
    <div id="container"></div>

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/bundle.js"></script>
    <script>
        // 创建 Shadow DOM
        const container = document.getElementById("container");
        const shadowRoot = container.attachShadow({ mode: "open" });

        // 创建 link 元素并附加到 Shadow DOM
        const link = document.createElement("link");
        link.rel = "stylesheet";
        link.href = "https://cdn.jsdelivr.net/npm/@baklavajs/[email protected]/dist/syrup-dark.css";
        shadowRoot.appendChild(link);

        // 创建 editor 元素并附加到 Shadow DOM
        const editor = document.createElement("div");
        editor.id = "editor";
        shadowRoot.appendChild(editor);

        // 初始化 BaklavaJS
        const viewModel = BaklavaJS.createBaklava(editor);
        const TestNode = BaklavaJS.Core.defineNode({
            type: "TestNode",
            inputs: {
                a: () => new BaklavaJS.RendererVue.TextInputInterface("Hello", "world"),
            },
            outputs: {
                b: () => new BaklavaJS.RendererVue.TextInputInterface("Hello", "world"),
            },
        });
        viewModel.editor.registerNodeType(TestNode);
    </script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant