Skip to content

Commit

Permalink
fix: script error occurs in the wysiwyg table (fix #1110) (#1111)
Browse files Browse the repository at this point in the history
* fix: element is empty when selection is finished

* fix: column is not added when cursor is at specific position
  • Loading branch information
seonim-ryu authored Jul 20, 2020
1 parent b6b3215 commit 6be680c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions apps/editor/src/js/wwTableSelectionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ class WwTableSelectionManager {
window.getSelection().removeAllRanges();
}, 10);
}
this.highlightTableCellsBy(selectionStart, selectionEnd);
validSelectionEnd = selectionEnd;

if (selectionStart && selectionEnd) {
this.highlightTableCellsBy(selectionStart, selectionEnd);
validSelectionEnd = selectionEnd;
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion apps/editor/src/js/wysiwygCommands/tableAddCol.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function getCellByRange(range) {
let cell = range.startContainer;

if (domUtils.getNodeName(cell) !== 'TD' && domUtils.getNodeName(cell) !== 'TH') {
cell = domUtils.parentsUntil(cell, 'tr');
cell = domUtils.closest(cell, 'td, th');
}

return cell;
Expand Down

0 comments on commit 6be680c

Please sign in to comment.