UX: prevents checkboxes from changing width

UX: prevents checkboxes from changing width
From e9398520f12efa2988edd7da9fe9d3ab92e46c99 Mon Sep 17 00:00:00 2001
From: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Date: Fri, 7 Sep 2018 17:24:22 +0200
Subject: [PATCH] UX: prevents checkboxes from changing width


diff --git a/assets/javascripts/discourse/initializers/checklist.js.es6 b/assets/javascripts/discourse/initializers/checklist.js.es6
index 0951df6..b61b59d 100644
--- a/assets/javascripts/discourse/initializers/checklist.js.es6
+++ b/assets/javascripts/discourse/initializers/checklist.js.es6
@@ -28,7 +28,7 @@ export function checklistSyntax($elem, post)
       var elem = $(ev.currentTarget),
         new_value = elem.hasClass("checked") ? "[ ]": "[\\*]";
 
-      elem.after('<i class="fa fa-spinner fa-spin"></i>');
+      elem.after('<i class="fa fa-spinner fa-spin fa-fw"></i>');
       elem.hide();
 
       var postId = viewPost.id;
diff --git a/assets/javascripts/lib/discourse-markdown/checklist.js.es6 b/assets/javascripts/lib/discourse-markdown/checklist.js.es6
index 5fd297e..160df37 100644
--- a/assets/javascripts/lib/discourse-markdown/checklist.js.es6
+++ b/assets/javascripts/lib/discourse-markdown/checklist.js.es6
@@ -5,15 +5,15 @@ const REGEX = /\[(\s?|_|-|x|\*)\]/ig;
 function getClasses(str) {
   switch(str.toLowerCase()) {
     case "x":
-      return "checked fa fa-check-square";
+      return "checked fa fa-check-square fa-fw";
     case "*":
-      return "checked fa fa-check-square-o";
+      return "checked fa fa-check-square-o fa-fw";
     case "-":
-      return "fa fa-minus-square-o";
+      return "fa fa-minus-square-o fa-fw";
     case "_":
-      return "fa fa-square";
+      return "fa fa-square fa-fw";
     default:
-      return "fa fa-square-o";
+      return "fa fa-square-o fa-fw";
   }
 }
 
@@ -90,13 +90,13 @@ export function setup(helper) {
   });
 
   helper.whiteList([ 'span.chcklst-stroked',
-                     'span.chcklst-box fa fa-square-o',
-                     'span.chcklst-box fa fa-square',
-                     'span.chcklst-box fa fa-minus-square-o',
-                     'span.chcklst-box checked fa fa-check-square',
-                     'span.chcklst-box checked fa fa-check-square-o' ]);
+                     'span.chcklst-box fa fa-square-o fa-fw',
+                     'span.chcklst-box fa fa-square fa-fw',
+                     'span.chcklst-box fa fa-minus-square-o fa-fw',
+                     'span.chcklst-box checked fa fa-check-square fa-fw',
+                     'span.chcklst-box checked fa fa-check-square-o fa-fw' ]);
 
   helper.registerPlugin(md =>{
     md.core.ruler.push('checklist', processChecklist);
   });
-}
\ No newline at end of file
+}

GitHub

1 Like