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:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.CompositionNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>,com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>,com.vaadin.flow.component.InputNotifier,com.vaadin.flow.component.KeyNotifier,com.vaadin.flow.data.value.HasValueChangeMode,Serializable
@Tag("vaadin-rich-text-editor") @NpmPackage(value="@vaadin/polymer-legacy-adapter", version="23.1.3") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") public class RichTextEditor extends GeneratedVaadinRichTextEditor<RichTextEditor,String> implements com.vaadin.flow.component.HasSize, com.vaadin.flow.data.value.HasValueChangeMode, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier, com.vaadin.flow.component.CompositionNotifier, com.vaadin.flow.component.HasLabelRich 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
setValueandgetValuemethods 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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRichTextEditor.RichTextEditorI18nThe internationalization properties forRichTextEditor.-
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
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends Object>
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
-
-
Constructor Summary
Constructors Constructor Description RichTextEditor()Constructs an emptyRichTextEditor.RichTextEditor(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)Constructs an emptyRichTextEditorwith a value change listener.RichTextEditor(String initialValue)Constructs aRichTextEditorwith the initial valueRichTextEditor(String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)Constructs an emptyRichTextEditorwith a value change listener and an initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<String>,String>asHtml()Gets an instance ofHasValuefor binding the html value of the editor withBinder.StringgetHtmlValue()The value of the editor presented as an HTML string.RichTextEditor.RichTextEditorI18ngetI18n()Gets the internationalization object previously set for this component.StringgetValue()Returns the current value of the text editor in Delta format.com.vaadin.flow.data.value.ValueChangeModegetValueChangeMode()voidsetI18n(RichTextEditor.RichTextEditorI18n i18n)Sets the internationalization properties for this component.voidsetValue(String value)Sets the value of this editor.voidsetValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)-
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.CompositionNotifier
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListener
-
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.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
-
-
-
Constructor Detail
-
RichTextEditor
public RichTextEditor()
Constructs an emptyRichTextEditor.
-
RichTextEditor
public RichTextEditor(String initialValue)
Constructs aRichTextEditorwith the initial value- Parameters:
initialValue- the initial value in Delta format, notnull- See Also:
AbstractField.setValue(Object)
-
RichTextEditor
public RichTextEditor(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
Constructs an emptyRichTextEditorwith a value change listener.- Parameters:
listener- the value change listener- See Also:
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
-
RichTextEditor
public RichTextEditor(String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
Constructs an emptyRichTextEditorwith a value change listener and an initial value.- Parameters:
initialValue- the initial valuelistener- the value change listener- See 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 com.vaadin.flow.data.value.ValueChangeMode getValueChangeMode()
The default value is
ValueChangeMode.ON_CHANGE.- Specified by:
getValueChangeModein interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
setValueChangeMode
public void setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)
- Specified by:
setValueChangeModein interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
setValue
public void setValue(String value)
Sets the value of this editor. Should be in Delta format. If the new value is not equal togetValue(), fires a value change event. ThrowsNullPointerException, if the value is null.Note:
Binderwill take care of thenullconversion when integrates with the editor, as long as no new converter is defined.- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>- Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<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:
getValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>,String>- Overrides:
getValuein classcom.vaadin.flow.component.AbstractField<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
htmlValueproperty from the web component ornullif it is not available. - See Also:
getValue(),asHtml(),RichTextEditor.AsHtml.getValue()
-
-