polotno-node 2.8.1 → 2.9.0
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 +13 -0
- package/instance.js +7 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -201,6 +201,19 @@ const url = await instance.jsonToPDFDataURL(json, {
|
|
|
201
201
|
});
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
+
### `attrs.textOverflow`
|
|
205
|
+
|
|
206
|
+
Control behavior of text on its overflow. Default is `change-font-size`. It means it will automatically reduce font size to fit text into the box. Other options are:
|
|
207
|
+
|
|
208
|
+
- `resize` (change text element height to make text fit)
|
|
209
|
+
- `ellipsis` (add ellipsis to the end of the text)
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
const url = await instance.jsonToPDFDataURL(json, {
|
|
213
|
+
textOverflow: 'resize',
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
204
217
|
### `instance.run()`
|
|
205
218
|
|
|
206
219
|
Run any Polotno store API directly inside web-page context.
|
package/instance.js
CHANGED
|
@@ -124,6 +124,13 @@ module.exports.createInstance = async ({
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
+
if (args[1]?.textOverflow) {
|
|
128
|
+
await page.evaluate((overflow) => {
|
|
129
|
+
if (window.config && window.config.unstable_setTextOverflow) {
|
|
130
|
+
window.config.unstable_setTextOverflow(overflow);
|
|
131
|
+
}
|
|
132
|
+
}, args[1].textOverflow);
|
|
133
|
+
}
|
|
127
134
|
await page.evaluate(() => {
|
|
128
135
|
if (window.config?.onLoadError) {
|
|
129
136
|
window.config.onLoadError((error) => {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polotno-node",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Polotno workflow from NodeJS",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "ava",
|
|
7
|
+
"test": "ava --timeout=30s --concurrency 3",
|
|
8
8
|
"build": "rm -rf ./dist && npx vite build ./client/ --base=./ --outDir ../dist",
|
|
9
9
|
"dev": "vite ./client.html"
|
|
10
10
|
},
|