PERF: Do not cook on the client & server (#22)

PERF: Do not cook on the client & server (#22)

diff --git a/assets/javascripts/discourse/initializers/checklist.js.es6 b/assets/javascripts/discourse/initializers/checklist.js.es6
index 129c2ca..12974b7 100644
--- a/assets/javascripts/discourse/initializers/checklist.js.es6
+++ b/assets/javascripts/discourse/initializers/checklist.js.es6
@@ -1,6 +1,5 @@
 import { withPluginApi } from "discourse/lib/plugin-api";
 import { ajax } from "discourse/lib/ajax";
-import { cookAsync } from "discourse/lib/text";
 import { iconHTML } from "discourse-common/lib/icon-library";
 
 function initializePlugin(api) {
@@ -11,13 +10,14 @@ function initializePlugin(api) {
   }
 }
 
-export function checklistSyntax($elem, post) {
-  if (!post) {
+export function checklistSyntax($elem, postDecorator) {
+  if (!postDecorator) {
     return;
   }
 
   const $boxes = $elem.find(".chcklst-box");
-  const postModel = post.getModel();
+  const postWidget = postDecorator.widget;
+  const postModel = postDecorator.getModel();
 
   if (!postModel.can_edit) {
     return;
@@ -88,13 +88,17 @@ export function checklistSyntax($elem, post) {
             }
           );
 
-          cookAsync(newRaw).then(cooked =>
-            postModel.save({
-              cooked: cooked.string,
-              raw: newRaw,
-              edit_reason: I18n.t("checklist.edit_reason")
-            })
-          );
+          const save = postModel.save({
+            raw: newRaw,
+            edit_reason: I18n.t("checklist.edit_reason")
+          })
+
+          if (save && save.then) {
+            save.then(() => {
+              postWidget.attrs.isSaving = false;
+              postWidget.scheduleRerender();
+            });
+          }
         }
       );
     });

GitHub sha: 73d14696

This commit appears in #22 which was approved by CvX, eviltrout, and eviltrout. It was merged by markvanlan.