Free and Open source Web Builder Framework. Next generation tool for building templates without coding
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
687 B

import { Collection } from '../../common';
import EditorModel from '../../editor/model/Editor';
import Page from './Page';
export default class Pages extends Collection<Page> {
constructor(models: any, em: EditorModel) {
super(models);
this.on('reset', this.onReset);
this.on('remove', this.onRemove);
// @ts-ignore We need to inject `em` for pages created on reset from the Storage load
this.model = (props: {}, opts = {}) => {
return new Page(props, {...opts, em });
}
}
onReset(m: Page, opts?: { previousModels?: Pages }) {
opts?.previousModels?.map((p) => this.onRemove(p));
}
onRemove(removed?: Page) {
removed?.onRemove();
}
}