Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions addons/html_editor/static/src/main/table/table_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,14 +581,18 @@ export class TablePlugin extends Plugin {
// To solve the issue we merge the ranges of the selection together the first time we find
// selection.rangeCount > 1. Morover, when hitting a double click on a cell, it spans a row
// inside selection which needs to be simplified here.
const [anchorNode, anchorOffset] = getDeepestPosition(
let [anchorNode, anchorOffset] = getDeepestPosition(
selection.getRangeAt(0).startContainer,
selection.getRangeAt(0).startOffset
);
const [focusNode, focusOffset] = getDeepestPosition(
let [focusNode, focusOffset] = getDeepestPosition(
selection.getRangeAt(selection.rangeCount - 1).startContainer,
selection.getRangeAt(selection.rangeCount - 1).startOffset
);
if (this.selectionDirection === "backward") {
[anchorNode, focusNode] = [focusNode, anchorNode];
[anchorOffset, focusOffset] = [focusOffset, anchorOffset];
}
this.dependencies.selection.setSelection({
anchorNode,
anchorOffset,
Expand All @@ -611,6 +615,7 @@ export class TablePlugin extends Plugin {
focusNode: ev.target,
focusOffset: 0,
});
this.selectionDirection = selection.direction;
return true;
}
}
Expand Down