mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-03-31 15:20:32 +08:00
fix(client): Fix setupLink - createLink needs lowdefy for input.
This commit is contained in:
parent
7cadf6389a
commit
314f131ceb
packages/client/src
@ -52,7 +52,7 @@ function initLowdefyContext({ auth, Components, config, router, stage, types, wi
|
||||
lowdefy._internal.window = window;
|
||||
lowdefy._internal.document = window.document;
|
||||
lowdefy._internal.router = router;
|
||||
lowdefy._internal.link = setupLink(router, window);
|
||||
lowdefy._internal.link = setupLink(lowdefy);
|
||||
lowdefy._internal.updateBlock = (blockId) =>
|
||||
lowdefy._internal.updaters[blockId] && lowdefy._internal.updaters[blockId]();
|
||||
lowdefy._internal.components.Link = createLinkComponent(lowdefy, Components.Link);
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
import { createLink } from '@lowdefy/engine';
|
||||
|
||||
function setupLink(router, window) {
|
||||
function setupLink(lowdefy) {
|
||||
const { router, window } = lowdefy._internal;
|
||||
const backLink = () => router.back();
|
||||
const disabledLink = () => {};
|
||||
const newOriginLink = ({ url, query, newTab }) => {
|
||||
@ -30,7 +31,7 @@ function setupLink(router, window) {
|
||||
if (newTab) {
|
||||
return window
|
||||
.open(
|
||||
`${window.location.origin}${router.basePath}${pathname}${query ? `?${query}` : ''}`,
|
||||
`${window.location.origin}${lowdefy.basePath}${pathname}${query ? `?${query}` : ''}`,
|
||||
'_blank'
|
||||
)
|
||||
.focus();
|
||||
@ -45,7 +46,7 @@ function setupLink(router, window) {
|
||||
const noLink = () => {
|
||||
throw new Error(`Invalid Link.`);
|
||||
};
|
||||
return createLink({ backLink, disabledLink, router, newOriginLink, noLink, sameOriginLink });
|
||||
return createLink({ backLink, disabledLink, lowdefy, newOriginLink, noLink, sameOriginLink });
|
||||
}
|
||||
|
||||
export default setupLink;
|
||||
|
Loading…
x
Reference in New Issue
Block a user