mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Pass element to the JS preEvaluate renderer hook (#160851)
This commit is contained in:
parent
ccddb94f98
commit
c6698eaced
|
@ -25,7 +25,7 @@ interface JavaScriptRenderingHook {
|
||||||
*
|
*
|
||||||
* @return A new string of JavaScript or `undefined` to continue using the provided string.
|
* @return A new string of JavaScript or `undefined` to continue using the provided string.
|
||||||
*/
|
*/
|
||||||
preEvaluate(outputItem: OutputItem, element: string, signal: AbortSignal): string | undefined | Promise<string | undefined>;
|
preEvaluate(outputItem: OutputItem, element: HTMLElement, script: string, signal: AbortSignal): string | undefined | Promise<string | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearContainer(container: HTMLElement) {
|
function clearContainer(container: HTMLElement) {
|
||||||
|
@ -103,7 +103,7 @@ async function renderJavascript(outputInfo: OutputItem, container: HTMLElement,
|
||||||
let scriptText = outputInfo.text();
|
let scriptText = outputInfo.text();
|
||||||
|
|
||||||
for (const hook of hooks) {
|
for (const hook of hooks) {
|
||||||
scriptText = (await hook.preEvaluate(outputInfo, scriptText, signal)) ?? scriptText;
|
scriptText = (await hook.preEvaluate(outputInfo, container, scriptText, signal)) ?? scriptText;
|
||||||
if (signal.aborted) {
|
if (signal.aborted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue