Skip to content

Commit

Permalink
updated survey-creator docs [azurepipelines skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov committed Sep 17, 2024
1 parent 4e5d9f1 commit 544b98d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 54 deletions.
69 changes: 17 additions & 52 deletions docs/get-started-vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,20 @@ const creator = new SurveyCreatorModel(creatorOptions);

### Render Survey Creator

Survey Creator rendering code is encapsulated in the `SurveyCreatorComponent`. To use it in your template, you need to install `surveyPlugin` (for SurveyJS Form Library) and `surveyCreatorPlugin`. Open the `main.ts` file, import these plugins, and install them using the `app.use()` method *in the exact order shown below*:
To render Survey Creator, add `SurveyCreatorComponent` to your template, and pass the model instance you created in the previous step to the component's `model` attribute:

```html
<script setup lang="ts">
import { SurveyCreatorComponent } from "survey-creator-vue";
// ...
</script>

<template>
<SurveyCreatorComponent :model="creator" />
</template>
```

The code above registers `SurveyCreatorComponent` locally. If you want to register it globally, open the `main.ts` file, import `surveyPlugin` (for SurveyJS Form Library) and `surveyCreatorPlugin`, and install them using the `app.use()` method *in the exact order shown below*. In this case, you don't need to import `SurveyCreatorComponent` within each Vue component where you want to use it.

```js
// main.ts
Expand All @@ -130,18 +143,6 @@ createApp(App)
.mount("#app");
```

To render Survey Creator, add `SurveyCreatorComponent` to your template, and pass the model instance you created in the previous step to the component's `model` attribute:

```html
<script setup lang="ts">
// ...
</script>

<template>
<SurveyCreatorComponent :model="creator" />
</template>
```

<details>
<summary>View Full Code</summary>

Expand All @@ -153,6 +154,7 @@ import "survey-creator-core/survey-creator-core.min.css";
import type { ICreatorOptions } from "survey-creator-core";
import { SurveyCreatorModel } from "survey-creator-core";
import { SurveyCreatorComponent } from "survey-creator-vue";
const creatorOptions: ICreatorOptions = {
showLogicTab: true,
Expand All @@ -165,19 +167,6 @@ const creator = new SurveyCreatorModel(creatorOptions);
<SurveyCreatorComponent :model="creator" />
</template>
```

```js
// main.ts
import { createApp } from "vue";
import App from "./App.vue";
import { surveyPlugin } from "survey-vue3-ui";
import { surveyCreatorPlugin } from "survey-creator-vue";

createApp(App)
.use(surveyPlugin)
.use(surveyCreatorPlugin)
.mount("#app");
```
</details>

### Save and Load Survey Model Schemas
Expand Down Expand Up @@ -291,6 +280,7 @@ import "survey-creator-core/survey-creator-core.min.css";
import type { ICreatorOptions } from "survey-creator-core";
import { SurveyCreatorModel } from "survey-creator-core";
import { SurveyCreatorComponent } from "survey-creator-vue";
const creatorOptions: ICreatorOptions = {
showLogicTab: true,
Expand Down Expand Up @@ -349,19 +339,6 @@ creator.saveSurveyFunc = (saveNo: number, callback: Function) => {
<SurveyCreatorComponent :model="creator" />
</template>
```

```js
// main.ts
import { createApp } from "vue";
import App from "./App.vue";
import { surveyPlugin } from "survey-vue3-ui";
import { surveyCreatorPlugin } from "survey-creator-vue";

createApp(App)
.use(surveyPlugin)
.use(surveyCreatorPlugin)
.mount("#app");
```
</details>

### Manage Image Uploads
Expand Down Expand Up @@ -414,6 +391,7 @@ import "survey-creator-core/survey-creator-core.min.css";
import type { ICreatorOptions } from "survey-creator-core";
import { SurveyCreatorModel } from "survey-creator-core";
import { SurveyCreatorComponent } from "survey-creator-vue";
const creatorOptions: ICreatorOptions = {
showLogicTab: true,
Expand Down Expand Up @@ -493,19 +471,6 @@ creator.saveSurveyFunc = (saveNo: number, callback: Function) => {
<SurveyCreatorComponent :model="creator" />
</template>
```

```js
// main.ts
import { createApp } from "vue";
import App from "./App.vue";
import { surveyPlugin } from "survey-vue3-ui";
import { surveyCreatorPlugin } from "survey-creator-vue";

createApp(App)
.use(surveyPlugin)
.use(surveyCreatorPlugin)
.mount("#app");
```
</details>

[View Demo](https://surveyjs.io/survey-creator/examples/file-upload/vue3js (linkStyle))
Expand Down
4 changes: 4 additions & 0 deletions docs/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@
"Name": "questiontoolbox",
"Title": "QuestionToolbox"
},
{
"Name": "questiontoolboxitem",
"Title": "QuestionToolboxItem"
},
{
"Name": "iquestiontoolboxitem",
"Title": "IQuestionToolboxItem"
Expand Down
4 changes: 2 additions & 2 deletions docs/toolbox-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Toolbox items can have nested items, or "subitems". They appear when users hover

<img src="./images/toolbox-subitems.png" alt="Survey Creator: Toolbox subitems" width="953" height="690">

To create a custom subitem, pass its [configuration object](/survey-creator/documentation/api-reference/iquestiontoolboxitem) to the [`addSubitem(subitem, index)`](/survey-creator/documentation/api-reference/iquestiontoolboxitem#addSubitem) method. Call this method on a toolbox item instance to which you want to add the subitem. For instance, the following code adds a "Limited to 280 characters" subitem to the Long Text toolbox item:
To create a custom subitem, pass its [configuration object](/survey-creator/documentation/api-reference/iquestiontoolboxitem) to the [`addSubitem(subitem, index)`](/survey-creator/documentation/api-reference/questiontoolboxitem#addSubitem) method. Call this method on a toolbox item instance to which you want to add the subitem. For instance, the following code adds a "Limited to 280 characters" subitem to the Long Text toolbox item:

```js
import { SurveyCreatorModel } from "survey-creator-core";
Expand All @@ -165,7 +165,7 @@ longTextItem.addSubitem({

[View Demo](/survey-creator/examples/manage-toolbox-subitems/ (linkStyle))

If you want to remove a specific subitem, call the [`removeSubitem(subitem)`](/survey-creator/documentation/api-reference/iquestiontoolboxitem#removeSubitem) method on a toolbox item instance. You can also remove all subitems of a toolbox item by calling the [`clearSubitems()`](/survey-creator/documentation/api-reference/iquestiontoolboxitem#clearSubitems) method:
If you want to remove a specific subitem, call the [`removeSubitem(subitem)`](/survey-creator/documentation/api-reference/questiontoolboxitem#removeSubitem) method on a toolbox item instance. You can also remove all subitems of a toolbox item by calling the [`clearSubitems()`](/survey-creator/documentation/api-reference/questiontoolboxitem#clearSubitems) method:

```js
// Remove the Labels subitem of the Rating Scale toolbox item
Expand Down

0 comments on commit 544b98d

Please sign in to comment.