Skip to content
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

fix: regression in Markdown.code_theme when using MarkdownCodeTheme enum #4373

Merged
merged 2 commits into from
Nov 21, 2024
Merged
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
13 changes: 10 additions & 3 deletions sdk/python/packages/flet/src/flet/core/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,12 @@ def before_update(self):
self._set_attr_json("codeStyle", self.__code_style)
self._set_attr_json("codeStyleSheet", self.__code_style_sheet)
self._set_attr_json("mdStyleSheet", self.__md_style_sheet)
self._set_attr_json("codeTheme", self.__code_theme)
self._set_attr_json(
"codeTheme",
self.__code_theme.value
if isinstance(self.__code_theme, MarkdownCodeTheme)
else self.__code_theme,
)

def _get_children(self):
if self.__img_error_content is not None:
Expand Down Expand Up @@ -483,11 +488,13 @@ def md_style_sheet(self, value: Optional[MarkdownStyleSheet]):

# code_theme
@property
def code_theme(self) -> Optional[MarkdownCodeTheme]:
def code_theme(self) -> Optional[Union[MarkdownCodeTheme, MarkdownCustomCodeTheme]]:
return self.__code_theme

@code_theme.setter
def code_theme(self, value: Optional[MarkdownCodeTheme]):
def code_theme(
self, value: Optional[Union[MarkdownCodeTheme, MarkdownCustomCodeTheme]]
):
self.__code_theme = value

# code_style
Expand Down