3f7e1bdc7b
Page/space export (Markdown & HTML, both via jsonToHtml -> generateHTML) crashed with "Export failed:undefined" on any page carrying a `comment` mark. Root cause: comment.renderHTML returned a LIVE DOM node (document.createElement + a click listener) whenever a global `document` existed — and the in-process MCP module injects a jsdom global.window+global.document into the Node server, defeating the old `typeof document === "undefined"` guard. The server export runs happy-dom's DOMSerializer, which crashes appending the foreign jsdom node (NodeUtility.isInclusiveAncestor -> "Cannot read properties of undefined (reading 'length')"). comment is the only extension returning a live node. Fix: widen the guard with an isNodeRuntime check (process.versions.node) so on any Node runtime renderHTML returns the plain, serializable spec array — even when MCP injected jsdom globals. The browser branch (createElement + click -> ACTIVE_COMMENT_EVENT) is untouched, so in-editor comment interactivity is preserved (Vite defines only process.env as a member-expression substitution, no `process` object in the browser bundle, so isNodeRuntime is false there). The mcp schema mirror already returns a spec array and is not on the export path (tiptapExtensions imports Comment from @docmost/editor-ext), so no mirror change is needed. Also: export-modal now reads the real error text from the response Blob (responseType:'blob' made err.response.data.message always undefined) so a failed export shows the server's message instead of "undefined". Adds a regression test that runs the real jsonToHtml on a comment-marked doc with jsdom globals injected (reproduces the crash on the unpatched code, passes after). closes #298 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
- Replace
plugin:@typescript-eslint/recommendedtoplugin:@typescript-eslint/recommended-type-checkedorplugin:@typescript-eslint/strict-type-checked - Optionally add
plugin:@typescript-eslint/stylistic-type-checked - Install eslint-plugin-react and add
plugin:react/recommended&plugin:react/jsx-runtimeto theextendslist