How to use contentful-ui-extensions-sdk - 10 common examples

To help you get started, we’ve selected a few contentful-ui-extensions-sdk 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 contentful / create-contentful-extension / packages / contentful-extension-scripts / template / javascript-sidebar / src / index.js View on Github external
onClick={this.onButtonClick}>
        Click on me to open dialog extension
      
    );
  }
}

export const initialize = sdk => {
  if (sdk.location.is(locations.LOCATION_DIALOG)) {
    ReactDOM.render(, document.getElementById('root'));
  } else {
    ReactDOM.render(, document.getElementById('root'));
  }
};

init(initialize);

/**
 * By default, iframe of the extension is fully reloaded on every save of a source file.
 * If you want to use HMR (hot module reload) instead of full reload, uncomment the following lines
 */
// if (module.hot) {
//   module.hot.accept();
// }
github contentful / ui-extensions-sdk / test / extensions / test-extension / src / index.js View on Github external
init(sdk => {
  window.sdk = sdk
  if (sdk.location.is(locations.LOCATION_ENTRY_FIELD)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_PAGE)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_EDITOR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_DIALOG)) {
    renderExtension()
  }
})
github contentful / ui-extensions-sdk / test / extensions / test-extension / src / index.js View on Github external
init(sdk => {
  window.sdk = sdk
  if (sdk.location.is(locations.LOCATION_ENTRY_FIELD)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_PAGE)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_EDITOR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_DIALOG)) {
    renderExtension()
  }
})
github contentful / ui-extensions-sdk / test / extensions / test-extension / src / index.js View on Github external
init(sdk => {
  window.sdk = sdk
  if (sdk.location.is(locations.LOCATION_ENTRY_FIELD)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_PAGE)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_EDITOR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_DIALOG)) {
    renderExtension()
  }
})
github contentful / ui-extensions-sdk / test / extensions / test-extension / src / index.js View on Github external
init(sdk => {
  window.sdk = sdk
  if (sdk.location.is(locations.LOCATION_ENTRY_FIELD)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_PAGE)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_EDITOR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_DIALOG)) {
    renderExtension()
  }
})
github contentful / ui-extensions-sdk / test / extensions / test-extension / src / index.js View on Github external
init(sdk => {
  window.sdk = sdk
  if (sdk.location.is(locations.LOCATION_ENTRY_FIELD)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_PAGE)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_ENTRY_EDITOR)) {
    renderExtension()
  } else if (sdk.location.is(locations.LOCATION_DIALOG)) {
    renderExtension()
  }
})
github contentful / extensions / marketplace / image-focal-point / src / index.js View on Github external
init(sdk => {
  if (sdk.location.is(locations.LOCATION_DIALOG)) {
    renderDialog(sdk);
  } else if (sdk.location.is(locations.LOCATION_APP)) {
    ReactDOM.render(, document.getElementById('root'));
  } else {
    ReactDOM.render(, document.getElementById('root'));
  }
});
github contentful / extensions / lib / shared-dam-app / src / index.tsx View on Github external
init(sdk => {
    const root = document.getElementById('root');

    if (sdk.location.is(locations.LOCATION_DIALOG)) {
      integration.renderDialog(sdk as DialogExtensionSDK);
    }

    if (sdk.location.is(locations.LOCATION_ENTRY_FIELD)) {
      render(
        ,
        root
      );
    }
github contentful / extensions / marketplace / readable / src / index.js View on Github external
init(extension => {
  extension.window.startAutoResizer();

  const rootElm = document.getElementById('root');

  if (extension.location.is(locations.LOCATION_ENTRY_SIDEBAR)) {
    ReactDOM.render(, rootElm);
  } else if (extension.location.is(locations.LOCATION_DIALOG)) {
    const { dialog } = extension.parameters.invocation;
    if (dialog === 'details') {
      ReactDOM.render(, rootElm);
    }
  }
});
github contentful / extensions / marketplace / commercetools-products / src / index.js View on Github external
init(extension => {
  const installationParameters = extension.parameters.installation;
  extension.window.startAutoResizer();

  if (extension.location.is(locations.LOCATION_ENTRY_FIELD)) {
    ReactDOM.render(
      ,
      document.getElementById('root')
    );
  } else if (extension.location.is(locations.LOCATION_DIALOG)) {
    ReactDOM.render(
      ,
      document.getElementById('root')
    );
  }
});