Repository navigation
fix: export a file block without a caption as a paragraph - #3387
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
@blocknote/xl-typst-exporter
commit: |
|
The external HTML of a file block without a caption was a link alone. A link is inline content. Thus the HTML parse joined two adjacent links into one paragraph: two blocks became one block. Now the link of a file block without a caption is in a paragraph. The export of a file block with a caption was a block-level element (a div) already, and it does not change. Test changes: the HTML export snapshot of a file block without a caption shows the paragraph (one snapshot for the core test schema, one for the React test schema). New test in blocks/File/block.test.ts.
…locks The React file block (`ReactFileBlock`) has its own external HTML. For a block without a caption, it was a link alone, as it was for the file block of the core package. A link is inline content. Thus the HTML parse joined two adjacent links into one paragraph: two blocks became one block. Now the link of a React file block without a caption is in a paragraph, which is the same HTML as the file block of the core package gives. `LinkWithCaption` makes this paragraph when the caption is empty. The export of a file block with a caption does not change. The React image, video and audio blocks do not change.
b2af6a0 to
a090b29
Compare
Main has the new test layout (tests/src/integration, Node or browser tests, setupEditor) and the Knip audit. Conflicts in 21 files: - package.json: the devDependencies of main (knip, postcss), and the two of the lens (@vitest/coverage-v8, eslint-plugin-perfectionist). - packages/xl-ai/package.json: the dependencies of main (no headers-polyfill), and the text-lens exports and the Yjs 14 peers of the lens. - packages/xl-ai/vitestSetup.ts: the version of main (getTestOptionsHost works without a window too). - vite.config.ts: the lint config of main, and the lens plugins and the two lens overrides. The lens override also has the rule of main that forbids an import of a test file. - Table/block.ts: the colwidth helper of the lens, with the colspan limit of main (as in the merge of 21 November). - defaultBlocks.ts: the imports of the two sides. - createLinkWithCaption.ts: the version of the lens. Main has only the half without a caption (#3387); the lens also writes a figure for a caption. - math-block (3 files): the version of main (#3389, the reviewed form of the lens commit 82b18c6). The three test files of that lens commit stay. Three of their cases expect an merror for a formula that KaTeX renders in part (x \badcommand y). Main keeps the MathML of KaTeX for such a formula, thus these three cases fail. - BlockNoteEditor.test.ts (removed by main): the block ID tests of the lens move to BlockNoteEditor.node.test.ts (headless) and BlockNoteEditor.browser.test.ts (mounted), with setupEditor. - DiffVersioningExtension.test.ts, utils.test.ts: the setupEditor form of main, with the tests of the lens in that form. - v1BindingSnapshotDiff.test.ts: the version of main. The change of the lens (the second version is an edit that keeps the block ID) is now in v1BindingSnapshotDiff.fixture.ts. - tests/src/unit/... (5 files): main moved them to tests/src/integration. The new markdownSyntaxText copy snapshots are at the new path. The toggle round-trip case of the lens is in htmlRoundTripCases. The two noCaption snapshots of main and of the lens are equal. - pnpm-lock.yaml, playground/src/examples.gen.tsx: the files of main, then made again by pnpm install and vp run gen. The text-lens example has no ariakit and shadcn dependencies now (the template of main).
Summary
The HTML export of a file block without a caption was a link alone. A link is inline content. Thus the HTML parse joined two adjacent file blocks into one paragraph.
The
toExternalHTMLof the file block now puts the link into a<p>element when the block has no caption. The fix is the same for the file block of@blocknote/coreand forReactFileBlockof@blocknote/react(one commit for each).Testing
blocks/File/block.test.ts,blocks/File/block.test.tsx). The two tests fail onmain.<p>element, which has thedata-nameanddata-urlattributes.Notes
LinkWithCaptionis a public export of@blocknote/react. With an empty caption, it now gives a<p>with the link. Before, it gave a<div>with the link and an empty<p>.Summary by CodeRabbit