mirror of
https://github.com/luminous-devs/lume.git
synced 2024-10-02 18:00:47 +00:00
fix new article layout
This commit is contained in:
parent
54ad1e6e1d
commit
dc229f40cb
@ -4,7 +4,7 @@ import Image from '@tiptap/extension-image';
|
|||||||
import Placeholder from '@tiptap/extension-placeholder';
|
import Placeholder from '@tiptap/extension-placeholder';
|
||||||
import { EditorContent, FloatingMenu, useEditor } from '@tiptap/react';
|
import { EditorContent, FloatingMenu, useEditor } from '@tiptap/react';
|
||||||
import StarterKit from '@tiptap/starter-kit';
|
import StarterKit from '@tiptap/starter-kit';
|
||||||
import { useMemo, useState } from 'react';
|
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
@ -27,12 +27,14 @@ import {
|
|||||||
export function NewArticleScreen() {
|
export function NewArticleScreen() {
|
||||||
const { ndk } = useNDK();
|
const { ndk } = useNDK();
|
||||||
|
|
||||||
|
const [height, setHeight] = useState(0);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [title, setTitle] = useState('');
|
const [title, setTitle] = useState('');
|
||||||
const [summary, setSummary] = useState({ open: false, content: '' });
|
const [summary, setSummary] = useState({ open: false, content: '' });
|
||||||
const [cover, setCover] = useState('');
|
const [cover, setCover] = useState('');
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const containerRef = useRef(null);
|
||||||
const ident = useMemo(() => String(Date.now()), []);
|
const ident = useMemo(() => String(Date.now()), []);
|
||||||
const editor = useEditor({
|
const editor = useEditor({
|
||||||
extensions: [
|
extensions: [
|
||||||
@ -113,10 +115,18 @@ export function NewArticleScreen() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
setHeight(containerRef.current.clientHeight);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-1 flex-col justify-between">
|
<div className="flex flex-1 flex-col justify-between">
|
||||||
<div className="flex-1 overflow-y-auto">
|
<div className="flex-1 overflow-y-auto">
|
||||||
<div className="flex flex-col gap-4">
|
<div
|
||||||
|
className="flex flex-col gap-4"
|
||||||
|
ref={containerRef}
|
||||||
|
style={{ height: `${height}px` }}
|
||||||
|
>
|
||||||
{cover ? (
|
{cover ? (
|
||||||
<img
|
<img
|
||||||
src={cover}
|
src={cover}
|
||||||
|
Loading…
Reference in New Issue
Block a user