Skip to content

Commit

Permalink
fix: The returned value queried is not necessarily BlockBlot
Browse files Browse the repository at this point in the history
  • Loading branch information
attoae committed Oct 1, 2024
1 parent b213e10 commit 3bb4429
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/quill/src/blots/scroll.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ContainerBlot, LeafBlot, Scope, ScrollBlot } from 'parchment';
import {
BlockBlot,
ContainerBlot,
LeafBlot,
Scope,
ScrollBlot
} from 'parchment';
import type { Blot, Parent, EmbedBlot, ParentBlot, Registry } from 'parchment';
import Delta, { AttributeMap, Op } from 'quill-delta';
import Emitter from '../core/emitter.js';
Expand Down Expand Up @@ -381,7 +387,8 @@ class Scroll extends ScrollBlot {
const formats: AttributeMap = {};

Object.entries(attributes).forEach(([key, value]) => {
const isBlockBlot = this.query(key, Scope.BLOCK & Scope.BLOT) != null;
const match = this.query(key, Scope.BLOCK & Scope.BLOT);
const isBlockBlot = match != null && match.prototype instanceof BlockBlot;
if (isBlockBlot) {
blotName = key;
} else {
Expand Down

0 comments on commit 3bb4429

Please sign in to comment.