fit-ui 3.4.2 → 3.4.3
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 +132 -85
- package/dist/Fit.UI.min.js +1 -1
- package/package.json +1 -1
package/dist/Fit.UI.js
CHANGED
|
@@ -682,7 +682,7 @@ Fit._internal =
|
|
|
682
682
|
{
|
|
683
683
|
Core:
|
|
684
684
|
{
|
|
685
|
-
VersionInfo: { Major: 3, Minor: 4, Patch:
|
|
685
|
+
VersionInfo: { Major: 3, Minor: 4, Patch: 3 } // 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
|
|
|
@@ -26930,76 +26930,47 @@ Fit.Controls.Input = function(ctlId)
|
|
|
26930
26930
|
}
|
|
26931
26931
|
}
|
|
26932
26932
|
|
|
26933
|
-
// Register necessary events with
|
|
26934
|
-
|
|
26935
|
-
var emojiButton = designEditor.container.$.querySelector("a.cke_button__emojipanel");
|
|
26933
|
+
// Register necessary events with color panel when opened
|
|
26936
26934
|
|
|
26937
|
-
|
|
26935
|
+
Fit.Array.ForEach(designEditor.container.$.querySelectorAll("a.cke_button__textcolor, a.cke_button__bgcolor"), function(button)
|
|
26938
26936
|
{
|
|
26939
|
-
|
|
26937
|
+
lockDesignEditorDialogButtonToFocusState(button, function() // Callback invoked to get panel associated with button
|
|
26940
26938
|
{
|
|
26941
|
-
|
|
26942
|
-
|
|
26943
|
-
if (me.Focused() === false)
|
|
26944
|
-
{
|
|
26945
|
-
// Control not focused - make sure OnFocus fires when emoji button is clicked,
|
|
26946
|
-
// and make sure ControlBase internally considers itself focused, so there is
|
|
26947
|
-
// no risk of OnFocus being fired twice without OnBlur firing in between,
|
|
26948
|
-
// when focus state is unlocked, and focus is perhaps re-assigned to another
|
|
26949
|
-
// DOM element within the control, which will be the case if the design editor
|
|
26950
|
-
// is switched back to an ordinary input field (e.g. using DesignMode(false)).
|
|
26951
|
-
me.Focused(true);
|
|
26952
|
-
}
|
|
26953
|
-
|
|
26954
|
-
// Prevent control from firing OnBlur when emoji dialog is opened.
|
|
26955
|
-
// Notice that locking the focus state will also prevent OnFocus
|
|
26956
|
-
// from being fired automatically.
|
|
26957
|
-
me._internal.FocusStateLocked(true);
|
|
26939
|
+
var panel = null;
|
|
26958
26940
|
|
|
26959
|
-
|
|
26941
|
+
// Color panel has no color plugin identifier, so we need to inspect all panel iframes to look for a plugin identifier inside
|
|
26942
|
+
Fit.Array.ForEach(document.querySelectorAll("div.cke_panel > iframe"), function(iframe)
|
|
26960
26943
|
{
|
|
26961
|
-
//
|
|
26962
|
-
// when interacting with emoji widget hosted outside of panels/callouts,
|
|
26963
|
-
// by detecting the presence of a data-disable-light-dismiss="true" attribute.
|
|
26964
|
-
var emojiPanel = document.querySelector("div.cke_emoji-panel"); // Shared among instances
|
|
26965
|
-
|
|
26966
|
-
if (emojiPanel !== null) // Better safe than sorry
|
|
26944
|
+
if (iframe.contentDocument !== null) // Null if hosted on foreign domain
|
|
26967
26945
|
{
|
|
26968
|
-
|
|
26969
|
-
|
|
26970
|
-
emojiPanel._associatedFitUiControl = me;
|
|
26946
|
+
var colorBlock = iframe.contentDocument.querySelector("div.cke_colorblock");
|
|
26971
26947
|
|
|
26972
|
-
|
|
26948
|
+
if (colorBlock !== null)
|
|
26973
26949
|
{
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
|
|
26977
|
-
|
|
26978
|
-
{
|
|
26979
|
-
designEditorActiveToolbarPanel = null;
|
|
26980
|
-
|
|
26981
|
-
// Disable focus lock - let ControlBase handle OnFocus and OnBlur automatically again
|
|
26982
|
-
me._internal.FocusStateLocked(false);
|
|
26983
|
-
|
|
26984
|
-
// Fire OnBlur in case user changed focus while emoji panel was open.
|
|
26985
|
-
// OnBlur does not fire automatically when focus state is locked.
|
|
26986
|
-
if (me.Focused() === false)
|
|
26987
|
-
{
|
|
26988
|
-
me._internal.FireOnBlur();
|
|
26989
|
-
}
|
|
26990
|
-
}
|
|
26991
|
-
},
|
|
26992
|
-
CloseEmojiPanel: function()
|
|
26993
|
-
{
|
|
26994
|
-
if (emojiPanel._associatedFitUiControl === me && Fit.Dom.IsVisible(emojiPanel) === true && Fit.Dom.Contained(emojiPanel, Fit.Dom.GetFocused()) === true)
|
|
26995
|
-
{
|
|
26996
|
-
designEditor.focus();
|
|
26997
|
-
designEditorActiveToolbarPanel.UnlockFocusStateIfEmojiPanelIsClosed();
|
|
26998
|
-
}
|
|
26999
|
-
}
|
|
26950
|
+
// Color panel found. Panel is shared between instances and used for both the
|
|
26951
|
+
// text color and back color. We know parentElement exists because of the query selector.
|
|
26952
|
+
panel = iframe.parentElement;
|
|
26953
|
+
return false; // Break loop
|
|
27000
26954
|
}
|
|
27001
26955
|
}
|
|
26956
|
+
});
|
|
26957
|
+
|
|
26958
|
+
return panel;
|
|
26959
|
+
});
|
|
26960
|
+
});
|
|
26961
|
+
|
|
26962
|
+
// Register necessary events with emoji panel when opened
|
|
26963
|
+
|
|
26964
|
+
var emojiButton = designEditor.container.$.querySelector("a.cke_button__emojipanel");
|
|
27002
26965
|
|
|
26966
|
+
if (emojiButton !== null) // Button might not be enabled
|
|
26967
|
+
{
|
|
26968
|
+
lockDesignEditorDialogButtonToFocusState(emojiButton, function() // Callback invoked to get panel associated with button
|
|
26969
|
+
{
|
|
26970
|
+
var emojiPanel = document.querySelector("div.cke_emoji-panel"); // Shared among instances
|
|
26971
|
+
|
|
26972
|
+
if (emojiPanel !== null) // Better safe than sorry
|
|
26973
|
+
{
|
|
27003
26974
|
// Hide status bar in emoji dialog
|
|
27004
26975
|
var emojiFrame = emojiPanel.querySelector("iframe");
|
|
27005
26976
|
var emojiContent = emojiFrame && emojiFrame.contentDocument;
|
|
@@ -27007,31 +26978,9 @@ Fit.Controls.Input = function(ctlId)
|
|
|
27007
26978
|
var emojiContentStatus = emojiContent && emojiContent.querySelector(".cke_emoji-status_bar");
|
|
27008
26979
|
emojiContentBlock && (emojiContentBlock.style.height = "220px");
|
|
27009
26980
|
emojiContentStatus && (emojiContentStatus.style.display = "none");
|
|
26981
|
+
}
|
|
27010
26982
|
|
|
27011
|
-
|
|
27012
|
-
{
|
|
27013
|
-
// Invoke cleanup function regularly to make sure
|
|
27014
|
-
// focus lock is relased when emoji panel is closed,
|
|
27015
|
-
// and to fire OnBlur if another control was focused
|
|
27016
|
-
// while emoji panel was open.
|
|
27017
|
-
|
|
27018
|
-
if (me === null)
|
|
27019
|
-
{
|
|
27020
|
-
clearInterval(checkClosedId);
|
|
27021
|
-
return;
|
|
27022
|
-
}
|
|
27023
|
-
|
|
27024
|
-
if (designEditorActiveToolbarPanel !== null)
|
|
27025
|
-
{
|
|
27026
|
-
designEditorActiveToolbarPanel.UnlockFocusStateIfEmojiPanelIsClosed(); // Nullfies designEditorActiveToolbarPanel if emoji panel is closed
|
|
27027
|
-
}
|
|
27028
|
-
|
|
27029
|
-
if (designEditorActiveToolbarPanel === null)
|
|
27030
|
-
{
|
|
27031
|
-
clearInterval(checkClosedId);
|
|
27032
|
-
}
|
|
27033
|
-
}, 250);
|
|
27034
|
-
}, 0);
|
|
26983
|
+
return emojiPanel;
|
|
27035
26984
|
});
|
|
27036
26985
|
}
|
|
27037
26986
|
|
|
@@ -27500,7 +27449,105 @@ Fit.Controls.Input = function(ctlId)
|
|
|
27500
27449
|
|
|
27501
27450
|
designEditorRestoreButtonState = null;
|
|
27502
27451
|
}
|
|
27503
|
-
}
|
|
27452
|
+
}
|
|
27453
|
+
|
|
27454
|
+
function lockDesignEditorDialogButtonToFocusState(button, getPanelCallback)
|
|
27455
|
+
{
|
|
27456
|
+
Fit.Validation.ExpectElement(button);
|
|
27457
|
+
Fit.Validation.ExpectFunction(getPanelCallback);
|
|
27458
|
+
|
|
27459
|
+
Fit.Events.AddHandler(button, "click", function(e)
|
|
27460
|
+
{
|
|
27461
|
+
// Make sure OnFocus fires before locking focus state
|
|
27462
|
+
|
|
27463
|
+
if (me.Focused() === false)
|
|
27464
|
+
{
|
|
27465
|
+
// Control not focused - make sure OnFocus fires when emoji button is clicked,
|
|
27466
|
+
// and make sure ControlBase internally considers itself focused, so there is
|
|
27467
|
+
// no risk of OnFocus being fired twice without OnBlur firing in between,
|
|
27468
|
+
// when focus state is unlocked, and focus is perhaps re-assigned to another
|
|
27469
|
+
// DOM element within the control, which will be the case if the design editor
|
|
27470
|
+
// is switched back to an ordinary input field (e.g. using DesignMode(false)).
|
|
27471
|
+
me.Focused(true);
|
|
27472
|
+
}
|
|
27473
|
+
|
|
27474
|
+
// Prevent control from firing OnBlur when emoji dialog is opened.
|
|
27475
|
+
// Notice that locking the focus state will also prevent OnFocus
|
|
27476
|
+
// from being fired automatically.
|
|
27477
|
+
me._internal.FocusStateLocked(true);
|
|
27478
|
+
|
|
27479
|
+
setTimeout(function() // Postpone - wait for dialog to be mounted in DOM
|
|
27480
|
+
{
|
|
27481
|
+
var panel = getPanelCallback(); // Panel is shared among instances
|
|
27482
|
+
|
|
27483
|
+
if (panel === null)
|
|
27484
|
+
{
|
|
27485
|
+
return;
|
|
27486
|
+
}
|
|
27487
|
+
|
|
27488
|
+
// Allow light dismissable panels/callouts to prevent close/dismiss
|
|
27489
|
+
// when interacting with emoji widget hosted outside of panels/callouts,
|
|
27490
|
+
// by detecting the presence of a data-disable-light-dismiss="true" attribute.
|
|
27491
|
+
Fit.Dom.Data(panel, "disable-light-dismiss", "true");
|
|
27492
|
+
|
|
27493
|
+
panel._associatedFitUiControl = me;
|
|
27494
|
+
|
|
27495
|
+
designEditorActiveToolbarPanel =
|
|
27496
|
+
{
|
|
27497
|
+
DomElement: panel,
|
|
27498
|
+
UnlockFocusStateIfEmojiPanelIsClosed: function() // Function called regularly via interval timer while emoji panel is open to make sure focus state is unlocked when emoji panel is closed, e.g. by pressing ESC, clicking outside of emoji panel, or by choosing an emoji
|
|
27499
|
+
{
|
|
27500
|
+
if (designModeEnabledAndReady() === false /* No longer in DesignMode */ || Fit.Dom.IsVisible(panel) === false /* Emoji panel closed */ || panel._associatedFitUiControl !== me /* Emoji panel now opened from another editor */)
|
|
27501
|
+
{
|
|
27502
|
+
designEditorActiveToolbarPanel = null;
|
|
27503
|
+
|
|
27504
|
+
// Disable focus lock - let ControlBase handle OnFocus and OnBlur automatically again
|
|
27505
|
+
me._internal.FocusStateLocked(false);
|
|
27506
|
+
|
|
27507
|
+
// Fire OnBlur in case user changed focus while emoji panel was open.
|
|
27508
|
+
// OnBlur does not fire automatically when focus state is locked.
|
|
27509
|
+
if (me.Focused() === false)
|
|
27510
|
+
{
|
|
27511
|
+
me._internal.FireOnBlur();
|
|
27512
|
+
}
|
|
27513
|
+
}
|
|
27514
|
+
},
|
|
27515
|
+
CloseEmojiPanel: function()
|
|
27516
|
+
{
|
|
27517
|
+
if (panel._associatedFitUiControl === me && Fit.Dom.IsVisible(panel) === true && Fit.Dom.Contained(panel, Fit.Dom.GetFocused()) === true)
|
|
27518
|
+
{
|
|
27519
|
+
designEditor.focus();
|
|
27520
|
+
designEditorActiveToolbarPanel.UnlockFocusStateIfEmojiPanelIsClosed();
|
|
27521
|
+
}
|
|
27522
|
+
}
|
|
27523
|
+
};
|
|
27524
|
+
|
|
27525
|
+
var checkClosedId = setInterval(function()
|
|
27526
|
+
{
|
|
27527
|
+
// Invoke cleanup function regularly to make sure
|
|
27528
|
+
// focus lock is relased when emoji panel is closed,
|
|
27529
|
+
// and to fire OnBlur if another control was focused
|
|
27530
|
+
// while emoji panel was open.
|
|
27531
|
+
|
|
27532
|
+
if (me === null)
|
|
27533
|
+
{
|
|
27534
|
+
clearInterval(checkClosedId);
|
|
27535
|
+
return;
|
|
27536
|
+
}
|
|
27537
|
+
|
|
27538
|
+
if (designEditorActiveToolbarPanel !== null)
|
|
27539
|
+
{
|
|
27540
|
+
designEditorActiveToolbarPanel.UnlockFocusStateIfEmojiPanelIsClosed(); // Nullfies designEditorActiveToolbarPanel if emoji panel is closed
|
|
27541
|
+
}
|
|
27542
|
+
|
|
27543
|
+
if (designEditorActiveToolbarPanel === null)
|
|
27544
|
+
{
|
|
27545
|
+
clearInterval(checkClosedId);
|
|
27546
|
+
}
|
|
27547
|
+
}, 250);
|
|
27548
|
+
}, 0);
|
|
27549
|
+
});
|
|
27550
|
+
}
|
|
27504
27551
|
|
|
27505
27552
|
function updateDesignEditorSize()
|
|
27506
27553
|
{
|