Skip to content

Commit 912c374

Browse files
authored
fix: setting cell width causes left border to be lost (#273)
* fix: setting cell width causes left border to be lost * Create lovely-ears-heal.md
1 parent fd75136 commit 912c374

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.changeset/lovely-ears-heal.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@wangeditor-next/table-module": patch
3+
---
4+
5+
fix: setting cell width causes border to be lost

packages/table-module/src/module/parse-style-html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function parseStyleHtml(elem: DOMElement, node: Descendant, _editor: IDom
4242
}
4343
borderStyle = getStyleValue($elem, 'border-style') || borderStyle // border 样式
4444
if (borderStyle) {
45-
tableNode.borderStyle = borderStyle
45+
tableNode.borderStyle = borderStyle === 'none' ? '' : borderStyle
4646
}
4747
borderColor = getStyleValue($elem, 'border-color') || borderColor // border 颜色
4848
if (borderColor) {

packages/table-module/src/module/render-style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function renderStyle(node: Descendant, vnode: VNode): VNode {
2121

2222
if (backgroundColor) { props.backgroundColor = backgroundColor }
2323
if (borderWidth) { props.borderWidth = `${borderWidth}px` }
24-
if (borderStyle) { props.borderStyle = borderStyle }
24+
if (borderStyle) { props.borderStyle = borderStyle === 'none' ? '' : borderStyle }
2525
if (borderColor) { props.borderColor = borderColor }
2626
if (textAlign) { props.textAlign = textAlign }
2727

packages/table-module/src/module/style-to-html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function styleToHtml(node, elemHtml) {
1919

2020
if (backgroundColor) { $elem.css('background-color', backgroundColor) }
2121
if (borderWidth) { $elem.css('border-width', `${borderWidth}px`) }
22-
if (borderStyle) { $elem.css('border-style', borderStyle) }
22+
if (borderStyle) { $elem.css('border-style', borderStyle === 'none' ? '' : borderStyle) }
2323
if (borderColor) { $elem.css('border-color', borderColor) }
2424
if (textAlign) { $elem.css('text-align', textAlign) }
2525

0 commit comments

Comments
 (0)