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
4413d4d4
Commit
4413d4d4
authored
Nov 14, 2012
by
Ujvari Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 181: Asks before switching from detail view if an unsaved not-empty reply is open.
parent
31619902
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
hypothesis.coffee
h/js/src/hypothesis.coffee
+28
-7
No files found.
h/js/src/hypothesis.coffee
View file @
4413d4d4
...
...
@@ -5,6 +5,7 @@ class Hypothesis extends Annotator
this
::
hash
=
-
1
# * cheap UUID :cake:
this
::
cache
=
{}
# * object cache
this
::
visible
=
false
# * Whether the sidebar is visible
this
::
reply_editor
=
null
# * Whether there is an open reply editor
# Plugin configuration
options
:
...
...
@@ -323,6 +324,10 @@ class Hypothesis extends Annotator
@
provider
.
setupAnnotation
stub
showViewer
:
(
annotations
=
[],
detail
=
false
)
=>
if
@
visible
and
not
detail
if
not
this
.
_canCloseUnsaved
()
return
# Thread the messages using JWZ
messages
=
mail
.
messageThread
().
thread
annotations
.
map
(
a
)
->
m
=
mail
.
message
(
null
,
a
.
id
,
a
.
thread
?
.
split
(
'/'
)
or
[])
...
...
@@ -482,9 +487,11 @@ class Hypothesis extends Annotator
editor
=
this
.
_createEditor
()
editor
.
load
(
reply
)
@
reply_editor
=
editor
editor
.
element
.
removeClass
(
'annotator-outer'
)
editor
.
on
'save'
,
(
annotation
)
=>
this
.
publish
'annotationCreated'
,
[
annotation
]
@
reply_editor
=
null
d3
.
select
(
editor
.
element
[
0
]).
select
(
'form'
)
.
data
([
reply
])
...
...
@@ -498,7 +505,9 @@ class Hypothesis extends Annotator
.
classed
(
'writer'
,
true
)
editor
.
element
.
appendTo
(
item
.
node
())
editor
.
on
(
'hide'
,
=>
item
.
remove
())
editor
.
on
(
'hide'
,
=>
item
.
remove
()
@
reply_editor
=
null
)
editor
.
element
.
find
(
":input:first"
).
focus
()
context
=
items
.
select
'.thread'
...
...
@@ -555,6 +564,18 @@ class Hypothesis extends Annotator
@
provider
.
hideFrame
()
$
(
"#toolbar"
).
removeClass
"shown"
_canCloseUnsaved
:
->
#See if there's an unsaved/uncancelled reply
can_close
=
true
unsaved_text
=
null
if
@
reply_editor
@
reply_editor
.
show
()
unsaved_text
=
@
reply_editor
.
element
[
0
].
ownerDocument
.
activeElement
.
value
can_close
=
unsaved_text
==
null
or
unsaved_text
.
length
<
1
or
confirm
"You have an unsaved reply. Do you really want to close the view?"
if
can_close
@
reply_editor
=
null
can_close
threadId
:
(
annotation
)
->
if
annotation
?
.
thread
?
...
...
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