feat: Unified icon picker (#7038)
This commit is contained in:
@@ -255,14 +255,18 @@ class Document extends ParanoidModel<
|
||||
@Column
|
||||
editorVersion: string;
|
||||
|
||||
/** An emoji to use as the document icon. */
|
||||
/**
|
||||
* An emoji to use as the document icon,
|
||||
* This is used as fallback (for backward compat) when icon is not set.
|
||||
*/
|
||||
@Length({
|
||||
max: 1,
|
||||
msg: `Emoji must be a single character`,
|
||||
max: 50,
|
||||
msg: `Emoji must be 50 characters or less`,
|
||||
})
|
||||
@Column
|
||||
emoji: string | null;
|
||||
|
||||
/** An icon to use as the document icon. */
|
||||
@Length({
|
||||
max: 50,
|
||||
msg: `icon must be 50 characters or less`,
|
||||
@@ -365,7 +369,11 @@ class Document extends ParanoidModel<
|
||||
model.archivedAt ||
|
||||
model.template ||
|
||||
!model.publishedAt ||
|
||||
!(model.changed("title") || model.changed("emoji")) ||
|
||||
!(
|
||||
model.changed("title") ||
|
||||
model.changed("icon") ||
|
||||
model.changed("color")
|
||||
) ||
|
||||
!model.collectionId
|
||||
) {
|
||||
return;
|
||||
@@ -721,6 +729,8 @@ class Document extends ParanoidModel<
|
||||
this.text = revision.text;
|
||||
this.title = revision.title;
|
||||
this.emoji = revision.emoji;
|
||||
this.icon = revision.icon;
|
||||
this.color = revision.color;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1083,6 +1093,8 @@ class Document extends ParanoidModel<
|
||||
title: this.title,
|
||||
url: this.url,
|
||||
emoji: isNil(this.emoji) ? undefined : this.emoji,
|
||||
icon: isNil(this.icon) ? undefined : this.icon,
|
||||
color: isNil(this.color) ? undefined : this.color,
|
||||
children,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user