Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): fix BASE_PATH for Vite dev mode #4342

Merged
merged 4 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/editor-ui/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ function getTemplatesRedirect(store: Store<IRootState>) {

const router = new Router({
mode: 'history',
// @ts-ignore
base: window.BASE_PATH ?? '/',
base: window.BASE_PATH === '/{{BASE_PATH}}/' ? '/' : window.BASE_PATH,
scrollBehavior(to, from, savedPosition) {
netroy marked this conversation as resolved.
Show resolved Hide resolved
// saved position == null means the page is NOT visited from history (back button)
if (savedPosition === null && to.name === VIEWS.TEMPLATES && to.meta) {
Expand Down
4 changes: 4 additions & 0 deletions packages/editor-ui/src/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ declare module 'markdown-it-emoji';
declare module 'markdown-it-task-lists';

declare global {
interface Window {
BASE_PATH: string;
}

namespace JSX {
// tslint:disable no-empty-interface
interface Element extends VNode {}
Expand Down