-
Notifications
You must be signed in to change notification settings - Fork 39
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
Feature request: Don't require placeholder to be an image #34
Comments
@jonom I completely agree. When I was reviewing and tweaking #32 I had a go... and failed. The trouble happens around here https://github.com/sheadawson/silverstripe-shortcodable/blob/master/javascript/editor_plugin.js#L61. Here we are using a regex string.repalce callback on the editor content to update shortcode tags to img tags. If we want to change that to shortcode tags to div tags with html contents loaded from a url, we have to use an ajax request to get the html... But because the ajax request is asynchronous, the callback function returns before the ajax request completes. This is what my attempt looked like. http://codepen.io/sheadawson/pen/ONdzRZ I think actually using images is not as lame as I initially thought. The example you mention displaying a phone number from SiteConfig can be achieved by setting the phone number as the text in the placeholder image. See this example https://gist.github.com/sheadawson/12c5e5a2b42272bd90f703941450d677#file-imagegallery-php-L64 I also like how it keeps things simple and clean in the editor. Implementation is fast and reasonably flexible. That said, if you or anyone else can think of a way to make this work, that would be awesome. |
Ah, that makes sense. Could you do it as a two-part thing maybe where Within Don't know if it's actually feasible or not :) Thanks for the tip on adding text to the placeholder image - didn't realise you could do that! |
Cheers for the suggestion. That could potentially work. I'll have to park On 9 May 2016 at 10:25, Jono Menz [email protected] wrote:
Shea Dawson mobile +64 20 4028 5647 |
Ha, sure would! |
The new ability to add a placeholder is great! Think it would be even better if it didn't have to be an image.
Currently
getShortcodePlaceHolder()
must return the URL to an image, but if it could return arbitrary HTML instead it would be much more flexible. I'm not sure how easy it would be to support this in TinyMCE but if there was a wrapper element involved maybe it could be accomplished?For simple shortcodes like reusable text tokens (e.g. displaying a phone number from SiteConfig) this would let you show the actual content, perhaps with a slightly different treatment to show it's a shortcode.
The text was updated successfully, but these errors were encountered: