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
5c82eb04
Commit
5c82eb04
authored
Nov 16, 2012
by
Ujvari Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fix for issue #181 to handle well multiple opened editors.
parent
c2c38d47
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
hypothesis.coffee
h/js/src/hypothesis.coffee
+15
-12
No files found.
h/js/src/hypothesis.coffee
View file @
5c82eb04
...
...
@@ -5,7 +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
this
::
unsaved_drafts
=
[]
# * Unsaved drafts currenty open
# Plugin configuration
options
:
...
...
@@ -487,11 +487,11 @@ class Hypothesis extends Annotator
editor
=
this
.
_createEditor
()
editor
.
load
(
reply
)
@
reply_editor
=
editor
@
unsaved_drafts
.
push
editor
editor
.
element
.
removeClass
(
'annotator-outer'
)
editor
.
on
'save'
,
(
annotation
)
=>
this
.
publish
'annotationCreated'
,
[
annotation
]
@
reply_editor
=
null
@
unsaved_drafts
.
splice
(
@
unsaved_drafts
.
indexOf
(
editor
),
1
)
d3
.
select
(
editor
.
element
[
0
]).
select
(
'form'
)
.
data
([
reply
])
...
...
@@ -507,7 +507,7 @@ class Hypothesis extends Annotator
editor
.
element
.
appendTo
(
item
.
node
())
editor
.
on
(
'hide'
,
=>
item
.
remove
()
@
reply_editor
=
null
)
@
unsaved_drafts
.
splice
(
@
unsaved_drafts
.
indexOf
(
editor
),
1
)
)
editor
.
element
.
find
(
":input:first"
).
focus
()
context
=
items
.
select
'.thread'
...
...
@@ -567,14 +567,17 @@ class Hypothesis extends Annotator
_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
open_editors
=
0
for
editor
in
@
unsaved_drafts
editor
.
show
()
unsaved_text
=
editor
.
element
[
0
].
ownerDocument
.
activeElement
.
value
if
unsaved_text
!=
null
and
unsaved_text
.
toString
().
length
>
0
then
open_editors
+=
1
if
open_editors
>
0
ctext
=
if
open_editors
>
1
then
"You have "
+
open_editors
+
" unsaved replies. Do you really want to close the view?"
else
"You have an unsaved reply. Do you really want to close the view?"
if
not
confirm
ctext
then
can_close
=
false
if
can_close
then
@
unsaved_drafts
=
[]
can_close
threadId
:
(
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