Replacing <strong> with <b> and <em> with <i> #382
-
HI, THX |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You will need to create a custom schema and use it. For example using import { nodes, marks } from 'ngx-editor';
import { Schema, DOMOutputSpec, MarkSpec } from 'prosemirror-model';
const em: MarkSpec = {
parseDOM: [{ tag: 'i' }, { tag: 'em' }, { style: 'font-style=italic' }],
toDOM(): DOMOutputSpec {
return ['i', 0]; // <----- this line is changed. old `return ["em", 0];`
},
};
const schema = new Schema({
nodes,
marks: {
...marks,
em,
},
});
const editor = new Editor({
schema,
}); Refer this for all existing schema configuration https://github.com/sibiraj-s/ngx-editor/blob/master/projects/ngx-editor/schema/marks.ts Also this for how to use custom schemas. https://github.com/sibiraj-s/ngx-editor/blob/master/projects/demo/src/app/schema.ts |
Beta Was this translation helpful? Give feedback.
You will need to create a custom schema and use it. For example using
i
for italics instead ofem
.Refer this for all existing schema configuration https://github.com/sibiraj-s/ngx-editor/blob/master/projects/ngx-editor/schema/marks.ts
Also this for h…