com.vaadin.flow.component.richtexteditor.
Class RichTextEditor
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.AbstractField<C,T>
-
- com.vaadin.flow.component.AbstractSinglePropertyField<R,T>
-
- com.vaadin.flow.component.richtexteditor.GeneratedVaadinRichTextEditor<RichTextEditor,String>
-
- com.vaadin.flow.component.richtexteditor.RichTextEditor
-
All Implemented Interfaces:
AttachNotifier
,CompositionNotifier
,DetachNotifier
,HasElement
,HasEnabled
,HasLabel
,HasSize
,HasStyle
,HasTheme
,HasValue<AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>
,HasValueAndElement<AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>
,InputNotifier
,KeyNotifier
,HasValueChangeMode
,Serializable
@Tag("vaadin-rich-text-editor") @NpmPackage(value="@vaadin/polymer-legacy-adapter", version="23.1.15") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") public class RichTextEditor extends GeneratedVaadinRichTextEditor<RichTextEditor,String> implements HasSize, HasValueChangeMode, InputNotifier, KeyNotifier, CompositionNotifier, HasLabel
Rich Text Editor is an input field for entering rich text. It allows you to format and style your text using boldface, italics, headings, lists, images, links etc.
The value of the rich text editor is in Delta format. The
setValue
andgetValue
methods deal with the default Delta format, but it is also possible to get and set the value as an HTML string usingrte.
,asHtml()
.getValue()
rte.
andasHtml()
.setValue()
getHtmlValue()
.Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RichTextEditor.RichTextEditorI18n
The internationalization properties for
RichTextEditor
.-
Nested classes/interfaces inherited from class com.vaadin.flow.component.richtexteditor.GeneratedVaadinRichTextEditor
GeneratedVaadinRichTextEditor.ChangeEvent<R extends GeneratedVaadinRichTextEditor<R,?>>
-
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V>
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
-
-
Field Summary
-
Fields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUT
-
-
Constructor Summary
Constructors Constructor 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 valueRichTextEditor(String initialValue, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
Constructs an empty
RichTextEditor
with a value change listener and an initial value.
-
Method Summary
All Methods Modifier and Type Method Description HasValue<HasValue.ValueChangeEvent<String>,String>
asHtml()
Gets an instance of
HasValue
for binding the html value of the editor withBinder
.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.
-
Methods inherited from class com.vaadin.flow.component.richtexteditor.GeneratedVaadinRichTextEditor
addChangeListener, addThemeVariants, getHtmlValueString, getI18nJsonArray, isDisabledBoolean, isReadonlyBoolean, removeThemeVariants, setDisabled, setI18n, setReadonly
-
Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
-
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, isEmpty, setModelValue, valueEquals
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.CompositionNotifier
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
Methods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValue
-
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
Methods inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
getValueChangeTimeout, setValueChangeTimeout
-
Methods inherited from interface com.vaadin.flow.component.InputNotifier
addInputListener
-
Methods inherited from interface com.vaadin.flow.component.KeyNotifier
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
-
-
-
-
Constructor Detail
-
RichTextEditor
public RichTextEditor()
Constructs an empty
RichTextEditor
.
-
RichTextEditor
public RichTextEditor(String initialValue)
Constructs a
RichTextEditor
with the initial valueParameters:
initialValue
- the initial value in Delta format, notnull
See Also:
-
RichTextEditor
public RichTextEditor(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
Constructs an empty
RichTextEditor
with a value change listener.Parameters:
listener
- the value change listenerSee Also:
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
-
RichTextEditor
public RichTextEditor(String initialValue, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
Constructs an empty
RichTextEditor
with a value change listener and an initial value.Parameters:
initialValue
- the initial valuelistener
- the value change listenerSee Also:
AbstractField.setValue(Object)
,AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
-
-
Method Detail
-
getI18n
public RichTextEditor.RichTextEditorI18n getI18n()
Gets the internationalization object previously set for this component.
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)
Returns:
the i18n object. It will be
null
, If the i18n properties weren't set.
-
setI18n
public void setI18n(RichTextEditor.RichTextEditorI18n i18n)
Sets the internationalization properties for this component.
Parameters:
i18n
- the internationalized properties, notnull
-
getValueChangeMode
public ValueChangeMode getValueChangeMode()
Gets current value change mode of the component.
The default value is
ValueChangeMode.ON_CHANGE
.Specified by:
getValueChangeMode
in interfaceHasValueChangeMode
Returns:
current value change mode of the component, or
null
if the value is not synchronized
-
setValueChangeMode
public void setValueChangeMode(ValueChangeMode valueChangeMode)
Description copied from interface:
HasValueChangeMode
Sets new value change mode for the component.
Specified by:
setValueChangeMode
in interfaceHasValueChangeMode
Parameters:
valueChangeMode
- new value change mode, ornull
to disable the value synchronization
-
setValue
public void setValue(String value)
Sets the value of this editor. Should be in Delta format. If the new value is not equal to
getValue()
, fires a value change event. ThrowsNullPointerException
, if the value is null.Note:
Binder
will take care of thenull
conversion when integrates with the editor, as long as no new converter is defined.Specified by:
setValue
in interfaceHasValue<AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>
Overrides:
setValue
in classAbstractField<RichTextEditor,String>
Parameters:
value
- the new value in Delta format, notnull
See Also:
asHtml()
,RichTextEditor.AsHtml.setValue(String)
-
getValue
public String getValue()
Returns the current value of the text editor in Delta format. By default, the empty editor will return an empty string.
Specified by:
getValue
in interfaceHasValue<AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>
Overrides:
getValue
in classAbstractField<RichTextEditor,String>
Returns:
the current value.
See Also:
getHtmlValue()
,asHtml()
,RichTextEditor.AsHtml.getValue()
-
getHtmlValue
public String getHtmlValue()
The value of the editor presented as an HTML string.
This represents the value currently set on the client side. If you have just set the value on the server side using
setValue(String)
orRichTextEditor.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.Returns:
the sanitized
htmlValue
property from the web component ornull
if it is not available.See Also:
getValue()
,asHtml()
,RichTextEditor.AsHtml.getValue()
-
asHtml
public HasValue<HasValue.ValueChangeEvent<String>,String> asHtml()
Gets an instance of
HasValue
for binding the html value of the editor withBinder
.Returns:
an instance of
HasValue
-
-