@@ -0,0 +1,2827 @@
+import AbstractCommand from 'abstract-command';%0A%0Aclass PaddingCommand extends AbstractCommand %7B%0A  constructor(%7B direction = 'auto', delta = 50, max = 200, min = 0 %7D = %7B%7D, root = document.documentElement, doc: Document = root.ownerDocument) %7B%0A    super(doc);%0A    this.direction = direction;%0A    this.delta = delta;%0A    this.max = max;%0A    this.min = min;%0A    this.root = root;%0A    this.document = doc;%0A  %7D%0A%0A  _getProp(paragraph) %7B%0A    let direction = this.direction;%0A%0A    // TODO: properly handle LTR here%0A    if (direction == 'auto') %7B%0A      direction = 'left';%0A    %7D%0A%0A    return %60padding-$%7Bdirection%7D%60;%0A  %7D%0A%0A  _setPadding(paragraph, padding) %7B%0A    let value = %60$%7Bpadding%7Dpx%60;%0A    let prop = this._getProp(paragraph);%0A%0A    // attempt to clear padding in inline style and check if the computed%0A    // value matches the desired padding. If it does, keep it blank, since%0A    // the padding specified on the stylesheet is the correct one.%0A    paragraph.style%5Bprop%5D = '';%0A    let style = window.getComputedStyle(paragraph);%0A    if (style%5Bprop%5D == value) return;%0A%0A    paragraph.style%5Bprop%5D = value;%0A  %7D%0A%0A  _getPadding(paragraph) %7B%0A    let prop = this._getProp(paragraph);%0A    let padding = paragraph.style%5Bprop%5D;%0A    if (padding && padding.match('%5B0-9%5C.%5D+px')) return parseInt(padding);%0A%0A    let style = window.getComputedStyle(paragraph);%0A    return parseInt(style%5Bprop%5D) %7C%7C 0;%0A  %7D%0A%0A  _isParagraph(node) %7B%0A    return node.nodeName == 'P';%0A  %7D%0A%0A  _findParagraph(node) %7B%0A    while (node && node != this.root) %7B%0A      if (this._isParagraph(node)) return node;%0A      node = node.parentNode;%0A    %7D%0A    return null;%0A  %7D%0A%0A  _findParagraphs(range) %7B%0A    let firstParagraph = this._findParagraph(range.startContainer);%0A    let lastParagraph = this._findParagraph(range.endContainer);%0A    if (firstParagraph.parentNode != lastParagraph.parentNode) %7B%0A      // we don't handle this case yet%0A      return %5B%5D;%0A    %7D%0A    let result = %5B%5D;%0A    for (let node = firstParagraph; node != lastParagraph; node = node.nextSibling) %7B%0A      if (this._isParagraph(node)) %7B%0A        result.push(node);%0A      %7D%0A    %7D%0A    result.push(lastParagraph);%0A    return result;%0A  %7D%0A%0A  _execute(range) %7B%0A    if (!range) return;%0A    let paragraphs = this._findParagraphs(range);%0A    for (let paragraph of paragraphs) %7B%0A      let padding = this._getPadding(paragraph)%0A      this._setPadding(paragraph, Math.min(Math.max(padding + this.delta, this.min), this.max));%0A    %7D%0A  %7D%0A%0A  _queryEnabled(range) %7B%0A    if (!range) return false;%0A    let paragraphs = this._findParagraphs(range);%0A    if (paragraphs.length == 0) return false;%0A    let values = paragraphs.map((paragraph) =%3E this._getPadding(paragraph) + this.delta);%0A    return values.some((value) =%3E value %3E= this.min && value %3C= this.max);%0A  %7D%0A%0A  _queryState(range) %7B%0A    return false;%0A  %7D%0A%7D%0A%0Aexport default PaddingCommand;

Add initial padding-command implementation.