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

docs: add note in RichTextEditor documentation about asRequired use #4170

Merged
merged 3 commits into from
Mar 10, 2025
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
20 changes: 20 additions & 0 deletions articles/components/rich-text-editor/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,26 @@ For the Flow component, the default is the HTML format, which is also used autom

To read, write, or bind the component's value using the Delta format, use the https://vaadin.com/api/platform/{moduleMavenVersion:com.vaadin:vaadin}/com/vaadin/flow/component/richtexteditor/RichTextEditor.html#asDelta()[`RichTextEditor.asDelta()`] wrapper.

.Usage with Binder
[NOTE]
====
As the component uses a complex HTML value, the default `asRequired` validator does not work as expected with `Binder`. Instead, provide a custom validator:
[.example]
--
ifdef::flow[]
[source,java]
----
binder.forField(richTextEditor)
.asRequired(Validator.from(value -> !richTextEditor.isEmpty(), "Required"))
----
endif::[]
--
====

For the web component, to read or write the value in the Delta format, use the `value` property.

To read or write the value in the HTML format, use the `htmlValue` property and the `dangerouslySetHtmlValue` method.
Expand Down