File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
blogpost-apps/nextjs-form-builder/src Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import 'ace-builds/src-noconflict/ext-searchbox';
18
18
import SurveyCreatorTheme from 'survey-creator-core/themes' ;
19
19
import { creatorTheme } from '../styles/form-builder-theme' ;
20
20
import { createPdfAction } from '../utils/surveyPdf' ;
21
- import { Action } from 'survey-core' ;
22
21
23
22
registerCreatorTheme ( SurveyCreatorTheme ) ;
24
23
@@ -57,10 +56,8 @@ export default function FormBuilderComponent(props: {
57
56
58
57
creator . applyCreatorTheme ( creatorTheme ) ;
59
58
60
- const savePdfAction : Action = createPdfAction ( creator ) ;
61
- creator . toolbar . actions . push ( savePdfAction ) ;
62
- creator . footerToolbar . actions . push ( savePdfAction ) ;
63
-
59
+ createPdfAction ( creator ) ;
60
+
64
61
creatorRef . current = creator ;
65
62
}
66
63
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function savePdf(survey: SurveyModel) {
19
19
surveyPDF . data = survey . data ;
20
20
surveyPDF . save ( survey . pdfFileName ) ;
21
21
}
22
- export function createPdfAction ( creator : SurveyCreator ) : Action {
22
+ export function createPdfAction ( creator : SurveyCreator ) {
23
23
const customIcon = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6 2a2 2 0 0 0-2 2v16c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V8l-6-6H6zm7 1.5L18.5 9H13V3.5zM12 13v4.17l-1.59-1.58L9 17l4 4 4-4-1.41-1.41L13 17.17V13h-1z"/></svg>' ;
24
24
SvgRegistry . registerIcon ( "icon-savepdf" , customIcon ) ;
25
25
@@ -34,6 +34,7 @@ export function createPdfAction(creator: SurveyCreator): Action {
34
34
const surveyModel = ( creator . getPlugin ( "preview" ) as any ) . model . survey as SurveyModel ;
35
35
savePdf ( surveyModel ) ;
36
36
}
37
- } ) ;
38
- return savePdfAction ;
37
+ } ) ;
38
+ creator . toolbar . actions . push ( savePdfAction ) ;
39
+ creator . footerToolbar . actions . push ( savePdfAction ) ;
39
40
}
You can’t perform that action at this time.
0 commit comments