fit-ui 2.11.0 → 2.11.1

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.
package/dist/Fit.UI.js CHANGED
@@ -682,7 +682,7 @@ Fit._internal =
682
682
  {
683
683
  Core:
684
684
  {
685
- VersionInfo: { Major: 2, Minor: 11, Patch: 0 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
685
+ VersionInfo: { Major: 2, Minor: 11, Patch: 1 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
686
686
  }
687
687
  };
688
688
 
@@ -22809,12 +22809,25 @@ Fit.Controls.Input = function(ctlId)
22809
22809
  }
22810
22810
  }
22811
22811
 
22812
+ // Guard against disposed control in case Focused(false) was called and an OnBlur handler disposed the control.
22813
+ // As the code further up shows, we call me._internal.FireOnBlur() if a dialog is currently open. This results
22814
+ // in OnBlur firing immediately, while normally it happens asynchronously due to how OnFocus and OnBlur is handled
22815
+ // in ControlBase, in which case we do not need to worry that the control might be disposed. It happens "later".
22816
+ // The situation can easily arise if an OnScroll handler is reponsible for removing focus from a control,
22817
+ // and if that control also has an OnBlur handler registered which disposes the control. Scrolling with a
22818
+ // dialog open will then trigger the situation which we guard against here.
22819
+ if (me === null)
22820
+ {
22821
+ return false;
22822
+ }
22823
+
22812
22824
  if (me.DesignMode() === true)
22813
22825
  {
22814
22826
  // If a dialog is open and it belongs to this control instance, and focus is found within dialog, then control is considered having focus.
22815
22827
  // However, if <body> is focused while dialog is open, control is also considered to have focus, since dialog temporarily assigns focus to
22816
22828
  // <body> when tabbing between elements within the dialog. This seems safe as no other control can be considered focused if <body> has focus.
22817
- if (Fit._internal.Controls.Input.ActiveEditorForDialog === me && (Fit.Dom.Contained(Fit._internal.Controls.Input.ActiveDialogForEditor.getElement().$, Fit.Dom.GetFocused()) === true || Fit.Dom.GetFocused() === document.body))
22829
+ // We also consider the control focused if an associated dialog (modal) is currently loading (Fit._internal.Controls.Input.ActiveDialogForEditor is null).
22830
+ if (Fit._internal.Controls.Input.ActiveEditorForDialog === me && (Fit._internal.Controls.Input.ActiveDialogForEditor === null || Fit.Dom.Contained(Fit._internal.Controls.Input.ActiveDialogForEditor.getElement().$, Fit.Dom.GetFocused()) === true || Fit.Dom.GetFocused() === document.body))
22818
22831
  return true;
22819
22832
 
22820
22833
  // If a toolbar dialog/callout is open and contains the element currently having focus, then control is considered having focus.
@@ -24455,7 +24468,7 @@ Fit.Controls.Input = function(ctlId)
24455
24468
  {
24456
24469
  // Still not rooted - add observer to create editor instance once control is rooted
24457
24470
 
24458
- rootedEventId = Fit.Events.AddHandler(me.GetDomElement(), "#rooted", function(e)
24471
+ rootedEventId = Fit.Events.AddHandler(me.GetDomElement(), "#rooted", function(e) // NOTICE: Also set in updateDesignEditorSize()
24459
24472
  {
24460
24473
  if (retry() === true || me.DesignMode() === false)
24461
24474
  {
@@ -25495,7 +25508,7 @@ Fit.Controls.Input = function(ctlId)
25495
25508
  // This is a problem because CKEditor uses setTimeout(..) to for instance
25496
25509
  // allow early registration of events, and because resources are loaded
25497
25510
  // in an async. manner.
25498
- designEditorUpdateSizeDebouncer = setTimeout(function()
25511
+ designEditorUpdateSizeDebouncer = setTimeout(function() // Timer is stopped if control is disposed
25499
25512
  {
25500
25513
  designEditorUpdateSizeDebouncer = -1;
25501
25514
  updateDesignEditorSize();
@@ -25504,6 +25517,30 @@ Fit.Controls.Input = function(ctlId)
25504
25517
  return;
25505
25518
  }
25506
25519
 
25520
+ if (Fit.Dom.IsRooted(me.GetDomElement()) === false) // CKEditor has been created and is ready but control has been removed from DOM
25521
+ {
25522
+ // CKEditor throws an error if dimensions are changed when not rooted in DOM. Control might
25523
+ // be added/removed dynamically as needed in the user interface, so we need to support this.
25524
+
25525
+ if (rootedEventId === -1)
25526
+ {
25527
+ rootedEventId = Fit.Events.AddHandler(me.GetDomElement(), "#rooted", function(e) // NOTICE: Also set in createEditor()
25528
+ {
25529
+ Fit.Events.RemoveHandler(me.GetDomElement(), rootedEventId);
25530
+ rootedEventId = -1;
25531
+
25532
+ // Control has been rooted in DOM again - call updateDesignEditorSize() again if DesignMode is still enabled
25533
+
25534
+ if (me.DesignMode() === true)
25535
+ {
25536
+ updateDesignEditorSize();
25537
+ }
25538
+ });
25539
+ }
25540
+
25541
+ return;
25542
+ }
25543
+
25507
25544
  //var w = me.Width();
25508
25545
  var h = me.Height();
25509
25546