fix(editor): disable html preview when no cross-origin isolated (#12192)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Bug Fixes**
  - Improved compatibility by ensuring code block preview features only activate when the browser supports isolated contexts, preventing potential issues in unsupported environments.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Flrande
2025-05-09 02:23:39 +00:00
parent 6d012f093f
commit 108f9e760e

View File

@@ -13,12 +13,17 @@ export class CodeBlockPreviewExtensionProvider extends ViewExtensionProvider {
override effect() {
super.effect();
htmlPreviewEffects();
if (window.crossOriginIsolated) {
htmlPreviewEffects();
}
}
override setup(context: ViewExtensionContext) {
super.setup(context);
context.register(CodeBlockHtmlPreview);
if (window.crossOriginIsolated) {
context.register(CodeBlockHtmlPreview);
}
}
}