Skip to content

Commit

Permalink
Fix bug that value is reverted after moving cell in tables field on Edge
Browse files Browse the repository at this point in the history
  • Loading branch information
masiuchi committed Sep 9, 2024
1 parent 1bc4231 commit 2571fe5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,13 @@ export default class aTable extends aTemplate {
range.setEndBefore(elem.lastChild.lastChild);
} else if (aTable.getBrowser() === 'edge'
&& elem.hasChildNodes() && elem.lastChild.tagName === 'DIV'
&& elem.lastChild.hasChildNodes() && elem.lastChild.lastChild.tagName === 'BR')
&& elem.lastChild.hasChildNodes())
{
range.setEndBefore(elem.lastChild.lastChild);
if (elem.lastChild.lastChild.tagName === 'BR') {
range.setEndBefore(elem.lastChild.lastChild);
} else {
range.setEndAfter(elem.lastChild.lastChild);
}
} else {
range.selectNodeContents(elem);
}
Expand Down Expand Up @@ -843,7 +847,9 @@ export default class aTable extends aTemplate {
if (this.afterEntered) {
this.afterEntered();
}
} else if (type === 'keyup' && aTable.getBrowser().indexOf('ie') !== -1) {
} else if (type === 'keyup'
&& (aTable.getBrowser().indexOf('ie') !== -1 || aTable.getBrowser() === 'edge'))
{
if (util.hasClass(this.e.target, 'a-table-editable') && this.e.target.parentNode.getAttribute('data-cell-id') === `${b}-${a}`) {
data.history.push(clone(data.row));
data.row[a].col[b].value = this.e.target.innerHTML.replace(/{(.*?)}/g, '{$1}');
Expand Down

0 comments on commit 2571fe5

Please sign in to comment.