File tree Expand file tree Collapse file tree 3 files changed +12276
-10947
lines changed
src/yafowil/widget/tiptap/resources Expand file tree Collapse file tree 3 files changed +12276
-10947
lines changed Original file line number Diff line number Diff line change @@ -135,4 +135,36 @@ export class TiptapWidget {
135
135
}
136
136
}
137
137
}
138
- }
138
+ }
139
+
140
+
141
+ //////////////////////////////////////////////////////////////////////////////
142
+ // yafowil.widget.array integration
143
+ //////////////////////////////////////////////////////////////////////////////
144
+
145
+ function tiptap_on_array_add ( inst , context ) {
146
+ TiptapWidget . initialize ( context ) ;
147
+ }
148
+
149
+ function tiptap_on_array_index ( inst , row , index ) {
150
+ $ ( '.div.tiptap-editor' , row ) . each ( function ( ) {
151
+ let trigger = $ ( this ) ,
152
+ ref_name = trigger . data ( 'reference-name' ) ,
153
+ base_id = inst . base_id ( row ) ,
154
+ base_name = base_id . replace ( / \- / g, '.' ) ;
155
+ trigger . data ( 'reference-name' , inst . set_value_index (
156
+ ref_name ,
157
+ base_name ,
158
+ index ,
159
+ '.'
160
+ ) ) ;
161
+ } ) ;
162
+ }
163
+
164
+ $ ( function ( ) {
165
+ if ( yafowil_array === undefined ) {
166
+ return ;
167
+ }
168
+ yafowil_array . on_array_event ( 'on_add' , tiptap_on_array_add ) ;
169
+ yafowil_array . on_array_event ( 'on_index' , tiptap_on_array_index ) ;
170
+ } ) ;
You can’t perform that action at this time.
0 commit comments