Skip to content

Commit

Permalink
Merge pull request #132 from obgnail/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
obgnail authored Aug 31, 2023
2 parents 0849865 + 8c2f43d commit aa279c9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

> 目前此方法仅限 windows 平台。
1. 下载插件源码
1. [下载](https://github.com/obgnail/typora_plugin/releases)插件源码

2. 进入 Typora 安装路径,找到包含 `window.html` 的文件夹 A。(一般是 `Typora/resources/app/window.html` 或者 `Typora/resources/window.html`

Expand All @@ -65,7 +65,7 @@

## 如何使用:方法二(手动)

1. 下载插件源码
1. [下载](https://github.com/obgnail/typora_plugin/releases)插件源码
2. 进入 Typora 安装路径,找到包含 `window.html` 的文件夹 A。(一般是 `Typora/resources/app/window.html` 或者 `Typora/resources/window.html`,推荐使用 everything 找一下)
3. 打开文件夹 A,将源码的 plugin 文件夹粘贴进该文件夹下。
4. 打开文件 `A/window.html`。搜索文件内容 `<script src="./app/window/frame.js" defer="defer"></script>` 或者 `<script src="./appsrc/window/frame.js" defer="defer"></script>`,并在 **后面** 加入 `<script src="./plugin/index.js" defer="defer"></script>`。保存。
Expand Down
2 changes: 1 addition & 1 deletion plugin/custom/plugins/templater.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ date: {{date}} {{weekday}}
# {{date}} Task List
## Todo
- task1(task describtion)
- task1(task description)
- task2
- task3
Expand Down
34 changes: 16 additions & 18 deletions plugin/window_tab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class windowTabBarPlugin extends global._basePlugin {
filePath && this.openTab(filePath);
});

this.utils.loopDetector(() => !!document.querySelector("header").getBoundingClientRect().height, this.adjustTop);
setTimeout(this.adjustTop, this.config.LOOP_DETECT_INTERVAL);

if (this.config.DRAG_STYLE === 1) {
this.sort1();
Expand Down Expand Up @@ -281,26 +281,24 @@ class windowTabBarPlugin extends global._basePlugin {
}

adjustTop = () => {
setTimeout(() => {
const windowTab = document.querySelector("#plugin-window-tab");
if (!this.config.HIDE_WINDOW_TITLE_BAR) {
const {height, top} = document.querySelector("header").getBoundingClientRect();
windowTab.style.top = height + top + "px";
}
const windowTab = document.querySelector("#plugin-window-tab");
if (!this.config.HIDE_WINDOW_TITLE_BAR) {
const {height, top} = document.querySelector("header").getBoundingClientRect();
windowTab.style.top = height + top + "px";
}

if (this.config.CHANGE_CONTENT_TOP) {
const {height, top} = windowTab.getBoundingClientRect();
document.querySelector("content").style.top = top + height + "px";
document.querySelector("#typora-source").style.top = top + height + "px";
}
if (this.config.CHANGE_CONTENT_TOP) {
const {height, top} = windowTab.getBoundingClientRect();
document.querySelector("content").style.top = top + height + "px";
document.querySelector("#typora-source").style.top = top + height + "px";
}

if (this.config.CHANGE_NOTIFICATION_Z_INDEX) {
const container = document.querySelector(".md-notification-container");
if (container) {
container.style.zIndex = "99999";
}
if (this.config.CHANGE_NOTIFICATION_Z_INDEX) {
const container = document.querySelector(".md-notification-container");
if (container) {
container.style.zIndex = "99999";
}
}, 200)
}
}

showTabsIfNeed = show => document.querySelector("#plugin-window-tab").style.display = (show) ? "" : "none";
Expand Down

0 comments on commit aa279c9

Please sign in to comment.