Closed rhurling closed 8 years ago
Lasso should only be replacing aesop_XXX shortcodes with HTML. It was built to make Aesop Story Engine easier to use.
For me Lasso is replacing every shortcode in the content with the rendered HTML once i press save (Contact Form 7 for example).
I know that the title of this issue is probably not describing it that well, but I can't come up with something that describes my issue better.
Oh, yep that's exactly right. Lasso saves the HTML of the_content entirely. What you can do is add the css class of the parent div so that Lasso will "ignore" the item. Happy to help through proper support channels help@lasso.is. This is also documented in the owners manual.
Also, happy to accept a PR with your above work provided that it works out well!
I tried using the ignore class, but for me that just removed it entirely after saving.
Okay, I'll try to submit a PR with this, since I think it's pretty important that Lasso doesn't destroy shortcodes of other plugins.
The way the ignore class works is that it will remove the item when you go to edit. Lasso really needs a dedicated content div (which is well documented) since it saves the HTML entirely (after processing through kses).
Excellent! I agree we'd like to remove the restriction of having that dedicated content div as there are cases where folks will use non aesop shortcodes within the_content.
Very nice work @rhurling. As @bearded-avenger stated Editus needs a dedicated content div to function properly. We have had no issues with ignoring classes when in edit mode that are created from other shortcodes.
Also, if you send a PR, be sure to search and replace Lasso with Editus. As of version 0.9.8 Lasso has been renamed Editus.
@michaelbeil The problem with using the ignoring classes is that the shortcode is removed entirely on edit (so the rendered content gets lost), which is fine for plugins that hook into the the_content
filter and add html before or after the content, or place it somewhere in between.
But its entirely insufficient if you use a shortcode that outputs something dynamic (for example something like [current_date format="d.m.Y"]
) since that's just replaced with the current output of that.
I won't have to replace Lasso with Editus if I'm branching off of the release/0.9.8 branch right?
Edit:
Better example of the current behavior Lasso shows for me.
Page with following content (as in database):
<h1>Current Date: [current_date]</h1>
After Save with Lasso:
<h1>Current Date: 08/25/2015</h1>
After Save with Lasso + PR i'm going to do:
<h1>Current Date: [current_date]</h1>
Thank you for this. I made a minor fix in lasso_wrap_shortcodes() to get rid of the warning.
It would be awesome if lasso didn't replace existing shortcodes with html. And I think I figured out a solution to that problem.
I'm wrapping shortcodes with two html comments before they are outputted (only if lasso is activated and the user can use lasso). After that I'm rereplacing it in the
lasso_object_save_args
filter with only the shortcode.The main problem is that lasso is replacing html comments in the shortcodify function with
undefined
, since comments don't have aouterHTML
property. I fixed that by adding the following here: https://github.com/AesopInteractive/lasso/blob/18500353f112cecf3048c10d329e56ca46252f73/public/assets/js/source/process-save.js#L147And here is my PHP code which does the heavy lifting
The
wrap_shortcodes
function is pretty much a copy of thedo_shortcodes
function, the only difference being formatting and the different callback.I'm not using Aesop Story engine, so I'm not entirely sure how that is affected, but I added an exception to not wrap shortcodes beginning with
aesop_
with the html comments.