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) {
...
@@ -167,17 +167,19 @@ var ADocEditor = function (customConfig) {
}
}
for
(
let
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
if
(
dataList
[
i
].
plainContent
.
length
==
0
){
y
+=
(
dataList
?.[
i
].
style
.
fontSize
)
}
let
canvas
=
canvasList
[
canvasIndex
].
el
let
canvas
=
canvasList
[
canvasIndex
].
el
canvas
.
setAttribute
(
"tabIndex"
,
-
1
)
canvas
.
setAttribute
(
"tabIndex"
,
-
1
)
renderText
(
canvas
,
dataList
[
i
])
renderText
(
canvas
,
dataList
[
i
])
x
=
0
;
x
=
0
;
if
(
dataList
[
i
].
id
==
caretData
.
activeData
.
id
)
{
if
(
dataList
[
i
].
id
==
caretData
.
activeData
.
id
)
{
caretData
.
canvasIndex
=
canvasIndex
;
caretData
.
canvasIndex
=
canvasIndex
;
}
}
}
}
function
renderText
(
canvas
,
data
Set
)
{
function
renderText
(
canvas
,
data
Block
)
{
let
ctx
=
canvas
.
getContext
(
'2d'
,
{
willReadFrequently
:
true
})
let
ctx
=
canvas
.
getContext
(
'2d'
,
{
willReadFrequently
:
true
})
ctx
.
save
()
ctx
.
save
()
...
@@ -185,27 +187,27 @@ var ADocEditor = function (customConfig) {
...
@@ -185,27 +187,27 @@ var ADocEditor = function (customConfig) {
let
wordStartIndex
=
0
let
wordStartIndex
=
0
let
wordEndIndex
=
0
let
wordEndIndex
=
0
let
wordsLength
=
0
;
let
wordsLength
=
0
;
data
Set
.
formatedText
=
[]
data
Block
.
formatedText
=
[]
for
(
let
i
=
0
;
i
<
data
Set
.
plainContent
.
length
;
i
++
)
{
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
wordEndIndex
=
i
}
}
let
style
=
{
...
config
.
style
,
...
data
Set
?.
style
?.[
i
]
}
let
style
=
{
...
config
.
style
,
...
data
Block
?.
style
?.[
i
]
}
if
(
i
==
0
)
{
if
(
i
==
0
)
{
y
+=
style
.
fontSize
y
+=
style
.
fontSize
}
}
ctx
.
save
()
ctx
.
save
()
ctx
.
font
=
`
${
style
.
fontSize
}
px
${
style
.
fontFamily
}
`
ctx
.
font
=
`
${
style
.
fontSize
}
px
${
style
.
fontFamily
}
`
ctx
.
fillStyle
=
style
.
fontColor
ctx
.
fillStyle
=
style
.
fontColor
let
charWidth
=
ctx
.
measureText
(
data
Set
.
plainContent
[
i
]).
width
let
charWidth
=
ctx
.
measureText
(
data
Block
.
plainContent
[
i
]).
width
ctx
.
restore
()
ctx
.
restore
()
data
Set
.
formatedText
[
i
]
=
{
data
Block
.
formatedText
[
i
]
=
{
...
style
,
...
style
,
char
:
data
Set
.
plainContent
[
i
],
char
:
data
Block
.
plainContent
[
i
],
width
:
charWidth
,
width
:
charWidth
,
x
:
x
,
x
:
x
,
y
:
y
,
y
:
y
,
...
@@ -226,11 +228,11 @@ var ADocEditor = function (customConfig) {
...
@@ -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
.
save
()
ctx
.
font
=
`
${
data
Set
.
formatedText
[
i
].
fontSize
}
px
${
dataSet
.
formatedText
[
i
].
fontFamily
}
`
ctx
.
font
=
`
${
data
Block
.
formatedText
[
i
].
fontSize
}
px
${
dataBlock
.
formatedText
[
i
].
fontFamily
}
`
ctx
.
fillStyle
=
data
Set
.
formatedText
[
i
].
fontColor
ctx
.
fillStyle
=
data
Block
.
formatedText
[
i
].
fontColor
ctx
.
fillText
(
data
Set
.
formatedText
[
i
].
char
,
dataSet
.
formatedText
[
i
].
x
,
dataSet
.
formatedText
[
i
].
y
)
ctx
.
fillText
(
data
Block
.
formatedText
[
i
].
char
,
dataBlock
.
formatedText
[
i
].
x
,
dataBlock
.
formatedText
[
i
].
y
)
ctx
.
restore
()
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