-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Move ViewCollection.bind() to utils.Collection #4935
Comments
It's probably more a matter of
where for UI, it would be
Current implementation is straightforward. I think it's an easy thing to do. |
I'm not sure what's the purpose of
which as good as
Is there anything more than that? |
For me that's fine. |
By the way: it would be nice to have the two-way binding of collections. Will it work out of the box, or we need a separate ticket for it? |
@pjasiun I'm not sure what outcome would you expect when the binding is used as a factory. But anyway, we considered it in the UI https://github.com/ckeditor/ckeditor5-ui/issues/110. |
Feature: `Collectio.bindTo` method now is not only available in the `ViewCollection` but in all `Collection`s. Closes #125.
Since it's a very useful feature to bind two collections, especially if you can do custom mapping, it should be moved to the
utils.Collection
to let users bind any collections, not onlyViewCollection
.Note that you can bind any observable variable, but not any observable collection, what is inconsistent.
The problem is that the binding checks if the parameter is the instance of
View
to check if it should be used or if the parameter is a creator function (https://github.com/ckeditor/ckeditor5-ui/blob/6b7fd4adfe6ee99fbdf84bfc4940f10ed78493b8/src/viewcollection.js#L227-L246). To solve it we could split theas
function to separate function, what would make the code simpler and less magic:Note that in the future we might introduce another popular mapping helper, like for the last line from the example above:
The text was updated successfully, but these errors were encountered: