return this;
},
stopEditingText: function() {
+ this.model.flushText();
this.$el.find("> .text").blur();
return this;
},
console.log("unexpected number of lines in textChange");
} else if (lines.length === 1) {
// Normal edit
+ // Debounce it.
this.model.setText(this.decodeText(lines[0]));
// If there's a line break in the text, they pressed "Enter", and it's more complicated.
this.save({collapsed: !this.get("collapsed")});
},
_setText: function(text) {
+ this._text = text;
return this.save({text: text});
},
- setText: function(text) {
- return Actions.App.act(new Actions.ChangeText(this, text));
+ setText: function(text, flush) {
+ this._text = text;
+ if (flush) {
+ this.flushText();
+ } else {
+ this._flushTextDebounced();
+ }
+ return this;
+ },
+ _flushTextDebounced: _.debounce(function() {
+ this.flushText();
+ }, 500),
+ flushText: function(text) {
+ if (!this._text || this.get("text") === this._text) {
+ return;
+ }
+ return Actions.App.act(new Actions.ChangeText(this, this._text));
},
hasChildren: function() {
return this.get("bullets").length > 0;
return this;
},
stopEditingText: function() {
+ this.model.flushText();
this.$el.find("> .text").blur();
return this;
},
console.log("unexpected number of lines in textChange");
} else if (lines.length === 1) {
// Normal edit
+ // Debounce it.
this.model.setText(this.decodeText(lines[0]));
// If there's a line break in the text, they pressed "Enter", and it's more complicated.
this.save({collapsed: !this.get("collapsed")});
},
_setText: function(text) {
+ this._text = text;
return this.save({text: text});
},
- setText: function(text) {
- return Actions.App.act(new Actions.ChangeText(this, text));
+ setText: function(text, flush) {
+ this._text = text;
+ if (flush) {
+ this.flushText();
+ } else {
+ this._flushTextDebounced();
+ }
+ return this;
+ },
+ _flushTextDebounced: _.debounce(function() {
+ this.flushText();
+ }, 500),
+ flushText: function(text) {
+ if (!this._text || this.get("text") === this._text) {
+ return;
+ }
+ return Actions.App.act(new Actions.ChangeText(this, this._text));
},
hasChildren: function() {
return this.get("bullets").length > 0;
this.save({collapsed: !this.get("collapsed")});
},
_setText: function(text) {
+ this._text = text;
return this.save({text: text});
},
- setText: function(text) {
- return Actions.App.act(new Actions.ChangeText(this, text));
+ setText: function(text, flush) {
+ this._text = text;
+ if (flush) {
+ this.flushText();
+ } else {
+ this._flushTextDebounced();
+ }
+ return this;
+ },
+ _flushTextDebounced: _.debounce(function() {
+ this.flushText();
+ }, 500),
+ flushText: function(text) {
+ if (!this._text || this.get("text") === this._text) {
+ return;
+ }
+ return Actions.App.act(new Actions.ChangeText(this, this._text));
},
hasChildren: function() {
return this.get("bullets").length > 0;
return this;
},
stopEditingText: function() {
+ this.model.flushText();
this.$el.find("> .text").blur();
return this;
},
console.log("unexpected number of lines in textChange");
} else if (lines.length === 1) {
// Normal edit
+ // Debounce it.
this.model.setText(this.decodeText(lines[0]));
// If there's a line break in the text, they pressed "Enter", and it's more complicated.