Describe the bug
There are cases to be applied not related FormatType to richtext if edit the class on the editor
but not applied on the front end
To Reproduce
- register format type
tagName: span, className: class1
- apply the format type to richtext on Visual Editor
- delete class on Code Editor
- back to Visual Editor
⇒ class1 is applied
- register format type
tagName: span, className: class1
- apply the format type to richtext on Visual Editor
- change class to class2 on Code Editor
- back to Visual Editor
⇒ class1 and class2 are applied
- register format types
tagName: span, className: class1
tagName: span, className: class2
- apply the second format type to rechtext (class2) on Visual Editor
- unregister (not register) second format type (e.g deactivate plugin)
registered only class1 format type
tagName: span, className: class1
- reload
⇒ class1 and class2 are applied
⇒ In either case, class1 is not applied on the front end
Expected behavior
unrelated FormatType should not be applied on editor
In the above case, class1 format type
Screenshots
- apply format type

- edit the class on Code Editor

- back to Visual Editor (class1 is applied)

- on front end (class1 is not applied)

Desktop (please complete the following information):
- OS: Windows10
- Browser: Chrome
- Version: 71.0.3578.98
Additional context
https://github.com/WordPress/gutenberg/blob/release/5.4/packages/rich-text/src/create.js#L40
toFormat function's behavior
- search formatType by class name (getFormatTypeForClassName)
- search formatType by type(tag name) (getFormatTypeForBareElement)
I think below is better
- search formatType by class name (getFormatTypeForClassName)
- search formatType by type and class name is empty
related pull request
#11488
Describe the bug
There are cases to be applied not related FormatType to richtext if edit the class on the editor
but not applied on the front end
To Reproduce
tagName: span, className: class1⇒ class1 is applied
tagName: span, className: class1⇒ class1 and class2 are applied
tagName: span, className: class1tagName: span, className: class2registered only class1 format type
tagName: span, className: class1⇒ class1 and class2 are applied
⇒ In either case, class1 is not applied on the front end
Expected behavior
unrelated FormatType should not be applied on editor
In the above case, class1 format type
Screenshots
Desktop (please complete the following information):
Additional context
https://github.com/WordPress/gutenberg/blob/release/5.4/packages/rich-text/src/create.js#L40
toFormatfunction's behaviorI think below is better
related pull request
#11488