This question is about including a html tag with linked metadata in the component "Document Editor". I am using Essential JS2 JavaScript (ES5) in an Angular 1.5.x project.
I am currently developing a 'tag adding tool' in which the user creates a template document where he can include tags with text and linked metadata.
So, when the template is being used to create a new document, these tags with metadata are replaced with the real data from the database.
To accomplish that, I was trying (... with no success...) to insert/paste an html tag with the associated metadata, like the example below:
'<span data-tag="{{datatag}}" data-context="{{datacontext}}">{ ' + angular.element(elem).text() + ' }</span>'
Is there some solution to insert an html tag with associated metadata in the document editor page? If not, is there a way to execute this idea?
Thank you so much in advance.
Greetings!
|
Syncfusion.EJ2.DocumentEditor.WordDocument doc = Syncfusion.EJ2.DocumentEditor.WordDocument.LoadString(“provide your processed html string here”, Syncfusion.EJ2.DocumentEditor.FormatType.Html);
var sfdt = Newtonsoft.Json.JsonConvert.SerializeObject(doc); |
|
rteObj.executeCommand('insertHTML', 'inserted an html'); |
Hello Suriya,
Thank you for the quick reply.
I appreciate the suggestion of the component ej2-richtexteditor. However, I am intend to use Document Editor component, as it is easier for the users to visualize the templates as a document page.
So, when creating the element which is being 'translated' from html to sfdt (in server side), is there a way/is it possible to also include a custom parameter in the returned json, so that custom parameter has an element/object with that binding data?
For instance, imagine the final json string to be pasted in the container would be something like:
let json = {
"characterFormat": {
"bold": true,
"italic": true
},
"customElement": {
"dataTag": "dataTagValue",
"dataContext": "dataContext"
},
"text": "Tag"
};
container.documentEditor.editor.paste(json);
Once again, thank you so much for the assistance.
Greetings