Commit 6621c0a7 by ramdayalmunda

caret style fix when changing font size

parent a83bdb6a
......@@ -187,13 +187,18 @@ var ADocEditor = function (customConfig) {
change = change?change:config.style.fontSize
caretData.style.fontSize = change
fontSizeInput.value = change
focusOnPage()
} )
} )
fontSizeInput.addEventListener('input', (e)=>{
function changeFontEvent(e){
let value = Number( e.target.value )
value = value?value:config.style.fontSize
caretData.style.fontSize = value
})
if (e?.key == 'Enter') focusOnPage()
}
fontSizeInput.addEventListener('keydown', changeFontEvent)
fontSizeInput.addEventListener('input', changeFontEvent)
})()
......@@ -258,7 +263,6 @@ var ADocEditor = function (customConfig) {
renderCaret(true)
function calculateTextSizeAndPosition() {
console.clear()
let d = 0, c = 0;
function getLineObj() {
let newLineObj = {
......@@ -774,15 +778,17 @@ var ADocEditor = function (customConfig) {
let lineObj = lines.find(item => item.dataIndex == dataIndex && caretData.index >= item.charStartIndex)
let x = (config.format.margin * pxMmRatio) + lineObj.tabWidth
let y = (config.format.margin) * pxMmRatio
let height = lineObj.maxFontSize * pxMmRatio * 5 / 4
let height = caretData.style.fontSize * pxMmRatio * 5 / 4
let width = height / 10
let charData = caretData.activeData.formatedText[caretData.index - 1]
if (lineObj) {
x = (charData?(charData.x+charData.width):x)
if(charData)y = charData.y-(lineObj.maxFontSize*pxMmRatio)
else y = lineObj.y-(lineObj.maxFontSize*pxMmRatio)
if(charData){
y = charData.y - (caretData.style.fontSize*pxMmRatio)
}else{
y = lineObj.y - (lineObj.maxFontSize*pxMmRatio)
}
}
......
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