diff --git a/packages/web/src/javascripts/Components/SuperEditor/Plugins/RemoteImagePlugin/RemoteImageComponent.tsx b/packages/web/src/javascripts/Components/SuperEditor/Plugins/RemoteImagePlugin/RemoteImageComponent.tsx index f27beec69..5d95c0897 100644 --- a/packages/web/src/javascripts/Components/SuperEditor/Plugins/RemoteImagePlugin/RemoteImageComponent.tsx +++ b/packages/web/src/javascripts/Components/SuperEditor/Plugins/RemoteImagePlugin/RemoteImageComponent.tsx @@ -2,13 +2,27 @@ import { useApplication } from '@/Components/ApplicationProvider' import Icon from '@/Components/Icon/Icon' import Spinner from '@/Components/Spinner/Spinner' import { isDesktopApplication } from '@/Utils' +import { BlockWithAlignableContents } from '@lexical/react/LexicalBlockWithAlignableContents' import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext' import { classNames } from '@standardnotes/snjs' +import { ElementFormatType, NodeKey } from 'lexical' import { useCallback, useState } from 'react' import { $createFileNode } from '../EncryptedFilePlugin/Nodes/FileUtils' import { RemoteImageNode } from './RemoteImageNode' -const RemoteImageComponent = ({ src, alt, node }: { src: string; alt?: string; node: RemoteImageNode }) => { +type Props = { + src: string + alt?: string + node: RemoteImageNode + className: Readonly<{ + base: string + focus: string + }> + format: ElementFormatType | null + nodeKey: NodeKey +} + +const RemoteImageComponent = ({ className, src, alt, node, format, nodeKey }: Props) => { const application = useApplication() const [editor] = useLexicalComposerContext() @@ -51,37 +65,39 @@ const RemoteImageComponent = ({ src, alt, node }: { src: string; alt?: string; n const canShowSaveButton = application.isNativeMobileWeb() || isDesktopApplication() return ( -
- {alt} { - setDidImageLoad(true) - }} - /> - {didImageLoad && canShowSaveButton && ( - - )} -
+ +
+ {alt} { + setDidImageLoad(true) + }} + /> + {didImageLoad && canShowSaveButton && ( + + )} +
+
) } diff --git a/packages/web/src/javascripts/Components/SuperEditor/Plugins/RemoteImagePlugin/RemoteImageNode.tsx b/packages/web/src/javascripts/Components/SuperEditor/Plugins/RemoteImagePlugin/RemoteImageNode.tsx index 7e32e9309..4aff35f6c 100644 --- a/packages/web/src/javascripts/Components/SuperEditor/Plugins/RemoteImagePlugin/RemoteImageNode.tsx +++ b/packages/web/src/javascripts/Components/SuperEditor/Plugins/RemoteImagePlugin/RemoteImageNode.tsx @@ -1,5 +1,5 @@ import { DecoratorBlockNode, SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode' -import { DOMConversionMap, DOMExportOutput, LexicalNode, Spread } from 'lexical' +import { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalEditor, LexicalNode, Spread } from 'lexical' import RemoteImageComponent from './RemoteImageComponent' type SerializedRemoteImageNode = Spread< @@ -75,8 +75,23 @@ export class RemoteImageNode extends DecoratorBlockNode { return { element } } - decorate(): JSX.Element { - return + decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element { + const embedBlockTheme = config.theme.embedBlock || {} + const className = { + base: embedBlockTheme.base || '', + focus: embedBlockTheme.focus || '', + } + + return ( + + ) } }