浏览代码

improve(plugin): support textarea for settings input item

charlie 3 年之前
父节点
当前提交
3e7c20fd80

+ 1 - 1
libs/src/LSPlugin.ts

@@ -232,7 +232,7 @@ export type SettingSchemaDesc = {
   default: string | number | boolean | Array<any> | object | null
   title: string
   description: string // support markdown
-  inputAs?: 'color' | 'date' | 'datetime-local' | 'range'
+  inputAs?: 'color' | 'date' | 'datetime-local' | 'range' | 'textarea'
   enumChoices?: Array<string>
   enumPicker?: 'select' | 'radio' | 'checkbox' // default: select
 }

+ 6 - 1
src/main/frontend/components/plugins.css

@@ -545,7 +545,12 @@
 
         .form-input {
           padding: 5px;
-          width: 50%;
+          width: 70%;
+        }
+
+        textarea.form-input {
+          overflow-y: auto;
+          resize: vertical;
         }
 
         .form-select {

+ 1 - 1
src/main/frontend/components/plugins_settings.cljs

@@ -25,7 +25,7 @@
 
     (let [input-as (util/safe-lower-case (or inputAs (name type)))
           input-as (if (= input-as "string") :text (keyword input-as))]
-      [:input
+      [(if (= input-as :textarea) :textarea :input)
        {:class        (util/classnames [{:form-input (not (contains? #{:color :range} input-as))}])
         :type         (name input-as)
         :defaultValue (or val default)