Apply JS formatter
This commit is contained in:
parent
f3f37fff02
commit
dd5a6ff85b
@ -7,11 +7,7 @@ class BesEditor {
|
|||||||
this.children = []
|
this.children = []
|
||||||
this.correctionPanel = document.getElementById('correction-panel') // TODO: use document.createElement('div') and insert it before edit element in DOM.
|
this.correctionPanel = document.getElementById('correction-panel') // TODO: use document.createElement('div') and insert it before edit element in DOM.
|
||||||
this.proof(edit)
|
this.proof(edit)
|
||||||
edit.addEventListener(
|
edit.addEventListener('beforeinput', e => this.handleBeforeInput(e), false)
|
||||||
'beforeinput',
|
|
||||||
e => this.handleBeforeInput(e),
|
|
||||||
false
|
|
||||||
)
|
|
||||||
edit.addEventListener('click', e => this.handleClick(e))
|
edit.addEventListener('click', e => this.handleClick(e))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +68,10 @@ class BesEditor {
|
|||||||
/*startingOffset <= match.offset &&*/ match.offset <
|
/*startingOffset <= match.offset &&*/ match.offset <
|
||||||
startingOffset + data[idx].text.length
|
startingOffset + data[idx].text.length
|
||||||
) {
|
) {
|
||||||
range.setStart(data[idx].el, match.offset - startingOffset)
|
range.setStart(
|
||||||
|
data[idx].el,
|
||||||
|
match.offset - startingOffset
|
||||||
|
)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +230,8 @@ class BesEditor {
|
|||||||
// Returns first block parent element
|
// Returns first block parent element
|
||||||
getBlockParent(el) {
|
getBlockParent(el) {
|
||||||
for (; el && el !== this.el; el = el.parentNode) {
|
for (; el && el !== this.el; el = el.parentNode) {
|
||||||
if (el.nodeType === Node.ELEMENT_NODE && BesEditor.isBlockElement(el)) return el
|
if (el.nodeType === Node.ELEMENT_NODE && BesEditor.isBlockElement(el))
|
||||||
|
return el
|
||||||
}
|
}
|
||||||
return el
|
return el
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user