Commit 78778c19 by ramdayalmunda

Enter event in between the lines completed

parent 2767b644
......@@ -323,7 +323,6 @@ var ADocEditor = function (customConfig) {
// to render caret
function renderCaret() {
console.log('renderCaret',caretData.canvasIndex, caretData.index)
let ctx = canvasList[caretData.canvasIndex].el.getContext('2d', { willReadFrequently: true })
let activeTextData = caretData.activeData.formatedText[caretData.index - 1]
if (!activeTextData) activeTextData = caretData.activeData.style
......@@ -418,11 +417,12 @@ var ADocEditor = function (customConfig) {
plainContent: "",
style: JSON.parse(JSON.stringify(style))
}
newLineData.style.y += newLineData.style.fontSize
newLineData.style.x = 0
newLineData.style.width = 0
dataSet.push(newLineData)
caretData.activeData = newLineData
newLineData.plainContent = caretData.activeData.plainContent.slice(caretData.index)
caretData.activeData.plainContent = caretData.activeData.plainContent.slice(0,caretData.index)
let currentDataIndex = dataSet.findIndex( item => item.id == caretData.activeData.id )
dataSet.splice(currentDataIndex+1, 0, newLineData)
caretData.activeData = dataSet[currentDataIndex+1]
caretData.y+= style.fontSize
caretData.index = 0
}
}
......@@ -572,9 +572,7 @@ var ADocEditor = function (customConfig) {
charIndex++
}
console.log("last line:", caretData.canvasIndex)
}
console.log('full break;', caretData.canvasIndex, caretData.index)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment