Skip to content

Conversation

@VladaHarbour
Copy link
Contributor

No description provided.

@VladaHarbour VladaHarbour self-assigned this Jan 30, 2026
@linear
Copy link

linear bot commented Jan 30, 2026

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f6ac31816

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@caio-pizzol caio-pizzol self-requested a review January 30, 2026 21:03
Copy link
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

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

looks good overall! just a minor comment

@caio-pizzol caio-pizzol self-requested a review February 2, 2026 13:25
Copy link
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

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

LGTm

@superdoc-dev superdoc-dev deleted a comment from github-actions bot Feb 3, 2026
@caio-pizzol caio-pizzol self-requested a review February 3, 2026 14:47
Copy link
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

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

@VladaHarbour just a few more comments around ECMA spec - worth double checking before merging

}, []);

updatedRows.forEach((row, index) => {
if (rowStartInlines[index]?.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So I checked the spec (§17.13.6.2) actually shows bookmarkEnd as a sibling of table cells, not inside them:

  <w:tr>                                                                                                                                                                                                                                           
    <w:tc><w:p/></w:tc>                                                                                                                                                                                                                            
    <w:bookmarkEnd w:id="0" />  <!-- sits here, outside the cell -->                                                                                                                                                                               
  </w:tr>                                                                                                                                                                                                                                          

But we're putting it inside a paragraph. This is probably fine given ProseMirror's schema constraints - just worth double-checking and documenting that we're intentionally normalizing the structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue here is that Prosemirror schema doesn't accept anything but tableCell inside tableRow. We can intentionally change this but the compatibility with table plugins may be broken

* @returns {Array}
*/
export function normalizeTableBookmarksInContent(content = [], editor) {
if (!Array.isArray(content) || content.length === 0) return content;
Copy link
Contributor

Choose a reason for hiding this comment

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

Table bookmarks can have colFirst and colLast attributes that specify which columns they cover:

<w:bookMarkStart w:colFirst="0" w:colLast="1" w:id="0" w:name="table"/>

I didn't see these being preserved when we relocate the bookmarks. If someone has a column-range bookmark, we might lose that info. Worth checking if this matters for our use cases, or at least adding a comment about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will check it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@caio-pizzol aded support for colFirst/colLast attributes when calculating the cell for normalisation

return result;
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

ECMA spec doesn't actually show bookmarks as valid direct children of <w:tbl>. So this whole normalization is handling documents that aren't strictly conformant.

Would be nice to add a comment explaining that - something like:

/**                                                                                                                                                                                                                                              
   * Some non-conformant DOCX producers place bookmarks as direct table children.                                                                                                                                                                  
   * Per ECMA-376 §17.13.6.2, they should be inside cells (bookmarkStart) or                                                                                                                                                                       
   * as children of rows (bookmarkEnd). We relocate them for PM compatibility.                                                                                                                                                                     
   */

@VladaHarbour
Copy link
Contributor Author

@caio-pizzol please let me know If I have to do something with the last spec review. https://ooxml.dev/ page 900 tells that colFirst/colLast are valid attributes for bookmarkStart

@superdoc-dev superdoc-dev deleted a comment from github-actions bot Feb 3, 2026
@superdoc-dev superdoc-dev deleted a comment from github-actions bot Feb 3, 2026
@superdoc-dev superdoc-dev deleted a comment from github-actions bot Feb 3, 2026
@superdoc-dev superdoc-dev deleted a comment from github-actions bot Feb 3, 2026
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.

3 participants