Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
ab55f33d
Commit
ab55f33d
authored
Jul 14, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: editor - warn on leave without save
parent
74e7316c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
editor.vue
client/components/editor.vue
+10
-0
No files found.
client/components/editor.vue
View file @
ab55f33d
...
...
@@ -118,6 +118,7 @@ export default {
dialogProgress
:
false
,
dialogEditorSelector
:
false
,
dialogUnsaved
:
false
,
exitConfirmed
:
false
,
initContentParsed
:
''
}
},
...
...
@@ -161,6 +162,14 @@ export default {
}
else
{
this
.
currentEditor
=
`editor
${
_
.
startCase
(
this
.
initEditor
||
'markdown'
)}
`
}
window
.
onbeforeunload
=
()
=>
{
if
(
!
this
.
exitConfirmed
&&
this
.
initContentParsed
!==
this
.
$store
.
get
(
'editor/content'
))
{
return
'You have unsaved edits. Are you sure you want to leave the editor?'
}
else
{
return
undefined
}
}
},
methods
:
{
openPropsModal
(
name
)
{
...
...
@@ -263,6 +272,7 @@ export default {
exitGo
()
{
this
.
$store
.
commit
(
`loadingStart`
,
'editor-close'
)
this
.
currentEditor
=
''
this
.
exitConfirmed
=
true
_
.
delay
(()
=>
{
if
(
this
.
$store
.
get
(
'editor/mode'
)
===
'create'
)
{
window
.
location
.
assign
(
`/`
)
...
...
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