feat: Editing large notes (greater than 1.5MB) will result in more optimized syncing, in which changes are saved locally immediately, but sync with the server less frequently (roughly every 30 seconds rather than after every change). (#2768)
This commit is contained in:
@@ -44,6 +44,8 @@ type BlocksEditorProps = {
|
||||
spellcheck?: boolean
|
||||
ignoreFirstChange?: boolean
|
||||
readonly?: boolean
|
||||
onFocus?: () => void
|
||||
onBlur?: () => void
|
||||
}
|
||||
|
||||
export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
|
||||
@@ -54,6 +56,8 @@ export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
|
||||
spellcheck,
|
||||
ignoreFirstChange = false,
|
||||
readonly,
|
||||
onFocus,
|
||||
onBlur,
|
||||
}) => {
|
||||
const [didIgnoreFirstChange, setDidIgnoreFirstChange] = useState(false)
|
||||
const handleChange = useCallback(
|
||||
@@ -95,6 +99,8 @@ export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
|
||||
className,
|
||||
)}
|
||||
spellCheck={spellcheck}
|
||||
onFocus={onFocus}
|
||||
onBlur={onBlur}
|
||||
/>
|
||||
<div className="search-highlight-container pointer-events-none absolute left-0 top-0 h-full w-full" />
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
FeatureStatus,
|
||||
GetSuperNoteFeature,
|
||||
EditorLineHeightValues,
|
||||
WebAppEvent,
|
||||
} from '@standardnotes/snjs'
|
||||
import { CSSProperties, FunctionComponent, useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { BlocksEditor } from './BlocksEditor'
|
||||
@@ -37,6 +38,7 @@ import NotEntitledBanner from '../ComponentView/NotEntitledBanner'
|
||||
import AutoFocusPlugin from './Plugins/AutoFocusPlugin'
|
||||
import usePreference from '@/Hooks/usePreference'
|
||||
import BlockPickerMenuPlugin from './Plugins/BlockPickerPlugin/BlockPickerPlugin'
|
||||
import { EditorEventSource } from '@/Types/EditorEventSource'
|
||||
|
||||
export const SuperNotePreviewCharLimit = 160
|
||||
|
||||
@@ -179,6 +181,10 @@ export const SuperEditor: FunctionComponent<Props> = ({
|
||||
}
|
||||
}, [])
|
||||
|
||||
const onFocus = useCallback(() => {
|
||||
application.notifyWebEvent(WebAppEvent.EditorDidFocus, { eventSource: EditorEventSource.UserInteraction })
|
||||
}, [application])
|
||||
|
||||
return (
|
||||
<div
|
||||
className="font-editor relative flex h-full w-full flex-col"
|
||||
@@ -203,6 +209,7 @@ export const SuperEditor: FunctionComponent<Props> = ({
|
||||
previewLength={SuperNotePreviewCharLimit}
|
||||
spellcheck={spellcheck}
|
||||
readonly={note.current.locked || readonly}
|
||||
onFocus={onFocus}
|
||||
>
|
||||
<ItemSelectionPlugin currentNote={note.current} />
|
||||
<FilePlugin currentNote={note.current} />
|
||||
|
||||
Reference in New Issue
Block a user