mobile: fix cursor render location incorrect when writing near top of editor

This commit is contained in:
Ammar Ahmed
2025-05-01 10:39:49 +05:00
parent bb5d5a5731
commit 2ec4a25660
4 changed files with 32 additions and 31 deletions

View File

@@ -421,13 +421,6 @@ const Tiptap = ({
ref={editorRoot}
onDoubleClick={onClickEmptyArea}
>
<Header
hasRedo={redo}
hasUndo={undo}
settings={settings}
noHeader={settings.noHeader || false}
/>
<div
id="editor-saving-failed-overlay"
style={{
@@ -532,9 +525,17 @@ const Tiptap = ({
overflowY: controller.loading ? "hidden" : "scroll",
height: "100%",
display: "block",
position: "relative"
position: "relative",
overscrollBehavior: "none"
}}
>
<Header
hasRedo={redo}
hasUndo={undo}
settings={settings}
noHeader={settings.noHeader || false}
/>
{settings.noHeader || tab.session?.locked ? null : (
<>
<Tags settings={settings} loading={controller.loading} />
@@ -854,25 +855,24 @@ const Tiptap = ({
minHeight: 300
}}
/>
<TiptapEditorWrapper
key={tick + tab.id + "-editor"}
options={tiptapOptions}
settings={settings}
onEditorUpdate={(editor) => {
if (!editor) {
setUndo(false);
setRedo(false);
}
if (undo !== editor.can().undo()) {
setUndo(editor.can().undo());
}
if (redo !== editor.can().redo()) {
setRedo(editor.can().redo());
}
}}
/>
</div>
<TiptapEditorWrapper
key={tick + tab.id + "-editor"}
options={tiptapOptions}
settings={settings}
onEditorUpdate={(editor) => {
if (!editor) {
setUndo(false);
setRedo(false);
}
if (undo !== editor.can().undo()) {
setUndo(editor.can().undo());
}
if (redo !== editor.can().redo()) {
setRedo(editor.can().redo());
}
}}
/>
</div>
</>
);

View File

@@ -118,7 +118,8 @@ function Header({
backgroundColor: "var(--nn_primary_background)",
position: "sticky",
width: "100vw",
zIndex: 999
zIndex: 999,
top: 0
}}
>
{noHeader ? null : (

View File

@@ -44,10 +44,10 @@ export default function TiptapEditorWrapper(props: {
display: props.settings.noToolbar ? "none" : "flex",
overflowY: "hidden",
minHeight: "50px",
position: "absolute",
position: "fixed",
bottom: 0,
left: 0,
right: 0
width: "100%",
overscrollBehavior: "none"
}}
editor={editor}
location="bottom"

View File

@@ -71,7 +71,7 @@ export const KeepInView = Extension.create<
export function keepLastLineInView(
editor: Editor,
THRESHOLD = 90,
THRESHOLD = 120,
SCROLL_THRESHOLD = 100
) {
if (