@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-variables",
3
- "version": "4.0.0-573",
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-573",
43
- "@elementor/editor-canvas": "4.0.0-573",
44
- "@elementor/editor-controls": "4.0.0-573",
45
- "@elementor/editor-current-user": "4.0.0-573",
46
- "@elementor/editor-mcp": "4.0.0-573",
47
- "@elementor/editor-panels": "4.0.0-573",
48
- "@elementor/editor-props": "4.0.0-573",
49
- "@elementor/editor-ui": "4.0.0-573",
50
- "@elementor/editor-v1-adapters": "4.0.0-573",
51
- "@elementor/menus": "4.0.0-573",
52
- "@elementor/http-client": "4.0.0-573",
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-573",
55
- "@elementor/schema": "4.0.0-573",
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-573",
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: ( itemId: string ) => setStopSyncConfirmation( itemId ),
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
- <ConfirmationDialog open={ open } onClose={ onClose }>
416
- <ConfirmationDialog.Title icon={ ColorFilterIcon } iconColor="secondary">
417
- { __( 'Stop syncing variable color', 'elementor' ) }
418
- </ConfirmationDialog.Title>
419
- <ConfirmationDialog.Content>
420
- <ConfirmationDialog.ContentText>
421
- { __(
422
- 'This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.',
423
- 'elementor'
424
- ) }
425
- </ConfirmationDialog.ContentText>
426
- </ConfirmationDialog.Content>
427
- <ConfirmationDialog.Actions
428
- onClose={ onClose }
429
- onConfirm={ onConfirm }
430
- cancelLabel={ __( 'Cancel', 'elementor' ) }
431
- confirmLabel={ __( 'Got it', 'elementor' ) }
432
- color="secondary"
433
- />
434
- </ConfirmationDialog>
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
+ };