bold.js 410 B

12345678910111213141516171819202122
  1. import Inline from '../blots/inline';
  2. class Bold extends Inline {
  3. static create() {
  4. return super.create();
  5. }
  6. static formats() {
  7. return true;
  8. }
  9. optimize(context) {
  10. super.optimize(context);
  11. if (this.domNode.tagName !== this.statics.tagName[0]) {
  12. this.replaceWith(this.statics.blotName);
  13. }
  14. }
  15. }
  16. Bold.blotName = 'bold';
  17. Bold.tagName = ['STRONG', 'B'];
  18. export default Bold;