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
0e206405
Commit
0e206405
authored
8 years ago
by
Yannis Barlas
Browse files
Options
Downloads
Patches
Plain Diff
clean up main editor after changes
parent
2c4962d8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/components/SimpleEditor/ContainerEditor.js
+2
-2
2 additions, 2 deletions
app/components/SimpleEditor/ContainerEditor.js
app/components/SimpleEditor/Editor.js
+34
-18
34 additions, 18 deletions
app/components/SimpleEditor/Editor.js
with
36 additions
and
20 deletions
app/components/SimpleEditor/ContainerEditor.js
+
2
−
2
View file @
0e206405
...
@@ -51,7 +51,7 @@ class ContainerEditor extends SubstanceContainerEditor {
...
@@ -51,7 +51,7 @@ class ContainerEditor extends SubstanceContainerEditor {
if
(
commandStates
[
'
save
'
].
disabled
===
false
)
{
if
(
commandStates
[
'
save
'
].
disabled
===
false
)
{
const
editor
=
this
.
getEditor
()
const
editor
=
this
.
getEditor
()
editor
.
send
(
'
C
hangesNotSaved
'
)
editor
.
send
(
'
c
hangesNotSaved
'
)
editor
.
emit
(
'
send:route
'
,
location
.
pathname
)
editor
.
emit
(
'
send:route
'
,
location
.
pathname
)
return
callback
(
false
)
return
callback
(
false
)
...
@@ -76,7 +76,7 @@ class ContainerEditor extends SubstanceContainerEditor {
...
@@ -76,7 +76,7 @@ class ContainerEditor extends SubstanceContainerEditor {
window
.
history
.
pushState
(
null
,
null
,
document
.
URL
)
window
.
history
.
pushState
(
null
,
null
,
document
.
URL
)
editor
.
send
(
'
C
hangesNotSaved
'
)
editor
.
send
(
'
c
hangesNotSaved
'
)
editor
.
emit
(
'
send:route
'
,
url
)
editor
.
emit
(
'
send:route
'
,
url
)
}
else
{
}
else
{
this
.
props
.
history
.
push
(
url
)
this
.
props
.
history
.
push
(
url
)
...
...
This diff is collapsed.
Click to expand it.
app/components/SimpleEditor/Editor.js
+
34
−
18
View file @
0e206405
...
@@ -22,13 +22,16 @@ class Editor extends ProseEditor {
...
@@ -22,13 +22,16 @@ class Editor extends ProseEditor {
this
.
handleActions
({
this
.
handleActions
({
'
showComments
'
:
function
()
{
this
.
toggleCommentsArea
(
true
)
},
'
showComments
'
:
function
()
{
this
.
toggleCommentsArea
(
true
)
},
'
hideComments
'
:
function
()
{
this
.
toggleCommentsArea
(
false
)
},
'
hideComments
'
:
function
()
{
this
.
toggleCommentsArea
(
false
)
},
// TODO -- clean them up like changesNotSaved
'
trackChangesUpdate
'
:
function
()
{
this
.
updateTrackChange
()
},
'
trackChangesUpdate
'
:
function
()
{
this
.
updateTrackChange
()
},
'
trackChangesViewToggle
'
:
function
()
{
this
.
trackChangesViewToggle
()
},
'
trackChangesViewToggle
'
:
function
()
{
this
.
trackChangesViewToggle
()
},
'
ChangesNotSaved
'
:
function
()
{
this
.
ChangesNotSaved
()
}
// 'changesNotSaved': function () { this.changesNotSaved() }
'
changesNotSaved
'
:
this
.
changesNotSaved
})
})
}
}
C
hangesNotSaved
()
{
c
hangesNotSaved
()
{
this
.
extendState
({
changesNotSaved
:
true
})
this
.
extendState
({
changesNotSaved
:
true
})
}
}
...
@@ -39,10 +42,9 @@ class Editor extends ProseEditor {
...
@@ -39,10 +42,9 @@ class Editor extends ProseEditor {
}
}
updateTrackChange
()
{
updateTrackChange
()
{
this
.
extendProps
({
trackChanges
:
!
this
.
props
.
trackChanges
})
// TODO -- clean up this.props and this.refs
this
.
extendProps
({
trackChanges
:
!
this
.
props
.
trackChanges
})
this
.
props
.
updateTrackChangesStatus
(
!
this
.
props
.
trackChanges
)
this
.
props
.
updateTrackChangesStatus
(
!
this
.
props
.
trackChanges
)
this
.
refs
.
toolbar
.
extendProps
({
trackChanges
:
this
.
props
.
trackChanges
})
this
.
refs
.
toolbar
.
extendProps
({
trackChanges
:
this
.
props
.
trackChanges
})
}
}
...
@@ -65,6 +67,8 @@ class Editor extends ProseEditor {
...
@@ -65,6 +67,8 @@ class Editor extends ProseEditor {
let
SplitPane
=
this
.
componentRegistry
.
get
(
'
split-pane
'
)
let
SplitPane
=
this
.
componentRegistry
.
get
(
'
split-pane
'
)
let
ScrollPane
=
this
.
componentRegistry
.
get
(
'
scroll-pane
'
)
let
ScrollPane
=
this
.
componentRegistry
.
get
(
'
scroll-pane
'
)
let
Overlay
=
this
.
componentRegistry
.
get
(
'
overlay
'
)
let
Overlay
=
this
.
componentRegistry
.
get
(
'
overlay
'
)
// TODO -- unnecessary // posssibly breaks book builder dnd
let
ContextMenu
=
this
.
componentRegistry
.
get
(
'
context-menu
'
)
// new what does it do?
let
ContextMenu
=
this
.
componentRegistry
.
get
(
'
context-menu
'
)
// new what does it do?
let
Dropzones
=
this
.
componentRegistry
.
get
(
'
dropzones
'
)
// new what does it do?
let
Dropzones
=
this
.
componentRegistry
.
get
(
'
dropzones
'
)
// new what does it do?
...
@@ -137,26 +141,38 @@ class Editor extends ProseEditor {
...
@@ -137,26 +141,38 @@ class Editor extends ProseEditor {
if
(
this
.
state
.
changesNotSaved
)
{
if
(
this
.
state
.
changesNotSaved
)
{
return
el
.
append
(
modal
)
return
el
.
append
(
modal
)
}
else
{
return
el
}
}
return
el
}
}
// TODO --
use this to insert read-only mode alert
// TODO --
leverage ProseEditor's this._renderToolbar maybe?
_renderToolbar
(
$$
)
{
_renderToolbar
(
$$
)
{
let
viewMode
=
this
.
props
.
disabled
?
$
$
(
'
span
'
)
let
viewMode
=
this
.
props
.
disabled
?
$
$
(
'
span
'
)
.
addClass
(
'
view-mode
'
)
.
addClass
(
'
view-mode
'
)
.
append
(
'
Editor is in Read-Only mode
'
)
.
append
(
'
Editor is in Read-Only mode
'
)
:
''
:
''
let
commandStates
=
this
.
commandManager
.
getCommandStates
()
let
commandStates
=
this
.
commandManager
.
getCommandStates
()
return
$
$
(
'
div
'
).
addClass
(
'
se-toolbar-wrapper
'
).
append
(
$
$
(
Toolbar
,
{
return
$
$
(
'
div
'
)
commandStates
:
commandStates
,
.
addClass
(
'
se-toolbar-wrapper
'
)
trackChanges
:
this
.
props
.
trackChanges
,
.
append
(
trackChangesView
:
this
.
state
.
trackChangesView
,
$
$
(
Toolbar
,
{
toolGroups
:
[
'
text
'
,
'
document
'
,
'
annotations
'
,
'
default
'
,
'
track-change-enable
'
,
'
track-change-toggle-view
'
]
commandStates
:
commandStates
,
}).
ref
(
'
toolbar
'
)
trackChanges
:
this
.
props
.
trackChanges
,
).
append
(
viewMode
)
trackChangesView
:
this
.
state
.
trackChangesView
,
toolGroups
:
[
'
annotations
'
,
'
default
'
,
'
document
'
,
'
text
'
,
'
track-change-enable
'
,
'
track-change-toggle-view
'
]
}).
ref
(
'
toolbar
'
)
)
.
append
(
viewMode
)
}
}
_renderEditor
(
$$
)
{
_renderEditor
(
$$
)
{
...
@@ -178,9 +194,9 @@ class Editor extends ProseEditor {
...
@@ -178,9 +194,9 @@ class Editor extends ProseEditor {
getInitialState
()
{
getInitialState
()
{
return
{
return
{
changesNotSaved
:
false
,
editorReady
:
false
,
editorReady
:
false
,
trackChangesView
:
true
,
trackChangesView
:
true
changesNotSaved
:
false
}
}
}
}
...
...
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