|
|
|
@ -17747,12 +17747,12 @@ BI.CodeEditor = BI.inherit(BI.Single, {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.editor.on("focus", function () { |
|
|
|
|
watermark.setVisible(false); |
|
|
|
|
self.watermark.setVisible(false); |
|
|
|
|
self.fireEvent(BI.CodeEditor.EVENT_FOCUS); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.editor.on("blur", function () { |
|
|
|
|
watermark.setVisible(BI.isEmptyString(self.getValue())); |
|
|
|
|
self.watermark.setVisible(BI.isEmptyString(self.getValue())); |
|
|
|
|
self.fireEvent(BI.CodeEditor.EVENT_BLUR); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -17761,21 +17761,21 @@ BI.CodeEditor = BI.inherit(BI.Single, {
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
//水印
|
|
|
|
|
var watermark = BI.createWidget({ |
|
|
|
|
this.watermark = BI.createWidget({ |
|
|
|
|
type: "bi.label", |
|
|
|
|
text: o.watermark, |
|
|
|
|
cls: "bi-water-mark", |
|
|
|
|
whiteSpace: "nowrap", |
|
|
|
|
textAlign: "left" |
|
|
|
|
}); |
|
|
|
|
watermark.element.bind( |
|
|
|
|
this.watermark.element.bind( |
|
|
|
|
"mousedown", function (e) { |
|
|
|
|
self.insertString(""); |
|
|
|
|
self.editor.focus(); |
|
|
|
|
e.stopEvent(); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
watermark.element.bind("click", function (e) { |
|
|
|
|
this.watermark.element.bind("click", function (e) { |
|
|
|
|
self.editor.focus(); |
|
|
|
|
e.stopEvent(); |
|
|
|
|
}); |
|
|
|
@ -17783,7 +17783,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
|
|
|
|
|
type: "bi.absolute", |
|
|
|
|
element: this, |
|
|
|
|
items: [{ |
|
|
|
|
el: watermark, |
|
|
|
|
el: this.watermark, |
|
|
|
|
top: 0, |
|
|
|
|
left: 5 |
|
|
|
|
}] |
|
|
|
@ -17801,6 +17801,15 @@ BI.CodeEditor = BI.inherit(BI.Single, {
|
|
|
|
|
this.editor.setOption("readOnly", b === true ? false : "nocursor") |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_checkWaterMark: function () { |
|
|
|
|
var o = this.options; |
|
|
|
|
if (BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { |
|
|
|
|
this.watermark && this.watermark.visible(); |
|
|
|
|
} else { |
|
|
|
|
this.watermark && this.watermark.invisible(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
insertParam: function (param) { |
|
|
|
|
var from = this.editor.getCursor(); |
|
|
|
|
this.editor.replaceSelection(param); |
|
|
|
@ -17855,7 +17864,8 @@ BI.CodeEditor = BI.inherit(BI.Single, {
|
|
|
|
|
} else { |
|
|
|
|
self.insertString(item); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
this._checkWaterMark(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
focus: function () { |
|
|
|
|