Skip to content

Conversation

@fvsch
Copy link
Contributor

@fvsch fvsch commented Mar 31, 2022

A couple more updates for the upcoming 1.7.0 release.

Breaking-ish change

When using one of the StackBlitzSDK.embedProject* methods to generate a <iframe> embedding a StackBlitz project, and when the user doesn't provide a forceEmbedLayout value in EmbedOptions, then we set forceEmbedLayout to true instead of undefined.

This results in generated URLs having the embed=1 query string parameter and using the embed layout, instead of using the generic editor layout (with a top bar, login button, forking on saving as an anonymous user, etc.).

According to @EricSimons, the current behavior is a bug dating back 4+ years ago. So a fix would be welcome to make it more likely that embeds actually use the embed layout.

It's still a change in behavior, and while many users might see it as a feature upgrade, others might be relying on embedding the StackBlitz editor with the normal (non-embed) layout, which is kinda unsupported and can behave strangely but who knows, there might be a few people out there that make it work.

For those users of the SDK, their options would be remaining on @stackblitz/[email protected] or lower, or providing { forceEmbedLayout: false } in options.

Example usage:

// Default, embed layout
sdk.embedProjectId('sb-embed', 'my-cool-project', {
  openFile: 'src/main.ts',
});

// Or opt out of the embed layout (not officially supported!)
sdk.embedProjectId('sb-embed', 'my-cool-project', {
  forceEmbedLayout: true,
  openFile: 'src/main.ts',
});

A couple extra fixes for the road

  • Encode file names in file= query string parameter
  • Improve error message when not finding a target element id

@fvsch fvsch requested review from EricSimons, ggdaltoso and sulco March 31, 2022 19:30
Copy link
Contributor

@ggdaltoso ggdaltoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good! 👌

@fvsch fvsch merged commit 86801de into sdk-1-7 Apr 1, 2022
ggdaltoso pushed a commit that referenced this pull request May 9, 2022
)

* Bump sdk version: 1.7.0-alpha.1
* Set default options.forceEmbedLayout to true for embed methods, mark as @deprecated
* Encode file names in file= query string parameter
* Improve error message when not finding a target element id
@fvsch fvsch deleted the fvsch/sdk-change-forceembedlayout branch June 9, 2022 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants