@ni/nimble-components 20.1.19 → 20.1.21

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.
@@ -16288,7 +16288,7 @@
16288
16288
 
16289
16289
  /**
16290
16290
  * Do not edit directly
16291
- * Generated on Thu, 31 Aug 2023 16:45:53 GMT
16291
+ * Generated on Fri, 01 Sep 2023 05:37:36 GMT
16292
16292
  */
16293
16293
 
16294
16294
  const Information100DarkUi = "#a46eff";
@@ -56170,6 +56170,15 @@ img.ProseMirror-separator {
56170
56170
  }
56171
56171
  `;
56172
56172
 
56173
+ /**
56174
+ * TipTap node types.
56175
+ * @public
56176
+ */
56177
+ const TipTapNodeName = {
56178
+ bulletList: 'bulletList',
56179
+ numberedList: 'orderedList'
56180
+ };
56181
+
56173
56182
  /**
56174
56183
  * A nimble styled rich text editor
56175
56184
  */
@@ -56286,6 +56295,7 @@ img.ProseMirror-separator {
56286
56295
  */
56287
56296
  boldButtonClick() {
56288
56297
  this.tiptapEditor.chain().focus().toggleBold().run();
56298
+ this.forceFocusEditor();
56289
56299
  }
56290
56300
  /**
56291
56301
  * Toggle the bold mark and focus back to the editor
@@ -56294,6 +56304,7 @@ img.ProseMirror-separator {
56294
56304
  boldButtonKeyDown(event) {
56295
56305
  if (this.keyActivatesButton(event)) {
56296
56306
  this.tiptapEditor.chain().focus().toggleBold().run();
56307
+ this.forceFocusEditor();
56297
56308
  return false;
56298
56309
  }
56299
56310
  return true;
@@ -56304,6 +56315,7 @@ img.ProseMirror-separator {
56304
56315
  */
56305
56316
  italicsButtonClick() {
56306
56317
  this.tiptapEditor.chain().focus().toggleItalic().run();
56318
+ this.forceFocusEditor();
56307
56319
  }
56308
56320
  /**
56309
56321
  * Toggle the italics mark and focus back to the editor
@@ -56312,6 +56324,7 @@ img.ProseMirror-separator {
56312
56324
  italicsButtonKeyDown(event) {
56313
56325
  if (this.keyActivatesButton(event)) {
56314
56326
  this.tiptapEditor.chain().focus().toggleItalic().run();
56327
+ this.forceFocusEditor();
56315
56328
  return false;
56316
56329
  }
56317
56330
  return true;
@@ -56322,6 +56335,7 @@ img.ProseMirror-separator {
56322
56335
  */
56323
56336
  bulletListButtonClick() {
56324
56337
  this.tiptapEditor.chain().focus().toggleBulletList().run();
56338
+ this.forceFocusEditor();
56325
56339
  }
56326
56340
  /**
56327
56341
  * Toggle the unordered list node and focus back to the editor
@@ -56330,6 +56344,7 @@ img.ProseMirror-separator {
56330
56344
  bulletListButtonKeyDown(event) {
56331
56345
  if (this.keyActivatesButton(event)) {
56332
56346
  this.tiptapEditor.chain().focus().toggleBulletList().run();
56347
+ this.forceFocusEditor();
56333
56348
  return false;
56334
56349
  }
56335
56350
  return true;
@@ -56340,6 +56355,7 @@ img.ProseMirror-separator {
56340
56355
  */
56341
56356
  numberedListButtonClick() {
56342
56357
  this.tiptapEditor.chain().focus().toggleOrderedList().run();
56358
+ this.forceFocusEditor();
56343
56359
  }
56344
56360
  /**
56345
56361
  * Toggle the ordered list node and focus back to the editor
@@ -56348,6 +56364,7 @@ img.ProseMirror-separator {
56348
56364
  numberedListButtonKeyDown(event) {
56349
56365
  if (this.keyActivatesButton(event)) {
56350
56366
  this.tiptapEditor.chain().focus().toggleOrderedList().run();
56367
+ this.forceFocusEditor();
56351
56368
  return false;
56352
56369
  }
56353
56370
  return true;
@@ -56490,10 +56507,14 @@ img.ProseMirror-separator {
56490
56507
  this.tiptapEditor.off('transaction');
56491
56508
  }
56492
56509
  updateEditorButtonsState() {
56510
+ const { extensionManager, state } = this.tiptapEditor;
56511
+ const { extensions } = extensionManager;
56512
+ const { selection } = state;
56513
+ const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
56493
56514
  this.boldButton.checked = this.tiptapEditor.isActive('bold');
56494
56515
  this.italicsButton.checked = this.tiptapEditor.isActive('italic');
56495
- this.bulletListButton.checked = this.tiptapEditor.isActive('bulletList');
56496
- this.numberedListButton.checked = this.tiptapEditor.isActive('orderedList');
56516
+ this.bulletListButton.checked = parentList?.node.type.name === TipTapNodeName.bulletList;
56517
+ this.numberedListButton.checked = parentList?.node.type.name === TipTapNodeName.numberedList;
56497
56518
  }
56498
56519
  keyActivatesButton(event) {
56499
56520
  switch (event.key) {
@@ -56553,7 +56574,7 @@ img.ProseMirror-separator {
56553
56574
  - this.tiptapEditor.view.dom.clientWidth;
56554
56575
  }
56555
56576
  getTipTapExtension(extensionName) {
56556
- return this.tiptapEditor.extensionManager.extensions.find(extension => extension.name === extensionName);
56577
+ return this.tiptapEditor.extensionManager.extensions.find((extension) => extension.name === extensionName);
56557
56578
  }
56558
56579
  setEditorTabIndex() {
56559
56580
  this.tiptapEditor.setOptions({
@@ -56564,6 +56585,14 @@ img.ProseMirror-separator {
56564
56585
  }
56565
56586
  });
56566
56587
  }
56588
+ // In Firefox browser, once the editor gets focused, the blinking caret will be visible until we click format buttons (Bold, Italic ...) in the Firefox browser (changing focus).
56589
+ // But once any of the toolbar button is clicked, editor internally has its focus but the blinking caret disappears.
56590
+ // As a workaround, manually triggering blur and setting focus on editor makes the blinking caret to re-appear.
56591
+ // Mozilla issue https://bugzilla.mozilla.org/show_bug.cgi?id=1496769 tracks removal of this workaround.
56592
+ forceFocusEditor() {
56593
+ this.tiptapEditor.commands.blur();
56594
+ this.tiptapEditor.commands.focus();
56595
+ }
56567
56596
  }
56568
56597
  __decorate$1([
56569
56598
  attr({ mode: 'boolean' })