@arbisoft/react-design-tool 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -10
- package/dist/cjs/index.js +359 -559
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +359 -559
- package/dist/esm/index.js.map +1 -1
- package/package.json +78 -78
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ npm install @arbisoft/react-design-tool@1.0.21
|
|
|
40
40
|
```
|
|
41
41
|
OR
|
|
42
42
|
```bash
|
|
43
|
-
yarn add @arbisoft/react-design-tool@1.0.
|
|
43
|
+
yarn add @arbisoft/react-design-tool@1.0.21
|
|
44
44
|
|
|
45
45
|
```
|
|
46
46
|
## 🚀 Quick Start
|
|
@@ -195,7 +195,16 @@ By providing this prop, you can change the default content for these texts.
|
|
|
195
195
|
```js
|
|
196
196
|
defaultText={'Your Default Text'}
|
|
197
197
|
```
|
|
198
|
-
#### 12. `
|
|
198
|
+
#### 12. `defaultQrLogo` (String)
|
|
199
|
+
|
|
200
|
+
Sets a default logo image to appear inside the QR code when the Studio loads.
|
|
201
|
+
|
|
202
|
+
**Example:**
|
|
203
|
+
|
|
204
|
+
```js
|
|
205
|
+
defaultQrLogo={'https://yourcdn.com/qr-logo.png'}
|
|
206
|
+
```
|
|
207
|
+
#### 13. `onSave` (Async function)
|
|
199
208
|
By providing this function, a "Save" Call-to-Action (CTA) button will appear in the Studio.
|
|
200
209
|
When the user clicks on this button, the function will be executed, and you will receive the current design data.
|
|
201
210
|
This data includes an array of elements and the image of the canvas. You can then use this data as needed, such as storing the elements and image.
|
|
@@ -208,14 +217,14 @@ onSave={async (data) => {
|
|
|
208
217
|
// You can store this data or perform any actions you'd like
|
|
209
218
|
}}
|
|
210
219
|
```
|
|
211
|
-
####
|
|
220
|
+
#### 14. `saveButtonText` (String)
|
|
212
221
|
Overrides the text for the Call-to-Action (CTA) button that appears in the Studio.
|
|
213
222
|
|
|
214
223
|
**Example:**
|
|
215
224
|
```js
|
|
216
225
|
saveButtonText={'Save Progress'}
|
|
217
226
|
```
|
|
218
|
-
####
|
|
227
|
+
#### 15. `locale` (String)
|
|
219
228
|
Sets the locale for the Studio to provide multilingual support.
|
|
220
229
|
You can set the `locale` prop to one of the supported languages: `"fr"`, `"en"`, `"ru"`, `"pl"`, `"de"`, `"es"`, or `"it"`.
|
|
221
230
|
The default locale is `"en"`.
|
|
@@ -224,23 +233,40 @@ The default locale is `"en"`.
|
|
|
224
233
|
```js
|
|
225
234
|
locale={'fr'}
|
|
226
235
|
```
|
|
227
|
-
####
|
|
228
|
-
|
|
236
|
+
#### 16. `ref` (reference)
|
|
237
|
+
|
|
238
|
+
A reference to the `Studio` component.
|
|
239
|
+
|
|
229
240
|
```js
|
|
230
241
|
const studioRef = useRef();
|
|
231
242
|
|
|
232
243
|
<Studio
|
|
233
244
|
ref={studioRef}
|
|
234
245
|
...
|
|
235
|
-
/>
|
|
246
|
+
/>
|
|
236
247
|
```
|
|
237
|
-
|
|
248
|
+
|
|
249
|
+
You can access the following properties via `studioRef.current`:
|
|
250
|
+
|
|
251
|
+
- `onSave()` – Manually trigger the save operation and retrieve the updated elements and image of the canvas, along with any other data.
|
|
252
|
+
- `loading` – Get the current loading state (`boolean`).
|
|
253
|
+
- `setLoading(true | false)` – Programmatically set the loading state of Studio.
|
|
238
254
|
|
|
239
255
|
**Example:**
|
|
256
|
+
|
|
240
257
|
```js
|
|
258
|
+
const studioRef = useRef();
|
|
259
|
+
|
|
260
|
+
// Access loading state
|
|
261
|
+
const isLoading = studioRef?.current?.loading;
|
|
262
|
+
|
|
263
|
+
// Set loading state
|
|
264
|
+
studioRef?.current?.setLoading(true);
|
|
265
|
+
|
|
266
|
+
// Trigger save
|
|
241
267
|
const handleSave = async () => {
|
|
242
|
-
|
|
243
|
-
|
|
268
|
+
const data = await studioRef?.current?.onSave();
|
|
269
|
+
console.log('Saved data:', data);
|
|
244
270
|
// { elements: [array of elements], image: canvas image }
|
|
245
271
|
};
|
|
246
272
|
```
|