@elementor/editor-editing-panel 1.21.0 → 1.22.0
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/CHANGELOG.md +22 -0
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/src/components/css-classes/css-class-selector.tsx +15 -4
- package/src/components/multi-combobox.tsx +1 -1
package/dist/index.mjs
CHANGED
|
@@ -136,7 +136,7 @@ function MultiCombobox({
|
|
|
136
136
|
const optionsAndActions = selectedOrInputValue.filter((option) => typeof option !== "string");
|
|
137
137
|
if (reason === "createOption") {
|
|
138
138
|
const [firstAction] = filterActions(actions, { options: options13, inputValue: inputValue ?? "" });
|
|
139
|
-
if (firstAction
|
|
139
|
+
if (firstAction?.value) {
|
|
140
140
|
return run(firstAction.apply, firstAction.value);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -570,6 +570,9 @@ function useCreateActions({
|
|
|
570
570
|
return {
|
|
571
571
|
// translators: %s is the label of the new class.
|
|
572
572
|
label: (value) => __3('Create new "%s"', "elementor").replace("%s", value),
|
|
573
|
+
// translators: %s is the singular label of css class provider (e.g "Global CSS Class").
|
|
574
|
+
group: __3("Create New %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
|
|
575
|
+
condition: (_, inputValue) => isLabelValid(inputValue) && !hasReachedLimit(provider),
|
|
573
576
|
apply: (label) => {
|
|
574
577
|
const createdId = create(label);
|
|
575
578
|
if (!createdId) {
|
|
@@ -577,13 +580,19 @@ function useCreateActions({
|
|
|
577
580
|
}
|
|
578
581
|
pushAppliedId(createdId);
|
|
579
582
|
setActiveId(createdId);
|
|
580
|
-
}
|
|
581
|
-
condition: (_, inputValue) => stylesRepository4.isLabelValid(inputValue) && !stylesRepository4.isLabelExist(inputValue),
|
|
582
|
-
// translators: %s is the singular label of css class provider (e.g "Global CSS Class").
|
|
583
|
-
group: __3("Create New %s", "elementor").replace("%s", provider.labels?.singular ?? "")
|
|
583
|
+
}
|
|
584
584
|
};
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
+
function hasReachedLimit(provider) {
|
|
588
|
+
if (provider.limit === void 0) {
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
return provider.actions.get().length >= provider.limit;
|
|
592
|
+
}
|
|
593
|
+
function isLabelValid(newLabel) {
|
|
594
|
+
return stylesRepository4.isLabelValid(newLabel) && !stylesRepository4.isLabelExist(newLabel);
|
|
595
|
+
}
|
|
587
596
|
function useAppliedOptions(options13, appliedIds) {
|
|
588
597
|
const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
|
|
589
598
|
const hasElementsProviderStyleApplied = applied.some(
|