break.js 408 B

1234567891011121314151617181920212223242526272829
  1. import Parchment from 'parchment';
  2. class Break extends Parchment.Embed {
  3. static value() {
  4. return undefined;
  5. }
  6. insertInto(parent, ref) {
  7. if (parent.children.length === 0) {
  8. super.insertInto(parent, ref);
  9. } else {
  10. this.remove();
  11. }
  12. }
  13. length() {
  14. return 0;
  15. }
  16. value() {
  17. return '';
  18. }
  19. }
  20. Break.blotName = 'break';
  21. Break.tagName = 'BR';
  22. export default Break;