Skip to content

Commit 0b3c556

Browse files
committed
[fix] 2 compatibility bugs of non-DOM JS runtime
1 parent c6f53bc commit 0b3c556

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "edkit",
3-
"version": "1.2.4",
3+
"version": "1.2.5",
44
"license": "LGPL-3.0",
55
"author": "shiy2008@gmail.com",
66
"contributors": [

source/Tool.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export abstract class Tool {
2020

2121
return (
2222
!command ||
23+
!globalThis.document ||
2324
document.queryCommandSupported(command) ||
2425
document.queryCommandEnabled(command)
2526
);
@@ -36,7 +37,8 @@ export abstract class Tool {
3637
box.matches(tags.map(tag => `${tag}, ${tag} *`).join(', '))
3738
);
3839
}
39-
if (command) return document.queryCommandState(command);
40+
if (command)
41+
return !!globalThis.document && document.queryCommandState(command);
4042

4143
return false;
4244
}

0 commit comments

Comments
 (0)