Задать вопрос
@balex777

Как получить текст из сохраненного _immutable обьекта Draft js?

Привет, в базе сохраняю текст из Draft js в таком виде.

Как из этого объекта получить текст в любом нужном мне месте?

{
  "_immutable": {
    "allowUndo": true,
    "currentContent": {
      "entityMap": {},
      "blockMap": {
        "32roc": {
          "key": "32roc",
          "type": "unstyled",
          "text": "ощгрищшгр шщорщ",
          "characterList": [
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            },
            {
              "style": [],
              "entity": null
            }
          ],
          "depth": 0,
          "data": {}
        }
      },
      "selectionBefore": {
        "anchorKey": "32roc",
        "anchorOffset": 0,
        "focusKey": "32roc",
        "focusOffset": 0,
        "isBackward": false,
        "hasFocus": true
      },
      "selectionAfter": {
        "anchorKey": "32roc",
        "anchorOffset": 15,
        "focusKey": "32roc",
        "focusOffset": 15,
        "isBackward": false,
        "hasFocus": true
      }
    },
    "decorator": {
      "_decorators": [
        {}
      ]
    },
    "directionMap": {
      "32roc": "LTR"
    },
    "forceSelection": false,
    "inCompositionMode": false,
    "inlineStyleOverride": null,
    "lastChangeType": "insert-characters",
    "nativelyRenderedContent": null,
    "redoStack": [],
    "selection": {
      "anchorKey": "32roc",
      "anchorOffset": 15,
      "focusKey": "32roc",
      "focusOffset": 15,
      "isBackward": false,
      "hasFocus": false
    },
    "treeMap": {
      "32roc": [
        {
          "start": 0,
          "end": 15,
          "decoratorKey": null,
          "leaves": [
            {
              "start": 0,
              "end": 15
            }
          ]
        }
      ]
    },
    "undoStack": [
      {
        "entityMap": {},
        "blockMap": {
          "32roc": {
            "key": "32roc",
            "type": "unstyled",
            "text": "",
            "characterList": [],
            "depth": 0,
            "data": {}
          }
        },
        "selectionBefore": {
          "anchorKey": "32roc",
          "anchorOffset": 0,
          "focusKey": "32roc",
          "focusOffset": 0,
          "isBackward": false,
          "hasFocus": false
        },
        "selectionAfter": {
          "anchorKey": "32roc",
          "anchorOffset": 0,
          "focusKey": "32roc",
          "focusOffset": 0,
          "isBackward": false,
          "hasFocus": false
        }
      }
    ]
  }
}
  • Вопрос задан
  • 38 просмотров
Подписаться 1 Простой Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы