Class TinyMce

  • All Implemented Interfaces:
    com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TinyMce,​String>,​String>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TinyMce,​String>,​String>, Serializable, org.github.legioth.field.Field<TinyMce,​String>

    @Tag("div")
    @JavaScript("./tinymceConnector.js")
    public class TinyMce
    extends com.vaadin.flow.component.Component
    implements org.github.legioth.field.Field<TinyMce,​String>, com.vaadin.flow.component.HasSize
    A Rich Text editor, based on TinyMCE Web Component. Some configurations has Java shorthand, some must be adjusted via getElement().setAttribute(String, String). See full options via https://www.tiny.cloud/docs/integrations/webcomponent/
    Author:
    mstahv
    See Also:
    Serialized Form
    • Nested Class Summary

      • 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
      TinyMce()  
      TinyMce​(boolean shadowRoot)
      Creates a new TinyMce editor with shadowroot set or disabled.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TinyMce configure​(String configurationKey, boolean value)  
      TinyMce configure​(String configurationKey, double value)  
      TinyMce configure​(String configurationKey, String value)  
      TinyMce configure​(String configurationKey, String... value)  
      void focus()  
      String getCurrentValue()  
      protected void injectTinyMceScript()
      Injects actual editor script to the host page from the add-on bundle.
      protected void onAttach​(com.vaadin.flow.component.AttachEvent attachEvent)  
      protected void onDetach​(com.vaadin.flow.component.DetachEvent detachEvent)  
      void replaceSelectionContent​(String htmlString)
      Replaces text in the editors selection (can be just a caret position).
      void setConfig​(String jsonConfig)  
      void setEditorContent​(String html)  
      void setEnabled​(boolean enabled)  
      void setReadOnly​(boolean readOnly)  
      • 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, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
      • Methods inherited from interface com.vaadin.flow.component.AttachNotifier

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

        addDetachListener
      • Methods inherited from interface org.github.legioth.field.Field

        addValueChangeListener, getEmptyValue, getValue, isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible, setValue
      • Methods inherited from interface com.vaadin.flow.component.HasElement

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

        isEnabled
      • 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.HasValue

        clear, getOptionalValue, isEmpty
    • Constructor Detail

      • TinyMce

        public TinyMce​(boolean shadowRoot)
        Creates a new TinyMce editor with shadowroot set or disabled. The shadow root should be used if the editor is in used in Dialog component, otherwise menu's and certain other features don't work. On the other hand, the shadow root must not be on when for example used in inline mode.
        Parameters:
        shadowRoot - true of shadow root hack should be used
      • TinyMce

        public TinyMce()
    • Method Detail

      • setEditorContent

        public void setEditorContent​(String html)
      • onAttach

        protected void onAttach​(com.vaadin.flow.component.AttachEvent attachEvent)
        Overrides:
        onAttach in class com.vaadin.flow.component.Component
      • onDetach

        protected void onDetach​(com.vaadin.flow.component.DetachEvent detachEvent)
        Overrides:
        onDetach in class com.vaadin.flow.component.Component
      • getCurrentValue

        public String getCurrentValue()
      • setConfig

        public void setConfig​(String jsonConfig)
      • configure

        public TinyMce configure​(String configurationKey,
                                 boolean value)
      • configure

        public TinyMce configure​(String configurationKey,
                                 double value)
      • replaceSelectionContent

        public void replaceSelectionContent​(String htmlString)
        Replaces text in the editors selection (can be just a caret position).
        Parameters:
        htmlString - the html snippet to be inserted
      • injectTinyMceScript

        protected void injectTinyMceScript()
        Injects actual editor script to the host page from the add-on bundle.

        Override this with an empty implementation if you to use the cloud hosted version, or own custom script if needed.

      • focus

        public void focus()
      • setEnabled

        public void setEnabled​(boolean enabled)
        Specified by:
        setEnabled in interface com.vaadin.flow.component.HasEnabled
      • setReadOnly

        public void setReadOnly​(boolean readOnly)
        Specified by:
        setReadOnly in interface org.github.legioth.field.Field<TinyMce,​String>
        Specified by:
        setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TinyMce,​String>,​String>
        Specified by:
        setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TinyMce,​String>,​String>