mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
mobile: fix cursor render location incorrect when writing near top of editor
This commit is contained in:
@@ -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>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -118,7 +118,8 @@ function Header({
|
||||
backgroundColor: "var(--nn_primary_background)",
|
||||
position: "sticky",
|
||||
width: "100vw",
|
||||
zIndex: 999
|
||||
zIndex: 999,
|
||||
top: 0
|
||||
}}
|
||||
>
|
||||
{noHeader ? null : (
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -71,7 +71,7 @@ export const KeepInView = Extension.create<
|
||||
|
||||
export function keepLastLineInView(
|
||||
editor: Editor,
|
||||
THRESHOLD = 90,
|
||||
THRESHOLD = 120,
|
||||
SCROLL_THRESHOLD = 100
|
||||
) {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user