Last active
November 15, 2015 08:43
-
-
Save martin-mfg/d27f58fa371c892e5c5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Updates the edit node | |
* | |
* @param {Ext.tree.TreeNode} node | |
* @param {String} editableText | |
* @param {String} updatedNode | |
* @return {void} | |
*/ | |
updateNodeText: function(node, editableText, updatedNode) { | |
node.setText(this.editNode.attributes.prefix + updatedNode + this.editNode.attributes.suffix); | |
node.attributes.editableText = editableText; | |
}, | |
// [...] | |
/** | |
* Updates the title of a node | |
* | |
* @param {Ext.tree.TreeNode} node | |
* @param {String} newText | |
* @param {String} oldText | |
* @param {TYPO3.Components.PageTree.TreeEditor} treeEditor | |
* @return {void} | |
*/ | |
saveTitle: function(node, newText, oldText, treeEditor) { //TODO: rename 1st parameter | |
nodeToChange = node.editNode; | |
if (newText === oldText || newText == '') { | |
treeEditor.updateNodeText( | |
nodeToChange, | |
nodeToChange.attributes.nodeData.editableText, | |
Ext.util.Format.htmlEncode(oldText) | |
); | |
return; | |
} | |
TYPO3.Components.PageTree.Commands.updateLabel( | |
node.editNode.attributes.nodeData, | |
newText, | |
function(response) { | |
if (this.evaluateResponse(response)) { | |
treeEditor.updateNodeText(nodeToChange, response.editableText, response.updatedText); | |
} else { | |
treeEditor.updateNodeText( | |
nodeToChange, | |
nodeToChange.attributes.nodeData.editableText, | |
Ext.util.Format.htmlEncode(oldText) | |
); | |
} | |
this.singleClick(node.editNode, node.editNode.ownerTree); | |
}, | |
this | |
); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment