Skip to content

Commit 55a663d

Browse files
committed
split the Sprite.text method into two methods - getter and setter since the getter requires a flag
1 parent f1f651c commit 55a663d

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

classes/ace.dre

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ SOFTWARE. -->
101101

102102
<handler event="oninit">
103103
// Get initial text (match behavior of inputtext)
104-
text = this.text || this.sprite.text();
105-
this.sprite.text('');
104+
text = this.text || this.sprite.getText(false);
105+
this.sprite.setText('');
106106

107107
// I couldn't get jquery syntax to work so directly modify the DOM.
108108
var acediv = document.createElement("DIV");

classes/text.dre

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ SOFTWARE. -->
115115
<setter name="text" args="text">
116116
# console.log('set_text', text)
117117
if (text != @text)
118-
@sprite.text(@format(text))
118+
@sprite.setText(@format(text))
119119
@updateSize()
120120
</setter>
121121
<handler event="oninit">

layout.coffee

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -911,14 +911,15 @@ window.dr = do ->
911911
# console.log('setid', @id)
912912
@setStyle('overflow', if clip then 'hidden' else '')
913913

914-
text: (textOrTextOnlyFlag) ->
915-
if textOrTextOnlyFlag? && typeof textOrTextOnlyFlag == "string"
916-
@el.innerHTML = textOrTextOnlyFlag
914+
setText: (txt) ->
915+
if txt?
916+
@el.innerHTML = txt
917+
918+
getText: (textOnly) ->
919+
if textOnly
920+
@el.innerText
917921
else
918-
if textOrTextOnlyFlag? && typeof textOrTextOnlyFlag == "boolean" && textOrTextOnlyFlag == true
919-
@el.innerText
920-
else
921-
@el.innerHTML
922+
@el.innerHTML
922923

923924
value: (value) ->
924925
return unless @input
@@ -1250,10 +1251,9 @@ window.dr = do ->
12501251

12511252
super
12521253

1253-
text = attributes['text'] || @sprite.text(true)
1254-
@['text'] = attributes['text'] = text
1255-
@sprite.text('')
1256-
@sprite.createInputtextElement(text, @multiline, @width, @height)
1254+
@text = attributes['text'] || @sprite.getText(true)
1255+
@sprite.setText('')
1256+
@sprite.createInputtextElement(@text, @multiline, @width, @height)
12571257
@inputElem = @sprite.el.getElementsByTagName('input')[0]
12581258
@height = @_heightFromInputHeight() unless @height
12591259

layout.js

Lines changed: 14 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)