Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
editoria
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yannis Barlas
editoria
Commits
ca318e7e
Commit
ca318e7e
authored
8 years ago
by
john
Browse files
Options
Downloads
Patches
Plain Diff
delete and backspace tracking goes in opposite directions
parent
ab5dec66
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/components/SimpleEditor/ContainerEditor.js
+3
-2
3 additions, 2 deletions
app/components/SimpleEditor/ContainerEditor.js
app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js
+20
-13
20 additions, 13 deletions
...impleEditor/elements/track_change/TrackChangesProvider.js
with
23 additions
and
15 deletions
app/components/SimpleEditor/ContainerEditor.js
+
3
−
2
View file @
ca318e7e
...
...
@@ -3,6 +3,7 @@ import {
ContainerEditor
as
SubstanceContainerEditor
,
// deleteCharacter,
// deleteSelection,
keys
as
keyboardKeys
,
Surface
,
uuid
}
from
'
substance
'
...
...
@@ -96,11 +97,11 @@ class ContainerEditor extends SubstanceContainerEditor {
event
.
stopPropagation
()
// TODO -- needed?
const
direction
=
(
event
.
keyCode
===
keys
.
BACKSPACE
)
?
'
left
'
:
'
right
'
const
direction
=
(
event
.
keyCode
===
key
boardKey
s
.
BACKSPACE
)
?
'
left
'
:
'
right
'
const
trackChangesProvider
=
this
.
context
.
trackChangesProvider
const
options
=
{
direction
:
direction
,
move
:
direction
,
status
:
'
delete
'
}
trackChangesProvider
.
handleTransaction
(
options
)
...
...
This diff is collapsed.
Click to expand it.
app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js
+
20
−
13
View file @
ca318e7e
...
...
@@ -45,23 +45,30 @@ class TrackChangesProvider {
}
handleDelete
(
options
)
{
const
{
status
}
=
options
const
{
move
,
status
}
=
options
if
(
status
!==
'
delete
'
)
return
const
mode
=
this
.
getMode
()
let
selection
console
.
log
(
'
move
'
,
move
)
const
direction
=
{
cursorTo
:
(
move
===
'
left
'
)
?
'
start
'
:
'
end
'
,
move
:
move
}
if
(
!
mode
)
{
selection
=
this
.
setSelectionPlusOne
(
'
left
'
)
// selection = this.setSelectionPlusOne('left')
selection
=
this
.
setSelectionPlusOne
(
direction
.
move
)
this
.
createDeleteAnnotation
(
selection
)
this
.
moveCursorTo
(
'
start
'
)
this
.
moveCursorTo
(
direction
.
cursorTo
)
return
}
if
(
mode
===
'
delete
'
)
{
selection
=
this
.
setSelectionPlusOne
(
'
left
'
)
selection
=
this
.
setSelectionPlusOne
(
direction
.
move
)
const
annotation
=
this
.
getAnnotationByStatus
(
'
delete
'
)
this
.
expandTrackAnnotation
(
selection
,
annotation
)
this
.
moveCursorTo
(
'
start
'
)
this
.
moveCursorTo
(
direction
.
cursorTo
)
}
// const isSelectionCollapsed = this.isSelectionCollapsed()
...
...
@@ -207,14 +214,14 @@ class TrackChangesProvider {
*/
shouldAdd
(
status
)
{
if
(
status
!==
'
add
'
)
return
false
const
mode
=
this
.
getMode
()
if
(
mode
)
return
false
return
true
}
//
shouldAdd (status) {
//
if (status !== 'add') return false
//
//
const mode = this.getMode()
//
if (mode) return false
//
//
return true
//
}
shouldDelete
(
status
)
{
if
(
status
===
'
delete
'
)
return
true
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment