Embedded confluence public - Components of embedded pages

Components

View Page

@atlaskit/embedded-confluence exports ViewPage component.

Within your React component, you can import the component from the package and then compose it.

// Given a confluence page located at: // https://acmeexample.atlassian.net/wiki/spaces/ABC/pages/1234 // and given parentProduct value = "PRODUCT" import { ViewPage } from '@atlaskit/embedded-confluence'; import { useThemeObserver } from '@atlaskit/tokens'; const MyComponent = (props) => { //Get the themeState Object from useThemeObserver or you can create your own Object for 3rd party products const themeState = useThemeObserver(); //For the latest list of supported fields in `themeState` Object please visit the design systems documentation : https://atlassian.design/components/tokens/code#setglobalthemethemestate-themeloader return ( <ArticleWrapper> <ViewPage contentId={'1234'} locale={'en-US'} hostname={'acmeexample.atlassian.net'} parentProduct={'PRODUCT'} spaceKey={'ABC'} themeState={themeState} /> </ArticleWrapper> ); };

Component API

Property nameTypeDescription
allowedFeaturesstring[](Optional) - If provided, only features included in the list will be enabled, features not in the list will be disabled. [] will disable all features. 'all' will enable all features. If not provided, default features: byline-contributors, byline-extensions, page-comments, page-reactions, will be enabled. see description for more.
classNamestring(Optional) - If provided, the custom class name will be added on the container element
contentIdstringThe Id of content from Confluence perspective
hostnamestringThe Confluence Cloud tenant you want to connect to. This is required when 3rd party is on a different domain than Confluence
isHeightSetFromContent boolean(Optional) - If provided, the height of the view component will be set to the height of the confluence content being rendered
localestring(Optional) - Locale string for localization. The default locale is "en-US". Please refer to API-References page for a list of other valid values.
navigationPolicyObject, see definition(Optional) See description and examples
parentProductstringValue that is associated with corresponding platform that is embedding Confluence pages. Required to properly embed. If unsure of what this string value is, please reach out to Atlassian/an Atlassian representative.
spaceKeystringThe key of space the content belongs to, from Confluence perspective.
themeStateThemeState, see definition(Optional) An optional value that represents the theme preference of the platform that is embedding Confluence pages. For the latest list of supported fields in themeState Object please visit the design systems documentation here

Edit Page

@atlaskit/embedded-confluence exports EditPage component.

Within your React component, you can import the component from the package and then compose it.

// Given a confluence page located at: // https://acmeexample.atlassian.net/wiki/spaces/ABC/pages/edit-v2/1234 // and given parentProduct value = "PRODUCT" import { EditPage } from '@atlaskit/embedded-confluence'; import { useThemeObserver } from '@atlaskit/tokens'; const MyComponent = (props) => { //Get the themeState Object from useThemeObserver or you can create your own Object for 3rd party products const themeState = useThemeObserver(); // For the latest list of supported fields in `themeState` Object please visit the design systems documentation : https://atlassian.design/components/tokens/code#setglobalthemethemestate-themeloader return ( <ArticleWrapper> <EditPage contentId={'1234'} locale={'en-US'} hostname={'acmeexample.atlassian.net'} parentProduct={'PRODUCT'} spaceKey={'ABC'} themeState={themeState} /> </ArticleWrapper> ); };

Component API

Property nameTypeDescription
allowedFeaturesstring[](Optional) - If provided, only features included in the list will be enabled, features not in the list will be disabled. [] will disable all features. 'all' will enable all features. If not provided, default features (none so far in the editing mode) will be enabled. see description for more.
contentIdstringThe Id of content from Confluence perspective
draftShareIdstring(Optional) - It is required only for Unpublished Draft. Unpublished Draft is a Confluence page that has not been published yet. Users (with exception the author) needs a valid draftShareId to have permission to view it. When a page is created, Confluence will generate a draftShareId.
hostnamestringThe Confluence Cloud tenant you want to connect to. This is required when 3rd party is on a different domain than Confluence
navigationPolicyObject, see definition(Optional) - (See description and examples
localestring(Optional) - Locale string for localization. The default locale is "en-US".
parentProductstringValue that is associated with corresponding platform that is embedding Confluence pages. Required to properly embed. If unsure of what this string value is, please reach out to Atlassian/an Atlassian representative.
themeStateThemeState, see definition(Optional) An optional value that represents the theme preference of the platform that is embedding Confluence pages. For the latest list of supported fields in themeState Object please visit the design systems documentation here

Note

  • To handle navigation when user click on the "Close" button, please subscribe to experience tracker event: "taskSuccess" of "edit-page/close" experience. Please refer to Experience Tracker section for more details.
  • To handle navigation when publish is successful after user click on the "Publish" button, please subscribe to experience tracker event: "taskSuccess" of "edit-page/publish" experience. For failed publish, you can subscribe to "taskFail" of the "edit-page/publish" experience. Please refer to Experience Tracker section for more details.

Page

@atlaskit/embedded-confluence exports Page component.

Within your React component, you can import the component from the package and then compose it.

Unlike ViewPage, the Page component renders the ViewPage component that can then be switched between View and Edit components. url:string is a highly recommended property to be passed in. Page parses this URL and extracts properties including protocol, hostname, content id, space key, parent product. If any of those URL-parsed properties are also explicitly passed in, then those passed-in properties will take priority over URL-parsed properties. The URL does not have to include a protocol or domain. Protocol by default will be "https:" and domain will be default be the same as window.location.

Page matches this URL against a predicate of routes that embedded Confluence will support. Currently we support the following routes:

  • View Page: /wiki/spaces/:spaceKey/pages/:contentId(\\d+)/:contentSlug?
  • View Blog: /wiki/spaces/:spaceKey/blog/:contentId(\\d+)/:contentSlug?
  • View Blog Date Legacy: /wiki/spaces/:spaceKey/blog/:year(\\d+)/:month(\\d+)/:day(\\d+)/:contentId(\\d+)/:contentSlug?

If an unsupported URL is passed in, you should be able to see the corresponding error message in the console and Page will not render anything.

Note

In case of the unpublished draft page, Page component can't display a ViewPage because the actual page for View doesn't exist. For this case, Parent Product should use the EditPage component instead.

// Given a confluence page located at: // https://acmeexample.atlassian.net/wiki/spaces/ABC/pages/1234 // and given parentProduct value = "PRODUCT" import { Page } from '@atlaskit/embedded-confluence'; const MyComponent = (props) => { return ( <ArticleWrapper> <Page url={'https://acmeexample.atlassian.net/wiki/spaces/ABC/pages/123?parentProduct=PRODUCT'} /> </ArticleWrapper> ); };

Component API

Property nameTypeDescription
allowedFeaturesobject(Optional) An object which has view and edit keys which provide allowedFeatures props for both View and Edit components. See description for more.
classNamestring(Optional) If provided, the custom class name will be added on the container element
contentIdstring(Optional) The Id of content from Confluence perspective
hashstring(Optional) Points a browser to a specific spot within a Confluence page.
hostnamestring(Optional) The Confluence Cloud tenant you want to connect to. This is required when parent product is on a different domain than Confluence
localestring(Optional) Locale string for localization. The default locale is "en-US".
navigationPolicyObject, see definition(Optional) See description and examples
parentProductstring(Optional) The parent product name string supported by Embedded Component
parentProductContentContainerIdstring(Optional) The Id of the parent product that have a mapping relationship with Confluence space. For example, for Jira, this could be the project Id. JSM can enable unlicensed user access by passing this prop.
parentProductContentIdstring(Optional) The Id of content from parent product perspective. For example, for JSM, this could be the KB article Id.
spaceKeystring(Optional) The key of space the content belongs to, from Confluence perspective.
themeStateObject(Optional) an optional prop that can be provided to the Embedded components to ensure that they apply the same theme preference as their parent product. For the latest list of supported fields in themeState Object please visit the design systems documentation here. If no themeState is provided, the Embedded component will display with it's original styles.
urlstring(Optional) If provided, contentId, spaceKey, parentProduct, hostname, protocol, draftShareId and queries will be parsed from the URL. If those properties are provided along with url, then those properties takes priority over parsed properties from the url

** Even though all properties are optional, the required properties for Page to render an embedded Confluence page are contentId, spaceKey, and parentProduct. They can be passed in either explicitly or via URL.

Components

View Page

@atlaskit/embedded-confluence exports ViewPage component.

Within your React component, you can import the component from the package and then compose it.

// Given a confluence page located at: // https://acmeexample.atlassian.net/wiki/spaces/ABC/pages/1234 // and given parentProduct value = "PRODUCT" import { ViewPage } from '@atlaskit/embedded-confluence'; import { useThemeObserver } from '@atlaskit/tokens'; const MyComponent = (props) => { //Get the themeState Object from useThemeObserver or you can create your own Object for 3rd party products const themeState = useThemeObserver(); // For the latest list of supported fields in `themeState` Object please visit the design systems documentation : https://atlassian.design/components/tokens/code#setglobalthemethemestate-themeloader return ( <ArticleWrapper> <ViewPage contentId={'1234'} locale={'en-US'} hostname={'acmeexample.atlassian.net'} parentProduct={'PRODUCT'} spaceKey={'ABC'} themeState={themeState} /> </ArticleWrapper> ); };

Component API

Property nameTypeDescription
allowedFeaturesstring[](Optional) - If provided, only features included in the list will be enabled, features not in the list will be disabled. [] will disable all features. 'all' will enable all features. If not provided, default features: byline-contributors, byline-extensions, page-comments, page-reactions, will be enabled. see description for more.
classNamestring(Optional) - If provided, the custom class name will be added on the container element
contentIdstringThe Id of content from Confluence perspective
hostnamestringThe Confluence Cloud tenant you want to connect to. This is required when 3rd party is on a different domain than Confluence
isHeightSetFromContent boolean(Optional) - If provided, the height of the view component will be set to the height of the confluence content being rendered
localestring(Optional) - Locale string for localization. The default locale is "en-US". Please refer to API-References page for a list of other valid values.
navigationPolicyObject, see definition(Optional) See description and examples
parentProductstringValue that is associated with corresponding platform that is embedding Confluence pages. Required to properly embed. If unsure of what this string value is, please reach out to Atlassian/an Atlassian representative.
spaceKeystringThe key of space the content belongs to, from Confluence perspective.
themeStateThemeState, see definition(Optional) An optional value that represents the theme preference of the platform that is embedding Confluence pages. For the latest list of supported fields in themeState Object please visit the design systems documentation here.

Edit Page

@atlaskit/embedded-confluence exports EditPage component.

Within your React component, you can import the component from the package and then compose it.

// Given a confluence page located at: // https://acmeexample.atlassian.net/wiki/spaces/ABC/pages/edit-v2/1234 // and given parentProduct value = "PRODUCT" import { EditPage } from '@atlaskit/embedded-confluence'; import { useThemeObserver } from '@atlaskit/tokens'; const MyComponent = (props) => { //Get the themeState Object from useThemeObserver or you can create your own Object for 3rd party products const themeState = useThemeObserver(); // For the latest list of supported fields in `themeState` Object please visit the design systems documentation : https://atlassian.design/components/tokens/code#setglobalthemethemestate-themeloader return ( <ArticleWrapper> <EditPage contentId={'1234'} locale={'en-US'} hostname={'acmeexample.atlassian.net'} parentProduct={'PRODUCT'} spaceKey={'ABC'} themeState={themeState} /> </ArticleWrapper> ); };

Component API

Property nameTypeDescription
allowedFeaturesstring[](Optional) - If provided, only features included in the list will be enabled, features not in the list will be disabled. [] will disable all features. 'all' will enable all features. If not provided, default features (none so far in the editing mode) will be enabled. see description for more.
contentIdstringThe Id of content from Confluence perspective
draftShareIdstring(Optional) - It is required only for Unpublished Draft. Unpublished Draft is a Confluence page that has not been published yet. Users (with exception the author) needs a valid draftShareId to have permission to view it. When a page is created, Confluence will generate a draftShareId.
hostnamestringThe Confluence Cloud tenant you want to connect to. This is required when 3rd party is on a different domain than Confluence
navigationPolicyObject, see definition(Optional) - (See description and examples
localestring(Optional) - Locale string for localization. The default locale is "en-US".
parentProductstringValue that is associated with corresponding platform that is embedding Confluence pages. Required to properly embed. If unsure of what this string value is, please reach out to Atlassian/an Atlassian representative.
themeStateThemeState, see definition(Optional) An optional value that represents the theme preference of the platform that is embedding Confluence pages. For the latest list of supported fields in themeState Object please visit the design systems documentation here.

Note

  • To handle navigation when user click on the "Close" button, please subscribe to experience tracker event: "taskSuccess" of "edit-page/close" experience. Please refer to Experience Tracker section for more details.
  • To handle navigation when publish is successful after user click on the "Publish" button, please subscribe to experience tracker event: "taskSuccess" of "edit-page/publish" experience. For failed publish, you can subscribe to "taskFail" of the "edit-page/publish" experience. Please refer to Experience Tracker section for more details.

Page

@atlaskit/embedded-confluence exports Page component.

Within your React component, you can import the component from the package and then compose it.

Unlike ViewPage, the Page component renders the ViewPage component that can then be switched between View and Edit components. url:string is a highly recommended property to be passed in. Page parses this URL and extracts properties including protocol, hostname, content id, space key, parent product. If any of those URL-parsed properties are also explicitly passed in, then those passed-in properties will take priority over URL-parsed properties. The URL does not have to include a protocol or domain. Protocol by default will be "https:" and domain will be default be the same as window.location.

Page matches this URL against a predicate of routes that embedded Confluence will support. Currently we support the following routes:

  • View Page: /wiki/spaces/:spaceKey/pages/:contentId(\\d+)/:contentSlug?
  • View Blog: /wiki/spaces/:spaceKey/blog/:contentId(\\d+)/:contentSlug?
  • View Blog Date Legacy: /wiki/spaces/:spaceKey/blog/:year(\\d+)/:month(\\d+)/:day(\\d+)/:contentId(\\d+)/:contentSlug?

If an unsupported URL is passed in, you should be able to see the corresponding error message in the console and Page will not render anything.

Note

In case of the unpublished draft page, Page component can't display a ViewPage because the actual page for View doesn't exist. For this case, Parent Product should use the EditPage component instead.

// Given a confluence page located at: // https://acmeexample.atlassian.net/wiki/spaces/ABC/pages/1234 // and given parentProduct value = "PRODUCT" import { Page } from '@atlaskit/embedded-confluence'; const MyComponent = (props) => { return ( <ArticleWrapper> <Page url={'https://acmeexample.atlassian.net/wiki/spaces/ABC/pages/123?parentProduct=PRODUCT'} /> </ArticleWrapper> ); };

Component API

Property nameTypeDescription
allowedFeaturesobject(Optional) An object which has view and edit keys which provide allowedFeatures props for both View and Edit components. See description for more.
classNamestring(Optional) If provided, the custom class name will be added on the container element
contentIdstring(Optional) The Id of content from Confluence perspective
hashstring(Optional) Points a browser to a specific spot within a Confluence page.
hostnamestring(Optional) The Confluence Cloud tenant you want to connect to. This is required when parent product is on a different domain than Confluence
localestring(Optional) Locale string for localization. The default locale is "en-US".
navigationPolicyObject, see definition(Optional) See description and examples
parentProductstring(Optional) The parent product name string supported by Embedded Component
parentProductContentContainerIdstring(Optional) The Id of the parent product that have a mapping relationship with Confluence space. For example, for Jira, this could be the project Id. JSM can enable unlicensed user access by passing this prop.
parentProductContentIdstring(Optional) The Id of content from parent product perspective. For example, for JSM, this could be the KB article Id.
spaceKeystring(Optional) The key of space the content belongs to, from Confluence perspective.
themeStateObject(Optional) an optional prop that can be provided to the Embedded components to ensure that they apply the same theme preference as their parent product. For the latest list of supported fields in themeState Object please visit the design systems documentation here. If no themeState is provided, the Embedded component will display with it's original styles.
urlstring(Optional) If provided, contentId, spaceKey, parentProduct, hostname, protocol, draftShareId and queries will be parsed from the URL. If those properties are provided along with url, then those properties takes priority over parsed properties from the url

** Even though all properties are optional, the required properties for Page to render an embedded Confluence page are contentId, spaceKey, and parentProduct. They can be passed in either explicitly or via URL.