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';
1818import SurveyCreatorTheme from 'survey-creator-core/themes' ;
1919import { creatorTheme } from '../styles/form-builder-theme' ;
2020import { createPdfAction } from '../utils/surveyPdf' ;
21- import { Action } from 'survey-core' ;
2221
2322registerCreatorTheme ( SurveyCreatorTheme ) ;
2423
@@ -57,10 +56,8 @@ export default function FormBuilderComponent(props: {
5756
5857 creator . applyCreatorTheme ( creatorTheme ) ;
5958
60- const savePdfAction : Action = createPdfAction ( creator ) ;
61- creator . toolbar . actions . push ( savePdfAction ) ;
62- creator . footerToolbar . actions . push ( savePdfAction ) ;
63-
59+ createPdfAction ( creator ) ;
60+
6461 creatorRef . current = creator ;
6562 }
6663
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function savePdf(survey: SurveyModel) {
1919 surveyPDF . data = survey . data ;
2020 surveyPDF . save ( survey . pdfFileName ) ;
2121}
22- export function createPdfAction ( creator : SurveyCreator ) : Action {
22+ export function createPdfAction ( creator : SurveyCreator ) {
2323 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>' ;
2424 SvgRegistry . registerIcon ( "icon-savepdf" , customIcon ) ;
2525
@@ -34,6 +34,7 @@ export function createPdfAction(creator: SurveyCreator): Action {
3434 const surveyModel = ( creator . getPlugin ( "preview" ) as any ) . model . survey as SurveyModel ;
3535 savePdf ( surveyModel ) ;
3636 }
37- } ) ;
38- return savePdfAction ;
37+ } ) ;
38+ creator . toolbar . actions . push ( savePdfAction ) ;
39+ creator . footerToolbar . actions . push ( savePdfAction ) ;
3940}
You can’t perform that action at this time.
0 commit comments