{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imageinsert/ui/imageinsertformrowview.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imageinsert/ui/imageinsertpanelview.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imageinsert/utils.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imageinsert/imageinsertui.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imageinsert.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/imageinline.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/image/utils.js","webpack:///./node_modules/@ckeditor/ckeditor5-image/src/image/ui/utils.js"],"names":["ImageUploadFormRowView","locale","_this","options","arguments","length","undefined","Object","classCallCheck","this","_super","call","bind","bindTemplate","set","class","children","createCollection","forEach","child","add","labelView","_role","_ariaLabelledBy","id","setTemplate","tag","attributes","to","role","aria-labelledby","View","ImageInsertPanelView","integrations","_this$_createActionBu","_createActionButtons","insertButtonView","cancelButtonView","dropdownView","_createDropdownView","focusTracker","FocusTracker","keystrokes","KeystrokeHandler","_focusables","ViewCollection","_focusCycler","FocusCycler","focusables","keystrokeHandler","actions","focusPrevious","focusNext","Collection","_loop","_Object$entries$_i","slicedToArray","_Object$entries","_i","integration","integrationView","fieldView","assertThisInitialized","value","on","imageURLInputValue","element","trim","name","_integrations","entries","tabindex","concat","toConsumableArray","ImageInsertFormRowView","_this2","esm_get","getPrototypeOf","prototype","submitHandler","view","childViews","v","listenTo","stopPropagation","data","evt","domEvt","priority","find","t","createDropdown","SplitButtonView","splitButtonView","buttonView","panelView","label","icon","icons","image","tooltip","extendTemplate","ButtonView","check","type","withText","isEnabled","cancel","delegate","focusFirst","prepareIntegrations","editor","panelItems","config","get","imageInsertUIPlugin","plugins","PREDEFINED_INTEGRATIONS","insertImageViaUrl","createLabeledInputView","item","ui","componentFactory","has","ckFinderButton","create","openCKFinder","reduce","object","key","labeledInputView","LabeledFieldView","createLabeledInputText","placeholder","ImageInsertUI","componentCreator","imageInsertView","command","commands","actionView","_setUpDropdown","insertImageViaUrlForm","getIntegration","imageUtils","onSubmit","selectedElement","model","document","selection","getSelectedElement","isImage","change","writer","setAttribute","removeAttribute","execute","source","closePanel","editing","focus","isOpen","once","getAttribute","Plugin","ImageInsert","ImageUpload","ImageInline","ImageInlineEditing","Widget","ImageTextAlternative","createImageViewElement","imageType","emptyElement","createEmptyElement","container","createContainerElement","isAllowedInsideAttributeElement","insert","createPositionAt","getImgViewElementMatcher","matchImageType","src","isInlineImageView","hasAttribute","findAncestor","isBlockImageView","determineImageTypeForInsertionAtSelection","schema","firstBlock","first","getSelectedBlocks","isObject","isEmpty","__webpack_require__","d","__webpack_exports__","repositionContextualBalloon","getBalloonPositionData","ckeditor5_src_ui__WEBPACK_IMPORTED_MODULE_0__","balloon","getClosestSelectedImageWidget","position","updatePosition","editingView","defaultPositions","BalloonPanelView","target","domConverter","viewToDom","positions","northArrowSouth","northArrowSouthWest","northArrowSouthEast","southArrowNorth","southArrowNorthWest","southArrowNorthEast"],"mappings":";;;;OAuBqBA,6CAWpB,SAAAA,EAAaC,GAAuB,IAAAC,EAAfC,EAAeC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,MAAAG,OAAAC,EAAA,KAAAD,CAAAE,KAAAT,GACnCE,EAAAQ,EAAAC,KAAAF,KAAOR,GAEP,IAAMW,EAAOV,EAAKW,aAHiB,OAWnCX,EAAKY,IAAK,QAASX,EAAQY,OAAS,MAQpCb,EAAKc,SAAWd,EAAKe,mBAEhBd,EAAQa,UACZb,EAAQa,SAASE,QAAS,SAAAC,GAAK,OAAIjB,EAAKc,SAASI,IAAKD,KAYvDjB,EAAKY,IAAK,QAAS,MAWnBZ,EAAKY,IAAK,kBAAmB,MAExBX,EAAQkB,WACZnB,EAAKY,KACJQ,MAAO,QACPC,gBAAiBpB,EAAQkB,UAAUG,KAIrCtB,EAAKuB,aACJC,IAAK,MACLC,YACCZ,OACC,KACA,eACAH,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db4.c1071dcd.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/imageinsert/ui/imageinsertformrowview\n */\n\nimport { View } from 'ckeditor5/src/ui';\n\nimport '../../../theme/imageinsertformrowview.css';\n\n/**\n * The class representing a single row in a complex form,\n * used by {@link module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView}.\n *\n * **Note**: For now this class is private. When more use cases appear (beyond `ckeditor5-table` and `ckeditor5-image`),\n * it will become a component in `ckeditor5-ui`.\n *\n * @private\n * @extends module:ui/view~View\n */\nexport default class ImageUploadFormRowView extends View {\n\t/**\n\t * Creates an instance of the form row class.\n\t *\n\t * @param {module:utils/locale~Locale} locale The locale instance.\n\t * @param {Object} options\n\t * @param {Array.} [options.children]\n\t * @param {String} [options.class]\n\t * @param {module:ui/view~View} [options.labelView] When passed, the row gets the `group` and `aria-labelledby`\n\t * DOM attributes and gets described by the label.\n\t */\n\tconstructor( locale, options = {} ) {\n\t\tsuper( locale );\n\n\t\tconst bind = this.bindTemplate;\n\n\t\t/**\n\t\t * An additional CSS class added to the {@link #element}.\n\t\t *\n\t\t * @observable\n\t\t * @member {String} #class\n\t\t */\n\t\tthis.set( 'class', options.class || null );\n\n\t\t/**\n\t\t * A collection of row items (buttons, dropdowns, etc.).\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:ui/viewcollection~ViewCollection}\n\t\t */\n\t\tthis.children = this.createCollection();\n\n\t\tif ( options.children ) {\n\t\t\toptions.children.forEach( child => this.children.add( child ) );\n\t\t}\n\n\t\t/**\n\t\t * The role property reflected by the `role` DOM attribute of the {@link #element}.\n\t\t *\n\t\t * **Note**: Used only when a `labelView` is passed to constructor `options`.\n\t\t *\n\t\t * @private\n\t\t * @observable\n\t\t * @member {String} #role\n\t\t */\n\t\tthis.set( '_role', null );\n\n\t\t/**\n\t\t * The ARIA property reflected by the `aria-labelledby` DOM attribute of the {@link #element}.\n\t\t *\n\t\t * **Note**: Used only when a `labelView` is passed to constructor `options`.\n\t\t *\n\t\t * @private\n\t\t * @observable\n\t\t * @member {String} #ariaLabelledBy\n\t\t */\n\t\tthis.set( '_ariaLabelledBy', null );\n\n\t\tif ( options.labelView ) {\n\t\t\tthis.set( {\n\t\t\t\t_role: 'group',\n\t\t\t\t_ariaLabelledBy: options.labelView.id\n\t\t\t} );\n\t\t}\n\n\t\tthis.setTemplate( {\n\t\t\ttag: 'div',\n\t\t\tattributes: {\n\t\t\t\tclass: [\n\t\t\t\t\t'ck',\n\t\t\t\t\t'ck-form__row',\n\t\t\t\t\tbind.to( 'class' )\n\t\t\t\t],\n\t\t\t\trole: bind.to( '_role' ),\n\t\t\t\t'aria-labelledby': bind.to( '_ariaLabelledBy' )\n\t\t\t},\n\t\t\tchildren: this.children\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/imageinsert/ui/imageinsertpanelview\n */\n\nimport { icons } from 'ckeditor5/src/core';\nimport { ButtonView, View, SplitButtonView, ViewCollection, submitHandler, createDropdown, FocusCycler } from 'ckeditor5/src/ui';\nimport { Collection, FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';\n\nimport ImageInsertFormRowView from './imageinsertformrowview';\n\nimport '../../../theme/imageinsert.css';\n\n/**\n * The insert an image via URL view controller class.\n *\n * See {@link module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView}.\n *\n * @extends module:ui/view~View\n */\nexport default class ImageInsertPanelView extends View {\n\t/**\n\t * Creates a view for the dropdown panel of {@link module:image/imageinsert/imageinsertui~ImageInsertUI}.\n\t *\n\t * @param {module:utils/locale~Locale} [locale] The localization services instance.\n\t * @param {Object} [integrations] An integrations object that contains\n\t * components (or tokens for components) to be shown in the panel view.\n\t */\n\tconstructor( locale, integrations ) {\n\t\tsuper( locale );\n\n\t\tconst { insertButtonView, cancelButtonView } = this._createActionButtons( locale );\n\n\t\t/**\n\t\t * The \"insert/update\" button view.\n\t\t *\n\t\t * @member {module:ui/button/buttonview~ButtonView}\n\t\t */\n\t\tthis.insertButtonView = insertButtonView;\n\n\t\t/**\n\t\t * The \"cancel\" button view.\n\t\t *\n\t\t * @member {module:ui/button/buttonview~ButtonView}\n\t\t */\n\t\tthis.cancelButtonView = cancelButtonView;\n\n\t\t/**\n\t\t * The dropdown view.\n\t\t *\n\t\t * @member {module:ui/dropdown/dropdownview~DropdownView}\n\t\t */\n\t\tthis.dropdownView = this._createDropdownView( locale );\n\n\t\t/**\n\t\t * The value of the URL input.\n\t\t *\n\t\t * @member {String} #imageURLInputValue\n\t\t * @observable\n\t\t */\n\t\tthis.set( 'imageURLInputValue', '' );\n\n\t\t/**\n\t\t * Tracks information about 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 * A collection of views that 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\t/**\n\t\t * A collection of the defined integrations for inserting the images.\n\t\t *\n\t\t * @private\n\t\t * @member {module:utils/collection~Collection}\n\t\t */\n\t\tthis.set( '_integrations', new Collection() );\n\n\t\tif ( integrations ) {\n\t\t\tfor ( const [ integration, integrationView ] of Object.entries( integrations ) ) {\n\t\t\t\tif ( integration === 'insertImageViaUrl' ) {\n\t\t\t\t\tintegrationView.fieldView.bind( 'value' ).to( this, 'imageURLInputValue', value => value || '' );\n\n\t\t\t\t\tintegrationView.fieldView.on( 'input', () => {\n\t\t\t\t\t\tthis.imageURLInputValue = integrationView.fieldView.element.value.trim();\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tintegrationView.name = integration;\n\n\t\t\t\tthis._integrations.add( integrationView );\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-image-insert-form'\n\t\t\t\t],\n\n\t\t\t\ttabindex: '-1'\n\t\t\t},\n\n\t\t\tchildren: [\n\t\t\t\t...this._integrations,\n\t\t\t\tnew ImageInsertFormRowView( locale, {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\tthis.insertButtonView,\n\t\t\t\t\t\tthis.cancelButtonView\n\t\t\t\t\t],\n\t\t\t\t\tclass: 'ck-image-insert-form__action-row'\n\t\t\t\t} )\n\t\t\t]\n\t\t} );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trender() {\n\t\tsuper.render();\n\n\t\tsubmitHandler( {\n\t\t\tview: this\n\t\t} );\n\n\t\tconst childViews = [\n\t\t\t...this._integrations,\n\t\t\tthis.insertButtonView,\n\t\t\tthis.cancelButtonView\n\t\t];\n\n\t\tchildViews.forEach( v => {\n\t\t\t// Register the view as focusable.\n\t\t\tthis._focusables.add( v );\n\n\t\t\t// Register the view in the focus tracker.\n\t\t\tthis.focusTracker.add( v.element );\n\t\t} );\n\n\t\t// Start listening for the keystrokes coming from #element.\n\t\tthis.keystrokes.listenTo( this.element );\n\n\t\tconst stopPropagation = data => data.stopPropagation();\n\n\t\t// Since the form is in the dropdown panel which is a child of the toolbar, the toolbar's\n\t\t// keystroke handler would take over the key management in the URL input. We need to prevent\n\t\t// this ASAP. Otherwise, the basic caret movement using the arrow keys will be impossible.\n\t\tthis.keystrokes.set( 'arrowright', stopPropagation );\n\t\tthis.keystrokes.set( 'arrowleft', stopPropagation );\n\t\tthis.keystrokes.set( 'arrowup', stopPropagation );\n\t\tthis.keystrokes.set( 'arrowdown', stopPropagation );\n\n\t\t// Intercept the \"selectstart\" event, which is blocked by default because of the default behavior\n\t\t// of the DropdownView#panelView.\n\t\t// TODO: blocking \"selectstart\" in the #panelView should be configurable per–drop–down instance.\n\t\tthis.listenTo( childViews[ 0 ].element, 'selectstart', ( evt, domEvt ) => {\n\t\t\tdomEvt.stopPropagation();\n\t\t}, { priority: 'high' } );\n\t}\n\n\t/**\n\t * Returns a view of the integration.\n\t *\n\t * @param {String} name The name of the integration.\n\t * @returns {module:ui/view~View}\n\t */\n\tgetIntegration( name ) {\n\t\treturn this._integrations.find( integration => integration.name === name );\n\t}\n\n\t/**\n\t * Creates the dropdown view.\n\t *\n\t * @param {module:utils/locale~Locale} locale The localization services instance.\n\t *\n\t * @private\n\t * @returns {module:ui/dropdown/dropdownview~DropdownView}\n\t */\n\t_createDropdownView( locale ) {\n\t\tconst t = locale.t;\n\t\tconst dropdownView = createDropdown( locale, SplitButtonView );\n\t\tconst splitButtonView = dropdownView.buttonView;\n\t\tconst panelView = dropdownView.panelView;\n\n\t\tsplitButtonView.set( {\n\t\t\tlabel: t( 'Insert image' ),\n\t\t\ticon: icons.image,\n\t\t\ttooltip: true\n\t\t} );\n\n\t\tpanelView.extendTemplate( {\n\t\t\tattributes: {\n\t\t\t\tclass: 'ck-image-insert__panel'\n\t\t\t}\n\t\t} );\n\n\t\treturn dropdownView;\n\t}\n\n\t/**\n\t * Creates the following form controls:\n\t *\n\t * * {@link #insertButtonView},\n\t * * {@link #cancelButtonView}.\n\t *\n\t * @param {module:utils/locale~Locale} locale The localization services instance.\n\t *\n\t * @private\n\t * @returns {Object.}\n\t */\n\t_createActionButtons( locale ) {\n\t\tconst t = locale.t;\n\t\tconst insertButtonView = new ButtonView( locale );\n\t\tconst cancelButtonView = new ButtonView( locale );\n\n\t\tinsertButtonView.set( {\n\t\t\tlabel: t( 'Insert' ),\n\t\t\ticon: icons.check,\n\t\t\tclass: 'ck-button-save',\n\t\t\ttype: 'submit',\n\t\t\twithText: true,\n\t\t\tisEnabled: this.imageURLInputValue\n\t\t} );\n\n\t\tcancelButtonView.set( {\n\t\t\tlabel: t( 'Cancel' ),\n\t\t\ticon: icons.cancel,\n\t\t\tclass: 'ck-button-cancel',\n\t\t\twithText: true\n\t\t} );\n\n\t\tinsertButtonView.bind( 'isEnabled' ).to( this, 'imageURLInputValue', value => !!value );\n\t\tinsertButtonView.delegate( 'execute' ).to( this, 'submit' );\n\t\tcancelButtonView.delegate( 'execute' ).to( this, 'cancel' );\n\n\t\treturn { insertButtonView, cancelButtonView };\n\t}\n\n\t/**\n\t * Focuses the first {@link #_focusables focusable} in the form.\n\t */\n\tfocus() {\n\t\tthis._focusCycler.focusFirst();\n\t}\n}\n\n/**\n * Fired when the form view is submitted (when one of the children triggered the submit event),\n * e.g. by a click on {@link #insertButtonView}.\n *\n * @event submit\n */\n\n/**\n * Fired when the form view is canceled, e.g. by a click on {@link #cancelButtonView}.\n *\n * @event cancel\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/imageinsert/utils\n */\n\nimport { LabeledFieldView, createLabeledInputText } from 'ckeditor5/src/ui';\n\n/**\n * Creates integrations object that will be passed to the\n * {@link module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView}.\n *\n * @param {module:core/editor/editor~Editor} editor Editor instance.\n *\n * @returns {Object.} Integrations object.\n */\nexport function prepareIntegrations( editor ) {\n\tconst panelItems = editor.config.get( 'image.insert.integrations' );\n\tconst imageInsertUIPlugin = editor.plugins.get( 'ImageInsertUI' );\n\n\tconst PREDEFINED_INTEGRATIONS = {\n\t\t'insertImageViaUrl': createLabeledInputView( editor.locale )\n\t};\n\n\tif ( !panelItems ) {\n\t\treturn PREDEFINED_INTEGRATIONS;\n\t}\n\n\t// Prepares ckfinder component for the `openCKFinder` integration token.\n\tif ( panelItems.find( item => item === 'openCKFinder' ) && editor.ui.componentFactory.has( 'ckfinder' ) ) {\n\t\tconst ckFinderButton = editor.ui.componentFactory.create( 'ckfinder' );\n\t\tckFinderButton.set( {\n\t\t\twithText: true,\n\t\t\tclass: 'ck-image-insert__ck-finder-button'\n\t\t} );\n\n\t\t// We want to close the dropdown panel view when user clicks the ckFinderButton.\n\t\tckFinderButton.delegate( 'execute' ).to( imageInsertUIPlugin, 'cancel' );\n\n\t\tPREDEFINED_INTEGRATIONS.openCKFinder = ckFinderButton;\n\t}\n\n\t// Creates integrations object of valid views to pass it to the ImageInsertPanelView.\n\treturn panelItems.reduce( ( object, key ) => {\n\t\tif ( PREDEFINED_INTEGRATIONS[ key ] ) {\n\t\t\tobject[ key ] = PREDEFINED_INTEGRATIONS[ key ];\n\t\t} else if ( editor.ui.componentFactory.has( key ) ) {\n\t\t\tobject[ key ] = editor.ui.componentFactory.create( key );\n\t\t}\n\n\t\treturn object;\n\t}, {} );\n}\n\n/**\n * Creates labeled field view.\n *\n * @param {module:utils/locale~Locale} locale The localization services instance.\n *\n * @returns {module:ui/labeledfield/labeledfieldview~LabeledFieldView}\n */\nexport function createLabeledInputView( locale ) {\n\tconst t = locale.t;\n\tconst labeledInputView = new LabeledFieldView( locale, createLabeledInputText );\n\n\tlabeledInputView.set( {\n\t\tlabel: t( 'Insert image via URL' )\n\t} );\n\tlabeledInputView.fieldView.placeholder = 'https://example.com/image.png';\n\n\treturn labeledInputView;\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/imageinsert/imageinsertui\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport ImageInsertPanelView from './ui/imageinsertpanelview';\nimport { prepareIntegrations } from './utils';\n\n/**\n * The image insert dropdown plugin.\n *\n * For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}\n * and {@glink features/images/image-upload/images-inserting#inserting-images-via-source-url Insert images via source URL} documentation.\n *\n * Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}\n * and also the `imageInsert` dropdown as an alias for backward compatibility.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ImageInsertUI extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ImageInsertUI';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst componentCreator = locale => {\n\t\t\treturn this._createDropdownView( locale );\n\t\t};\n\n\t\t// Register `insertImage` dropdown and add `imageInsert` dropdown as an alias for backward compatibility.\n\t\teditor.ui.componentFactory.add( 'insertImage', componentCreator );\n\t\teditor.ui.componentFactory.add( 'imageInsert', componentCreator );\n\t}\n\n\t/**\n\t * Creates the dropdown view.\n\t *\n\t * @param {module:utils/locale~Locale} locale The localization services instance.\n\t *\n\t * @private\n\t * @returns {module:ui/dropdown/dropdownview~DropdownView}\n\t */\n\t_createDropdownView( locale ) {\n\t\tconst editor = this.editor;\n\t\tconst imageInsertView = new ImageInsertPanelView( locale, prepareIntegrations( editor ) );\n\t\tconst command = editor.commands.get( 'uploadImage' );\n\n\t\tconst dropdownView = imageInsertView.dropdownView;\n\t\tconst splitButtonView = dropdownView.buttonView;\n\n\t\tsplitButtonView.actionView = editor.ui.componentFactory.create( 'uploadImage' );\n\t\t// After we replaced action button with `uploadImage` component,\n\t\t// we have lost a proper styling and some minor visual quirks have appeared.\n\t\t// Brining back original split button classes helps fix the button styling\n\t\t// See https://github.com/ckeditor/ckeditor5/issues/7986.\n\t\tsplitButtonView.actionView.extendTemplate( {\n\t\t\tattributes: {\n\t\t\t\tclass: 'ck ck-button ck-splitbutton__action'\n\t\t\t}\n\t\t} );\n\n\t\treturn this._setUpDropdown( dropdownView, imageInsertView, command );\n\t}\n\n\t/**\n\t * Sets up the dropdown view.\n\t *\n\t * @param {module:ui/dropdown/dropdownview~DropdownView} dropdownView A dropdownView.\n\t * @param {module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView} imageInsertView An imageInsertView.\n\t * @param {module:core/command~Command} command An insertImage command\n\t *\n\t * @private\n\t * @returns {module:ui/dropdown/dropdownview~DropdownView}\n\t */\n\t_setUpDropdown( dropdownView, imageInsertView, command ) {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\t\tconst insertButtonView = imageInsertView.insertButtonView;\n\t\tconst insertImageViaUrlForm = imageInsertView.getIntegration( 'insertImageViaUrl' );\n\t\tconst panelView = dropdownView.panelView;\n\t\tconst imageUtils = this.editor.plugins.get( 'ImageUtils' );\n\n\t\tdropdownView.bind( 'isEnabled' ).to( command );\n\n\t\t// Defer the children injection to improve initial performance.\n\t\t// See https://github.com/ckeditor/ckeditor5/pull/8019#discussion_r484069652.\n\t\tdropdownView.buttonView.once( 'open', () => {\n\t\t\tpanelView.children.add( imageInsertView );\n\t\t} );\n\n\t\tdropdownView.on( 'change:isOpen', () => {\n\t\t\tconst selectedElement = editor.model.document.selection.getSelectedElement();\n\n\t\t\tif ( dropdownView.isOpen ) {\n\t\t\t\timageInsertView.focus();\n\n\t\t\t\tif ( imageUtils.isImage( selectedElement ) ) {\n\t\t\t\t\timageInsertView.imageURLInputValue = selectedElement.getAttribute( 'src' );\n\t\t\t\t\tinsertButtonView.label = t( 'Update' );\n\t\t\t\t\tinsertImageViaUrlForm.label = t( 'Update image URL' );\n\t\t\t\t} else {\n\t\t\t\t\timageInsertView.imageURLInputValue = '';\n\t\t\t\t\tinsertButtonView.label = t( 'Insert' );\n\t\t\t\t\tinsertImageViaUrlForm.label = t( 'Insert image via URL' );\n\t\t\t\t}\n\t\t\t}\n\t\t// Note: Use the low priority to make sure the following listener starts working after the\n\t\t// default action of the drop-down is executed (i.e. the panel showed up). Otherwise, the\n\t\t// invisible form/input cannot be focused/selected.\n\t\t}, { priority: 'low' } );\n\n\t\timageInsertView.delegate( 'submit', 'cancel' ).to( dropdownView );\n\t\tthis.delegate( 'cancel' ).to( dropdownView );\n\n\t\tdropdownView.on( 'submit', () => {\n\t\t\tclosePanel();\n\t\t\tonSubmit();\n\t\t} );\n\n\t\tdropdownView.on( 'cancel', () => {\n\t\t\tclosePanel();\n\t\t} );\n\n\t\tfunction onSubmit() {\n\t\t\tconst selectedElement = editor.model.document.selection.getSelectedElement();\n\n\t\t\tif ( imageUtils.isImage( selectedElement ) ) {\n\t\t\t\teditor.model.change( writer => {\n\t\t\t\t\twriter.setAttribute( 'src', imageInsertView.imageURLInputValue, selectedElement );\n\t\t\t\t\twriter.removeAttribute( 'srcset', selectedElement );\n\t\t\t\t\twriter.removeAttribute( 'sizes', selectedElement );\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\teditor.execute( 'insertImage', { source: imageInsertView.imageURLInputValue } );\n\t\t\t}\n\t\t}\n\n\t\tfunction closePanel() {\n\t\t\teditor.editing.view.focus();\n\t\t\tdropdownView.isOpen = false;\n\t\t}\n\n\t\treturn dropdownView;\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/imageinsert\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport ImageUpload from './imageupload';\nimport ImageInsertUI from './imageinsert/imageinsertui';\n\n/**\n * The image insert plugin.\n *\n * For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}\n * and {@glink features/images/image-upload/images-inserting#inserting-images-via-source-url Insert images via source URL} documentation.\n *\n * This plugin does not do anything directly, but it loads a set of specific plugins\n * to enable image uploading or inserting via implemented integrations:\n *\n * * {@link module:image/imageupload~ImageUpload}\n * * {@link module:image/imageinsert/imageinsertui~ImageInsertUI},\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ImageInsert extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ImageInsert';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ImageUpload, ImageInsertUI ];\n\t}\n}\n\n/**\n * The image insert configuration.\n *\n * @member {module:image/imageinsert~ImageInsertConfig} module:image/image~ImageConfig#insert\n */\n\n/**\n * The configuration of the image insert dropdown panel view. Used by the image insert feature in the `@ckeditor/ckeditor5-image` package.\n *\n *\t\tClassicEditor\n *\t\t\t.create( editorElement, {\n * \t\t\t\timage: {\n * \t\t\t\t\tinsert: {\n *\t\t\t\t\t\t... // settings for \"insertImage\" view goes here\n * \t\t\t\t\t}\n * \t\t\t\t}\n *\t\t\t} )\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.\n *\n * @interface module:image/imageinsert~ImageInsertConfig\n */\n\n/**\n * The image insert panel view configuration contains a list of {@link module:image/imageinsert~ImageInsert} integrations.\n *\n * The option accepts string tokens.\n * * for predefined integrations, we have two special strings: `insertImageViaUrl` and `openCKFinder`.\n * The former adds the **Insert image via URL** feature, while the latter adds the built-in **CKFinder** integration.\n * * for custom integrations, each string should be a name of the component registered in the\n * {@link module:ui/componentfactory~ComponentFactory component factory}.\n * If you have a plugin `PluginX` that registers `pluginXButton` component, then the integration token\n * in that case should be `pluginXButton`.\n *\n *\t\t// Add `insertImageViaUrl`, `openCKFinder` and custom `pluginXButton` integrations.\n *\t\tconst imageInsertConfig = {\n *\t\t\tinsert: {\n *\t\t\t\tintegrations: [\n *\t\t\t\t\t'insertImageViaUrl',\n *\t\t\t\t\t'openCKFinder',\n *\t\t\t\t\t'pluginXButton'\n *\t\t\t\t]\n *\t\t\t}\n *\t\t};\n *\n * @protected\n * @member {Array.} module:image/imageinsert~ImageInsertConfig#integrations\n * @default [ 'insertImageViaUrl' ]\n */\n\n/**\n * This options allows to override the image type used by the {@link module:image/image/insertimagecommand~InsertImageCommand} when the user\n * inserts new images into the editor content. By default, this option is unset which means the editor will choose the optimal image type\n * based on the context of the insertion (e.g. the current selection and availability of plugins)\n *\n * Available options are:\n *\n * * `'block'` – all images inserted into the editor will be block (requires the {@link module:image/imageblock~ImageBlock} plugin),\n * * `'inline'` – all images inserted into the editor will be inline (requires the {@link module:image/imageinline~ImageInline} plugin).\n *\n * @member {'inline'|'block'|undefined} module:image/imageinsert~ImageInsertConfig#type\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/imageinline\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { Widget } from 'ckeditor5/src/widget';\n\nimport ImageTextAlternative from './imagetextalternative';\nimport ImageInlineEditing from './image/imageinlineediting';\n\nimport '../theme/image.css';\n\n/**\n * The image inline plugin.\n *\n * This is a \"glue\" plugin which loads the following plugins:\n *\n * * {@link module:image/image/imageinlineediting~ImageInlineEditing},\n * * {@link module:image/imagetextalternative~ImageTextAlternative}.\n *\n * Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}\n * for more information.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ImageInline extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ ImageInlineEditing, Widget, ImageTextAlternative ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ImageInline';\n\t}\n}\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/image/utils\n */\n\nimport { first } from 'ckeditor5/src/utils';\n\n/**\n * Creates a view element representing the image of provided image type.\n *\n * An 'imageBlock' type (block image):\n *\n *\t\t
\n *\n * An 'imageInline' type (inline image):\n *\n *\t\t\n *\n * Note that `alt` and `src` attributes are converted separately, so they are not included.\n *\n * @protected\n * @param {module:engine/view/downcastwriter~DowncastWriter} writer\n * @param {'imageBlock'|'imageInline'} imageType The type of created image.\n * @returns {module:engine/view/containerelement~ContainerElement}\n */\nexport function createImageViewElement( writer, imageType ) {\n\tconst emptyElement = writer.createEmptyElement( 'img' );\n\n\tconst container = imageType === 'imageBlock' ?\n\t\twriter.createContainerElement( 'figure', { class: 'image' } ) :\n\t\twriter.createContainerElement( 'span', { class: 'image-inline' }, { isAllowedInsideAttributeElement: true } );\n\n\twriter.insert( writer.createPositionAt( container, 0 ), emptyElement );\n\n\treturn container;\n}\n\n/**\n * A function returning a `MatcherPattern` for a particular type of View images.\n *\n * @protected\n * @param {module:core/editor/editor~Editor} editor\n * @param {'imageBlock'|'imageInline'} matchImageType The type of created image.\n * @returns {module:engine/view/matcher~MatcherPattern}\n */\nexport function getImgViewElementMatcher( editor, matchImageType ) {\n\tif ( editor.plugins.has( 'ImageInlineEditing' ) !== editor.plugins.has( 'ImageBlockEditing' ) ) {\n\t\treturn {\n\t\t\tname: 'img',\n\t\t\tattributes: {\n\t\t\t\tsrc: true\n\t\t\t}\n\t\t};\n\t}\n\n\tconst imageUtils = editor.plugins.get( 'ImageUtils' );\n\n\treturn element => {\n\t\t// Convert only images with src attribute.\n\t\tif ( !imageUtils.isInlineImageView( element ) || !element.hasAttribute( 'src' ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// The can be standalone, wrapped in
...
(ImageBlock plugin) or\n\t\t// wrapped in
...
(LinkImage plugin).\n\t\tconst imageType = element.findAncestor( imageUtils.isBlockImageView ) ? 'imageBlock' : 'imageInline';\n\n\t\tif ( imageType !== matchImageType ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { name: true, attributes: [ 'src' ] };\n\t};\n}\n\n/**\n * Considering the current model selection, it returns the name of the model image element\n * (`'imageBlock'` or `'imageInline'`) that will make most sense from the UX perspective if a new\n * image was inserted (also: uploaded, dropped, pasted) at that selection.\n *\n * The assumption is that inserting images into empty blocks or on other block widgets should\n * produce block images. Inline images should be inserted in other cases, e.g. in paragraphs\n * that already contain some text.\n *\n * @protected\n * @param {module:engine/model/schema~Schema} schema\n * @param {module:engine/model/selection~Selection|module:engine/model/documentselection~DocumentSelection} selection\n * @returns {'imageBlock'|'imageInline'}\n */\nexport function determineImageTypeForInsertionAtSelection( schema, selection ) {\n\tconst firstBlock = first( selection.getSelectedBlocks() );\n\n\t// Insert a block image if the selection is not in/on block elements or it's on a block widget.\n\tif ( !firstBlock || schema.isObject( firstBlock ) ) {\n\t\treturn 'imageBlock';\n\t}\n\n\t// A block image should also be inserted into an empty block element\n\t// (that is not an empty list item so the list won't get split).\n\tif ( firstBlock.isEmpty && firstBlock.name != 'listItem' ) {\n\t\treturn 'imageBlock';\n\t}\n\n\t// Otherwise insert an inline image.\n\treturn 'imageInline';\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/image/ui/utils\n */\n\nimport { BalloonPanelView } from 'ckeditor5/src/ui';\n\n/**\n * A helper utility that positions the\n * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon} instance\n * with respect to the image in the editor content, if one is selected.\n *\n * @param {module:core/editor/editor~Editor} editor The editor instance.\n */\nexport function repositionContextualBalloon( editor ) {\n\tconst balloon = editor.plugins.get( 'ContextualBalloon' );\n\n\tif ( editor.plugins.get( 'ImageUtils' ).getClosestSelectedImageWidget( editor.editing.view.document.selection ) ) {\n\t\tconst position = getBalloonPositionData( editor );\n\n\t\tballoon.updatePosition( position );\n\t}\n}\n\n/**\n * Returns the positioning options that control the geometry of the\n * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon} with respect\n * to the selected element in the editor content.\n *\n * @param {module:core/editor/editor~Editor} editor The editor instance.\n * @returns {module:utils/dom/position~Options}\n */\nexport function getBalloonPositionData( editor ) {\n\tconst editingView = editor.editing.view;\n\tconst defaultPositions = BalloonPanelView.defaultPositions;\n\tconst imageUtils = editor.plugins.get( 'ImageUtils' );\n\n\treturn {\n\t\ttarget: editingView.domConverter.viewToDom( imageUtils.getClosestSelectedImageWidget( editingView.document.selection ) ),\n\t\tpositions: [\n\t\t\tdefaultPositions.northArrowSouth,\n\t\t\tdefaultPositions.northArrowSouthWest,\n\t\t\tdefaultPositions.northArrowSouthEast,\n\t\t\tdefaultPositions.southArrowNorth,\n\t\t\tdefaultPositions.southArrowNorthWest,\n\t\t\tdefaultPositions.southArrowNorthEast\n\t\t]\n\t};\n}\n"],"sourceRoot":""}