MDL-67654 mod_forum: formchangechecker for discussion inline replies.
[moodle.git] / mod / forum / amd / src / discussion_nested_v2.js
index 6c0e89c..1b8f3d2 100644 (file)
@@ -245,6 +245,21 @@ const buildShowInPageReplyFormFunction = (additionalTemplateContext) => {
             } catch (e) {
                 Notification.exception(e);
             }
+
+            // Load formchangechecker module.
+            import('core/yui')
+                .then(Y => {
+                    return new Promise(resolve => {
+                        Y.use('moodle-core-formchangechecker', Y => {
+                            resolve(Y);
+                        });
+                    });
+                })
+                .then(Y => {
+                    M.core_formchangechecker.init({formid: Y.one(postContainer[0].querySelector('form')).generateID()});
+                    return Y;
+                })
+                .catch();
         }
 
         inPageReplyCreateButton.fadeOut(ANIMATION_DURATION, () => {