@ngstarter-ui/components 22.2.2 → 22.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/component-registry.json +15 -0
- package/content-editor/BLOCK_FORMAT.md +717 -0
- package/content-editor/document.schema.json +1598 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-attachment-block-B2GUlWO2.mjs → ngstarter-ui-components-content-editor-attachment-block-DlUkhwCu.mjs} +3 -3
- package/fesm2022/{ngstarter-ui-components-content-editor-attachment-block-B2GUlWO2.mjs.map → ngstarter-ui-components-content-editor-attachment-block-DlUkhwCu.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-block-base-BHAxKEOT.mjs → ngstarter-ui-components-content-editor-block-base-C46lyMrp.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-block-base-BHAxKEOT.mjs.map → ngstarter-ui-components-content-editor-block-base-C46lyMrp.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-callout-block-Cnga7Z-6.mjs → ngstarter-ui-components-content-editor-callout-block-Jbf8h2yz.mjs} +3 -3
- package/fesm2022/{ngstarter-ui-components-content-editor-callout-block-Cnga7Z-6.mjs.map → ngstarter-ui-components-content-editor-callout-block-Jbf8h2yz.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-DSdVOJtH.mjs → ngstarter-ui-components-content-editor-code-block.component-BizHRPdC.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-DSdVOJtH.mjs.map → ngstarter-ui-components-content-editor-code-block.component-BizHRPdC.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-DhFxtMQS.mjs → ngstarter-ui-components-content-editor-embed-block-BzoaJvai.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-DhFxtMQS.mjs.map → ngstarter-ui-components-content-editor-embed-block-BzoaJvai.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-gallery-block-cEy-dCMa.mjs → ngstarter-ui-components-content-editor-gallery-block-C4p-S0Do.mjs} +3 -3
- package/fesm2022/{ngstarter-ui-components-content-editor-gallery-block-cEy-dCMa.mjs.map → ngstarter-ui-components-content-editor-gallery-block-C4p-S0Do.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-grid-block-DFLGRFiO.mjs → ngstarter-ui-components-content-editor-grid-block-Cdq_Dcv2.mjs} +4 -4
- package/fesm2022/{ngstarter-ui-components-content-editor-grid-block-DFLGRFiO.mjs.map → ngstarter-ui-components-content-editor-grid-block-Cdq_Dcv2.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs → ngstarter-ui-components-content-editor-heading-block.component-CDSt4rXe.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs.map → ngstarter-ui-components-content-editor-heading-block.component-CDSt4rXe.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs → ngstarter-ui-components-content-editor-image-block.component-LfKZapgv.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs.map → ngstarter-ui-components-content-editor-image-block.component-LfKZapgv.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs → ngstarter-ui-components-content-editor-list-block.component-CdQ30RjA.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs.map → ngstarter-ui-components-content-editor-list-block.component-CdQ30RjA.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs → ngstarter-ui-components-content-editor-nested-blocks-CbZY0keH.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs.map → ngstarter-ui-components-content-editor-nested-blocks-CbZY0keH.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs → ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs} +578 -19
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-JVxf_Cdx.mjs → ngstarter-ui-components-content-editor-paragraph-block.component-Dd0pQquG.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-JVxf_Cdx.mjs.map → ngstarter-ui-components-content-editor-paragraph-block.component-Dd0pQquG.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-7EO7z7Sr.mjs → ngstarter-ui-components-content-editor-quote-block.component-CUxKoeb_.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-7EO7z7Sr.mjs.map → ngstarter-ui-components-content-editor-quote-block.component-CUxKoeb_.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-CJS-IBHw.mjs → ngstarter-ui-components-content-editor-table-block.component-BTExrXy8.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-CJS-IBHw.mjs.map → ngstarter-ui-components-content-editor-table-block.component-BTExrXy8.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-toggle-block-B01lhY_V.mjs → ngstarter-ui-components-content-editor-toggle-block-B46YeMGQ.mjs} +4 -4
- package/fesm2022/{ngstarter-ui-components-content-editor-toggle-block-B01lhY_V.mjs.map → ngstarter-ui-components-content-editor-toggle-block-B46YeMGQ.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-upload-block-base-D9ELpJr-.mjs → ngstarter-ui-components-content-editor-upload-block-base-DKqojf--.mjs} +3 -3
- package/fesm2022/{ngstarter-ui-components-content-editor-upload-block-base-D9ELpJr-.mjs.map → ngstarter-ui-components-content-editor-upload-block-base-DKqojf--.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-video-block.component-DQUPVDwV.mjs → ngstarter-ui-components-content-editor-video-block.component-hBR5AauH.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-video-block.component-DQUPVDwV.mjs.map → ngstarter-ui-components-content-editor-video-block.component-hBR5AauH.mjs.map} +1 -1
- package/fesm2022/ngstarter-ui-components-content-editor.mjs +1 -1
- package/package.json +3 -1
- package/types/ngstarter-ui-components-content-editor.d.ts +102 -13
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs.map +0 -1
|
@@ -2,9 +2,9 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { ExpansionPanel, ExpansionPanelHeader, ExpansionPanelTitle } from '@ngstarter-ui/components/expansion';
|
|
4
4
|
import { SlideToggle } from '@ngstarter-ui/components/slide-toggle';
|
|
5
|
-
import { C as ContentEditorBlockBase } from './ngstarter-ui-components-content-editor-block-base-
|
|
6
|
-
import { C as ContentEditorNestedBlocks } from './ngstarter-ui-components-content-editor-nested-blocks-
|
|
7
|
-
import { d as ContentEditorContentEditableDirective } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor
|
|
5
|
+
import { C as ContentEditorBlockBase } from './ngstarter-ui-components-content-editor-block-base-C46lyMrp.mjs';
|
|
6
|
+
import { C as ContentEditorNestedBlocks } from './ngstarter-ui-components-content-editor-nested-blocks-CbZY0keH.mjs';
|
|
7
|
+
import { d as ContentEditorContentEditableDirective } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs';
|
|
8
8
|
|
|
9
9
|
class ContentEditorToggleBlock extends ContentEditorBlockBase {
|
|
10
10
|
changeTitle(title) { this.save({ ...this.latestContent(), title }); }
|
|
@@ -18,4 +18,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
18
18
|
}] });
|
|
19
19
|
|
|
20
20
|
export { ContentEditorToggleBlock };
|
|
21
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-toggle-block-
|
|
21
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-toggle-block-B46YeMGQ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-content-editor-toggle-block-
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-toggle-block-B46YeMGQ.mjs","sources":["../../../projects/components/content-editor/src/_builder/toggle-block/toggle-block.ts","../../../projects/components/content-editor/src/_builder/toggle-block/toggle-block.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { ExpansionPanel, ExpansionPanelHeader, ExpansionPanelTitle } from '@ngstarter-ui/components/expansion';\nimport { SlideToggle } from '@ngstarter-ui/components/slide-toggle';\nimport { ContentEditorBlockBase } from '../block-base';\nimport { ContentEditorNestedBlocks } from '../nested-blocks/nested-blocks';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { ContentEditorText, ContentEditorToggleContent, ContentEditorToggleSettings } from '../../types';\n\n@Component({\n selector: 'ngs-content-editor-toggle-block',\n imports: [ExpansionPanel, ExpansionPanelHeader, ExpansionPanelTitle, SlideToggle, ContentEditorNestedBlocks, ContentEditorContentEditableDirective],\n templateUrl: './toggle-block.html', styleUrl: './toggle-block.scss', changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorToggleBlock extends ContentEditorBlockBase<ContentEditorToggleContent, ContentEditorToggleSettings> {\n changeTitle(title: ContentEditorText): void { this.save({ ...this.latestContent(), title }); }\n changeExpanded(expanded: boolean): void { this.save(this.latestContent(), { ...this.settings(), expanded }); }\n}\n","<ngs-expansion-panel [expanded]=\"true\">\n <ngs-expansion-panel-header><ngs-expansion-panel-title>\n <div [ngsContentEditorContentEditable]=\"content().title\" (contentChanged)=\"changeTitle($event)\"\n (click)=\"$event.stopPropagation()\" (keydown)=\"$event.stopPropagation()\" data-empty-placeholder=\"Toggle title…\"></div>\n </ngs-expansion-panel-title></ngs-expansion-panel-header>\n <div class=\"flex flex-col gap-3 py-3\">\n <ngs-slide-toggle [checked]=\"settings().expanded\" (change)=\"changeExpanded($event.checked)\">Expanded by default</ngs-slide-toggle>\n <ngs-content-editor-nested-blocks [scope]=\"{parentId: id()}\"/>\n </div>\n</ngs-expansion-panel>\n"],"names":[],"mappings":";;;;;;;;AAaM,MAAO,wBAAyB,SAAQ,sBAA+E,CAAA;AAC3H,IAAA,WAAW,CAAC,KAAwB,EAAA,EAAU,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAC7F,cAAc,CAAC,QAAiB,EAAA,EAAU,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;uGAFlG,wBAAwB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAxB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,wBAAwB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iCAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECbrC,srBAUA,EAAA,MAAA,EAAA,CAAA,0pBAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDAY,cAAc,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAA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AA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iCAAiC,WAClC,CAAC,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,WAAW,EAAE,yBAAyB,EAAE,qCAAqC,CAAC,EAAA,eAAA,EAC7D,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,srBAAA,EAAA,MAAA,EAAA,CAAA,0pBAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { signal, inject, DestroyRef, Directive } from '@angular/core';
|
|
3
|
-
import { C as ContentEditorBlockBase } from './ngstarter-ui-components-content-editor-block-base-
|
|
4
|
-
import { h as findContentEditorBlock } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor
|
|
3
|
+
import { C as ContentEditorBlockBase } from './ngstarter-ui-components-content-editor-block-base-C46lyMrp.mjs';
|
|
4
|
+
import { h as findContentEditorBlock } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs';
|
|
5
5
|
|
|
6
6
|
class ContentEditorUploadBlockBase extends ContentEditorBlockBase {
|
|
7
7
|
uploading = signal(false, /* @ts-ignore */
|
|
@@ -26,4 +26,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
26
26
|
}], ctorParameters: () => [] });
|
|
27
27
|
|
|
28
28
|
export { ContentEditorUploadBlockBase as C };
|
|
29
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-upload-block-base-
|
|
29
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-upload-block-base-DKqojf--.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-content-editor-upload-block-base-
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-upload-block-base-DKqojf--.mjs","sources":["../../../projects/components/content-editor/src/_builder/upload-block-base.ts"],"sourcesContent":["import { DestroyRef, Directive, inject, signal } from '@angular/core';\nimport { ContentEditorBlockBase } from './block-base';\nimport { findContentEditorBlock } from '../document';\n\n@Directive()\nexport abstract class ContentEditorUploadBlockBase<T, S extends object = Record<string, unknown>> extends ContentEditorBlockBase<T, S> {\n readonly uploading = signal(false);\n readonly error = signal('');\n private request = 0;\n constructor() {\n super();\n inject(DestroyRef).onDestroy(() => { this.request++; });\n }\n protected beginUpload(): number { this.uploading.set(true); this.error.set(''); return ++this.request; }\n protected isCurrentUpload(request: number): boolean {\n return request === this.request && !!findContentEditorBlock(this.store.editor.document().blocks, this.id());\n }\n cancelUpload(): void { this.request++; this.uploading.set(false); }\n}\n"],"names":[],"mappings":";;;;;AAKM,MAAgB,4BAA4E,SAAQ,sBAA4B,CAAA;IAC3H,SAAS,GAAG,MAAM,CAAC,KAAK;kFAAC;IACzB,KAAK,GAAG,MAAM,CAAC,EAAE;8EAAC;IACnB,OAAO,GAAG,CAAC;AACnB,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;AACP,QAAA,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,MAAK,EAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IACzD;AACU,IAAA,WAAW,GAAA,EAAa,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7F,IAAA,eAAe,CAAC,OAAe,EAAA;QACvC,OAAO,OAAO,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IAC7G;AACA,IAAA,YAAY,KAAW,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;uGAZ9C,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAA5B,4BAA4B,EAAA,YAAA,EAAA,IAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADjD;;;;;"}
|
|
@@ -4,7 +4,7 @@ import { UploadArea, UploadTriggerDirective } from '@ngstarter-ui/components/upl
|
|
|
4
4
|
import { ProgressBar } from '@ngstarter-ui/components/progress-bar';
|
|
5
5
|
import { Button } from '@ngstarter-ui/components/button';
|
|
6
6
|
import { Icon } from '@ngstarter-ui/components/icon';
|
|
7
|
-
import { C as ContentBuilderStore, a as CONTENT_BUILDER, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor
|
|
7
|
+
import { C as ContentBuilderStore, a as CONTENT_BUILDER, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs';
|
|
8
8
|
import { FormField, Label } from '@ngstarter-ui/components/form-field';
|
|
9
9
|
import { Input } from '@ngstarter-ui/components/input';
|
|
10
10
|
import * as i1 from '@angular/forms';
|
|
@@ -198,4 +198,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
198
198
|
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], _caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "_caption", required: false }] }, { type: i0.Output, args: ["_captionChange"] }], _settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "_settings", required: false }] }, { type: i0.Output, args: ["_settingsChange"] }], videoElement: [{ type: i0.ViewChild, args: ['videoPlayer', { isSignal: true }] }] } });
|
|
199
199
|
|
|
200
200
|
export { VideoBlockComponent };
|
|
201
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-video-block.component-
|
|
201
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-video-block.component-hBR5AauH.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-content-editor-video-block.component-DQUPVDwV.mjs","sources":["../../../projects/components/content-editor/src/_builder/video-block/video-block.component.ts","../../../projects/components/content-editor/src/_builder/video-block/video-block.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, effect, untracked, forwardRef, inject, input, model, OnInit, signal, viewChild, ElementRef } from '@angular/core';\nimport { UploadArea, UploadFileSelectedEvent, UploadTriggerDirective } from '@ngstarter-ui/components/upload';\nimport { ProgressBar } from '@ngstarter-ui/components/progress-bar';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK, ContentEditorDataBlock,\n ContentEditorVideoBlockSettings,\n ContentEditorVideoContent\n} from '../../types';\nimport { FormField, Label } from '@ngstarter-ui/components/form-field';\nimport { Input } from '@ngstarter-ui/components/input';\nimport { FormsModule } from '@angular/forms';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport { ResizableContainer } from '@ngstarter-ui/components/resizable-container';\n\n@Component({\n selector: 'ngs-video-block',\n imports: [\n UploadArea,\n UploadTriggerDirective,\n ProgressBar,\n Button,\n Icon,\n FormField,\n Input,\n FormsModule,\n Label,\n ResizableContainer\n ],\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: forwardRef(() => VideoBlockComponent),\n multi: true\n }\n ],\n templateUrl: './video-block.component.html',\n styleUrl: './video-block.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '(keypress)': 'handleKeyPress($event)',\n 'class': 'block'\n }\n})\nexport class VideoBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n\n id = input.required<string>();\n content = input.required<ContentEditorVideoContent>();\n settings = input.required<ContentEditorVideoBlockSettings>();\n index = input.required<number>();\n props = input<unknown[]>([]);\n\n uploading = signal(false);\n selectedVideo = signal<string>('');\n\n protected _src = signal<string>('');\n protected _caption = model<string>('');\n protected _orientation = signal<'portrait' | 'landscape'>('landscape');\n protected _settings = model<ContentEditorVideoBlockSettings>({});\n readonly initialized = signal(false);\n\n readonly videoElement = viewChild<ElementRef<HTMLVideoElement>>('videoPlayer');\n\n private _aspectRatio = 16 / 9;\n\n constructor() {\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n this._src.set(content.src);\n this._caption.set(content.caption);\n this._orientation.set(content.orientation || 'landscape');\n this._settings.set({ ...settings });\n });\n });\n }\n\n ngOnInit() {\n this._src.set(this.content().src);\n this._caption.set(this.content().caption);\n this._orientation.set(this.content().orientation || 'landscape');\n this._settings.set(this.settings() || {});\n this.initialized.set(true);\n }\n\n focus() {\n if (this._src()) {\n this._contentBuilder.focusBlock(this.id());\n }\n }\n\n getData(): any {\n return {\n content: {\n src: this._src(),\n caption: this._caption(),\n orientation: this._orientation()\n },\n settings: {\n ...this._settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n const src = this.getData().content.src;\n return typeof src === 'string' ? src.trim().length === 0 : !src;\n }\n\n protected cancelUploading() {\n this.uploading.set(false);\n }\n\n protected onFileSelected(event: UploadFileSelectedEvent): void {\n this.uploading.set(true);\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n this.selectedVideo.set(reader.result as string);\n\n const video = document.createElement('video');\n video.preload = 'metadata';\n video.onloadedmetadata = () => {\n window.URL.revokeObjectURL(video.src);\n const orientation = video.videoWidth > video.videoHeight ? 'landscape' : 'portrait';\n this._orientation.set(orientation);\n this._aspectRatio = video.videoWidth / video.videoHeight;\n\n let width = video.videoWidth;\n let height = video.videoHeight;\n\n if (width > 704) {\n width = 704;\n height = Math.round(width / this._aspectRatio);\n }\n\n if (height > 1000) {\n width = Math.round(width / 2);\n height = Math.round(height / 2);\n }\n\n // Initial settings based on video metadata\n this._settings.update(s => ({\n ...s,\n actualWidth: video.videoWidth,\n actualHeight: video.videoHeight,\n width,\n height\n }));\n };\n video.src = URL.createObjectURL(event.files[0]);\n\n const uploadFn = this._contentBuilder.getBlockDefOption('video', 'uploadFn');\n uploadFn(event.files[0], reader.result)\n .then((url: string) => {\n if (!this.uploading()) {\n this.selectedVideo.set('');\n return;\n }\n\n this._src.set(url);\n this.selectedVideo.set('');\n this.uploading.set(false);\n this.update();\n this.focus();\n });\n }, false);\n reader.readAsDataURL(event.files[0]);\n }\n\n protected _onCaptionChange() {\n this.update();\n }\n\n protected _onVideoResized(event: { width: number }) {\n let width = event.width;\n if (width > 704) {\n width = 704;\n }\n const height = Math.round(width / this._aspectRatio);\n\n this._settings.update(s => ({\n ...s,\n width,\n height\n }));\n\n this.update();\n }\n\n protected _onVideoLoaded(event: any) {\n const video = event.target as HTMLVideoElement;\n this._aspectRatio = video.videoWidth / video.videoHeight;\n }\n\n protected handleKeyPress(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","@if (uploading()) {\n <div class=\"relative flex items-center justify-center overflow-hidden\">\n <div class=\"absolute inset-0 z-10 flex items-center justify-center bg-white/80\">\n <div class=\"absolute top-0 start-0 end-0 z-20\">\n <ngs-progress-bar mode=\"indeterminate\"/>\n </div>\n <div class=\"absolute end-2 top-4 w-max z-30\">\n <button ngsButton (click)=\"cancelUploading()\">\n <ngs-icon name=\"fluent:delete-24-regular\"/>\n </button>\n </div>\n <div class=\"bg-white px-3 text-sm py-1.5 rounded-lg border border-border\">Loading...</div>\n </div>\n <div [style.width.px]=\"_settings().width || null\"\n [style.height.px]=\"_settings().height || null\"\n [class.max-w-full]=\"!_settings().width\">\n <video [src]=\"selectedVideo()\" muted class=\"w-full h-auto block\"></video>\n </div>\n </div>\n} @else if (_src()) {\n <div class=\"flex items-center justify-center overflow-hidden\">\n <ngs-resizable-container (resized)=\"_onVideoResized($event)\"\n [style.width.px]=\"_settings().width || null\"\n [style.height.px]=\"_settings().height || null\"\n [class.max-w-full]=\"!_settings().width\">\n <video #videoPlayer\n [src]=\"_src()\"\n class=\"w-full h-auto block\"\n (loadedmetadata)=\"_onVideoLoaded($event)\"\n controls></video>\n </ngs-resizable-container>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Caption</ngs-label>\n <input ngsInput [(ngModel)]=\"_caption\" (ngModelChange)=\"_onCaptionChange()\">\n </ngs-form-field>\n} @else {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"video/*\"\n (fileSelected)=\"onFileSelected($event)\" multiple=\"false\"\n class=\"cursor-pointer hover:outline-2 hover:outline-[var(--color-primary)]\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop video here or click to upload\n } @else {\n <div class=\"font-medium\">Drop video here</div>\n }\n </ngs-upload-area>\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;MA+Ca,mBAAmB,CAAA;AACtB,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;IAE1E,EAAE,GAAG,KAAK,CAAC,QAAQ;2EAAU;IAC7B,OAAO,GAAG,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AAA,+MAAA,CAAA,EAAA;u0BAqB+D,aAAa,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-video-block.component-hBR5AauH.mjs","sources":["../../../projects/components/content-editor/src/_builder/video-block/video-block.component.ts","../../../projects/components/content-editor/src/_builder/video-block/video-block.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, effect, untracked, forwardRef, inject, input, model, OnInit, signal, viewChild, ElementRef } from '@angular/core';\nimport { UploadArea, UploadFileSelectedEvent, UploadTriggerDirective } from '@ngstarter-ui/components/upload';\nimport { ProgressBar } from '@ngstarter-ui/components/progress-bar';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK, ContentEditorDataBlock,\n ContentEditorVideoBlockSettings,\n ContentEditorVideoContent\n} from '../../types';\nimport { FormField, Label } from '@ngstarter-ui/components/form-field';\nimport { Input } from '@ngstarter-ui/components/input';\nimport { FormsModule } from '@angular/forms';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport { ResizableContainer } from '@ngstarter-ui/components/resizable-container';\n\n@Component({\n selector: 'ngs-video-block',\n imports: [\n UploadArea,\n UploadTriggerDirective,\n ProgressBar,\n Button,\n Icon,\n FormField,\n Input,\n FormsModule,\n Label,\n ResizableContainer\n ],\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: forwardRef(() => VideoBlockComponent),\n multi: true\n }\n ],\n templateUrl: './video-block.component.html',\n styleUrl: './video-block.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '(keypress)': 'handleKeyPress($event)',\n 'class': 'block'\n }\n})\nexport class VideoBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n\n id = input.required<string>();\n content = input.required<ContentEditorVideoContent>();\n settings = input.required<ContentEditorVideoBlockSettings>();\n index = input.required<number>();\n props = input<unknown[]>([]);\n\n uploading = signal(false);\n selectedVideo = signal<string>('');\n\n protected _src = signal<string>('');\n protected _caption = model<string>('');\n protected _orientation = signal<'portrait' | 'landscape'>('landscape');\n protected _settings = model<ContentEditorVideoBlockSettings>({});\n readonly initialized = signal(false);\n\n readonly videoElement = viewChild<ElementRef<HTMLVideoElement>>('videoPlayer');\n\n private _aspectRatio = 16 / 9;\n\n constructor() {\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n this._src.set(content.src);\n this._caption.set(content.caption);\n this._orientation.set(content.orientation || 'landscape');\n this._settings.set({ ...settings });\n });\n });\n }\n\n ngOnInit() {\n this._src.set(this.content().src);\n this._caption.set(this.content().caption);\n this._orientation.set(this.content().orientation || 'landscape');\n this._settings.set(this.settings() || {});\n this.initialized.set(true);\n }\n\n focus() {\n if (this._src()) {\n this._contentBuilder.focusBlock(this.id());\n }\n }\n\n getData(): any {\n return {\n content: {\n src: this._src(),\n caption: this._caption(),\n orientation: this._orientation()\n },\n settings: {\n ...this._settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n const src = this.getData().content.src;\n return typeof src === 'string' ? src.trim().length === 0 : !src;\n }\n\n protected cancelUploading() {\n this.uploading.set(false);\n }\n\n protected onFileSelected(event: UploadFileSelectedEvent): void {\n this.uploading.set(true);\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n this.selectedVideo.set(reader.result as string);\n\n const video = document.createElement('video');\n video.preload = 'metadata';\n video.onloadedmetadata = () => {\n window.URL.revokeObjectURL(video.src);\n const orientation = video.videoWidth > video.videoHeight ? 'landscape' : 'portrait';\n this._orientation.set(orientation);\n this._aspectRatio = video.videoWidth / video.videoHeight;\n\n let width = video.videoWidth;\n let height = video.videoHeight;\n\n if (width > 704) {\n width = 704;\n height = Math.round(width / this._aspectRatio);\n }\n\n if (height > 1000) {\n width = Math.round(width / 2);\n height = Math.round(height / 2);\n }\n\n // Initial settings based on video metadata\n this._settings.update(s => ({\n ...s,\n actualWidth: video.videoWidth,\n actualHeight: video.videoHeight,\n width,\n height\n }));\n };\n video.src = URL.createObjectURL(event.files[0]);\n\n const uploadFn = this._contentBuilder.getBlockDefOption('video', 'uploadFn');\n uploadFn(event.files[0], reader.result)\n .then((url: string) => {\n if (!this.uploading()) {\n this.selectedVideo.set('');\n return;\n }\n\n this._src.set(url);\n this.selectedVideo.set('');\n this.uploading.set(false);\n this.update();\n this.focus();\n });\n }, false);\n reader.readAsDataURL(event.files[0]);\n }\n\n protected _onCaptionChange() {\n this.update();\n }\n\n protected _onVideoResized(event: { width: number }) {\n let width = event.width;\n if (width > 704) {\n width = 704;\n }\n const height = Math.round(width / this._aspectRatio);\n\n this._settings.update(s => ({\n ...s,\n width,\n height\n }));\n\n this.update();\n }\n\n protected _onVideoLoaded(event: any) {\n const video = event.target as HTMLVideoElement;\n this._aspectRatio = video.videoWidth / video.videoHeight;\n }\n\n protected handleKeyPress(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","@if (uploading()) {\n <div class=\"relative flex items-center justify-center overflow-hidden\">\n <div class=\"absolute inset-0 z-10 flex items-center justify-center bg-white/80\">\n <div class=\"absolute top-0 start-0 end-0 z-20\">\n <ngs-progress-bar mode=\"indeterminate\"/>\n </div>\n <div class=\"absolute end-2 top-4 w-max z-30\">\n <button ngsButton (click)=\"cancelUploading()\">\n <ngs-icon name=\"fluent:delete-24-regular\"/>\n </button>\n </div>\n <div class=\"bg-white px-3 text-sm py-1.5 rounded-lg border border-border\">Loading...</div>\n </div>\n <div [style.width.px]=\"_settings().width || null\"\n [style.height.px]=\"_settings().height || null\"\n [class.max-w-full]=\"!_settings().width\">\n <video [src]=\"selectedVideo()\" muted class=\"w-full h-auto block\"></video>\n </div>\n </div>\n} @else if (_src()) {\n <div class=\"flex items-center justify-center overflow-hidden\">\n <ngs-resizable-container (resized)=\"_onVideoResized($event)\"\n [style.width.px]=\"_settings().width || null\"\n [style.height.px]=\"_settings().height || null\"\n [class.max-w-full]=\"!_settings().width\">\n <video #videoPlayer\n [src]=\"_src()\"\n class=\"w-full h-auto block\"\n (loadedmetadata)=\"_onVideoLoaded($event)\"\n controls></video>\n </ngs-resizable-container>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Caption</ngs-label>\n <input ngsInput [(ngModel)]=\"_caption\" (ngModelChange)=\"_onCaptionChange()\">\n </ngs-form-field>\n} @else {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"video/*\"\n (fileSelected)=\"onFileSelected($event)\" multiple=\"false\"\n class=\"cursor-pointer hover:outline-2 hover:outline-[var(--color-primary)]\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop video here or click to upload\n } @else {\n <div class=\"font-medium\">Drop video here</div>\n }\n </ngs-upload-area>\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;MA+Ca,mBAAmB,CAAA;AACtB,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;IAE1E,EAAE,GAAG,KAAK,CAAC,QAAQ;2EAAU;IAC7B,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAA6B;IACrD,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAmC;IAC5D,KAAK,GAAG,KAAK,CAAC,QAAQ;8EAAU;IAChC,KAAK,GAAG,KAAK,CAAY,EAAE;8EAAC;IAE5B,SAAS,GAAG,MAAM,CAAC,KAAK;kFAAC;IACzB,aAAa,GAAG,MAAM,CAAS,EAAE;sFA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S, p as CONTENT_EDITOR_CALLOUT_HTML_STYLES, q as CONTENT_EDITOR_CONFIG, s as CONTENT_EDITOR_DEFAULT_HTML_CONVERTERS, t as CONTENT_EDITOR_DEFAULT_RENDERERS, u as CONTENT_EDITOR_GALLERY_HTML_STYLES, v as CONTENT_EDITOR_GRID_HTML_STYLES, w as CommandBarComponent, x as ContentBuilderComponent, y as ContentEditorAttachmentRenderer, z as ContentEditorCalloutRenderer, A as ContentEditorCodeRenderer, D as ContentEditorDividerRenderer, E as ContentEditorEmbedRenderer, F as ContentEditorGalleryRenderer, G as ContentEditorGridRenderer, H as ContentEditorHeadingRenderer, I as ContentEditorHtmlSerializer, J as ContentEditorImageRenderer, K as
|
|
1
|
+
export { B as BlockSelectionDirective, a as CONTENT_BUILDER, e as CONTENT_EDITOR_BLOCK, o as CONTENT_EDITOR_BLOCK_RENDERERS, p as CONTENT_EDITOR_CALLOUT_HTML_STYLES, q as CONTENT_EDITOR_CONFIG, s as CONTENT_EDITOR_DEFAULT_HTML_CONVERTERS, t as CONTENT_EDITOR_DEFAULT_RENDERERS, u as CONTENT_EDITOR_GALLERY_HTML_STYLES, v as CONTENT_EDITOR_GRID_HTML_STYLES, w as CommandBarComponent, x as ContentBuilderComponent, y as ContentEditorAttachmentRenderer, z as ContentEditorCalloutRenderer, A as ContentEditorCodeRenderer, D as ContentEditorDividerRenderer, E as ContentEditorEmbedRenderer, F as ContentEditorGalleryRenderer, G as ContentEditorGridRenderer, H as ContentEditorHeadingRenderer, I as ContentEditorHtmlSerializer, J as ContentEditorImageRenderer, K as ContentEditorImportError, L as ContentEditorImporter, M as ContentEditorListRenderer, N as ContentEditorParagraphRenderer, O as ContentEditorQuoteRenderer, P as ContentEditorRenderer, Q as ContentEditorTableRenderer, R as ContentEditorToggleRenderer, S as ContentEditorVideoRenderer, T as TextSelectionPopupDirective, c as cloneContentEditorValue, U as contentEditorAttachmentToHtml, V as contentEditorBlockToHtml, l as contentEditorBlockView, W as contentEditorCalloutToHtml, m as contentEditorChildCollections, X as contentEditorCodeToHtml, k as contentEditorCollection, Y as contentEditorDividerToHtml, Z as contentEditorEmbedToHtml, _ as contentEditorFromHtml, $ as contentEditorFromJson, a0 as contentEditorGalleryToHtml, a1 as contentEditorGridToHtml, a2 as contentEditorHeadingToHtml, a3 as contentEditorImageToHtml, a4 as contentEditorListToHtml, a5 as contentEditorNativeBlock, a6 as contentEditorParagraphToHtml, a7 as contentEditorQuoteToHtml, a8 as contentEditorTableToHtml, b as contentEditorText, a9 as contentEditorToHtml, aa as contentEditorToggleToHtml, ab as contentEditorVideoToHtml, h as findContentEditorBlock, n as isContentEditorBlockEmpty, ac as mergeContentEditorConfig, ad as provideContentEditor, ae as provideContentEditorConfig, af as provideContentEditorRenderer, ag as provideContentEditorRenderers, ah as replaceContentEditorCollection } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs';
|
|
2
2
|
//# sourceMappingURL=ngstarter-ui-components-content-editor.mjs.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngstarter-ui/components",
|
|
3
3
|
"description": "NgStarter - AI-friendly Enterprise Angular UI Components and Admin Panel",
|
|
4
|
-
"version": "22.2.
|
|
4
|
+
"version": "22.2.3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/elementarlabsdev/ngstarter.git"
|
|
@@ -79,6 +79,8 @@
|
|
|
79
79
|
"registry": "https://registry.npmjs.org/"
|
|
80
80
|
},
|
|
81
81
|
"exports": {
|
|
82
|
+
"./content-editor/document.schema.json": "./content-editor/document.schema.json",
|
|
83
|
+
"./content-editor/BLOCK_FORMAT.md": "./content-editor/BLOCK_FORMAT.md",
|
|
82
84
|
"./ai/*": "./ai/*",
|
|
83
85
|
"./styles/*": "./styles/*",
|
|
84
86
|
"./styles/themes/*": "./styles/themes/*",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { InjectionToken, Signal, Type, InputSignal, EnvironmentProviders, OnDestroy, OnInit, AfterViewInit, EventEmitter, ViewContainerRef, ElementRef, Renderer2, NgZone, Provider } from '@angular/core';
|
|
3
3
|
import * as _ngstarter_ui_components_headless_editor from '@ngstarter-ui/components/headless-editor';
|
|
4
|
-
import { NgsHeadlessEditor, NgsHeadlessEditorMark, NgsHeadlessEditorBlock, NgsHeadlessEditorText, NgsHeadlessEditorDocument } from '@ngstarter-ui/components/headless-editor';
|
|
4
|
+
import { NgsHeadlessEditor, NgsHeadlessEditorMark, NgsHeadlessEditorBlock, NgsHeadlessEditorText, NgsHeadlessEditorDocument, NgsHeadlessEditorMarkDefinition } from '@ngstarter-ui/components/headless-editor';
|
|
5
5
|
import * as _ngstarter_ui_components_content_editor from '@ngstarter-ui/components/content-editor';
|
|
6
6
|
import { CdkDropList, CdkDragDrop, CdkDrag, CdkDragStart } from '@angular/cdk/drag-drop';
|
|
7
7
|
import { Menu, MenuCloseReason } from '@ngstarter-ui/components/menu';
|
|
@@ -76,6 +76,35 @@ interface ContentEditorBlockEmpty {
|
|
|
76
76
|
type ContentEditorDocument = NgsHeadlessEditorDocument;
|
|
77
77
|
type ContentEditorBlock<TContent = unknown> = NgsHeadlessEditorBlock<TContent>;
|
|
78
78
|
type ContentEditorText = readonly NgsHeadlessEditorText[];
|
|
79
|
+
type ContentEditorBuiltinBlockType = 'paragraph' | 'heading' | 'code' | 'divider' | 'bulletList' | 'orderedList' | 'quote' | 'table' | 'image' | 'video' | 'embed' | 'callout' | 'toggle' | 'attachment' | 'gallery' | 'grid';
|
|
80
|
+
type ContentEditorDimension = number | 'auto' | null;
|
|
81
|
+
interface ContentEditorQuoteContent {
|
|
82
|
+
cite: {
|
|
83
|
+
content: ContentEditorText;
|
|
84
|
+
props?: ContentEditorItemProperty[];
|
|
85
|
+
};
|
|
86
|
+
caption: {
|
|
87
|
+
content: ContentEditorText;
|
|
88
|
+
props?: ContentEditorItemProperty[];
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
interface ContentEditorTableCellMetadata {
|
|
92
|
+
props?: ContentEditorItemProperty[];
|
|
93
|
+
options?: {
|
|
94
|
+
colspan?: number;
|
|
95
|
+
rowspan?: number;
|
|
96
|
+
width?: ContentEditorDimension;
|
|
97
|
+
};
|
|
98
|
+
styles?: Readonly<Record<string, unknown>>;
|
|
99
|
+
[key: string]: unknown;
|
|
100
|
+
}
|
|
101
|
+
interface ContentEditorTableAttributes {
|
|
102
|
+
rows: readonly (readonly ContentEditorText[])[];
|
|
103
|
+
header?: boolean;
|
|
104
|
+
cellMetadata?: readonly (readonly ContentEditorTableCellMetadata[])[];
|
|
105
|
+
settings?: ContentEditorTableBlockSettings;
|
|
106
|
+
props?: ContentEditorItemProperty[];
|
|
107
|
+
}
|
|
79
108
|
type ContentEditorCalloutVariant = 'note' | 'tip' | 'warning' | 'danger';
|
|
80
109
|
interface ContentEditorCalloutSettings {
|
|
81
110
|
variant: ContentEditorCalloutVariant;
|
|
@@ -177,20 +206,20 @@ interface ContentEditorEmbedContent {
|
|
|
177
206
|
type: string;
|
|
178
207
|
}
|
|
179
208
|
interface ContentEditorImageBlockSettings {
|
|
180
|
-
width?:
|
|
181
|
-
height?:
|
|
182
|
-
actualWidth?:
|
|
183
|
-
actualHeight?:
|
|
209
|
+
width?: ContentEditorDimension;
|
|
210
|
+
height?: ContentEditorDimension;
|
|
211
|
+
actualWidth?: ContentEditorDimension;
|
|
212
|
+
actualHeight?: ContentEditorDimension;
|
|
184
213
|
}
|
|
185
214
|
interface ContentEditorVideoBlockSettings {
|
|
186
|
-
width?:
|
|
187
|
-
height?:
|
|
188
|
-
actualWidth?:
|
|
189
|
-
actualHeight?:
|
|
215
|
+
width?: ContentEditorDimension;
|
|
216
|
+
height?: ContentEditorDimension;
|
|
217
|
+
actualWidth?: ContentEditorDimension;
|
|
218
|
+
actualHeight?: ContentEditorDimension;
|
|
190
219
|
}
|
|
191
220
|
interface ContentEditorEmbedBlockSettings {
|
|
192
|
-
width
|
|
193
|
-
height
|
|
221
|
+
width?: ContentEditorDimension;
|
|
222
|
+
height?: ContentEditorDimension;
|
|
194
223
|
}
|
|
195
224
|
interface ContentEditorListItem {
|
|
196
225
|
content: ContentEditorText;
|
|
@@ -233,14 +262,53 @@ interface ContentEditorBlockRendererInputSignals<TContent = unknown, TSettings =
|
|
|
233
262
|
index: InputSignal<number>;
|
|
234
263
|
}
|
|
235
264
|
|
|
265
|
+
interface ContentEditorImportOptions {
|
|
266
|
+
/** Maximum JSON/HTML nesting depth. Default: 64. */
|
|
267
|
+
maxDepth?: number;
|
|
268
|
+
/** Maximum number of document blocks, including nested blocks. Default: 10000. */
|
|
269
|
+
maxBlocks?: number;
|
|
270
|
+
/** Preserve application-defined JSON block types. Default: false. */
|
|
271
|
+
allowUnknownBlocks?: boolean;
|
|
272
|
+
}
|
|
273
|
+
interface ContentEditorHtmlImportOptions extends ContentEditorImportOptions {
|
|
274
|
+
/** A DOM document supplied by the application, useful for server-side parsers. */
|
|
275
|
+
document?: Document;
|
|
276
|
+
}
|
|
277
|
+
interface ContentEditorHtmlImportContext {
|
|
278
|
+
createBlock(type: string, content: unknown, attrs?: Readonly<Record<string, unknown>>): ContentEditorBlock;
|
|
279
|
+
createId(prefix?: string): string;
|
|
280
|
+
parseBlocks(element: Element): readonly ContentEditorBlock[];
|
|
281
|
+
parseText(element: Element): ContentEditorText;
|
|
282
|
+
/** Uses the built-in parser for this element without invoking the override again. */
|
|
283
|
+
defaultFromHtml(element: Element): readonly ContentEditorBlock[];
|
|
284
|
+
safeUrl(value: unknown, kind?: ContentEditorHtmlUrlKind): string | null;
|
|
285
|
+
}
|
|
286
|
+
interface ContentEditorBlockHtmlImporter {
|
|
287
|
+
/** CSS selector matched against the source element. Overrides run before built-ins. */
|
|
288
|
+
selector: string;
|
|
289
|
+
parse(element: Element, context: ContentEditorHtmlImportContext): ContentEditorBlock | readonly ContentEditorBlock[] | null;
|
|
290
|
+
}
|
|
291
|
+
/** Return an error message to reject a block, or undefined to accept it. */
|
|
292
|
+
type ContentEditorBlockImportValidator = (block: ContentEditorBlock) => string | undefined;
|
|
293
|
+
/** Structured failure. The editor is never modified when parsing fails. */
|
|
294
|
+
declare class ContentEditorImportError extends Error {
|
|
295
|
+
readonly path: string;
|
|
296
|
+
constructor(path: string, message: string);
|
|
297
|
+
}
|
|
298
|
+
type ContentEditorImportMarkDefinition = NgsHeadlessEditorMarkDefinition;
|
|
299
|
+
|
|
236
300
|
interface ContentEditorBlockConfig {
|
|
237
301
|
toHtml?: ContentEditorBlockHtmlConverter;
|
|
302
|
+
fromHtml?: ContentEditorBlockHtmlImporter;
|
|
303
|
+
validateImport?: ContentEditorBlockImportValidator;
|
|
238
304
|
options?: Readonly<Record<string, unknown>>;
|
|
239
305
|
}
|
|
240
306
|
interface ContentEditorConfig {
|
|
241
307
|
blocks?: Readonly<Record<string, ContentEditorBlockConfig>>;
|
|
242
308
|
marks?: Readonly<Record<string, ContentEditorMarkHtmlConverter>>;
|
|
243
309
|
includeStyles?: boolean;
|
|
310
|
+
/** Additional or overridden mark definitions used when importing HTML. */
|
|
311
|
+
importMarks?: readonly ContentEditorImportMarkDefinition[];
|
|
244
312
|
/** Unknown blocks throw by default to avoid silently losing saved content. */
|
|
245
313
|
unknownBlockToHtml?: ContentEditorBlockHtmlConverter;
|
|
246
314
|
}
|
|
@@ -292,6 +360,7 @@ declare class ContentBuilderComponent implements OnInit, AfterViewInit, OnDestro
|
|
|
292
360
|
readonly editor: NgsHeadlessEditor;
|
|
293
361
|
private readonly globalConfig;
|
|
294
362
|
private readonly htmlSerializer;
|
|
363
|
+
private readonly importer;
|
|
295
364
|
readonly config: _angular_core.InputSignal<ContentEditorConfig>;
|
|
296
365
|
/** One insertion menu shared by root controls, nested collections and custom blocks. */
|
|
297
366
|
readonly blockMenu: _angular_core.Signal<Menu>;
|
|
@@ -372,6 +441,10 @@ declare class ContentBuilderComponent implements OnInit, AfterViewInit, OnDestro
|
|
|
372
441
|
readonly canEnterRoot: (_drag: CdkDrag, drop: CdkDropList) => boolean;
|
|
373
442
|
onTagSelected(tagName: string | null): void;
|
|
374
443
|
getData(): _ngstarter_ui_components_headless_editor.NgsHeadlessEditorDocument;
|
|
444
|
+
/** Validates before replacing the document. Import is one undoable edit. */
|
|
445
|
+
importJson(source: unknown, config?: ContentEditorConfig, options?: ContentEditorImportOptions): ContentEditorDocument;
|
|
446
|
+
importHtml(html: string, config?: ContentEditorConfig, options?: ContentEditorHtmlImportOptions): ContentEditorDocument;
|
|
447
|
+
private applyImport;
|
|
375
448
|
/** Exports the live document, including nested blocks, through the configured converters. */
|
|
376
449
|
toHtml(config?: ContentEditorConfig): string;
|
|
377
450
|
blockToHtml(block: ContentEditorBlock, config?: ContentEditorConfig): string;
|
|
@@ -698,6 +771,22 @@ declare function replaceContentEditorCollection(blocks: NgsHeadlessEditorBlock[]
|
|
|
698
771
|
/** Mutable UI payloads must not mutate saved documents or undo snapshots. */
|
|
699
772
|
declare function cloneContentEditorValue<T>(value: T): T;
|
|
700
773
|
|
|
774
|
+
/** Parses and validates the native version-1 format without changing the caller's objects. */
|
|
775
|
+
declare function contentEditorFromJson(source: unknown, config?: ContentEditorConfig, options?: ContentEditorImportOptions): ContentEditorDocument;
|
|
776
|
+
|
|
777
|
+
/** Imports semantic HTML into native blocks. Scripts, event handlers and arbitrary CSS are never stored. */
|
|
778
|
+
declare function contentEditorFromHtml(html: string, config?: ContentEditorConfig, options?: ContentEditorHtmlImportOptions): ContentEditorDocument;
|
|
779
|
+
|
|
780
|
+
/** Parsing only: applications decide when to replace their current document. */
|
|
781
|
+
declare class ContentEditorImporter {
|
|
782
|
+
private readonly config;
|
|
783
|
+
private readonly document;
|
|
784
|
+
fromJson(source: unknown, config?: ContentEditorConfig, options?: ContentEditorImportOptions): _ngstarter_ui_components_headless_editor.NgsHeadlessEditorDocument;
|
|
785
|
+
fromHtml(html: string, config?: ContentEditorConfig, options?: ContentEditorHtmlImportOptions): _ngstarter_ui_components_headless_editor.NgsHeadlessEditorDocument;
|
|
786
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContentEditorImporter, never>;
|
|
787
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
|
|
788
|
+
}
|
|
789
|
+
|
|
701
790
|
/** Shared marks and commands for content editing and read-only rendering. */
|
|
702
791
|
declare function provideContentEditor(): Provider[];
|
|
703
792
|
|
|
@@ -756,5 +845,5 @@ declare class ContentEditorGridRenderer extends ContentEditorRendererBase<Conten
|
|
|
756
845
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContentEditorGridRenderer, "ngs-content-editor-grid-renderer", never, {}, {}, never, never, true, never>;
|
|
757
846
|
}
|
|
758
847
|
|
|
759
|
-
export { BlockSelectionDirective, CONTENT_BUILDER, CONTENT_EDITOR_BLOCK, CONTENT_EDITOR_BLOCK_RENDERERS, CONTENT_EDITOR_CALLOUT_HTML_STYLES, CONTENT_EDITOR_CONFIG, CONTENT_EDITOR_DEFAULT_HTML_CONVERTERS, CONTENT_EDITOR_DEFAULT_RENDERERS, CONTENT_EDITOR_GALLERY_HTML_STYLES, CONTENT_EDITOR_GRID_HTML_STYLES, CommandBarComponent, ContentBuilderComponent, ContentEditorAttachmentRenderer, ContentEditorCalloutRenderer, ContentEditorCodeRenderer, ContentEditorDividerRenderer, ContentEditorEmbedRenderer, ContentEditorGalleryRenderer, ContentEditorGridRenderer, ContentEditorHeadingRenderer, ContentEditorHtmlSerializer, ContentEditorImageRenderer, ContentEditorListRenderer, ContentEditorParagraphRenderer, ContentEditorQuoteRenderer, ContentEditorRenderer, ContentEditorTableRenderer, ContentEditorToggleRenderer, ContentEditorVideoRenderer, TextSelectionPopupDirective, cloneContentEditorValue, contentEditorAttachmentToHtml, contentEditorBlockToHtml, contentEditorBlockView, contentEditorCalloutToHtml, contentEditorChildCollections, contentEditorCodeToHtml, contentEditorCollection, contentEditorDividerToHtml, contentEditorEmbedToHtml, contentEditorGalleryToHtml, contentEditorGridToHtml, contentEditorHeadingToHtml, contentEditorImageToHtml, contentEditorListToHtml, contentEditorNativeBlock, contentEditorParagraphToHtml, contentEditorQuoteToHtml, contentEditorTableToHtml, contentEditorText, contentEditorToHtml, contentEditorToggleToHtml, contentEditorVideoToHtml, findContentEditorBlock, isContentEditorBlockEmpty, mergeContentEditorConfig, provideContentEditor, provideContentEditorConfig, provideContentEditorRenderer, provideContentEditorRenderers, replaceContentEditorCollection };
|
|
760
|
-
export type { ContentEditorAttachmentContent, ContentEditorBlock, ContentEditorBlockConfig, ContentEditorBlockDef, ContentEditorBlockEmpty, ContentEditorBlockHtmlConverter, ContentEditorBlockInsertionTarget, ContentEditorBlockRendererDef, ContentEditorBlockRendererInputSignals, ContentEditorBlockRendererInputs, ContentEditorBlockScope, ContentEditorBlockView, ContentEditorCalloutSettings, ContentEditorCalloutVariant, ContentEditorCodeRendererSettings, ContentEditorConfig, ContentEditorDataBlock, ContentEditorDocument, ContentEditorEmbedBlockSettings, ContentEditorEmbedContent, ContentEditorGalleryContent, ContentEditorGalleryImage, ContentEditorGridCell, ContentEditorGridContent, ContentEditorGridGap, ContentEditorGridSettings, ContentEditorHeadingBlockSettings, ContentEditorHtmlContext, ContentEditorHtmlUrlKind, ContentEditorImageBlockSettings, ContentEditorImageContent, ContentEditorItemProperty, ContentEditorListItem, ContentEditorListSettings, ContentEditorMarkHtmlConverter, ContentEditorOptions, ContentEditorQuoteRendererContent, ContentEditorQuoteRendererContentPart, ContentEditorSuggestionHeading, ContentEditorSuggestionItem, ContentEditorTableBlockSettings, ContentEditorTableCell, ContentEditorText, ContentEditorToggleContent, ContentEditorToggleSettings, ContentEditorUploadFn, ContentEditorVideoBlockSettings, ContentEditorVideoContent, ISelectionPopupComponent };
|
|
848
|
+
export { BlockSelectionDirective, CONTENT_BUILDER, CONTENT_EDITOR_BLOCK, CONTENT_EDITOR_BLOCK_RENDERERS, CONTENT_EDITOR_CALLOUT_HTML_STYLES, CONTENT_EDITOR_CONFIG, CONTENT_EDITOR_DEFAULT_HTML_CONVERTERS, CONTENT_EDITOR_DEFAULT_RENDERERS, CONTENT_EDITOR_GALLERY_HTML_STYLES, CONTENT_EDITOR_GRID_HTML_STYLES, CommandBarComponent, ContentBuilderComponent, ContentEditorAttachmentRenderer, ContentEditorCalloutRenderer, ContentEditorCodeRenderer, ContentEditorDividerRenderer, ContentEditorEmbedRenderer, ContentEditorGalleryRenderer, ContentEditorGridRenderer, ContentEditorHeadingRenderer, ContentEditorHtmlSerializer, ContentEditorImageRenderer, ContentEditorImportError, ContentEditorImporter, ContentEditorListRenderer, ContentEditorParagraphRenderer, ContentEditorQuoteRenderer, ContentEditorRenderer, ContentEditorTableRenderer, ContentEditorToggleRenderer, ContentEditorVideoRenderer, TextSelectionPopupDirective, cloneContentEditorValue, contentEditorAttachmentToHtml, contentEditorBlockToHtml, contentEditorBlockView, contentEditorCalloutToHtml, contentEditorChildCollections, contentEditorCodeToHtml, contentEditorCollection, contentEditorDividerToHtml, contentEditorEmbedToHtml, contentEditorFromHtml, contentEditorFromJson, contentEditorGalleryToHtml, contentEditorGridToHtml, contentEditorHeadingToHtml, contentEditorImageToHtml, contentEditorListToHtml, contentEditorNativeBlock, contentEditorParagraphToHtml, contentEditorQuoteToHtml, contentEditorTableToHtml, contentEditorText, contentEditorToHtml, contentEditorToggleToHtml, contentEditorVideoToHtml, findContentEditorBlock, isContentEditorBlockEmpty, mergeContentEditorConfig, provideContentEditor, provideContentEditorConfig, provideContentEditorRenderer, provideContentEditorRenderers, replaceContentEditorCollection };
|
|
849
|
+
export type { ContentEditorAttachmentContent, ContentEditorBlock, ContentEditorBlockConfig, ContentEditorBlockDef, ContentEditorBlockEmpty, ContentEditorBlockHtmlConverter, ContentEditorBlockHtmlImporter, ContentEditorBlockImportValidator, ContentEditorBlockInsertionTarget, ContentEditorBlockRendererDef, ContentEditorBlockRendererInputSignals, ContentEditorBlockRendererInputs, ContentEditorBlockScope, ContentEditorBlockView, ContentEditorBuiltinBlockType, ContentEditorCalloutSettings, ContentEditorCalloutVariant, ContentEditorCodeRendererSettings, ContentEditorConfig, ContentEditorDataBlock, ContentEditorDimension, ContentEditorDocument, ContentEditorEmbedBlockSettings, ContentEditorEmbedContent, ContentEditorGalleryContent, ContentEditorGalleryImage, ContentEditorGridCell, ContentEditorGridContent, ContentEditorGridGap, ContentEditorGridSettings, ContentEditorHeadingBlockSettings, ContentEditorHtmlContext, ContentEditorHtmlImportContext, ContentEditorHtmlImportOptions, ContentEditorHtmlUrlKind, ContentEditorImageBlockSettings, ContentEditorImageContent, ContentEditorImportMarkDefinition, ContentEditorImportOptions, ContentEditorItemProperty, ContentEditorListItem, ContentEditorListSettings, ContentEditorMarkHtmlConverter, ContentEditorOptions, ContentEditorQuoteContent, ContentEditorQuoteRendererContent, ContentEditorQuoteRendererContentPart, ContentEditorSuggestionHeading, ContentEditorSuggestionItem, ContentEditorTableAttributes, ContentEditorTableBlockSettings, ContentEditorTableCell, ContentEditorTableCellMetadata, ContentEditorText, ContentEditorToggleContent, ContentEditorToggleSettings, ContentEditorUploadFn, ContentEditorVideoBlockSettings, ContentEditorVideoContent, ISelectionPopupComponent };
|