Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffInline.js
Show First 20 Lines • Show All 766 Lines • ▼ Show 20 Lines | _getSuggestionButton: function() { | ||||
return this._suggestionButton; | return this._suggestionButton; | ||||
}, | }, | ||||
_onSuggestEdit: function(e) { | _onSuggestEdit: function(e) { | ||||
e.kill(); | e.kill(); | ||||
this.setHasSuggestion(!this.getHasSuggestion()); | this.setHasSuggestion(!this.getHasSuggestion()); | ||||
// The first time the user actually clicks the button and enables | // Resize the suggestion input for size of the text. | ||||
// suggestions for a given editor state, fill the input with the | |||||
// underlying text if there isn't any text yet. | |||||
if (this.getHasSuggestion()) { | if (this.getHasSuggestion()) { | ||||
if (this._editRow) { | if (this._editRow) { | ||||
var node = this._getSuggestionNode(this._editRow); | var node = this._getSuggestionNode(this._editRow); | ||||
if (node) { | if (node) { | ||||
if (!node.value.length) { | |||||
var data = JX.Stratcom.getData(node); | |||||
if (!data.hasSetDefault) { | |||||
data.hasSetDefault = true; | |||||
node.value = data.defaultText; | |||||
node.rows = Math.max(3, node.value.split('\n').length); | node.rows = Math.max(3, node.value.split('\n').length); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
} | |||||
// Save the "hasSuggestion" part of the content state. | // Save the "hasSuggestion" part of the content state. | ||||
this.triggerDraft(); | this.triggerDraft(); | ||||
}, | }, | ||||
_getActiveContentState: function() { | _getActiveContentState: function() { | ||||
var state = this._activeContentState; | var state = this._activeContentState; | ||||
▲ Show 20 Lines • Show All 413 Lines • Show Last 20 Lines |