Created
April 21, 2018 19:20
-
-
Save hugoabernier/a70e971843166dfafe002e9e2c9a269b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import * as ReactDom from "react-dom"; | |
import { override } from "@microsoft/decorators"; | |
import { Log } from "@microsoft/sp-core-library"; | |
import { | |
BaseApplicationCustomizer, | |
PlaceholderName, | |
PlaceholderContent | |
} from "@microsoft/sp-application-base"; | |
import { Dialog } from "@microsoft/sp-dialog"; | |
import * as strings from "ClassificationExtensionApplicationCustomizerStrings"; | |
import ClassificationHeader from "../../../lib/extensions/classificationExtension/components/ClassificationHeader"; | |
import { IClassificationHeaderProps } from "./components/ClassificationHeader.types"; | |
const LOG_SOURCE: string = "ClassificationExtensionApplicationCustomizer"; | |
/** | |
* If your command set uses the ClientSideComponentProperties JSON input, | |
* it will be deserialized into the BaseExtension.properties object. | |
* You can define an interface to describe it. | |
*/ | |
export interface IClassificationExtensionApplicationCustomizerProperties { | |
// this is an example; replace with your own property | |
testMessage: string; | |
} | |
/** A Custom Action which can be run during execution of a Client Side Application */ | |
export default class ClassificationExtensionApplicationCustomizer | |
extends BaseApplicationCustomizer<IClassificationExtensionApplicationCustomizerProperties> { | |
private _topPlaceholder: PlaceholderContent | undefined; | |
@override | |
public onInit(): Promise<void> { | |
const header: PlaceholderContent = this.context.placeholderProvider.tryCreateContent( | |
PlaceholderName.Top, | |
{ onDispose: this._onDispose } | |
); | |
if (!this._topPlaceholder) { | |
this._topPlaceholder = this.context.placeholderProvider.tryCreateContent( | |
PlaceholderName.Top, | |
{ onDispose: this._onDispose }); | |
// the extension should not assume that the expected placeholder is available. | |
if (!this._topPlaceholder) { | |
console.error("The header placeholder was not found."); | |
return; | |
} | |
const elem: React.ReactElement<IClassificationHeaderProps> = React.createElement(ClassificationHeader, { | |
}); | |
ReactDom.render(elem, this._topPlaceholder.domElement); | |
} | |
} | |
private _onDispose(): void { | |
// empty | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment