Skip to content

Commit bdc57ef

Browse files
committed
feat: shortcut for fullscreen in tab
1 parent e37afce commit bdc57ef

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ The label of a draw.io image block can be configured in the plugin settings.
8181

8282
## Changelog
8383

84+
+ v0.5.4
85+
+ Feature: fullscreen support for shortcut in Tab
8486
+ v0.5.3
8587
+ Fix: unable to save when saving large content
8688
+ v0.5.2

README_zh_CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070

7171
## 更新日志
7272

73+
+ v0.5.4
74+
+ 新增功能:Tab支持快捷键全屏
7375
+ v0.5.3
7476
+ 修复缺陷:内容过多时无法保存
7577
+ v0.5.2

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "siyuan-embed-drawio",
3-
"version": "0.5.3",
3+
"version": "0.5.4",
44
"type": "module",
55
"description": "This is a plugin for siyuan",
66
"author": "",

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "siyuan-embed-drawio",
33
"author": "Yuxin Zhao",
44
"url": "https://github.com/YuxinZhaozyx/siyuan-embed-drawio",
5-
"version": "0.5.3",
5+
"version": "0.5.4",
66
"minAppVersion": "3.0.0",
77
"disabledInPublish": true,
88
"backends": [

src/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,24 @@ export default class DrawioPlugin extends Plugin {
544544
}
545545
};
546546

547+
const switchFullscreen = () => {
548+
if (document.fullscreenElement) {
549+
document.exitFullscreen();
550+
} else {
551+
this.element.requestFullscreen();
552+
}
553+
}
554+
const keydownEventHandleer = (event: KeyboardEvent) => {
555+
if (event.key.toLowerCase() === 'y' && (event.altKey || event.metaKey)) {
556+
switchFullscreen();
557+
}
558+
};
559+
547560
window.addEventListener("message", messageEventHandler);
561+
iframe.contentWindow.addEventListener("keydown", keydownEventHandleer);
548562
this.beforeDestroy = () => {
549563
window.removeEventListener("message", messageEventHandler);
564+
iframe.contentWindow.removeEventListener("keydown", keydownEventHandleer);
550565
};
551566
}
552567
});

0 commit comments

Comments
 (0)