Commit 78778c19 by ramdayalmunda

Enter event in between the lines completed

parent 2767b644
...@@ -323,7 +323,6 @@ var ADocEditor = function (customConfig) { ...@@ -323,7 +323,6 @@ var ADocEditor = function (customConfig) {
// to render caret // to render caret
function renderCaret() { function renderCaret() {
console.log('renderCaret',caretData.canvasIndex, caretData.index)
let ctx = canvasList[caretData.canvasIndex].el.getContext('2d', { willReadFrequently: true }) let ctx = canvasList[caretData.canvasIndex].el.getContext('2d', { willReadFrequently: true })
let activeTextData = caretData.activeData.formatedText[caretData.index - 1] let activeTextData = caretData.activeData.formatedText[caretData.index - 1]
if (!activeTextData) activeTextData = caretData.activeData.style if (!activeTextData) activeTextData = caretData.activeData.style
...@@ -418,11 +417,12 @@ var ADocEditor = function (customConfig) { ...@@ -418,11 +417,12 @@ var ADocEditor = function (customConfig) {
plainContent: "", plainContent: "",
style: JSON.parse(JSON.stringify(style)) style: JSON.parse(JSON.stringify(style))
} }
newLineData.style.y += newLineData.style.fontSize newLineData.plainContent = caretData.activeData.plainContent.slice(caretData.index)
newLineData.style.x = 0 caretData.activeData.plainContent = caretData.activeData.plainContent.slice(0,caretData.index)
newLineData.style.width = 0 let currentDataIndex = dataSet.findIndex( item => item.id == caretData.activeData.id )
dataSet.push(newLineData) dataSet.splice(currentDataIndex+1, 0, newLineData)
caretData.activeData = newLineData caretData.activeData = dataSet[currentDataIndex+1]
caretData.y+= style.fontSize
caretData.index = 0 caretData.index = 0
} }
} }
...@@ -572,9 +572,7 @@ var ADocEditor = function (customConfig) { ...@@ -572,9 +572,7 @@ var ADocEditor = function (customConfig) {
charIndex++ 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