From fd31e793d120ad0baa83c934506bac61b3c8749e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 14 May 2019 15:49:53 +0100 Subject: [PATCH] fix lint --- src/editor/dom.js | 3 ++- src/editor/model.js | 6 +++++- src/editor/render.js | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/editor/dom.js b/src/editor/dom.js index fd46c0820a..0899fd25b3 100644 --- a/src/editor/dom.js +++ b/src/editor/dom.js @@ -37,7 +37,8 @@ function walkDOMDepthFirst(editor, enterNodeCallback, leaveNodeCallback) { } export function getCaretOffsetAndText(editor, sel) { - let {focusOffset, focusNode} = sel; + let {focusNode} = sel; + const {focusOffset} = sel; let caretOffset = focusOffset; let foundCaret = false; let text = ""; diff --git a/src/editor/model.js b/src/editor/model.js index c35d55e309..ebf92c9a79 100644 --- a/src/editor/model.js +++ b/src/editor/model.js @@ -171,6 +171,8 @@ export default class EditorModel { /** * removes `len` amount of characters at `pos`. + * @param {Object} pos + * @param {Number} len * @return {Number} how many characters before pos were also removed, * usually because of non-editable parts that can only be removed in their entirety. */ @@ -205,10 +207,12 @@ export default class EditorModel { /** * inserts `str` into the model at `pos`. + * @param {Object} pos + * @param {string} str * @return {Number} how far from position (in characters) the insertion ended. * This can be more than the length of `str` when crossing non-editable parts, which are skipped. */ - _addText(pos, str, actions) { + _addText(pos, str) { let {index} = pos; const {offset} = pos; let addLen = str.length; diff --git a/src/editor/render.js b/src/editor/render.js index 34643ff8b7..052c11c320 100644 --- a/src/editor/render.js +++ b/src/editor/render.js @@ -40,9 +40,7 @@ export function renderModel(editor, model) { } return lines; }, [[]]); - - // console.log(lines.map(parts => parts.map(p => p.toString()))); - + // TODO: refactor this code, DRY it lines.forEach((parts, i) => { let lineContainer = editor.childNodes[i]; while (lineContainer && (lineContainer.tagName !== "DIV" || !!lineContainer.className)) {