Skip to content

Replacing <strong> with <b> and <em> with <i> #382

Closed Answered by sibiraj-s
informatikTirol asked this question in Q&A
Discussion options

You must be logged in to vote

You will need to create a custom schema and use it. For example using i for italics instead of em.

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 h…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@informatikTirol
Comment options

Answer selected by informatikTirol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants