feat(editor): replace spec provider with extension manager (#11861)

Closes: BS-3273
This commit is contained in:
Saul-Mirone
2025-04-22 07:40:41 +00:00
parent 8fdb00e0ab
commit 6d6504e2af
51 changed files with 623 additions and 177 deletions
@@ -54,14 +54,17 @@ describe('multiple scopes', () => {
class ViewExt1 extends ViewExtensionProvider {
override name = 'ViewExt1';
override setup(context: ViewExtensionContext) {
super.setup(context);
constructor() {
super();
setup1();
}
override setup(context: ViewExtensionContext, option?: { foo: number }) {
super.setup(context, option);
if (context.scope === 'page') {
setup1();
context.register(Ext2);
}
if (context.scope === 'edgeless') {
setup2();
context.register(Ext3);
}
}
@@ -69,6 +72,11 @@ describe('multiple scopes', () => {
class ViewExt2 extends ViewExtensionProvider {
override name = 'ViewExt2';
constructor() {
super();
setup2();
}
override setup(context: ViewExtensionContext) {
super.setup(context);
if (context.scope === 'page') {
@@ -87,7 +95,7 @@ describe('multiple scopes', () => {
expect(edgelessExtensions).toEqual([Ext3, Ext5]);
});
it('should setup be cached', () => {
it('should cache provider instances', () => {
manager.get('page');
manager.get('edgeless');
expect(setup1).toHaveBeenCalledTimes(1);