add auto-highlighting of selected/updated code

This commit is contained in:
undergroundwires
2020-08-25 16:52:38 +01:00
parent 5df458739d
commit b789250cb8
39 changed files with 1163 additions and 175 deletions

View File

@@ -13,10 +13,11 @@ export class ApplicationStub implements IApplication {
return this;
}
public findCategory(categoryId: number): ICategory {
throw new Error('Method not implemented.');
return this.getAllCategories().find(
(category) => category.id === categoryId);
}
public getRecommendedScripts(): readonly IScript[] {
throw new Error('Method not implemented.');
throw new Error('Method not implemented: getRecommendedScripts');
}
public findScript(scriptId: string): IScript {
return this.getAllScripts().find((script) => scriptId === script.id);

View File

@@ -11,6 +11,14 @@ export class CategoryStub extends BaseEntity<number> implements ICategory {
constructor(id: number) {
super(id);
}
public getAllScriptsRecursively(): readonly IScript[] {
return [
...this.scripts,
...this.subCategories.flatMap((c) => c.getAllScriptsRecursively()),
];
}
public withScriptIds(...scriptIds: string[]): CategoryStub {
for (const scriptId of scriptIds) {
this.withScript(new ScriptStub(scriptId));

View File

@@ -0,0 +1,8 @@
import { SelectedScript } from '@/application/State/Selection/SelectedScript';
import { ScriptStub } from './ScriptStub';
export class SelectedScriptStub extends SelectedScript {
constructor(id: string, revert = false) {
super(new ScriptStub(id), revert);
}
}