Files
NapCatQQ/.pnpm-store/v3/files/d4/7bf920b4cd497fedf7bd4c6474bdaa0cdb4e30f9fcf95009f5fbec807494f53ca40f737b01718329b9cc8093bfd7e0c7eb9693c749abf5e1d50dcd6fd856a7
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

49 lines
1.2 KiB
Plaintext

import Scope from '../../scope.js';
import BlockBlot from '../block.js';
import ParentBlot from './parent.js';
class ContainerBlot extends ParentBlot {
public static blotName = 'container';
public static scope = Scope.BLOCK_BLOT;
public static tagName: string | string[];
public prev!: BlockBlot | ContainerBlot | null;
public next!: BlockBlot | ContainerBlot | null;
public checkMerge(): boolean {
return (
this.next !== null && this.next.statics.blotName === this.statics.blotName
);
}
public deleteAt(index: number, length: number): void {
super.deleteAt(index, length);
this.enforceAllowedChildren();
}
public formatAt(
index: number,
length: number,
name: string,
value: any,
): void {
super.formatAt(index, length, name, value);
this.enforceAllowedChildren();
}
public insertAt(index: number, value: string, def?: any): void {
super.insertAt(index, value, def);
this.enforceAllowedChildren();
}
public optimize(context: { [key: string]: any }): void {
super.optimize(context);
if (this.children.length > 0 && this.next != null && this.checkMerge()) {
this.next.moveChildren(this);
this.next.remove();
}
}
}
export default ContainerBlot;