Skip to content

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

@zstsr

Description

@zstsr
<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/baklavajs@2.0.2-beta.3/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/themes@2.0.2-beta.3/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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions