Library doesn’t recognise {color:} as valid empty colour tag

Issue #58 resolved
Craig Lawrence created an issue

Request {color:}aaa{color}bbb{color}ccc{color}

Typescript

{
  "version": 1,
  "type": "doc",
  "content": [
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "aaa",
          "marks": [
            {
              "type": "textColor",
              "attrs": {
                "color": "#000000"
              }
            }
          ]
        },
        {
          "type": "text",
          "text": "bbb"
        },
        {
          "type": "text",
          "text": "ccc",
          "marks": [
            {
              "type": "textColor",
              "attrs": {
                "color": "#000000"
              }
            }
          ]
        }
      ]
    }
  ]
}

adf-builder-java

{
  "type" : "doc",
  "version" : 1,
  "content" : [ {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "{color:}aaa"
    }, {
      "type" : "text",
      "text" : "bbb",
      "marks" : [ {
        "type" : "textColor",
        "attrs" : {
          "color" : "#000000"
        }
      } ]
    }, {
      "type" : "text",
      "text" : "ccc"
    } ]
  } ]
}

Comments (4)

  1. Chris Fuller

    Interestingly, what the content service is doing there is wrong. The wiki renderer is doing this:

    Wiki

    Color macro with empty value {color:}foo{color}.
    

    HTML

    <p>Color macro with empty value <font color="">foo</font>.</p>
    

    The result of the empty color tag is for it to have no effect at all. However the content service’s transformer is producing a textColor mark with color #000000, which forces the color to black even when that isn’t what would otherwise be inherited. Since ADF is not permitted to use a textColor mark without it specifying a color value, the most correct thing we could do is simply discard the empty color macro and leave the text node unmarked.

    Of course, like so many other discrepancies, we may want to mimic FCS’s current wrong behaviour while we still care about consistency checking.

  2. Log in to comment