Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chibat committed Nov 2, 2023
1 parent c56c942 commit 0101de7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions islands/PostEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ export default function Edit(props: { post: Post }) {
}, textarea.current);

useEffect(() => {
if (!preview.value) {
if (preview.value) {
Mousetrap.bind(
"mod+p",
() => {
displayEdit();
return false;
},
);
} else {
Mousetrap(textarea.current).bind(
"mod+enter",
() => {
Expand All @@ -54,14 +62,6 @@ export default function Edit(props: { post: Post }) {
return false;
},
);
} else {
Mousetrap.bind(
"mod+p",
() => {
displayEdit();
return false;
},
);
}
}, [preview.value]);

Expand Down
18 changes: 9 additions & 9 deletions islands/PostNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ export default function Post() {
}, textarea.current);

useEffect(() => {
if (!preview.value) {
if (preview.value) {
Mousetrap.bind(
"mod+p",
() => {
displayEdit();
return false;
},
);
} else {
Mousetrap(textarea.current).bind(
"mod+enter",
() => {
Expand All @@ -51,14 +59,6 @@ export default function Post() {
return false;
},
);
} else {
Mousetrap.bind(
"mod+p",
() => {
displayEdit();
return false;
},
);
}
}, [preview.value]);

Expand Down

0 comments on commit 0101de7

Please sign in to comment.