slab / delta

Simple and expressive JSON format for describing rich-text content and their changes
https://quilljs.com/docs/delta
BSD 3-Clause "New" or "Revised" License
914 stars 130 forks source link

Why abbreviate "operations"? #9

Closed christianhg closed 7 years ago

christianhg commented 7 years ago

This oddity was immediately noticed by my team as I'm trying to introduce Quill. All other properties seem to be spelled out. Why abbreviate "operations" to "ops"?

"delta": {
  "ops": [
    {
      "attributes": {
        "bold": true
      },
      "insert": "foo"
    },
    {
      "insert": " "
    },
    {
      "attributes": {
        "italic": true
      },
      "insert": "b"
    },
    {
      "attributes": {
        "italic": true,
        "bold": true
      },
      "insert": "ar"
    },
    {
      "attributes": {
        "bold": true
      },
      "insert": " "
    },
    {
      "attributes": {
        "underline": true,
        "bold": true
      },
      "insert": "ba"
    },
    {
      "attributes": {
        "underline": true
      },
      "insert": "z"
    },
    {
      "insert": "\n"
    }
  ]
}
jhchen commented 7 years ago

It's a fair question. Part of it is it is a long word and referenced a lot so was noticeably contributed to how often we would have to split lines into two to adhere with max line width constraints. Attributes is just as long of a word but less often used. The other factor was it seemed like a temporary name as ES6 at the time promised inheriting from Array in a way that the thought was Delta would soon inherit and not need the ops key anymore. This may still happen but implementation of the ES6 spec has taken longer than was advised.