lucid-extension-sdk 0.0.57 → 0.0.58

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -1,4 +1,5 @@
1
1
  import { isString } from '../checks';
2
+ import { IframeAttributes } from '../iframe/iframeutils';
2
3
  /**
3
4
  * An enumeration of of the supported unfurl Iframe aspect ratio.
4
5
  * The iframe will be maximized to fit the screen responsively
@@ -64,3 +65,4 @@ export declare function serializeUnfurlIframe(concrete: UnfurlIframe): Serialize
64
65
  export declare function getIFrameHeight(unfurlIframeAspectRatio: UnfurlIframeAspectRatio): number;
65
66
  /** @ignore */
66
67
  export declare function getIFrameWidth(unfurlIframeAspectRatio: UnfurlIframeAspectRatio): number;
68
+ export declare function generateIframeAttributes(unfurlIframe: UnfurlIframe): IframeAttributes;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIFrameWidth = exports.getIFrameHeight = exports.serializeUnfurlIframe = exports.deserializeUnfurlIframe = exports.isValidUnfurlIframe = exports.UnfurlIframeAspectRatio = void 0;
3
+ exports.generateIframeAttributes = exports.getIFrameWidth = exports.getIFrameHeight = exports.serializeUnfurlIframe = exports.deserializeUnfurlIframe = exports.isValidUnfurlIframe = exports.UnfurlIframeAspectRatio = void 0;
4
4
  const checks_1 = require("../checks");
5
+ const iframeutils_1 = require("../iframe/iframeutils");
5
6
  const validators_1 = require("../validators/validators");
6
7
  /**
7
8
  * An enumeration of of the supported unfurl Iframe aspect ratio.
@@ -91,3 +92,13 @@ function getIFrameWidth(unfurlIframeAspectRatio) {
91
92
  }
92
93
  }
93
94
  exports.getIFrameWidth = getIFrameWidth;
95
+ function generateIframeAttributes(unfurlIframe) {
96
+ const iframeAttributes = {
97
+ src: unfurlIframe.iframeUrl,
98
+ height: unfurlIframe.aspectRatio ? getIFrameHeight(unfurlIframe.aspectRatio) : iframeutils_1.DEFAULT_IFRAME_HEIGHT,
99
+ width: unfurlIframe.aspectRatio ? getIFrameWidth(unfurlIframe.aspectRatio) : iframeutils_1.DEFAULT_IFRAME_WIDTH,
100
+ title: unfurlIframe.iframeTitle,
101
+ };
102
+ return iframeAttributes;
103
+ }
104
+ exports.generateIframeAttributes = generateIframeAttributes;
@@ -41,12 +41,7 @@ class ExperimentalLinkUnfurlBlockProxy extends blockproxy_1.BlockProxy {
41
41
  * @ignore
42
42
  */
43
43
  setIframe(unfurlIframe) {
44
- const iframeAttributes = {
45
- src: unfurlIframe.iframeUrl,
46
- height: unfurlIframe.aspectRatio ? (0, unfurliframe_1.getIFrameHeight)(unfurlIframe.aspectRatio) : iframeutils_1.DEFAULT_IFRAME_HEIGHT,
47
- width: unfurlIframe.aspectRatio ? (0, unfurliframe_1.getIFrameWidth)(unfurlIframe.aspectRatio) : iframeutils_1.DEFAULT_IFRAME_WIDTH,
48
- title: unfurlIframe.iframeTitle,
49
- };
44
+ const iframeAttributes = (0, unfurliframe_1.generateIframeAttributes)(unfurlIframe);
50
45
  this.properties.set('LinkUnfurlIframeHtml', (0, iframeutils_1.generateIFrameHTML)(iframeAttributes));
51
46
  this.properties.set('LinkUnfurlIframeHeight', iframeAttributes.height);
52
47
  this.properties.set('LinkUnfurlIframeWidth', iframeAttributes.width);