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.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.6.2") @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.CompositionNotifierRich 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 the Quill Delta format. The
setValueandgetValuemethods use the delta format by default.Note that the default use of the delta format has been deprecated in 23.3, and from 24 onwards, the component will use the HTML format as default. To keep using the delta format, use
asDelta(),RichTextEditor.AsDelta.getValue()andRichTextEditor.AsDelta.setValue(String).To get and set the value in HTML format, use
asHtml,RichTextEditor.AsHtml.getValue()andRichTextEditor.AsHtml.setValue(String).- 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)Deprecated.Since 23.3, this API is deprecated in order to maintain API consistency.RichTextEditor(String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)Deprecated.Since 23.3, this API is deprecated in order to maintain API consistency.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddThemeVariants(RichTextEditorVariant... variants)Adds theme variants to the component.com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<String>,String>asDelta()Gets an instance ofHasValuefor the editor in the Quill Delta format.com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<String>,String>asHtml()Gets an instance ofHasValuefor the editor in the HTML format.StringgetHtmlValue()The value of the editor presented as an HTML string.RichTextEditor.RichTextEditorI18ngetI18n()Gets the internationalization object previously set for this component.StringgetValue()Deprecated.since 23.3, from 24 onwards the value will be in HTML format.com.vaadin.flow.data.value.ValueChangeModegetValueChangeMode()voidremoveThemeVariants(RichTextEditorVariant... variants)Removes theme variants from the component.voidsetI18n(RichTextEditor.RichTextEditorI18n i18n)Sets the internationalization properties for this component.voidsetValue(String value)Deprecated.since 23.3, from 24 onwards the value will be in HTML format.voidsetValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)-
Methods inherited from class com.vaadin.flow.component.richtexteditor.GeneratedVaadinRichTextEditor
addChangeListener, getHtmlValueString, getI18nJsonArray, isDisabledBoolean, isReadonlyBoolean, 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, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, 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
@Deprecated public RichTextEditor(String initialValue)
Deprecated.Since 23.3, this API is deprecated in order to maintain API consistency. UsesetValue(String)instead.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
@Deprecated public RichTextEditor(String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RichTextEditor,String>> listener)
Deprecated.Since 23.3, this API is deprecated in order to maintain API consistency. UsesetValue(String)instead.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
@Deprecated public void setValue(String value)
Deprecated.since 23.3, from 24 onwards the value will be in HTML format. UseasDelta()instead.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
@Deprecated public String getValue()
Deprecated.since 23.3, from 24 onwards the value will be in HTML format. UseasDelta()instead.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()
-
asHtml
public com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<String>,String> asHtml()
Gets an instance ofHasValuefor the editor in the HTML format. Can be used for binding the value withBinder.- Returns:
- an instance of
HasValue
-
asDelta
public com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<String>,String> asDelta()
Gets an instance ofHasValuefor the editor in the Quill Delta format. Can be used for binding the value withBinder.- Returns:
- an instance of
HasValue
-
addThemeVariants
public void addThemeVariants(RichTextEditorVariant... variants)
Adds theme variants to the component.- Overrides:
addThemeVariantsin classGeneratedVaadinRichTextEditor<RichTextEditor,String>- Parameters:
variants- theme variants to add
-
removeThemeVariants
public void removeThemeVariants(RichTextEditorVariant... variants)
Removes theme variants from the component.- Overrides:
removeThemeVariantsin classGeneratedVaadinRichTextEditor<RichTextEditor,String>- Parameters:
variants- theme variants to remove
-
-