Skip to content

Commit c179519

Browse files
committed
✨ feat: Add input number element in setting-utils
1 parent 50a2286 commit c179519

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/libs/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type TSettingItemType = "checkbox" | "select" | "textinput" | "textarea" | "slider" | "button";
1+
type TSettingItemType = "checkbox" | "select" | "textinput" | "textarea" | "number" | "slider" | "button";
22
interface ISettingItem {
33
key: string;
44
value: any;

src/libs/setting-utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @Author : frostime
44
* @Date : 2023-09-16 18:05:00
55
* @FilePath : /src/libs/setting-utils.ts
6-
* @LastEditTime : 2023-11-28 21:46:29
6+
* @LastEditTime : 2023-12-28 18:10:12
77
* @Description : A utility for siyuan plugin settings
88
*/
99

@@ -130,6 +130,13 @@ export class SettingUtils {
130130
textareaElement.value = item.value;
131131
itemElement = textareaElement;
132132
break;
133+
case 'number':
134+
let numberElement: HTMLInputElement = document.createElement('input');
135+
numberElement.type = 'number';
136+
numberElement.className = 'b3-text-field fn__flex-center fn__size200';
137+
numberElement.value = item.value;
138+
itemElement = numberElement;
139+
break;
133140
case 'button':
134141
let buttonElement: HTMLButtonElement = document.createElement('button');
135142
buttonElement.className = "b3-button b3-button--outline fn__flex-center fn__size200";

0 commit comments

Comments
 (0)