Class JmixMarkdownEditor
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<JmixMarkdownEditor,String>
com.vaadin.flow.component.AbstractSinglePropertyField<JmixMarkdownEditor,String>
io.jmix.flowui.kit.component.markdowneditor.JmixMarkdownEditor
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<JmixMarkdownEditor>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<JmixMarkdownEditor>,com.vaadin.flow.component.FocusNotifier<JmixMarkdownEditor>,com.vaadin.flow.component.HasAriaLabel,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasHelper,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasPlaceholder,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<JmixMarkdownEditor,,String>, String> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixMarkdownEditor,,String>, String> com.vaadin.flow.component.shared.HasThemeVariant<MarkdownEditorVariant>,com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.component.shared.HasValidationProperties,com.vaadin.flow.data.binder.HasValidator<String>,com.vaadin.flow.data.value.HasValueChangeMode,HasAutofocus,Serializable
- Direct Known Subclasses:
MarkdownEditor
@Tag("jmix-markdown-editor")
@JsModule("./src/markdown-editor/jmix-markdown-editor.js")
public class JmixMarkdownEditor
extends com.vaadin.flow.component.AbstractSinglePropertyField<JmixMarkdownEditor,String>
implements com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasPlaceholder, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.data.binder.HasValidator<String>, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.data.value.HasValueChangeMode, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.Focusable<JmixMarkdownEditor>, com.vaadin.flow.component.shared.HasThemeVariant<MarkdownEditorVariant>, HasAutofocus
A markdown editor field component that supports editing and rendered preview.
The component provides an Edit/Preview tab bar, a formatting toolbar with
common markdown actions and keyboard shortcuts, and renders the preview using
the built-in vaadin-markdown component.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInternationalization properties forJmixMarkdownEditor.static classEvent fired when the editor switches between Edit and Preview mode.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
FieldsModifier and TypeFieldDescriptionprotected com.vaadin.flow.data.value.ValueChangeModeprotected com.vaadin.flow.data.binder.Validator<String> protected com.vaadin.flow.component.shared.internal.ValidationController<JmixMarkdownEditor, String> protected intFields inherited from interface io.jmix.flowui.kit.component.HasAutofocus
AUTOFOCUS_PROPERTY_NAMEFields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an emptyJmixMarkdownEditor.JmixMarkdownEditor(String label) Constructs an emptyJmixMarkdownEditorwith the given label. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddModeChangedListener(com.vaadin.flow.component.ComponentEventListener<JmixMarkdownEditor.ModeChangedEvent> listener) Adds a listener that is notified whenever the editor mode changes between Edit and Preview.protected voidcom.vaadin.flow.data.binder.Validator<String> getI18n()Gets the internationalization object previously set for this component.protected StringgetMode()Returns the current mode of this editor.com.vaadin.flow.data.value.ValueChangeModeGets current value change mode of the component.intReturns the currently set timeout, for how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.booleanAlias forHasValueAndElement.isRequiredIndicatorVisible()protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidrunBeforeClientResponse(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.UI> command) voidSets the internationalization object for this component.protected voidvoidsetManualValidation(boolean enabled) voidsetMode(MarkdownEditorMode mode) Sets the editor mode.voidsetRequired(boolean required) Alias forHasValueAndElement.setRequiredIndicatorVisible(boolean).voidsetValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode) Sets new value change mode for the component.voidsetValueChangeTimeout(int valueChangeTimeout) Sets how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.protected voidvalidate()Validates the current value against the field constraints and updates the invalid state and error message accordingly.Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, bindValue, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods 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, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledByMethods inherited from interface io.jmix.flowui.kit.component.HasAutofocus
isAutofocus, setAutofocusMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
bindHelperText, getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods inherited from interface com.vaadin.flow.component.HasPlaceholder
bindPlaceholder, getPlaceholder, setPlaceholderMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariantsMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipTextMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.data.binder.HasValidator
addValidationStatusChangeListenerMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
Field Details
-
currentMode
protected com.vaadin.flow.data.value.ValueChangeMode currentMode -
valueChangeTimeout
protected int valueChangeTimeout -
i18n
-
defaultValidator
-
validationController
protected com.vaadin.flow.component.shared.internal.ValidationController<JmixMarkdownEditor,String> validationController
-
-
Constructor Details
-
JmixMarkdownEditor
public JmixMarkdownEditor()Constructs an emptyJmixMarkdownEditor. -
JmixMarkdownEditor
Constructs an emptyJmixMarkdownEditorwith the given label.- Parameters:
label- the text to set as the label
-
-
Method Details
-
getDefaultValidator
- Specified by:
getDefaultValidatorin interfacecom.vaadin.flow.data.binder.HasValidator<String>
-
setManualValidation
public void setManualValidation(boolean enabled) - Specified by:
setManualValidationin interfacecom.vaadin.flow.component.HasValidation
-
getValueChangeMode
public com.vaadin.flow.data.value.ValueChangeMode getValueChangeMode()Gets current value change mode of the component.- Specified by:
getValueChangeModein interfacecom.vaadin.flow.data.value.HasValueChangeMode- Returns:
- current value change mode of the component, or
nullif the value is not synchronized
-
setValueChangeMode
public void setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode) Sets new value change mode for the component.- Specified by:
setValueChangeModein interfacecom.vaadin.flow.data.value.HasValueChangeMode- Parameters:
valueChangeMode- new value change mode, ornullto disable the value synchronization
-
getValueChangeTimeout
public int getValueChangeTimeout()Returns the currently set timeout, for how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.- Specified by:
getValueChangeTimeoutin interfacecom.vaadin.flow.data.value.HasValueChangeMode- Returns:
- the timeout in milliseconds of how often
HasValue.ValueChangeEvents are triggered.
-
setValueChangeTimeout
public void setValueChangeTimeout(int valueChangeTimeout) Sets how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.- Specified by:
setValueChangeTimeoutin interfacecom.vaadin.flow.data.value.HasValueChangeMode- Parameters:
valueChangeTimeout- the timeout in milliseconds of how oftenHasValue.ValueChangeEvents are triggered.
-
applyChangeTimeout
protected void applyChangeTimeout() -
setRequired
public void setRequired(boolean required) Alias forHasValueAndElement.setRequiredIndicatorVisible(boolean).- Parameters:
required-trueto make the field required,falseotherwise
-
isRequired
public boolean isRequired()Alias forHasValueAndElement.isRequiredIndicatorVisible()- Returns:
trueif the field is required,falseotherwise
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
getI18n
Gets the internationalization object previously set for this component.- Returns:
- the i18n object, or
nullif none has been set
-
setI18n
Sets the internationalization object for this component.- Parameters:
i18n- the i18n object, notnull
-
getMode
Returns the current mode of this editor.- Returns:
- the current
MarkdownEditorMode, nevernull
-
setMode
Sets the editor mode.- Parameters:
mode- the mode to set, notnull
-
addModeChangedListener
public com.vaadin.flow.shared.Registration addModeChangedListener(com.vaadin.flow.component.ComponentEventListener<JmixMarkdownEditor.ModeChangedEvent> listener) Adds a listener that is notified whenever the editor mode changes between Edit and Preview.- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used to remove the listener
-
validate
protected void validate()Validates the current value against the field constraints and updates the invalid state and error message accordingly. Has no effect when manual validation is enabled. -
setI18nWithJS
protected void setI18nWithJS() -
runBeforeClientResponse
protected void runBeforeClientResponse(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.UI> command) -
getI18nErrorMessage
protected String getI18nErrorMessage(Function<JmixMarkdownEditor.JmixMarkdownEditorI18n, String> getter)
-