@adobe/create-ccweb-add-on 1.1.0 → 1.2.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/dist/app/WxpAddOnFactory.d.ts.map +1 -1
- package/dist/app/WxpAddOnFactory.js +6 -4
- package/dist/templates/javascript/template/src/add-on-ui-sdk.d.ts +7 -0
- package/dist/templates/javascript/template/src/index.html +1 -18
- package/dist/templates/javascript/template/src/index.js +15 -0
- package/dist/templates/javascript/template/tsconfig.json +14 -0
- package/dist/templates/javascript-with-document-sandbox/template/src/index.html +1 -26
- package/dist/templates/javascript-with-document-sandbox/template/src/manifest.json +2 -3
- package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
- package/dist/templates/javascript-with-document-sandbox/template/src/{code.js → sandbox/code.js} +4 -4
- package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
- package/dist/templates/javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +7 -0
- package/dist/templates/javascript-with-document-sandbox/template/src/ui/index.js +24 -0
- package/dist/templates/javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
- package/dist/templates/javascript-with-document-sandbox/template/tsconfig.json +14 -0
- package/dist/templates/react-javascript/template/src/add-on-ui-sdk.d.ts +7 -0
- package/dist/templates/react-javascript/template/tsconfig.json +13 -0
- package/dist/templates/react-javascript-with-document-sandbox/template/src/manifest.json +1 -2
- package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
- package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/code.js +4 -4
- package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
- package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +7 -0
- package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
- package/dist/templates/react-javascript-with-document-sandbox/template/tsconfig.json +13 -0
- package/dist/templates/react-typescript-with-document-sandbox/template/src/manifest.json +1 -2
- package/dist/templates/react-typescript-with-document-sandbox/template/src/sandbox/code.ts +4 -4
- package/dist/templates/typescript-with-document-sandbox/template/src/manifest.json +1 -2
- package/dist/templates/typescript-with-document-sandbox/template/src/sandbox/code.ts +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -6
- package/src/app/WxpAddOnFactory.ts +6 -5
- package/src/test/app/WxpAddOnFactory.spec.ts +6 -5
- package/templates/javascript/template/src/add-on-ui-sdk.d.ts +7 -0
- package/templates/javascript/template/src/index.html +1 -18
- package/templates/javascript/template/src/index.js +15 -0
- package/templates/javascript/template/tsconfig.json +14 -0
- package/templates/javascript-with-document-sandbox/template/src/index.html +1 -26
- package/templates/javascript-with-document-sandbox/template/src/manifest.json +2 -3
- package/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
- package/templates/javascript-with-document-sandbox/template/src/{code.js → sandbox/code.js} +4 -4
- package/templates/javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
- package/templates/javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +7 -0
- package/templates/javascript-with-document-sandbox/template/src/ui/index.js +24 -0
- package/templates/javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
- package/templates/javascript-with-document-sandbox/template/tsconfig.json +14 -0
- package/templates/react-javascript/template/src/add-on-ui-sdk.d.ts +7 -0
- package/templates/react-javascript/template/tsconfig.json +13 -0
- package/templates/react-javascript-with-document-sandbox/template/src/manifest.json +1 -2
- package/templates/react-javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
- package/templates/react-javascript-with-document-sandbox/template/src/sandbox/code.js +4 -4
- package/templates/react-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
- package/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +7 -0
- package/templates/react-javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
- package/templates/react-javascript-with-document-sandbox/template/tsconfig.json +13 -0
- package/templates/react-typescript-with-document-sandbox/template/src/manifest.json +1 -2
- package/templates/react-typescript-with-document-sandbox/template/src/sandbox/code.ts +4 -4
- package/templates/typescript-with-document-sandbox/template/src/manifest.json +1 -2
- package/templates/typescript-with-document-sandbox/template/src/sandbox/code.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WxpAddOnFactory.d.ts","sourceRoot":"","sources":["../../src/app/WxpAddOnFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAOtE,OAAO,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,qBACa,eAAgB,YAAW,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IACzD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAuB;IAC7D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAE9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD;;;;;;;;;;OAUG;gBAEoC,kBAAkB,EAAE,kBAAkB,EACpC,oBAAoB,EAAE,oBAAoB,EAC9C,gBAAgB,EAAE,gBAAgB,EACzB,UAAU,EAAE,eAAe,EACzC,UAAU,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACC,gBAAgB,EAAE,gBAAgB;IAchF;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"WxpAddOnFactory.d.ts","sourceRoot":"","sources":["../../src/app/WxpAddOnFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAOtE,OAAO,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,qBACa,eAAgB,YAAW,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IACzD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAuB;IAC7D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAE9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD;;;;;;;;;;OAUG;gBAEoC,kBAAkB,EAAE,kBAAkB,EACpC,oBAAoB,EAAE,oBAAoB,EAC9C,gBAAgB,EAAE,gBAAgB,EACzB,UAAU,EAAE,eAAe,EACzC,UAAU,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACC,gBAAgB,EAAE,gBAAgB;IAchF;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA0EhD,OAAO,CAAC,kBAAkB;CAc7B"}
|
|
@@ -90,10 +90,12 @@ let WxpAddOnFactory = class WxpAddOnFactory {
|
|
|
90
90
|
this._copyTemplateFiles(addOnDirectory, templateName);
|
|
91
91
|
const rootDirectory = process.cwd();
|
|
92
92
|
process.chdir(addOnDirectory);
|
|
93
|
-
const devDependencyArgs = [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
const devDependencyArgs = [
|
|
94
|
+
"install",
|
|
95
|
+
"--save-dev",
|
|
96
|
+
"@adobe/ccweb-add-on-scripts",
|
|
97
|
+
"@adobe/ccweb-add-on-sdk-types"
|
|
98
|
+
];
|
|
97
99
|
if (options.verbose) {
|
|
98
100
|
devDependencyArgs.push("--verbose");
|
|
99
101
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// DO NOT modify this file.
|
|
2
|
+
|
|
3
|
+
declare module "https://new.express.adobe.com/static/add-on-sdk/sdk.js" {
|
|
4
|
+
import { AddOnUISdkTypes } from "@adobe/ccweb-add-on-sdk-types";
|
|
5
|
+
export default AddOnUISdkTypes.default;
|
|
6
|
+
export * from "@adobe/ccweb-add-on-sdk-types/ui/ui-sdk";
|
|
7
|
+
}
|
|
@@ -42,23 +42,6 @@
|
|
|
42
42
|
<div class="container">
|
|
43
43
|
<button id="clickMe" disabled>Click me</button>
|
|
44
44
|
</div>
|
|
45
|
-
|
|
46
|
-
<script type="module">
|
|
47
|
-
import addOnUISdk from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
|
|
48
|
-
|
|
49
|
-
addOnUISdk.ready.then(() => {
|
|
50
|
-
console.log("addOnUISdk is ready for use.");
|
|
51
|
-
|
|
52
|
-
const clickMeButton = document.getElementById("clickMe");
|
|
53
|
-
clickMeButton.addEventListener("click", () => {
|
|
54
|
-
clickMeButton.innerHTML = "Clicked";
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Enable the button only when:
|
|
58
|
-
// 1. `addOnUISdk` is ready, and
|
|
59
|
-
// 2. `click` event listener is registered.
|
|
60
|
-
clickMeButton.disabled = false;
|
|
61
|
-
});
|
|
62
|
-
</script>
|
|
45
|
+
<script type="module" src="index.js"></script>
|
|
63
46
|
</body>
|
|
64
47
|
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import addOnUISdk from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
|
|
2
|
+
|
|
3
|
+
addOnUISdk.ready.then(() => {
|
|
4
|
+
console.log("addOnUISdk is ready for use.");
|
|
5
|
+
|
|
6
|
+
const clickMeButton = document.getElementById("clickMe");
|
|
7
|
+
clickMeButton.addEventListener("click", () => {
|
|
8
|
+
clickMeButton.innerHTML = "Clicked";
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// Enable the button only when:
|
|
12
|
+
// 1. `addOnUISdk` is ready, and
|
|
13
|
+
// 2. `click` event listener is registered.
|
|
14
|
+
clickMeButton.disabled = false;
|
|
15
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"experimentalDecorators": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
"useDefineForClassFields": false
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["node_modules"],
|
|
13
|
+
"include": ["src/**/*"]
|
|
14
|
+
}
|
|
@@ -46,31 +46,6 @@
|
|
|
46
46
|
<button id="createRectangle" disabled>Create Rectangle</button>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
49
|
-
<script type="module">
|
|
50
|
-
import addOnUISdk from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
|
|
51
|
-
|
|
52
|
-
addOnUISdk.ready.then(async () => {
|
|
53
|
-
console.log("addOnUISdk is ready for use.");
|
|
54
|
-
|
|
55
|
-
// Get the UI runtime.
|
|
56
|
-
const { runtime } = addOnUISdk.instance;
|
|
57
|
-
|
|
58
|
-
// Get the proxy object, which is required
|
|
59
|
-
// to call the APIs defined in the Document Sandbox runtime
|
|
60
|
-
// i.e., in the `code.js` file of this add-on.
|
|
61
|
-
const sandboxProxy = await runtime.apiProxy("documentSandbox");
|
|
62
|
-
|
|
63
|
-
const createRectangleButton = document.getElementById("createRectangle");
|
|
64
|
-
createRectangleButton.addEventListener("click", async event => {
|
|
65
|
-
await sandboxProxy.createRectangle();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Enable the button only when:
|
|
69
|
-
// 1. `addOnUISdk` is ready,
|
|
70
|
-
// 2. `sandboxProxy` is available, and
|
|
71
|
-
// 3. `click` event listener is registered.
|
|
72
|
-
createRectangleButton.disabled = false;
|
|
73
|
-
});
|
|
74
|
-
</script>
|
|
49
|
+
<script type="module" src="ui/index.js"></script>
|
|
75
50
|
</body>
|
|
76
51
|
</html>
|
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
"name": "Express",
|
|
10
10
|
"apiVersion": 1
|
|
11
11
|
}
|
|
12
|
-
]
|
|
13
|
-
"experimentalApis": true
|
|
12
|
+
]
|
|
14
13
|
},
|
|
15
14
|
"entryPoints": [
|
|
16
15
|
{
|
|
17
16
|
"type": "panel",
|
|
18
17
|
"id": "panel1",
|
|
19
18
|
"main": "index.html",
|
|
20
|
-
"documentSandbox": "code.js"
|
|
19
|
+
"documentSandbox": "sandbox/code.js"
|
|
21
20
|
}
|
|
22
21
|
]
|
|
23
22
|
}
|
package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// DO NOT modify this file.
|
|
2
|
+
|
|
3
|
+
declare module "add-on-sdk-document-sandbox" {
|
|
4
|
+
import { AddOnDocumentSandboxSdkTypes } from "@adobe/ccweb-add-on-sdk-types";
|
|
5
|
+
export default AddOnDocumentSandboxSdkTypes.default;
|
|
6
|
+
export * from "@adobe/ccweb-add-on-sdk-types/sandbox/add-on-sdk-document-sandbox";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module "express-document-sdk" {
|
|
10
|
+
export * from "@adobe/ccweb-add-on-sdk-types/sandbox/express-document-sdk";
|
|
11
|
+
}
|
package/dist/templates/javascript-with-document-sandbox/template/src/{code.js → sandbox/code.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import addOnSandboxSdk from "add-on-sdk-document-sandbox";
|
|
2
|
-
import { editor
|
|
2
|
+
import { editor } from "express-document-sdk";
|
|
3
3
|
|
|
4
4
|
// Get the document sandbox runtime.
|
|
5
5
|
const { runtime } = addOnSandboxSdk.instance;
|
|
@@ -19,11 +19,11 @@ function start() {
|
|
|
19
19
|
rectangle.translation = { x: 10, y: 10 };
|
|
20
20
|
|
|
21
21
|
// Define rectangle color.
|
|
22
|
-
const
|
|
22
|
+
const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
|
|
23
23
|
|
|
24
24
|
// Fill the rectangle with the color.
|
|
25
|
-
const rectangleFill = editor.
|
|
26
|
-
rectangle.
|
|
25
|
+
const rectangleFill = editor.makeColorFill(color);
|
|
26
|
+
rectangle.fill = rectangleFill;
|
|
27
27
|
|
|
28
28
|
// Add the rectangle to the document.
|
|
29
29
|
const insertionParent = editor.context.insertionParent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// DO NOT modify this file.
|
|
2
|
+
|
|
3
|
+
declare module "https://new.express.adobe.com/static/add-on-sdk/sdk.js" {
|
|
4
|
+
import { AddOnUISdkTypes } from "@adobe/ccweb-add-on-sdk-types";
|
|
5
|
+
export default AddOnUISdkTypes.default;
|
|
6
|
+
export * from "@adobe/ccweb-add-on-sdk-types/ui/ui-sdk";
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import addOnUISdk from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
|
|
2
|
+
|
|
3
|
+
addOnUISdk.ready.then(async () => {
|
|
4
|
+
console.log("addOnUISdk is ready for use.");
|
|
5
|
+
|
|
6
|
+
// Get the UI runtime.
|
|
7
|
+
const { runtime } = addOnUISdk.instance;
|
|
8
|
+
|
|
9
|
+
// Get the proxy object, which is required
|
|
10
|
+
// to call the APIs defined in the Document Sandbox runtime
|
|
11
|
+
// i.e., in the `code.js` file of this add-on.
|
|
12
|
+
const sandboxProxy = await runtime.apiProxy("documentSandbox");
|
|
13
|
+
|
|
14
|
+
const createRectangleButton = document.getElementById("createRectangle");
|
|
15
|
+
createRectangleButton.addEventListener("click", async event => {
|
|
16
|
+
await sandboxProxy.createRectangle();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Enable the button only when:
|
|
20
|
+
// 1. `addOnUISdk` is ready,
|
|
21
|
+
// 2. `sandboxProxy` is available, and
|
|
22
|
+
// 3. `click` event listener is registered.
|
|
23
|
+
createRectangleButton.disabled = false;
|
|
24
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"experimentalDecorators": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
"useDefineForClassFields": false
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["node_modules"],
|
|
13
|
+
"include": ["src/**/*"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// DO NOT modify this file.
|
|
2
|
+
|
|
3
|
+
declare module "https://new.express.adobe.com/static/add-on-sdk/sdk.js" {
|
|
4
|
+
import { AddOnUISdkTypes } from "@adobe/ccweb-add-on-sdk-types";
|
|
5
|
+
export default AddOnUISdkTypes.default;
|
|
6
|
+
export * from "@adobe/ccweb-add-on-sdk-types/ui/ui-sdk";
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"jsx": "react",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"target": "ESNext"
|
|
10
|
+
},
|
|
11
|
+
"exclude": ["node_modules"],
|
|
12
|
+
"include": ["src/**/*"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// DO NOT modify this file.
|
|
2
|
+
|
|
3
|
+
declare module "add-on-sdk-document-sandbox" {
|
|
4
|
+
import { AddOnDocumentSandboxSdkTypes } from "@adobe/ccweb-add-on-sdk-types";
|
|
5
|
+
export default AddOnDocumentSandboxSdkTypes.default;
|
|
6
|
+
export * from "@adobe/ccweb-add-on-sdk-types/sandbox/add-on-sdk-document-sandbox";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module "express-document-sdk" {
|
|
10
|
+
export * from "@adobe/ccweb-add-on-sdk-types/sandbox/express-document-sdk";
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import addOnSandboxSdk from "add-on-sdk-document-sandbox";
|
|
2
|
-
import { editor
|
|
2
|
+
import { editor } from "express-document-sdk";
|
|
3
3
|
|
|
4
4
|
// Get the document sandbox runtime.
|
|
5
5
|
const { runtime } = addOnSandboxSdk.instance;
|
|
@@ -19,11 +19,11 @@ function start() {
|
|
|
19
19
|
rectangle.translation = { x: 10, y: 10 };
|
|
20
20
|
|
|
21
21
|
// Define rectangle color.
|
|
22
|
-
const
|
|
22
|
+
const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
|
|
23
23
|
|
|
24
24
|
// Fill the rectangle with the color.
|
|
25
|
-
const rectangleFill = editor.
|
|
26
|
-
rectangle.
|
|
25
|
+
const rectangleFill = editor.makeColorFill(color);
|
|
26
|
+
rectangle.fill = rectangleFill;
|
|
27
27
|
|
|
28
28
|
// Add the rectangle to the document.
|
|
29
29
|
const insertionParent = editor.context.insertionParent;
|
package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// DO NOT modify this file.
|
|
2
|
+
|
|
3
|
+
declare module "https://new.express.adobe.com/static/add-on-sdk/sdk.js" {
|
|
4
|
+
import { AddOnUISdkTypes } from "@adobe/ccweb-add-on-sdk-types";
|
|
5
|
+
export default AddOnUISdkTypes.default;
|
|
6
|
+
export * from "@adobe/ccweb-add-on-sdk-types/ui/ui-sdk";
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"jsx": "react",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"target": "ESNext"
|
|
10
|
+
},
|
|
11
|
+
"exclude": ["node_modules"],
|
|
12
|
+
"include": ["src/**/*"]
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import addOnSandboxSdk from "add-on-sdk-document-sandbox";
|
|
2
|
-
import { editor
|
|
2
|
+
import { editor } from "express-document-sdk";
|
|
3
3
|
import { DocumentSandboxApi } from "../models/DocumentSandboxApi";
|
|
4
4
|
|
|
5
5
|
// Get the document sandbox runtime.
|
|
@@ -20,11 +20,11 @@ function start(): void {
|
|
|
20
20
|
rectangle.translation = { x: 10, y: 10 };
|
|
21
21
|
|
|
22
22
|
// Define rectangle color.
|
|
23
|
-
const
|
|
23
|
+
const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
|
|
24
24
|
|
|
25
25
|
// Fill the rectangle with the color.
|
|
26
|
-
const rectangleFill = editor.
|
|
27
|
-
rectangle.
|
|
26
|
+
const rectangleFill = editor.makeColorFill(color);
|
|
27
|
+
rectangle.fill = rectangleFill;
|
|
28
28
|
|
|
29
29
|
// Add the rectangle to the document.
|
|
30
30
|
const insertionParent = editor.context.insertionParent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import addOnSandboxSdk from "add-on-sdk-document-sandbox";
|
|
2
|
-
import { editor
|
|
2
|
+
import { editor } from "express-document-sdk";
|
|
3
3
|
import { DocumentSandboxApi } from "../models/DocumentSandboxApi";
|
|
4
4
|
|
|
5
5
|
// Get the document sandbox runtime.
|
|
@@ -20,11 +20,11 @@ function start(): void {
|
|
|
20
20
|
rectangle.translation = { x: 10, y: 10 };
|
|
21
21
|
|
|
22
22
|
// Define rectangle color.
|
|
23
|
-
const
|
|
23
|
+
const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
|
|
24
24
|
|
|
25
25
|
// Fill the rectangle with the color.
|
|
26
|
-
const rectangleFill = editor.
|
|
27
|
-
rectangle.
|
|
26
|
+
const rectangleFill = editor.makeColorFill(color);
|
|
27
|
+
rectangle.fill = rectangleFill;
|
|
28
28
|
|
|
29
29
|
// Add the rectangle to the document.
|
|
30
30
|
const insertionParent = editor.context.insertionParent;
|