Skip to content

Implement block conversion — export side and convert API#148

Open
Reversean wants to merge 1 commit into
feature/blocks-splitfrom
feature/blocks-convert
Open

Implement block conversion — export side and convert API#148
Reversean wants to merge 1 commit into
feature/blocks-splitfrom
feature/blocks-convert

Conversation

@Reversean
Copy link
Copy Markdown

@Reversean Reversean commented May 24, 2026

Summary

  • Add exportTextContent() to BlockToolFacade — the export counterpart to importTextContent(). Supports a function, a string keypath, or a dot-notation keypath via conversionConfig.export.
  • Add convertBlock() to BlocksManager: exports text from the source block using its conversion config, imports it into the target tool type, and replaces the block at the same index.
  • Implement BlocksAPI.convert() in core and uncomment the method in the SDK interface. The dataOverrides parameter is stubbed with a @todo until BlockAPI is available.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

⏭️ No files to mutate for ./packages/model

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

⏭️ No files to mutate for ./packages/dom-adapters

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

Coverage report for ./packages/model

St.
Category Percentage Covered / Total
🟢 Statements 99.71% 1043/1046
🟢 Branches 98.43% 314/319
🟢 Functions 98.39% 244/248
🟢 Lines 99.7% 1001/1004

Test suite run success

562 tests passing in 26 suites.

Report generated by 🧪jest coverage report action from 630d328

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

Coverage report for ./packages/dom-adapters

St.
Category Percentage Covered / Total
🟢 Statements 96.43% 27/28
🟢 Branches 86.96% 20/23
🟢 Functions 100% 5/5
🟢 Lines 96.43% 27/28

Test suite run success

11 tests passing in 2 suites.

Report generated by 🧪jest coverage report action from 630d328

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

Coverage report for ./packages/core

St.
Category Percentage Covered / Total
🟢 Statements
99.44% (+0.72% 🔼)
179/180
🟢 Branches
96.97% (+5.03% 🔼)
64/66
🟢 Functions
97.14% (-2.86% 🔻)
34/35
🟢 Lines
99.41% (+0.77% 🔼)
168/169
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢 api/BlocksAPI.ts 93.33% 100% 90% 92.86%

Test suite run success

106 tests passing in 7 suites.

Report generated by 🧪jest coverage report action from 630d328

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

Coverage report for ./packages/collaboration-manager

St.
Category Percentage Covered / Total
🟢 Statements 92.51% 358/387
🟢 Branches 85.51% 118/138
🟢 Functions 98.15% 53/54
🟢 Lines 92.41% 353/382

Test suite run success

117 tests passing in 7 suites.

Report generated by 🧪jest coverage report action from 630d328

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

⏭️ No files to mutate for ./packages/core

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

Coverage report for ./packages/ot-server

St.
Category Percentage Covered / Total
🟡 Statements 70.97% 22/31
🔴 Branches 20% 1/5
🟡 Functions 75% 6/8
🟡 Lines 68.97% 20/29

Test suite run success

4 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from 630d328

Add exportTextContent() to BlockToolFacade as the counterpart to importTextContent():
supports function, string keypath, and dot-notation keypath via conversionConfig.export.

Add convertBlock() to BlocksManager: exports text from the source block,
imports it into the target type, and replaces the block at the same index.

Wire up BlocksAPI.convert() in core and uncomment the method in the SDK interface.
dataOverrides parameter is accepted but not yet applied (marked @todo).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Reversean Reversean force-pushed the feature/blocks-convert branch from fc906c1 to 630d328 Compare May 24, 2026 12:33
id: string,
newType: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
dataOverrides?: BlockToolData
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to leave a to-do if you're not going to implement it in this PR

* @param dataOverrides - optional data overrides for the new block @todo implement
*/
public convert(
id: string,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use id or index

Also, it would be more scalable to use a single object with parameters and add an optional useId property (see my PR that adds user ID to API methods)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants