mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
item.text is optional
This commit is contained in:
parent
cb727d433d
commit
2556d8c047
@ -172,7 +172,7 @@ export const Layer = ({
|
||||
if (item.tags) {
|
||||
item.text += '\n\n'
|
||||
item.tags.map((tag) => {
|
||||
if (!item.text.includes(`#${encodeTag(tag)}`)) {
|
||||
if (!item.text?.includes(`#${encodeTag(tag)}`)) {
|
||||
item.text += `#${encodeTag(tag)}`
|
||||
}
|
||||
return item.text
|
||||
@ -180,7 +180,7 @@ export const Layer = ({
|
||||
}
|
||||
|
||||
if (allTagsLoaded && allItemsLoaded) {
|
||||
item.text.match(hashTagRegex)?.map((tag) => {
|
||||
item.text?.match(hashTagRegex)?.map((tag) => {
|
||||
if (
|
||||
!tags.find(
|
||||
(t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase(),
|
||||
|
||||
@ -189,7 +189,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
key={props.position.toString()}
|
||||
placeholder='Text'
|
||||
dataField='text'
|
||||
defaultValue={props.item ? props.item.text : ''}
|
||||
defaultValue={props.item?.text ?? ''}
|
||||
inputStyle='tw-h-40 tw-mt-5'
|
||||
/>
|
||||
</>
|
||||
|
||||
2
src/types/Item.d.ts
vendored
2
src/types/Item.d.ts
vendored
@ -18,7 +18,7 @@ interface GalleryItem {
|
||||
export interface Item {
|
||||
id: string
|
||||
name: string
|
||||
text: string
|
||||
text?: string
|
||||
data?: string
|
||||
position?: Point | null
|
||||
date_created?: string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user