diff --git a/lib/src/Components/Input/RichTextEditor/RichTextEditor.tsx b/lib/src/Components/Input/RichTextEditor/RichTextEditor.tsx index 6346a02d..302251f1 100644 --- a/lib/src/Components/Input/RichTextEditor/RichTextEditor.tsx +++ b/lib/src/Components/Input/RichTextEditor/RichTextEditor.tsx @@ -37,6 +37,7 @@ interface RichTextEditorProps { defaultValue: string placeholder?: string showMenu?: boolean + readOnly?: boolean updateFormValue?: (value: string) => void } @@ -64,12 +65,12 @@ export function RichTextEditor({ defaultValue, placeholder, showMenu = true, + readOnly = false, updateFormValue, }: RichTextEditorProps) { const handleChange = () => { if (updateFormValue) { if (editor) { - console.log(getStyledMarkdown(editor)) updateFormValue(getStyledMarkdown(editor)) } } @@ -78,6 +79,7 @@ export function RichTextEditor({ const tags = useTags() const editor = useEditor({ + editable: !readOnly, extensions: [ Color.configure({ types: ['textStyle', 'listItem'] }), Youtube.configure({ @@ -147,7 +149,7 @@ export function RichTextEditor({ onUpdate: handleChange, editorProps: { attributes: { - class: `tw:h-full markdown tw:max-h-full tw:p-2 tw:overflow-y-auto`, + class: `tw:h-full markdown tw:max-h-full ${readOnly ? `` : `tw:p-2`} tw:overflow-y-auto tw:overflow-x-hidden`, }, }, }) @@ -170,12 +172,12 @@ export function RichTextEditor({ ) : null}
{editor ? ( <> - {showMenu ? : null} - + {showMenu && !readOnly ? : null} + ) : null}
diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx index 64b8d07b..77069bb8 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx @@ -137,7 +137,7 @@ export function HeaderView({ editCallback && (
  • item.layer?.customEditLink @@ -147,7 +147,7 @@ export function HeaderView({ : editCallback(e) } > - +
  • )} @@ -156,11 +156,11 @@ export function HeaderView({ setPositionCallback && (
  • - +
  • )} @@ -169,14 +169,14 @@ export function HeaderView({ deleteCallback && (
  • {loading ? ( ) : ( - + )}
  • diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index 3788b651..bdeb677f 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -12,6 +12,7 @@ import remarkBreaks from 'remark-breaks' import remarkGfm from 'remark-gfm' import { visit } from 'unist-util-visit' +import { RichTextEditor } from '#components/Input/RichTextEditor/RichTextEditor' import { useAddFilterTag } from '#components/Map/hooks/useFilter' import { useTags } from '#components/Map/hooks/useTags' import { decodeTag } from '#utils/FormatTags' @@ -137,20 +138,7 @@ export const TextView = ({ ) } - return ( -
    - - {replacedText} - -
    - ) + return } function removeMarkdownKeepParagraphs(text: string): string { diff --git a/lib/src/Components/Profile/ProfileView.tsx b/lib/src/Components/Profile/ProfileView.tsx index 199972f6..7737c16e 100644 --- a/lib/src/Components/Profile/ProfileView.tsx +++ b/lib/src/Components/Profile/ProfileView.tsx @@ -174,7 +174,7 @@ export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi {item && ( <>