Skip to content

Commit

Permalink
Error message in runtime Vaadin console when using codeEditor component
Browse files Browse the repository at this point in the history
  • Loading branch information
KremnevDmitry committed Jul 21, 2023
1 parent b541d48 commit d9e65c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ public void setPrintMarginColumn(int printMarginColumn) {
*/
@Synchronize(PROPERTY_THEME)
public CodeEditorTheme getTheme() {
return CodeEditorTheme.fromId(getElement().getProperty(PROPERTY_THEME));
return CodeEditorTheme.fromId(getElement().getProperty(PROPERTY_THEME, CodeEditorTheme.TEXTMATE.getId()));
}

/**
* Sets the visual theme of the editor.
* The visual theme is not applied by default.
* The visual theme is {@link CodeEditorTheme#TEXTMATE} by default.
*
* @param theme the instance of the {@link CodeEditorTheme} to be applied
*/
Expand All @@ -189,12 +189,12 @@ public void setTheme(CodeEditorTheme theme) {
*/
@Synchronize(PROPERTY_MODE)
public CodeEditorMode getMode() {
return CodeEditorMode.fromId(getElement().getProperty(PROPERTY_MODE));
return CodeEditorMode.fromId(getElement().getProperty(PROPERTY_MODE, CodeEditorMode.PLAIN_TEXT.getId()));
}

/**
* Sets syntax highlighting for a specific mode.
* The syntax highlighting mode is not applied by default.
* The syntax highlighting mode is {@link CodeEditorMode#PLAIN_TEXT} by default.
*
* @param mode the instance of the {@link CodeEditorMode} to be applied
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ class JmixCodeEditor extends ResizeMixin(InputFieldMixin(ThemableMixin(ElementMi
return {
theme: {
type: String,
value: 'textmate',
observer: '_onThemeChange'
},

mode: {
type: String,
value: 'plain_text',
observer: '_onModeChange'
},

Expand Down Expand Up @@ -279,6 +281,10 @@ class JmixCodeEditor extends ResizeMixin(InputFieldMixin(ThemableMixin(ElementMi

this._editor.setPrintMarginColumn(printMarginColumn);
}

get clearElement() {
return null;
}
}

customElements.define(JmixCodeEditor.is, JmixCodeEditor);
Expand Down

0 comments on commit d9e65c5

Please sign in to comment.