Skip to content

Commit

Permalink
update readme & add custom action feature
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhua committed Jun 26, 2024
1 parent 26c7dfd commit 29d168e
Show file tree
Hide file tree
Showing 26 changed files with 1,195 additions and 652 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_style = space
indent_size = 2
tab_width = 2
44 changes: 22 additions & 22 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,26 @@ After installing and enabling the plugin, you can access the various tools via t

- Select a piece of text in the Obsidian editor, and the PopKit toolset will instantly appear. Click on a tool to use it.

![Usage](./screenshots/usage.gif)

- You can manually invoke the PopKit toolbar using the command "show PopKit" (of course, assigning a shortcut key to this command would be more convenient). Since there might be no selected content at this point, some built-in actions may not be relevant, and the tooltip will exclude those tools.

![Command](./screenshots/command.gif)

- In fact, the PopKit toolbar can display quite dynamic content. As mentioned earlier, it can decide whether to show specific buttons based on whether there is selected text. Additionally, it can perform mathematical calculations, display date and time, count words, and more. Below is an example of mathematical calculations.

![Calculation](./screenshots/conditions.gif)

## Customization

You can customize the tools available in the PopKit toolbar by going to **Settings** > **PopKit** and selecting the tools you want to enable or disable.

- This plugin comes with dozens of tools. To enable the ones you want, simply drag them into the preview toolbar in the settings interface.

- The tools in the preview toolbar can be freely dragged to adjust their order. If you want to remove a tool, simply drag it from the preview toolbar to the delete box.

- In addition to the built-in tools, you can easily add any Obsidian built-in commands or commands registered by enabled plugins as custom tools. To enable a custom tool, simply drag it into the preview toolbar.

## Future Features

- [ ] Allow users to add custom tools.
Expand Down
11 changes: 10 additions & 1 deletion i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@ const en: BaseTranslation = {
},
setting: {
delete: 'Drag the button here to delete',
buildIn: 'Build in actions',
buildIn: 'Buildin actions',
custom: 'Custom actions',
add: 'Add custom action',
divider: 'Divider',
upload: 'Upload',
customTitle: 'Add Custom Action',
addSuccess: 'A custom action has been added successfully',
plugin: 'Source Plugin: ',
command: 'Command: ',
icon: 'Icon: ',
empty: 'No custom actions available yet. You can add them using the form below.',
}
};

Expand Down
76 changes: 74 additions & 2 deletions i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,49 @@ type RootTranslation = {
*/
'delete': string
/**
* B​u​i​l​d​i​n​ ​a​c​t​i​o​n​s
* B​u​i​l​d​i​n​ ​a​c​t​i​o​n​s
*/
buildIn: string
/**
* C​u​s​t​o​m​ ​a​c​t​i​o​n​s
*/
custom: string
/**
* A​d​d​ ​c​u​s​t​o​m​ ​a​c​t​i​o​n
*/
add: string
/**
* D​i​v​i​d​e​r
*/
divider: string
/**
* U​p​l​o​a​d
*/
upload: string
/**
* A​d​d​ ​C​u​s​t​o​m​ ​A​c​t​i​o​n
*/
customTitle: string
/**
* A​ ​c​u​s​t​o​m​ ​a​c​t​i​o​n​ ​h​a​s​ ​b​e​e​n​ ​a​d​d​e​d​ ​s​u​c​c​e​s​s​f​u​l​l​y
*/
addSuccess: string
/**
* S​o​u​r​c​e​ ​P​l​u​g​i​n​:​
*/
plugin: string
/**
* C​o​m​m​a​n​d​:​
*/
command: string
/**
* I​c​o​n​:​
*/
icon: string
/**
* N​o​ ​c​u​s​t​o​m​ ​a​c​t​i​o​n​s​ ​a​v​a​i​l​a​b​l​e​ ​y​e​t​.​ ​Y​o​u​ ​c​a​n​ ​a​d​d​ ​t​h​e​m​ ​u​s​i​n​g​ ​t​h​e​ ​f​o​r​m​ ​b​e​l​o​w​.
*/
empty: string
}
}

Expand Down Expand Up @@ -393,13 +429,49 @@ export type TranslationFunctions = {
*/
'delete': () => LocalizedString
/**
* Build in actions
* Buildin actions
*/
buildIn: () => LocalizedString
/**
* Custom actions
*/
custom: () => LocalizedString
/**
* Add custom action
*/
add: () => LocalizedString
/**
* Divider
*/
divider: () => LocalizedString
/**
* Upload
*/
upload: () => LocalizedString
/**
* Add Custom Action
*/
customTitle: () => LocalizedString
/**
* A custom action has been added successfully
*/
addSuccess: () => LocalizedString
/**
* Source Plugin:
*/
plugin: () => LocalizedString
/**
* Command:
*/
command: () => LocalizedString
/**
* Icon:
*/
icon: () => LocalizedString
/**
* No custom actions available yet. You can add them using the form below.
*/
empty: () => LocalizedString
}
}

Expand Down
9 changes: 9 additions & 0 deletions i18n/zh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ const zh: Translation = {
setting: {
delete: '拖动按钮到此处删除',
buildIn: '内置快捷工具',
custom: '自定义快捷工具',
add: '添加自定义快捷工具',
divider: '分割线',
upload: '上传',
customTitle: '自定义快捷工具',
addSuccess: '自定义快捷工具添加成功',
plugin: '来源插件:',
command: '命令:',
icon: '图标:',
empty: '暂无自定义快捷工具,可以通过下方表单添加。',
}
};

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
"license": "MIT",
"devDependencies": {
"@types/lodash": "^4.17.5",
"@types/node": "^20.14.2",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "7.13.0",
"@typescript-eslint/parser": "7.13.0",
"@typescript-eslint/eslint-plugin": "7.14.1",
"@typescript-eslint/parser": "7.14.1",
"builtin-modules": "3.3.0",
"esbuild": "0.21.5",
"obsidian": "latest",
"tslib": "2.6.3",
"typescript": "5.4.5"
"typescript": "5.5.2"
},
"dependencies": {
"@dnd-kit/core": "^6.1.0",
Expand All @@ -41,10 +41,10 @@
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/base": "5.0.0-beta.40",
"@mui/material": "^5.15.19",
"@mui/material": "^5.15.20",
"dayjs": "^1.11.11",
"lodash": "^4.17.21",
"lucide-react": "^0.394.0",
"lucide-react": "^0.396.0",
"mathjs": "^13.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
Loading

0 comments on commit 29d168e

Please sign in to comment.