-
Notifications
You must be signed in to change notification settings - Fork 281
[SuperEditor][SuperReader][SuperTextField] Merge stylesheet styles with default text style. (Resolves #2727) #2750
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
base: main
Are you sure you want to change the base?
Changes from all commits
88bc15d
e419be9
f06ceb2
a2eebde
ad949fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -461,7 +461,19 @@ class SuperEditorState extends State<SuperEditor> { | |
); | ||
|
||
_createEditContext(); | ||
_createLayoutPresenter(); | ||
} | ||
|
||
@override | ||
void didChangeDependencies() { | ||
super.didChangeDependencies(); | ||
|
||
if (_docLayoutPresenter == null) { | ||
_createLayoutPresenter(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of adding this conditional logic, can we create the layout presenter with a null default text style and then update it here without any conditional at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this logic because there are some situations where we re-create the presenter inside It we always create the presenter with a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't follow that explanation. Can you provide an example of what you mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, if we want to create the presenter with a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first code snippet you included doesn't seem to reference the layout presenter at all. The second code snippet calls a method to create the layout presenter. Neither of these code snippets appear to show code that would need to be changed? It would be great if you could show exactly what code snippet exists now, and exactly what code snippet it would need to become, so that we can avoid any confusion about what you're trying to say. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both snippets call _createLayoutPresenter();
_docStylesheetStyler.defaultTextStyle = DefaultTextStyle.of(context).style; |
||
} else if (widget.stylesheet.inheritDefaultTextStyle) { | ||
// The default text style might have changed. Update it in the stylesheet styler. | ||
final defaultTextStyle = DefaultTextStyle.of(context).style; | ||
_docStylesheetStyler.defaultTextStyle = defaultTextStyle; | ||
} | ||
} | ||
|
||
@override | ||
|
@@ -590,7 +602,10 @@ class SuperEditorState extends State<SuperEditor> { | |
|
||
final document = editContext.document; | ||
|
||
_docStylesheetStyler = SingleColumnStylesheetStyler(stylesheet: widget.stylesheet); | ||
_docStylesheetStyler = SingleColumnStylesheetStyler( | ||
stylesheet: widget.stylesheet, | ||
defaultTextStyle: DefaultTextStyle.of(context).style, | ||
); | ||
|
||
_docLayoutPerComponentBlockStyler = SingleColumnLayoutCustomComponentStyler(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a constructor Dart Doc that explains what should be passed for
defaultTextStyle
and what happens if nothing is passed for it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.