draft-js icon indicating copy to clipboard operation
draft-js copied to clipboard

Superscript and subscript is missing from `HTMLTagToRawInlineStyleMap`

Open zicyApp opened this issue 3 years ago • 4 comments

Some types are missing when converting html to content blocks:

The current convertFromHtmlToContentBlocks.js only contains the following tags:

var HTMLTagToRawInlineStyleMap = Map({
  b: 'BOLD',
  code: 'CODE',
  del: 'STRIKETHROUGH',
  em: 'ITALIC',
  i: 'ITALIC',
  s: 'STRIKETHROUGH',
  strike: 'STRIKETHROUGH',
  strong: 'BOLD',
  u: 'UNDERLINE',
  mark: 'HIGHLIGHT'
});

The html tags <sup></sup> and <sub></sub> are being ignored when converting from html string.

Solution:

Extend HTMLTagToRawInlineStyleMap with the following 2 types:

sup: 'SUPERSCRIPT',
sub: 'SUBSCRIPT'

zicyApp avatar Jan 16 '22 15:01 zicyApp

Hey @zicyApp Can I do this please?

NaincyKumariKnoldus avatar Jan 16 '22 15:01 NaincyKumariKnoldus

Hey @zicyApp Can I do this please?

Sure no problem.

zicyApp avatar Jan 16 '22 15:01 zicyApp

Hey @zicyApp I have raised a PR now. Please Review this.

NaincyKumariKnoldus avatar Jan 16 '22 16:01 NaincyKumariKnoldus

any updates on this?

nemisqe avatar Jul 07 '22 10:07 nemisqe