Owain Jones
11/10/2023, 3:10 PMjson
"Umbraco": {
"CMS": {
"RichTextEditor": {
"Commands": [
{
"Alias": "blockquote",
"Name": "BlockQuote",
"Mode": "Selection"
},
{
"Alias": "codesample",
"Name": "Code Sample",
"Mode": "Insert"
},
{
"Alias": "fullscreen",
"Name": "Full Screen",
"Mode": "Selection"
}
],
"Plugins": [
"codesample",
"fullscreen"
]
}
}
}
Which makes it available in the rich text editor (see screenshot).
I then downloaded the css and js files from: https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript+csharp+css-extras+csv+docker+git+json+log+markdown+powershell+python+jsx+tsx+regex+scss+scheme+solution-file+sql+typescript+xml-doc+yaml&plugins=line-highlight+line-numbers+show-language+highlight-keywords+inline-color+toolbar+treeview
and added them to my frontend.
But syntax highlighting is just not working on the frontend, every guide online says it should "just work"... does anyone have any ideas?huwred
11/10/2023, 4:21 PMOwain Jones
11/10/2023, 6:20 PMhuwred
11/10/2023, 6:20 PMOwain Jones
11/10/2023, 6:21 PMOwain Jones
11/11/2023, 2:00 PMOwain Jones
03/30/2024, 9:28 PMOwain Jones
03/30/2024, 9:30 PMOwain Jones
03/30/2024, 9:30 PMMike Chambers
03/31/2024, 10:33 AMMike Chambers
03/31/2024, 10:42 AMsanitizeTinyMCE
global setting.. wonder if this could be playing up? https://docs.umbraco.com/umbraco-cms/reference/configuration/globalsettings#sanitize-tinymceMark Drake
03/31/2024, 2:27 PMOwain Jones
04/02/2024, 12:53 PMumbracoPropertyData
does contain the additional classes around the code, but the one that doesn't work does not...Owain Jones
04/02/2024, 12:53 PMOwain Jones
04/02/2024, 12:54 PMOwain Jones
04/02/2024, 1:53 PMOwain Jones
04/02/2024, 1:54 PM<code>
element, which seems to be the cause (i'm guessing the PrismJS script needs that to add the highlighting)
https://cdn.discordapp.com/attachments/1172553816110010541/1224718642415927316/image.png?ex=661e831e&is=660c0e1e&hm=06ba650e18efab52aa2f6b450f032d07bc7e41acb25ae845ca52e291774985e0&Owain Jones
04/02/2024, 2:00 PMcode
element, it isn't doing it. But what's odd is that sometimes the TinyMCE editor saves the RTE value with those decoration elements already there! Which is why I was seeing it work inconsistently...
https://cdn.discordapp.com/attachments/1172553816110010541/1224720068932538538/codesample_plugin_what.gif?ex=661e8472&is=660c0f72&hm=f6a4a33175a50bd57d5629a21e72aed3aa1bf06264f89b048e57e6f014416001&Mike Chambers
04/02/2024, 7:58 PMcode
isn't present in the default, so should be stripped by tinyMce?
https://github.com/umbraco/Umbraco-CMS/blob/fdea8c28c89c62bf33272e67b3d7770ff2becf9f/src/Umbraco.Core/Configuration/Models/RichTextEditorSettings.cs#L10-L11
https://cdn.discordapp.com/attachments/1172553816110010541/1224810213937385572/image.png?ex=661ed866&is=660c6366&hm=e3aa4eadcb9b1df3d5347c58bdeffcfd9da2e6e55fa33cab7562aaac37365c11&Mike Chambers
04/02/2024, 8:05 PMMike Chambers
04/02/2024, 8:10 PM,-code
on the end for allow but remove if empty?huwred
04/03/2024, 6:25 AMhuwred
04/03/2024, 7:39 AMOwain Jones
04/03/2024, 9:04 AMDean Leigh
04/03/2024, 11:31 AM