Skip to content

feat(editor): DP-175912 extend table extension for table styling#1130

Open
Maysam Kangarani Farahani (maysamkf) wants to merge 7 commits intostagingfrom
extend-table-support
Open

feat(editor): DP-175912 extend table extension for table styling#1130
Maysam Kangarani Farahani (maysamkf) wants to merge 7 commits intostagingfrom
extend-table-support

Conversation

@maysamkf
Copy link
Contributor

@maysamkf Maysam Kangarani Farahani (maysamkf) commented Mar 16, 2026

PR Title

Obligatory GIF (super important!)

Obligatory GIF

🛠️ Type Of Change

These types will increment the version number on release:

  • Fix
  • Feature
  • Performance Improvement
  • Refactor

📖 Jira Ticket

https://dialpad.atlassian.net/browse/DP-175912

📖 Description

  • Extended tiptap table extension
  • Added allowCustomTables prop
  • Added unit tests

💡 Context

The Omnichannel team is using the rich text editor to support editing signatures in email channels.
Requirement to support some signatures with custom table styling

📝 Checklist

For all PRs:

  • I have ensured no private Dialpad links or info are in the code or pull request description (Dialtone is a public repo!).
  • I have reviewed my changes.
  • I have added all relevant documentation.
  • I have considered the performance impact of my change.

For all Vue changes:

  • I have added / updated unit tests.
  • I have validated components with a screen reader.
  • I have validated components keyboard navigation.

📷 Screenshots / GIFs

Old:

Screenshot 2026-03-16 at 2 21 15 PM

New:

Screenshot 2026-03-16 at 2 20 50 PM

border: var(--dt-size-border-100) solid var(--dt-color-foreground-primary);
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removing td styling when allowCustomTables is enabled

@github-actions
Copy link
Contributor

Please add either the visual-test-ready or no-visual-test label to this PR depending on whether you want to run visual tests or not.
It is recommended to run visual tests if your PR changes any UI. ‼️

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: 499b4dba88

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

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

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

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment on lines +56 to +60
&--custom-tables > .ProseMirror {
td {
padding-left: unset;
border: unset;
}

Choose a reason for hiding this comment

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

P2 Badge Reset table border-collapse in custom table mode

When allowCustomTables is enabled, this block only unsets td border/padding, but the base rule in the same file still forces table { border-collapse: collapse; }. That means pasted tables relying on cellspacing/separate borders (a key custom-table use case) still render collapsed inside the editor, so users won’t see preserved spacing while editing even though attributes are kept in HTML output. Add a table override under the custom-tables modifier to avoid inheriting the default collapsed layout.

Useful? React with 👍 / 👎.

@anarravula-dialpad
Copy link
Contributor

/windsurf-review

Copy link
Contributor

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

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

Other comments (2)

💡 To request another review, post a new comment with "/windsurf-review".

Comment on lines +8 to +39
border: {
default: null,
parseHTML: element => element.getAttribute('border'),
renderHTML: attributes => {
if (!attributes.border) return {};
return { border: attributes.border };
},
},
cellpadding: {
default: null,
parseHTML: element => element.getAttribute('cellpadding'),
renderHTML: attributes => {
if (!attributes.cellpadding) return {};
return { cellpadding: attributes.cellpadding };
},
},
cellspacing: {
default: null,
parseHTML: element => element.getAttribute('cellspacing'),
renderHTML: attributes => {
if (!attributes.cellspacing) return {};
return { cellspacing: attributes.cellspacing };
},
},
style: {
default: null,
parseHTML: element => element.getAttribute('style'),
renderHTML: attributes => {
if (!attributes.style) return {};
return { style: attributes.style };
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider creating a helper function to generate attribute configurations to reduce code duplication. The same pattern is repeated for multiple attributes (border, cellpadding, cellspacing, style, etc.).

For example:

const createAttribute = (name) => ({
  default: null,
  parseHTML: element => element.getAttribute(name),
  renderHTML: attributes => {
    if (!attributes[name]) return {};
    return { [name]: attributes[name] };
  },
});

// Then use it like:
// border: createAttribute('border'),
// cellpadding: createAttribute('cellpadding'),
// etc.

Comment on lines +858 to +871
clipboardData.setData('text/html',
'<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;">' +
'<tr style="background-color: #ffffff;">' +
'<td style="padding: 5px;" valign="top" width="300">' +
'<div style="font-size:14pt; color:#333333; font-weight:bold;">John Doe</div>' +
'</td>' +
'</tr>' +
'<tr>' +
'<td style="padding: 5px;" valign="top" width="300">' +
'<div style="font-size:10pt; color:#666666;">Support Team</div>' +
'</td>' +
'</tr>' +
'</table>',
);
Copy link
Contributor

Choose a reason for hiding this comment

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

The HTML string in the 'should preserve complex email signature table with mixed attributes when pasted' test is quite long and makes the test harder to read. Consider extracting this HTML to a constant at the top of the file or to a helper function that generates test HTML.

Copy link
Contributor Author

@maysamkf Maysam Kangarani Farahani (maysamkf) Mar 16, 2026

Choose a reason for hiding this comment

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

imo i think this is fine, but lmk if anyone thinks this should be changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I'm okay with it

@github-actions
Copy link
Contributor

✔️ Deploy previews ready!
😎 Dialtone documentation preview: https://dialtone.dialpad.com/deploy-previews/pr-1130/
😎 Dialtone-vue preview: https://dialtone.dialpad.com/vue/deploy-previews/pr-1130/

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

Labels

no-visual-test Add this tag when the PR does not need visual testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants