6b22d59d0f42175334c0330c7f79193fa5910f9552b4cde87d6f625d4dbc3e04714683b68f81412f7eff0e2f796cdb9da5b0cd49855beb1c36b066ecdc31d1 932 B

12345678910111213141516171819202122232425262728293031323334
  1. import type { Formattable, Root } from './abstract/blot.js';
  2. import LeafBlot from './abstract/leaf.js';
  3. class EmbedBlot extends LeafBlot implements Formattable {
  4. public static formats(_domNode: HTMLElement, _scroll: Root): any {
  5. return undefined;
  6. }
  7. public format(name: string, value: any): void {
  8. // super.formatAt wraps, which is what we want in general,
  9. // but this allows subclasses to overwrite for formats
  10. // that just apply to particular embeds
  11. super.formatAt(0, this.length(), name, value);
  12. }
  13. public formatAt(
  14. index: number,
  15. length: number,
  16. name: string,
  17. value: any,
  18. ): void {
  19. if (index === 0 && length === this.length()) {
  20. this.format(name, value);
  21. } else {
  22. super.formatAt(index, length, name, value);
  23. }
  24. }
  25. public formats(): { [index: string]: any } {
  26. return this.statics.formats(this.domNode, this.scroll);
  27. }
  28. }
  29. export default EmbedBlot;