Serialized table missing colgroup tag and TH's data-colwidth not setting the column width

The question title said it all.

After serializing the ‘prosemirror-tables’'s table , no colgroup tag in the generated editor content’s string.

Only TH have the data-colwidth attribute to wich is affected the column’s width but css doesn’t consider it and columns always stretch to maximum width.

I ll try override the TH’s toDom (or the function which is used in the serialization) to try fix this. If i can add the style.width besides the data-colwidth attribute , it will work

Those are managed by the node view. So indeed, if you want some representation of them in your serialized HTML, you’ll have to provide your own toDOM.

1 Like
tableNodes({
    tableGroup: 'block',
    cellContent: 'block+',
    cellAttributes: {
      class: {
        default: 'table-cell',
        setDOMAttr: (value, attrs) => {
          if (value) {
            attrs.class = value
          }
        },
      },
      style: {
        default: null,
        setDOMAttr: (value, attrs) => {
          if (attrs['data-colwidth']) {
            attrs.style =
              (attrs.style || '') + `width: ${attrs['data-colwidth']}px;`
          }
        },
      },
    },
  })