Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
a-doc-editor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramdayal Munda
a-doc-editor
Commits
6621c0a7
Commit
6621c0a7
authored
Jan 13, 2024
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caret style fix when changing font size
parent
a83bdb6a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
a-doc-editor2.js
dist/assets/a-doc-editor2.js
+13
-7
No files found.
dist/assets/a-doc-editor2.js
View file @
6621c0a7
...
@@ -187,13 +187,18 @@ var ADocEditor = function (customConfig) {
...
@@ -187,13 +187,18 @@ var ADocEditor = function (customConfig) {
change
=
change
?
change
:
config
.
style
.
fontSize
change
=
change
?
change
:
config
.
style
.
fontSize
caretData
.
style
.
fontSize
=
change
caretData
.
style
.
fontSize
=
change
fontSizeInput
.
value
=
change
fontSizeInput
.
value
=
change
focusOnPage
()
}
)
}
)
}
)
}
)
fontSizeInput
.
addEventListener
(
'input'
,
(
e
)
=>
{
function
changeFontEvent
(
e
){
let
value
=
Number
(
e
.
target
.
value
)
let
value
=
Number
(
e
.
target
.
value
)
value
=
value
?
value
:
config
.
style
.
fontSize
value
=
value
?
value
:
config
.
style
.
fontSize
caretData
.
style
.
fontSize
=
value
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) {
...
@@ -258,7 +263,6 @@ var ADocEditor = function (customConfig) {
renderCaret
(
true
)
renderCaret
(
true
)
function
calculateTextSizeAndPosition
()
{
function
calculateTextSizeAndPosition
()
{
console
.
clear
()
let
d
=
0
,
c
=
0
;
let
d
=
0
,
c
=
0
;
function
getLineObj
()
{
function
getLineObj
()
{
let
newLineObj
=
{
let
newLineObj
=
{
...
@@ -774,15 +778,17 @@ var ADocEditor = function (customConfig) {
...
@@ -774,15 +778,17 @@ var ADocEditor = function (customConfig) {
let lineObj = lines.find(item => item.dataIndex == dataIndex && caretData.index >= item.charStartIndex)
let lineObj = lines.find(item => item.dataIndex == dataIndex && caretData.index >= item.charStartIndex)
let x = (config.format.margin * pxMmRatio) + lineObj.tabWidth
let x = (config.format.margin * pxMmRatio) + lineObj.tabWidth
let y = (config.format.margin) * pxMmRatio
let y = (config.format.margin) * pxMmRatio
let height =
lineObj.maxF
ontSize * pxMmRatio * 5 / 4
let height =
caretData.style.f
ontSize * pxMmRatio * 5 / 4
let width = height / 10
let width = height / 10
let charData = caretData.activeData.formatedText[caretData.index - 1]
let charData = caretData.activeData.formatedText[caretData.index - 1]
if (lineObj) {
if (lineObj) {
x = (charData?(charData.x+charData.width):x)
x = (charData?(charData.x+charData.width):x)
if(charData)y = charData.y-(lineObj.maxFontSize*pxMmRatio)
if(charData){
else y = lineObj.y-(lineObj.maxFontSize*pxMmRatio)
y = charData.y - (caretData.style.fontSize*pxMmRatio)
}else{
y = lineObj.y - (lineObj.maxFontSize*pxMmRatio)
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment