@wix/editor 1.562.0 → 1.563.0
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/cjs/index.js +37 -60
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +37 -60
- package/dist/esm/index.js.map +1 -1
- package/dist/statics/docs-ts-model.json +5080 -3881
- package/dist/statics/index.js +37 -60
- package/dist/statics/index.js.map +1 -1
- package/dist/types/index.d.ts +46 -158
- package/package.json +6 -6
package/dist/cjs/index.js
CHANGED
|
@@ -640,9 +640,11 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
640
640
|
);
|
|
641
641
|
}
|
|
642
642
|
/**
|
|
643
|
-
*
|
|
643
|
+
* Lists the data fields defined on the selected component's manifest.
|
|
644
644
|
*
|
|
645
|
-
*
|
|
645
|
+
* Each key in the result is a valid **`dataItemKey`** for `getData`, `setData`, and `getResolvedData`.
|
|
646
|
+
*
|
|
647
|
+
* @returns Definitions keyed by `dataItemKey`.
|
|
646
648
|
*
|
|
647
649
|
* @example
|
|
648
650
|
* ```ts
|
|
@@ -681,19 +683,21 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
681
683
|
);
|
|
682
684
|
}
|
|
683
685
|
/**
|
|
684
|
-
*
|
|
686
|
+
* Returns one data field from the selected component by **`dataItemKey`**.
|
|
687
|
+
*
|
|
688
|
+
* A **`dataItemKey`** is the property name of a data field in that component's manifest — the same names
|
|
689
|
+
* returned from `getDataDefinitions`. Example: `'heroImage'` for a field declared under `editorElement.data`.
|
|
685
690
|
*
|
|
686
|
-
*
|
|
687
|
-
* for a single data item.
|
|
691
|
+
* `getData` returns all fields at once. This method returns only the field you name.
|
|
688
692
|
*
|
|
689
|
-
* @param options -
|
|
690
|
-
* @returns
|
|
693
|
+
* @param options.dataItemKey - Key of the data field to read. Must exist on the component manifest.
|
|
694
|
+
* @returns Value for that data field.
|
|
691
695
|
*
|
|
692
696
|
* @example
|
|
693
697
|
* ```ts
|
|
694
698
|
* import { reactElements } from '@wix/editor';
|
|
695
699
|
*
|
|
696
|
-
* const
|
|
700
|
+
* const hero = await reactElements.getResolvedData({
|
|
697
701
|
* dataItemKey: 'heroImage',
|
|
698
702
|
* });
|
|
699
703
|
* ```
|
|
@@ -735,7 +739,7 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
735
739
|
/**
|
|
736
740
|
* Retrieves the preset definitions declared in the component's manifest.
|
|
737
741
|
*
|
|
738
|
-
* @returns
|
|
742
|
+
* @returns An object mapping each preset key to its definition.
|
|
739
743
|
*
|
|
740
744
|
* @example
|
|
741
745
|
* ```ts
|
|
@@ -842,7 +846,7 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
842
846
|
);
|
|
843
847
|
}
|
|
844
848
|
/**
|
|
845
|
-
* Retrieves the
|
|
849
|
+
* Retrieves the active state for the component.
|
|
846
850
|
*
|
|
847
851
|
* @returns Key of the active state, or `null` if the default state is active.
|
|
848
852
|
*
|
|
@@ -888,7 +892,7 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
888
892
|
/**
|
|
889
893
|
* Retrieves the state definitions declared in the component's manifest.
|
|
890
894
|
*
|
|
891
|
-
* @returns
|
|
895
|
+
* @returns An object mapping each state key to its definition.
|
|
892
896
|
*
|
|
893
897
|
* @example
|
|
894
898
|
* ```ts
|
|
@@ -937,22 +941,21 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
937
941
|
);
|
|
938
942
|
}
|
|
939
943
|
/**
|
|
940
|
-
* Opens the font picker for selecting a font family and weight.
|
|
944
|
+
* Opens the font picker for selecting a font family and weight from a custom panel.
|
|
941
945
|
*
|
|
942
|
-
* Pass `
|
|
943
|
-
*
|
|
946
|
+
* Pass `target` and `panelOptions` to position the popup next to the control that opened it.
|
|
947
|
+
* Use `onChange` / `onPreview` to handle the selection; the editor does not write to the manifest for you.
|
|
944
948
|
*
|
|
945
|
-
* @param params -
|
|
949
|
+
* @param params - Picker options.
|
|
946
950
|
* @returns Selected font family and weight, or `undefined` if dismissed.
|
|
947
951
|
*
|
|
948
952
|
* @example
|
|
949
953
|
* ```ts
|
|
950
954
|
* import { reactElements } from '@wix/editor';
|
|
951
955
|
*
|
|
952
|
-
* const font = await reactElements.selectFont({ styleItemKey: 'headingFont' });
|
|
953
|
-
*
|
|
954
956
|
* const font = await reactElements.selectFont({
|
|
955
957
|
* selectedFontFamily: { family: 'Arial', weight: '400' },
|
|
958
|
+
* target: buttonRef.current,
|
|
956
959
|
* onChange: (value) => console.log('Selected:', value),
|
|
957
960
|
* });
|
|
958
961
|
* ```
|
|
@@ -974,21 +977,20 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
974
977
|
}
|
|
975
978
|
}
|
|
976
979
|
/**
|
|
977
|
-
* Opens the font family picker
|
|
978
|
-
*
|
|
979
|
-
*
|
|
980
|
+
* Opens the font family picker without weight selection, from a custom panel.
|
|
981
|
+
*
|
|
982
|
+
* Same pattern as {@link selectFont}: `target`, `panelOptions`, and callbacks.
|
|
980
983
|
*
|
|
981
|
-
* @param params -
|
|
984
|
+
* @param params - Picker options.
|
|
982
985
|
* @returns Selected font family, or `undefined` if dismissed.
|
|
983
986
|
*
|
|
984
987
|
* @example
|
|
985
988
|
* ```ts
|
|
986
989
|
* import { reactElements } from '@wix/editor';
|
|
987
990
|
*
|
|
988
|
-
* const font = await reactElements.selectFontFamily({ styleItemKey: 'bodyFont' });
|
|
989
|
-
*
|
|
990
991
|
* const font = await reactElements.selectFontFamily({
|
|
991
992
|
* selectedFontFamily: { family: 'Helvetica', weight: '400' },
|
|
993
|
+
* target: buttonRef.current,
|
|
992
994
|
* onChange: (value) => console.log('Selected:', value.family),
|
|
993
995
|
* });
|
|
994
996
|
* ```
|
|
@@ -1010,21 +1012,15 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
1010
1012
|
}
|
|
1011
1013
|
}
|
|
1012
1014
|
/**
|
|
1013
|
-
* Opens the media picker for selecting images, videos, or other media
|
|
1014
|
-
* from the Wix Media Manager.
|
|
1015
|
-
*
|
|
1016
|
-
* Pass `dataItemKey` to bind the picker to a manifest data item,
|
|
1017
|
-
* or pass manual options to configure the picker.
|
|
1015
|
+
* Opens the media picker for selecting images, videos, or other media from a custom panel.
|
|
1018
1016
|
*
|
|
1019
|
-
* @param params -
|
|
1017
|
+
* @param params - Picker options.
|
|
1020
1018
|
* @returns Selected media items.
|
|
1021
1019
|
*
|
|
1022
1020
|
* @example
|
|
1023
1021
|
* ```ts
|
|
1024
1022
|
* import { reactElements } from '@wix/editor';
|
|
1025
1023
|
*
|
|
1026
|
-
* const media = await reactElements.selectMedia({ dataItemKey: 'heroImage' });
|
|
1027
|
-
*
|
|
1028
1024
|
* const media = await reactElements.selectMedia({
|
|
1029
1025
|
* isMultiSelect: true,
|
|
1030
1026
|
* category: 'image',
|
|
@@ -1041,20 +1037,15 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
1041
1037
|
);
|
|
1042
1038
|
}
|
|
1043
1039
|
/**
|
|
1044
|
-
* Opens the link picker for creating or editing a link.
|
|
1045
|
-
*
|
|
1046
|
-
* Pass `dataItemKey` to bind the picker to a manifest data item,
|
|
1047
|
-
* or pass a `value` and optional `linkTypes` to configure manually.
|
|
1040
|
+
* Opens the link picker for creating or editing a link from a custom panel.
|
|
1048
1041
|
*
|
|
1049
|
-
* @param params -
|
|
1042
|
+
* @param params - Picker options.
|
|
1050
1043
|
* @returns Selected link, or `null`/`undefined` if dismissed.
|
|
1051
1044
|
*
|
|
1052
1045
|
* @example
|
|
1053
1046
|
* ```ts
|
|
1054
1047
|
* import { reactElements } from '@wix/editor';
|
|
1055
1048
|
*
|
|
1056
|
-
* const link = await reactElements.selectLink({ dataItemKey: 'buttonLink' });
|
|
1057
|
-
*
|
|
1058
1049
|
* const link = await reactElements.selectLink({
|
|
1059
1050
|
* value: currentLink,
|
|
1060
1051
|
* options: { linkTypes: ['ExternalLink', 'PageLink'] },
|
|
@@ -1071,20 +1062,15 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
1071
1062
|
);
|
|
1072
1063
|
}
|
|
1073
1064
|
/**
|
|
1074
|
-
* Opens the color picker for selecting a color.
|
|
1075
|
-
*
|
|
1076
|
-
* Pass `styleItemKey` to bind the picker to a manifest style item,
|
|
1077
|
-
* or pass manual options to configure the picker.
|
|
1065
|
+
* Opens the color picker for selecting a color from a custom panel.
|
|
1078
1066
|
*
|
|
1079
|
-
* @param params -
|
|
1067
|
+
* @param params - Picker options.
|
|
1080
1068
|
* @returns Selected color value, or `undefined` if dismissed.
|
|
1081
1069
|
*
|
|
1082
1070
|
* @example
|
|
1083
1071
|
* ```ts
|
|
1084
1072
|
* import { reactElements } from '@wix/editor';
|
|
1085
1073
|
*
|
|
1086
|
-
* const color = await reactElements.selectColor({ styleItemKey: 'backgroundColor' });
|
|
1087
|
-
*
|
|
1088
1074
|
* const color = await reactElements.selectColor({
|
|
1089
1075
|
* initialValue: '#ff0000',
|
|
1090
1076
|
* mode: ['solid', 'gradient'],
|
|
@@ -1134,13 +1120,9 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
1134
1120
|
);
|
|
1135
1121
|
}
|
|
1136
1122
|
/**
|
|
1137
|
-
* Opens the font weight picker for
|
|
1138
|
-
* font family.
|
|
1139
|
-
*
|
|
1140
|
-
* Pass manifest style item keys to bind the picker, or pass manual
|
|
1141
|
-
* options to handle the selection via callbacks.
|
|
1123
|
+
* Opens the font weight picker for a specified font family, from a custom panel.
|
|
1142
1124
|
*
|
|
1143
|
-
* @param params -
|
|
1125
|
+
* @param params - Picker options.
|
|
1144
1126
|
* @returns Selected font weight.
|
|
1145
1127
|
*
|
|
1146
1128
|
* @example
|
|
@@ -1148,12 +1130,8 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
1148
1130
|
* import { reactElements } from '@wix/editor';
|
|
1149
1131
|
*
|
|
1150
1132
|
* const weight = await reactElements.selectFontWeight({
|
|
1151
|
-
* fontFamilyStyleItemKey: 'headingFontFamily',
|
|
1152
|
-
* fontWeightStyleItemKey: 'headingFontWeight',
|
|
1153
|
-
* });
|
|
1154
|
-
*
|
|
1155
|
-
* const weight = await reactElements.selectFontWeight({
|
|
1156
1133
|
* fontFamily: { family: 'Arial', weight: '400' },
|
|
1134
|
+
* target: buttonRef.current,
|
|
1157
1135
|
* onChange: (value) => console.log('Selected weight:', value.weight),
|
|
1158
1136
|
* });
|
|
1159
1137
|
* ```
|
|
@@ -1170,11 +1148,9 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
1170
1148
|
};
|
|
1171
1149
|
}
|
|
1172
1150
|
/**
|
|
1173
|
-
* Opens the text theme picker
|
|
1174
|
-
* (a combination of font and color from the site's theme).
|
|
1151
|
+
* Opens the text theme picker from a custom panel — a site theme combination of font and color.
|
|
1175
1152
|
*
|
|
1176
|
-
* @param params -
|
|
1177
|
-
* @param params.target - HTML element to anchor the picker to.
|
|
1153
|
+
* @param params - Picker options. Pass `target` for the element in your panel that opened the picker.
|
|
1178
1154
|
* @param params.initialValue - Initial font and color values.
|
|
1179
1155
|
* @returns Selected text theme.
|
|
1180
1156
|
*
|
|
@@ -1183,6 +1159,7 @@ class ElementSDKShape extends BaseSDKShape {
|
|
|
1183
1159
|
* import { reactElements } from '@wix/editor';
|
|
1184
1160
|
*
|
|
1185
1161
|
* const theme = await reactElements.selectTextTheme({
|
|
1162
|
+
* target: buttonRef.current,
|
|
1186
1163
|
* initialValue: { font: 'Heading 1', color: '#333' },
|
|
1187
1164
|
* });
|
|
1188
1165
|
* ```
|