@@ -45,21 +45,21 @@ export const closeSelects = () => {
45
45
* @param {string } boxId
46
46
* @param {object } defaultParams
47
47
*/
48
- // export const setSelectValueInElement = ({ boxId, defaultParams }) => {
49
- // for (const [key, { value }] of Object.entries(
50
- // defaultParams[Types.SELECT.type]
51
- // )) {
52
- // // we need to precise paper root because of the minimap duplicate elements
53
- // const el = $(
54
- // `${INTERFACE_ROOT} foreignObject[boxId="${boxId}"] .select[name="${key}"] ${Types.SELECT.tag}`
55
- // );
56
- // if (el.find(":selected").val() != value) {
57
- // $(el)
58
- // .val(value)
59
- // .trigger("change.select2");
60
- // }
61
- // }
62
- // };
48
+ export const setSelectValueInElement = ( { boxId, defaultParams } ) => {
49
+ for ( const [ key , { value } ] of Object . entries (
50
+ defaultParams [ Types . SELECT . type ]
51
+ ) ) {
52
+ // we need to precise paper root because of the minimap duplicate elements
53
+ const el = $ (
54
+ `${ INTERFACE_ROOT } foreignObject[boxId="${ boxId } "] .select[name="${ key } "] ${ Types . SELECT . tag } `
55
+ ) ;
56
+ if ( el . find ( ":selected" ) . val ( ) != value ) {
57
+ $ ( el )
58
+ . val ( value )
59
+ . trigger ( "change.select2" ) ;
60
+ }
61
+ }
62
+ } ;
63
63
64
64
/**
65
65
* set input value in DOM
@@ -68,22 +68,22 @@ export const closeSelects = () => {
68
68
* @param {string } type
69
69
* @param {object } defaultParams
70
70
*/
71
- // export const setInputValueInElement = ({
72
- // boxId,
73
- // type: boxName,
74
- // defaultParams
75
- // }) => {
76
- // for (const [key, { value }] of Object.entries(
77
- // defaultParams[Types.NUMBER.type]
78
- // )) {
79
- // // we need to precise paper root because of the minimap duplicate elements
80
- // const el = $(
81
- // `${INTERFACE_ROOT} foreignObject[boxId="${boxId}"] ${Types.NUMBER.tag}[name="${key}"]`
82
- // );
83
- // el.val(value);
84
- // checkInputValue(el, { boxId, boxName });
85
- // }
86
- // };
71
+ export const setInputValueInElement = ( {
72
+ boxId,
73
+ type : boxName ,
74
+ defaultParams
75
+ } ) => {
76
+ for ( const [ key , { value } ] of Object . entries (
77
+ defaultParams [ Types . NUMBER . type ]
78
+ ) ) {
79
+ // we need to precise paper root because of the minimap duplicate elements
80
+ const el = $ (
81
+ `${ INTERFACE_ROOT } foreignObject[boxId="${ boxId } "] ${ Types . NUMBER . tag } [name="${ key } "]`
82
+ ) ;
83
+ el . val ( value ) ;
84
+ checkInputValue ( el , { boxId, boxName } ) ;
85
+ }
86
+ } ;
87
87
88
88
/**
89
89
* reset value of input or select element
0 commit comments