Show: Inherited Protected Private Deprecated

# File `src/ui/react/src/components/buttons/button-embed.jsx`

                                (function () {
                                    'use strict';

                                    /**
                                     * The ButtonEmbed class provides functionality for creating and editing an embed link in a document.
                                     * ButtonEmbed renders in two different modes:
                                     *
                                     * - Normal: Just a button that allows to switch to the edition mode
                                     * - Exclusive: The ButtonEmbedEdit UI with all the link edition controls.
                                     *
                                     * @uses ButtonKeystroke
                                     *
                                     * @class ButtonEmbed
                                     */
                                    var ButtonEmbed = React.createClass({
                                        mixins: [AlloyEditor.ButtonKeystroke],

                                        // Allows validating props being passed to the component.
                                        propTypes: {
                                            /**
                                             * The editor instance where the component is being used.
                                             *
                                             * @property {Object} editor
                                             */
                                            editor: React.PropTypes.object.isRequired,

                                            /**
                                             * The label that should be used for accessibility purposes.
                                             *
                                             * @property {String} label
                                             */
                                            label: React.PropTypes.string,

                                            /**
                                             * The tabIndex of the button in its toolbar current state. A value other than -1
                                             * means that the button has focus and is the active element.
                                             *
                                             * @property {Number} tabIndex
                                             */
                                            tabIndex: React.PropTypes.number
                                        },

                                        // Lifecycle. Provides static properties to the widget.
                                        statics: {
                                            /**
                                             * The name which will be used as an alias of the button in the configuration.
                                             *
                                             * @static
                                             * @property {String} key
                                             * @default embed
                                             */
                                            key: 'embed'
                                        },

                                        /**
                                         * Lifecycle. Returns the default values of the properties used in the widget.
                                         *
                                         * @method getDefaultProps
                                         * @return {Object} The default properties.
                                         */
                                        getDefaultProps: function() {
                                            return {
                                                keystroke: {
                                                    fn: '_requestExclusive',
                                                    keys: CKEDITOR.CTRL + CKEDITOR.SHIFT + 76 /*L*/
                                                }
                                            };
                                        },

                                        /**
                                         * Lifecycle. Renders the UI of the button.
                                         *
                                         * @method render
                                         * @return {Object} The content which should be rendered.
                                         */
                                        render: function() {
                                            if (this.props.renderExclusive) {
                                                return (
                                                    <AlloyEditor.ButtonEmbedEdit {...this.props} />
                                                );
                                            } else {
                                                return (
                                                    <button aria-label={AlloyEditor.Strings.link} className="ae-button" data-type="button-embed" onClick={this._requestExclusive} tabIndex={this.props.tabIndex} title={AlloyEditor.Strings.link}>
                                                        <span className="ae-icon-add"></span>
                                                    </button>
                                                );
                                            }
                                        },

                                        /**
                                         * Requests the link button to be rendered in exclusive mode to allow the embedding of a link.
                                         *
                                         * @protected
                                         * @method _requestExclusive
                                         */
                                        _requestExclusive: function() {
                                            this.props.requestExclusive(ButtonEmbed.key);
                                        }
                                    });

                                    AlloyEditor.Buttons[ButtonEmbed.key] = AlloyEditor.ButtonEmbed = ButtonEmbed;
                                }());