You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Macro not working in content block with rich text editor #31
I noticed that macro's aren't working like they should. It renders the exact same content as the one in the richtext editor instead of it creating the content when it's rendering it.
This is how normal tinymce content is saved in the database: <?UMBRACO_MACRO macroAlias=\"VideoImageWithCaption\" image=\"umb://media/ea0e3fe8608d46638dc1ff274aee5d51\" videoUrl=\"\" caption=\"\" />\n<p>Teeshfjkhdkjh aldjfk ajsd</p>\n<p>f ajksdfk ashdfjkhaskldjflsadf</p>
And this is how the content is saved in the content blocks: <p>Testdf asdf asdfasdfasdf adfasdfasdfasdfasdf </p>\n<div class=\"umb-macro-holder Button umb-macro-mce_1 mceNonEditable\"><!-- <?UMBRACO_MACRO macroAlias=\"Button\" text=\"Contact specialist\" link=\"umb://document/f000a85417174839b304b0c98254f629\" /> --><ins><a href=\"/\" class=\"button is-brand\"> <span>Contact specialist</span> <span class=\"icon \"> <span class=\"material-icons\">arrow_forward</span> </span> </a></ins></div>
The <?UMBRACO_MACRO> element is hidden in the comment for the content blocks, so it doesn't get rendered correctly.
Can you check how macros are saved in Nested Content (i.e. just add your Content Block dataType to the Homepage or so)? That should be the same as in ContentBlocks. If it does work in NestedContent then I can have a look. If it doesn't work in NestedContent then there is not much we can do either.
Hey @PerplexDaniel,
Yeah, that's one of the things I also checked. This is the full textValue that gets stored in the database when using nested content:
Well it seems Umbraco uses a MacroTagParser in their Rich Text Editor property editor to parse their macro tags back and forth. I suppose we will have to somehow call these methods as well for our editor.
Seems like IDataValueEditor.FromEditor() & IDataValueEditor.ToEditor() are probably the place for this, considering this is also where the Rich Text Editor itself does that. So our editor should implement these methods and call Nested Content's FromEditor / ToEditor() methods.
This is similar to how we already implement Validation at this moment. We also call Nested Content's validation method and go from there.
Just putting this info here for later when I'll try if that fixes this. Assuming it will.
@patrickdemooij9 I have included a fix for this issue in 1.5.2-rc.1 which is on NuGet now. Make sure to tick "Include prerelease" to find it. Seems to work now. If you find any issues let me know and I'll fix them before 1.5.2 final.
@patrickdemooij9 FYI I have released 1.5.2. If you didn't have the chance to test it yet and still find issues just let me know and we'll fix in a next release.
Activity
PerplexDaniel commentedon Aug 7, 2020
Can you check how macros are saved in Nested Content (i.e. just add your Content Block dataType to the Homepage or so)? That should be the same as in ContentBlocks. If it does work in NestedContent then I can have a look. If it doesn't work in NestedContent then there is not much we can do either.
patrickdemooij9 commentedon Aug 7, 2020
Hey @PerplexDaniel,
Yeah, that's one of the things I also checked. This is the full textValue that gets stored in the database when using nested content:
And this is the full textValue that is stored for the contentBlocks:
PerplexDaniel commentedon Aug 7, 2020
Strange, it shouldn't really store anything differently than Nested Content but apparently it does. Will try to have a look at this soon.
PerplexDaniel commentedon Aug 7, 2020
Well it seems Umbraco uses a MacroTagParser in their Rich Text Editor property editor to parse their macro tags back and forth. I suppose we will have to somehow call these methods as well for our editor.
Seems like
IDataValueEditor.FromEditor()&IDataValueEditor.ToEditor()are probably the place for this, considering this is also where the Rich Text Editor itself does that. So our editor should implement these methods and call Nested Content's FromEditor / ToEditor() methods.This is similar to how we already implement Validation at this moment. We also call Nested Content's validation method and go from there.
Just putting this info here for later when I'll try if that fixes this. Assuming it will.
Fix macro issues inside RTE (#31)
PerplexDaniel commentedon Aug 16, 2020
@patrickdemooij9 I have included a fix for this issue in
1.5.2-rc.1which is on NuGet now. Make sure to tick "Include prerelease" to find it. Seems to work now. If you find any issues let me know and I'll fix them before 1.5.2 final.Fix macro issues inside RTE (#31)
PerplexDaniel commentedon Aug 24, 2020
@patrickdemooij9 FYI I have released
1.5.2. If you didn't have the chance to test it yet and still find issues just let me know and we'll fix in a next release.