.../captioned-image/lib/captioned-image-plugin.js | 26 +++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/extra/captioned-image/lib/captioned-image-plugin.js b/plugins/extra/captioned-image/lib/captioned-image-plugin.js index 540dfe1..71fd5f5 100644 --- a/plugins/extra/captioned-image/lib/captioned-image-plugin.js +++ b/plugins/extra/captioned-image/lib/captioned-image-plugin.js @@ -122,6 +122,7 @@ define([ function initializeComponents() { var left = UiPlugin.getAdoptedComponent('alignLeft'); var right = UiPlugin.getAdoptedComponent('alignRight'); + var center = UiPlugin.getAdoptedComponent('alignCenter'); var alignLeft = function () { if (BlockManager._activeBlock) { BlockManager._activeBlock.attr('align', 'left'); @@ -136,6 +137,13 @@ define([ } return false; }; + var alignCenter = function () { + if (BlockManager._activeBlock) { + BlockManager._activeBlock.attr('align', 'center'); + return true; + } + return false; + } if (left) { var clickLeft = left.click; @@ -169,6 +177,22 @@ define([ })); } + if (center) { + var clickCenter = center.click; + center.click = function () { + if (!alignCenter()) { + clickCenter(); + } + }; + components.push(center); + } else { + components.push(Ui.adopt('imgAlignCenter', Button, { + tooltip: 'Align center', + text: 'Align center', + click: alignCenter + })); + } + components.push(Ui.adopt('imgAlignClear', Button, { tooltip: 'Remove alignment', text: 'Remove alignment',