jtsternberg / Shortcode_Button

Tinymce and Quicktag buttons for outputting shortcodes. Built to work with CMB2.
81 stars 7 forks source link

Wrap Selections in both Quicktags Editor and TinyMCE w/ Shortcodes #4

Closed JayWood closed 9 years ago

JayWood commented 9 years ago

Speaks for itself, this will wrap the user's selection in the short code tag, complete w/ closing tags.

jtsternberg commented 9 years ago

I prefer that the close tag not be used if there is no selection. (i.e. use the self-closing shortcode)

jtsternberg commented 9 years ago

This should be a parameter that is registered when _Shortcode_Button_ is first initiated, whether shortcode can wrap existing text. if not, should use default (existing) handling.

JayWood commented 9 years ago

The log was just an oopsie on my part, but i'm sad that inline var declarations aren't a thing, they look so much cleaner.

I'll see what I can do about the registration parameter for closing tags. But that begs the question, if the user says 'yes' to closing tags, ie, the shortcode must use a selection, then wouldn't we require the user to make a selection before they can even use the shortcode?

JayWood commented 9 years ago

Oh, and yes this currently works with the text only mode as well.

jtsternberg commented 9 years ago

By 'user', I think you mean the dev who initiates, right? And no, i wasn't saying a selection should be required, though the parameter could take 'required' as a value if you want to make your PR work that way. the parameter would default to false (not allowed), could toggle to true (allowed) or 'required'.

jtsternberg commented 9 years ago

Thanks dude!