Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DataController.insertContent() #3861

Closed
Reinmar opened this issue Oct 21, 2016 · 3 comments · Fixed by ckeditor/ckeditor5-engine#656
Closed

Implement DataController.insertContent() #3861

Reinmar opened this issue Oct 21, 2016 · 3 comments · Fixed by ckeditor/ckeditor5-engine#656
Assignees
Labels
package:engine status:discussion type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented Oct 21, 2016

Needed for ckeditor/ckeditor5-clipboard#1.

It seems that it must accept view document fragment, because it will need to convert it to the model using the context of insertion. And this becomes part of the "insert content" logic, so should most likely be done inside this method.

BTW, it made me think that this method would make sense on the DataController. And I kinda like this idea. We've been thinking where to move the composer and I can see that modifySelection() makes for the EditingController and deleteContent() together with insertContent() could perhaps end in the the DataController. Note also that we'll need something like getSelectedContent() for the copy and cut operations (so deleteContent() would become deleteSelectedContent()).

OTOH, I know what you're going to say – those methods look weird on the DataController. I agree... I'd have to get used to them. But consider this – let's say we'd like to move insertContent() to the Document. But insertContent() requires (as explained above) a knowledge about DataController. So how could it be implemented on the Document?

tl;dr:

  • DataController#insertContent() – paste and I'm sure it'll be used in many ways in many cases by developers,
  • DataController#deleteSelectedContent() – delete feature,
  • DataController#getSelectedContent() – copy, cut and this has been also requested many times in the past for various integration scenariosm
  • EditingController#modifySelection()

Does it make any sense or no sense at all?

@Reinmar Reinmar self-assigned this Oct 21, 2016
@Reinmar
Copy link
Member Author

Reinmar commented Oct 21, 2016

There's +1 from @pjasiun and @fredck for having these method on the DataController. Note, however, that they will have to accept the selection on which they operate, just like now, when they are in the composer. This is fine and gives the developer the ability to specify on what piece of content the operations should be made.

@Reinmar
Copy link
Member Author

Reinmar commented Oct 21, 2016

PS. modifySelection() makes most sense in the model.Document or on the Selection as a static method.

@Reinmar Reinmar changed the title Implement Composer.insertContent() Implement DataController.insertContent() Oct 24, 2016
@Reinmar
Copy link
Member Author

Reinmar commented Oct 25, 2016

@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 4 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed status:discussion type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:engine labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine status:discussion type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants