Skip to content

Commit

Permalink
feat: improve conditional and playground VE fake
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawntraoz committed Feb 27, 2023
1 parent 9eb1030 commit 7c1715a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const storyblokInit = (pluginOptions: SbSDKOptions = {}) => {
** For more security: https://www.storyblok.com/faq/how-to-verify-the-preview-query-parameters-of-the-visual-editor
*/
const isServer = typeof window === "undefined";
const inEditor = !isServer ? window?.location?.search?.includes('_storyblok_tk') : false;
const inEditor = !isServer && window.location?.search?.includes('_storyblok_tk');
if (bridge !== false && inEditor) {
loadBridge(bridgeLatest);
}
Expand Down
3 changes: 3 additions & 0 deletions playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
</head>
<body>
<div>Hello</div>
<button class="fake-visual-editor" onclick="window.location.href = '/?_storyblok_tk[timestamp]=1675712641'">
Fake being inside Visual Editor
</button>
<button class="with-bridge" onclick="initWithBridge()">
storyblokInit With Bridge
</button>
Expand Down

0 comments on commit 7c1715a

Please sign in to comment.