Fixed the router, and editable div

This commit is contained in:
Julien Nahum
2023-10-16 12:54:51 +02:00
parent 3d3759c58c
commit 199a0190ad
9 changed files with 318 additions and 281 deletions

View File

@@ -47,7 +47,7 @@ async function getMatchedComponents (to) {
*/
async function beforeEach (to, from, next) {
// Sentry tracking
if (window.config.sentry_dsn) {
if (false && window.config.sentry_dsn) {
Sentry.configureScope((scope) => scope.setTransactionName(to?.name || 'Unknown route name'))
}
@@ -163,18 +163,6 @@ function parseMiddleware (middleware) {
return { middleware: name, params }
}
/**
* Resolve async components.
*
* @param {Array} components
* @return {Array}
*/
function resolveComponents (components) {
return Promise.all(components.map(component => {
return typeof component === 'function' ? component() : component
}))
}
/**
* Merge the the global middleware with the components middleware.
*
@@ -222,18 +210,7 @@ function scrollBehavior (to, from, savedPosition) {
if (to.hash) {
return { selector: to.hash }
}
const [component] = getMatchedComponents(to)
if (component && component.scrollToTop === false) {
return {}
}
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({ left: 0, top: 0 })
}, 190)
})
return {}
}
/**
@@ -250,3 +227,15 @@ function resolveMiddleware (requireContext) {
})
return middlewares
}
/**
* Resolve async components.
*
* @param {Array} components
* @return {Array}
*/
function resolveComponents (components) {
return Promise.all(components.map(component => {
return typeof component === 'function' ? component() : component
}))
}