This commit is contained in:
Shusui MOYATANI
2023-06-17 01:42:04 +09:00
parent df8bc01e92
commit 6ba622328b
14 changed files with 159 additions and 47 deletions

View File

@@ -7,7 +7,7 @@ type UseHandleCommandProps = {
type CommandBase<T> = { command: T };
export type OpenPostForm = CommandBase<'openPostForm'>;
export type OpenPostForm = CommandBase<'openPostForm'> & { content?: string };
export type ClosePostForm = CommandBase<'closePostForm'>;
export type MoveToNextItem = CommandBase<'moveToNextItem'>;
export type MoveToPrevItem = CommandBase<'moveToPrevItem'>;

View File

@@ -1,5 +1,8 @@
import { createSignal, onMount } from 'solid-js';
// TODO Find a better way to solve this. Firefox on Windows can cause 2px gap.
const Offset = 2;
const useDetectOverflow = () => {
let elementRef: HTMLElement | undefined;
const [overflow, setOverflow] = createSignal(false);
@@ -10,7 +13,7 @@ const useDetectOverflow = () => {
onMount(() => {
if (elementRef != null) {
setOverflow(elementRef.scrollHeight > elementRef.clientHeight);
setOverflow(elementRef.scrollHeight > elementRef.clientHeight + Offset);
}
});