@elementor/editor-global-classes 3.32.0-38 → 3.32.0-39
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 +6 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/capabilities.ts +1 -1
- package/src/sync-with-document-save.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-global-classes",
|
|
3
|
-
"version": "3.32.0-
|
|
3
|
+
"version": "3.32.0-39",
|
|
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": "3.32.0-
|
|
43
|
-
"@elementor/editor-current-user": "3.32.0-
|
|
44
|
-
"@elementor/editor-documents": "3.32.0-
|
|
45
|
-
"@elementor/editor-editing-panel": "3.32.0-
|
|
46
|
-
"@elementor/editor-panels": "3.32.0-
|
|
47
|
-
"@elementor/editor-props": "3.32.0-
|
|
48
|
-
"@elementor/editor-styles": "3.32.0-
|
|
49
|
-
"@elementor/editor-styles-repository": "3.32.0-
|
|
50
|
-
"@elementor/editor-ui": "3.32.0-
|
|
51
|
-
"@elementor/editor-v1-adapters": "3.32.0-
|
|
52
|
-
"@elementor/http-client": "3.32.0-
|
|
42
|
+
"@elementor/editor": "3.32.0-39",
|
|
43
|
+
"@elementor/editor-current-user": "3.32.0-39",
|
|
44
|
+
"@elementor/editor-documents": "3.32.0-39",
|
|
45
|
+
"@elementor/editor-editing-panel": "3.32.0-39",
|
|
46
|
+
"@elementor/editor-panels": "3.32.0-39",
|
|
47
|
+
"@elementor/editor-props": "3.32.0-39",
|
|
48
|
+
"@elementor/editor-styles": "3.32.0-39",
|
|
49
|
+
"@elementor/editor-styles-repository": "3.32.0-39",
|
|
50
|
+
"@elementor/editor-ui": "3.32.0-39",
|
|
51
|
+
"@elementor/editor-v1-adapters": "3.32.0-39",
|
|
52
|
+
"@elementor/http-client": "3.32.0-39",
|
|
53
53
|
"@elementor/icons": "1.46.0",
|
|
54
|
-
"@elementor/query": "3.32.0-
|
|
55
|
-
"@elementor/store": "3.32.0-
|
|
54
|
+
"@elementor/query": "3.32.0-39",
|
|
55
|
+
"@elementor/store": "3.32.0-39",
|
|
56
56
|
"@elementor/ui": "1.36.8",
|
|
57
|
-
"@elementor/utils": "3.32.0-
|
|
57
|
+
"@elementor/utils": "3.32.0-39",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
package/src/capabilities.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type UserCapabilities } from '@elementor/editor-styles-repository';
|
|
|
2
2
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
3
3
|
|
|
4
4
|
const EXPERIMENT_KEY = 'global_classes_should_enforce_capabilities';
|
|
5
|
-
const UPDATE_CLASS_CAPABILITY_KEY = 'elementor_global_classes_update_class';
|
|
5
|
+
export const UPDATE_CLASS_CAPABILITY_KEY = 'elementor_global_classes_update_class';
|
|
6
6
|
|
|
7
7
|
export const getCapabilities = (): UserCapabilities | undefined => {
|
|
8
8
|
const shouldEnforceCapabilities = isExperimentActive( EXPERIMENT_KEY );
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { getCurrentUser } from '@elementor/editor-current-user';
|
|
1
2
|
import { setDocumentModifiedStatus } from '@elementor/editor-documents';
|
|
2
3
|
import { registerDataHook } from '@elementor/editor-v1-adapters';
|
|
3
4
|
import { __getState as getState, __subscribeWithSelector as subscribeWithSelector } from '@elementor/store';
|
|
4
5
|
|
|
6
|
+
import { UPDATE_CLASS_CAPABILITY_KEY } from './capabilities';
|
|
5
7
|
import { saveGlobalClasses } from './save-global-classes';
|
|
6
8
|
import { selectIsDirty } from './store';
|
|
7
9
|
|
|
@@ -25,6 +27,14 @@ function syncDirtyState() {
|
|
|
25
27
|
|
|
26
28
|
function bindSaveAction() {
|
|
27
29
|
registerDataHook( 'after', 'document/save/save', ( args ) => {
|
|
30
|
+
const user = getCurrentUser();
|
|
31
|
+
|
|
32
|
+
const canEdit = user?.capabilities.includes( UPDATE_CLASS_CAPABILITY_KEY );
|
|
33
|
+
|
|
34
|
+
if ( ! canEdit ) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
28
38
|
return saveGlobalClasses( {
|
|
29
39
|
context: args.status === 'publish' ? 'frontend' : 'preview',
|
|
30
40
|
} );
|