Skip to content

Commit

Permalink
pass through parchment context
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Jun 20, 2017
1 parent 4e874c4 commit ee869f4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions blots/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class Block extends Parchment.Block {
this.cache = {};
}

optimize() {
super.optimize();
optimize(context) {
super.optimize(context);
this.cache = {};
}

Expand Down
4 changes: 2 additions & 2 deletions blots/inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class Inline extends Parchment.Inline {
}
}

optimize() {
super.optimize();
optimize(context) {
super.optimize(context);
if (this.parent instanceof Inline &&
Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
let parent = this.parent.isolate(this.offset(), this.length());
Expand Down
4 changes: 2 additions & 2 deletions formats/bold.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class Bold extends Inline {
return true;
}

optimize() {
super.optimize();
optimize(context) {
super.optimize(context);
if (this.domNode.tagName !== this.statics.tagName[0]) {
this.replaceWith(this.statics.blotName);
}
Expand Down
6 changes: 3 additions & 3 deletions formats/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ class CodeBlock extends Block {
}
}

optimize() {
optimize(context) {
if (!this.domNode.textContent.endsWith('\n')) {
this.appendChild(Parchment.create('text', '\n'));
}
super.optimize();
super.optimize(context);
let next = this.next;
if (next != null && next.prev === this &&
next.statics.blotName === this.statics.blotName &&
this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {
next.optimize();
next.optimize(context);
next.moveChildren(this);
next.remove();
}
Expand Down
4 changes: 2 additions & 2 deletions formats/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class List extends Container {
}
}

optimize() {
super.optimize();
optimize(context) {
super.optimize(context);
let next = this.next;
if (next != null && next.prev === this &&
next.statics.blotName === this.statics.blotName &&
Expand Down

0 comments on commit ee869f4

Please sign in to comment.