Skip to content

Commit e89feef

Browse files
committed
Use yafowil_array.inside_template API to check whether widget gets initialized inside array template.
1 parent 107b362 commit e89feef

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

js/src/widget.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export class TiptapWidget {
66
static initialize(context) {
77
$('div.tiptap-editor', context).each(function() {
88
let elem = $(this);
9-
if (elem.parents('.arraytemplate').length) {
9+
if (window.yafowil_array !== undefined &&
10+
window.yafowil_array.inside_template(elem)) {
1011
return;
1112
}
1213
new TiptapWidget(elem, {

js/tests/test_widget.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ QUnit.module('TiptapWidget', hooks => {
7272
window.yafowil_array = {
7373
on_array_event: function(evt_name, evt_function) {
7474
_array_subscribers[evt_name] = evt_function;
75+
},
76+
inside_template(elem) {
77+
return elem.parents('.arraytemplate').length > 0;
7578
}
7679
};
7780
register_array_subscribers();

0 commit comments

Comments
 (0)