Skip to content

Feat(BREAKING CHANGES): Add EmbedContext argument in buildWidgetSpan #2615

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion lib/src/editor/embed/embed_editor_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ abstract class EmbedBuilder {
String get key;
bool get expanded => true;

WidgetSpan buildWidgetSpan(Widget widget) {
WidgetSpan buildWidgetSpan(Widget widget, EmbedContext embedContext) {
Copy link
Collaborator

@EchoEllet EchoEllet Jul 22, 2025

Choose a reason for hiding this comment

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

This is a breaking change. Clients need to update their code to build.

return WidgetSpan(child: widget);
}

Expand Down
17 changes: 9 additions & 8 deletions lib/src/editor/widgets/text/text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,20 @@ class _TextLineState extends State<TextLine> {
}

final embedBuilder = widget.embedBuilder(child);
final embedContext = EmbedContext(
controller: widget.controller,
node: child,
readOnly: widget.readOnly,
inline: true,
textStyle: lineStyle,
);
final embedWidget = EmbedProxy(
embedBuilder.build(
context,
EmbedContext(
controller: widget.controller,
node: child,
readOnly: widget.readOnly,
inline: true,
textStyle: lineStyle,
),
embedContext,
),
);
final embed = embedBuilder.buildWidgetSpan(embedWidget);
final embed = embedBuilder.buildWidgetSpan(embedWidget, embedContext);
textSpanChildren.add(embed);
continue;
}
Expand Down
Loading