| 1234567891011121314151617181920212223242526272829 |
- /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
- /**
- * @module ui/selectionrootobtainer
- */
- /**
- * Returns a function, which obtains the farthest DOM
- * {@link module:engine/view/rooteditableelement~RootEditableElement}
- * of the {@link module:engine/view/document~Document#selection}.
- *
- * @param {module:core/editor/editor~Editor} editor Editor instance.
- * @returns {Function}
- */
- export default function selectionRootObtainer( editor ) {
- return () => {
- const view = editor.editing.view;
- const editableElement = view.selection.editableElement;
- if ( editableElement ) {
- return view.domConverter.mapViewToDom( editableElement.root );
- }
- return null;
- };
- }
|