Class HugeRte

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<HugeRte,String>
com.vaadin.flow.component.AbstractSinglePropertyField<HugeRte,String>
org.vaadin.hugerte.HugeRte
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<HugeRte>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<HugeRte>, com.vaadin.flow.component.FocusNotifier<HugeRte>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<HugeRte,String>,String>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<HugeRte,String>,String>, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.shared.HasThemeVariant<HugeRteVariant>, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.data.binder.HasValidator<String>, Serializable

@Tag("vaadin-huge-rte") @NpmPackage(value="hugerte",version="1.0.15") @NpmPackage(value="diff-match-patch",version="1.0.5") @JsModule("./vaadin-huge-rte.js") @CssImport("./vaadin-huge-rte.css") public class HugeRte extends com.vaadin.flow.component.AbstractSinglePropertyField<HugeRte,String> implements com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.data.binder.HasValidator<String>, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.Focusable<HugeRte>, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.shared.HasThemeVariant<HugeRteVariant>
A Rich Text editor, based on HugeRTE JS component.
Author:
mstahv, Stefan Uebe
See Also:
  • Nested Class Summary

    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>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

    com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

    com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue

    com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The default height of the component.
    static final ValueChangeMode
    The default value change mode.
    static final int
    The default timeout in milliseconds for ValueChangeMode.TIMEOUT and ValueChangeMode.INTERVAL.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance.
    HugeRte(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<HugeRte,String>> valueChangeListener)
    Creates a new instance with the given value change listener.
    HugeRte(String label)
    Creates a new instance with the given label.
    HugeRte(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<HugeRte,String>> valueChangeListener)
    Creates a new instance with the given label and value change listener.
    HugeRte(String label, String initialValue)
    Creates a new instance with the given label and initial value.
    HugeRte(String label, String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<HugeRte,String>> valueChangeListener)
    Creates a new instance with the given label, initial value and value change listener.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    applyDelta(String oldValue, String delta)
    Applies the given delta onto the "old" value.
    configure(String configurationKey, boolean value)
    Sets a single boolean value for the given configuration key.
    configure(String configurationKey, double value)
    Sets a single number for the given configuration key.
    configure(String configurationKey, String value)
    Sets a single string for the given configuration key.
    configure(String configurationKey, String... value)
    Sets an array of strings for the given configuration key.
    configure(String configurationKey, ClientSideReference value)
    Sets a single string for the given configuration key by reading the given client side reference's representation.
    Configures this instance with a default set of plugins, menubar and toolbar options enabled.
    Sets the language the editor shall use.
    configureMenubar(Menubar... menubarItems)
    Configures the menubar of the editor instance to show the given items.
    Configures the plugins, that shall be enabled for this editor instance.
    Configures the resize option for the editor.
    configureToolbar(Toolbar... toolbarItems)
    Configures the toolbar of the editor instance to show the given items.
    tools.jackson.databind.node.ObjectNode
     
    Returns the current value change mode.
    int
     
    void
     
    void
    setEditorHeight(int editorHeight)
    This convenience method sets the editor height in pixels.
    void
    setEditorHeight(String editorHeight)
    This convenience method sets the editor height.
    void
    setEditorMaxHeight(int editorMaxHeight)
    This convenience method sets the editor maximal height in pixels.
    void
    setEditorMinHeight(int editorMinHeight)
    This convenience method sets the editor minimal height in pixels.
    protected void
     
    void
    setRawConfig(String jsConfig)
     
    void
    Sets the value change mode of this instance.
    void
    setValueChangeTimeout(int timeoutInMilliseconds)
     

    Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField

    getSynchronizationRegistration, hasValidValue, setSynchronizedEvent

    Methods inherited from class com.vaadin.flow.component.AbstractField

    addValueChangeListener, bindValue, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, 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.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    bindEnabled, isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasHelper

    bindHelperText, getHelperComponent, getHelperText, setHelperComponent, setHelperText

    Methods inherited from interface com.vaadin.flow.component.HasLabel

    getLabel, setLabel

    Methods inherited from interface com.vaadin.flow.component.HasSize

    bindHeight, bindWidth, 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, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasTheme

    addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

    Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant

    addThemeVariants, bindThemeVariant, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants

    Methods inherited from interface com.vaadin.flow.component.HasValidation

    setManualValidation

    Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties

    getErrorMessage, isInvalid, setErrorMessage, setInvalid

    Methods inherited from interface com.vaadin.flow.data.binder.HasValidator

    addValidationStatusChangeListener, getDefaultValidator

    Methods inherited from interface com.vaadin.flow.component.HasValue

    clear, getOptionalValue

    Methods inherited from interface com.vaadin.flow.component.HasValueAndElement

    bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible

    Methods inherited from interface com.vaadin.flow.component.InputNotifier

    addInputListener
  • Field Details

    • DEFAULT_VALUE_CHANGE_MODE_TIMEOUT

      public static final int DEFAULT_VALUE_CHANGE_MODE_TIMEOUT
      The default timeout in milliseconds for ValueChangeMode.TIMEOUT and ValueChangeMode.INTERVAL.
      See Also:
    • DEFAULT_VALUE_CHANGE_MODE

      public static final ValueChangeMode DEFAULT_VALUE_CHANGE_MODE
      The default value change mode.
    • DEFAULT_HEIGHT

      public static final String DEFAULT_HEIGHT
      The default height of the component. Also used as the editor height of a resizable editor, that has no editor height set.
      See Also:
  • Constructor Details

    • HugeRte

      public HugeRte(String label)
      Creates a new instance with the given label.
      Parameters:
      label - label
    • HugeRte

      public HugeRte(String label, String initialValue)
      Creates a new instance with the given label and initial value. The initial value is set as it is without any further processing.
      Parameters:
      label - label
      initialValue - initial value
    • HugeRte

      public HugeRte(String label, String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<HugeRte,String>> valueChangeListener)
      Creates a new instance with the given label, initial value and value change listener. The initial value is set as it is without any further processing.
      Parameters:
      label - label
      initialValue - initial value
      valueChangeListener - value change listener
    • HugeRte

      public HugeRte(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<HugeRte,String>> valueChangeListener)
      Creates a new instance with the given label and value change listener.
      Parameters:
      label - label
      valueChangeListener - value change listener
    • HugeRte

      public HugeRte(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<HugeRte,String>> valueChangeListener)
      Creates a new instance with the given value change listener.
      Parameters:
      valueChangeListener - value change listener
    • HugeRte

      public HugeRte()
      Creates a new instance.
  • Method Details

    • setPresentationValue

      protected void setPresentationValue(String value)
      Overrides:
      setPresentationValue in class com.vaadin.flow.component.AbstractSinglePropertyField<HugeRte,String>
    • applyDelta

      public static String applyDelta(String oldValue, String delta)
      Applies the given delta onto the "old" value. Returns the "new", resulting value
      Parameters:
      oldValue - old value
      delta - delta to apply
      Returns:
      new value
    • setRawConfig

      public void setRawConfig(String jsConfig)
    • getConfig

      public tools.jackson.databind.node.ObjectNode getConfig()
    • configureBasicSetup

      public HugeRte configureBasicSetup()
      Configures this instance with a default set of plugins, menubar and toolbar options enabled.
      Returns:
      this instance
    • configure

      public HugeRte configure(String configurationKey, String value)
      Sets a single string for the given configuration key. Please note, that there is no check, if the given config key exists or the value is valid or might be applied to this key.
      Parameters:
      configurationKey - config key
      value - value to set
      Returns:
      this instance
    • configure

      public HugeRte configure(String configurationKey, String... value)
      Sets an array of strings for the given configuration key. The result will also be an array on the client side. Please note, that there is no check, if the given config key exists or the value is valid or might be applied to this key.
      Parameters:
      configurationKey - config key
      value - value to set
      Returns:
      this instance
    • configure

      public HugeRte configure(String configurationKey, boolean value)
      Sets a single boolean value for the given configuration key. Please note, that there is no check, if the given config key exists or the value is valid or might be applied to this key.
      Parameters:
      configurationKey - config key
      value - value to set
      Returns:
      this instance
    • configure

      public HugeRte configure(String configurationKey, double value)
      Sets a single number for the given configuration key. Please note, that there is no check, if the given config key exists or the value is valid or might be applied to this key.
      Parameters:
      configurationKey - config key
      value - value to set
      Returns:
      this instance
    • configure

      public HugeRte configure(String configurationKey, ClientSideReference value)
      Sets a single string for the given configuration key by reading the given client side reference's representation. Please note, that there is no check, if the given config key exists or the value is valid or might be applied to this key.
      Parameters:
      configurationKey - config key
      value - value to set
      Returns:
      this instance
    • configureLanguage

      public HugeRte configureLanguage(Language language)
      Sets the language the editor shall use. This dedicated method exists due to the special handling of the Language.ENGLISH item.
      Parameters:
      language - language to set
      Returns:
      this instance
    • configurePlugins

      public HugeRte configurePlugins(Plugin... plugins)
      Configures the plugins, that shall be enabled for this editor instance. Previous settings will be overridden. Passing nothing will disable all plugins.
      Parameters:
      plugins - plugins to enable
      Returns:
      this instance
    • configureMenubar

      public HugeRte configureMenubar(Menubar... menubarItems)
      Configures the menubar of the editor instance to show the given items. Previous settings will be overridden. Passing nothing will hide the menubar.
      Parameters:
      menubarItems - menubar items to show
      Returns:
      this instance
    • configureToolbar

      public HugeRte configureToolbar(Toolbar... toolbarItems)
      Configures the toolbar of the editor instance to show the given items. Previous settings will be overridden. Passing nothing will hide the toolbar.
      Parameters:
      toolbarItems - toolbar items to show
      Returns:
      this instance
    • configureResize

      public HugeRte configureResize(ResizeDirection direction)

      Configures the resize option for the editor. Please note, that there are additional settings to this instance necessary, so it is not recommended to call directly configure("resize", ...).

      Please note, that this feature is a built-in feature of the HugeRTE and may lead to some issues with the wrapping Vaadin component regarding initial and continuous height settings. If you want to set an initial height or min-max height restrictions, it is strongly recommended to do that via the setEditor...Height methods, NOT the normal ones.

      Also please note, that when you only set a min-max restriction, but no initial editor height, the editor will not be shown with its minimal height, but minimized. If you want to show it in its minimal or maximal state, apply the respective pixel value to setEditorHeight(String).

      Parameters:
      direction - direction
      Returns:
      this instance
      See Also:
    • setValueChangeMode

      public void setValueChangeMode(ValueChangeMode valueChangeMode)
      Sets the value change mode of this instance. By default the editor uses ValueChangeMode.ON_CHANGE. Null resets the mode to the default.
      Parameters:
      valueChangeMode - new value change mode
    • getValueChangeMode

      public ValueChangeMode getValueChangeMode()
      Returns the current value change mode. Never null.
      Returns:
      value change mode
    • setValueChangeTimeout

      public void setValueChangeTimeout(int timeoutInMilliseconds)
    • getValueChangeTimeout

      public int getValueChangeTimeout()
    • replaceSelectionContent

      public void replaceSelectionContent(String htmlString)
    • setEditorHeight

      public void setEditorHeight(String editorHeight)

      This convenience method sets the editor height. The editor in this case is not the component itself, but a subset of its content. Basically everything except for the label, error- and helper text. So the component will always be a bit larger (for instance when you set a height of 600px, the component will have something like ~650px, depending on the used features).

      This value cannot be changed, while the editor is attached. This is a limitation of the underlying editor engine.

      Please note, that you may not need this method very often, but in edge cases only (e.g. when using the resizable functionality). Also ensure, that no normal height is set (i.e. remove the default height).

      Parameters:
      editorHeight - editor height
    • setEditorHeight

      public void setEditorHeight(int editorHeight)

      This convenience method sets the editor height in pixels. The editor in this case is not the component itself, but a subset of its content. Basically everything except for the label, error- and helper text. So the component will always be a bit larger (for instance when you set a height of 600px, the component will have something like ~650px, depending on the used features).

      This value cannot be changed, while the editor is attached. This is a limitation of the underlying editor engine.

      Please note, that you may not need this method very often, but in edge cases only (e.g. when using the resizable functionality).

      Parameters:
      editorHeight - editor height
    • setEditorMinHeight

      public void setEditorMinHeight(int editorMinHeight)

      This convenience method sets the editor minimal height in pixels.

      The editor in this case is not the component itself, but a subset of its content. Basically everything except for the label, error- and helper text. So the component will always be a bit larger (for instance when you set a min height of 200px, the component still will be something like ~250px, depending on the used features).

      This value cannot be changed, while the editor is attached. This is a limitation of the underlying editor engine.

      Please note, that you may not need this method very often, but in edge cases only (e.g. when using the resizable functionality or auto resize plugin).

      Parameters:
      editorMinHeight - editor minimal height
    • setEditorMaxHeight

      public void setEditorMaxHeight(int editorMaxHeight)

      This convenience method sets the editor maximal height in pixels.

      The editor in this case is not the component itself, but a subset of its content. Basically everything except for the label, error- and helper text. So the component will always be a bit larger (for instance when you set a max height of 600px, the component will still be something like ~650px, depending on the used features).

      This value cannot be changed, while the editor is attached. This is a limitation of the underlying editor engine.

      Please note, that you may not need this method very often, but in edge cases only (e.g. when using the resizable functionality or auto resize plugin).

      Parameters:
      editorMaxHeight - editor maximal height