@Tag(value="vaadin-rich-text-editor") public class RichTextEditor extends GeneratedVaadinRichTextEditor<RichTextEditor,String> implements HasSize, HasValueChangeMode, InputNotifier, KeyNotifier, CompositionNotifier
<vaadin-rich-text-editor>
component.
The value of the rich text editor is in
Delta format. The
setValue
and getValue
methods
deal with the default Delta format, but it is also possible to get and set
the value as an HTML string using
rte.
,
asHtml()
.getValue()
rte.
and asHtml()
.setValue()
getHtmlValue()
.
Modifier and Type | Class and Description |
---|---|
static class |
RichTextEditor.RichTextEditorI18n
The internationalization properties for
RichTextEditor . |
GeneratedVaadinRichTextEditor.ChangeEvent<R extends GeneratedVaadinRichTextEditor<R,?>>
AbstractField.ComponentValueChangeEvent<C extends Component,V>
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
DEFAULT_CHANGE_TIMEOUT
Constructor and Description |
---|
RichTextEditor()
Constructs an empty
RichTextEditor . |
RichTextEditor(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
Constructs an empty
RichTextEditor with a value change listener. |
RichTextEditor(String initialValue)
Constructs a
RichTextEditor with the initial value |
RichTextEditor(String initialValue,
HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
Constructs an empty
RichTextEditor with a value change listener
and an initial value. |
Modifier and Type | Method and Description |
---|---|
HasValue<HasValue.ValueChangeEvent<String>,String> |
asHtml()
Gets an instance of
HasValue for binding the html value of the
editor with Binder . |
String |
getHtmlValue()
The value of the editor presented as an HTML string.
|
RichTextEditor.RichTextEditorI18n |
getI18n()
Gets the internationalization object previously set for this component.
|
String |
getValue()
Returns the current value of the text editor in
Delta format.
|
ValueChangeMode |
getValueChangeMode()
Gets current value change mode of the component.
|
void |
setI18n(RichTextEditor.RichTextEditorI18n i18n)
Sets the internationalization properties for this component.
|
void |
setValue(String value)
Sets the value of this editor.
|
void |
setValueChangeMode(ValueChangeMode valueChangeMode)
Sets new value change mode for the component.
|
addChangeListener, addThemeVariants, getHtmlValueString, getI18nJsonArray, isDisabledBoolean, isReadonlyBoolean, removeThemeVariants, setDisabled, setI18n, setReadonly
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
addValueChangeListener, getEmptyValue, isEmpty, setModelValue, valueEquals
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
getElement
getValueChangeTimeout, setValueChangeTimeout
addInputListener
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListener
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
clear, getOptionalValue
isEnabled, setEnabled
addAttachListener
addDetachListener
public RichTextEditor()
RichTextEditor
.public RichTextEditor(String initialValue)
RichTextEditor
with the initial valueinitialValue
- the initial value in Delta format, not null
AbstractField.setValue(Object)
public RichTextEditor(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
RichTextEditor
with a value change listener.listener
- the value change listenerAbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
public RichTextEditor(String initialValue, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
RichTextEditor
with a value change listener
and an initial value.initialValue
- the initial valuelistener
- the value change listenerAbstractField.setValue(Object)
,
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
public RichTextEditor.RichTextEditorI18n getI18n()
Note: updating the object content that is gotten from this method will
not update the lang on the component if not set back using
setI18n(RichTextEditorI18n)
null
, If the i18n
properties weren't set.public void setI18n(RichTextEditor.RichTextEditorI18n i18n)
i18n
- the internationalized properties, not null
public ValueChangeMode getValueChangeMode()
The default value is ValueChangeMode.ON_CHANGE
.
getValueChangeMode
in interface HasValueChangeMode
null
if
the value is not synchronizedpublic void setValueChangeMode(ValueChangeMode valueChangeMode)
HasValueChangeMode
setValueChangeMode
in interface HasValueChangeMode
valueChangeMode
- new value change mode, or null
to disable the value
synchronizationpublic void setValue(String value)
getValue()
, fires a value change event.
Throws NullPointerException
, if the value is null.
Note: Binder
will take care of the null
conversion when
integrates with the editor, as long as no new converter is defined.
setValue
in interface HasValue<AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>
setValue
in class AbstractField<RichTextEditor,String>
value
- the new value in Delta format, not null
asHtml()
,
AsHtml#setValue(String)
public String getValue()
getValue
in interface HasValue<AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>
getValue
in class AbstractField<RichTextEditor,String>
getHtmlValue()
,
asHtml()
,
AsHtml#getValue()
public String getHtmlValue()
This represents the value currently set on the client side. If you have
just set the value on the server side using setValue(String)
or
AsHtml#setValue(String)
then the value returned from this method
will not yet correspond to the newly set value until the next server
round trip.
htmlValue
property from the web component
or null
if it is not available.getValue()
,
asHtml()
,
AsHtml#getValue()
public HasValue<HasValue.ValueChangeEvent<String>,String> asHtml()
HasValue
for binding the html value of the
editor with Binder
.HasValue
Copyright © 2021. All rights reserved.