survey-creator icon indicating copy to clipboard operation
survey-creator copied to clipboard

add custom widget

Open DevAhmad7 opened this issue 3 years ago • 1 comments

how add new custom widget with react.js?

Screenshot 2022-09-06 182211

import { SurveyCreator } from 'survey-creator-react'
// . how use SurveyCreator to add new widget
// . SurveyCreator => CustomWidgetCollection.Instance.add(widget, type)
const surveyCreatorMemo = useMemo(() => {
    localization.currentLocale = lang
    const surveyCreator = new SurveyCreator(options)
    surveyCreator.JSON = survey ? JSON.parse(survey) : {}
    surveyCreator.showSidebar = false
    surveyCreator.toolbox.changeCategories(categories)
    surveyCreator.toolbarItems.splice(0, 3)
    surveyCreator.addPluginTab(
        'questionBankTab',
        questionBankTab,
        t('common:toolbar.admin.questionBank'),
        'svc-tab-template',
        1
    )
    surveyCreator.allowEditSurveyTitle = false
    surveyCreator.CustomWidgetCollection.Instance.add({}, "") // wrong
    return surveyCreator
}, [options, lang])

DevAhmad7 avatar Sep 06 '22 16:09 DevAhmad7

please, help me!

DevAhmad7 avatar Sep 18 '22 23:09 DevAhmad7