From 8b47bba8223895be9cc72b0436a4dc5984cedb0f Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Mon, 9 Jun 2025 23:05:19 +0200 Subject: [PATCH] flex layout optimizations, text editor fine tuning and markdown rendering --- package-lock.json | 7 +- package.json | 1 + src/Components/Input/ComboBoxInput.tsx | 2 +- src/Components/Input/RichTextEditor.tsx | 24 +-- src/Components/Input/TextEditorMenu.tsx | 140 ++---------------- .../ItemPopupComponents/TextView.tsx | 16 -- src/Components/Profile/ProfileForm.tsx | 2 +- .../Subcomponents/GroupSubheaderForm.tsx | 2 +- .../Profile/Subcomponents/ProfileTextForm.tsx | 8 +- src/Components/Profile/Templates/TabsForm.tsx | 2 +- 10 files changed, 39 insertions(+), 165 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f5d401a..4a3d4369 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@heroicons/react": "^2.0.17", "@tanstack/react-query": "^5.17.8", + "@tiptap/core": "^2.14.0", "@tiptap/extension-bubble-menu": "^2.14.0", "@tiptap/extension-color": "^2.12.0", "@tiptap/extension-image": "^2.14.0", @@ -2373,9 +2374,9 @@ } }, "node_modules/@tiptap/core": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.12.0.tgz", - "integrity": "sha512-3qX8oGVKFFZzQ0vit+ZolR6AJIATBzmEmjAA0llFhWk4vf3v64p1YcXcJsOBsr5scizJu5L6RYWEFatFwqckRg==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.14.0.tgz", + "integrity": "sha512-MBSMzGYRFlwYCocvx3dU7zpCBSDQ0qWByNtStaEzuBUgzCJ6wn2DP/xG0cMcLmE3Ia0VLM4nwbLOAAvBXOtylA==", "license": "MIT", "funding": { "type": "github", diff --git a/package.json b/package.json index 27083a4b..859b6b1b 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "dependencies": { "@heroicons/react": "^2.0.17", "@tanstack/react-query": "^5.17.8", + "@tiptap/core": "^2.14.0", "@tiptap/extension-bubble-menu": "^2.14.0", "@tiptap/extension-color": "^2.12.0", "@tiptap/extension-image": "^2.14.0", diff --git a/src/Components/Input/ComboBoxInput.tsx b/src/Components/Input/ComboBoxInput.tsx index 2cfacc7f..59b7cc77 100644 --- a/src/Components/Input/ComboBoxInput.tsx +++ b/src/Components/Input/ComboBoxInput.tsx @@ -13,7 +13,7 @@ const ComboBoxInput = ({ id, options, value, onValueChange }: ComboBoxProps) => return ( setUrl(e.target.value)} - type='url' - placeholder='https://...' - /> - -
Enter valid url
- - - - - - ) : ( -
editor.chain().focus().extendMarkRange('link').unsetLink().run()} - > - -
- )} - - -
  • -
    + {/*
  • +
    -
  • + */}
  • editor.chain().focus().setHorizontalRule().run()} > @@ -206,7 +138,7 @@ export const TextEditorMenu = ({ editor }: { editor: Editor }) => {
  • editor.chain().focus().undo().run()} > @@ -215,7 +147,7 @@ export const TextEditorMenu = ({ editor }: { editor: Editor }) => {
  • editor.chain().focus().redo().run()} > @@ -223,50 +155,6 @@ export const TextEditorMenu = ({ editor }: { editor: Editor }) => {
  • - {/**
    -
    - -
    -
    */} - {/** -
    -
      -
    • -
      editor.chain().focus().toggleBold().run()} - > - -
      -
    • -
    • -
      editor.chain().focus().toggleItalic().run()} - > - -
      -
    • -
    • -
      - -
      -
    • -
    -
    -
    */} ) } diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index 508e210f..fee7109b 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -53,22 +53,6 @@ export const TextView = ({ if (innerText) replacedText = fixUrls(innerText) - if (replacedText) { - replacedText = replacedText.replace(/(? { - let shortUrl = url - - if (url.match('^https://')) { - shortUrl = url.split('https://')[1] - } - - if (url.match('^http://')) { - shortUrl = url.split('http://')[1] - } - - return `[${shortUrl}](${url})` - }) - } - if (replacedText) { replacedText = replacedText.replace(mailRegex, (url) => { return `[${url}](mailto:${url})` diff --git a/src/Components/Profile/ProfileForm.tsx b/src/Components/Profile/ProfileForm.tsx index 249664d1..d5fb3224 100644 --- a/src/Components/Profile/ProfileForm.tsx +++ b/src/Components/Profile/ProfileForm.tsx @@ -158,7 +158,7 @@ export function ProfileForm() { <>
    +