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
668fae9e
Commit
668fae9e
authored
Dec 08, 2023
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enter event with blank line
parent
6fbbe974
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
a-doc-editor.js
dist/assets/a-doc-editor.js
+15
-13
No files found.
dist/assets/a-doc-editor.js
View file @
668fae9e
...
...
@@ -167,17 +167,19 @@ var ADocEditor = function (customConfig) {
}
for
(
let
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
if
(
dataList
[
i
].
plainContent
.
length
==
0
){
y
+=
(
dataList
?.[
i
].
style
.
fontSize
)
}
let
canvas
=
canvasList
[
canvasIndex
].
el
canvas
.
setAttribute
(
"tabIndex"
,
-
1
)
renderText
(
canvas
,
dataList
[
i
])
x
=
0
;
if
(
dataList
[
i
].
id
==
caretData
.
activeData
.
id
)
{
caretData
.
canvasIndex
=
canvasIndex
;
}
}
function
renderText
(
canvas
,
data
Set
)
{
function
renderText
(
canvas
,
data
Block
)
{
let
ctx
=
canvas
.
getContext
(
'2d'
,
{
willReadFrequently
:
true
})
ctx
.
save
()
...
...
@@ -185,27 +187,27 @@ var ADocEditor = function (customConfig) {
let
wordStartIndex
=
0
let
wordEndIndex
=
0
let
wordsLength
=
0
;
data
Set
.
formatedText
=
[]
for
(
let
i
=
0
;
i
<
data
Set
.
plainContent
.
length
;
i
++
)
{
data
Block
.
formatedText
=
[]
for
(
let
i
=
0
;
i
<
data
Block
.
plainContent
.
length
;
i
++
)
{
if
(
/
\s
+/
.
test
(
data
Set
.
plainContent
[
i
]))
{
if
(
/
\s
+/
.
test
(
data
Block
.
plainContent
[
i
]))
{
wordEndIndex
=
i
}
let
style
=
{
...
config
.
style
,
...
data
Set
?.
style
?.[
i
]
}
let
style
=
{
...
config
.
style
,
...
data
Block
?.
style
?.[
i
]
}
if
(
i
==
0
)
{
y
+=
style
.
fontSize
}
ctx
.
save
()
ctx
.
font
=
`
${
style
.
fontSize
}
px
${
style
.
fontFamily
}
`
ctx
.
fillStyle
=
style
.
fontColor
let
charWidth
=
ctx
.
measureText
(
data
Set
.
plainContent
[
i
]).
width
let
charWidth
=
ctx
.
measureText
(
data
Block
.
plainContent
[
i
]).
width
ctx
.
restore
()
data
Set
.
formatedText
[
i
]
=
{
data
Block
.
formatedText
[
i
]
=
{
...
style
,
char
:
data
Set
.
plainContent
[
i
],
char
:
data
Block
.
plainContent
[
i
],
width
:
charWidth
,
x
:
x
,
y
:
y
,
...
...
@@ -226,11 +228,11 @@ var ADocEditor = function (customConfig) {
}
for
(
let
i
=
0
;
i
<
data
Set
.
formatedText
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
Block
.
formatedText
.
length
;
i
++
)
{
ctx
.
save
()
ctx
.
font
=
`
${
data
Set
.
formatedText
[
i
].
fontSize
}
px
${
dataSet
.
formatedText
[
i
].
fontFamily
}
`
ctx
.
fillStyle
=
data
Set
.
formatedText
[
i
].
fontColor
ctx
.
fillText
(
data
Set
.
formatedText
[
i
].
char
,
dataSet
.
formatedText
[
i
].
x
,
dataSet
.
formatedText
[
i
].
y
)
ctx
.
font
=
`
${
data
Block
.
formatedText
[
i
].
fontSize
}
px
${
dataBlock
.
formatedText
[
i
].
fontFamily
}
`
ctx
.
fillStyle
=
data
Block
.
formatedText
[
i
].
fontColor
ctx
.
fillText
(
data
Block
.
formatedText
[
i
].
char
,
dataBlock
.
formatedText
[
i
].
x
,
dataBlock
.
formatedText
[
i
].
y
)
ctx
.
restore
()
}
...
...
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