mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 19:57:36 +08:00
Temporary fix for AceEditor #PL-1980
This commit is contained in:
parent
195aabd9a2
commit
1268ca1b11
@ -7,6 +7,8 @@ package com.haulmont.cuba.web.toolkit.ui;
|
||||
|
||||
import com.haulmont.cuba.gui.autocomplete.AutoCompleteSupport;
|
||||
import com.haulmont.cuba.web.controllers.ControllerUtils;
|
||||
import com.vaadin.data.Validator;
|
||||
import com.vaadin.data.util.converter.Converter;
|
||||
import com.vaadin.ui.AbstractTextField;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.vaadin.aceeditor.AceEditor;
|
||||
@ -19,8 +21,9 @@ public class CubaSourceCodeEditor extends AceEditor implements AutoCompleteSuppo
|
||||
|
||||
public CubaSourceCodeEditor() {
|
||||
String location = ControllerUtils.getLocationWithoutParams();
|
||||
if (!StringUtils.endsWith(location, "/"))
|
||||
if (!StringUtils.endsWith(location, "/")) {
|
||||
location += "/";
|
||||
}
|
||||
|
||||
String aceLocation = location + "VAADIN/resources/ace";
|
||||
|
||||
@ -34,4 +37,23 @@ public class CubaSourceCodeEditor extends AceEditor implements AutoCompleteSuppo
|
||||
setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY);
|
||||
setTextChangeTimeout(200);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setInternalValue(String newValue) {
|
||||
if (newValue == null) {
|
||||
newValue = "";
|
||||
}
|
||||
|
||||
super.setInternalValue(newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setValue(String newFieldValue, boolean repaintIsNotNeeded)
|
||||
throws ReadOnlyException, Converter.ConversionException, Validator.InvalidValueException {
|
||||
if (newFieldValue == null) {
|
||||
newFieldValue = "";
|
||||
}
|
||||
|
||||
super.setValue(newFieldValue, repaintIsNotNeeded);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user