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:
@@ -13,12 +13,17 @@ export class CodeBlockPreviewExtensionProvider extends ViewExtensionProvider {
|
|||||||
|
|
||||||
override effect() {
|
override effect() {
|
||||||
super.effect();
|
super.effect();
|
||||||
|
|
||||||
|
if (window.crossOriginIsolated) {
|
||||||
htmlPreviewEffects();
|
htmlPreviewEffects();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override setup(context: ViewExtensionContext) {
|
override setup(context: ViewExtensionContext) {
|
||||||
super.setup(context);
|
super.setup(context);
|
||||||
|
|
||||||
|
if (window.crossOriginIsolated) {
|
||||||
context.register(CodeBlockHtmlPreview);
|
context.register(CodeBlockHtmlPreview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user