Skip to content

docs update code markdown_editor #893

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 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""# MarkdownEditor"""

import solara
from solara.alias import rv
from solara.website.utils import apidoc


Expand Down Expand Up @@ -36,12 +35,12 @@ def Page():
""".strip()

markdown_text, set_markdown_text = solara.use_state(markdown_initial)
Copy link
Collaborator

Choose a reason for hiding this comment

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

And I also now noticed that the use_state here can be replaced with use_reactive, and .value and .set can be used throughout.

with solara.HBox(grow=True) as main:
with solara.VBox():
with solara.Row(grow=True) as main:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Row doesn't accept grow as an argument.

Suggested change
with solara.Row(grow=True) as main:
with solara.Row() as main:

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, I missed this last time, but the return main pattern can also be removed here.

Suggested change
with solara.Row(grow=True) as main:
with solara.Row(grow=True):

with solara.Column():
with solara.Padding(2):
with rv.Sheet(elevation=2):
with solara.v.Sheet(elevation=2):
solara.MarkdownEditor(markdown_text, on_value=set_markdown_text)
with rv.Sheet(elevation=2):
with solara.v.Sheet(elevation=2):
solara.Markdown("# Raw markdown")
solara.Preformatted(markdown_text)

Expand Down
Loading