The qds-content-designer component provides a registry-driven authoring workspace for QDS content documents.
<qds-content-designer id="designer"></qds-content-designer>
<script type="module">
import {
QdsContentRegistry
} from 'https://cdn.q360.ai/assets/components/index.js';
const registry = new QdsContentRegistry([
{
type: 'smart-metric',
label: 'Metric Tile',
modes: ['dashboard'],
defaultConfig: {
metricKey: 'production'
},
renderTag: 'qds-smart-metric'
}
]);
const designer = document.getElementById('designer');
designer.registry = registry;
designer.context = {
blockRegistry: registry,
canEdit: true,
canPreview: true,
services: {
metrics: {
production: '12.4 mboe/d'
}
}
};
designer.document = {
version: 1,
mode: 'page',
title: 'Quarterly Content',
blocks: []
};
designer.addEventListener('content-change', (event) => {
console.log('Updated document', event.detail.document);
});
</script>
| Event | Detail | Description |
|---|---|---|
content-change |
{ document } |
Fired whenever the document changes |
block-select |
{ blockId } |
Fired when the selected block changes |
block-add |
{ block } |
Fired after a block is added |
block-remove |
{ blockId } |
Fired after a block is removed |
block-move |
{ blockId, layout } |
Fired after layout or order changes |
preview-request |
{ document } |
Fired when the preview view is activated |
The designer is composed from reusable first-class QDS components:
qds-content-paletteqds-content-outlineqds-content-canvasqds-content-propertiesqds-content-block-frameRich-text blocks use the full QDS formatting toolbar, including headings, font and text color, alignment, indentation, links, lists, quotations, superscript, subscript, code blocks, and clearing formatting.
The toolbar floats above the page while a rich-text block is being edited, so the canvas and its surrounding panels do not clip the controls. It follows the editor when scrolling and wraps to fit the viewport. Font and color dialogs preserve the selected text.
Formatting is stored in the block’s html property and is available in both
Preview and runtime rendering. Host applications continue to receive the
normal content-change document event; no editor-specific integration is
required.
qds-content-renderer so authoring preview matches runtime rendering.context.