Fix #229850. Inline editContext check in notebook webviewPreloads. (#229869)

This commit is contained in:
Peng Lyu
2024-09-26 11:37:36 -07:00
committed by GitHub
parent f71675cbd9
commit a7d5297937
@@ -187,6 +187,10 @@ async function webviewPreloads(ctx: PreloadContext) {
}, 0);
};
const isEditableElement = (element: Element) => {
return element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea' || 'editContext' in element;
};
// check if an input element is focused within the output element
const checkOutputInputFocus = (e: FocusEvent) => {
lastFocusedOutput = getOutputContainer(e);
@@ -3106,7 +3110,3 @@ export function preloadsScriptStr(styleValues: PreloadStyles, options: PreloadOp
JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify(ctx))}"))
)\n//# sourceURL=notebookWebviewPreloads.js\n`;
}
export function isEditableElement(element: Element): boolean {
return element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea' || 'editContext' in element;
}