@ni/nimble-components 20.17.1 → 20.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16301,7 +16301,7 @@
16301
16301
 
16302
16302
  /**
16303
16303
  * Do not edit directly
16304
- * Generated on Fri, 05 Jan 2024 00:21:59 GMT
16304
+ * Generated on Fri, 05 Jan 2024 14:36:09 GMT
16305
16305
  */
16306
16306
 
16307
16307
  const Information100DarkUi = "#a46eff";
@@ -56623,8 +56623,10 @@ img.ProseMirror-separator {
56623
56623
  * @internal
56624
56624
  */
56625
56625
  configurationChanged(prev, next) {
56626
+ const formatButtonsState = this.getButtonsState(this.tiptapEditor);
56627
+ const { from, to } = this.tiptapEditor.view.state.selection;
56626
56628
  if (this.isMentionExtensionConfigUnchanged(prev, next)) {
56627
- this.refreshMarkdownContent();
56629
+ this.setMarkdown(this.getMarkdown());
56628
56630
  }
56629
56631
  else {
56630
56632
  const mentionExtensionConfig = this.getMentionExtensionConfig();
@@ -56633,6 +56635,8 @@ img.ProseMirror-separator {
56633
56635
  this.initializeEditor();
56634
56636
  this.setMarkdown(currentStateMarkdown);
56635
56637
  }
56638
+ this.tiptapEditor.commands.setTextSelection({ from, to });
56639
+ this.resetEditorButtonsState(formatButtonsState);
56636
56640
  this.setActiveMappingConfigs();
56637
56641
  }
56638
56642
  /**
@@ -56978,11 +56982,22 @@ img.ProseMirror-separator {
56978
56982
  getMentionExtensionConfigFromCharacter(character) {
56979
56983
  return this.getMentionExtensionConfig().find(config => config.character === character);
56980
56984
  }
56981
- // This method restore the cursor selection after setting the editor content when the editor is focused
56982
- refreshMarkdownContent() {
56983
- const { from, to } = this.tiptapEditor.view.state.selection;
56984
- this.setMarkdown(this.getMarkdown());
56985
- this.tiptapEditor.commands.setTextSelection({ from, to });
56985
+ resetEditorButtonsState(buttonsState) {
56986
+ if (buttonsState?.bold && !this.tiptapEditor.isActive('bold')) {
56987
+ this.tiptapEditor.chain().focus().toggleBold().run();
56988
+ }
56989
+ if (buttonsState?.italics && !this.tiptapEditor.isActive('italic')) {
56990
+ this.tiptapEditor.chain().focus().toggleItalic().run();
56991
+ }
56992
+ }
56993
+ getButtonsState(tiptapEditor) {
56994
+ if (!this.$fastController.isConnected) {
56995
+ return undefined;
56996
+ }
56997
+ return {
56998
+ bold: tiptapEditor.isActive('bold'),
56999
+ italics: tiptapEditor.isActive('italic')
57000
+ };
56986
57001
  }
56987
57002
  }
56988
57003
  __decorate$1([