chore: fix super checklist rendering in conversion and history dialogs [skip e2e]
This commit is contained in:
@@ -1,5 +1,14 @@
|
|||||||
import { ContentType, NoteContent, NoteType, SNNote, classNames, isUIFeatureAnIframeFeature } from '@standardnotes/snjs'
|
import {
|
||||||
import { UIEventHandler, useEffect, useMemo, useRef } from 'react'
|
ContentType,
|
||||||
|
EditorLineHeightValues,
|
||||||
|
NoteContent,
|
||||||
|
NoteType,
|
||||||
|
PrefKey,
|
||||||
|
SNNote,
|
||||||
|
classNames,
|
||||||
|
isUIFeatureAnIframeFeature,
|
||||||
|
} from '@standardnotes/snjs'
|
||||||
|
import { CSSProperties, UIEventHandler, useEffect, useMemo, useRef } from 'react'
|
||||||
import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery'
|
import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery'
|
||||||
import { useApplication } from '../ApplicationProvider'
|
import { useApplication } from '../ApplicationProvider'
|
||||||
import IframeFeatureView from '../ComponentView/IframeFeatureView'
|
import IframeFeatureView from '../ComponentView/IframeFeatureView'
|
||||||
@@ -8,6 +17,8 @@ import { BlocksEditor } from '../SuperEditor/BlocksEditor'
|
|||||||
import { BlocksEditorComposer } from '../SuperEditor/BlocksEditorComposer'
|
import { BlocksEditorComposer } from '../SuperEditor/BlocksEditorComposer'
|
||||||
import { useLinkingController } from '@/Controllers/LinkingControllerProvider'
|
import { useLinkingController } from '@/Controllers/LinkingControllerProvider'
|
||||||
import LinkedItemBubblesContainer from '../LinkedItems/LinkedItemBubblesContainer'
|
import LinkedItemBubblesContainer from '../LinkedItems/LinkedItemBubblesContainer'
|
||||||
|
import usePreference from '@/Hooks/usePreference'
|
||||||
|
import { useResponsiveEditorFontSize } from '@/Utils/getPlaintextFontSize'
|
||||||
|
|
||||||
export const ReadonlyNoteContent = ({
|
export const ReadonlyNoteContent = ({
|
||||||
note,
|
note,
|
||||||
@@ -74,6 +85,10 @@ export const ReadonlyNoteContent = ({
|
|||||||
})
|
})
|
||||||
}, [scrollPos, shouldSyncScroll])
|
}, [scrollPos, shouldSyncScroll])
|
||||||
|
|
||||||
|
const lineHeight = usePreference(PrefKey.EditorLineHeight)
|
||||||
|
const fontSize = usePreference(PrefKey.EditorFontSize)
|
||||||
|
const responsiveFontSize = useResponsiveEditorFontSize(fontSize, false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-grow flex-col overflow-hidden" ref={containerRef}>
|
<div className="flex h-full flex-grow flex-col overflow-hidden" ref={containerRef}>
|
||||||
<div className={classNames('w-full px-4 pt-4 text-base font-bold', componentViewer && 'pb-4')}>
|
<div className={classNames('w-full px-4 pt-4 text-base font-bold', componentViewer && 'pb-4')}>
|
||||||
@@ -94,7 +109,15 @@ export const ReadonlyNoteContent = ({
|
|||||||
</div>
|
</div>
|
||||||
) : content.noteType === NoteType.Super ? (
|
) : content.noteType === NoteType.Super ? (
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<div className="w-full flex-grow overflow-hidden overflow-y-auto">
|
<div
|
||||||
|
className="w-full flex-grow overflow-hidden overflow-y-auto"
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
'--line-height': EditorLineHeightValues[lineHeight],
|
||||||
|
'--font-size': responsiveFontSize,
|
||||||
|
} as CSSProperties
|
||||||
|
}
|
||||||
|
>
|
||||||
<BlocksEditorComposer readonly initialValue={content.text} key={content.text}>
|
<BlocksEditorComposer readonly initialValue={content.text} key={content.text}>
|
||||||
<BlocksEditor
|
<BlocksEditor
|
||||||
readonly
|
readonly
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import { WebApplication } from '@/Application/WebApplication'
|
import { WebApplication } from '@/Application/WebApplication'
|
||||||
import {
|
import {
|
||||||
ApplicationEvent,
|
|
||||||
classNames,
|
classNames,
|
||||||
EditorFontSize,
|
|
||||||
EditorLineHeight,
|
|
||||||
isPayloadSourceRetrieved,
|
isPayloadSourceRetrieved,
|
||||||
PrefKey,
|
PrefKey,
|
||||||
PrefDefaults,
|
|
||||||
NativeFeatureIdentifier,
|
NativeFeatureIdentifier,
|
||||||
FeatureStatus,
|
FeatureStatus,
|
||||||
GetSuperNoteFeature,
|
GetSuperNoteFeature,
|
||||||
@@ -48,6 +44,7 @@ import CodeOptionsPlugin from './Plugins/CodeOptionsPlugin/CodeOptions'
|
|||||||
import RemoteImagePlugin from './Plugins/RemoteImagePlugin/RemoteImagePlugin'
|
import RemoteImagePlugin from './Plugins/RemoteImagePlugin/RemoteImagePlugin'
|
||||||
import NotEntitledBanner from '../ComponentView/NotEntitledBanner'
|
import NotEntitledBanner from '../ComponentView/NotEntitledBanner'
|
||||||
import AutoFocusPlugin from './Plugins/AutoFocusPlugin'
|
import AutoFocusPlugin from './Plugins/AutoFocusPlugin'
|
||||||
|
import usePreference from '@/Hooks/usePreference'
|
||||||
|
|
||||||
export const SuperNotePreviewCharLimit = 160
|
export const SuperNotePreviewCharLimit = 160
|
||||||
|
|
||||||
@@ -160,30 +157,10 @@ export const SuperEditor: FunctionComponent<Props> = ({
|
|||||||
return disposer
|
return disposer
|
||||||
}, [controller, controller.item.uuid])
|
}, [controller, controller.item.uuid])
|
||||||
|
|
||||||
const [lineHeight, setLineHeight] = useState<EditorLineHeight>(() =>
|
const lineHeight = usePreference(PrefKey.EditorLineHeight)
|
||||||
application.getPreference(PrefKey.EditorLineHeight, PrefDefaults[PrefKey.EditorLineHeight]),
|
const fontSize = usePreference(PrefKey.EditorFontSize)
|
||||||
)
|
|
||||||
const [fontSize, setFontSize] = useState<EditorFontSize>(() =>
|
|
||||||
application.getPreference(PrefKey.EditorFontSize, PrefDefaults[PrefKey.EditorFontSize]),
|
|
||||||
)
|
|
||||||
const responsiveFontSize = useResponsiveEditorFontSize(fontSize, false)
|
const responsiveFontSize = useResponsiveEditorFontSize(fontSize, false)
|
||||||
|
|
||||||
const reloadPreferences = useCallback(() => {
|
|
||||||
const lineHeight = application.getPreference(PrefKey.EditorLineHeight, PrefDefaults[PrefKey.EditorLineHeight])
|
|
||||||
const fontSize = application.getPreference(PrefKey.EditorFontSize, PrefDefaults[PrefKey.EditorFontSize])
|
|
||||||
|
|
||||||
setLineHeight(lineHeight)
|
|
||||||
setFontSize(fontSize)
|
|
||||||
}, [application])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
reloadPreferences()
|
|
||||||
|
|
||||||
return application.addSingleEventObserver(ApplicationEvent.PreferencesChanged, async () => {
|
|
||||||
reloadPreferences()
|
|
||||||
})
|
|
||||||
}, [reloadPreferences, application])
|
|
||||||
|
|
||||||
const ref = useRef<HTMLDivElement>(null)
|
const ref = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { WebApplication } from '@/Application/WebApplication'
|
import { WebApplication } from '@/Application/WebApplication'
|
||||||
import { NoteType, SNNote } from '@standardnotes/snjs'
|
import { EditorLineHeightValues, NoteType, PrefKey, SNNote } from '@standardnotes/snjs'
|
||||||
import { FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react'
|
import { CSSProperties, FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
import { ErrorBoundary } from '@/Utils/ErrorBoundary'
|
import { ErrorBoundary } from '@/Utils/ErrorBoundary'
|
||||||
import ImportPlugin from './Plugins/ImportPlugin/ImportPlugin'
|
import ImportPlugin from './Plugins/ImportPlugin/ImportPlugin'
|
||||||
import { NoteViewController } from '../NoteView/Controller/NoteViewController'
|
import { NoteViewController } from '../NoteView/Controller/NoteViewController'
|
||||||
@@ -8,6 +8,8 @@ import { spaceSeparatedStrings } from '@standardnotes/utils'
|
|||||||
import Modal, { ModalAction } from '@/Components/Modal/Modal'
|
import Modal, { ModalAction } from '@/Components/Modal/Modal'
|
||||||
import { BlocksEditor } from './BlocksEditor'
|
import { BlocksEditor } from './BlocksEditor'
|
||||||
import { BlocksEditorComposer } from './BlocksEditorComposer'
|
import { BlocksEditorComposer } from './BlocksEditorComposer'
|
||||||
|
import usePreference from '@/Hooks/usePreference'
|
||||||
|
import { useResponsiveEditorFontSize } from '@/Utils/getPlaintextFontSize'
|
||||||
|
|
||||||
const NotePreviewCharLimit = 160
|
const NotePreviewCharLimit = 160
|
||||||
|
|
||||||
@@ -123,6 +125,10 @@ export const SuperNoteImporter: FunctionComponent<Props> = ({ note, application,
|
|||||||
[canBeConvertedAsIs, closeDialog, confirmConvert, convertAsIs],
|
[canBeConvertedAsIs, closeDialog, confirmConvert, convertAsIs],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const lineHeight = usePreference(PrefKey.EditorLineHeight)
|
||||||
|
const fontSize = usePreference(PrefKey.EditorFontSize)
|
||||||
|
const responsiveFontSize = useResponsiveEditorFontSize(fontSize, false)
|
||||||
|
|
||||||
if (isSeamlessConvert) {
|
if (isSeamlessConvert) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -133,7 +139,15 @@ export const SuperNoteImporter: FunctionComponent<Props> = ({ note, application,
|
|||||||
The following is a preview of how your note will look when converted to Super. Super notes use a custom format
|
The following is a preview of how your note will look when converted to Super. Super notes use a custom format
|
||||||
under the hood. Converting your note will transition it from plaintext to the custom Super format.
|
under the hood. Converting your note will transition it from plaintext to the custom Super format.
|
||||||
</div>
|
</div>
|
||||||
<div className="relative w-full px-4 py-4">
|
<div
|
||||||
|
className="relative w-full px-4 py-4"
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
'--line-height': EditorLineHeightValues[lineHeight],
|
||||||
|
'--font-size': responsiveFontSize,
|
||||||
|
} as CSSProperties
|
||||||
|
}
|
||||||
|
>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<BlocksEditorComposer readonly initialValue={undefined}>
|
<BlocksEditorComposer readonly initialValue={undefined}>
|
||||||
<BlocksEditor
|
<BlocksEditor
|
||||||
|
|||||||
Reference in New Issue
Block a user