Commit e1d0ff89 by ramdayalmunda

width and indenation fix

parent 2470d679
...@@ -252,7 +252,7 @@ var ADocEditor = function (customConfig) { ...@@ -252,7 +252,7 @@ var ADocEditor = function (customConfig) {
// to calculate the lines // to calculate the lines
let tempLineWidth = 0; let tempLineWidth = 0;
let maxLineWidth = config.pageSetup.pxWidth - (config.format.margin * pxMmRatio * 2) let maxLineWidth = config.pageSetup.pxWidth - (config.format.margin * pxMmRatio * 2)
let tabWidth =( (dataBlock.type==1?1:0)+ dataBlock.tabCount)*config.format.tabWidth*pxMmRatio let tabWidth = ( (dataBlock.type==1?1:0)+ dataBlock.tabCount)*config.format.tabWidth*pxMmRatio
lineObj.tabWidth = tabWidth lineObj.tabWidth = tabWidth
maxLineWidth -= tabWidth maxLineWidth -= tabWidth
lineObj.dataType = dataBlock.type lineObj.dataType = dataBlock.type
...@@ -275,9 +275,13 @@ var ADocEditor = function (customConfig) { ...@@ -275,9 +275,13 @@ var ADocEditor = function (customConfig) {
lineObj.plainContent = dataBlock.plainContent.slice(lineObj.charStartIndex, lineObj.charEndIndex + 1) lineObj.plainContent = dataBlock.plainContent.slice(lineObj.charStartIndex, lineObj.charEndIndex + 1)
lines.push(lineObj) lines.push(lineObj)
lineObj = new getLineObj() lineObj = new getLineObj()
lineObj.listIndex = dataBlock.listIndex maxLineWidth = config.pageSetup.pxWidth - (config.format.margin * pxMmRatio * 2)
lineObj.maxLineWidth = maxLineWidth lineObj.maxLineWidth = maxLineWidth
lineObj.tabCount = dataBlock.tabCount if (dataBlock.type==1) lineObj.tabWidth = tabWidth
else lineObj.tabWidth = 0
lineObj.listIndex = dataBlock.listIndex
if (dataBlock.type==1) lineObj.tabCount = dataBlock.tabCount
else lineObj.tabCount = 0
lineObj.charStartIndex = i + 1 lineObj.charStartIndex = i + 1
lineObj.charEndIndex = i + 1 lineObj.charEndIndex = i + 1
tempLineWidth = 0 tempLineWidth = 0
...@@ -342,7 +346,6 @@ var ADocEditor = function (customConfig) { ...@@ -342,7 +346,6 @@ var ADocEditor = function (customConfig) {
caretData.previousCaret = null caretData.previousCaret = null
} }
if (!caretData.blink) { if (!caretData.blink) {
let x = config.format.margin * pxMmRatio let x = config.format.margin * pxMmRatio
let y = (config.format.margin) * pxMmRatio let y = (config.format.margin) * pxMmRatio
let height = config.style.fontSize * pxMmRatio * 5 / 4 let height = config.style.fontSize * pxMmRatio * 5 / 4
...@@ -438,15 +441,14 @@ var ADocEditor = function (customConfig) { ...@@ -438,15 +441,14 @@ var ADocEditor = function (customConfig) {
else if (e.key == 'Backspace') { else if (e.key == 'Backspace') {
if (caretData.index == 0) { if (caretData.index == 0) {
let activeDataIndex = dataList.findIndex(item => item.id == caretData.activeData.id) let activeDataIndex = dataList.findIndex(item => item.id == caretData.activeData.id)
if (activeDataIndex > 0) {
if ( caretData.activeData.type == 0 ){
if (caretData.activeData.tabCount){ if (caretData.activeData.tabCount){
caretData.activeData.tabCount-- caretData.activeData.tabCount--
}else{ }
else if (activeDataIndex > 0) {
if ( caretData.activeData.type == 0 ){
if (!caretData.activeData.plainContent.length){ dataList.splice( activeDataIndex, 1 ) } if (!caretData.activeData.plainContent.length){ dataList.splice( activeDataIndex, 1 ) }
caretData.activeData = dataList[activeDataIndex - 1] caretData.activeData = dataList[activeDataIndex - 1]
caretData.index = caretData.activeData.plainContent.length caretData.index = caretData.activeData.plainContent.length
}
}else if ( caretData.activeData.type==1 ){ }else if ( caretData.activeData.type==1 ){
caretData.activeData.type = 0 caretData.activeData.type = 0
} }
...@@ -469,6 +471,7 @@ var ADocEditor = function (customConfig) { ...@@ -469,6 +471,7 @@ var ADocEditor = function (customConfig) {
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
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
......
const express = require("express") const express = require("express")
const port = 3910; const port = 3910;
const path = require("path"); const path = require("path");
console.log( typeof FileReader )
const app = express() const app = express()
app.use( express.json() ) app.use( express.json() )
......
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