Skip to content

Commit 1247080

Browse files
committed
remove child text node dep
1 parent e8e0ad4 commit 1247080

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

packages/lexical-table/src/LexicalTableCellNode.ts

+2-21
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import type {
1111
DOMConversionOutput,
1212
DOMExportOutput,
1313
EditorConfig,
14-
ElementFormatType,
1514
LexicalEditor,
1615
LexicalNode,
1716
NodeKey,
@@ -27,7 +26,6 @@ import {
2726
$isLineBreakNode,
2827
$isTextNode,
2928
ElementNode,
30-
ParagraphNode,
3129
} from 'lexical';
3230

3331
import {COLUMN_WIDTH, PIXEL_VALUE_REG_EXP} from './constants';
@@ -147,13 +145,9 @@ export class TableCellNode extends ElementNode {
147145
}
148146
if (this.__writingMode) {
149147
element.style.writingMode = this.__writingMode;
150-
element.style.verticalAlign = computeVerticalFormat(
151-
this.getChildFormatType(),
152-
);
153-
element.style.transform = 'rotate(180deg)';
148+
element.style.verticalAlign = computeVerticalFormat(this.getFormatType());
154149
} else {
155150
element.style.verticalAlign = '';
156-
element.style.transform = '';
157151
}
158152

159153
addClassNamesToElement(
@@ -255,14 +249,6 @@ export class TableCellNode extends ElementNode {
255249
return this.getLatest().__width;
256250
}
257251

258-
getChildFormatType(): ElementFormatType {
259-
return this.getFirstChild<ParagraphNode>()!.getFormatType();
260-
}
261-
262-
getChildTextDirection(): 'ltr' | 'rtl' | null {
263-
return this.getFirstChild<ParagraphNode>()!.getDirection();
264-
}
265-
266252
getCellDirection(): 'horizontal' | 'vertical' {
267253
if (this.getLatest().__writingMode) {
268254
return 'vertical';
@@ -273,12 +259,7 @@ export class TableCellNode extends ElementNode {
273259

274260
setCellDirection(direction: 'horizontal' | 'vertical'): void {
275261
if (direction === 'vertical') {
276-
const childTextDirection = this.getChildTextDirection();
277-
if (childTextDirection === 'rtl') {
278-
this.getWritable().__writingMode = 'vertical-rl';
279-
} else {
280-
this.getWritable().__writingMode = 'vertical-lr';
281-
}
262+
this.getWritable().__writingMode = 'vertical-lr';
282263
} else {
283264
this.getWritable().__writingMode = undefined;
284265
}

packages/lexical-table/src/LexicalTableUtils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,11 @@ export function $getTableCellNodeRect(tableCellNode: TableCellNode): {
893893
return null;
894894
}
895895

896-
export const computeVerticalFormat = (format?: ElementFormatType) => {
896+
export const computeVerticalFormat = (format: ElementFormatType) => {
897897
if (format === 'center') {
898898
return 'middle';
899899
} else if (format === 'right' || format === 'end') {
900-
return 'top';
900+
return 'bottom';
901901
}
902-
return 'bottom';
902+
return 'top';
903903
};

0 commit comments

Comments
 (0)