lucid-extension-sdk 0.0.215 → 0.0.216

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.
@@ -9,11 +9,23 @@
9
9
  export declare const DEFAULT_IFRAME_WIDTH: number;
10
10
  export declare const DEFAULT_IFRAME_HEIGHT: number;
11
11
  /** @ignore */
12
- export interface IframeAttributes {
12
+ export type IframeAttributes =
13
+ /**
14
+ * This type syntax makes it so either src or srcdoc is always provided, but never both.
15
+ */
16
+ ({
13
17
  /**
14
18
  * The source url
15
19
  */
16
20
  src: string;
21
+ srcdoc?: undefined;
22
+ } | {
23
+ /**
24
+ * The html content of the iframe if not using a source url
25
+ */
26
+ srcdoc: string;
27
+ src?: undefined;
28
+ }) & {
17
29
  /**
18
30
  * The iFrame height
19
31
  */
@@ -26,7 +38,7 @@ export interface IframeAttributes {
26
38
  * The iFrame title for accessibility
27
39
  */
28
40
  title?: string;
29
- }
41
+ };
30
42
  /**
31
43
  * Generate iframe HTML from the IFrameAttributes object
32
44
  * @returns the generated iframe HTML
@@ -54,6 +54,13 @@ exports.generateIFrameHTML = generateIFrameHTML;
54
54
  */
55
55
  function parseIFrameAttributesFromHTML(iframeHTML) {
56
56
  var _a, _b, _c, _d, _e, _f;
57
+ if (!iframeHTML.startsWith('<iframe')) {
58
+ return {
59
+ srcdoc: iframeHTML,
60
+ height: exports.DEFAULT_IFRAME_HEIGHT,
61
+ width: exports.DEFAULT_IFRAME_WIDTH,
62
+ };
63
+ }
57
64
  const src = (_b = (_a = iframeHTML.match(iframeRegExps.src)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
58
65
  const height = (_c = iframeHTML.match(iframeRegExps.height)) === null || _c === void 0 ? void 0 : _c[1];
59
66
  const width = (_d = iframeHTML.match(iframeRegExps.width)) === null || _d === void 0 ? void 0 : _d[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.215",
3
+ "version": "0.0.216",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",