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
6fbbe974
Commit
6fbbe974
authored
Dec 08, 2023
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backspace event of next and previous lines
parent
55662d19
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
a-doc-editor.js
dist/assets/a-doc-editor.js
+15
-2
No files found.
dist/assets/a-doc-editor.js
View file @
6fbbe974
...
@@ -310,7 +310,7 @@ var ADocEditor = function (customConfig) {
...
@@ -310,7 +310,7 @@ var ADocEditor = function (customConfig) {
return
return
}
}
else
if
(
e
.
ctrlKey
)
{
else
if
(
e
.
ctrlKey
)
{
if
(
e
.
keyCode
==
8
)
{
// ctrl+backspace: delete the ent
rit
e word
if
(
e
.
keyCode
==
8
)
{
// ctrl+backspace: delete the ent
ir
e word
let
separatedSentence
=
caretData
.
activeData
.
plainContent
.
slice
(
0
,
caretData
.
index
)
let
separatedSentence
=
caretData
.
activeData
.
plainContent
.
slice
(
0
,
caretData
.
index
)
let
indexOfpreviousBlankChar
=
separatedSentence
.
search
(
/
[^
a-zA-Z0-9
](?=[
a-zA-Z0-9
]
*$
)
/
)
let
indexOfpreviousBlankChar
=
separatedSentence
.
search
(
/
[^
a-zA-Z0-9
](?=[
a-zA-Z0-9
]
*$
)
/
)
if
(
indexOfpreviousBlankChar
<=
0
)
caretData
.
activeData
.
plainContent
=
""
if
(
indexOfpreviousBlankChar
<=
0
)
caretData
.
activeData
.
plainContent
=
""
...
@@ -348,8 +348,21 @@ var ADocEditor = function (customConfig) {
...
@@ -348,8 +348,21 @@ var ADocEditor = function (customConfig) {
++
caretData
.
index
++
caretData
.
index
}
}
else
if
(
e
.
keyCode
==
8
)
{
// backspace
else
if
(
e
.
keyCode
==
8
)
{
// backspace
if
(
caretData
.
index
<=
0
){
let
currentIndex
=
dataSet
.
findIndex
(
item
=>
item
.
id
==
caretData
.
activeData
.
id
)
if
(
currentIndex
>
0
){
caretData
.
activeData
=
dataSet
[
currentIndex
-
1
]
caretData
.
index
=
dataSet
[
currentIndex
-
1
].
plainContent
.
length
if
(
dataSet
[
currentIndex
].
plainContent
.
length
!=
0
){
caretData
.
activeData
.
plainContent
+=
dataSet
[
currentIndex
].
plainContent
caretData
.
activeData
.
formatedText
.
push
(
...
dataSet
[
currentIndex
].
formatedText
)
}
dataSet
.
splice
(
currentIndex
,
1
)
}
}
else
{
caretData
.
activeData
.
plainContent
=
caretData
.
activeData
.
plainContent
.
slice
(
0
,
caretData
.
index
-
1
)
+
caretData
.
activeData
.
plainContent
.
slice
(
caretData
.
index
)
caretData
.
activeData
.
plainContent
=
caretData
.
activeData
.
plainContent
.
slice
(
0
,
caretData
.
index
-
1
)
+
caretData
.
activeData
.
plainContent
.
slice
(
caretData
.
index
)
caretData
.
index
=
caretData
.
index
<=
0
?
0
:
caretData
.
index
-
1
caretData
.
index
=
caretData
.
index
-
1
}
}
}
else
if
(
e
.
keyCode
==
37
)
{
// left key
else
if
(
e
.
keyCode
==
37
)
{
// left key
e
.
preventDefault
()
e
.
preventDefault
()
...
...
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