@@ -21,12 +21,6 @@ import { convertText, convertToModelFragment } from '../conversion/view-to-model
2121import ViewDocumentFragment from '../view/documentfragment' ;
2222
2323import ModelRange from '../model/range' ;
24- import ModelElement from '../model/element' ;
25-
26- import insertContent from './insertcontent' ;
27- import deleteContent from './deletecontent' ;
28- import modifySelection from './modifyselection' ;
29- import getSelectedContent from './getselectedcontent' ;
3024
3125/**
3226 * Controller for the data pipeline. The data pipeline controls how data is retrieved from the document
@@ -116,9 +110,6 @@ export default class DataController {
116110 this . viewToModel . on ( 'text' , convertText ( ) , { priority : 'lowest' } ) ;
117111 this . viewToModel . on ( 'element' , convertToModelFragment ( ) , { priority : 'lowest' } ) ;
118112 this . viewToModel . on ( 'documentFragment' , convertToModelFragment ( ) , { priority : 'lowest' } ) ;
119-
120- [ 'insertContent' , 'deleteContent' , 'modifySelection' , 'getSelectedContent' ]
121- . forEach ( methodName => this . decorate ( methodName ) ) ;
122113 }
123114
124115 /**
@@ -240,126 +231,6 @@ export default class DataController {
240231 * Removes all event listeners set by the DataController.
241232 */
242233 destroy ( ) { }
243-
244- /**
245- * See {@link module:engine/controller/insertcontent.insertContent}.
246- *
247- * @fires insertContent
248- * @param {module:engine/model/documentfragment~DocumentFragment|module:engine/model/item~Item } content The content to insert.
249- * @param {module:engine/model/selection~Selection } selection Selection into which the content should be inserted.
250- */
251- insertContent ( content , selection ) {
252- insertContent ( this , content , selection ) ;
253- }
254-
255- /**
256- * See {@link module:engine/controller/deletecontent.deleteContent}.
257- *
258- * Note: For the sake of predictability, the resulting selection should always be collapsed.
259- * In cases where a feature wants to modify deleting behavior so selection isn't collapsed
260- * (e.g. a table feature may want to keep row selection after pressing <kbd>Backspace</kbd>),
261- * then that behavior should be implemented in the view's listener. At the same time, the table feature
262- * will need to modify this method's behavior too, e.g. to "delete contents and then collapse
263- * the selection inside the last selected cell" or "delete the row and collapse selection somewhere near".
264- * That needs to be done in order to ensure that other features which use `deleteContent()` will work well with tables.
265- *
266- * @fires deleteContent
267- * @param {module:engine/model/selection~Selection } selection Selection of which the content should be deleted.
268- * @param {Object } options See {@link module:engine/controller/deletecontent~deleteContent}'s options.
269- */
270- deleteContent ( selection , options ) {
271- deleteContent ( this , selection , options ) ;
272- }
273-
274- /**
275- * See {@link module:engine/controller/modifyselection.modifySelection}.
276- *
277- * @fires modifySelection
278- * @param {module:engine/model/selection~Selection } selection The selection to modify.
279- * @param {Object } options See {@link module:engine/controller/modifyselection~modifySelection}'s options.
280- */
281- modifySelection ( selection , options ) {
282- modifySelection ( this , selection , options ) ;
283- }
284-
285- /**
286- * See {@link module:engine/controller/getselectedcontent.getSelectedContent}.
287- *
288- * @fires module:engine/controller/datacontroller~DataController#getSelectedContent
289- * @param {module:engine/model/selection~Selection } selection The selection of which content will be retrieved.
290- * @returns {module:engine/model/documentfragment~DocumentFragment } Document fragment holding the clone of the selected content.
291- */
292- getSelectedContent ( selection ) {
293- return getSelectedContent ( this , selection ) ;
294- }
295-
296- /**
297- * Checks whether given {@link module:engine/model/range~Range range} or {@link module:engine/model/element~Element element}
298- * has any content.
299- *
300- * Content is any text node or element which is registered in {@link module:engine/model/schema~Schema schema}.
301- *
302- * @param {module:engine/model/range~Range|module:engine/model/element~Element } rangeOrElement Range or element to check.
303- * @returns {Boolean }
304- */
305- hasContent ( rangeOrElement ) {
306- if ( rangeOrElement instanceof ModelElement ) {
307- rangeOrElement = ModelRange . createIn ( rangeOrElement ) ;
308- }
309-
310- if ( rangeOrElement . isCollapsed ) {
311- return false ;
312- }
313-
314- for ( const item of rangeOrElement . getItems ( ) ) {
315- // Remember, `TreeWalker` returns always `textProxy` nodes.
316- if ( item . is ( 'textProxy' ) || this . model . schema . objects . has ( item . name ) ) {
317- return true ;
318- }
319- }
320-
321- return false ;
322- }
323234}
324235
325236mix ( DataController , ObservableMixin ) ;
326-
327- /**
328- * Event fired when {@link #insertContent} method is called.
329- *
330- * The {@link #insertContent default action of that method} is implemented as a
331- * listener to this event so it can be fully customized by the features.
332- *
333- * @event insertContent
334- * @param {Array } args The arguments passed to the original method.
335- */
336-
337- /**
338- * Event fired when {@link #deleteContent} method is called.
339- *
340- * The {@link #deleteContent default action of that method} is implemented as a
341- * listener to this event so it can be fully customized by the features.
342- *
343- * @event deleteContent
344- * @param {Array } args The arguments passed to the original method.
345- */
346-
347- /**
348- * Event fired when {@link #modifySelection} method is called.
349- *
350- * The {@link #modifySelection default action of that method} is implemented as a
351- * listener to this event so it can be fully customized by the features.
352- *
353- * @event modifySelection
354- * @param {Array } args The arguments passed to the original method.
355- */
356-
357- /**
358- * Event fired when {@link #getSelectedContent} method is called.
359- *
360- * The {@link #getSelectedContent default action of that method} is implemented as a
361- * listener to this event so it can be fully customized by the features.
362- *
363- * @event getSelectedContent
364- * @param {Array } args The arguments passed to the original method.
365- */
0 commit comments