Skip to content

Commit a59720f

Browse files
committed
checkpoint 4
1 parent 65778da commit a59720f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/com/codeblock.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ export class CodeBlock {
5151
return {
5252
view: (vnode) => {
5353
return [
54-
m(CodeEditor),
54+
m(CodeEditor, {
55+
path: vnode.attrs.path,
56+
workbench: vnode.attrs.workbench,
57+
}),
5558
m(CodeEditorOutput, {
5659
output: this.output,
60+
path: vnode.attrs.path,
5761
}),
5862
];
5963
},
@@ -149,18 +153,13 @@ const CodeEditorOutput = {
149153
attrs: { path },
150154
} = vnode;
151155
const snippet = path.node.getComponent(CodeBlock);
152-
window.hljs.highlightBlock(
153-
dom.querySelector(".code-editor-output")
154-
);
156+
157+
window.hljs.highlightBlock(dom);
155158

156159
dom
157160
.querySelector("button")
158161
.addEventListener("click", async () => {
159-
snippet.output = await defaultExecutor.execute(snippet.code, {
160-
language: snippet.language,
161-
});
162-
console.log(snippet.output);
163-
vnode.state.output = snippet.output;
162+
console.log(snippet);
164163
});
165164
},
166165

0 commit comments

Comments
 (0)