File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ export const VariantRevertDropdown = (props: any) => {
195195 invertTooltipPosition,
196196 toggleVariantDropdown,
197197 variantStatus = BASE_VARIANT_STATUS ,
198+ disabled,
198199 } = props ;
199200 const dropdownRef = useRef < HTMLDivElement > ( null ) ;
200201 useHandleOutsideClick ( dropdownRef , closeDropdown ) ;
@@ -221,6 +222,7 @@ export const VariantRevertDropdown = (props: any) => {
221222 style = { { padding : "6px" } }
222223 data-tooltip = { "Variant" }
223224 data-testid = { `visual-builder-canvas-variant-icon` }
225+ disabled = { disabled }
224226 >
225227 < VariantIcon />
226228 </ button >
@@ -236,6 +238,7 @@ export const VariantRevertDropdown = (props: any) => {
236238 data-tooltip = { "Variant Revert" }
237239 data-testid = { `visual-builder-canvas-variant-revert` }
238240 onClick = { toggleVariantDropdown }
241+ disabled = { disabled }
239242 >
240243 < VariantIcon />
241244 < CaretIcon open = { props . isOpen } />
Original file line number Diff line number Diff line change @@ -398,6 +398,7 @@ function FieldToolbarComponent(
398398 closeDropdown = { closeVariantDropdown }
399399 invertTooltipPosition = { invertTooltipPosition }
400400 toggleVariantDropdown = { toggleVariantDropdown }
401+ disabled = { disableFieldActions }
401402 />
402403 ) : null }
403404 { isMultiple && ! isWholeMultipleField ? (
Original file line number Diff line number Diff line change @@ -17,25 +17,30 @@ export async function getEntryPermissions({
1717 contentTypeUid : string ;
1818 locale : string ;
1919} ) {
20- const permissions = await visualBuilderPostMessage ?. send < EntryPermissions > (
21- "get-permissions" ,
22- {
23- type : "entry" ,
24- entryUid,
25- contentTypeUid,
26- locale,
20+ try {
21+ const permissions =
22+ await visualBuilderPostMessage ?. send < EntryPermissions > (
23+ "get-permissions" ,
24+ {
25+ type : "entry" ,
26+ entryUid,
27+ contentTypeUid,
28+ locale,
29+ }
30+ ) ;
31+ if ( permissions ) {
32+ return permissions ;
2733 }
28- ) ;
34+ } catch ( error ) {
35+ console . debug ( "[Visual Builder] Error fetching permissions" , error ) ;
36+ }
2937 // allow editing when things go wrong,
3038 // e.g. when no permissions are received
31- if ( ! permissions ) {
32- return {
33- create : true ,
34- read : true ,
35- update : true ,
36- delete : true ,
37- publish : true ,
38- } ;
39- }
40- return permissions ;
39+ return {
40+ create : true ,
41+ read : true ,
42+ update : true ,
43+ delete : true ,
44+ publish : true ,
45+ } ;
4146}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ enum DisableReason {
1313 DisabledVariant = "This field is not editable as it doesn't match the selected variant" ,
1414 UnlocalizedVariant = "This field is not editable as it is not localized" ,
1515 None = "" ,
16- EntryUpdateRestricted = "You do not have permission to update this entry" ,
16+ EntryUpdateRestricted = "You do not have permission to edit this entry" ,
1717}
1818
1919interface FieldDisableState {
You can’t perform that action at this time.
0 commit comments