릴리즈 3.4.0 이상
현재 에디터의 Body모델을 AI 입력에 필요한 속성만 필터링하여 JSON Object 또는 JSON String으로 반환합니다.
Parameters:
Name | Type | Attribute | Description |
|---|---|---|---|
toString | boolean | default : false | 현재 에디터 Body 모델을 JSON String으로 반환 받을지 설정합니다. |
| useStyle | boolean | default : false | 스타일을 포함하여 반환 받을지 설정합니다. |
Return:
| Type | Description |
|---|---|
| Object | String | Body 모델 JSON Object 또는 JSON String. |
Example:
var model = editor.getBodyModelJSONForAI(); var model = editor.getBodyModelJSONForAI(false. true); var model = editor.getBodyModelJSONForAI(true);
toString: false
{
"type": "Body",
"children": [
{
"children": [
{
"text": "안녕",
"type": "TextRun"
},
{
"text": "하세요",
"type": "TextRun"
}
],
"type": "Paragraph"
}
]
}
toString: false, useStyle: true
{
"type": "Body",
"children": [
{
"children": [
{
"text": "안녕",
"style": {
"color": {
"r": 128,
"g": 128,
"b": 255
}
},
"type": "TextRun"
},
{
"text": "하세요",
"style": {
"color": {
"r": 255,
"g": 128,
"b": 128
}
},
"type": "TextRun"
}
],
"type": "Paragraph"
}
]
}
toString: true
{"type":"Body","children":[{"children":[{"text":"안녕","type":"TextRun"},{"text":"하세요","type":"TextRun"}],"type":"Paragraph"}]}
