chore: Enable eslint to enforce curly (#3060)
This commit is contained in:
@@ -150,7 +150,9 @@ export default class CodeFence extends Node {
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
if (!isInCode(state)) return false;
|
||||
if (!isInCode(state)) {
|
||||
return false;
|
||||
}
|
||||
const {
|
||||
tr,
|
||||
selection,
|
||||
@@ -171,7 +173,9 @@ export default class CodeFence extends Node {
|
||||
return true;
|
||||
},
|
||||
Tab: (state: EditorState, dispatch: (tr: Transaction) => void) => {
|
||||
if (!isInCode(state)) return false;
|
||||
if (!isInCode(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { tr, selection } = state;
|
||||
dispatch(tr.insertText(" ", selection.from, selection.to));
|
||||
|
||||
@@ -39,7 +39,9 @@ export default class HardBreak extends Node {
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
if (!isInTable(state)) return false;
|
||||
if (!isInTable(state)) {
|
||||
return false;
|
||||
}
|
||||
dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView());
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -216,7 +216,9 @@ export default class Heading extends Node {
|
||||
const previouslySeen = {};
|
||||
|
||||
doc.descendants((node, pos) => {
|
||||
if (node.type.name !== this.name) return;
|
||||
if (node.type.name !== this.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
// calculate the optimal id
|
||||
const slug = headingToSlug(node);
|
||||
|
||||
@@ -41,7 +41,9 @@ const uploadPlugin = (options: Options) =>
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!event.clipboardData) return false;
|
||||
if (!event.clipboardData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if we actually pasted any files
|
||||
const files = Array.prototype.slice
|
||||
@@ -49,7 +51,9 @@ const uploadPlugin = (options: Options) =>
|
||||
.map((dt: any) => dt.getAsFile())
|
||||
.filter((file: File) => file);
|
||||
|
||||
if (files.length === 0) return false;
|
||||
if (files.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { tr } = view.state;
|
||||
if (!tr.selection.empty) {
|
||||
@@ -96,7 +100,9 @@ const uploadPlugin = (options: Options) =>
|
||||
const IMAGE_CLASSES = ["right-50", "left-50"];
|
||||
|
||||
const getLayoutAndTitle = (tokenTitle: string | null) => {
|
||||
if (!tokenTitle) return {};
|
||||
if (!tokenTitle) {
|
||||
return {};
|
||||
}
|
||||
if (IMAGE_CLASSES.includes(tokenTitle)) {
|
||||
return {
|
||||
layoutClass: tokenTitle,
|
||||
@@ -242,7 +248,9 @@ export default class Image extends Node {
|
||||
const alt = event.currentTarget.innerText;
|
||||
const { src, title, layoutClass } = node.attrs;
|
||||
|
||||
if (alt === node.attrs.alt) return;
|
||||
if (alt === node.attrs.alt) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { view } = this.editor;
|
||||
const { tr } = view.state;
|
||||
|
||||
@@ -203,8 +203,12 @@ export default class ListItem extends Node {
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
if (!isInList(state)) return false;
|
||||
if (!state.selection.empty) return false;
|
||||
if (!isInList(state)) {
|
||||
return false;
|
||||
}
|
||||
if (!state.selection.empty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { tr, selection } = state;
|
||||
dispatch(tr.split(selection.to));
|
||||
@@ -214,9 +218,13 @@ export default class ListItem extends Node {
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
if (!state.selection.empty) return false;
|
||||
if (!state.selection.empty) {
|
||||
return false;
|
||||
}
|
||||
const result = getParentListItem(state);
|
||||
if (!result) return false;
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const [li, pos] = result;
|
||||
const $pos = state.doc.resolve(pos);
|
||||
@@ -244,9 +252,13 @@ export default class ListItem extends Node {
|
||||
state: EditorState,
|
||||
dispatch: (tr: Transaction) => void
|
||||
) => {
|
||||
if (!state.selection.empty) return false;
|
||||
if (!state.selection.empty) {
|
||||
return false;
|
||||
}
|
||||
const result = getParentListItem(state);
|
||||
if (!result) return false;
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const [li, pos] = result;
|
||||
const $pos = state.doc.resolve(pos + li.nodeSize);
|
||||
|
||||
@@ -124,7 +124,9 @@ export default class Table extends Node {
|
||||
Tab: goToNextCell(1),
|
||||
"Shift-Tab": goToNextCell(-1),
|
||||
Enter: (state: EditorState, dispatch: (tr: Transaction) => void) => {
|
||||
if (!isInTable(state)) return false;
|
||||
if (!isInTable(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Adding row at the end for now, can we find the current cell
|
||||
// row index and add the row below that?
|
||||
@@ -156,11 +158,15 @@ export default class Table extends Node {
|
||||
let index = 0;
|
||||
|
||||
doc.descendants((node, pos) => {
|
||||
if (node.type.name !== this.name) return;
|
||||
if (node.type.name !== this.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
const elements = document.getElementsByClassName("rme-table");
|
||||
const table = elements[index];
|
||||
if (!table) return;
|
||||
if (!table) {
|
||||
return;
|
||||
}
|
||||
|
||||
const element = table.parentElement;
|
||||
const shadowRight = !!(
|
||||
|
||||
Reference in New Issue
Block a user