@elementor/editor-editing-panel 4.2.0-928 → 4.2.0-930

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-editing-panel",
3
- "version": "4.2.0-928",
3
+ "version": "4.2.0-930",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,31 +39,31 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.2.0-928",
43
- "@elementor/editor-canvas": "4.2.0-928",
44
- "@elementor/editor-controls": "4.2.0-928",
45
- "@elementor/editor-documents": "4.2.0-928",
46
- "@elementor/editor-elements": "4.2.0-928",
47
- "@elementor/editor-interactions": "4.2.0-928",
48
- "@elementor/editor-notifications": "4.2.0-928",
49
- "@elementor/editor-panels": "4.2.0-928",
50
- "@elementor/editor-props": "4.2.0-928",
51
- "@elementor/editor-responsive": "4.2.0-928",
52
- "@elementor/editor-styles": "4.2.0-928",
53
- "@elementor/editor-styles-repository": "4.2.0-928",
54
- "@elementor/editor-ui": "4.2.0-928",
55
- "@elementor/editor-v1-adapters": "4.2.0-928",
56
- "@elementor/http-client": "4.2.0-928",
42
+ "@elementor/editor": "4.2.0-930",
43
+ "@elementor/editor-canvas": "4.2.0-930",
44
+ "@elementor/editor-controls": "4.2.0-930",
45
+ "@elementor/editor-documents": "4.2.0-930",
46
+ "@elementor/editor-elements": "4.2.0-930",
47
+ "@elementor/editor-interactions": "4.2.0-930",
48
+ "@elementor/editor-notifications": "4.2.0-930",
49
+ "@elementor/editor-panels": "4.2.0-930",
50
+ "@elementor/editor-props": "4.2.0-930",
51
+ "@elementor/editor-responsive": "4.2.0-930",
52
+ "@elementor/editor-styles": "4.2.0-930",
53
+ "@elementor/editor-styles-repository": "4.2.0-930",
54
+ "@elementor/editor-ui": "4.2.0-930",
55
+ "@elementor/editor-v1-adapters": "4.2.0-930",
56
+ "@elementor/http-client": "4.2.0-930",
57
57
  "@elementor/icons": "~1.75.1",
58
- "@elementor/editor-variables": "4.2.0-928",
59
- "@elementor/locations": "4.2.0-928",
60
- "@elementor/menus": "4.2.0-928",
61
- "@elementor/query": "4.2.0-928",
62
- "@elementor/schema": "4.2.0-928",
63
- "@elementor/session": "4.2.0-928",
58
+ "@elementor/editor-variables": "4.2.0-930",
59
+ "@elementor/locations": "4.2.0-930",
60
+ "@elementor/menus": "4.2.0-930",
61
+ "@elementor/query": "4.2.0-930",
62
+ "@elementor/schema": "4.2.0-930",
63
+ "@elementor/session": "4.2.0-930",
64
64
  "@elementor/ui": "1.37.5",
65
- "@elementor/utils": "4.2.0-928",
66
- "@elementor/wp-media": "4.2.0-928",
65
+ "@elementor/utils": "4.2.0-930",
66
+ "@elementor/wp-media": "4.2.0-930",
67
67
  "@wordpress/i18n": "^5.13.0"
68
68
  },
69
69
  "peerDependencies": {
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+
3
+ function getStickyPromotion() {
4
+ return window.elementor?.config?.editingPanelStickyPromotion;
5
+ }
6
+
7
+ export const EditingPanelStickyPromotion = () => {
8
+ const promotion = getStickyPromotion();
9
+
10
+ if ( ! promotion ) {
11
+ return null;
12
+ }
13
+
14
+ return (
15
+ <div className="elementor-panel-editor-sticky-promotion">
16
+ <div className="elementor-get-pro-sticky-message">
17
+ { promotion.message }{ ' ' }
18
+ <a target="_blank" rel="noreferrer" href={ promotion.url }>
19
+ { promotion.button_text }
20
+ </a>
21
+ </div>
22
+ </div>
23
+ );
24
+ };
@@ -17,6 +17,7 @@ import { __ } from '@wordpress/i18n';
17
17
  import { ElementProvider } from '../contexts/element-context';
18
18
  import { getEditingPanelReplacement } from '../editing-panel-replacement-registry';
19
19
  import { EditorPanelErrorFallback } from './editing-panel-error-fallback';
20
+ import { EditingPanelStickyPromotion } from './editing-panel-sticky-promotion';
20
21
  import { EditingPanelTabs } from './editing-panel-tabs';
21
22
 
22
23
  export const { Slot: PanelHeaderTopSlot, inject: injectIntoPanelHeaderTop } = createLocation();
@@ -43,9 +44,10 @@ export const EditingPanel = () => {
43
44
  <PanelHeaderTitle>{ panelTitle }</PanelHeaderTitle>
44
45
  <AtomIcon fontSize="small" sx={ { color: 'text.tertiary' } } />
45
46
  </PanelHeader>
46
- <PanelBody>
47
+ <PanelBody sx={ { height: 'auto', flex: 1, minHeight: 0 } }>
47
48
  <EditingPanelTabs />
48
49
  </PanelBody>
50
+ <EditingPanelStickyPromotion />
49
51
  </>
50
52
  );
51
53
 
@@ -9,12 +9,14 @@ type Dynamic = {
9
9
  settings?: Props;
10
10
  };
11
11
 
12
- export const dynamicTransformer = createTransformer< Dynamic >( ( value, { propType } ) => {
12
+ export const dynamicTransformer = createTransformer< Dynamic >( ( value, { propType, renderContext } ) => {
13
13
  if ( ! value?.name || ! isDynamicTagSupported( value.name ) ) {
14
14
  return propType?.default ?? null;
15
15
  }
16
16
 
17
- return getDynamicValue( value.name, simpleTransform( value?.settings ?? {} ) );
17
+ const renderPostId = ( renderContext as { currentPostId?: number } | undefined )?.currentPostId;
18
+
19
+ return getDynamicValue( value.name, simpleTransform( value?.settings ?? {} ), renderPostId );
18
20
  } );
19
21
 
20
22
  // Temporary naive transformation until we'll have a `backendTransformer` that
@@ -29,7 +31,7 @@ function simpleTransform( props: Props ) {
29
31
  return Object.fromEntries( transformed );
30
32
  }
31
33
 
32
- function getDynamicValue( name: string, settings: Record< string, unknown > ) {
34
+ function getDynamicValue( name: string, settings: Record< string, unknown >, renderPostId?: number ) {
33
35
  const { dynamicTags } = window.elementor ?? {};
34
36
 
35
37
  if ( ! dynamicTags ) {
@@ -43,6 +45,10 @@ function getDynamicValue( name: string, settings: Record< string, unknown > ) {
43
45
  return null;
44
46
  }
45
47
 
48
+ if ( renderPostId ) {
49
+ tag.editorRenderPostId = renderPostId;
50
+ }
51
+
46
52
  return dynamicTags.loadTagDataFromCache( tag ) ?? null;
47
53
  };
48
54
 
@@ -53,11 +59,8 @@ function getDynamicValue( name: string, settings: Record< string, unknown > ) {
53
59
  }
54
60
 
55
61
  return new Promise( ( resolve ) => {
56
- dynamicTags.refreshCacheFromServer(
57
- () => {
58
- resolve( getTagValue() );
59
- },
60
- { disableCache: true }
61
- );
62
+ dynamicTags.refreshCacheFromServer( () => {
63
+ resolve( getTagValue() );
64
+ } );
62
65
  } );
63
66
  }
@@ -28,14 +28,10 @@ export type DynamicPropValue = TransformablePropValue<
28
28
  { name: string; settings?: Record< string, unknown > }
29
29
  >;
30
30
 
31
- export type RefreshCacheFromServerOptions = {
32
- disableCache?: boolean;
33
- };
34
-
35
31
  export type DynamicTagsManager = {
36
32
  createTag: ( id: string, name: string, settings: Record< string, unknown > ) => TagInstance;
37
33
  loadTagDataFromCache: ( tag: TagInstance ) => unknown;
38
- refreshCacheFromServer: ( callback: () => void, options?: RefreshCacheFromServerOptions ) => void;
34
+ refreshCacheFromServer: ( callback: () => void ) => void;
39
35
  };
40
36
 
41
37
  export type TagInstance = {
@@ -46,4 +42,5 @@ export type TagInstance = {
46
42
  model: {
47
43
  toJSON: () => Record< string, unknown >;
48
44
  };
45
+ editorRenderPostId?: number;
49
46
  };