10 lines
434 B
TypeScript
10 lines
434 B
TypeScript
export function restoreTextResourceContent(draft?: Record<string, any>): string[] {
|
|
const content = draft?.content;
|
|
if (typeof content === "string") return [content];
|
|
// An empty string in the array is an intentional edit and must stay empty.
|
|
if (Array.isArray(content) && content.length) return content;
|
|
if (draft?.audioMeta?.outputType === "text" && typeof draft.text === "string")
|
|
return [draft.text];
|
|
return [];
|
|
}
|