Skip to content

Commit

Permalink
update dependencies and lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 29, 2018
1 parent a5894ab commit c87c749
Show file tree
Hide file tree
Showing 14 changed files with 1,667 additions and 3,862 deletions.
6 changes: 4 additions & 2 deletions blots/inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ class Inline extends InlineBlot {
const otherIndex = Inline.order.indexOf(other);
if (selfIndex >= 0 || otherIndex >= 0) {
return selfIndex - otherIndex;
} else if (self === other) {
}
if (self === other) {
return 0;
} else if (self < other) {
}
if (self < other) {
return -1;
}
return 1;
Expand Down
9 changes: 6 additions & 3 deletions core/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ function convertListHTML(items, lastIndent, types) {
offset,
length,
)}${convertListHTML(rest, indent, types)}`;
} else if (indent === lastIndent) {
}
if (indent === lastIndent) {
return `</li><li${attribute}>${convertHTML(
child,
offset,
Expand All @@ -259,9 +260,11 @@ function convertListHTML(items, lastIndent, types) {
function convertHTML(blot, index, length, isRoot = false) {
if (typeof blot.html === 'function') {
return blot.html(index, length);
} else if (blot instanceof TextBlot) {
}
if (blot instanceof TextBlot) {
return escapeText(blot.value().slice(index, index + length));
} else if (blot.children) {
}
if (blot.children) {
// TODO fix API
if (blot.statics.blotName === 'list-container') {
const items = [];
Expand Down
5 changes: 2 additions & 3 deletions core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,8 @@ class Quill {
() => {
const range = this.getSelection(true);
let change = new Delta();
if (range == null) {
return change;
} else if (this.scroll.query(name, Parchment.Scope.BLOCK)) {
if (range == null) return change;
if (this.scroll.query(name, Parchment.Scope.BLOCK)) {
change = this.editor.formatLine(range.index, range.length, {
[name]: value,
});
Expand Down
3 changes: 2 additions & 1 deletion core/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ class Selection {
const index = blot.offset(this.scroll);
if (offset === 0) {
return index;
} else if (blot instanceof ContainerBlot) {
}
if (blot instanceof ContainerBlot) {
return index + blot.length();
}
return index + blot.index(node, offset);
Expand Down
2 changes: 1 addition & 1 deletion formats/image.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EmbedBlot } from 'parchment';
import { sanitize } from '../formats/link';
import { sanitize } from './link';

const ATTRIBUTES = ['alt', 'height', 'width'];

Expand Down
3 changes: 2 additions & 1 deletion formats/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class Script extends Inline {
static create(value) {
if (value === 'super') {
return document.createElement('sup');
} else if (value === 'sub') {
}
if (value === 'sub') {
return document.createElement('sub');
}
return super.create(value);
Expand Down
2 changes: 1 addition & 1 deletion formats/video.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BlockEmbed } from '../blots/block';
import Link from '../formats/link';
import Link from './link';

const ATTRIBUTES = ['height', 'width'];

Expand Down
6 changes: 4 additions & 2 deletions modules/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class Clipboard extends Module {
return new Delta().insert(text, {
[CodeBlock.blotName]: formats[CodeBlock.blotName],
});
} else if (!html) {
}
if (!html) {
return new Delta().insert(text || '');
}
const doc = new DOMParser().parseFromString(
Expand Down Expand Up @@ -298,7 +299,8 @@ function traverse(scroll, node, elementMatchers, textMatchers, nodeMatches) {
return textMatchers.reduce((delta, matcher) => {
return matcher(node, delta, scroll);
}, new Delta());
} else if (node.nodeType === node.ELEMENT_NODE) {
}
if (node.nodeType === node.ELEMENT_NODE) {
return Array.from(node.childNodes || []).reduce((delta, childNode) => {
let childrenDelta = traverse(
scroll,
Expand Down
6 changes: 4 additions & 2 deletions modules/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,11 @@ function tableSide(table, row, cell, offset) {
return offset === 0 ? -1 : 1;
}
return cell.prev == null ? -1 : 1;
} else if (row.prev == null) {
}
if (row.prev == null) {
return -1;
} else if (row.next == null) {
}
if (row.next == null) {
return 1;
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion modules/syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import BreakBlot from '../blots/break';
import CursorBlot from '../blots/cursor';
import TextBlot, { escapeText } from '../blots/text';
import CodeBlock, { CodeBlockContainer } from '../formats/code';
import { traverse } from '../modules/clipboard';
import { traverse } from './clipboard';

const TokenAttributor = new ClassAttributor('code-token', 'hljs', {
scope: Scope.INLINE,
Expand Down
Loading

0 comments on commit c87c749

Please sign in to comment.