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
4d1ab1f1
Unverified
Commit
4d1ab1f1
authored
May 21, 2023
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: handle create path
parent
3da8fb41
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
15 deletions
+38
-15
PageHeader.vue
ux/src/components/PageHeader.vue
+14
-3
Index.vue
ux/src/pages/Index.vue
+17
-0
routes.js
ux/src/router/routes.js
+6
-11
page.js
ux/src/stores/page.js
+1
-1
No files found.
ux/src/components/PageHeader.vue
View file @
4d1ab1f1
...
...
@@ -108,6 +108,7 @@
icon='las la-print'
color='grey'
aria-label='Print'
@click='printPage'
)
q-tooltip Print
template(v-if='editorStore.isActive')
...
...
@@ -230,13 +231,19 @@ function openEditorSettings () {
}
async
function
discardChanges
()
{
//
Is it the home page in create mode?
if
(
editorStore
.
mode
===
'create'
&&
pageStore
.
path
===
''
&&
pageStore
.
locale
===
'en'
)
{
//
From create mode
if
(
editorStore
.
mode
===
'create'
)
{
editorStore
.
$patch
({
isActive
:
false
,
editor
:
''
})
siteStore
.
overlay
=
'Welcome'
// Is it the home page in create mode?
if
((
pageStore
.
path
===
''
||
pageStore
.
path
===
'home'
)
&&
pageStore
.
locale
===
'en'
)
{
siteStore
.
overlay
=
'Welcome'
}
router
.
replace
(
'/'
)
return
}
...
...
@@ -371,4 +378,8 @@ async function editPage () {
await
pageStore
.
pageEdit
()
$q
.
loading
.
hide
()
}
function
printPage
()
{
window
.
print
()
}
</
script
>
ux/src/pages/Index.vue
View file @
4d1ab1f1
...
...
@@ -262,7 +262,24 @@ const lastModified = computed(() => {
// WATCHERS
watch
(()
=>
route
.
path
,
async
(
newValue
)
=>
{
// -> Enter Create Mode?
if
(
newValue
.
startsWith
(
'/_create'
))
{
if
(
!
route
.
params
.
editor
)
{
$q
.
notify
({
type
:
'negative'
,
message
:
'No editor specified!'
})
return
router
.
replace
(
'/'
)
}
$q
.
loading
.
show
()
await
pageStore
.
pageCreate
({
editor
:
route
.
params
.
editor
})
$q
.
loading
.
hide
()
}
// -> Moving to a non-page path? Ignore
if
(
newValue
.
startsWith
(
'/_'
))
{
return
}
// -> Load Page
try
{
await
pageStore
.
pageLoad
({
path
:
newValue
})
if
(
editorStore
.
isActive
)
{
...
...
ux/src/router/routes.js
View file @
4d1ab1f1
...
...
@@ -2,14 +2,6 @@ import { usePageStore } from 'src/stores/page'
const
routes
=
[
{
path
:
'/'
,
component
:
()
=>
import
(
'../layouts/MainLayout.vue'
),
children
:
[
{
path
:
''
,
component
:
()
=>
import
(
'../pages/Index.vue'
)
},
{
path
:
'_create/:editor?'
,
component
:
()
=>
import
(
'../pages/Index.vue'
)
}
]
},
{
path
:
'/login'
,
component
:
()
=>
import
(
'layouts/AuthLayout.vue'
),
children
:
[
...
...
@@ -85,11 +77,14 @@ const routes = [
// },
// --------------------------------
//
SYSTEM ROUTES CATCH-ALL FALLBACK
//
CREATE
// --------------------------------
{
path
:
'/_:catchAll(.*)*'
,
redirect
:
'/_error/notfound'
path
:
'/_create/:editor?'
,
component
:
()
=>
import
(
'../layouts/MainLayout.vue'
),
children
:
[
{
path
:
''
,
component
:
()
=>
import
(
'../pages/Index.vue'
)
}
]
},
// -----------------------
// STANDARD PAGE CATCH-ALL
...
...
ux/src/stores/page.js
View file @
4d1ab1f1
...
...
@@ -352,7 +352,7 @@ export const usePageStore = defineStore('page', {
mode
:
'edit'
})
this
.
router
.
push
(
'/_create'
)
this
.
router
.
push
(
`/_create/
${
editor
}
`
)
},
/**
* PAGE - EDIT
...
...
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