@pnp/spfx-property-controls
Version:
Reusable property pane controls for SharePoint Framework solutions
48 lines • 1.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyPaneMarkdownContent = PropertyPaneMarkdownContent;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const ReactDom = tslib_1.__importStar(require("react-dom"));
const PropertyPaneMarkdownContentHost_1 = tslib_1.__importDefault(require("./PropertyPaneMarkdownContentHost"));
const sp_property_pane_1 = require("@microsoft/sp-property-pane");
class PropertyPaneMarkdownContentBuilder {
constructor(_properties) {
this.type = sp_property_pane_1.PropertyPaneFieldType.Custom;
this.properties = {
key: _properties.key,
label: _properties.label,
markdown: _properties.markdown,
options: _properties.options,
onRender: this.onRender.bind(this),
};
}
render() {
if (!this.elem) {
return;
}
this.onRender(this.elem);
}
onRender(elem, ctx, changeCallback) {
if (!this.elem) {
this.elem = elem;
}
const element = React.createElement(PropertyPaneMarkdownContentHost_1.default, {
description: this.properties.label,
markdown: this.properties.markdown,
markdownProps: this.properties.options
});
ReactDom.render(element, elem);
}
}
/**
* Creates a property pane section that displays read-only markdown content.
* Use this property pane control to display additional instructions, help
* screens, etc.
*
* @param properties
*/
function PropertyPaneMarkdownContent(properties) {
return new PropertyPaneMarkdownContentBuilder(properties);
}
//# sourceMappingURL=PropertyPaneMarkdownContent.js.map