Я создаю страницу, которая получает данные JSON, созданные с помощью Editor.js, редактора документов, в методе GET.
Однако, когда я фактически получил данные, я обнаружил, что поле было слишком сложным, как и данные API выше, и было так много различных факторов, таких как толщина шрифта и применение курсива. Изначально я пытался применить стиль самостоятельно, разделяя элементы по одному с помощью оператора switch case, но я думал, что это почти невозможно.
Итак, мой вопрос: могу ли я знать инструмент или способ, который поможет вам обрабатывать данные JSON, созданные с помощью этих editor.js? Я не мог его найти, как бы я ни искал.
Я видел большинство задействованных видео и пытался гуглить, но не смог найти удовлетворительного ответа.
{
"userId": 1,
"petType": "DOG",
"title": "Top Tips for Dog Care",
"category": "TIPS",
"blocks": [{
"id": "mhTl6ghSkV",
"type": "paragraph",
"data": {
"text": "Hey. Meet the new Editor. On this picture you can see it in action. Then, try a demo 🤓"
}
},
{
"id": "l98dyx3yjb",
"type": "header",
"data": {
"text": "Key features",
"level": 3
}
},
{
"id": "os_YI4eub4",
"type": "list",
"data": {
"type": "unordered",
"items": [
"It is a block-style editor",
"It returns clean data output in JSON",
"Designed to be extendable and pluggable with a <a href=\"https://editorjs.io/creating-a-block-tool\">simple API</a>"
]
}
},
{
"id": "TcUNySG15P",
"type": "paragraph",
"data": {
"text": "Workspace in classic editors is made of a single contenteditable element, used to create different HTML markups. Editor.js workspace consists of separate Blocks: paragraphs, headings, images, lists, quotes, etc. Each of them is an independent <sup data-tune=\"footnotes\">1</sup> contenteditable element (or more complex structure) provided by Plugin and united by Editor's Core."
},
"tunes": {
"footnotes": [
"It works more stable then in other WYSIWYG editors. Same time it has smooth and well-known arrow navigation behavior like classic editors."
]
}
},
{
"id": "ksCokKAhQw",
"type": "paragraph",
"data": {
"text": "Classic WYSIWYG editors produce raw HTML-markup with both content data and content appearance. On the contrary, <mark class=\"cdx-marker\">Editor.js outputs JSON object</mark> with data of each Block."
}
},
{
"id": "XKNT99-qqS",
"type": "attaches",
"data": {
"file": {
"url": "https://drive.google.com/user/catalog/my-file.pdf",
"size": 12902,
"name": "file.pdf",
"extension": "pdf"
},
"title": "My file"
}
},
{
"id": "hZAjSnqYMX",
"type": "image",
"data": {
"file": {
"url": "assets/codex2x.png"
},
"withBorder": false,
"withBackground": false,
"stretched": true,
"caption": "CodeX Code Camp 2019"
}
}
]
}