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) {
|
if (item.tags) {
|
||||||
item.text += '\n\n'
|
item.text += '\n\n'
|
||||||
item.tags.map((tag) => {
|
item.tags.map((tag) => {
|
||||||
if (!item.text.includes(`#${encodeTag(tag)}`)) {
|
if (!item.text?.includes(`#${encodeTag(tag)}`)) {
|
||||||
item.text += `#${encodeTag(tag)}`
|
item.text += `#${encodeTag(tag)}`
|
||||||
}
|
}
|
||||||
return item.text
|
return item.text
|
||||||
@ -180,7 +180,7 @@ export const Layer = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (allTagsLoaded && allItemsLoaded) {
|
if (allTagsLoaded && allItemsLoaded) {
|
||||||
item.text.match(hashTagRegex)?.map((tag) => {
|
item.text?.match(hashTagRegex)?.map((tag) => {
|
||||||
if (
|
if (
|
||||||
!tags.find(
|
!tags.find(
|
||||||
(t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase(),
|
(t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase(),
|
||||||
|
|||||||
@ -189,7 +189,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
|||||||
key={props.position.toString()}
|
key={props.position.toString()}
|
||||||
placeholder='Text'
|
placeholder='Text'
|
||||||
dataField='text'
|
dataField='text'
|
||||||
defaultValue={props.item ? props.item.text : ''}
|
defaultValue={props.item?.text ?? ''}
|
||||||
inputStyle='tw-h-40 tw-mt-5'
|
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 {
|
export interface Item {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
text: string
|
text?: string
|
||||||
data?: string
|
data?: string
|
||||||
position?: Point | null
|
position?: Point | null
|
||||||
date_created?: string
|
date_created?: string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user