removed tributejs

This commit is contained in:
Anton Tranelis 2025-02-04 12:44:59 +00:00
parent a4db7b78a1
commit a8ad09fab7
3 changed files with 1 additions and 36 deletions

6
package-lock.json generated
View File

@ -27,7 +27,6 @@
"react-string-replace": "^1.1.1",
"react-toastify": "^9.1.3",
"remark-breaks": "^4.0.0",
"tributejs": "github:coreydales/tribute#Fix-compile-error-T-does-not-satisfy-the-constraint",
"tw-elements": "^1.0.0",
"yet-another-react-lightbox": "^3.21.7"
},
@ -7728,11 +7727,6 @@
"node": ">=8.0"
}
},
"node_modules/tributejs": {
"version": "5.1.3",
"resolved": "git+ssh://git@github.com/coreydales/tribute.git#126b8fcc9addc673946dc78d8f6bda08ac73c9a3",
"license": "MIT"
},
"node_modules/trim-lines": {
"version": "3.0.1",
"license": "MIT",

View File

@ -88,7 +88,6 @@
"react-string-replace": "^1.1.1",
"react-toastify": "^9.1.3",
"remark-breaks": "^4.0.0",
"tributejs": "github:coreydales/tribute#Fix-compile-error-T-does-not-satisfy-the-constraint",
"tw-elements": "^1.0.0",
"yet-another-react-lightbox": "^3.21.7"
},

View File

@ -2,8 +2,7 @@
/* eslint-disable @typescript-eslint/consistent-indexed-object-style */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
import { useEffect, useRef, useState } from 'react'
import Tribute from 'tributejs'
import { useEffect, useRef, useState } from 'react'
import { useTags } from '#components/Map/hooks/useTags'
@ -37,9 +36,6 @@ export function TextAreaInput({
const ref = useRef<HTMLTextAreaElement>(null)
const [inputValue, setInputValue] = useState<string>(defaultValue)
// prevent react18 from calling useEffect twice
const init = useRef(false)
const tags = useTags()
const values: KeyValue[] = []
@ -48,30 +44,6 @@ export function TextAreaInput({
values.push({ key: tag.name, value: tag.name, color: tag.color })
})
const tribute = new Tribute({
containerClass: 'tw-z-3000 tw-bg-base-100 tw-p-2 tw-rounded-lg tw-shadow',
selectClass: 'tw-font-bold',
trigger: '#',
values,
menuShowMinLength: 3,
noMatchTemplate: () => {
return ''
},
menuItemTemplate: function (item) {
return `<span style="color: ${item.original.color}; padding: 5px; border-radius: 3px;">#${item.string}</span>`
},
})
useEffect(() => {
if (!init.current) {
if (ref.current) {
tribute.attach(ref.current)
}
init.current = true
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ref])
useEffect(() => {
setInputValue(defaultValue)
}, [defaultValue])