@elementor/editor-variables 4.0.0-573 → 4.0.0-591
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 +35 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variables-manager/variables-manager-panel.tsx +44 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-variables",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-591",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "4.0.0-
|
|
43
|
-
"@elementor/editor-canvas": "4.0.0-
|
|
44
|
-
"@elementor/editor-controls": "4.0.0-
|
|
45
|
-
"@elementor/editor-current-user": "4.0.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.0.0-
|
|
47
|
-
"@elementor/editor-panels": "4.0.0-
|
|
48
|
-
"@elementor/editor-props": "4.0.0-
|
|
49
|
-
"@elementor/editor-ui": "4.0.0-
|
|
50
|
-
"@elementor/editor-v1-adapters": "4.0.0-
|
|
51
|
-
"@elementor/menus": "4.0.0-
|
|
52
|
-
"@elementor/http-client": "4.0.0-
|
|
42
|
+
"@elementor/editor": "4.0.0-591",
|
|
43
|
+
"@elementor/editor-canvas": "4.0.0-591",
|
|
44
|
+
"@elementor/editor-controls": "4.0.0-591",
|
|
45
|
+
"@elementor/editor-current-user": "4.0.0-591",
|
|
46
|
+
"@elementor/editor-mcp": "4.0.0-591",
|
|
47
|
+
"@elementor/editor-panels": "4.0.0-591",
|
|
48
|
+
"@elementor/editor-props": "4.0.0-591",
|
|
49
|
+
"@elementor/editor-ui": "4.0.0-591",
|
|
50
|
+
"@elementor/editor-v1-adapters": "4.0.0-591",
|
|
51
|
+
"@elementor/menus": "4.0.0-591",
|
|
52
|
+
"@elementor/http-client": "4.0.0-591",
|
|
53
53
|
"@elementor/icons": "^1.63.0",
|
|
54
|
-
"@elementor/events": "4.0.0-
|
|
55
|
-
"@elementor/schema": "4.0.0-
|
|
54
|
+
"@elementor/events": "4.0.0-591",
|
|
55
|
+
"@elementor/schema": "4.0.0-591",
|
|
56
56
|
"@elementor/ui": "1.37.2",
|
|
57
|
-
"@elementor/utils": "4.0.0-
|
|
57
|
+
"@elementor/utils": "4.0.0-591",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { useSuppressedMessage } from '@elementor/editor-current-user';
|
|
3
4
|
import {
|
|
4
5
|
__createPanel as createPanel,
|
|
5
6
|
Panel,
|
|
@@ -37,6 +38,7 @@ import { SIZE, VariableManagerCreateMenu } from './variables-manager-create-menu
|
|
|
37
38
|
import { VariablesManagerTable } from './variables-manager-table';
|
|
38
39
|
|
|
39
40
|
const id = 'variables-manager';
|
|
41
|
+
const STOP_SYNC_MESSAGE_KEY = 'stop-sync-variable';
|
|
40
42
|
|
|
41
43
|
type StopSyncConfirmationDialogProps = {
|
|
42
44
|
open: boolean;
|
|
@@ -60,6 +62,7 @@ export const { panel, usePanelActions } = createPanel( {
|
|
|
60
62
|
export function VariablesManagerPanel() {
|
|
61
63
|
const { close: closePanel } = usePanelActions();
|
|
62
64
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
|
|
65
|
+
const [ isStopSyncSuppressed ] = useSuppressedMessage( STOP_SYNC_MESSAGE_KEY );
|
|
63
66
|
|
|
64
67
|
const createMenuState = usePopupState( {
|
|
65
68
|
variant: 'popover',
|
|
@@ -156,6 +159,17 @@ export function VariablesManagerPanel() {
|
|
|
156
159
|
[ handleStopSync ]
|
|
157
160
|
);
|
|
158
161
|
|
|
162
|
+
const handleShowStopSyncDialog = useCallback(
|
|
163
|
+
( itemId: string ) => {
|
|
164
|
+
if ( ! isStopSyncSuppressed ) {
|
|
165
|
+
setStopSyncConfirmation( itemId );
|
|
166
|
+
} else {
|
|
167
|
+
handleStopSync( itemId );
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
[ isStopSyncSuppressed, handleStopSync ]
|
|
171
|
+
);
|
|
172
|
+
|
|
159
173
|
const buildMenuActions = useCallback(
|
|
160
174
|
( variableId: string ) => {
|
|
161
175
|
const variable = variables[ variableId ];
|
|
@@ -168,7 +182,7 @@ export function VariablesManagerPanel() {
|
|
|
168
182
|
variableId,
|
|
169
183
|
handlers: {
|
|
170
184
|
onStartSync: handleStartSync,
|
|
171
|
-
onStopSync:
|
|
185
|
+
onStopSync: handleShowStopSyncDialog,
|
|
172
186
|
},
|
|
173
187
|
} );
|
|
174
188
|
|
|
@@ -189,7 +203,7 @@ export function VariablesManagerPanel() {
|
|
|
189
203
|
|
|
190
204
|
return [ ...typeActions, deleteAction ];
|
|
191
205
|
},
|
|
192
|
-
[ variables, handleStartSync ]
|
|
206
|
+
[ variables, handleStartSync, handleShowStopSyncDialog ]
|
|
193
207
|
);
|
|
194
208
|
|
|
195
209
|
const hasVariables = Object.keys( variables ).length > 0;
|
|
@@ -411,25 +425,31 @@ const usePreventUnload = ( isDirty: boolean ) => {
|
|
|
411
425
|
}, [ isDirty ] );
|
|
412
426
|
};
|
|
413
427
|
|
|
414
|
-
const StopSyncConfirmationDialog = ( { open, onClose, onConfirm }: StopSyncConfirmationDialogProps ) =>
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
428
|
+
const StopSyncConfirmationDialog = ( { open, onClose, onConfirm }: StopSyncConfirmationDialogProps ) => {
|
|
429
|
+
const [ , suppressStopSyncMessage ] = useSuppressedMessage( STOP_SYNC_MESSAGE_KEY );
|
|
430
|
+
|
|
431
|
+
return (
|
|
432
|
+
<ConfirmationDialog open={ open } onClose={ onClose }>
|
|
433
|
+
<ConfirmationDialog.Title icon={ ColorFilterIcon } iconColor="primary">
|
|
434
|
+
{ __( 'Stop syncing variable color', 'elementor' ) }
|
|
435
|
+
</ConfirmationDialog.Title>
|
|
436
|
+
<ConfirmationDialog.Content>
|
|
437
|
+
<ConfirmationDialog.ContentText>
|
|
438
|
+
{ __(
|
|
439
|
+
'This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.',
|
|
440
|
+
'elementor'
|
|
441
|
+
) }
|
|
442
|
+
</ConfirmationDialog.ContentText>
|
|
443
|
+
</ConfirmationDialog.Content>
|
|
444
|
+
<ConfirmationDialog.Actions
|
|
445
|
+
onClose={ onClose }
|
|
446
|
+
onConfirm={ onConfirm }
|
|
447
|
+
cancelLabel={ __( 'Cancel', 'elementor' ) }
|
|
448
|
+
confirmLabel={ __( 'Got it', 'elementor' ) }
|
|
449
|
+
color="primary"
|
|
450
|
+
onSuppressMessage={ suppressStopSyncMessage }
|
|
451
|
+
suppressLabel={ __( "Don't show again", 'elementor' ) }
|
|
452
|
+
/>
|
|
453
|
+
</ConfirmationDialog>
|
|
454
|
+
);
|
|
455
|
+
};
|