Skip to content

Commit

Permalink
Bump roosterjs-content-model-core to 0.21.3 to integrate #2259 (#2265)
Browse files Browse the repository at this point in the history
* Content Model: Do not set focus to editor when format if editor did not have focus before format (#2259)

* Content Model: Do not set focus to editor when format if editor did not have focus before

* fix test

* Bump content model core to 0.21.3
  • Loading branch information
JiuqingSong authored Dec 12, 2023
1 parent 4b35c78 commit ea267e5
Show file tree
Hide file tree
Showing 3 changed files with 467 additions and 417 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@ export const formatContentModel: FormatContentModel = (core, formatter, options)
rawEvent,
newImages: [],
};
const hasFocus = core.api.hasFocus(core);
let selection: DOMSelection | undefined;

if (formatter(model, context)) {
const writeBack = () => {
handleImages(core, context);

selection =
core.api.setContentModel(core, model, undefined /*options*/, onNodeCreated) ||
undefined;
core.api.setContentModel(
core,
model,
hasFocus ? undefined : { ignoreSelection: true }, // If editor did not have focus before format, do not set focus after format
onNodeCreated
) || undefined;

handlePendingFormat(core, context, selection);
};
Expand Down
Loading

0 comments on commit ea267e5

Please sign in to comment.