Skip to content

Marking up text- like bolding - inserts HTML tags into the JSON data text string #1607

Description

@uuykay

Question

HI there, I love your editor, and when I was first rolling my own solution, I came up with an API similar to your block API. One thing I noticed however when playing with your homepage demo, was that if you highlight a word and make it bold, it goes from:

 {
      "type" : "paragraph",
      "data" : {
          "text" : "Hey. Meet the new Editor. On this page you can see it in action — try to edit this text."
      }
  },

to

 {
      "type" : "paragraph",
      "data" : {
          "text" : "Hey. <b>Meet </b>the new Editor. On this page you can see it in action — try to edit this text."
      }
  },

The tag inside is not ideal for use in React. To parse it I would need to do some string manipulation to strip it out and replace it properly. Do you have an alternative to this?

Context

I want to use this in React, and of course I need only JSON data, no tags within the data.

Related issues

If there are related issues which describe a bugs or features, put them here

Comments

So like I said when I was coming up with a solution myself my API was similar but slightly different. If I wanted to bold a word in the middle of a sentence, I would do something like:

 {
{
          type: "p",
          content: [
            {
              type: "strong",
              content: "Identify ",
            },
            {
              type: "span",
              content: "the correct statement about both satellites.",
            },
          ],
        }
  },

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions