ENHANCEMENT Marking "link" and "unlink" buttons in SilverStripe's TinyMCE as disabled if no link is selected (see 4646efe84 in sapphire for details)

This commit is contained in:
Ingo Schommer 2012-01-04 23:33:12 +01:00
parent 7a29a4a0ca
commit bb7edf8bfd

View File

@ -37,8 +37,10 @@
jQuery('#Form_EditorToolbarFlashForm')[0].open();
});
ed.onNodeChange.add(function(ed, o) {
jQuery('Form_EditorToolbarLinkForm').entwine('ss').updateSelection();
ed.onNodeChange.add(function(ed, cm, n, co) {
cm.setDisabled('sslink', co && n.nodeName != 'A');
cm.setActive('sslink', n.nodeName == 'A' && !n.name);
jQuery('Form_EditorToolbarLinkForm').entwine('ss').respondToNodeChange();
});
}