Closed nimuseel closed 3 years ago
Hi! Can you please paste here the exact structure/data that you're passing to the datocms-structured-text-to-html-string render method please? Angular/TypeScript should not be an issue here, so it must be something else.
@stefanoverna Hi, Here's the data.
{
"schema": "dast",
"document": {
"type": "root",
"children": [
{
"type": "paragraph",
"children": [
{
"type": "span",
"value": "λΉμ¦λ΅ μλΉμ€ κΈ΄κΈ μ κ² μ€!"
}
]
},
{
"type": "list",
"style": "bulleted",
"children": [
{
"type": "listItem",
"children": [
{
"type": "paragraph",
"children": [
{
"type": "span",
"value": "μμ
μΌμ: 2021.06.11 μ€ν 2μ ~2021.06.12 μ€ν 2μ"
}
]
}
]
},
{
"type": "listItem",
"children": [
{
"type": "paragraph",
"children": [
{
"type": "span",
"value": "μμ
μ¬ν: μλΉμ€ κ°μ "
}
]
}
]
}
]
},
{
"type": "paragraph",
"children": [
{
"url": "https://www.notion.so/bznav/cd055a3c2d8b40579e2867d92b2f3e75",
"type": "link",
"children": [
{
"type": "span",
"value": "μμΈν μ¬ν νμΈνκΈ°"
}
]
}
]
}
]
}
}
Mh, I see no problems here: https://codepen.io/stefanoverna/pen/KKmMxEe
Oh... The same error occurs when stored in a separate variable. :(
const data: StructuredTextDocument = {
schema: 'dast',
document: {
type: 'root',
children: [
{
type: 'paragraph',
children: [
{
type: 'span',
value: 'λΉμ¦λ΅ μλΉμ€ κΈ΄κΈ μ κ² μ€!'
}
]
},
{
type: 'list',
style: 'bulleted',
children: [
{
type: 'listItem',
children: [
{
type: 'paragraph',
children: [
{
type: 'span',
value: 'μμ
μΌμ: 2021.06.11 μ€ν 2μ ~2021.06.12 μ€ν 2μ'
}
]
}
]
},
{
type: 'listItem',
children: [
{
type: 'paragraph',
children: [
{
type: 'span',
value: 'μμ
μ¬ν: μλΉμ€ κ°μ '
}
]
}
]
}
]
},
{
type: 'paragraph',
children: [
{
url: 'https://www.notion.so/bznav/cd055a3c2d8b40579e2867d92b2f3e75',
type: 'link',
children: [
{
type: 'span',
value: 'μμΈν μ¬ν νμΈνκΈ°'
}
]
}
]
}
]
}
};
const result = render(data);
console.log(result);
What version of datocms-structured-text-to-html-string are you using?
I am using 1.1.4 version. The same error occurs after repeated install and install several times.
@stefanoverna Are you following this issue internally? I wish I could get some help...π₯²
Are you able to share a small repository reproducing the issue? I really don't know what could be the cause honestly π
I think it'll be difficult because it's a company code.. π’ Could it be related to tsconfig?
it does not need to be the company's code, just a small chunk of code that reproduces the issue (codepen?). my hands are kinda tied otherwise, I'm sorry
I tried to set and test the stackblitz according to our project configuration as much as possible, but it works well, and I wonder why it doesn't work well for us. That's why I talked about tsconfig. (or other deep parts)
https://stackblitz.com/edit/ionic-2dwkxk?file=pages/home/home.ts
More) I debugged it with Chrome devtool and found that child is undefined in the 42nd row of render.js. However, if you look at the node in the right toolbar 'Scope', you can see that there is a child in the node.
It seems to me that children is undefined because you stopped the code execution before the ternary expression was evaluated 100%.
Oh, I understand. I'll try to figure it out more internally in this. Please don't close the issue. π
@stefanoverna This issue has been resolved! The array-flatten module was installed in the project and it was solved. Thank you very much for your help. π π
Please consider that it is a translator. π
Hello, I'm Korean DatoCMS user I'm leaving an issue because I have a question about DataCMS.
Which version of TypeScript is supported by the datocms-structured-text-to-html-string library provided by DatoCMS?
The version of TypeScript I'm using now is version 3.9.7. The framework uses Ionic v3 (Angular v6).
The validate method of datocms-structured-text-utils was used to determine that it was a valid dast grammar. If you use the render method, the error message Object(..) is not a function is output.
Attached is a photo that proves that it is valid when validating with error message below.
Please contact me if you need more information.
It works in Angular v10 & TypeScript 4.0.3 environments. I look forward to hearing from you. Have a nice day :)