How to use the @lrnwebcomponents/haxcms-elements/lib/core/haxcms-site-store.js.store.cmsSiteEditorBackend function in @lrnwebcomponents/haxcms-elements

To help you get started, we’ve selected a few @lrnwebcomponents/haxcms-elements examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elmsln / lrnwebcomponents / elements / haxcms-elements / lib / core / haxcms-editor-builder.js View on Github external
// @todo may want to make this more flexible
        script.src = `../../haxcms-jwt`;
        fetch(script.src).then(response => {
          if (response.status != 404) {
            document.documentElement.appendChild(script);
          }
        });
      }
      // dynamic import if this isn't published tho we'll double check
      // that it's valid later
      if (context !== "published") {
        const basePath = this.pathFromUrl(decodeURIComponent(import.meta.url));
        // import and set the tag based on the context
        store.cmsSiteEditorBackend.tag = `haxcms-backend-${context}`;
        // delay import slightly to ensure global scope is there
        import(`${basePath}backends/${store.cmsSiteEditorBackend.tag}.js`).then(
          e => {
            if (!store.cmsSiteEditorBackend.instance) {
              store.cmsSiteEditorBackend.instance = document.createElement(
                store.cmsSiteEditorBackend.tag
              );
              document.body.append(store.cmsSiteEditorBackend.instance);
            }
          }
        );
      }
    }
  }
}
github elmsln / lrnwebcomponents / elements / haxcms-elements / lib / core / haxcms-editor-builder.js View on Github external
let script = document.createElement("script");
        // IF we're in a live environment this will always be 2 levels back
        // @todo may want to make this more flexible
        script.src = `../../haxcms-jwt`;
        fetch(script.src).then(response => {
          if (response.status != 404) {
            document.documentElement.appendChild(script);
          }
        });
      }
      // dynamic import if this isn't published tho we'll double check
      // that it's valid later
      if (context !== "published") {
        const basePath = this.pathFromUrl(decodeURIComponent(import.meta.url));
        // import and set the tag based on the context
        store.cmsSiteEditorBackend.tag = `haxcms-backend-${context}`;
        // delay import slightly to ensure global scope is there
        import(`${basePath}backends/${store.cmsSiteEditorBackend.tag}.js`).then(
          e => {
            if (!store.cmsSiteEditorBackend.instance) {
              store.cmsSiteEditorBackend.instance = document.createElement(
                store.cmsSiteEditorBackend.tag
              );
              document.body.append(store.cmsSiteEditorBackend.instance);
            }
          }
        );
      }
    }
  }
}
github elmsln / lrnwebcomponents / elements / haxcms-elements / lib / core / haxcms-editor-builder.js View on Github external
e => {
            if (!store.cmsSiteEditorBackend.instance) {
              store.cmsSiteEditorBackend.instance = document.createElement(
                store.cmsSiteEditorBackend.tag
              );
              document.body.append(store.cmsSiteEditorBackend.instance);
            }
          }
        );

@lrnwebcomponents/haxcms-elements

HAX CMS series of elements to provide a full on CMS

Apache-2.0
Latest version published 5 months ago

Package Health Score

69 / 100
Full package analysis

Popular @lrnwebcomponents/haxcms-elements functions