import { IaddContentEditorWebPart } from "../../../@types/helper/methods" ; import { IContentEditorWebPart } from "../../../@types/helper/webpart" ; import { WebPart } from "../webpart" ; declare var SP ; export const addContentEditorWebPart = ( url , wpProps ) => { return new Promise ( ( resolve , reject ) => { let context = SP . ClientContext . get_current ( ) ; let page = context . get_web ( ) . getFileByServerRelativeUrl ( url ) ; let wpMgr = page . getLimitedWebPartManager ( SP . WebParts . PersonalizationScope . shared ) ; let wp = wpMgr . importWebPart ( WebPart . generateContentEditorXML ( wpProps ) ) . get_webPart ( ) ; wpMgr . addWebPart ( wp , wpProps . zone || "" , wpProps . index || 0 ) ; context . load ( wp ) ; context . executeQueryAsync ( ( ) => { resolve ( ) ; } , ( ... args ) => { reject ( args [ 1 ] ? args [ 1 ] . get_message ( ) : "" ) ; } ) ; } ) ; } ;