fix lint
parent
b616fd025e
commit
4439a04689
|
@ -95,6 +95,7 @@ module.exports = {
|
||||||
"new-cap": ["warn"],
|
"new-cap": ["warn"],
|
||||||
"key-spacing": ["warn"],
|
"key-spacing": ["warn"],
|
||||||
"prefer-const": ["warn"],
|
"prefer-const": ["warn"],
|
||||||
|
"arrow-parens": "off",
|
||||||
|
|
||||||
// crashes currently: https://github.com/eslint/eslint/issues/6274
|
// crashes currently: https://github.com/eslint/eslint/issues/6274
|
||||||
"generator-star-spacing": "off",
|
"generator-star-spacing": "off",
|
||||||
|
|
|
@ -16,11 +16,6 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Value } from 'slate';
|
import { Value } from 'slate';
|
||||||
import Html from 'slate-html-serializer';
|
|
||||||
import Md from 'slate-md-serializer';
|
|
||||||
import Plain from 'slate-plain-serializer';
|
|
||||||
import * as RichText from './RichText';
|
|
||||||
import Markdown from './Markdown';
|
|
||||||
|
|
||||||
import _clamp from 'lodash/clamp';
|
import _clamp from 'lodash/clamp';
|
||||||
|
|
||||||
|
@ -38,17 +33,17 @@ class HistoryItem {
|
||||||
this.format = format;
|
this.format = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJSON(obj): HistoryItem {
|
static fromJSON(obj: Object): HistoryItem {
|
||||||
return new HistoryItem(
|
return new HistoryItem(
|
||||||
Value.fromJSON(obj.value),
|
Value.fromJSON(obj.value),
|
||||||
obj.format
|
obj.format,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toJSON(): Object {
|
toJSON(): Object {
|
||||||
return {
|
return {
|
||||||
value: this.value.toJSON(),
|
value: this.value.toJSON(),
|
||||||
format: this.format
|
format: this.format,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,10 +62,9 @@ export default class ComposerHistoryManager {
|
||||||
for (; item = sessionStorage.getItem(`${this.prefix}[${this.currentIndex}]`); this.currentIndex++) {
|
for (; item = sessionStorage.getItem(`${this.prefix}[${this.currentIndex}]`); this.currentIndex++) {
|
||||||
try {
|
try {
|
||||||
this.history.push(
|
this.history.push(
|
||||||
HistoryItem.fromJSON(JSON.parse(item))
|
HistoryItem.fromJSON(JSON.parse(item)),
|
||||||
);
|
);
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
|
||||||
console.warn("Throwing away unserialisable history", e);
|
console.warn("Throwing away unserialisable history", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,8 +132,7 @@ export default class CommandProvider extends AutocompleteProvider {
|
||||||
let results;
|
let results;
|
||||||
if (command[0] == '/') {
|
if (command[0] == '/') {
|
||||||
results = COMMANDS;
|
results = COMMANDS;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
results = this.matcher.match(command[0]);
|
results = this.matcher.match(command[0]);
|
||||||
}
|
}
|
||||||
completions = results.map((result) => {
|
completions = results.map((result) => {
|
||||||
|
|
|
@ -31,7 +31,7 @@ class PlainWithPillsSerializer {
|
||||||
* @param {String} options.pillFormat - either 'md', 'plain', 'id'
|
* @param {String} options.pillFormat - either 'md', 'plain', 'id'
|
||||||
*/
|
*/
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
let {
|
const {
|
||||||
pillFormat = 'plain',
|
pillFormat = 'plain',
|
||||||
} = options;
|
} = options;
|
||||||
this.pillFormat = pillFormat;
|
this.pillFormat = pillFormat;
|
||||||
|
@ -46,7 +46,7 @@ class PlainWithPillsSerializer {
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
serialize = value => {
|
serialize = value => {
|
||||||
return this._serializeNode(value.document)
|
return this._serializeNode(value.document);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,8 +61,7 @@ class PlainWithPillsSerializer {
|
||||||
(node.object == 'block' && Block.isBlockList(node.nodes))
|
(node.object == 'block' && Block.isBlockList(node.nodes))
|
||||||
) {
|
) {
|
||||||
return node.nodes.map(this._serializeNode).join('\n');
|
return node.nodes.map(this._serializeNode).join('\n');
|
||||||
}
|
} else if (node.type == 'emoji') {
|
||||||
else if (node.type == 'emoji') {
|
|
||||||
return node.data.get('emojiUnicode');
|
return node.data.get('emojiUnicode');
|
||||||
} else if (node.type == 'pill') {
|
} else if (node.type == 'pill') {
|
||||||
switch (this.pillFormat) {
|
switch (this.pillFormat) {
|
||||||
|
@ -73,11 +72,9 @@ class PlainWithPillsSerializer {
|
||||||
case 'id':
|
case 'id':
|
||||||
return node.data.get('completionId') || node.data.get('completion');
|
return node.data.get('completionId') || node.data.get('completion');
|
||||||
}
|
}
|
||||||
}
|
} else if (node.nodes) {
|
||||||
else if (node.nodes) {
|
|
||||||
return node.nodes.map(this._serializeNode).join('');
|
return node.nodes.map(this._serializeNode).join('');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return node.text;
|
return node.text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,4 +86,4 @@ class PlainWithPillsSerializer {
|
||||||
* @type {PlainWithPillsSerializer}
|
* @type {PlainWithPillsSerializer}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default PlainWithPillsSerializer
|
export default PlainWithPillsSerializer;
|
||||||
|
|
Loading…
Reference in New Issue