Skip to content

Commit

Permalink
🔀 Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Jul 9, 2024
2 parents 4f990b7 + 36ae7b1 commit 6eeb68b
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 146 deletions.
113 changes: 4 additions & 109 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,112 +1,7 @@
# Changelog

## v0.3.5 2024-04-30
## v1.1.0

* [Add `direction` to plugin method `Setting.addItem`](https://github.com/siyuan-note/siyuan/issues/11183)


## 0.3.4 2024-02-20

* [Add plugin event bus `click-flashcard-action`](https://github.com/siyuan-note/siyuan/issues/10318)

## 0.3.3 2024-01-24

* Update dock icon class

## 0.3.2 2024-01-09

* [Add plugin `protyleOptions`](https://github.com/siyuan-note/siyuan/issues/10090)
* [Add plugin api `uninstall`](https://github.com/siyuan-note/siyuan/issues/10063)
* [Add plugin method `updateCards`](https://github.com/siyuan-note/siyuan/issues/10065)
* [Add plugin function `lockScreen`](https://github.com/siyuan-note/siyuan/issues/10063)
* [Add plugin event bus `lock-screen`](https://github.com/siyuan-note/siyuan/pull/9967)
* [Add plugin event bus `open-menu-inbox`](https://github.com/siyuan-note/siyuan/pull/9967)


## 0.3.1 2023-12-06

* [Support `Dock Plugin` and `Command Palette` on mobile](https://github.com/siyuan-note/siyuan/issues/9926)

## 0.3.0 2023-12-05

* Upgrade Siyuan to 0.9.0
* Support more platforms

## 0.2.9 2023-11-28

* [Add plugin method `openMobileFileById`](https://github.com/siyuan-note/siyuan/issues/9738)


## 0.2.8 2023-11-15

* [`resize` cannot be triggered after dragging to unpin the dock](https://github.com/siyuan-note/siyuan/issues/9640)

## 0.2.7 2023-10-31

* [Export `Constants` to plugin](https://github.com/siyuan-note/siyuan/issues/9555)
* [Add plugin `app.appId`](https://github.com/siyuan-note/siyuan/issues/9538)
* [Add plugin event bus `switch-protyle`](https://github.com/siyuan-note/siyuan/issues/9454)

## 0.2.6 2023-10-24

* [Deprecated `loaded-protyle` use `loaded-protyle-static` instead](https://github.com/siyuan-note/siyuan/issues/9468)

## 0.2.5 2023-10-10

* [Add plugin event bus `open-menu-doctree`](https://github.com/siyuan-note/siyuan/issues/9351)

## 0.2.4 2023-09-19

* Supports use in windows
* [Add plugin function `transaction`](https://github.com/siyuan-note/siyuan/issues/9172)

## 0.2.3 2023-09-05

* [Add plugin function `transaction`](https://github.com/siyuan-note/siyuan/issues/9172)
* [Plugin API add openWindow and command.globalCallback](https://github.com/siyuan-note/siyuan/issues/9032)

## 0.2.2 2023-08-29

* [Add plugin event bus `destroy-protyle`](https://github.com/siyuan-note/siyuan/issues/9033)
* [Add plugin event bus `loaded-protyle-dynamic`](https://github.com/siyuan-note/siyuan/issues/9021)

## 0.2.1 2023-08-21

* [Plugin API add getOpenedTab method](https://github.com/siyuan-note/siyuan/issues/9002)
* [Plugin API custom.fn => custom.id in openTab](https://github.com/siyuan-note/siyuan/issues/8944)

## 0.2.0 2023-08-15

* [Add plugin event bus `open-siyuan-url-plugin` and `open-siyuan-url-block`](https://github.com/siyuan-note/siyuan/pull/8927)


## 0.1.12 2023-08-01

* Upgrade siyuan to 0.7.9

## 0.1.11

* [Add `input-search` event bus to plugins](https://github.com/siyuan-note/siyuan/issues/8725)


## 0.1.10

* [Add `bind this` example for eventBus in plugins](https://github.com/siyuan-note/siyuan/issues/8668)
* [Add `open-menu-breadcrumbmore` event bus to plugins](https://github.com/siyuan-note/siyuan/issues/8666)

## 0.1.9

* [Add `open-menu-xxx` event bus for plugins ](https://github.com/siyuan-note/siyuan/issues/8617)

## 0.1.8

* [Add protyleSlash to the plugin](https://github.com/siyuan-note/siyuan/issues/8599)
* [Add plugin API protyle](https://github.com/siyuan-note/siyuan/issues/8445)

## 0.1.7

* [Support build js and json](https://github.com/siyuan-note/plugin-sample/pull/8)

## 0.1.6

* add `fetchPost` example
- ✨ feat: 显示隐藏书签组的时候加入过渡动画
- 🐛 fix: 修复重复设置 err item 的 title 属性的恶性 bug
- ✨ feat: 显示失效项目的内部细节
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sy-bookmark-plus",
"version": "1.0.1",
"version": "1.1.0",
"type": "module",
"description": "A more powerful bookmark",
"repository": "",
Expand Down Expand Up @@ -31,5 +31,8 @@
"vite-plugin-solid": "^2.10.2",
"vite-plugin-static-copy": "^1.0.5",
"vite-plugin-zip-pack": "^1.2.2"
},
"dependencies": {
"solid-transition-group": "^0.2.3"
}
}
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sy-bookmark-plus",
"author": "frostime",
"url": "https://github.com/frostime/sy-bookmark-plus",
"version": "1.0.1",
"version": "1.1.0",
"minAppVersion": "3.0.12",
"backends": [
"windows",
Expand Down
3 changes: 2 additions & 1 deletion public/i18n/en_US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msg:
groupNameEmpty: The name of the bookmark group cannot be empty!
itemErr:
closed: 'The notebook "{0}" is already closed'
deleted: 'Content block not found, it may have been deleted! Old block content: {0}'
deleted: 'Content block not found, it may have been deleted! Old block content: [{0}]'
setting:
replaceDefault:
title: Replace Built-in Bookmarks
Expand Down Expand Up @@ -73,6 +73,7 @@ item:
top: Move to Top
bottom: Move to Bottom
del: Delete Bookmark
checkerritem: Check detail
newgroup:
name:
- Bookmark Group Name
Expand Down
3 changes: 2 additions & 1 deletion public/i18n/zh_CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msg:
groupNameEmpty: 书签组的名称不能为空!
itemErr:
closed: '笔记本「{0}」已经关闭'
deleted: '无法找到内容块,可能已经被删除!旧块内容{0}'
deleted: '无法找到内容块,可能已经被删除!旧块内容: 「{0}'
setting:
replaceDefault:
title: 替换内置书签
Expand Down Expand Up @@ -73,6 +73,7 @@ item:
top: 置顶
bottom: 置底
del: 删除书签
checkerritem: 查看失效项详情
newgroup:
name:
- 书签组名称
Expand Down
63 changes: 44 additions & 19 deletions src/components/group.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Component, createEffect, createMemo, createSignal, Match, useContext } from "solid-js";
import { Component, createEffect, createMemo, createSignal, Match, useContext, Show } from "solid-js";
import { For, Switch } from "solid-js";
import { Transition } from "solid-transition-group";

import { Menu, Constants, confirm, showMessage } from "siyuan";
import Item from "./item";
// import { inputDialogSync } from "@/libs/dialog";
import inputDialog from '@/libs/components/input-dialog';
import { groups, setGroups, configs, itemInfo } from "../model";
import { ClassName } from "../libs/dom";

import { getBlockByID } from "@/api";
import inputDialog from '@/libs/components/input-dialog';
import { ClassName } from "@/libs/dom";
import { i18n, renderI18n } from "@/utils/i18n";

import Item from "./item";
import { groups, setGroups, configs, itemInfo } from "../model";
import { BookmarkContext, itemMoving, setItemMoving, groupDrop, setGroupDrop } from "./context";

import { i18n, renderI18n } from "@/utils/i18n";


interface Props {
group: IBookmarkGroup;
Expand Down Expand Up @@ -368,7 +369,6 @@ const Group: Component<Props> = (props) => {
}

const svgArrowClass = () => isOpen() ? "b3-list-item__arrow--open" : "";
const itemsClass = () => isOpen() ? "" : "fn__none";

return (
<section
Expand Down Expand Up @@ -425,17 +425,42 @@ const Group: Component<Props> = (props) => {
</span>
<span class="counter">{shownItems().length}</span>
</li>
<ul
class={`custom-bookmark-group-list ${itemsClass()}`}
data-groupid={props.group.id}
data-groupname={props.group.name}
<Transition
onExit={(el, done) => {
const a = el.animate({
opacity: [1, 0],
transform: ['translateY(0)', 'translateY(-10px)'], //向上移动
}, {
duration: 120,
easing: 'ease-in-out'
});
a.finished.then(done);
}}
onEnter={(el, done) => {
const a = el.animate({
opacity: [0, 1],
transform: ['translateY(-10px)', 'translateY(0)'], //向下移动
}, {
duration: 120,
easing: 'ease-in-out'
});
a.finished.then(done);
}}
>
<For each={shownItems()}>
{(item: IItemCore) => (
<Item group={props.group.id} itemCore={item} deleteItem={itemDelete} />
)}
</For>
</ul>
<Show when={isOpen()}>
<ul
class="custom-bookmark-group-list"
data-groupid={props.group.id}
data-groupname={props.group.name}
>
<For each={shownItems()}>
{(item: IItemCore) => (
<Item group={props.group.id} itemCore={item} deleteItem={itemDelete} />
)}
</For>
</ul>
</Show>
</Transition>
</section>
);
};
Expand Down
31 changes: 31 additions & 0 deletions src/components/item.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, createEffect, createMemo, createSignal, useContext } from "solid-js";
import { render } from "solid-js/web";
import { Menu, openTab, showMessage } from "siyuan";
import { buildItemDetail } from "../libs/dom";

Expand All @@ -7,6 +8,8 @@ import { itemInfo, setGroups, groupMap } from "../model";
import { BookmarkContext, itemMoving, setItemMoving } from "./context";

import { i18n } from "@/utils/i18n";
import { simpleDialog } from "@/libs/dialog";
import Typography from "@/libs/components/typography";

interface IProps {
group: TBookmarkGroupId;
Expand Down Expand Up @@ -38,6 +41,25 @@ const setStyleBtn = (key: string, label: string): HTMLElement => {
return div.firstElementChild as HTMLElement;
}

const showErrItem = (item: IBookmarkItemInfo) => {
const markdown = `
- **ID**: ${item.id}
- **Box**: ${item.box}
- **Type**: ${item.type}
- **Subtype**: ${item.subtype}
- **Title**: ${item.title}
`;
let element = document.createElement('div');
// element.style.display = 'contents';
element.style.padding = '10px';
render(() => <Typography markdown={markdown} fontSize="18px"/>, element);
simpleDialog({
title: `<span style="font-weight: bold; color: var(--b3-theme-error);">${item.err}</span>`,
ele: element,
width: '640px'
});
}


const Item: Component<IProps> = (props) => {
const item = () => itemInfo[props.itemCore.id];
Expand Down Expand Up @@ -91,6 +113,15 @@ const Item: Component<IProps> = (props) => {
const showItemContextMenu = (e: MouseEvent) => {
e.stopPropagation();
const menu = new Menu();
if (item().err) {
menu.addItem({
label: i18n_.checkerritem,
icon: "iconBug",
click: () => {
showErrItem(item());
},
});
}
menu.addItem({
label: i18n_.copyref,
icon: "iconRef",
Expand Down
16 changes: 8 additions & 8 deletions src/libs/components/typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
* @Author : frostime
* @Date : 2024-03-25 14:19:10
* @FilePath : /src/libs/components/typography.tsx
* @LastEditTime : 2024-06-13 11:08:52
* @LastEditTime : 2024-07-09 21:08:27
* @Description :
*/
import { Dynamic } from "solid-js/web";


const Typography = (props: {markdown: string, fontSize?: string;}) => {
const Typography = (props: { markdown: string, fontSize?: string; }) => {
const lute = window.Lute!.New();
let content = lute.Md2HTML(props.markdown);
let font = props.fontSize ? `${props.fontSize} !important;` : 'initial';
return (
<div class="item__readme b3-typography" style={{
'font-size': props.fontSize ?? 'initial'
}}>
<Dynamic component={content}/>
</div>
<div
class="item__readme b3-typography"
innerHTML={content}
style={`font-size: ${font}`}
/>
);
}

Expand Down
9 changes: 3 additions & 6 deletions src/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,16 @@ export class BookmarkDataModel {
err: ''
}
if (notebookMap?.[item.box]?.closed === true) {
// obj.title = `笔记本「${notebookMap[item.box].name}」已经关闭`;
obj.title = renderI18n(i18n.itemErr.closed, notebookMap[item.box].name);
obj.err = 'BoxClosed';
} else {
// obj.title = `无法找到内容块,可能已经被删除!旧块内容:${JSON.stringify(item)}`;
obj.title = renderI18n(i18n.itemErr.deleted, JSON.stringify(item));

obj.title = renderI18n(i18n.itemErr.deleted, item.title);
obj.err = 'BlockDeleted';
}
if (item.err === obj.err) return; //防止多次刷新失效的 item 导致 title 变得巨长无比
batch(() => {
setItemInfo(id, 'title', obj.title);
//@ts-ignore
setItemInfo(id, 'err', obj.err);
setItemInfo(id, 'err', obj.err as ("BoxClosed" | "BlockDeleted"));
});
}
// ItemInfoStore[id].set({ ...item });
Expand Down

0 comments on commit 6eeb68b

Please sign in to comment.