@wix/editor 1.438.0 → 1.440.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 +438 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +438 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/statics/docs-ts-model.json +6187 -0
- package/dist/statics/index.js +438 -6
- package/dist/statics/index.js.map +1 -1
- package/dist/types/index.d.ts +464 -5
- package/package.json +11 -5
package/dist/statics/index.js
CHANGED
|
@@ -531,6 +531,19 @@
|
|
|
531
531
|
this.overriddenApplicationContext = overriddenApplicationContext;
|
|
532
532
|
this.childPath = childPath;
|
|
533
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* Retrieves the style definitions declared in the component's manifest,
|
|
536
|
+
* including `cssProperties` and `cssCustomProperties`.
|
|
537
|
+
*
|
|
538
|
+
* @returns Style definitions for the component.
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
* ```ts
|
|
542
|
+
* import { element } from '@wix/editor';
|
|
543
|
+
*
|
|
544
|
+
* const defs = await element.getStyleDefinitions();
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
534
547
|
async getStyleDefinitions() {
|
|
535
548
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
536
549
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -539,6 +552,19 @@
|
|
|
539
552
|
this.childPath
|
|
540
553
|
);
|
|
541
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* Retrieves the current style values for the component.
|
|
557
|
+
*
|
|
558
|
+
* @returns Current `cssProperties` and `cssCustomProperties` values.
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```ts
|
|
562
|
+
* import { element } from '@wix/editor';
|
|
563
|
+
*
|
|
564
|
+
* const styles = await element.getStyles();
|
|
565
|
+
* const bgColor = styles.cssProperties.backgroundColor;
|
|
566
|
+
* ```
|
|
567
|
+
*/
|
|
542
568
|
async getStyles() {
|
|
543
569
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
544
570
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -548,9 +574,11 @@
|
|
|
548
574
|
);
|
|
549
575
|
}
|
|
550
576
|
/**
|
|
551
|
-
* Sets style values for the
|
|
577
|
+
* Sets style values for the component.
|
|
552
578
|
*
|
|
553
579
|
* @example
|
|
580
|
+
* ```ts
|
|
581
|
+
* import { element } from '@wix/editor';
|
|
554
582
|
* import { CssPropertyType } from '@wix/public-editor-platform-sdk';
|
|
555
583
|
*
|
|
556
584
|
* // Using enum (recommended):
|
|
@@ -562,6 +590,7 @@
|
|
|
562
590
|
* await element.setStyles({
|
|
563
591
|
* cssProperties: { 'color': '#fff' }
|
|
564
592
|
* });
|
|
593
|
+
* ```
|
|
565
594
|
*/
|
|
566
595
|
async setStyles(values = {}) {
|
|
567
596
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -573,9 +602,11 @@
|
|
|
573
602
|
);
|
|
574
603
|
}
|
|
575
604
|
/**
|
|
576
|
-
* Removes style values from the
|
|
605
|
+
* Removes style values from the component.
|
|
577
606
|
*
|
|
578
607
|
* @example
|
|
608
|
+
* ```ts
|
|
609
|
+
* import { element } from '@wix/editor';
|
|
579
610
|
* import { CssPropertyType } from '@wix/public-editor-platform-sdk';
|
|
580
611
|
*
|
|
581
612
|
* // Using enum (recommended):
|
|
@@ -587,6 +618,7 @@
|
|
|
587
618
|
* await element.removeStyles({
|
|
588
619
|
* cssPropertiesKeys: ['color']
|
|
589
620
|
* });
|
|
621
|
+
* ```
|
|
590
622
|
*/
|
|
591
623
|
async removeStyles(values = {}) {
|
|
592
624
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -597,6 +629,18 @@
|
|
|
597
629
|
values
|
|
598
630
|
);
|
|
599
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* Retrieves the data item definitions declared in the component's manifest.
|
|
634
|
+
*
|
|
635
|
+
* @returns Data item definitions keyed by data item key.
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* ```ts
|
|
639
|
+
* import { element } from '@wix/editor';
|
|
640
|
+
*
|
|
641
|
+
* const defs = await element.getDataDefinitions();
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
600
644
|
async getDataDefinitions() {
|
|
601
645
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
602
646
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -605,6 +649,19 @@
|
|
|
605
649
|
this.childPath
|
|
606
650
|
);
|
|
607
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* Retrieves the current data values for the component.
|
|
654
|
+
*
|
|
655
|
+
* @typeParam T - Optional type parameter to define the expected structure of the returned data.
|
|
656
|
+
* @returns Current data values for the component.
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```ts
|
|
660
|
+
* import { element } from '@wix/editor';
|
|
661
|
+
*
|
|
662
|
+
* const data = await element.getData();
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
608
665
|
async getData() {
|
|
609
666
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
610
667
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -613,6 +670,24 @@
|
|
|
613
670
|
this.childPath
|
|
614
671
|
);
|
|
615
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Retrieves the resolved value of a specific data item.
|
|
675
|
+
*
|
|
676
|
+
* Unlike {@link getData}, this method returns the fully resolved value
|
|
677
|
+
* for a single data item.
|
|
678
|
+
*
|
|
679
|
+
* @param options - Object containing the `dataItemKey` to resolve.
|
|
680
|
+
* @returns Resolved value for the specified data item.
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```ts
|
|
684
|
+
* import { element } from '@wix/editor';
|
|
685
|
+
*
|
|
686
|
+
* const resolved = await element.getResolvedData({
|
|
687
|
+
* dataItemKey: 'heroImage',
|
|
688
|
+
* });
|
|
689
|
+
* ```
|
|
690
|
+
*/
|
|
616
691
|
async getResolvedData({ dataItemKey }) {
|
|
617
692
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
618
693
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -624,6 +699,20 @@
|
|
|
624
699
|
}
|
|
625
700
|
);
|
|
626
701
|
}
|
|
702
|
+
/**
|
|
703
|
+
* Updates data values for the component. Only the specified data items
|
|
704
|
+
* are updated; other data items remain unchanged.
|
|
705
|
+
*
|
|
706
|
+
* @typeParam T - Optional type parameter to define the expected structure of the input data.
|
|
707
|
+
* @param values - Data item keys and their new values.
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* ```ts
|
|
711
|
+
* import { element } from '@wix/editor';
|
|
712
|
+
*
|
|
713
|
+
* await element.setData({ title: 'New Title', showButton: false });
|
|
714
|
+
* ```
|
|
715
|
+
*/
|
|
627
716
|
async setData(values) {
|
|
628
717
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
629
718
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -633,6 +722,18 @@
|
|
|
633
722
|
values
|
|
634
723
|
);
|
|
635
724
|
}
|
|
725
|
+
/**
|
|
726
|
+
* Retrieves the preset definitions declared in the component's manifest.
|
|
727
|
+
*
|
|
728
|
+
* @returns Preset definitions keyed by preset key.
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* ```ts
|
|
732
|
+
* import { element } from '@wix/editor';
|
|
733
|
+
*
|
|
734
|
+
* const presets = await element.getPresetDefinitions();
|
|
735
|
+
* ```
|
|
736
|
+
*/
|
|
636
737
|
async getPresetDefinitions() {
|
|
637
738
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
638
739
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -641,6 +742,18 @@
|
|
|
641
742
|
this.childPath
|
|
642
743
|
);
|
|
643
744
|
}
|
|
745
|
+
/**
|
|
746
|
+
* Retrieves the currently applied preset for the component.
|
|
747
|
+
*
|
|
748
|
+
* @returns Key of the applied preset, or `null` if no preset is applied.
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* ```ts
|
|
752
|
+
* import { element } from '@wix/editor';
|
|
753
|
+
*
|
|
754
|
+
* const preset = await element.getAppliedPreset();
|
|
755
|
+
* ```
|
|
756
|
+
*/
|
|
644
757
|
async getAppliedPreset() {
|
|
645
758
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
646
759
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -649,6 +762,19 @@
|
|
|
649
762
|
this.childPath
|
|
650
763
|
);
|
|
651
764
|
}
|
|
765
|
+
/**
|
|
766
|
+
* Applies a preset to the component. Applying a preset updates the component's
|
|
767
|
+
* styles and data to match the preset's defined defaults.
|
|
768
|
+
*
|
|
769
|
+
* @param options - Object containing the `key` of the preset to apply.
|
|
770
|
+
*
|
|
771
|
+
* @example
|
|
772
|
+
* ```ts
|
|
773
|
+
* import { element } from '@wix/editor';
|
|
774
|
+
*
|
|
775
|
+
* await element.applyPreset({ key: 'minimal' });
|
|
776
|
+
* ```
|
|
777
|
+
*/
|
|
652
778
|
async applyPreset(options) {
|
|
653
779
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
654
780
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -658,6 +784,23 @@
|
|
|
658
784
|
options
|
|
659
785
|
);
|
|
660
786
|
}
|
|
787
|
+
/**
|
|
788
|
+
* Retrieves the display group definitions declared in the component's manifest.
|
|
789
|
+
*
|
|
790
|
+
* @param options - Optional filter by `groupType`.
|
|
791
|
+
* @returns Display group definitions for the component.
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
* ```ts
|
|
795
|
+
* import { element } from '@wix/editor';
|
|
796
|
+
*
|
|
797
|
+
* const groups = await element.getDisplayGroupDefinitions();
|
|
798
|
+
*
|
|
799
|
+
* const cssGroups = await element.getDisplayGroupDefinitions({
|
|
800
|
+
* filter: { groupType: 'cssDataType' },
|
|
801
|
+
* });
|
|
802
|
+
* ```
|
|
803
|
+
*/
|
|
661
804
|
// TODO: group type should come from builder enum
|
|
662
805
|
async getDisplayGroupDefinitions(options) {
|
|
663
806
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -668,6 +811,18 @@
|
|
|
668
811
|
options
|
|
669
812
|
);
|
|
670
813
|
}
|
|
814
|
+
/**
|
|
815
|
+
* Retrieves the display name of the component as defined in the manifest.
|
|
816
|
+
*
|
|
817
|
+
* @returns Component display name.
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```ts
|
|
821
|
+
* import { element } from '@wix/editor';
|
|
822
|
+
*
|
|
823
|
+
* const name = await element.getDisplayName();
|
|
824
|
+
* ```
|
|
825
|
+
*/
|
|
671
826
|
async getDisplayName() {
|
|
672
827
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
673
828
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -676,6 +831,18 @@
|
|
|
676
831
|
this.childPath
|
|
677
832
|
);
|
|
678
833
|
}
|
|
834
|
+
/**
|
|
835
|
+
* Retrieves the currently active state for the component.
|
|
836
|
+
*
|
|
837
|
+
* @returns Key of the active state, or `null` if the default state is active.
|
|
838
|
+
*
|
|
839
|
+
* @example
|
|
840
|
+
* ```ts
|
|
841
|
+
* import { element } from '@wix/editor';
|
|
842
|
+
*
|
|
843
|
+
* const state = await element.getState();
|
|
844
|
+
* ```
|
|
845
|
+
*/
|
|
679
846
|
async getState() {
|
|
680
847
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
681
848
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -684,6 +851,21 @@
|
|
|
684
851
|
this.childPath
|
|
685
852
|
);
|
|
686
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* Sets the active state for the component. Pass `null` to return to the
|
|
856
|
+
* default state.
|
|
857
|
+
*
|
|
858
|
+
* @param stateKey - State key to activate, or `null` for the default state.
|
|
859
|
+
*
|
|
860
|
+
* @example
|
|
861
|
+
* ```ts
|
|
862
|
+
* import { element } from '@wix/editor';
|
|
863
|
+
*
|
|
864
|
+
* await element.setState('hover');
|
|
865
|
+
*
|
|
866
|
+
* await element.setState(null);
|
|
867
|
+
* ```
|
|
868
|
+
*/
|
|
687
869
|
async setState(stateKey) {
|
|
688
870
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
689
871
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -693,6 +875,18 @@
|
|
|
693
875
|
stateKey
|
|
694
876
|
);
|
|
695
877
|
}
|
|
878
|
+
/**
|
|
879
|
+
* Retrieves the state definitions declared in the component's manifest.
|
|
880
|
+
*
|
|
881
|
+
* @returns State definitions keyed by state key.
|
|
882
|
+
*
|
|
883
|
+
* @example
|
|
884
|
+
* ```ts
|
|
885
|
+
* import { element } from '@wix/editor';
|
|
886
|
+
*
|
|
887
|
+
* const states = await element.getStateDefinitions();
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
696
890
|
async getStateDefinitions() {
|
|
697
891
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
698
892
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -701,19 +895,58 @@
|
|
|
701
895
|
this.childPath
|
|
702
896
|
);
|
|
703
897
|
}
|
|
898
|
+
// TODO: use type from the ManifestChangeDetection,
|
|
899
|
+
// but type should be moved to editor-platform-public-interfaces
|
|
704
900
|
/**
|
|
705
|
-
*
|
|
706
|
-
*
|
|
901
|
+
* Subscribes to changes on the component. The callback is invoked whenever
|
|
902
|
+
* styles, data, state, preset, props, or manifest values change.
|
|
903
|
+
*
|
|
904
|
+
* @param callback - Callback that receives a patch with `type` and `value`.
|
|
905
|
+
* @returns Unsubscribe method.
|
|
906
|
+
*
|
|
907
|
+
* @example
|
|
908
|
+
* ```ts
|
|
909
|
+
* import { element } from '@wix/editor';
|
|
910
|
+
*
|
|
911
|
+
* const unsubscribe = await element.onChange((patch) => {
|
|
912
|
+
* if (patch.type === 'data') {
|
|
913
|
+
* console.log('Data changed:', patch.value);
|
|
914
|
+
* }
|
|
915
|
+
* });
|
|
916
|
+
*
|
|
917
|
+
* unsubscribe();
|
|
918
|
+
* ```
|
|
707
919
|
*/
|
|
708
|
-
async onChange(
|
|
920
|
+
async onChange(callback) {
|
|
709
921
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
710
922
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
711
923
|
return privateAPI.builderComponent.onChange(
|
|
712
924
|
manifestContextId,
|
|
713
925
|
this.childPath,
|
|
714
|
-
|
|
926
|
+
callback
|
|
715
927
|
);
|
|
716
928
|
}
|
|
929
|
+
/**
|
|
930
|
+
* Opens the font picker for selecting a font family and weight.
|
|
931
|
+
*
|
|
932
|
+
* Pass `styleItemKey` to bind the picker to a manifest style item,
|
|
933
|
+
* or pass manual options to handle the selection via callbacks.
|
|
934
|
+
*
|
|
935
|
+
* @param params - `styleItemKey` for manifest binding, or manual picker options.
|
|
936
|
+
* @returns Selected font family and weight, or `undefined` if dismissed.
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* ```ts
|
|
940
|
+
* import { element } from '@wix/editor';
|
|
941
|
+
*
|
|
942
|
+
* const font = await element.selectFont({ styleItemKey: 'headingFont' });
|
|
943
|
+
*
|
|
944
|
+
* const font = await element.selectFont({
|
|
945
|
+
* selectedFontFamily: { family: 'Arial', weight: '400' },
|
|
946
|
+
* onChange: (value) => console.log('Selected:', value),
|
|
947
|
+
* });
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
717
950
|
async selectFont(params) {
|
|
718
951
|
try {
|
|
719
952
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -730,6 +963,26 @@
|
|
|
730
963
|
} catch (error) {
|
|
731
964
|
}
|
|
732
965
|
}
|
|
966
|
+
/**
|
|
967
|
+
* Opens the font family picker for selecting a font family without
|
|
968
|
+
* weight options. Works the same as {@link selectFont} but without
|
|
969
|
+
* the weight selector.
|
|
970
|
+
*
|
|
971
|
+
* @param params - `styleItemKey` for manifest binding, or manual picker options.
|
|
972
|
+
* @returns Selected font family, or `undefined` if dismissed.
|
|
973
|
+
*
|
|
974
|
+
* @example
|
|
975
|
+
* ```ts
|
|
976
|
+
* import { element } from '@wix/editor';
|
|
977
|
+
*
|
|
978
|
+
* const font = await element.selectFontFamily({ styleItemKey: 'bodyFont' });
|
|
979
|
+
*
|
|
980
|
+
* const font = await element.selectFontFamily({
|
|
981
|
+
* selectedFontFamily: { family: 'Helvetica', weight: '400' },
|
|
982
|
+
* onChange: (value) => console.log('Selected:', value.family),
|
|
983
|
+
* });
|
|
984
|
+
* ```
|
|
985
|
+
*/
|
|
733
986
|
async selectFontFamily(params) {
|
|
734
987
|
try {
|
|
735
988
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
@@ -746,6 +999,28 @@
|
|
|
746
999
|
} catch (error) {
|
|
747
1000
|
}
|
|
748
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Opens the media picker for selecting images, videos, or other media
|
|
1004
|
+
* from the Wix Media Manager.
|
|
1005
|
+
*
|
|
1006
|
+
* Pass `dataItemKey` to bind the picker to a manifest data item,
|
|
1007
|
+
* or pass manual options to configure the picker.
|
|
1008
|
+
*
|
|
1009
|
+
* @param params - `dataItemKey` for manifest binding, or manual picker options.
|
|
1010
|
+
* @returns Selected media items.
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* ```ts
|
|
1014
|
+
* import { element } from '@wix/editor';
|
|
1015
|
+
*
|
|
1016
|
+
* const media = await element.selectMedia({ dataItemKey: 'heroImage' });
|
|
1017
|
+
*
|
|
1018
|
+
* const media = await element.selectMedia({
|
|
1019
|
+
* isMultiSelect: true,
|
|
1020
|
+
* category: 'image',
|
|
1021
|
+
* });
|
|
1022
|
+
* ```
|
|
1023
|
+
*/
|
|
749
1024
|
async selectMedia(params) {
|
|
750
1025
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
751
1026
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -755,6 +1030,27 @@
|
|
|
755
1030
|
params
|
|
756
1031
|
);
|
|
757
1032
|
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Opens the link picker for creating or editing a link.
|
|
1035
|
+
*
|
|
1036
|
+
* Pass `dataItemKey` to bind the picker to a manifest data item,
|
|
1037
|
+
* or pass a `value` and optional `linkTypes` to configure manually.
|
|
1038
|
+
*
|
|
1039
|
+
* @param params - `dataItemKey` for manifest binding, or manual picker options.
|
|
1040
|
+
* @returns Selected link, or `null`/`undefined` if dismissed.
|
|
1041
|
+
*
|
|
1042
|
+
* @example
|
|
1043
|
+
* ```ts
|
|
1044
|
+
* import { element } from '@wix/editor';
|
|
1045
|
+
*
|
|
1046
|
+
* const link = await element.selectLink({ dataItemKey: 'buttonLink' });
|
|
1047
|
+
*
|
|
1048
|
+
* const link = await element.selectLink({
|
|
1049
|
+
* value: currentLink,
|
|
1050
|
+
* options: { linkTypes: ['ExternalLink', 'PageLink'] },
|
|
1051
|
+
* });
|
|
1052
|
+
* ```
|
|
1053
|
+
*/
|
|
758
1054
|
async selectLink(params) {
|
|
759
1055
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
760
1056
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -764,6 +1060,30 @@
|
|
|
764
1060
|
params
|
|
765
1061
|
);
|
|
766
1062
|
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Opens the color picker for selecting a color.
|
|
1065
|
+
*
|
|
1066
|
+
* Pass `styleItemKey` to bind the picker to a manifest style item,
|
|
1067
|
+
* or pass manual options to configure the picker.
|
|
1068
|
+
*
|
|
1069
|
+
* @param params - `styleItemKey` for manifest binding, or manual picker options.
|
|
1070
|
+
* @returns Selected color value, or `undefined` if dismissed.
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```ts
|
|
1074
|
+
* import { element } from '@wix/editor';
|
|
1075
|
+
*
|
|
1076
|
+
* const color = await element.selectColor({ styleItemKey: 'backgroundColor' });
|
|
1077
|
+
*
|
|
1078
|
+
* const color = await element.selectColor({
|
|
1079
|
+
* initialValue: '#ff0000',
|
|
1080
|
+
* mode: ['solid', 'gradient'],
|
|
1081
|
+
* showOpacity: true,
|
|
1082
|
+
* onChange: (color) => console.log('Preview:', color),
|
|
1083
|
+
* onApply: (color) => console.log('Applied:', color),
|
|
1084
|
+
* });
|
|
1085
|
+
* ```
|
|
1086
|
+
*/
|
|
767
1087
|
async selectColor(params) {
|
|
768
1088
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
769
1089
|
try {
|
|
@@ -777,6 +1097,23 @@
|
|
|
777
1097
|
} catch (error) {
|
|
778
1098
|
}
|
|
779
1099
|
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Opens the background picker for selecting a background fill
|
|
1102
|
+
* (color, gradient, or image).
|
|
1103
|
+
*
|
|
1104
|
+
* @param options - Background picker configuration.
|
|
1105
|
+
* @returns Selected background fill value.
|
|
1106
|
+
*
|
|
1107
|
+
* @example
|
|
1108
|
+
* ```ts
|
|
1109
|
+
* import { element } from '@wix/editor';
|
|
1110
|
+
*
|
|
1111
|
+
* const bg = await element.selectBackground({
|
|
1112
|
+
* initialValue: { backgroundColor: '#fff', backgroundImage: '' },
|
|
1113
|
+
* onChange: (value) => console.log('Preview:', value),
|
|
1114
|
+
* });
|
|
1115
|
+
* ```
|
|
1116
|
+
*/
|
|
780
1117
|
async selectBackground(options) {
|
|
781
1118
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
782
1119
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -786,6 +1123,31 @@
|
|
|
786
1123
|
options
|
|
787
1124
|
);
|
|
788
1125
|
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Opens the font weight picker for selecting a font weight for a specified
|
|
1128
|
+
* font family.
|
|
1129
|
+
*
|
|
1130
|
+
* Pass manifest style item keys to bind the picker, or pass manual
|
|
1131
|
+
* options to handle the selection via callbacks.
|
|
1132
|
+
*
|
|
1133
|
+
* @param params - Manifest style item keys, or manual picker options.
|
|
1134
|
+
* @returns Selected font weight.
|
|
1135
|
+
*
|
|
1136
|
+
* @example
|
|
1137
|
+
* ```ts
|
|
1138
|
+
* import { element } from '@wix/editor';
|
|
1139
|
+
*
|
|
1140
|
+
* const weight = await element.selectFontWeight({
|
|
1141
|
+
* fontFamilyStyleItemKey: 'headingFontFamily',
|
|
1142
|
+
* fontWeightStyleItemKey: 'headingFontWeight',
|
|
1143
|
+
* });
|
|
1144
|
+
*
|
|
1145
|
+
* const weight = await element.selectFontWeight({
|
|
1146
|
+
* fontFamily: { family: 'Arial', weight: '400' },
|
|
1147
|
+
* onChange: (value) => console.log('Selected weight:', value.weight),
|
|
1148
|
+
* });
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
789
1151
|
async selectFontWeight(params) {
|
|
790
1152
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
791
1153
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -797,6 +1159,24 @@
|
|
|
797
1159
|
)
|
|
798
1160
|
};
|
|
799
1161
|
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Opens the text theme picker for selecting a predefined text theme
|
|
1164
|
+
* (a combination of font and color from the site's theme).
|
|
1165
|
+
*
|
|
1166
|
+
* @param params - Text theme picker configuration.
|
|
1167
|
+
* @param params.target - HTML element to anchor the picker to.
|
|
1168
|
+
* @param params.initialValue - Initial font and color values.
|
|
1169
|
+
* @returns Selected text theme.
|
|
1170
|
+
*
|
|
1171
|
+
* @example
|
|
1172
|
+
* ```ts
|
|
1173
|
+
* import { element } from '@wix/editor';
|
|
1174
|
+
*
|
|
1175
|
+
* const theme = await element.selectTextTheme({
|
|
1176
|
+
* initialValue: { font: 'Heading 1', color: '#333' },
|
|
1177
|
+
* });
|
|
1178
|
+
* ```
|
|
1179
|
+
*/
|
|
800
1180
|
async selectTextTheme(params) {
|
|
801
1181
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
802
1182
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -805,6 +1185,20 @@
|
|
|
805
1185
|
params
|
|
806
1186
|
);
|
|
807
1187
|
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Retrieves the currently selected index in an array items data group.
|
|
1190
|
+
*
|
|
1191
|
+
* @param options - Specify `arrayItemsDisplayGroupKey` if the component
|
|
1192
|
+
* has multiple array item groups.
|
|
1193
|
+
* @returns Index of the currently selected array item.
|
|
1194
|
+
*
|
|
1195
|
+
* @example
|
|
1196
|
+
* ```ts
|
|
1197
|
+
* import { element } from '@wix/editor';
|
|
1198
|
+
*
|
|
1199
|
+
* const index = await element.getArrayItemsSelectedIndex();
|
|
1200
|
+
* ```
|
|
1201
|
+
*/
|
|
808
1202
|
async getArrayItemsSelectedIndex(options) {
|
|
809
1203
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
810
1204
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -814,6 +1208,19 @@
|
|
|
814
1208
|
options
|
|
815
1209
|
);
|
|
816
1210
|
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Sets the selected index in an array items data group.
|
|
1213
|
+
*
|
|
1214
|
+
* @param options - Object containing the `index` to select, and optionally
|
|
1215
|
+
* `arrayItemsDisplayGroupKey` if there are multiple array item groups.
|
|
1216
|
+
*
|
|
1217
|
+
* @example
|
|
1218
|
+
* ```ts
|
|
1219
|
+
* import { element } from '@wix/editor';
|
|
1220
|
+
*
|
|
1221
|
+
* await element.setArrayItemsSelectedIndex({ index: 2 });
|
|
1222
|
+
* ```
|
|
1223
|
+
*/
|
|
817
1224
|
async setArrayItemsSelectedIndex(options) {
|
|
818
1225
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
819
1226
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -823,6 +1230,19 @@
|
|
|
823
1230
|
options
|
|
824
1231
|
);
|
|
825
1232
|
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Resets the selected index in an array items data group to the default.
|
|
1235
|
+
*
|
|
1236
|
+
* @param options - Specify `arrayItemsDisplayGroupKey` if the component
|
|
1237
|
+
* has multiple array item groups.
|
|
1238
|
+
*
|
|
1239
|
+
* @example
|
|
1240
|
+
* ```ts
|
|
1241
|
+
* import { element } from '@wix/editor';
|
|
1242
|
+
*
|
|
1243
|
+
* await element.resetArrayItemsSelectedIndex();
|
|
1244
|
+
* ```
|
|
1245
|
+
*/
|
|
826
1246
|
async resetArrayItemsSelectedIndex(options) {
|
|
827
1247
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
828
1248
|
const manifestContextId = await this.getRequiredManifestContextId();
|
|
@@ -832,6 +1252,18 @@
|
|
|
832
1252
|
options
|
|
833
1253
|
);
|
|
834
1254
|
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Retrieves the BI (Business Intelligence) token for the component.
|
|
1257
|
+
*
|
|
1258
|
+
* @returns BI token string.
|
|
1259
|
+
*
|
|
1260
|
+
* @example
|
|
1261
|
+
* ```ts
|
|
1262
|
+
* import { element } from '@wix/editor';
|
|
1263
|
+
*
|
|
1264
|
+
* const token = await element.getBiToken();
|
|
1265
|
+
* ```
|
|
1266
|
+
*/
|
|
835
1267
|
async getBiToken() {
|
|
836
1268
|
const privateAPI = await this.getPlatformPrivateAPI();
|
|
837
1269
|
const manifestContextId = await this.getRequiredManifestContextId();
|