polotno-node 2.0.0 → 2.0.2
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 +17 -0
- package/dist/{client.f7f82675.js → client.0ebb7c1e.js} +1259 -1235
- package/dist/client.html +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -152,6 +152,23 @@ const url = await instance.run(async (json) => {
|
|
|
152
152
|
}, json);
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
+
## Your own client
|
|
156
|
+
|
|
157
|
+
By default `polotno-node` ships with the default Polotno Editor with its (hopefully) last version. If you use experimental API such as `unstable_registerShapeModel` and `unstable_registerShapeComponent`, the rendering may fail if you use unknow elements types.
|
|
158
|
+
|
|
159
|
+
In that case you can use your own client editor. You need to create a public html page with `store` as global variable and mount just `<Workspace />` component from `polotno/canvas` module. Take a look into `client.html` file and `client.js` file in this repo as a demo. In your own version of the Editor you can use experimental API to define custom components.
|
|
160
|
+
|
|
161
|
+
Pass `url` option to `createInstance` function with public url of your client editor.
|
|
162
|
+
|
|
163
|
+
```js
|
|
164
|
+
const { createInstance } = require('polotno-node');
|
|
165
|
+
|
|
166
|
+
const instance = await createInstance({
|
|
167
|
+
key: 'KEY',
|
|
168
|
+
url: 'https://yourappdomain.com/client',
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
155
172
|
## Browserless usage
|
|
156
173
|
|
|
157
174
|
By default `polotno-node` will import browser bundle using `chrome-aws-lambda`. But you can use `browserless` instead, to keep your cloud function smaller.
|