{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative/imagetextalternativecommand.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative/imagetextalternativeediting.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative/ui/textalternativeformview.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative/imagetextalternativeui.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative.js"],"names":["ImageTextAlternativeCommand","editor","this","imageUtils","plugins","get","element","getClosestSelectedImageElement","model","document","selection","isEnabled","hasAttribute","value","getAttribute","options","imageElement","change","writer","setAttribute","newValue","Command","ImageTextAlternativeEditing","commands","add","ImageUtils","Plugin","TextAlternativeFormView","locale","_this","Object","classCallCheck","_super","call","t","focusTracker","FocusTracker","keystrokes","KeystrokeHandler","labeledInput","_createLabeledInputView","saveButtonView","_createButton","icons","check","type","cancelButtonView","cancel","_focusables","ViewCollection","_focusCycler","FocusCycler","focusables","keystrokeHandler","actions","focusPrevious","focusNext","setTemplate","tag","attributes","class","tabindex","children","injectCssTransitionDisabler","assertThisInitialized","_this2","esm_get","getPrototypeOf","prototype","listenTo","submitHandler","view","forEach","v","label","icon","className","eventName","button","ButtonView","set","tooltip","extendTemplate","delegate","to","LabeledFieldView","createLabeledInputText","View","ImageTextAlternativeUI","_createForm","_form","destroy","ui","componentFactory","command","lowVision","bind","_showForm","editing","viewDocument","_balloon","render","execute","fieldView","_hideForm","data","getClosestSelectedImageWidget","_isVisible","repositionContextualBalloon","clickOutsideHandler","emitter","activator","contextElements","callback","disableCssTransitions","_isInBalloon","position","getBalloonPositionData","select","enableCssTransitions","focusEditable","isFocused","focus","remove","visibleView","hasView","ContextualBalloon","ImageTextAlternative"],"mappings":";;;;OAgBqBA,8JAYpB,WACC,IAAMC,EAASC,KAAKD,OACdE,EAAaF,EAAOG,QAAQC,IAAK,cACjCC,EAAUH,EAAWI,+BAAgCL,KAAKD,OAAO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C,EAAagE,UAAU1F,MAAQ0B,EAAagE,UAAUjG,QAAQO,MAAQiF,EAAQjF,OAAS,GAEvFX,KAAKwF,MAAMnD,aAAagE,UAAUe,SAElCpH,KAAKwF,MAAM6B,iDASZ,SAAWC,GACJtH,KAAKiH,eAMNjH,KAAKwF,MAAMvD,aAAasF,WAC5BvH,KAAKwF,MAAMjD,eAAeiF,QAG3BxH,KAAKkG,SAASuB,OAAQzH,KAAKwF,OAEtB8B,GACJtH,KAAKD,OAAOiG,QAAQ3B,KAAKmD,iCAU3B,WACC,OAAOxH,KAAKkG,SAASwB,cAAgB1H,KAAKwF,gCAS3C,WACC,OAAOxF,KAAKkG,SAASyB,QAAS3H,KAAKwF,+BAzMpC,WACC,OAASoC,gCAMV,WACC,MAAO,gCAZ2CpG;;;;OCE/BqG,kKAIpB,WACC,OAASzG,EAA6BkE,2BAMvC,WACC,MAAO,8BAZyC9D","file":"js/chunk-2d0cfb12.64f8ba20.js","sourcesContent":["/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module image/imagetextalternative/imagetextalternativecommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\n\n/**\n * The image text alternative command. It is used to change the `alt` attribute of `` and `` model elements.\n *\n * @extends module:core/command~Command\n */\nexport default class ImageTextAlternativeCommand extends Command {\n\t/**\n\t * The command value: `false` if there is no `alt` attribute, otherwise the value of the `alt` attribute.\n\t *\n\t * @readonly\n\t * @observable\n\t * @member {String|Boolean} #value\n\t */\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tconst editor = this.editor;\n\t\tconst imageUtils = editor.plugins.get( 'ImageUtils' );\n\t\tconst element = imageUtils.getClosestSelectedImageElement( this.editor.model.document.selection );\n\n\t\tthis.isEnabled = !!element;\n\n\t\tif ( this.isEnabled && element.hasAttribute( 'alt' ) ) {\n\t\t\tthis.value = element.getAttribute( 'alt' );\n\t\t} else {\n\t\t\tthis.value = false;\n\t\t}\n\t}\n\n\t/**\n\t * Executes the command.\n\t *\n\t * @fires execute\n\t * @param {Object} options\n\t * @param {String} options.newValue The new value of the `alt` attribute to set.\n\t */\n\texecute( options ) {\n\t\tconst editor = this.editor;\n\t\tconst imageUtils = editor.plugins.get( 'ImageUtils' );\n\t\tconst model = editor.model;\n\t\tconst imageElement = imageUtils.getClosestSelectedImageElement( model.document.selection );\n\n\t\tmodel.change( writer => {\n\t\t\twriter.setAttribute( 'alt', options.newValue, imageElement );\n\t\t} );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module image/imagetextalternative/imagetextalternativeediting\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport ImageTextAlternativeCommand from './imagetextalternativecommand';\nimport ImageUtils from '../imageutils';\n\n/**\n * The image text alternative editing plugin.\n *\n * Registers the `'imageTextAlternative'` command.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ImageTextAlternativeEditing extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ImageUtils ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ImageTextAlternativeEditing';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tthis.editor.commands.add( 'imageTextAlternative', new ImageTextAlternativeCommand( this.editor ) );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module image/imagetextalternative/ui/textalternativeformview\n */\n\nimport {\n\tButtonView,\n\tFocusCycler,\n\tLabeledFieldView,\n\tView,\n\tViewCollection,\n\tcreateLabeledInputText,\n\tinjectCssTransitionDisabler,\n\tsubmitHandler\n} from 'ckeditor5/src/ui';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';\nimport { icons } from 'ckeditor5/src/core';\n\nimport '../../../theme/textalternativeform.css';\n\n// See: #8833.\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';\n\n/**\n * The TextAlternativeFormView class.\n *\n * @extends module:ui/view~View\n */\nexport default class TextAlternativeFormView extends View {\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( locale ) {\n\t\tsuper( locale );\n\n\t\tconst t = this.locale.t;\n\n\t\t/**\n\t\t * Tracks information about the DOM focus in the form.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:utils/focustracker~FocusTracker}\n\t\t */\n\t\tthis.focusTracker = new FocusTracker();\n\n\t\t/**\n\t\t * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:utils/keystrokehandler~KeystrokeHandler}\n\t\t */\n\t\tthis.keystrokes = new KeystrokeHandler();\n\n\t\t/**\n\t\t * An input with a label.\n\t\t *\n\t\t * @member {module:ui/labeledfield/labeledfieldview~LabeledFieldView} #labeledInput\n\t\t */\n\t\tthis.labeledInput = this._createLabeledInputView();\n\n\t\t/**\n\t\t * A button used to submit the form.\n\t\t *\n\t\t * @member {module:ui/button/buttonview~ButtonView} #saveButtonView\n\t\t */\n\t\tthis.saveButtonView = this._createButton( t( 'Save' ), icons.check, 'ck-button-save' );\n\t\tthis.saveButtonView.type = 'submit';\n\n\t\t/**\n\t\t * A button used to cancel the form.\n\t\t *\n\t\t * @member {module:ui/button/buttonview~ButtonView} #cancelButtonView\n\t\t */\n\t\tthis.cancelButtonView = this._createButton( t( 'Cancel' ), icons.cancel, 'ck-button-cancel', 'cancel' );\n\n\t\t/**\n\t\t * A collection of views which can be focused in the form.\n\t\t *\n\t\t * @readonly\n\t\t * @protected\n\t\t * @member {module:ui/viewcollection~ViewCollection}\n\t\t */\n\t\tthis._focusables = new ViewCollection();\n\n\t\t/**\n\t\t * Helps cycling over {@link #_focusables} in the form.\n\t\t *\n\t\t * @readonly\n\t\t * @protected\n\t\t * @member {module:ui/focuscycler~FocusCycler}\n\t\t */\n\t\tthis._focusCycler = new FocusCycler( {\n\t\t\tfocusables: this._focusables,\n\t\t\tfocusTracker: this.focusTracker,\n\t\t\tkeystrokeHandler: this.keystrokes,\n\t\t\tactions: {\n\t\t\t\t// Navigate form fields backwards using the Shift + Tab keystroke.\n\t\t\t\tfocusPrevious: 'shift + tab',\n\n\t\t\t\t// Navigate form fields forwards using the Tab key.\n\t\t\t\tfocusNext: 'tab'\n\t\t\t}\n\t\t} );\n\n\t\tthis.setTemplate( {\n\t\t\ttag: 'form',\n\n\t\t\tattributes: {\n\t\t\t\tclass: [\n\t\t\t\t\t'ck',\n\t\t\t\t\t'ck-text-alternative-form',\n\t\t\t\t\t'ck-responsive-form'\n\t\t\t\t],\n\n\t\t\t\t// https://github.com/ckeditor/ckeditor5-image/issues/40\n\t\t\t\ttabindex: '-1'\n\t\t\t},\n\n\t\t\tchildren: [\n\t\t\t\tthis.labeledInput,\n\t\t\t\tthis.saveButtonView,\n\t\t\t\tthis.cancelButtonView\n\t\t\t]\n\t\t} );\n\n\t\tinjectCssTransitionDisabler( this );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trender() {\n\t\tsuper.render();\n\n\t\tthis.keystrokes.listenTo( this.element );\n\n\t\tsubmitHandler( { view: this } );\n\n\t\t[ this.labeledInput, this.saveButtonView, this.cancelButtonView ]\n\t\t\t.forEach( v => {\n\t\t\t\t// Register the view as focusable.\n\t\t\t\tthis._focusables.add( v );\n\n\t\t\t\t// Register the view in the focus tracker.\n\t\t\t\tthis.focusTracker.add( v.element );\n\t\t\t} );\n\t}\n\n\t/**\n\t * Creates the button view.\n\t *\n\t * @private\n\t * @param {String} label The button label\n\t * @param {String} icon The button's icon.\n\t * @param {String} className The additional button CSS class name.\n\t * @param {String} [eventName] The event name that the ButtonView#execute event will be delegated to.\n\t * @returns {module:ui/button/buttonview~ButtonView} The button view instance.\n\t */\n\t_createButton( label, icon, className, eventName ) {\n\t\tconst button = new ButtonView( this.locale );\n\n\t\tbutton.set( {\n\t\t\tlabel,\n\t\t\ticon,\n\t\t\ttooltip: true\n\t\t} );\n\n\t\tbutton.extendTemplate( {\n\t\t\tattributes: {\n\t\t\t\tclass: className\n\t\t\t}\n\t\t} );\n\n\t\tif ( eventName ) {\n\t\t\tbutton.delegate( 'execute' ).to( this, eventName );\n\t\t}\n\n\t\treturn button;\n\t}\n\n\t/**\n\t * Creates an input with a label.\n\t *\n\t * @private\n\t * @returns {module:ui/labeledfield/labeledfieldview~LabeledFieldView} Labeled field view instance.\n\t */\n\t_createLabeledInputView() {\n\t\tconst t = this.locale.t;\n\t\tconst labeledInput = new LabeledFieldView( this.locale, createLabeledInputText );\n\n\t\tlabeledInput.label = t( 'Text alternative' );\n\n\t\treturn labeledInput;\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module image/imagetextalternative/imagetextalternativeui\n */\n\nimport { Plugin, icons } from 'ckeditor5/src/core';\nimport { ButtonView, ContextualBalloon, clickOutsideHandler } from 'ckeditor5/src/ui';\n\nimport TextAlternativeFormView from './ui/textalternativeformview';\nimport { repositionContextualBalloon, getBalloonPositionData } from '../image/ui/utils';\n\n/**\n * The image text alternative UI plugin.\n *\n * The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ImageTextAlternativeUI extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ContextualBalloon ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ImageTextAlternativeUI';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tthis._createButton();\n\t\tthis._createForm();\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tdestroy() {\n\t\tsuper.destroy();\n\n\t\t// Destroy created UI components as they are not automatically destroyed (see ckeditor5#1341).\n\t\tthis._form.destroy();\n\t}\n\n\t/**\n\t * Creates a button showing the balloon panel for changing the image text alternative and\n\t * registers it in the editor {@link module:ui/componentfactory~ComponentFactory ComponentFactory}.\n\t *\n\t * @private\n\t */\n\t_createButton() {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\n\t\teditor.ui.componentFactory.add( 'imageTextAlternative', locale => {\n\t\t\tconst command = editor.commands.get( 'imageTextAlternative' );\n\t\t\tconst view = new ButtonView( locale );\n\n\t\t\tview.set( {\n\t\t\t\tlabel: t( 'Change image text alternative' ),\n\t\t\t\ticon: icons.lowVision,\n\t\t\t\ttooltip: true\n\t\t\t} );\n\n\t\t\tview.bind( 'isEnabled' ).to( command, 'isEnabled' );\n\n\t\t\tthis.listenTo( view, 'execute', () => {\n\t\t\t\tthis._showForm();\n\t\t\t} );\n\n\t\t\treturn view;\n\t\t} );\n\t}\n\n\t/**\n\t * Creates the {@link module:image/imagetextalternative/ui/textalternativeformview~TextAlternativeFormView}\n\t * form.\n\t *\n\t * @private\n\t */\n\t_createForm() {\n\t\tconst editor = this.editor;\n\t\tconst view = editor.editing.view;\n\t\tconst viewDocument = view.document;\n\t\tconst imageUtils = editor.plugins.get( 'ImageUtils' );\n\n\t\t/**\n\t\t * The contextual balloon plugin instance.\n\t\t *\n\t\t * @private\n\t\t * @member {module:ui/panel/balloon/contextualballoon~ContextualBalloon}\n\t\t */\n\t\tthis._balloon = this.editor.plugins.get( 'ContextualBalloon' );\n\n\t\t/**\n\t\t * A form containing a textarea and buttons, used to change the `alt` text value.\n\t\t *\n\t\t * @member {module:image/imagetextalternative/ui/textalternativeformview~TextAlternativeFormView}\n\t\t */\n\t\tthis._form = new TextAlternativeFormView( editor.locale );\n\n\t\t// Render the form so its #element is available for clickOutsideHandler.\n\t\tthis._form.render();\n\n\t\tthis.listenTo( this._form, 'submit', () => {\n\t\t\teditor.execute( 'imageTextAlternative', {\n\t\t\t\tnewValue: this._form.labeledInput.fieldView.element.value\n\t\t\t} );\n\n\t\t\tthis._hideForm( true );\n\t\t} );\n\n\t\tthis.listenTo( this._form, 'cancel', () => {\n\t\t\tthis._hideForm( true );\n\t\t} );\n\n\t\t// Close the form on Esc key press.\n\t\tthis._form.keystrokes.set( 'Esc', ( data, cancel ) => {\n\t\t\tthis._hideForm( true );\n\t\t\tcancel();\n\t\t} );\n\n\t\t// Reposition the balloon or hide the form if an image widget is no longer selected.\n\t\tthis.listenTo( editor.ui, 'update', () => {\n\t\t\tif ( !imageUtils.getClosestSelectedImageWidget( viewDocument.selection ) ) {\n\t\t\t\tthis._hideForm( true );\n\t\t\t} else if ( this._isVisible ) {\n\t\t\t\trepositionContextualBalloon( editor );\n\t\t\t}\n\t\t} );\n\n\t\t// Close on click outside of balloon panel element.\n\t\tclickOutsideHandler( {\n\t\t\temitter: this._form,\n\t\t\tactivator: () => this._isVisible,\n\t\t\tcontextElements: [ this._balloon.view.element ],\n\t\t\tcallback: () => this._hideForm()\n\t\t} );\n\t}\n\n\t/**\n\t * Shows the {@link #_form} in the {@link #_balloon}.\n\t *\n\t * @private\n\t */\n\t_showForm() {\n\t\tif ( this._isVisible ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst editor = this.editor;\n\t\tconst command = editor.commands.get( 'imageTextAlternative' );\n\t\tconst labeledInput = this._form.labeledInput;\n\n\t\tthis._form.disableCssTransitions();\n\n\t\tif ( !this._isInBalloon ) {\n\t\t\tthis._balloon.add( {\n\t\t\t\tview: this._form,\n\t\t\t\tposition: getBalloonPositionData( editor )\n\t\t\t} );\n\t\t}\n\n\t\t// Make sure that each time the panel shows up, the field remains in sync with the value of\n\t\t// the command. If the user typed in the input, then canceled the balloon (`labeledInput#value`\n\t\t// stays unaltered) and re-opened it without changing the value of the command, they would see the\n\t\t// old value instead of the actual value of the command.\n\t\t// https://github.com/ckeditor/ckeditor5-image/issues/114\n\t\tlabeledInput.fieldView.value = labeledInput.fieldView.element.value = command.value || '';\n\n\t\tthis._form.labeledInput.fieldView.select();\n\n\t\tthis._form.enableCssTransitions();\n\t}\n\n\t/**\n\t * Removes the {@link #_form} from the {@link #_balloon}.\n\t *\n\t * @param {Boolean} [focusEditable=false] Controls whether the editing view is focused afterwards.\n\t * @private\n\t */\n\t_hideForm( focusEditable ) {\n\t\tif ( !this._isInBalloon ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Blur the input element before removing it from DOM to prevent issues in some browsers.\n\t\t// See https://github.com/ckeditor/ckeditor5/issues/1501.\n\t\tif ( this._form.focusTracker.isFocused ) {\n\t\t\tthis._form.saveButtonView.focus();\n\t\t}\n\n\t\tthis._balloon.remove( this._form );\n\n\t\tif ( focusEditable ) {\n\t\t\tthis.editor.editing.view.focus();\n\t\t}\n\t}\n\n\t/**\n\t * Returns `true` when the {@link #_form} is the visible view in the {@link #_balloon}.\n\t *\n\t * @private\n\t * @type {Boolean}\n\t */\n\tget _isVisible() {\n\t\treturn this._balloon.visibleView === this._form;\n\t}\n\n\t/**\n\t * Returns `true` when the {@link #_form} is in the {@link #_balloon}.\n\t *\n\t * @private\n\t * @type {Boolean}\n\t */\n\tget _isInBalloon() {\n\t\treturn this._balloon.hasView( this._form );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module image/imagetextalternative\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport ImageTextAlternativeEditing from './imagetextalternative/imagetextalternativeediting';\nimport ImageTextAlternativeUI from './imagetextalternative/imagetextalternativeui';\n\n/**\n * The image text alternative plugin.\n *\n * For a detailed overview, check the {@glink features/images/images-styles image styles} documentation.\n *\n * This is a \"glue\" plugin which loads the\n * {@link module:image/imagetextalternative/imagetextalternativeediting~ImageTextAlternativeEditing}\n * and {@link module:image/imagetextalternative/imagetextalternativeui~ImageTextAlternativeUI} plugins.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ImageTextAlternative extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ImageTextAlternativeEditing, ImageTextAlternativeUI ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ImageTextAlternative';\n\t}\n}\n"],"sourceRoot":""}