mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 02:56:23 +08:00
feat(editor): migrate typst mermaid to native (#14499)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Native/WASM Mermaid and Typst SVG preview rendering on desktop and mobile, plus cross-platform Preview plugin integrations. * **Improvements** * Centralized, sanitized rendering bridge with automatic Typst font-directory handling and configurable native renderer selection. * More consistent and robust error serialization and worker-backed preview flows for improved stability and performance. * **Tests** * Extensive unit and integration tests for preview rendering, font discovery, sanitization, and error serialization. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -90,6 +90,22 @@ export function createHTMLTargetConfig(
|
||||
);
|
||||
|
||||
const buildConfig = getBuildConfigFromEnv(pkg);
|
||||
const codeBlockPreviewBackendFile =
|
||||
buildConfig.distribution === 'desktop'
|
||||
? 'platform-backend.desktop.ts'
|
||||
: buildConfig.distribution === 'ios' ||
|
||||
buildConfig.distribution === 'android'
|
||||
? 'platform-backend.mobile.ts'
|
||||
: 'platform-backend.ts';
|
||||
const codeBlockPreviewBackendAlias = ProjectRoot.join(
|
||||
'packages',
|
||||
'frontend',
|
||||
'core',
|
||||
'src',
|
||||
'modules',
|
||||
'code-block-preview-renderer',
|
||||
codeBlockPreviewBackendFile
|
||||
).value;
|
||||
|
||||
console.log(
|
||||
`Building [${pkg.name}] for [${buildConfig.appBuildType}] channel in [${buildConfig.debug ? 'development' : 'production'}] mode.`
|
||||
@@ -145,6 +161,8 @@ export function createHTMLTargetConfig(
|
||||
'@preact',
|
||||
'signals-core'
|
||||
).value,
|
||||
'@affine/core/modules/code-block-preview-renderer/platform-backend':
|
||||
codeBlockPreviewBackendAlias,
|
||||
},
|
||||
},
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user