Commit 632d63be by ramdayalmunda

enter event in between text

parent 6c606c3b
...@@ -566,11 +566,18 @@ var ADocEditor = function (customConfig) { ...@@ -566,11 +566,18 @@ var ADocEditor = function (customConfig) {
tabCount: caretData.activeData.tabCount, tabCount: caretData.activeData.tabCount,
style: { ...caretData.activeData.style } style: { ...caretData.activeData.style }
} }
dataObj.plainContent = caretData.activeData.plainContent.slice(caretData.index)
caretData.activeData.plainContent = caretData.activeData.plainContent.slice(0,caretData.index)
dataObj.formatedText = caretData.activeData.formatedText.splice(caretData.index)
let activeDataIndex = dataList.findIndex( item => item.id==caretData.activeData.id )
dataList.splice( activeDataIndex+1, 0, dataObj )
if (e.ctrlKey || e.metaKey) dataObj.newPage = true if (e.ctrlKey || e.metaKey) dataObj.newPage = true
caretData.index = 0 caretData.index = 0
caretData.activeData = dataObj caretData.activeData = dataObj
if (dataObj.type == 0) dataObj.tabCount = 0 if (dataObj.type == 0) dataObj.tabCount = 0
dataList.push(dataObj) // dataList.push(dataObj)
} }
else if (e.key.length == 1 && !e.ctrlKey && !e.metaKey) { // displayable text else if (e.key.length == 1 && !e.ctrlKey && !e.metaKey) { // displayable text
// ***** DISPLAYABLE TEXT **** // // ***** DISPLAYABLE TEXT **** //
...@@ -848,6 +855,7 @@ var ADocEditor = function (customConfig) { ...@@ -848,6 +855,7 @@ var ADocEditor = function (customConfig) {
config = JSON.parse( JSON.stringify( data.config ) ) config = JSON.parse( JSON.stringify( data.config ) )
caretData = JSON.parse( JSON.stringify( data.caretData ) ) caretData = JSON.parse( JSON.stringify( data.caretData ) )
caretData.activeData = dataList[data.caretData.activeDataIndex] caretData.activeData = dataList[data.caretData.activeDataIndex]
caretData.blink = false
reRenderCanvas() reRenderCanvas()
}, },
addFonts, addFonts,
......
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