Skip to content

Commit

Permalink
Revert "balance table cells"
Browse files Browse the repository at this point in the history
This reverts commit 3f6b478.
  • Loading branch information
jhchen committed Apr 26, 2018
1 parent 3f6b478 commit afcea0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 34 deletions.
23 changes: 9 additions & 14 deletions blots/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Scroll extends Parchment.Scroll {

batchEnd() {
this.batch = false;
this.optimize();
}

emitMount(blot) {
Expand Down Expand Up @@ -149,27 +150,21 @@ class Scroll extends Parchment.Scroll {
// Never remove self
}

update(mutations, context = {}) {
update(mutations) {
if (this.batch === true) return;
context.source =
typeof mutations === 'string' ? mutations : Emitter.sources.USER;
let source = Emitter.sources.USER;
if (typeof mutations === 'string') {
source = mutations;
}
if (!Array.isArray(mutations)) {
mutations = this.observer.takeRecords();
}
if (mutations.length > 0) {
this.emitter.emit(
Emitter.events.SCROLL_BEFORE_UPDATE,
context.source,
mutations,
);
this.emitter.emit(Emitter.events.SCROLL_BEFORE_UPDATE, source, mutations);
}
super.update(mutations.concat([]), context); // pass copy
super.update(mutations.concat([])); // pass copy
if (mutations.length > 0) {
this.emitter.emit(
Emitter.events.SCROLL_UPDATE,
context.source,
mutations,
);
this.emitter.emit(Emitter.events.SCROLL_UPDATE, source, mutations);
}
}
}
Expand Down
23 changes: 3 additions & 20 deletions modules/table.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Parchment from 'parchment';
import Block from '../blots/block';
import Container from '../blots/container';
import Quill from '../core/quill';
import Module from '../core/module';
import {
Expand All @@ -14,26 +17,6 @@ class Table extends Module {
Quill.register(TableBody);
Quill.register(TableContainer);
}

constructor(...args) {
super(...args);
this.quill.on(Quill.events.SCROLL_OPTIMIZE, (mutations, context) => {
if (context.source !== Quill.sources.USER) return;
const tables = new Set(
mutations
.map(mutation => {
if (mutation.target.tagName === 'TABLE') {
return Quill.find(mutation.target);
}
return null;
})
.filter(blot => blot != null),
);
tables.forEach(table => {
table.balanceCells();
});
});
}
}

export default Table;

0 comments on commit afcea0a

Please sign in to comment.