Skip to content

Commit a98cea8

Browse files
committed
Support for vertical cell writing
1 parent 0c59d90 commit a98cea8

File tree

1 file changed

+13
-1
lines changed
  • packages/lexical-playground/src/plugins/TableActionMenuPlugin

1 file changed

+13
-1
lines changed

packages/lexical-playground/src/plugins/TableActionMenuPlugin/index.tsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,19 @@ function TableActionMenu({
495495
if ($isRangeSelection(selection) || $isTableSelection(selection)) {
496496
const [cell] = $getNodeTriplet(selection.anchor);
497497
const currentTextDirection = cell.getWritingMode();
498-
cell.setWritingMode(!currentTextDirection ? 'vertical-lr' : null);
498+
const newTextDirection = !currentTextDirection ? 'vertical-lr' : null;
499+
cell.setWritingMode(newTextDirection);
500+
501+
if ($isTableSelection(selection)) {
502+
const nodes = selection.getNodes();
503+
504+
for (let i = 0; i < nodes.length; i++) {
505+
const node = nodes[i];
506+
if ($isTableCellNode(node)) {
507+
node.setWritingMode(newTextDirection);
508+
}
509+
}
510+
}
499511
}
500512
});
501513
}, [editor]);

0 commit comments

Comments
 (0)