Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 0 additions & 5 deletions packages/js/src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ export const loadBridge = (src: string) => {

// Way to make sure all event handlers are called after loading
window.storyblokRegisterEvent = (cb: () => void) => {
if (window.location === window.parent.location) {
console.warn('You are not in Draft Mode or in the Visual Editor.');
return;
}

if (!loaded) {
callbacks.push(cb);
}
Expand Down
19 changes: 0 additions & 19 deletions packages/js/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,25 +395,6 @@ describe('@storyblok/js', () => {
window.location = originalLocation;
});

it('should warn when not in editor mode', () => {
const consoleSpy = vi.spyOn(console, 'warn');
const callback = vi.fn();

// Ensure we're not in an iframe
Object.defineProperty(window, 'parent', {
value: { location: window.location },
writable: true,
});

loadBridge('https://app.storyblok.com/f/storyblok-v2-latest.js');
window.storyblokRegisterEvent(callback);

expect(consoleSpy).toHaveBeenCalledWith(
'You are not in Draft Mode or in the Visual Editor.',
);
expect(callback).not.toHaveBeenCalled();
});

it('should execute callbacks in order of registration', async () => {
const executionOrder: number[] = [];
const callback1 = vi.fn(() => executionOrder.push(1));
Expand Down