Is there any way in Draft.js to check if a style is being used?

Viewed 242

I am wondering, if there is any way to choose in Draft.js to check, if a style is being used.

For example, we have this styleMap:

const styleMap = {
  'STRIKETHROUGH': {
    textDecoration: 'line-through',
  },
};

<Editor
   customStyleMap={styleMap}
   editorState={editorState}
   onChange={onEditorStateChanged}
   placeholder="Write some text here"
   spellCheck={true}
   readOnly={false}
/>

Is there any way to check, if the style STRIKETHROUGH is being used in the current editorState? I saw that I can get styling with getCurrentInlineStyle(); and check this, but it gives only the result for the "current" action and not for the whole text. Does anybody know a different way to check, if a style is being used in the editorState?

1 Answers
Related