Hi all,
I am looking for a way to highlight js c# code in a rich text field.
Especially we want to use it in the knowledge base in creatio.
Is there a way to do this?
Regards,
Oliver
Like
Hi Oliver,
You can possibly do it and here is small instruction on how:
1) At first write an example of a code you want to highlight and do it manually using the options above the text. Save the result.
2) Get the value of this field from the database, it should look something like this:
<div>hello there </div> <div> </div> <div>define("PrcAcceptanceCertificate777ab4cfSection", [], function() {<br /> return {<br /> entitySchemaName: "PrcAcceptanceCertificate",<br /> details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,<br /> diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,<br /> methods: {}<br /> };<br /> });<br /> </div> <div> </div>
3) In this value take a look at how the system applies styles, you need to do it automatically in your method.
4) Write a method that will apply needed highlights to your text.
var text = this.get("Notes");
text.DoSomethingToModifyIt();
this.set("Notes", text);
Probably the hardest point would be finding the js code in the whole text because for the system there are no differences between a normal sentence or parts of the code. But if you manage to do it, then applying highlights is not that difficult to do.
Hi,
phew, that sounds like a lot of work.
I was thinking more of a js library that you can just use.
There must already be something integrated in creatio, because there is the source code area. Couldn't we just use that somehow?
Or a component in the editor like here in the community area
Regards,
Oliver
Oliver Herzog,
Slightly misunderstood what are you trying to do.
Can you please specify what source code area you are referring to?
Sorry for the misunderstanding!
I just want c#, js or html to be displayed "nicely" in the richtext editor. In the first post you can see how it should not look like.
No logical check or something like that.
Something like the code snippet function here in the community.
Oliver Herzog,
Unfortunately, right now highlighting the code lines like the "Code snippet" function is impossible on the system itself due to a base logic of RICH_TEXT fields.
I registered your suggestion for our R&D team, thank you for your idea.