diff --git a/packages/creator-presets-core/src/presets-editable-languages.ts b/packages/creator-presets-core/src/presets-editable-languages.ts index c608db1a9d..bcb5ffac4c 100644 --- a/packages/creator-presets-core/src/presets-editable-languages.ts +++ b/packages/creator-presets-core/src/presets-editable-languages.ts @@ -74,10 +74,6 @@ export class CreatorPresetEditableLanguages extends CreatorPresetEditableBase { res.push(new ItemValue(locale, name)); } }); - res.sort((a: ItemValue, b: ItemValue): number => { - if(a.text === b.text) return 0; - return a.text < b.text ? -1 : 1; - }); if(addEnLocale) { res.unshift(new ItemValue("en", editorLocalization.getLocaleName("en"))); } diff --git a/packages/creator-presets-react/src/CreatorPresetEditor.tsx b/packages/creator-presets-react/src/CreatorPresetEditor.tsx index e17691ea71..a85f60e6c7 100644 --- a/packages/creator-presets-react/src/CreatorPresetEditor.tsx +++ b/packages/creator-presets-react/src/CreatorPresetEditor.tsx @@ -1,11 +1,23 @@ import * as React from "react"; import { Base } from "survey-core"; -import { SurveyActionBar, SurveyElementBase, Survey, SvgBundleComponent } from "survey-react-ui"; +import { SurveyElementBase, Survey, SvgBundleComponent } from "survey-react-ui"; import { ICreatorOptions, SurveyCreatorModel } from "survey-creator-core"; import { SurveyCreator, SurveyCreatorComponent } from "survey-creator-react"; import { CreatorPresetEditorModel } from "creator-presets-core"; import { PresetsHeaderComponent } from "./Header"; +const presetApplyText = "Use the following code to apply the preset:"; +const presetApplyCode = `import { SurveyCreatorModel, SurveyCreatorPreset } from "survey-creator-core"; +const creator = new SurveyCreatorModel({ ... }); + +const presetJson = { + // Copy the JSON object from below +} + +const preset = new SurveyCreatorPreset(presetJson); +preset.applyTo(creator); +`; + export class CreatorPresetEditor extends CreatorPresetEditorModel { public createCreator(options: ICreatorOptions): SurveyCreatorModel { return new SurveyCreator(options); @@ -46,17 +58,12 @@ export class CreatorPresetEditorComponent extends SurveyElementBase -
Please use the following code to apply your preset: +
{presetApplyText}
-
{codeText}
+
{presetApplyCode}