Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
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
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
aece5afe
Commit
aece5afe
authored
Mar 19, 2013
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some bridge errors
parent
c73a10f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
bridge.coffee
h/js/plugin/bridge.coffee
+20
-17
No files found.
h/js/plugin/bridge.coffee
View file @
aece5afe
...
...
@@ -80,14 +80,14 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
msg
:
msg
beforeAnnotationCreated
:
(
annotation
)
=>
unless
annotation
.
$
$tag
?
tag
=
this
.
createAnnotation
()
this
.
_tag
annotation
,
tag
return
if
annotation
.
$
$tag
?
this
.
beforeCreateAnnotation
annotation
annotationDeleted
:
(
annotation
)
=>
return
unless
@
cache
[
annotation
.
$
$tag
?
]
delete
@
cache
[
annotation
.
$
$tag
]
this
.
deleteAnnotation
annotation
return
unless
annotation
.
$
$tag
?
and
@
cache
[
annotation
.
$
$tag
]
this
.
deleteAnnotation
annotation
,
(
err
)
=>
if
err
then
@
annotator
.
setupAnnotation
annotation
else
delete
@
cache
[
annotation
.
$
$tag
]
annotationsLoaded
:
(
annotations
)
=>
this
.
setupAnnotation
a
for
a
in
annotations
...
...
@@ -96,8 +96,8 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
@
channel
## Remote method call bindings
.
bind
(
'
createAnnotation'
,
(
txn
,
tag
)
=>
annotation
=
this
.
_
tag
{},
tag
.
bind
(
'
beforeCreateAnnotation'
,
(
txn
,
annotation
)
=>
annotation
=
this
.
_
parse
annotation
@
annotator
.
publish
'beforeAnnotationCreated'
,
annotation
this
.
_format
annotation
)
...
...
@@ -111,8 +111,12 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
)
.
bind
(
'deleteAnnotation'
,
(
txn
,
annotation
)
=>
delete
@
cache
[
annotation
.
tag
]
this
.
_format
(
@
annotator
.
deleteAnnotation
(
this
.
_parse
annotation
))
annotation
=
this
.
_parse
annotation
delete
@
cache
[
annotation
.
$
$tag
]
annotation
=
@
annotator
.
deleteAnnotation
annotation
result
=
this
.
_format
annotation
delete
@
cache
[
annotation
.
$
$tag
]
result
)
## Notifications
...
...
@@ -121,19 +125,18 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
)
.
bind
(
'showViewer'
,
(
ctx
,
annotations
)
=>
@
annotator
.
show
Edito
r
(
this
.
_parse
a
for
a
in
annotations
)
@
annotator
.
show
Viewe
r
(
this
.
_parse
a
for
a
in
annotations
)
)
createAnnotation
:
(
cb
)
->
tag
=
window
.
btoa
Math
.
random
()
beforeCreateAnnotation
:
(
annotation
,
cb
)
->
@
channel
.
call
method
:
'
c
reateAnnotation'
params
:
t
ag
method
:
'
beforeC
reateAnnotation'
params
:
t
his
.
_format
annotation
success
:
(
annotation
)
=>
annotation
=
this
.
_parse
annotation
cb
?
null
,
annotation
error
:
(
error
,
reason
)
=>
cb
?
{
error
,
reason
}
tag
annotation
setupAnnotation
:
(
annotation
,
cb
)
->
@
channel
.
call
...
...
@@ -156,7 +159,7 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
annotation
deleteAnnotation
:
(
annotation
,
cb
)
->
@
channel
.
notify
@
channel
.
call
method
:
'deleteAnnotation'
params
:
this
.
_format
annotation
success
:
(
annotation
)
=>
...
...
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