Explorar o código

simplify code

Yuki Takei %!s(int64=9) %!d(string=hai) anos
pai
achega
ecde90a0f2
Modificáronse 2 ficheiros con 8 adicións e 5 borrados
  1. 2 1
      resource/js/crowi-form.js
  2. 6 4
      resource/js/crowi.js

+ 2 - 1
resource/js/crowi-form.js

@@ -72,7 +72,8 @@ $(function() {
     crowi.interceptorManager.process('preRenderPreview', context)   // process with the context
       // render HTML with jQuery
       .then(() => {
-        return $('#preview-body').html(context.parsedHTML).promise();
+        $('#preview-body').html(context.parsedHTML);
+        Promise.resolve($('#preview-body'));
       })
       // process interceptors for post rendering
       .then((bodyElement) => {

+ 6 - 4
resource/js/crowi.js

@@ -426,10 +426,8 @@ $(function() {
       crowi.interceptorManager.process('preRender', context)   // process with the context
         // render HTML with jQuery
         .then(() => {
-          return $('#revision-body-content').html(context.parsedHTML).promise();
-        })
-        // process interceptors for post rendering
-        .then((bodyElement) => {
+          $('#revision-body-content').html(context.parsedHTML);
+
           $('.template-create-button').on('click', function() {
             var path = $(this).data('path');
             var templateId = $(this).data('template');
@@ -442,6 +440,10 @@ $(function() {
           Crowi.correctHeaders('#revision-body-content');
           Crowi.revisionToc('#revision-body-content', '#revision-toc');
 
+          Promise.resolve($('#revision-body-content'));
+        })
+        // process interceptors for post rendering
+        .then((bodyElement) => {
           context = Object.assign(context, {bodyElement})
           return crowi.interceptorManager.process('postRender', context);
         });