import * as ko from "knockout" ; import { ImplementorBase } from "survey-knockout-ui" ; import { SurveyCreator } from "../creator" ; const template = require ( "./creator.html" ) ; export class CreatorViewModel { constructor ( public creator , private rootNode ) { this . creator . initKeyboardShortcuts ( this . rootNode ) ; this . creator . initResponsivityManager ( this . rootNode as HTMLDivElement ) ; new ImplementorBase ( this . creator . notifier ) ; new ImplementorBase ( this . creator . toolbox ) ; new ImplementorBase ( this . creator . dragDropSurveyElements ) ; new ImplementorBase ( this . creator . dragDropChoices ) ; new ImplementorBase ( this . creator ) ; } dispose ( ) { this . creator . removeKeyboardShortcuts ( this . rootNode ) ; this . creator . resetResponsivityManager ( ) ; } } ko . components . register ( "survey-creator" , { viewModel : { createViewModel : ( params , componentInfo ) => { const element = componentInfo . element ; const model = new CreatorViewModel ( params . creator , element ) ; ko . utils . domNodeDisposal . addDisposeCallback ( element , ( ) => { model . dispose ( ) ; } ) ; return model ; } , } , template : template , } ) ;