Skip to content

Commit

Permalink
fix: title cell drag
Browse files Browse the repository at this point in the history
  • Loading branch information
golok727 committed Apr 26, 2024
1 parent ee2f2a8 commit 0e012d8
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ShadowlessElement } from '@blocksuite/block-std';
import { assertEquals, assertExists } from '@blocksuite/global/utils';
import { DocCollection, type Text } from '@blocksuite/store';
import { DocCollection, Text, type Y } from '@blocksuite/store';
import type { ReactiveController } from 'lit';
import { css, html } from 'lit';
import { customElement } from 'lit/decorators.js';
Expand Down Expand Up @@ -771,18 +771,21 @@ function fillSelectionWithFocusCellData(
if (tRichText.is(focusCell.column.dataType)) {
const focusCellText = focusData as Text;
const delta = focusCellText.toDelta();
const curCellText = cellContainer.column.getValue(curRowId) as Text;
const curCellText = cellContainer.column.getValue(curRowId);

if (curCellText) {
curCellText.clear();
curCellText.applyDelta(delta);
const text =
focusCell.column.type === 'title'
? new Text(curCellText as Y.Text)
: (curCellText as Text);

text.clear();
text.applyDelta(delta);
} else {
const newText = new DocCollection.Y.Text();
newText.applyDelta(delta);
cellContainer.column.setValue(curRowId, newText);
}

continue;
} else {
cellContainer.column.setValue(curRowId, focusData);
}
Expand Down

0 comments on commit 0e012d8

Please sign in to comment.