From 59daefa941e3fb2b2c590a58a8872c9ea8cfb519 Mon Sep 17 00:00:00 2001 From: frostime Date: Tue, 30 Apr 2024 16:15:58 +0800 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20update=20siyuan:=20add=20`?= =?UTF-8?q?direction`=20parameter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- README_zh_CN.md | 2 +- package.json | 6 +++--- plugin.json | 4 ++-- src/index.ts | 1 + src/libs/setting-utils.ts | 6 +++++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3c233a7..09c8cdd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [中文版](./README_zh_CN.md) -> Consistent with [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.4](https://github.com/siyuan-note/plugin-sample/tree/v0.3.4) +> Consistent with [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.5](https://github.com/siyuan-note/plugin-sample/tree/v0.3.5) diff --git a/README_zh_CN.md b/README_zh_CN.md index 1510f9b..ca35f7c 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -4,7 +4,7 @@ [English](./README.md) -> 本例同 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.4](https://github.com/siyuan-note/plugin-sample/tree/v0.3.4) +> 本例同 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.5](https://github.com/siyuan-note/plugin-sample/tree/v0.3.5) 1. 使用 vite 打包 2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发 diff --git a/package.json b/package.json index 4bccd57..44cdd78 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "plugin-sample-vite-svelte", - "version": "0.3.2", + "version": "0.3.5", "type": "module", "description": "This is a sample plugin based on vite and svelte for Siyuan (https://b3log.org/siyuan)", "repository": "", "homepage": "", - "author": "", + "author": "frostime", "license": "MIT", "scripts": { "make-link": "node --no-warnings ./scripts/make_dev_link.js", @@ -23,7 +23,7 @@ "minimist": "^1.2.8", "rollup-plugin-livereload": "^2.0.5", "sass": "^1.63.3", - "siyuan": "0.9.7", + "siyuan": "0.9.8", "svelte": "^4.2.0", "ts-node": "^10.9.1", "typescript": "^5.1.3", diff --git a/plugin.json b/plugin.json index b810268..071b2a3 100644 --- a/plugin.json +++ b/plugin.json @@ -2,8 +2,8 @@ "name": "plugin-sample-vite-svelte", "author": "frostime", "url": "https://github.com/siyuan-note/plugin-sample-vite-svelte", - "version": "0.3.4", - "minAppVersion": "3.0.0", + "version": "0.3.5", + "minAppVersion": "3.0.12", "backends": [ "windows", "linux", diff --git a/src/index.ts b/src/index.ts index 704ad00..4af2041 100644 --- a/src/index.ts +++ b/src/index.ts @@ -235,6 +235,7 @@ export default class PluginSample extends Plugin { type: "slider", title: "Slider text", description: "Slider description", + direction: "column", slider: { min: 0, max: 100, diff --git a/src/libs/setting-utils.ts b/src/libs/setting-utils.ts index 2a3926b..e611ce8 100644 --- a/src/libs/setting-utils.ts +++ b/src/libs/setting-utils.ts @@ -3,7 +3,7 @@ * @Author : frostime * @Date : 2023-12-17 18:28:19 * @FilePath : /src/libs/setting-utils.ts - * @LastEditTime : 2024-04-30 15:50:07 + * @LastEditTime : 2024-04-30 16:09:54 * @Description : */ @@ -222,6 +222,7 @@ export class SettingUtils { this.plugin.setting.addItem({ title: item.title, description: item?.description, + direction: item?.direction, createActionElement: () => { this.updateElementFromValue(item.key); let element = this.getElement(item.key); @@ -232,6 +233,7 @@ export class SettingUtils { this.plugin.setting.addItem({ title: item.title, description: item?.description, + direction: item?.direction, createActionElement: () => { let val = this.get(item.key); let element = item.createElement(val); @@ -334,6 +336,7 @@ export class SettingUtils { private updateValueFromElement(key: string) { let item = this.settings.get(key); + if (item.type === 'button') return; let element = this.elements.get(key) as any; item.value = valueOf(element); // switch (item.type) { @@ -360,6 +363,7 @@ export class SettingUtils { private updateElementFromValue(key: string) { let item = this.settings.get(key); + if (item.type === 'button') return; let element = this.elements.get(key) as any; setValue(element, item.value); // switch (item.type) {