Browse Source

Add rich text for step descriptions

Angus McLeod 7 years ago
parent
commit
d14db3678a

+ 2 - 2
assets/javascripts/discourse/templates/components/wizard-custom-step.hbs

@@ -34,12 +34,12 @@
   </div>
 </div>
 
-<div class="setting">
+<div class="setting full">
   <div class="setting-label">
     <h3>{{i18n 'admin.wizard.step.description'}}</h3>
   </div>
   <div class="setting-value">
-    {{textarea name="description" value=step.description placeholder=(i18n "admin.wizard.custom_text_placeholder")}}
+    {{d-editor value=step.description placeholder="admin.wizard.custom_text_placeholder"}}
   </div>
 </div>
 

+ 6 - 0
assets/stylesheets/wizard/wizard_custom.scss

@@ -47,6 +47,12 @@
   .wizard-column .wizard-field .input-area {
     margin: 0.5em 0;
   }
+
+  img.emoji {
+    width: 20px;
+    height: 20px;
+    vertical-align: middle;
+  }
 }
 
 .step-message {

+ 18 - 0
assets/stylesheets/wizard_custom_admin.scss

@@ -60,10 +60,28 @@
         margin-top: 5px;
         display: block;
       }
+
+      .d-editor {
+        width: 100%;
+
+        .d-editor-input {
+          height: 100px;
+        }
+
+        button {
+          margin: 0;
+        }
+      }
     }
 
     &.full {
       width: 100%;
+
+      .setting-value {
+        width: initial;
+        overflow: hidden;
+        float: none;
+      }
     }
 
     label {

+ 6 - 0
controllers/admin.rb

@@ -75,6 +75,12 @@ class CustomWizard::AdminController < ::ApplicationController
 
     return render json: { error: error } if error
 
+    ## end of error checks
+
+    wizard['steps'].each do |s|
+      s['description'] = PrettyText.cook(s['description']) if s['description']
+    end
+
     existing = PluginStore.get('custom_wizard', wizard['id']) || {}
     new_time = existing['after_time_scheduled'] ?
                after_time_scheduled != Time.parse(existing['after_time_scheduled']).utc :