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
f0f9e42a
Commit
f0f9e42a
authored
8 years ago
by
john
Browse files
Options
Downloads
Patches
Plain Diff
handle addition annotation in firefox
parent
0905f37a
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
+49
-5
49 additions, 5 deletions
app/components/SimpleEditor/ContainerEditor.js
app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js
+2
-1
2 additions, 1 deletion
...impleEditor/elements/track_change/TrackChangeComponent.js
with
51 additions
and
6 deletions
app/components/SimpleEditor/ContainerEditor.js
+
49
−
5
View file @
f0f9e42a
...
@@ -10,7 +10,7 @@ import {
...
@@ -10,7 +10,7 @@ import {
class
ContainerEditor
extends
SubstanceContainerEditor
{
class
ContainerEditor
extends
SubstanceContainerEditor
{
render
(
$$
)
{
render
(
$$
)
{
// TODO --
better ways to write this in es6
// TODO --
call with super
var
el
=
Surface
.
prototype
.
render
.
call
(
this
,
$$
)
var
el
=
Surface
.
prototype
.
render
.
call
(
this
,
$$
)
var
doc
=
this
.
getDocument
()
var
doc
=
this
.
getDocument
()
...
@@ -83,6 +83,17 @@ class ContainerEditor extends SubstanceContainerEditor {
...
@@ -83,6 +83,17 @@ class ContainerEditor extends SubstanceContainerEditor {
})
})
}
}
onTextInputShim
(
event
)
{
if
(
!
this
.
props
.
trackChanges
)
return
super
.
onTextInputShim
(
event
)
this
.
handleTracking
({
event
:
event
,
status
:
'
add
'
,
surfaceEvent
:
'
input
'
,
keypress
:
true
})
}
_handleDeleteKey
(
event
)
{
_handleDeleteKey
(
event
)
{
if
(
!
this
.
props
.
trackChanges
)
return
super
.
_handleDeleteKey
(
event
)
if
(
!
this
.
props
.
trackChanges
)
return
super
.
_handleDeleteKey
(
event
)
...
@@ -103,15 +114,48 @@ class ContainerEditor extends SubstanceContainerEditor {
...
@@ -103,15 +114,48 @@ class ContainerEditor extends SubstanceContainerEditor {
})
})
}
}
shouldIgnoreKeypress
(
event
)
{
// see Surface's onTextInputShim for comments
if
(
event
.
which
===
0
||
event
.
charCode
===
0
||
event
.
keyCode
===
keys
.
TAB
||
event
.
keyCode
===
keys
.
ESCAPE
||
Boolean
(
event
.
metaKey
)
||
(
Boolean
(
event
.
ctrlKey
)
^
Boolean
(
event
.
altKey
))
)
{
return
true
}
return
false
}
getTextFromKeypress
(
event
)
{
let
character
=
String
.
fromCharCode
(
event
.
which
)
if
(
!
event
.
shiftKey
)
character
=
character
.
toLowerCase
()
if
(
character
.
length
===
0
)
return
null
return
character
}
handleTracking
(
options
)
{
handleTracking
(
options
)
{
const
trackChangesProvider
=
this
.
context
.
trackChangesProvider
const
trackChangesProvider
=
this
.
context
.
trackChangesProvider
const
{
event
,
surfaceEvent
}
=
options
const
{
event
,
keypress
,
surfaceEvent
}
=
options
event
.
preventDefault
()
if
(
!
keypress
)
{
event
.
stopPropagation
()
event
.
preventDefault
()
event
.
stopPropagation
()
}
if
(
surfaceEvent
===
'
input
'
)
{
if
(
surfaceEvent
===
'
input
'
)
{
if
(
!
event
.
data
)
return
if
(
keypress
)
{
if
(
this
.
shouldIgnoreKeypress
(
event
))
return
const
text
=
this
.
getTextFromKeypress
(
event
)
event
.
data
=
text
event
.
preventDefault
()
event
.
stopPropagation
()
}
if
(
!
keypress
&&
!
event
.
data
)
return
this
.
_state
.
skipNextObservation
=
true
this
.
_state
.
skipNextObservation
=
true
}
}
...
...
This diff is collapsed.
Click to expand it.
app/components/SimpleEditor/elements/track_change/TrackChangeComponent.js
+
2
−
1
View file @
f0f9e42a
import
{
pickBy
,
clone
,
map
,
sortBy
,
findIndex
}
from
'
lodash
'
import
{
AnnotationComponent
,
createAnnotation
,
deleteNode
}
from
'
substance
'
import
{
AnnotationComponent
,
createAnnotation
,
deleteNode
}
from
'
substance
'
import
{
pickBy
,
clone
,
map
,
sortBy
,
findIndex
}
from
'
lodash
'
class
TrackChangeComponent
extends
AnnotationComponent
{
class
TrackChangeComponent
extends
AnnotationComponent
{
render
(
$$
)
{
render
(
$$
)
{
const
{
status
}
=
this
.
props
.
node
const
{
status
}
=
this
.
props
.
node
...
...
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