mirror of https://github.com/vector-im/riot-web
fix lint
parent
0b18ff52c5
commit
fd31e793d1
|
@ -37,7 +37,8 @@ function walkDOMDepthFirst(editor, enterNodeCallback, leaveNodeCallback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCaretOffsetAndText(editor, sel) {
|
export function getCaretOffsetAndText(editor, sel) {
|
||||||
let {focusOffset, focusNode} = sel;
|
let {focusNode} = sel;
|
||||||
|
const {focusOffset} = sel;
|
||||||
let caretOffset = focusOffset;
|
let caretOffset = focusOffset;
|
||||||
let foundCaret = false;
|
let foundCaret = false;
|
||||||
let text = "";
|
let text = "";
|
||||||
|
|
|
@ -171,6 +171,8 @@ export default class EditorModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* removes `len` amount of characters at `pos`.
|
* removes `len` amount of characters at `pos`.
|
||||||
|
* @param {Object} pos
|
||||||
|
* @param {Number} len
|
||||||
* @return {Number} how many characters before pos were also removed,
|
* @return {Number} how many characters before pos were also removed,
|
||||||
* usually because of non-editable parts that can only be removed in their entirety.
|
* 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`.
|
* inserts `str` into the model at `pos`.
|
||||||
|
* @param {Object} pos
|
||||||
|
* @param {string} str
|
||||||
* @return {Number} how far from position (in characters) the insertion ended.
|
* @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.
|
* 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;
|
let {index} = pos;
|
||||||
const {offset} = pos;
|
const {offset} = pos;
|
||||||
let addLen = str.length;
|
let addLen = str.length;
|
||||||
|
|
|
@ -40,9 +40,7 @@ export function renderModel(editor, model) {
|
||||||
}
|
}
|
||||||
return lines;
|
return lines;
|
||||||
}, [[]]);
|
}, [[]]);
|
||||||
|
// TODO: refactor this code, DRY it
|
||||||
// console.log(lines.map(parts => parts.map(p => p.toString())));
|
|
||||||
|
|
||||||
lines.forEach((parts, i) => {
|
lines.forEach((parts, i) => {
|
||||||
let lineContainer = editor.childNodes[i];
|
let lineContainer = editor.childNodes[i];
|
||||||
while (lineContainer && (lineContainer.tagName !== "DIV" || !!lineContainer.className)) {
|
while (lineContainer && (lineContainer.tagName !== "DIV" || !!lineContainer.className)) {
|
||||||
|
|
Loading…
Reference in New Issue