/** * Captioned Image provides an Aloha block implementation that allows the editor * to work with images that have captions, such that an image with its * corresponding caption can be aligned together in an editable. * It reads and writes to an tag's data-caption and data-align attributes. * No formatting inside the caption is allowed; only plain text is permitted. * Four possible alignments are possible: none, left, right, center. * * TODO * ---- * - Implement makeClean * - Prevent disallowed content in caption */ define([ 'jquery', 'aloha/core', 'aloha/plugin', 'block/block', 'block/blockmanager', 'ui/ui', 'ui/toggleButton', 'ui/toolbar', 'util/maps', 'aloha/contenthandlermanager', 'aloha/console', 'align/align-plugin', // Needed to ensure that we have "alignLeft", and // "alignRight" components. // FIXME: use of the css require plugin is deprecated 'css!captioned-image/css/captioned-image.css' ], function ( $, Aloha, Plugin, Block, BlockManager, Ui, ToggleButton, Toolbar, Maps, ContentHandlerManager, console ) { 'use strict'; var defaultRenderCSS = '\ .captioned-image {\ text-align: center;\ padding: 0 1em 1em;\ }\ .captioned-image.align-right {\ float: right;\ padding-right: 0;\ }\ .captioned-image.align-left {\ float: left;\ padding-left: 0;\ }\ .captioned-image.align-center {\ display: block;\ text-align: center;\ }\ .captioned-image .caption {\ padding: 0.5em;\ font-size: 0.9em;\ background: rgba(0,0,0,0.8);\ font-family: Arial;\ color: #fff;\ text-align: left;\ min-width: 100px;\ }\ .captioned-image.align-center .caption {\ margin-left: auto;\ margin-right: auto;\ }\ /* Overrides for when the caption is being edited through Aloha Editor. */\ .aloha-captioned-image-block .captioned-image {\ padding: 0;\ }\ '; var settings = ((Aloha.settings && Aloha.settings.plugins && Aloha.settings.plugins.captionedImage) || false); if (settings.defaultCSS !== false) { $('