microsoft / roosterjs

roosterjs is a framework-independent javascript rich text editor.
Other
1.17k stars 157 forks source link

[Content fidelity] Support cellPadding and cellSpacing attributes in Content Model #2808

Open BryanValverdeU opened 1 week ago

BryanValverdeU commented 1 week ago

Add support to cellpadding and cellspacing attributes in Content model, in order to improve content fidelity when writing back tables with these attributes.

Before After
cellSpacingBefore cellSpacingAfter

To test:

  1. Restore the below Snapshot
  2. trigger content model write back
  3. Expect that the table remains the same
<div style="color:inherit" id="x_Signature"><div></div><div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:#fff!important" class="x_elementToProof" data-ogsc="rgb(0, 0, 0)">Test</div><div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:#fff!important" class="x_elementToProof" data-ogsc="rgb(0, 0, 0)"><br></div><div style="color:inherit" id="x_Signature"><table style="background-color:#292929!important;width:100%;font-size:1px;color:inherit" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsb="rgb(255, 255, 255)"><tbody><tr style="font-size:.1"><td style="vertical-align:top" align="left"><table style="width:520px;font-size:.1;line-height:normal" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:8px 0 16px;vertical-align:top" align="left"><a style="text-decoration:none;color:#db97ff!important" id="LPlnk689713" shash="Gaq5rZCBQjei0b1yT8PozmlpqHeMDIE4aXKSoJmxw4De2YIxdooDgydTBEEatzegQ+C+XHRTYGO10WZJ78WlS5VycmaOLT6ctNDsYbbon4l1jCcXVGiNM7ZB+wn6js2KpB8cPDw3DY3GKqGg84+F3LVxCh7repj+zQX0t290OoE=" originalsrc="https://uk.content.exclaimer.net/?url=https%3A%2F%2Fwww.exclaimer.com%2F&amp;tenantid=bm88-84zEem80AAD_wDvFQ&amp;templateid=5c7e21a4227fee1189276045bdcfbff1&amp;excomponentid=dMIpEPiSgs08i9F2UChFySJrEWRX3Obh0itCRuAVbe0&amp;signature=crRogc9HW94jsVqNWbxQr3N22Xa_1qYDZZ59W0ac8spRaErdKq0RY-lNACznFlyqFzxEQ1yUaQOHbmKYKODE73IYRz_bH4ZjsUlkm-5e7_AyUmrAW1Pe4Ys7FqKlXR9LUFtVpRj1bR8KBdhox_0tyJfvqRwozTt7uHDoWepXmCg-MnzMZ91sbhhmcjxEABg4DreHhX4evik5_i1UW_rKvLn4nvjlqqHP_1qord_DMF3Y8sAUJsxTUugEtIyPFSVyFUTu8iPNAY5mY4F752ddc0l2sahm8EqiEVPfq_Cz3oSvRalSHPC0khI43obJsUIuI12nIT6Xq7ol_0-FayNlyA&amp;v=1" data-auth="Verified" rel="noopener noreferrer" target="_blank" href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuk.content.exclaimer.net%2F%3Furl%3Dhttps%253A%252F%252Fwww.exclaimer.com%252F%26tenantid%3Dbm88-84zEem80AAD_wDvFQ%26templateid%3D5c7e21a4227fee1189276045bdcfbff1%26excomponentid%3DdMIpEPiSgs08i9F2UChFySJrEWRX3Obh0itCRuAVbe0%26signature%3DcrRogc9HW94jsVqNWbxQr3N22Xa_1qYDZZ59W0ac8spRaErdKq0RY-lNACznFlyqFzxEQ1yUaQOHbmKYKODE73IYRz_bH4ZjsUlkm-5e7_AyUmrAW1Pe4Ys7FqKlXR9LUFtVpRj1bR8KBdhox_0tyJfvqRwozTt7uHDoWepXmCg-MnzMZ91sbhhmcjxEABg4DreHhX4evik5_i1UW_rKvLn4nvjlqqHP_1qord_DMF3Y8sAUJsxTUugEtIyPFSVyFUTu8iPNAY5mY4F752ddc0l2sahm8EqiEVPfq_Cz3oSvRalSHPC0khI43obJsUIuI12nIT6Xq7ol_0-FayNlyA%26v%3D1&amp;data=05%7C02%7Cbvalverde%40microsoft.com%7Cf4e76a11ec4640ab136408dcdcdf230e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638628098136277978%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;sdata=cdlAH14k6SZOHQYxLwsqIH%2F6AQVZIn%2FsNtMVa7%2FqVuk%3D&amp;reserved=0" title="Original URL: https://uk.content.exclaimer.net/?url=https%3A%2F%2Fwww.exclaimer.com%2F&amp;tenantid=bm88-84zEem80AAD_wDvFQ&amp;templateid=5c7e21a4227fee1189276045bdcfbff1&amp;excomponentid=dMIpEPiSgs08i9F2UChFySJrEWRX3Obh0itCRuAVbe0&amp;signature=crRogc9HW94jsVqNWbxQr3N22Xa_1qYDZZ59W0ac8spRaErdKq0RY-lNACznFlyqFzxEQ1yUaQOHbmKYKODE73IYRz_bH4ZjsUlkm-5e7_AyUmrAW1Pe4Ys7FqKlXR9LUFtVpRj1bR8KBdhox_0tyJfvqRwozTt7uHDoWepXmCg-MnzMZ91sbhhmcjxEABg4DreHhX4evik5_i1UW_rKvLn4nvjlqqHP_1qord_DMF3Y8sAUJsxTUugEtIyPFSVyFUTu8iPNAY5mY4F752ddc0l2sahm8EqiEVPfq_Cz3oSvRalSHPC0khI43obJsUIuI12nIT6Xq7ol_0-FayNlyA&amp;v=1. Click or tap if you trust this link." data-linkindex="0" data-ogsc=""><img style="width:154px;min-width:154px;max-width:154px;height:30.8px;min-height:30.8px;max-height:30.8px;font-size:.1" data-outlook-trace="F:1|T:2" alt="" border="0.1" height="30.8" width="154" originalsrc="cid:11f45b94-9b5f-4001-9411-af4b898848db" data-imageerror="AttNotFound" data-imagetype="AttachmentByCid"></a></td></tr><tr style="font-size:.1"><td style="padding:0 0 12px;vertical-align:top" align="left"><table style="font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"></td><td style="padding:0;vertical-align:top" align="left"><table style="font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0 0 8px;vertical-align:top" align="left"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:20px"><td style="font-family:'Grenette Pro','Crimson Pro',Baskerville">Your&nbsp;Name&nbsp;Here&nbsp;</td></tr></tbody></table></td></tr><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="white-space:nowrap;color:#9aadff;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana">Your&nbsp;Title&nbsp;Here&nbsp;</td></tr></tbody></table></td></tr></tbody></table></td></tr><tr style="font-size:.1"><td style="padding:8px 0 0;vertical-align:top" align="left"><table style="font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana">T:&nbsp;</td></tr></tbody></table></td><td style="padding:0;vertical-align:top" align="left"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana"><a style="text-decoration:none;color:#e2e4ff!important" id="LPlnk689713" data-auth="NotApplicable" rel="noopener noreferrer" target="_blank" href="tel:+44%20(0)%201234%20123456" data-linkindex="1" data-ogsc="rgb(27, 32, 55)">+44&nbsp;(0)&nbsp;1234&nbsp;123456</a></td></tr></tbody></table></td><td style="padding:0 0 0 4px;vertical-align:top" align="left"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana">(Office)</td></tr></tbody></table></td></tr></tbody></table></td></tr><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana">T:&nbsp;</td></tr></tbody></table></td><td style="padding:0;vertical-align:top" align="left"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana"><a style="text-decoration:none;color:#e2e4ff!important" id="LPlnk689713" data-auth="NotApplicable" rel="noopener noreferrer" target="_blank" href="tel:+44%20(0)%201234%20123456" data-linkindex="2" data-ogsc="rgb(27, 32, 55)">+44&nbsp;(0)&nbsp;1234&nbsp;123456</a></td></tr></tbody></table></td><td style="padding:0 0 0 4px;vertical-align:top" align="left"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana">(Direct)</td></tr></tbody></table></td></tr></tbody></table></td></tr><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana">E:&nbsp;</td></tr></tbody></table></td><td style="padding:0;vertical-align:top" align="left" colspan="2"><table style="white-space:nowrap;color:#e2e4ff!important;font-size:14px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsc="rgb(27, 32, 55)"><tbody><tr style="font-size:14px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana"><a style="text-decoration:none;color:#e2e4ff!important" id="LPlnk689713" href="mailto:your.mailbox@domain.com" data-linkindex="3" data-ogsc="rgb(27, 32, 55)">your.mailbox@domain.com</a></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><table style="background-color:#292929!important;width:100%;font-size:1px;color:inherit" border="0.1" cellspacing="0.1" cellpadding="0" data-ogsb="rgb(255, 255, 255)"><tbody><tr style="font-size:.1"><td style="vertical-align:top" align="left"><table style="width:520px;font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="font-size:.1;line-height:normal" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0 0 12px;vertical-align:top" align="left"><a style="text-decoration:none;color:#db97ff!important" id="LPlnk689713" shash="C+9pkTd/mzAIXytByq4e4GRB11C6ofIylcpeBEu4Lqsu42TeeCUyU6E6XBC9C0ABj2o0Trhj/5kRSaAm5fMjomgxQikol5Wtc2vfA3Crxee8+v5V52TyZKZBCScMgBzYTZpUnylg2QK9UNFEm1ZCqX2wV0+c03sAjYL7d4CpYPo=" originalsrc="https://uk.content.exclaimer.net/?url=https%3A%2F%2Fportal.exclaimer.com%2Fsign-up%2F&amp;tenantid=bm88-84zEem80AAD_wDvFQ&amp;templateid=c59925e64bb1ee11bea06045bdd19417&amp;excomponentid=vyjhIiitwdrcYi3lAsVh3LODfZtQIJsDs9p4X-JoG8A&amp;signature=XK0JUXTVw1Y_BeHWlM_UyrTDeS7iFy2IskjFaC8hFUVBcPoAbEsXuz2DG5-cnXDF__nwt4ahvQczzbA9Qc1l0g9s-wBN6e7BnVRYWwwnNEqL7KM5e6ZyqJp0fi5bmjycgQ1arTcDbgc3jMDedGT5U8d2hoNhse-ekvwvOpH3BUdJNDzW4ASO8XMAbhaUMKCQyhllLcUbUAEzXzYjZY-RZcpbcEA-TDS-Lg8Us5gQn3YJy2Go2W12azWxTkahRNZVyv6x6SnhZmh2KOUnJm4buTUsdQDojGbDg-b8ZmvxiqxrdcbrHi_t3l18IZWbhKXEgs8D091oHVygq7RddAO--Q&amp;v=1" data-auth="Verified" rel="noopener noreferrer" target="_blank" href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuk.content.exclaimer.net%2F%3Furl%3Dhttps%253A%252F%252Fportal.exclaimer.com%252Fsign-up%252F%26tenantid%3Dbm88-84zEem80AAD_wDvFQ%26templateid%3Dc59925e64bb1ee11bea06045bdd19417%26excomponentid%3DvyjhIiitwdrcYi3lAsVh3LODfZtQIJsDs9p4X-JoG8A%26signature%3DXK0JUXTVw1Y_BeHWlM_UyrTDeS7iFy2IskjFaC8hFUVBcPoAbEsXuz2DG5-cnXDF__nwt4ahvQczzbA9Qc1l0g9s-wBN6e7BnVRYWwwnNEqL7KM5e6ZyqJp0fi5bmjycgQ1arTcDbgc3jMDedGT5U8d2hoNhse-ekvwvOpH3BUdJNDzW4ASO8XMAbhaUMKCQyhllLcUbUAEzXzYjZY-RZcpbcEA-TDS-Lg8Us5gQn3YJy2Go2W12azWxTkahRNZVyv6x6SnhZmh2KOUnJm4buTUsdQDojGbDg-b8ZmvxiqxrdcbrHi_t3l18IZWbhKXEgs8D091oHVygq7RddAO--Q%26v%3D1&amp;data=05%7C02%7Cbvalverde%40microsoft.com%7Cf4e76a11ec4640ab136408dcdcdf230e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638628098136309250%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;sdata=zZN3m%2FgupgunCkP0Dw%2BlAsWgE%2F6QTBSmYODCglaus0o%3D&amp;reserved=0" title="Original URL: https://uk.content.exclaimer.net/?url=https%3A%2F%2Fportal.exclaimer.com%2Fsign-up%2F&amp;tenantid=bm88-84zEem80AAD_wDvFQ&amp;templateid=c59925e64bb1ee11bea06045bdd19417&amp;excomponentid=vyjhIiitwdrcYi3lAsVh3LODfZtQIJsDs9p4X-JoG8A&amp;signature=XK0JUXTVw1Y_BeHWlM_UyrTDeS7iFy2IskjFaC8hFUVBcPoAbEsXuz2DG5-cnXDF__nwt4ahvQczzbA9Qc1l0g9s-wBN6e7BnVRYWwwnNEqL7KM5e6ZyqJp0fi5bmjycgQ1arTcDbgc3jMDedGT5U8d2hoNhse-ekvwvOpH3BUdJNDzW4ASO8XMAbhaUMKCQyhllLcUbUAEzXzYjZY-RZcpbcEA-TDS-Lg8Us5gQn3YJy2Go2W12azWxTkahRNZVyv6x6SnhZmh2KOUnJm4buTUsdQDojGbDg-b8ZmvxiqxrdcbrHi_t3l18IZWbhKXEgs8D091oHVygq7RddAO--Q&amp;v=1. Click or tap if you trust this link." data-linkindex="4" data-ogsc=""><img style="width:520px;min-width:520px;max-width:520px;height:147.33px;min-height:147.33px;max-height:147.33px;font-size:12px" data-outlook-trace="F:1|T:2" alt="Start your 14 day trial of Exclaimer" title="Start your 14 day trial of Exclaimer" border="0.1" height="147.33" width="520" originalsrc="cid:b73ed4e6-94ec-45e3-a0e6-faace53d5be2" data-imageerror="AttNotFound" data-imagetype="AttachmentByCid"></a></td></tr></tbody></table></td></tr><tr style="font-size:.1"><td style="padding:12px 0 8px;border-top:solid 1px #e9e9ea;border-right:none;border-bottom:none;border-left:none;vertical-align:top" align="left"><table style="font-size:.1" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:.1"><td style="padding:0;vertical-align:top" align="left"><table style="white-space:normal;color:#999;font-size:8px;font-family:'ABC Marfa','Wix Madefor',Verdana;font-weight:400;font-style:normal;text-align:justify;line-height:9px" border="0.1" cellspacing="0.1" cellpadding="0"><tbody><tr style="font-size:8px"><td style="font-family:'ABC Marfa','Wix Madefor',Verdana">Exclaimer Ltd accepts no liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Registered in England and Wales (number 04938619).<span style="font-family:remialcxesans;font-size:1px;color:#fff;line-height:1px">​<span style="font-family:template-5iWZxbFLEe6-oGBFvdGUFw">​</span><span style="font-family:zone-1">​</span><span style="font-family:zones-AQ">​</span></span><br></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></div></div>