Templates 2.0 (#636)
Templates 2.0 and a whole bunch of other refactoring
This commit is contained in:
@@ -54,6 +54,7 @@ export async function expandCodeWidgets(
|
||||
// 'not found' is to be expected (no code widget configured for this language)
|
||||
// Every other error should probably be reported
|
||||
if (!e.message.includes("not found")) {
|
||||
console.trace();
|
||||
console.error("Error rendering code", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,6 +330,13 @@ function render(
|
||||
const command = t.children![1].children![0].text!;
|
||||
let commandText = command;
|
||||
const aliasNode = findNodeOfType(t, "CommandLinkAlias");
|
||||
const argsNode = findNodeOfType(t, "CommandLinkArgs");
|
||||
let args: any = [];
|
||||
|
||||
if (argsNode) {
|
||||
args = JSON.parse(`[${argsNode.children![0].text!}]`);
|
||||
}
|
||||
|
||||
if (aliasNode) {
|
||||
commandText = aliasNode.children![0].text!;
|
||||
}
|
||||
@@ -337,7 +344,7 @@ function render(
|
||||
return {
|
||||
name: "button",
|
||||
attrs: {
|
||||
"data-onclick": JSON.stringify(["command", command]),
|
||||
"data-onclick": JSON.stringify(["command", command, args]),
|
||||
},
|
||||
body: commandText,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user