Skip to content

Commit

Permalink
🔖 v1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Achuan-2 committed Oct 20, 2024
1 parent 4359341 commit 5345d4f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.1.3 / 2024.10.20
- ✨ 交互优化:选择无样式进行格式刷时,自动关闭悬浮工具栏
- 💄启动格式刷时,信息提示用正常提示,不用报错提示

## v1.1.2 / 2024.10.12
- ✨ 交互优化:打开格式刷模式的时候,弹窗提示如何关闭格式刷
- ✨ 交互优化:右下角dock栏关闭格式刷按钮添加aria-label
Expand Down
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": "siyuan-plugin-formatPainter",
"author": "Achuan-2",
"url": "https://github.com/Achuan-2/siyuan-plugin-formatPainter",
"version": "1.1.2",
"version": "1.1.3",
"minAppVersion": "3.0.12",
"backends": [
"windows",
Expand Down
18 changes: 15 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class PluginSample extends Plugin {
this.formatPainterEnable = true;
document.body.dataset.formatPainterEnable = "true";
// console.log(this.formatData);
fetchPost("/api/notification/pushErrMsg", { "msg": this.i18n.enable, "timeout": 7000 });
fetchPost("/api/notification/pushMsg", { "msg": this.i18n.enable, "timeout": 7000 });

///v dock indicator worker
const indicator = document.querySelector(".siyuan-plugin-formatPainter_brush_indicator");
Expand Down Expand Up @@ -113,7 +113,7 @@ export default class PluginSample extends Plugin {
// Apply the stored format to the selected text
// 如果都为空
this.protyle.toolbar.setInlineMark(this.protyle, "clear", "range");
this.protyle.toolbar.setInlineMark(this.protyle, "text", "range");
// this.protyle.toolbar.setInlineMark(this.protyle, "text", "range");
if (!this.formatData) {
return;
}
Expand Down Expand Up @@ -182,6 +182,18 @@ export default class PluginSample extends Plugin {
// console.log("Format applied to selected text");
// 清空选区
selection.removeAllRanges();
this.protyle.toolbar.range.collapse(true);
// 选择所有具有 .protyle-toolbar 类的元素
const toolbarElements = document.querySelectorAll('.protyle-toolbar');
// 遍历选中的元素
toolbarElements.forEach(element => {
// 检查元素是否没有 .fn__none 类
if (!element.classList.contains('fn__none')) {
// 如果没有 .fn__none 类,则添加它
element.classList.add('fn__none');
}
});

}
}
}
Expand Down Expand Up @@ -353,7 +365,7 @@ export default class PluginSample extends Plugin {
fetchPost("/api/notification/pushMsg", { "msg": this.i18n.disable, "timeout": 7000 });
document.body.dataset.formatPainterEnable = "false";
} else {
fetchPost("/api/notification/pushErrMsg", { "msg": this.i18n.enable, "timeout": 7000 });
fetchPost("/api/notification/pushMsg", { "msg": this.i18n.enable, "timeout": 7000 });
document.body.dataset.formatPainterEnable = "true";
}
this.formatPainterEnable = !this.formatPainterEnable;
Expand Down

0 comments on commit 5345d4f

Please sign in to comment.