Skip to content

Commit

Permalink
fix(database): replace selected text content when pasting (toeverythi…
Browse files Browse the repository at this point in the history
  • Loading branch information
zqran authored Sep 19, 2023
1 parent 7610509 commit 43249fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,11 @@ export class RichTextCellEditing extends BaseCellRenderer<Y.Text> {
if (yText) {
const text = new Text(yText);
const index = range?.index ?? yText.length;
text.insert(textClipboardData, index);
if (range?.length) {
text.replace(range.index, range.length, textClipboardData);
} else {
text.insert(textClipboardData, index);
}
this.vEditor?.setVRange({
index: index + textClipboardData.length,
length: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,11 @@ export class HeaderAreaTextCellEditing extends BaseTextCell {
if (yText) {
const text = new Text(yText);
const index = range?.index ?? yText.length;
text.insert(textClipboardData, index);
if (range?.length) {
text.replace(range.index, range.length, textClipboardData);
} else {
text.insert(textClipboardData, index);
}
this.vEditor?.setVRange({
index: index + textClipboardData.length,
length: 0,
Expand Down

0 comments on commit 43249fa

Please sign in to comment.