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 0c59d90 commit a98cea8
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 a98cea8

Please sign in to comment.