SimpleWysiwyg
This server-side class provides methods that convert data from the HTML format to WYSIWYG-JSON. The data in this format can be used in the fields of the WYSIWYG type.
The data in the WYSIWYG-JSON format contains the following keys:
display_value
– the field content in the text form without formatting.lexical_json_value
– the field content in the WYSIWYG-JSON format based on the Lexical library.
note
The error messages that are returned by the methods of this server class contain links to the Lexical library documentation. Use them to get detailed information about the problem.
convertHTMLToJSON(html)
Use this method to convert data from the HTML format to WYSIWYG-JSON.
Parameter(s):
Name | Type | Mandatory | Default value |
---|---|---|---|
html | String | Y | N |
Return:
Type | Description |
---|---|
String | The method returns data in WYSIWYG-JSON format. |
Example:
convertHTMLToJSON(html)
let ww = new SimpleWysiwyg();
let a = ww.convertHTMLToJSON("<html><head><title>1</title></head><body><p>text</p></body></html>");