@elementor/editor-global-classes 3.35.0-493 → 3.35.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/dist/index.js
CHANGED
|
@@ -565,7 +565,7 @@ var import_store26 = require("@elementor/store");
|
|
|
565
565
|
|
|
566
566
|
// src/components/class-manager/class-manager-button.tsx
|
|
567
567
|
var React19 = __toESM(require("react"));
|
|
568
|
-
var
|
|
568
|
+
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
569
569
|
var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
|
|
570
570
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
571
571
|
var import_ui16 = require("@elementor/ui");
|
|
@@ -595,10 +595,10 @@ var PrefetchCssClassUsage = () => {
|
|
|
595
595
|
// src/components/class-manager/class-manager-panel.tsx
|
|
596
596
|
var React18 = __toESM(require("react"));
|
|
597
597
|
var import_react8 = require("react");
|
|
598
|
-
var
|
|
598
|
+
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
599
599
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
600
600
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
601
|
-
var
|
|
601
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
602
602
|
var import_icons11 = require("@elementor/icons");
|
|
603
603
|
var import_query3 = require("@elementor/query");
|
|
604
604
|
var import_store20 = require("@elementor/store");
|
|
@@ -1207,8 +1207,6 @@ var IntroductionContent = () => {
|
|
|
1207
1207
|
};
|
|
1208
1208
|
|
|
1209
1209
|
// src/components/class-manager/delete-class.ts
|
|
1210
|
-
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
1211
|
-
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1212
1210
|
var import_store14 = require("@elementor/store");
|
|
1213
1211
|
var isDeleted = false;
|
|
1214
1212
|
var deleteClass = (id2) => {
|
|
@@ -1222,20 +1220,9 @@ var deleteClass = (id2) => {
|
|
|
1222
1220
|
});
|
|
1223
1221
|
};
|
|
1224
1222
|
var onDelete = async () => {
|
|
1225
|
-
await reloadDocument();
|
|
1226
1223
|
isDeleted = false;
|
|
1227
1224
|
};
|
|
1228
1225
|
var hasDeletedItems = () => isDeleted;
|
|
1229
|
-
var reloadDocument = () => {
|
|
1230
|
-
const currentDocument = (0, import_editor_documents2.getCurrentDocument)();
|
|
1231
|
-
const documentsManager = (0, import_editor_documents2.getV1DocumentsManager)();
|
|
1232
|
-
documentsManager.invalidateCache();
|
|
1233
|
-
return (0, import_editor_v1_adapters2.__privateRunCommand)("editor/documents/switch", {
|
|
1234
|
-
id: currentDocument?.id,
|
|
1235
|
-
shouldScroll: false,
|
|
1236
|
-
shouldNavigateToDefaultRoute: false
|
|
1237
|
-
});
|
|
1238
|
-
};
|
|
1239
1226
|
|
|
1240
1227
|
// src/components/class-manager/flipped-color-swatch-icon.tsx
|
|
1241
1228
|
var React10 = __toESM(require("react"));
|
|
@@ -1266,7 +1253,7 @@ var import_i18n11 = require("@wordpress/i18n");
|
|
|
1266
1253
|
|
|
1267
1254
|
// src/components/css-class-usage/components/css-class-usage-popover.tsx
|
|
1268
1255
|
var React11 = __toESM(require("react"));
|
|
1269
|
-
var
|
|
1256
|
+
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
1270
1257
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1271
1258
|
var import_icons6 = require("@elementor/icons");
|
|
1272
1259
|
var import_ui8 = require("@elementor/ui");
|
|
@@ -1311,7 +1298,7 @@ var CssClassUsagePopover = ({
|
|
|
1311
1298
|
onClose
|
|
1312
1299
|
}) => {
|
|
1313
1300
|
const { data: classUsage } = useCssClassUsageByID(cssClassID);
|
|
1314
|
-
const onNavigate = (0,
|
|
1301
|
+
const onNavigate = (0, import_editor_documents2.__useOpenDocumentInNewTab)();
|
|
1315
1302
|
const cssClassUsageRecords = classUsage?.content.map(
|
|
1316
1303
|
({ title, elements, pageId, type }) => ({
|
|
1317
1304
|
type: "item",
|
|
@@ -2039,16 +2026,27 @@ function unblockPanelInteractions() {
|
|
|
2039
2026
|
|
|
2040
2027
|
// src/components/class-manager/class-manager-panel.tsx
|
|
2041
2028
|
var id = "global-classes-manager";
|
|
2029
|
+
var reloadDocument = () => {
|
|
2030
|
+
const currentDocument = (0, import_editor_documents3.getCurrentDocument)();
|
|
2031
|
+
const documentsManager = (0, import_editor_documents3.getV1DocumentsManager)();
|
|
2032
|
+
documentsManager.invalidateCache();
|
|
2033
|
+
return (0, import_editor_v1_adapters2.__privateRunCommand)("editor/documents/switch", {
|
|
2034
|
+
id: currentDocument?.id,
|
|
2035
|
+
shouldScroll: false,
|
|
2036
|
+
shouldNavigateToDefaultRoute: false
|
|
2037
|
+
});
|
|
2038
|
+
};
|
|
2042
2039
|
var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
2043
2040
|
id,
|
|
2044
2041
|
component: ClassManagerPanel,
|
|
2045
2042
|
allowedEditModes: ["edit", id],
|
|
2046
2043
|
onOpen: () => {
|
|
2047
|
-
(0,
|
|
2044
|
+
(0, import_editor_v1_adapters2.changeEditMode)(id);
|
|
2048
2045
|
blockPanelInteractions();
|
|
2049
2046
|
},
|
|
2050
|
-
onClose: () => {
|
|
2051
|
-
(0,
|
|
2047
|
+
onClose: async () => {
|
|
2048
|
+
(0, import_editor_v1_adapters2.changeEditMode)("edit");
|
|
2049
|
+
await reloadDocument();
|
|
2052
2050
|
unblockPanelInteractions();
|
|
2053
2051
|
},
|
|
2054
2052
|
isOpenPreviousElement: true
|
|
@@ -2152,7 +2150,7 @@ var usePublish = () => {
|
|
|
2152
2150
|
return (0, import_query3.useMutation)({
|
|
2153
2151
|
mutationFn: () => saveGlobalClasses({ context: "frontend" }),
|
|
2154
2152
|
onSuccess: async () => {
|
|
2155
|
-
(0,
|
|
2153
|
+
(0, import_editor_documents3.setDocumentModifiedStatus)(false);
|
|
2156
2154
|
if (hasDeletedItems()) {
|
|
2157
2155
|
await onDelete();
|
|
2158
2156
|
}
|
|
@@ -2179,9 +2177,9 @@ var trackGlobalClassesButton = () => {
|
|
|
2179
2177
|
});
|
|
2180
2178
|
};
|
|
2181
2179
|
var ClassManagerButton = () => {
|
|
2182
|
-
const document = (0,
|
|
2180
|
+
const document = (0, import_editor_documents4.__useActiveDocument)();
|
|
2183
2181
|
const { open: openPanel } = usePanelActions();
|
|
2184
|
-
const { save: saveDocument } = (0,
|
|
2182
|
+
const { save: saveDocument } = (0, import_editor_documents4.__useActiveDocumentActions)();
|
|
2185
2183
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui10.useDialog)();
|
|
2186
2184
|
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
2187
2185
|
const { userCan } = (0, import_editor_styles_repository3.useUserStylesCapability)();
|
|
@@ -2717,12 +2715,12 @@ var initMcpIntegration = () => {
|
|
|
2717
2715
|
|
|
2718
2716
|
// src/sync-with-document.tsx
|
|
2719
2717
|
var import_react10 = require("react");
|
|
2720
|
-
var
|
|
2718
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2721
2719
|
|
|
2722
2720
|
// src/sync-with-document-save.ts
|
|
2723
2721
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2724
|
-
var
|
|
2725
|
-
var
|
|
2722
|
+
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
2723
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2726
2724
|
var import_store24 = require("@elementor/store");
|
|
2727
2725
|
function syncWithDocumentSave(panelActions) {
|
|
2728
2726
|
const unsubscribe = syncDirtyState();
|
|
@@ -2734,11 +2732,11 @@ function syncDirtyState() {
|
|
|
2734
2732
|
if (!isDirty()) {
|
|
2735
2733
|
return;
|
|
2736
2734
|
}
|
|
2737
|
-
(0,
|
|
2735
|
+
(0, import_editor_documents5.setDocumentModifiedStatus)(true);
|
|
2738
2736
|
});
|
|
2739
2737
|
}
|
|
2740
2738
|
function bindSaveAction(panelActions) {
|
|
2741
|
-
(0,
|
|
2739
|
+
(0, import_editor_v1_adapters3.registerDataHook)("dependency", "document/save/save", (args) => {
|
|
2742
2740
|
const user = (0, import_editor_current_user2.getCurrentUser)();
|
|
2743
2741
|
const canEdit = user?.capabilities.includes(UPDATE_CLASS_CAPABILITY_KEY);
|
|
2744
2742
|
if (!canEdit) {
|
|
@@ -2759,7 +2757,7 @@ function isDirty() {
|
|
|
2759
2757
|
function SyncWithDocumentSave() {
|
|
2760
2758
|
const panelActions = usePanelActions();
|
|
2761
2759
|
(0, import_react10.useEffect)(() => {
|
|
2762
|
-
(0,
|
|
2760
|
+
(0, import_editor_v1_adapters4.__privateListenTo)((0, import_editor_v1_adapters4.v1ReadyEvent)(), () => {
|
|
2763
2761
|
syncWithDocumentSave(panelActions);
|
|
2764
2762
|
});
|
|
2765
2763
|
}, []);
|