FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
documentcloud/public/javascripts/app/editor.js at master · documentcloud/documentcloud · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Mar 11, 2021. It is now read-only.
documentcloud
/
documentcloud
Public archive
Notifications
You must be signed in to change notification settings
Fork
157
Star
425
Code
Issues
194
Pull requests
16
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
documentcloud
/
public
/
javascripts
/
app
/
editor.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (59 loc) · 2.43 KB
Breadcrumbs
documentcloud
/
public
/
javascripts
/
app
/
editor.js
Copy path
File metadata and controls
66 lines (59 loc) · 2.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Main controller for the in-viewer document editor. Orchestrates subviews.
dc
.
app
.
editor
=
new
Backbone
.
View
(
)
;
_
.
extend
(
dc
.
app
.
editor
,
{
// Initializes the workspace, binding it to <body>.
initialize
:
function
(
docId
,
options
)
{
this
.
setElement
(
'body'
)
;
this
.
docId
=
docId
;
this
.
options
=
options
;
_
.
bindAll
(
this
,
'closeAllEditors'
,
'confirmStateChange'
)
;
dc
.
app
.
hotkeys
.
initialize
(
)
;
this
.
createSubViews
(
)
;
this
.
renderSubViews
(
)
;
currentDocument
.
api
.
onChangeState
(
this
.
closeAllEditors
)
;
}
,
confirmStateChange
:
function
(
continuation
)
{
if
(
this
.
_openDialog
)
return
;
this
.
_openDialog
=
dc
.
ui
.
Dialog
.
confirm
(
'You have unsaved changes. Are you sure you want to leave without saving them?'
,
continuation
,
{
onClose
:
_
.
bind
(
function
(
)
{
this
.
_openDialog
=
null
;
}
,
this
)
}
)
;
}
,
setSaveState
:
function
(
unsaved
)
{
this
.
unsavedChanges
=
unsaved
;
var
confirmation
=
unsaved
?
this
.
confirmStateChange
:
null
;
currentDocument
.
api
.
setConfirmStateChange
(
confirmation
)
;
}
,
// Create all of the requisite subviews.
createSubViews
:
function
(
)
{
dc
.
ui
.
notifier
=
new
dc
.
ui
.
Notifier
(
)
;
this
.
controlPanel
=
new
dc
.
ui
.
ViewerControlPanel
(
)
;
this
.
sectionEditor
=
new
dc
.
ui
.
SectionEditor
(
)
;
this
.
annotationEditor
=
new
dc
.
ui
.
AnnotationEditor
(
)
;
this
.
removePagesEditor
=
new
dc
.
ui
.
RemovePagesEditor
(
{
editor
:
this
}
)
;
this
.
reorderPagesEditor
=
new
dc
.
ui
.
ReorderPagesEditor
(
{
editor
:
this
}
)
;
this
.
editPageTextEditor
=
new
dc
.
ui
.
EditPageTextEditor
(
{
editor
:
this
}
)
;
this
.
replacePagesEditor
=
new
dc
.
ui
.
ReplacePagesEditor
(
{
editor
:
this
}
)
;
}
,
// Render all of the existing subviews and place them in the DOM.
renderSubViews
:
function
(
)
{
var
access
=
'DV-isContributor'
;
if
(
this
.
options
.
isReviewer
)
access
=
'DV-isReviewer'
;
if
(
this
.
options
.
isOwner
)
access
=
'DV-isOwner'
;
$
(
'.DV-docViewer'
)
.
addClass
(
access
)
;
$
(
'.DV-well'
)
.
append
(
this
.
controlPanel
.
render
(
)
.
el
)
;
$
(
'.DV-logo'
)
.
hide
(
)
;
$
(
'.DV-thumbnailsView'
)
.
show
(
)
;
currentDocument
.
api
.
roundTabCorners
(
)
;
var
supp
=
$
(
'.DV-supplemental'
)
;
if
(
supp
.
hasClass
(
'DV-noNavigation'
)
)
{
supp
.
removeClass
(
'DV-noNavigation'
)
.
addClass
(
'DV-noNavigationMargin'
)
;
}
}
,
closeAllEditors
:
function
(
)
{
this
.
removePagesEditor
.
close
(
)
;
this
.
reorderPagesEditor
.
close
(
)
;
this
.
replacePagesEditor
.
close
(
)
;
this
.
editPageTextEditor
.
close
(
)
;
return
true
;
}
}
)
;
Back
|
FazBrowse Home
|
New Git URL