Skip to content

Commit

Permalink
Support for vertical cell writing
Browse files Browse the repository at this point in the history
  • Loading branch information
ivailop7 committed Aug 24, 2024
1 parent 028817c commit befd737
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,19 @@ function TableActionMenu({
if ($isRangeSelection(selection) || $isTableSelection(selection)) {
const [cell] = $getNodeTriplet(selection.anchor);
const currentTextDirection = cell.getWritingMode();
cell.setWritingMode(!currentTextDirection ? 'vertical-lr' : null);
const newTextDirection = !currentTextDirection ? 'vertical-lr' : null;
cell.setWritingMode(newTextDirection);

if ($isTableSelection(selection)) {
const nodes = selection.getNodes();

for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if ($isTableCellNode(node)) {
node.setWritingMode(newTextDirection);
}
}
}
}
});
}, [editor]);
Expand Down

0 comments on commit befd737

Please sign in to comment.