Open coolwebs opened 7 years ago
I'm confused as to what behavior would make sense here. Text input fields do what you're describing out of the box through browser autocomplete functionality. For other field types, there isn't an autocomplete UI built in to the field itself, so we'd have to style something custom.
If you want to do this yourself for a specific shortcode (ie, when creating a new instance of a shortcode, pull certain values from the last edited instance of that shortcode, you could use the send_to_editor
js hook from #681 (once that's merged) to save values for the fields you want to autopopulate, and then set them on a new shortcode using the render_edit
js hook.
Sorry for not being clearer. I think the issue I am experiencing is directly related to https://github.com/wp-shortcake/shortcake/pull/738
@coolwebs
For a short term fix until the next release I just grabbed the code from the issue #738 with one minor tweak. The fix didn't address multi selects so instead of an empty split, i used a comma as the separator and I don't use commas in any select values. Not ideal but was simplest way for me until this gets worked out with a release and I can move on to other things.
<option value="{{ option.value }}" <# if ( ! _.isEmpty( _.filter( _.isArray( data.value ) ? data.value : data.value.split(","), function(val) { return val === option.value; } ) ) ) { print('selected'); } #>>{{ option.label }}</option>
Thanks @cowanr - that certainly resolves my issue for the meantime!
Is there a way for the Shortcake plugin to remember user parameters that have previously been entered? The plugin works perfectly in the first instance creating a shortcode on the page/post. However, when user wants to edit the shortcode, the modal window does not seem to remember the user specified settings/parameters.
Any 'text' field does this perfectly and that does not appear to be the issue. However, when I introduce select fields or checkboxes/radio buttons, the user data is not displayed when editing the shortcode using the Visual Editor. Is there a hook or function I can use to get the editor to remember this information?