Skip to content

Commit

Permalink
Merge pull request #23 from obgnail/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
obgnail authored Jul 24, 2023
2 parents cce91d2 + 04e5fa3 commit 99b48e3
Show file tree
Hide file tree
Showing 7 changed files with 858 additions and 20 deletions.
48 changes: 31 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@

| 序号 | 文件名 | 功能 | 默认开启 |
| ---- | ------------------ | -------------------------------- | -------- |
| 1 | search_multi | 全局多关键字搜索 ||
| 2 | window_tab | 标签页管理 ||
| 3 | md_padding | 中文与英文、数字之间添加空格 ||
| 4 | commander | 命令行环境 ||
| 5 | read_only | 只读模式 ||
| 6 | collapse_paragraph | 章节折叠 ||
| 7 | fence_enhance | 一键复制代码,折叠代码 ||
| 8 | resize_table | 调整表格行高列宽 ||
| 9 | resize_image | 调整图片显示大小 ||
| 10 | go_top | 一键到文章顶部 ||
| 11 | file_counter | 显示目录下的文件数 ||
| 12 | truncate_text | 暂时隐藏内容,提高大文件渲染性能 ||
| 13 | right_click_menu | 右键菜单统一管理、调用插件 ||
| 14 | mermaid_replace | 替换 mermaid 组件 ||
| 15 | old_window_tab | 标签页管理(已废弃) ||
| 1 | window_tab | 标签页管理 ||
| 2 | search_multi | 全局多关键字搜索 ||
| 3 | multi_highlighter | 多关键字高亮 ||
| 4 | md_padding | 中文与英文、数字之间添加空格 ||
| 5 | commander | 命令行环境 ||
| 6 | read_only | 只读模式 ||
| 7 | collapse_paragraph | 章节折叠 ||
| 8 | fence_enhance | 一键复制代码,折叠代码 ||
| 9 | file_counter | 显示目录下的文件数 ||
| 10 | resize_table | 调整表格行高列宽 ||
| 11 | resize_image | 调整图片显示大小 ||
| 12 | go_top | 一键到文章顶部 ||
| 13 | truncate_text | 暂时隐藏内容,提高大文件渲染性能 ||
| 14 | right_click_menu | 右键菜单统一管理、调用插件 ||
| 15 | mermaid_replace | 替换 mermaid 组件 ||
| 16 | old_window_tab | 标签页管理(已废弃) ||

> 每个功能都对应源码的 plugin 文件夹下的一个同名文件(index.js 除外),**如若不需要某些功能,按需删除文件即可**
Expand Down Expand Up @@ -90,7 +91,7 @@ JSBridge.invoke('executeJavaScript', 1, "_myValue=123; JSBridge.invoke('executeJ
- ArrowUp,ArrowDown:方向键上下选中
- click、ctrl+enter:当前窗口打开
- ctrl+click、ctrl+shift+enter:新窗口打开
- drag:拖动输入框可移动搜索框
- ctrl+drag:ctrl+拖动输入框可移动

> ctrl 在 Mac 中对应 command
Expand All @@ -110,6 +111,19 @@ JSBridge.invoke('executeJavaScript', 1, "_myValue=123; JSBridge.invoke('executeJ



## multi_highlighter:多关键字高亮

![multi_highlighter](assets/multi_highlighter.png)

- ctrl+shift+H:打开搜索框
- esc:关闭搜索框
- enter:搜索
- ctrl+drag:ctrl+拖动输入框可移动
- left click:定位到下一个关键字
- right click:定位到上一个关键字



### md_padding:盘古之白

中英文混排时,中文与英文之间、中文与数字之间添加空格。
Expand All @@ -134,7 +148,7 @@ JSBridge.invoke('executeJavaScript', 1, "_myValue=123; JSBridge.invoke('executeJ

- ctrl+G:弹出执行框
- esc:隐藏执行框
- drag:拖动输入框可移动
- ctrl+drag:ctrl+拖动输入框可移动

支持 shell:

Expand Down
Binary file added assets/multi_highlighter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion plugin/commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
margin-left: 0;
margin-right: 2.5px;
padding-left: 5px;
padding-right: 5px;
padding-right: 24px;
}
#typora-commander-form select {
Expand Down Expand Up @@ -321,12 +321,14 @@

if (config.ALLOW_DRAG) {
modal.input.addEventListener("mousedown", ev => {
if (!metaKeyPressed(ev)) return;
ev.stopPropagation();
const rect = modal.modal.getBoundingClientRect();
const shiftX = ev.clientX - rect.left;
const shiftY = ev.clientY - rect.top;

const onMouseMove = ev => {
if (!metaKeyPressed(ev)) return;
ev.stopPropagation();
ev.preventDefault();
requestAnimationFrame(() => {
Expand All @@ -336,6 +338,7 @@
}

document.addEventListener("mouseup", ev => {
if (!metaKeyPressed(ev)) return;
ev.stopPropagation();
ev.preventDefault();
document.removeEventListener('mousemove', onMouseMove);
Expand Down
10 changes: 9 additions & 1 deletion plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ window.onload = () => {
call_args: null,
},
{
name: "多关键字搜索",
name: "全局多关键字搜索",
src: "./plugin/search_multi.js",
enable: true,
clickable: true,
call: null,
call_args: null,
},
{
name: "多关键字高亮",
src: "./plugin/multi_highlighter/index.js",
enable: true,
clickable: true,
call: null,
call_args: null,
},
{
name: "表格大小调整",
src: "./plugin/resize_table.js",
Expand Down
Loading

0 comments on commit 99b48e3

Please sign in to comment.