Repository navigation
Editing entities from select2. - #12
Conversation
| return $.trim( component.select2_result_template( data ) ); | ||
| }, | ||
| templateSelection: function( data ) { | ||
| data.disable_edit = ! data.id; |
There was a problem hiding this comment.
The id is not defined when the template is for the âsearchingâ message or for the âno results foundâ message?
There was a problem hiding this comment.
Yes, and for placeholders as well.
|
@westonruter Found that |
|
@miina This is working exactly how I had envisioned it, but I found an obscure bug. If you drag & drop the order of the posts, then edit one and return focus back to the control the Customizer panel will not scroll up or down. I cannot reproduce the issue without reordering the posts first. |
|
Instead of making the result text itself a link, what if there was a link added after the text that had the edit dashicon as its content (along with |
|
I think the scrolling issue is fixed. |
|
FYI: This same functionality is also proposed for the |
| var component = this; | ||
|
|
||
| // Set up the add new post buttons | ||
| component.container.on( 'click', '.select2-selection__choice__edit', function() { |
There was a problem hiding this comment.
The body of this function can now be replaced with a call to api.Posts.startEditPostFlow(). See https://github.com/xwp/wp-customize-posts/blob/33840418da9dcd7c55d15061de5fe49f85d9058f/js/customize-posts.js#L589-L598
There was a problem hiding this comment.
Thanks for pointing that out, will take a look.
| return $.trim( component.select2_result_template( data ) ); | ||
| }, | ||
| templateSelection: function( data ) { | ||
| data.multiple = component.select2_options.multiple; |
There was a problem hiding this comment.
Is there a better way how to get it from template that it's multiple select field?
There was a problem hiding this comment.
It doesn't look like. I checked this and if there are any other arguments, and I see none. So yeah, looks good.

Fixes #8