{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-editor-inline/src/inlineeditorui.js","webpack:///./node_modules/@ckeditor/ckeditor5-editor-inline/src/inlineeditoruiview.js","webpack:///./node_modules/@ckeditor/ckeditor5-editor-inline/src/inlineeditor.js"],"names":["InlineEditorUI","editor","view","_toolbarConfig","normalizeToolbarConfig","config","get","this","editingView","editing","editable","editingRoot","document","getRoot","name","rootName","render","editableElement","element","setEditableElement","focusTracker","add","bind","to","attachDomRoot","_initPlaceholder","_initToolbar","fire","detachDomRoot","destroy","toolbar","panel","viewportTopOffset","listenTo","ui","isVisible","pin","target","positions","panelPositions","fillFromConfig","componentFactory","enableToolbarKeyboardFocus","origin","originFocusTracker","originKeystrokeHandler","keystrokes","sourceElement","placeholderText","tagName","toLowerCase","getAttribute","enablePlaceholder","text","isDirectHost","keepOnFocus","EditorUI","toPx","toUnit","InlineEditorUIView","locale","options","ToolbarView","shouldGroupWhenFull","shouldToolbarGroupWhenFull","isFloating","set","BalloonPanelView","withArrow","_getPanelPositions","extendTemplate","attributes","class","InlineEditableUIView","_resizeObserver","body","registerChild","content","ResizeObserver","maxWidth","Rect","width","editableRect","panelRect","top","height","bottom","_getPanelPositionTop","left","uiLanguageDirection","reverse","EditorUIView","InlineEditor","sourceElementOrData","model","createRoot","isElement","secureSourceElement","attachToForm","data","getData","then","setDataInElement","Promise","resolve","isHTMLElement","CKEditorError","initPlugins","init","initialData","getInitialData","Editor","getDataFromElement","mix","DataApiMixin","ElementApiMixin"],"mappings":"0RAkBqBA,E,YAOpB,WAAaC,EAAQC,GAAO,oCAC3B,kDAAOD,IAQP,EAAKC,KAAOA,EAQZ,EAAKC,eAAiBC,eAAwBH,EAAOI,OAAOC,IAAK,YAjBtC,E,0EA+B3B,IAAML,EAASM,KAAKN,OACdC,EAAOK,KAAKL,KACZM,EAAcP,EAAOQ,QAAQP,KAC7BQ,EAAWR,EAAKQ,SAChBC,EAAcH,EAAYI,SAASC,UAIzCH,EAASI,KAAO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,MAAM,kBAAMpG,EAAO0B,KAAM,YACzB0E,MAAM,kBAAMpG,a,GA5KwB8G,QAqL1C,SAASD,EAAgBjB,GACxB,OAAOG,eAAWH,GAAwBmB,eAAoBnB,GAAwBA,EAJvFoB,eAAKrB,EAAcsB,QACnBD,eAAKrB,EAAcuB","file":"js/chunk-vendors~707215c5.6152e982.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 editor-inline/inlineeditorui\n */\n\nimport { EditorUI } from 'ckeditor5/src/core';\nimport { enableToolbarKeyboardFocus, normalizeToolbarConfig } from 'ckeditor5/src/ui';\nimport { enablePlaceholder } from 'ckeditor5/src/engine';\n\n/**\n * The inline editor UI class.\n *\n * @extends module:core/editor/editorui~EditorUI\n */\nexport default class InlineEditorUI extends EditorUI {\n\t/**\n\t * Creates an instance of the inline editor UI class.\n\t *\n\t * @param {module:core/editor/editor~Editor} editor The editor instance.\n\t * @param {module:ui/editorui/editoruiview~EditorUIView} view The view of the UI.\n\t */\n\tconstructor( editor, view ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * The main (top–most) view of the editor UI.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:ui/editorui/editoruiview~EditorUIView} #view\n\t\t */\n\t\tthis.view = view;\n\n\t\t/**\n\t\t * A normalized `config.toolbar` object.\n\t\t *\n\t\t * @type {Object}\n\t\t * @private\n\t\t */\n\t\tthis._toolbarConfig = normalizeToolbarConfig( editor.config.get( 'toolbar' ) );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tget element() {\n\t\treturn this.view.editable.element;\n\t}\n\n\t/**\n\t * Initializes the UI.\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst view = this.view;\n\t\tconst editingView = editor.editing.view;\n\t\tconst editable = view.editable;\n\t\tconst editingRoot = editingView.document.getRoot();\n\n\t\t// The editable UI and editing root should share the same name. Then name is used\n\t\t// to recognize the particular editable, for instance in ARIA attributes.\n\t\teditable.name = editingRoot.rootName;\n\n\t\tview.render();\n\n\t\t// The editable UI element in DOM is available for sure only after the editor UI view has been rendered.\n\t\t// But it can be available earlier if a DOM element has been passed to InlineEditor.create().\n\t\tconst editableElement = editable.element;\n\n\t\t// Register the editable UI view in the editor. A single editor instance can aggregate multiple\n\t\t// editable areas (roots) but the inline editor has only one.\n\t\tthis.setEditableElement( editable.name, editableElement );\n\n\t\t// Let the global focus tracker know that the editable UI element is focusable and\n\t\t// belongs to the editor. From now on, the focus tracker will sustain the editor focus\n\t\t// as long as the editable is focused (e.g. the user is typing).\n\t\tthis.focusTracker.add( editableElement );\n\n\t\t// Let the editable UI element respond to the changes in the global editor focus\n\t\t// tracker. It has been added to the same tracker a few lines above but, in reality, there are\n\t\t// many focusable areas in the editor, like balloons, toolbars or dropdowns and as long\n\t\t// as they have focus, the editable should act like it is focused too (although technically\n\t\t// it isn't), e.g. by setting the proper CSS class, visually announcing focus to the user.\n\t\t// Doing otherwise will result in editable focus styles disappearing, once e.g. the\n\t\t// toolbar gets focused.\n\t\teditable.bind( 'isFocused' ).to( this.focusTracker );\n\n\t\t// Bind the editable UI element to the editing view, making it an end– and entry–point\n\t\t// of the editor's engine. This is where the engine meets the UI.\n\t\teditingView.attachDomRoot( editableElement );\n\n\t\tthis._initPlaceholder();\n\t\tthis._initToolbar();\n\t\tthis.fire( 'ready' );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tdestroy() {\n\t\tconst view = this.view;\n\t\tconst editingView = this.editor.editing.view;\n\n\t\teditingView.detachDomRoot( view.editable.name );\n\t\tview.destroy();\n\n\t\tsuper.destroy();\n\t}\n\n\t/**\n\t * Initializes the inline editor toolbar and its panel.\n\t *\n\t * @private\n\t */\n\t_initToolbar() {\n\t\tconst editor = this.editor;\n\t\tconst view = this.view;\n\t\tconst editableElement = view.editable.element;\n\t\tconst editingView = editor.editing.view;\n\t\tconst toolbar = view.toolbar;\n\n\t\t// Set–up the view#panel.\n\t\tview.panel.bind( 'isVisible' ).to( this.focusTracker, 'isFocused' );\n\n\t\tif ( this._toolbarConfig.viewportTopOffset ) {\n\t\t\tview.viewportTopOffset = this._toolbarConfig.viewportTopOffset;\n\t\t}\n\n\t\t// https://github.com/ckeditor/ckeditor5-editor-inline/issues/4\n\t\tview.listenTo( editor.ui, 'update', () => {\n\t\t\t// Don't pin if the panel is not already visible. It prevents the panel\n\t\t\t// showing up when there's no focus in the UI.\n\t\t\tif ( view.panel.isVisible ) {\n\t\t\t\tview.panel.pin( {\n\t\t\t\t\ttarget: editableElement,\n\t\t\t\t\tpositions: view.panelPositions\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\ttoolbar.fillFromConfig( this._toolbarConfig, this.componentFactory );\n\n\t\tenableToolbarKeyboardFocus( {\n\t\t\torigin: editingView,\n\t\t\toriginFocusTracker: this.focusTracker,\n\t\t\toriginKeystrokeHandler: editor.keystrokes,\n\t\t\ttoolbar\n\t\t} );\n\t}\n\n\t/**\n\t * Enable the placeholder text on the editing root, if any was configured.\n\t *\n\t * @private\n\t */\n\t_initPlaceholder() {\n\t\tconst editor = this.editor;\n\t\tconst editingView = editor.editing.view;\n\t\tconst editingRoot = editingView.document.getRoot();\n\t\tconst sourceElement = editor.sourceElement;\n\n\t\tconst placeholderText = editor.config.get( 'placeholder' ) ||\n\t\t\tsourceElement && sourceElement.tagName.toLowerCase() === 'textarea' && sourceElement.getAttribute( 'placeholder' );\n\n\t\tif ( placeholderText ) {\n\t\t\tenablePlaceholder( {\n\t\t\t\tview: editingView,\n\t\t\t\telement: editingRoot,\n\t\t\t\ttext: placeholderText,\n\t\t\t\tisDirectHost: false,\n\t\t\t\tkeepOnFocus: true\n\t\t\t} );\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 editor-inline/inlineeditoruiview\n */\nimport { BalloonPanelView, EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui';\nimport { Rect, ResizeObserver, toUnit } from 'ckeditor5/src/utils';\n\nconst toPx = toUnit( 'px' );\n\n/**\n * Inline editor UI view. Uses an nline editable and a floating toolbar.\n *\n * @extends module:ui/editorui/editoruiview~EditorUIView\n */\nexport default class InlineEditorUIView extends EditorUIView {\n\t/**\n\t * Creates an instance of the inline editor UI view.\n\t *\n\t * @param {module:utils/locale~Locale} locale The {@link module:core/editor/editor~Editor#locale} instance.\n\t * @param {module:engine/view/view~View} editingView The editing view instance this view is related to.\n\t * @param {HTMLElement} [editableElement] The editable element. If not specified, it will be automatically created by\n\t * {@link module:ui/editableui/editableuiview~EditableUIView}. Otherwise, the given element will be used.\n\t * @param {Object} [options={}] Configuration options for the view instance.\n\t * @param {Boolean} [options.shouldToolbarGroupWhenFull] When set `true` enables automatic items grouping\n\t * in the main {@link module:editor-inline/inlineeditoruiview~InlineEditorUIView#toolbar toolbar}.\n\t * See {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} to learn more.\n\t */\n\tconstructor( locale, editingView, editableElement, options = {} ) {\n\t\tsuper( locale );\n\n\t\t/**\n\t\t * A floating toolbar view instance.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:ui/toolbar/toolbarview~ToolbarView}\n\t\t */\n\t\tthis.toolbar = new ToolbarView( locale, {\n\t\t\tshouldGroupWhenFull: options.shouldToolbarGroupWhenFull,\n\t\t\tisFloating: true\n\t\t} );\n\n\t\t/**\n\t\t * The offset from the top edge of the web browser's viewport which makes the\n\t\t * UI become sticky. The default value is `0`, which means that the UI becomes\n\t\t * sticky when its upper edge touches the top of the page viewport.\n\t\t *\n\t\t * This attribute is useful when the web page has UI elements positioned to the top\n\t\t * either using `position: fixed` or `position: sticky`, which would cover the\n\t\t * UI or vice–versa (depending on the `z-index` hierarchy).\n\t\t *\n\t\t * @readonly\n\t\t * @observable\n\t\t * @member {Number} #viewportTopOffset\n\t\t */\n\t\tthis.set( 'viewportTopOffset', 0 );\n\n\t\t/**\n\t\t * A balloon panel view instance.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:ui/panel/balloon/balloonpanelview~BalloonPanelView}\n\t\t */\n\t\tthis.panel = new BalloonPanelView( locale );\n\n\t\tthis.panel.withArrow = false;\n\n\t\t/**\n\t\t * A set of positioning functions used by the {@link #panel} to float around\n\t\t * {@link #element editableElement}.\n\t\t *\n\t\t * The positioning functions are as follows:\n\t\t *\n\t\t * * West:\n\t\t *\n\t\t *\t\t[ Panel ]\n\t\t *\t\t+------------------+\n\t\t *\t\t| #editableElement |\n\t\t *\t\t+------------------+\n\t\t *\n\t\t *\t\t+------------------+\n\t\t *\t\t| #editableElement |\n\t\t *\t\t|[ Panel ] |\n\t\t *\t\t| |\n\t\t *\t\t+------------------+\n\t\t *\n\t\t *\t\t+------------------+\n\t\t *\t\t| #editableElement |\n\t\t *\t\t+------------------+\n\t\t *\t\t[ Panel ]\n\t\t *\n\t\t * * East:\n\t\t *\n\t\t *\t\t [ Panel ]\n\t\t *\t\t+------------------+\n\t\t *\t\t| #editableElement |\n\t\t *\t\t+------------------+\n\t\t *\n\t\t *\t\t+------------------+\n\t\t *\t\t| #editableElement |\n\t\t *\t\t| [ Panel ]|\n\t\t *\t\t| |\n\t\t *\t\t+------------------+\n\t\t *\n\t\t *\t\t+------------------+\n\t\t *\t\t| #editableElement |\n\t\t *\t\t+------------------+\n\t\t *\t\t [ Panel ]\n\t\t *\n\t\t * See: {@link module:utils/dom/position~Options#positions}.\n\t\t *\n\t\t * @readonly\n\t\t * @type {Array.}\n\t\t */\n\t\tthis.panelPositions = this._getPanelPositions();\n\n\t\tthis.panel.extendTemplate( {\n\t\t\tattributes: {\n\t\t\t\tclass: 'ck-toolbar-container'\n\t\t\t}\n\t\t} );\n\n\t\t/**\n\t\t * Editable UI view.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:ui/editableui/inline/inlineeditableuiview~InlineEditableUIView}\n\t\t */\n\t\tthis.editable = new InlineEditableUIView( locale, editingView, editableElement );\n\n\t\t/**\n\t\t * An instance of the resize observer that helps dynamically determine the geometry of the toolbar\n\t\t * and manage items that do not fit into a single row.\n\t\t *\n\t\t * **Note:** Created in {@link #render}.\n\t\t *\n\t\t * @private\n\t\t * @member {module:utils/dom/resizeobserver~ResizeObserver}\n\t\t */\n\t\tthis._resizeObserver = null;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trender() {\n\t\tsuper.render();\n\n\t\tthis.body.add( this.panel );\n\t\tthis.registerChild( this.editable );\n\t\tthis.panel.content.add( this.toolbar );\n\n\t\tconst options = this.toolbar.options;\n\n\t\t// Set toolbar's max-width on the initialization and update it on the editable resize,\n\t\t// if 'shouldToolbarGroupWhenFull' in config is set to 'true'.\n\t\tif ( options.shouldGroupWhenFull ) {\n\t\t\tconst editableElement = this.editable.element;\n\n\t\t\tthis._resizeObserver = new ResizeObserver( editableElement, () => {\n\t\t\t\tthis.toolbar.maxWidth = toPx( new Rect( editableElement ).width );\n\t\t\t} );\n\t\t}\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tdestroy() {\n\t\tsuper.destroy();\n\n\t\tif ( this._resizeObserver ) {\n\t\t\tthis._resizeObserver.destroy();\n\t\t}\n\t}\n\n\t/**\n\t * Determines the panel top position of the {@link #panel} in {@link #panelPositions}.\n\t *\n\t * @private\n\t * @param {module:utils/dom/rect~Rect} editableRect Rect of the {@link #element}.\n\t * @param {module:utils/dom/rect~Rect} panelRect Rect of the {@link #panel}.\n\t */\n\t_getPanelPositionTop( editableRect, panelRect ) {\n\t\tlet top;\n\n\t\tif ( editableRect.top > panelRect.height + this.viewportTopOffset ) {\n\t\t\ttop = editableRect.top - panelRect.height;\n\t\t} else if ( editableRect.bottom > panelRect.height + this.viewportTopOffset + 50 ) {\n\t\t\ttop = this.viewportTopOffset;\n\t\t} else {\n\t\t\ttop = editableRect.bottom;\n\t\t}\n\n\t\treturn top;\n\t}\n\n\t/**\n\t * Returns the positions for {@link #panelPositions}.\n\t *\n\t * See: {@link module:utils/dom/position~Options#positions}.\n\t *\n\t * @private\n\t * @returns {Array.}\n\t */\n\t_getPanelPositions() {\n\t\tconst positions = [\n\t\t\t( editableRect, panelRect ) => {\n\t\t\t\treturn {\n\t\t\t\t\ttop: this._getPanelPositionTop( editableRect, panelRect ),\n\t\t\t\t\tleft: editableRect.left,\n\t\t\t\t\tname: 'toolbar_west'\n\t\t\t\t};\n\t\t\t},\n\t\t\t( editableRect, panelRect ) => {\n\t\t\t\treturn {\n\t\t\t\t\ttop: this._getPanelPositionTop( editableRect, panelRect ),\n\t\t\t\t\tleft: editableRect.left + editableRect.width - panelRect.width,\n\t\t\t\t\tname: 'toolbar_east'\n\t\t\t\t};\n\t\t\t}\n\t\t];\n\n\t\tif ( this.locale.uiLanguageDirection === 'ltr' ) {\n\t\t\treturn positions;\n\t\t} else {\n\t\t\treturn positions.reverse();\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 editor-inline/inlineeditor\n */\n\nimport { Editor, DataApiMixin, ElementApiMixin, attachToForm, secureSourceElement } from 'ckeditor5/src/core';\nimport { mix, getDataFromElement, setDataInElement, CKEditorError } from 'ckeditor5/src/utils';\n\nimport { isElement } from 'lodash-es';\n\nimport InlineEditorUI from './inlineeditorui';\nimport InlineEditorUIView from './inlineeditoruiview';\n\n/**\n * The {@glink builds/guides/overview#inline-editor inline editor} implementation.\n * It uses an inline editable and a floating toolbar.\n * See the {@glink examples/builds/inline-editor demo}.\n *\n * In order to create a inline editor instance, use the static\n * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method.\n *\n * # Inline editor and inline build\n *\n * The inline editor can be used directly from source (if you installed the\n * [`@ckeditor/ckeditor5-editor-inline`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-inline) package)\n * but it is also available in the {@glink builds/guides/overview#inline-editor inline build}.\n *\n * {@glink builds/guides/overview Builds} are ready-to-use editors with plugins bundled in. When using the editor from\n * source you need to take care of loading all plugins by yourself\n * (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).\n * Using the editor from source gives much better flexibility and allows easier customization.\n *\n * Read more about initializing the editor from source or as a build in\n * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}.\n *\n * @mixes module:core/editor/utils/dataapimixin~DataApiMixin\n * @mixes module:core/editor/utils/elementapimixin~ElementApiMixin\n * @implements module:core/editor/editorwithui~EditorWithUI\n * @extends module:core/editor/editor~Editor\n */\nexport default class InlineEditor extends Editor {\n\t/**\n\t * Creates an instance of the inline editor.\n\t *\n\t * **Note:** Do not use the constructor to create editor instances. Use the static\n\t * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method instead.\n\t *\n\t * @protected\n\t * @param {HTMLElement|String} sourceElementOrData The DOM element that will be the source for the created editor\n\t * (on which the editor will be initialized) or initial data for the editor. For more information see\n\t * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}.\n\t * @param {module:core/editor/editorconfig~EditorConfig} config The editor configuration.\n\t */\n\tconstructor( sourceElementOrData, config ) {\n\t\tsuper( config );\n\n\t\tthis.model.document.createRoot();\n\n\t\tif ( isElement( sourceElementOrData ) ) {\n\t\t\tthis.sourceElement = sourceElementOrData;\n\t\t\tsecureSourceElement( this );\n\t\t}\n\n\t\tconst shouldToolbarGroupWhenFull = !this.config.get( 'toolbar.shouldNotGroupWhenFull' );\n\n\t\tconst view = new InlineEditorUIView( this.locale, this.editing.view, this.sourceElement, {\n\t\t\tshouldToolbarGroupWhenFull\n\t\t} );\n\t\tthis.ui = new InlineEditorUI( this, view );\n\n\t\tattachToForm( this );\n\t}\n\n\t/**\n\t * Destroys the editor instance, releasing all resources used by it.\n\t *\n\t * Updates the original editor element with the data.\n\t *\n\t * @returns {Promise}\n\t */\n\tdestroy() {\n\t\t// Cache the data, then destroy.\n\t\t// It's safe to assume that the model->view conversion will not work after super.destroy().\n\t\tconst data = this.getData();\n\n\t\tthis.ui.destroy();\n\n\t\treturn super.destroy()\n\t\t\t.then( () => {\n\t\t\t\tif ( this.sourceElement ) {\n\t\t\t\t\tsetDataInElement( this.sourceElement, data );\n\t\t\t\t}\n\t\t\t} );\n\t}\n\n\t/**\n\t * Creates a new inline editor instance.\n\t *\n\t * There are three general ways how the editor can be initialized.\n\t *\n\t * # Using an existing DOM element (and loading data from it)\n\t *\n\t * You can initialize the editor using an existing DOM element:\n\t *\n\t *\t\tInlineEditor\n\t *\t\t\t.create( document.querySelector( '#editor' ) )\n\t *\t\t\t.then( editor => {\n\t *\t\t\t\tconsole.log( 'Editor was initialized', editor );\n\t *\t\t\t} )\n\t *\t\t\t.catch( err => {\n\t *\t\t\t\tconsole.error( err.stack );\n\t *\t\t\t} );\n\t *\n\t * The element's content will be used as the editor data and the element will become the editable element.\n\t *\n\t * # Creating a detached editor\n\t *\n\t * Alternatively, you can initialize the editor by passing the initial data directly as a `String`.\n\t * In this case, the editor will render an element that must be inserted into the DOM for the editor to work properly:\n\t *\n\t *\t\tInlineEditor\n\t *\t\t\t.create( '

Hello world!

' )\n\t *\t\t\t.then( editor => {\n\t *\t\t\t\tconsole.log( 'Editor was initialized', editor );\n\t *\n\t *\t\t\t\t// Initial data was provided so the editor UI element needs to be added manually to the DOM.\n\t *\t\t\t\tdocument.body.appendChild( editor.ui.element );\n\t *\t\t\t} )\n\t *\t\t\t.catch( err => {\n\t *\t\t\t\tconsole.error( err.stack );\n\t *\t\t\t} );\n\t *\n\t * This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your\n\t * web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.\n\t *\n\t * # Using an existing DOM element (and data provided in `config.initialData`)\n\t *\n\t * You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:\n\t *\n\t *\t\tInlineEditor\n\t *\t\t\t.create( document.querySelector( '#editor' ), {\n\t *\t\t\t\tinitialData: '

Initial data

Foo bar.

'\n\t *\t\t\t} )\n\t *\t\t\t.then( editor => {\n\t *\t\t\t\tconsole.log( 'Editor was initialized', editor );\n\t *\t\t\t} )\n\t *\t\t\t.catch( err => {\n\t *\t\t\t\tconsole.error( err.stack );\n\t *\t\t\t} );\n\t *\n\t * This method can be used to initialize the editor on an existing element with the specified content in case if your integration\n\t * makes it difficult to set the content of the source element.\n\t *\n\t * Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.\n\t *\n\t * # Configuring the editor\n\t *\n\t * See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about\n\t * customizing plugins, toolbar and more.\n\t *\n\t * # Using the editor from source\n\t *\n\t * The code samples listed in the previous sections of this documentation assume that you are using an\n\t * {@glink builds/guides/overview editor build} (for example – `@ckeditor/ckeditor5-build-inline`).\n\t *\n\t * If you want to use the inline editor from source (`@ckeditor/ckeditor5-editor-inline/src/inlineeditor`),\n\t * you need to define the list of\n\t * {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and\n\t * {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from\n\t * source in the {@glink builds/guides/integration/advanced-setup \"Advanced setup\" guide}.\n\t *\n\t * @param {HTMLElement|String} sourceElementOrData The DOM element that will be the source for the created editor\n\t * or the editor's initial data.\n\t *\n\t * If a DOM element is passed, its content will be automatically loaded to the editor upon initialization.\n\t * Moreover, the editor data will be set back to the original element once the editor is destroyed.\n\t *\n\t * If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.\n\t * It is available under the {@link module:editor-inline/inlineeditorui~InlineEditorUI#element `editor.ui.element`} property.\n\t *\n\t * @param {module:core/editor/editorconfig~EditorConfig} [config] The editor configuration.\n\t * @returns {Promise} A promise resolved once the editor is ready. The promise resolves with the created editor instance.\n\t */\n\tstatic create( sourceElementOrData, config = {} ) {\n\t\treturn new Promise( resolve => {\n\t\t\tconst isHTMLElement = isElement( sourceElementOrData );\n\n\t\t\tif ( isHTMLElement && sourceElementOrData.tagName === 'TEXTAREA' ) {\n\t\t\t\t// Documented in core/editor/editor.js\n\t\t\t\t// eslint-disable-next-line ckeditor5-rules/ckeditor-error-message\n\t\t\t\tthrow new CKEditorError( 'editor-wrong-element', null );\n\t\t\t}\n\n\t\t\tconst editor = new this( sourceElementOrData, config );\n\n\t\t\tresolve(\n\t\t\t\teditor.initPlugins()\n\t\t\t\t\t.then( () => {\n\t\t\t\t\t\teditor.ui.init();\n\t\t\t\t\t} )\n\t\t\t\t\t.then( () => {\n\t\t\t\t\t\tif ( !isHTMLElement && config.initialData ) {\n\t\t\t\t\t\t\t// Documented in core/editor/editorconfig.jdoc.\n\t\t\t\t\t\t\t// eslint-disable-next-line ckeditor5-rules/ckeditor-error-message\n\t\t\t\t\t\t\tthrow new CKEditorError( 'editor-create-initial-data', null );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst initialData = config.initialData || getInitialData( sourceElementOrData );\n\n\t\t\t\t\t\treturn editor.data.init( initialData );\n\t\t\t\t\t} )\n\t\t\t\t\t.then( () => editor.fire( 'ready' ) )\n\t\t\t\t\t.then( () => editor )\n\t\t\t);\n\t\t} );\n\t}\n}\n\nmix( InlineEditor, DataApiMixin );\nmix( InlineEditor, ElementApiMixin );\n\nfunction getInitialData( sourceElementOrData ) {\n\treturn isElement( sourceElementOrData ) ? getDataFromElement( sourceElementOrData ) : sourceElementOrData;\n}\n"],"sourceRoot":""}