Migration
If you are migrating from older version of ngx-editor(v4 and below) or from other editors, the DOM structure might be little different.
To convert them to the editors current DOM schema, you will need to write a custom schema and run the document through that.
An Example to convert and parse div
into p
tag persisting all attributes
Example HTML
Lets take this HTML and and write a schema to retain background property.
The Schema
You can refer here https://github.com/sibiraj-s/ngx-editor/blob/v5.3.0/src/lib/schema/nodes.ts for editor default schema.
Refer here https://prosemirror.net/examples/schema/ to write a schema from scratch.
After creating the schema extend it with editor’s default schema so that all default parsing is applied.
To Convert HTML
The editor accepts both doc/HTML as input. If you need HTML