Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jocs committed Jul 5, 2024
1 parent f2fdc83 commit 56cb803
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ describe('test TextX static methods invert and makeInvertible', () => {
bl: BooleanNumber.TRUE,
},
}],
customRanges: [],
customDecorations: [],
},
coverType: UpdateDocsAttributeType.COVER,
Expand Down
10 changes: 3 additions & 7 deletions packages/docs/src/commands/commands/core-editing.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const EditorInsertTextCommandId = 'doc.command.insert-text';
export const InsertCommand: ICommand<IInsertCommandParams> = {
id: EditorInsertTextCommandId,
type: CommandType.COMMAND,
// eslint-disable-next-line max-lines-per-function

handler: async (accessor, params: IInsertCommandParams) => {
const commandService = accessor.get(ICommandService);
const univerInstanceService = accessor.get(IUniverInstanceService);
Expand All @@ -63,11 +63,7 @@ export const InsertCommand: ICommand<IInsertCommandParams> = {
const textSelectionManagerService = accessor.get(TextSelectionManagerService);
const activeRange = textSelectionManagerService.getActiveRange();

if (activeRange == null) {
return false;
}

const originBody = docDataModel.getSelfOrHeaderFooterModel(activeRange.segmentId).getBody();
const originBody = docDataModel.getSelfOrHeaderFooterModel(activeRange?.segmentId ?? '').getBody();

if (!originBody) {
return false;
Expand All @@ -78,7 +74,7 @@ export const InsertCommand: ICommand<IInsertCommandParams> = {
{
startOffset: startOffset + body.dataStream.length,
endOffset: startOffset + body.dataStream.length,
style: activeRange.style,
style: activeRange?.style,
collapsed,
},
];
Expand Down

0 comments on commit 56cb803

Please sign in to comment.