Skip to content

Commit

Permalink
✨ 适配性调整
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Jul 7, 2024
1 parent 81ce34e commit d95928c
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 70 deletions.
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@

# SiYuan plugin sample with vite and solidjs

[中文版](./README_zh_CN.md)

> 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)


1. Using vite for packaging
2. Use symbolic linking instead of putting the project into the plugins directory program development
3. Built-in support for the solidjs framework
4. Provides a github action template to automatically generate package.zip and upload to new release
11 changes: 0 additions & 11 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,11 +0,0 @@
# 使用 vite + solidjs 的思源笔记插件示例

[English](./README.md)


> 本例同 [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. 使用符号链接、而不是把项目放到插件目录下的模式进行开发
3. 内置对 solidjs 框架的支持
4. 提供一个github action 模板,能自动生成package.zip并上传到新版本中
76 changes: 39 additions & 37 deletions src/components/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,42 +148,44 @@ const Item: Component<IProps> = (props) => {
]
})
menu.addSeparator();
const groups = shownGroups().filter((g) => g.id !== props.group && g.type !== 'dynamic').map((g) => {
return {
label: g.name,
click: () => {
model.transferItem(props.group, g.id, item());
},
};
});
menu.addItem({
label: "移动到其他分组",
icon: "iconFolder",
type: 'submenu',
submenu: groups
});
menu.addItem({
label: '移动',
icon: 'iconMove',
type: 'submenu',
submenu: [
{
label: "置顶",
icon: "iconTop",
click: () => {
model.reorderItem(props.group, item(), 'top');
}
},
{
label: "置底",
icon: "iconTop",
iconClass: "rotate-180",
if (!inDynamicGroup()) {
const groups = shownGroups().filter((g) => g.id !== props.group && g.type !== 'dynamic').map((g) => {
return {
label: g.name,
click: () => {
model.reorderItem(props.group, item(), 'bottom');
model.transferItem(props.group, g.id, item());
},
};
});
menu.addItem({
label: "移动到其他分组",
icon: "iconFolder",
type: 'submenu',
submenu: groups
});
menu.addItem({
label: '移动',
icon: 'iconMove',
type: 'submenu',
submenu: [
{
label: "置顶",
icon: "iconTop",
click: () => {
model.reorderItem(props.group, item(), 'top');
}
},
{
label: "置底",
icon: "iconTop",
iconClass: "rotate-180",
click: () => {
model.reorderItem(props.group, item(), 'bottom');
}
}
}
]
});
]
});
}
menu.addItem({
label: "删除书签",
icon: "iconTrashcan",
Expand Down Expand Up @@ -233,15 +235,15 @@ const Item: Component<IProps> = (props) => {

const BindDragEvent = {
draggable: true,
onDragStart: onDragStart ,
onDragEnd: onDragEnd ,
onDragStart: onDragStart,
onDragEnd: onDragEnd,
}

return (
<li
class={`b3-list-item b3-list-item--hide-action custom-bookmark-item ${dragovered()}`}
style={`${opacityStyle()} ${props.itemCore?.style ?? ''}`}
{...(inDynamicGroup() ? {draggable: false} : BindDragEvent)}
{...(inDynamicGroup() ? { draggable: false } : BindDragEvent)}
data-node-id={item().id}
data-ref-text=""
data-def-id=""
Expand Down
4 changes: 3 additions & 1 deletion src/components/new-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const NewGroup = (props: IPrpos) => {
case 'attr':
return {
desc: "请输入要查找的属性",
direction: "column",
direction: "row",
input: "textinput"
}

Expand Down Expand Up @@ -123,6 +123,8 @@ const NewGroup = (props: IPrpos) => {
changed={(v) => {
props.setRule({ input: v });
}}
// nofnSize={true}
flex1={ruleType() === 'attr' ? true : false}
/>
</ItemWrap>
</Show>
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Author : frostime
* @Date : 2024-06-12 19:48:53
* @FilePath : /src/index.ts
* @LastEditTime : 2024-07-07 18:05:52
* @LastEditTime : 2024-07-07 18:22:17
* @Description :
*/
import {
Expand Down Expand Up @@ -62,15 +62,15 @@ export default class PluginBookmarkPlus extends Plugin {
`);

this.addDock({
type: '::dock::' + 'Bookmark',
type: '::dock',
config: {
position: 'RightBottom',
size: {
width: 200,
height: 200,
},
icon: 'iconBookmark',
title: 'F-Bookmark'
title: 'Bookmark+'
},
data: {
plugin: this,
Expand All @@ -87,7 +87,7 @@ export default class PluginBookmarkPlus extends Plugin {
langText: 'F-misc 书签',
hotkey: bookmarkKeymap.default,
callback: () => {
const ele = document.querySelector('span[data-type="sy-f-misc::dock::Bookmark"]') as HTMLElement;
const ele = document.querySelector(`span[data-type="${this.name}::dock"]`) as HTMLElement;
ele?.click();
}
});
Expand Down
3 changes: 2 additions & 1 deletion src/libs/components/item-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createSignal } from "solid-js";
interface IProps extends ISettingItemCore {
changed: (v?: any) => void;
nofnSize?: boolean;
flex1?: boolean;
}

export default function InputItem(props: IProps) {
Expand Down Expand Up @@ -36,7 +37,7 @@ export default function InputItem(props: IProps) {
return (
<input
class="b3-text-field fn__flex-center"
classList={{ fn__size200: fn_size }}
classList={{ fn__size200: fn_size, 'fn__flex-1': props.flex1 }}
id={props.key}
placeholder={props.placeholder}
value={value()}
Expand Down
4 changes: 3 additions & 1 deletion src/libs/components/item-wrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const SettingItemWrap: Component<SettingItemWrapProps> = (props) => {
}}>{props.title}</span>
<div class="b3-label__text" innerHTML={props.description}></div>
<div class="fn__hr"></div>
{props?.children}
<div style="display: flex;">
{props?.children}
</div>
</div>
</div>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/style/card-view.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
& .custom-bookmark-item {
margin: 5px 8px;
& span.b3-list-item__toggle {
padding-left: 12px !important;
padding-left: 5px !important;
}
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"useDefineForClassFields": true,
"module": "ESNext",
"lib": [
"ES2020",
"ES2023",
"DOM",
"DOM.Iterable"
],
Expand Down

0 comments on commit d95928c

Please sign in to comment.