[FIX] web_editor: properly show link alignment in toolbar
When clicking on a link in the editor, the "center" alignment button was always marked as active whatever the real alignment of the link. This was because it considered the alignment of the text inside the link instead of the link's one inside its parent.
This commit is contained in:
@@ -2015,6 +2015,14 @@ eventHandler.modules.editor.currentStyle = function(target) {
|
||||
if(r)
|
||||
styleInfo.image = r.isOnImg();
|
||||
}
|
||||
// Fix when the target is a link: the text-align buttons state should
|
||||
// indicate the alignment of the link in the parent, not the text inside
|
||||
// the link (which is not possible to customize with summernote). Summernote fixed
|
||||
// this in their newest version... by just not showing the active button
|
||||
// for alignments.
|
||||
if (styleInfo.anchor) {
|
||||
styleInfo['text-align'] = $(styleInfo.anchor).parent().css('text-align');
|
||||
}
|
||||
return styleInfo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user