ngx-t-forms 2.0.37 → 3.1.0
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/fesm2022/{ngx-t-forms-auto-complete-input-element.component-D_l5sbNh.mjs → ngx-t-forms-auto-complete-input-element.component-FhUHTsUF.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-D_l5sbNh.mjs.map → ngx-t-forms-auto-complete-input-element.component-FhUHTsUF.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-basic-input-input-element.component-fJIsRm0v.mjs → ngx-t-forms-basic-input-input-element.component-BJKe9wIA.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-basic-input-input-element.component-fJIsRm0v.mjs.map → ngx-t-forms-basic-input-input-element.component-BJKe9wIA.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-FQLTI7CX.mjs +643 -0
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-FQLTI7CX.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-L1kPy15K.mjs → ngx-t-forms-chip-options-creator-editor.component-CJtbprXS.mjs} +4 -4
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-CJtbprXS.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-CU6Cp-oK.mjs → ngx-t-forms-config-mscoa-additional-inputs.component-CU6R5h-x.mjs} +4 -4
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-CU6R5h-x.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-data-source-picker.component-C8MBbnfz.mjs +261 -0
- package/fesm2022/ngx-t-forms-data-source-picker.component-C8MBbnfz.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-DsjcLQ5A.mjs → ngx-t-forms-date-picker-input-element.component-Dux6uy66.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-DsjcLQ5A.mjs.map → ngx-t-forms-date-picker-input-element.component-Dux6uy66.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-date-range-picker-input-element.component-SMWrTm5X.mjs +157 -0
- package/fesm2022/ngx-t-forms-date-range-picker-input-element.component-SMWrTm5X.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-uGM93dvc.mjs +373 -0
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-uGM93dvc.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-document-picker.component-DIqaaBSl.mjs +1259 -0
- package/fesm2022/ngx-t-forms-document-picker.component-DIqaaBSl.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-editor-input-element.component-CIELjDty.mjs +417 -0
- package/fesm2022/ngx-t-forms-editor-input-element.component-CIELjDty.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-editor-js-input.component-C1dI_7rU.mjs +553 -0
- package/fesm2022/ngx-t-forms-editor-js-input.component-C1dI_7rU.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-_RBYRgn9.mjs → ngx-t-forms-file-upload-input-element.component-CQsKz87N.mjs} +7 -7
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-_RBYRgn9.mjs.map → ngx-t-forms-file-upload-input-element.component-CQsKz87N.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-form-input-selector.component-Dj0jvBdm.mjs +86 -0
- package/fesm2022/ngx-t-forms-form-input-selector.component-Dj0jvBdm.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-form-json-view.component-D9rU9vxT.mjs → ngx-t-forms-form-json-view.component-DzJKFl4c.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-json-view.component-D9rU9vxT.mjs.map → ngx-t-forms-form-json-view.component-DzJKFl4c.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-form-payload-projection.component-y9PSIeP1.mjs +179 -0
- package/fesm2022/ngx-t-forms-form-payload-projection.component-y9PSIeP1.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-CqCL3Bnc.mjs → ngx-t-forms-form-section-stepper.component-DOvVtJGB.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-CqCL3Bnc.mjs.map → ngx-t-forms-form-section-stepper.component-DOvVtJGB.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-wmRDJU4P.mjs → ngx-t-forms-forms-builder-menu.component-CcqyQLf5.mjs} +12 -12
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-wmRDJU4P.mjs.map → ngx-t-forms-forms-builder-menu.component-CcqyQLf5.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-geo-location.component-CMbBSXe0.mjs → ngx-t-forms-geo-location.component-Bj_qIEqi.mjs} +7 -7
- package/fesm2022/{ngx-t-forms-geo-location.component-CMbBSXe0.mjs.map → ngx-t-forms-geo-location.component-Bj_qIEqi.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-header-template-editor.component-DLldVmcN.mjs +129 -0
- package/fesm2022/ngx-t-forms-header-template-editor.component-DLldVmcN.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-image-capture-input-element.component-Cbq8OYk7.mjs → ngx-t-forms-image-capture-input-element.component-lwp3IcDt.mjs} +7 -7
- package/fesm2022/{ngx-t-forms-image-capture-input-element.component-Cbq8OYk7.mjs.map → ngx-t-forms-image-capture-input-element.component-lwp3IcDt.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-index-CPNvE4PP.mjs → ngx-t-forms-index-C8NtLE16.mjs} +2 -2
- package/fesm2022/ngx-t-forms-index-C8NtLE16.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-input-custom.component-uNVdF9aA.mjs → ngx-t-forms-input-custom.component-DiciFhSS.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-input-custom.component-uNVdF9aA.mjs.map → ngx-t-forms-input-custom.component-DiciFhSS.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-input-editor.component-D12hrHOc.mjs +190 -0
- package/fesm2022/ngx-t-forms-input-editor.component-D12hrHOc.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-D0SGS9xQ.mjs → ngx-t-forms-map-mat-options-keys-C2JpMTEc.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-D0SGS9xQ.mjs.map → ngx-t-forms-map-mat-options-keys-C2JpMTEc.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-C1Qrze7K.mjs +167 -0
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-C1Qrze7K.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-mat-slider-editor.component-CTSBrM-j.mjs → ngx-t-forms-mat-slider-editor.component-4buvmLkX.mjs} +3 -3
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-4buvmLkX.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-mat-slider-toggle-editor.component-CcYiwx-8.mjs → ngx-t-forms-mat-slider-toggle-editor.component-DX8L0O1k.mjs} +3 -3
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-DX8L0O1k.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-CxF6Ljjf.mjs → ngx-t-forms-missing-form-configs.component-BaTR_jzc.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-CxF6Ljjf.mjs.map → ngx-t-forms-missing-form-configs.component-BaTR_jzc.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BqT5Z8SM.mjs → ngx-t-forms-mscoa-chart-toolbar.component-Dni_bv_G.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BqT5Z8SM.mjs.map → ngx-t-forms-mscoa-chart-toolbar.component-Dni_bv_G.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-error-display.component-99DpVSy7.mjs → ngx-t-forms-mscoa-error-display.component-BDPi6w2E.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-mscoa-error-display.component-99DpVSy7.mjs.map → ngx-t-forms-mscoa-error-display.component-BDPi6w2E.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-BPQuzR5k.mjs +447 -0
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-BPQuzR5k.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-mscoa-temporary-hint.component-B1Z-IXSL.mjs → ngx-t-forms-mscoa-temporary-hint.component-g7DosiVb.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-mscoa-temporary-hint.component-B1Z-IXSL.mjs.map → ngx-t-forms-mscoa-temporary-hint.component-g7DosiVb.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-hXWMRFjl.mjs +905 -0
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-hXWMRFjl.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-ngx-t-forms-DQ_h-jPF.mjs → ngx-t-forms-ngx-t-forms-tQEbZK_e.mjs} +2188 -249
- package/fesm2022/ngx-t-forms-ngx-t-forms-tQEbZK_e.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-paginated-selection-table-DHwojPhn.mjs → ngx-t-forms-paginated-selection-table-pYY2sWAb.mjs} +8 -8
- package/fesm2022/{ngx-t-forms-paginated-selection-table-DHwojPhn.mjs.map → ngx-t-forms-paginated-selection-table-pYY2sWAb.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-payload-template-editor.component-DGCUsTYx.mjs +79 -0
- package/fesm2022/ngx-t-forms-payload-template-editor.component-DGCUsTYx.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-pipeline-generator.component-D2stBXXC.mjs +748 -0
- package/fesm2022/ngx-t-forms-pipeline-generator.component-D2stBXXC.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-record-list-manager.component-CtCOIpai.mjs +446 -0
- package/fesm2022/ngx-t-forms-record-list-manager.component-CtCOIpai.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-required-inputs.component-D9wIdOhg.mjs +272 -0
- package/fesm2022/ngx-t-forms-required-inputs.component-D9wIdOhg.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-D3sa7sNg.mjs → ngx-t-forms-rest-api-call-setup.component-Gy7Rtmue.mjs} +39 -8
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-Gy7Rtmue.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-search-field.component-mR4Kk12C.mjs +38 -0
- package/fesm2022/ngx-t-forms-search-field.component-mR4Kk12C.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-section-report.component-D6jakGa5.mjs → ngx-t-forms-section-report.component-U9uQ_Ow9.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-section-report.component-D6jakGa5.mjs.map → ngx-t-forms-section-report.component-U9uQ_Ow9.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-select-input-element.component-CwqIck0h.mjs → ngx-t-forms-select-input-element.component-CxYTmuvV.mjs} +8 -8
- package/fesm2022/{ngx-t-forms-select-input-element.component-CwqIck0h.mjs.map → ngx-t-forms-select-input-element.component-CxYTmuvV.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-selection-options-editor.component-BLLejOLG.mjs +169 -0
- package/fesm2022/ngx-t-forms-selection-options-editor.component-BLLejOLG.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-D0ttyEex.mjs +263 -0
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-D0ttyEex.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-textarea-input-element.component-D4dEi8Vs.mjs → ngx-t-forms-textarea-input-element.component-75VdPc6z.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-textarea-input-element.component-D4dEi8Vs.mjs.map → ngx-t-forms-textarea-input-element.component-75VdPc6z.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-toggle-input-element.component-BZiTFB0j.mjs → ngx-t-forms-toggle-input-element.component-DQGvEJN-.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-toggle-input-element.component-BZiTFB0j.mjs.map → ngx-t-forms-toggle-input-element.component-DQGvEJN-.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-token-transform-D_wsFbNc.mjs +173 -0
- package/fesm2022/ngx-t-forms-token-transform-D_wsFbNc.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-validators-config.component-EM7RSWIz.mjs +574 -0
- package/fesm2022/ngx-t-forms-validators-config.component-EM7RSWIz.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-workflow-adjudication.component-DD6Fhx06.mjs → ngx-t-forms-workflow-adjudication.component-C1Em-g9e.mjs} +17 -17
- package/fesm2022/ngx-t-forms-workflow-adjudication.component-C1Em-g9e.mjs.map +1 -0
- package/fesm2022/ngx-t-forms.mjs +1 -1
- package/package.json +2 -2
- package/styles/_editor-mixins.scss +117 -117
- package/styles/_signature-pad.scss +26 -26
- package/styles/_tokens.scss +148 -148
- package/types/ngx-t-forms.d.ts +14 -2
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-B8Do3h4B.mjs +0 -643
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-B8Do3h4B.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-L1kPy15K.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-CU6Cp-oK.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-data-source-picker.component-r7OGAsxo.mjs +0 -261
- package/fesm2022/ngx-t-forms-data-source-picker.component-r7OGAsxo.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-date-range-picker-input-element.component-B8V7IpoK.mjs +0 -156
- package/fesm2022/ngx-t-forms-date-range-picker-input-element.component-B8V7IpoK.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-hKJqVYUY.mjs +0 -373
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-hKJqVYUY.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-document-picker.component-f-hz6Vef.mjs +0 -704
- package/fesm2022/ngx-t-forms-document-picker.component-f-hz6Vef.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-editor-input-element.component-D38U94oj.mjs +0 -294
- package/fesm2022/ngx-t-forms-editor-input-element.component-D38U94oj.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-editor-js-input.component-D_Jq7sfY.mjs +0 -240
- package/fesm2022/ngx-t-forms-editor-js-input.component-D_Jq7sfY.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-input-selector.component-CUwK3DqG.mjs +0 -86
- package/fesm2022/ngx-t-forms-form-input-selector.component-CUwK3DqG.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-payload-projection.component-D46W1-4z.mjs +0 -179
- package/fesm2022/ngx-t-forms-form-payload-projection.component-D46W1-4z.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-index-CPNvE4PP.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-input-editor.component-BWoKhlI3.mjs +0 -190
- package/fesm2022/ngx-t-forms-input-editor.component-BWoKhlI3.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-Cu-KiAeY.mjs +0 -66
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-Cu-KiAeY.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-CTSBrM-j.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-CcYiwx-8.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-BT-dM_5C.mjs +0 -447
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-BT-dM_5C.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-DXAh2Mbm.mjs +0 -905
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-DXAh2Mbm.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-ngx-t-forms-DQ_h-jPF.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-payload-template-editor.component-CAXdFu4E.mjs +0 -203
- package/fesm2022/ngx-t-forms-payload-template-editor.component-CAXdFu4E.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-pipeline-generator.component-BJQ-KnmU.mjs +0 -748
- package/fesm2022/ngx-t-forms-pipeline-generator.component-BJQ-KnmU.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-record-list-manager.component-BoD3S_7u.mjs +0 -358
- package/fesm2022/ngx-t-forms-record-list-manager.component-BoD3S_7u.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-required-inputs.component-C-E3fQu6.mjs +0 -272
- package/fesm2022/ngx-t-forms-required-inputs.component-C-E3fQu6.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-D3sa7sNg.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-search-field.component-B2ZO7lqO.mjs +0 -38
- package/fesm2022/ngx-t-forms-search-field.component-B2ZO7lqO.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-selection-options-editor.component-Coj9gnrq.mjs +0 -169
- package/fesm2022/ngx-t-forms-selection-options-editor.component-Coj9gnrq.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-DqFMP1rZ.mjs +0 -204
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-DqFMP1rZ.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-validators-config.component-B3K9nLxx.mjs +0 -574
- package/fesm2022/ngx-t-forms-validators-config.component-B3K9nLxx.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-workflow-adjudication.component-DD6Fhx06.mjs.map +0 -1
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, inject, ElementRef, signal, viewChild, PLATFORM_ID, Input } from '@angular/core';
|
|
3
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
4
|
+
import { NgControl } from '@angular/forms';
|
|
5
|
+
import { MatFormFieldControl } from '@angular/material/form-field';
|
|
6
|
+
import { B as BaseCustomInput, _ as _isEqual } from './ngx-t-forms-ngx-t-forms-tQEbZK_e.mjs';
|
|
7
|
+
|
|
8
|
+
// Third-party Editor.js tool packages ship without typings that line up with
|
|
9
|
+
// the host editor's `ToolConstructable`. We narrow at the registration boundary
|
|
10
|
+
// via `unknown` rather than leaking `any` through this module.
|
|
11
|
+
const asToolConstructable = (tool) => tool;
|
|
12
|
+
/**
|
|
13
|
+
* Dynamically loads every Editor.js plugin bundle and returns a ready-to-use `EditorConfig`.
|
|
14
|
+
*
|
|
15
|
+
* Browser-only: callers MUST gate this behind `isPlatformBrowser(...)` because each plugin
|
|
16
|
+
* package touches `self` / `document` at module-eval time and crashes under bare-Node SSR.
|
|
17
|
+
*/
|
|
18
|
+
const loadEditorConfig = async (payload) => {
|
|
19
|
+
const [{ default: Header }, { default: List }, { default: Paragraph }, { default: Quote }, { default: Table }, { default: ImageTool }, { default: Delimiter }, { default: CodeTool }, { default: Embed },] = await Promise.all([
|
|
20
|
+
import('@editorjs/header'),
|
|
21
|
+
import('@editorjs/list'),
|
|
22
|
+
import('@editorjs/paragraph'),
|
|
23
|
+
import('@editorjs/quote'),
|
|
24
|
+
import('@editorjs/table'),
|
|
25
|
+
import('@editorjs/image'),
|
|
26
|
+
import('@editorjs/delimiter'),
|
|
27
|
+
import('@editorjs/code'),
|
|
28
|
+
import('@editorjs/embed'),
|
|
29
|
+
]);
|
|
30
|
+
return ({
|
|
31
|
+
holder: payload.holderId,
|
|
32
|
+
autofocus: true,
|
|
33
|
+
placeholder: 'Let\'s write something amazing...',
|
|
34
|
+
inlineToolbar: true,
|
|
35
|
+
tools: {
|
|
36
|
+
header: {
|
|
37
|
+
class: asToolConstructable(Header),
|
|
38
|
+
config: {
|
|
39
|
+
levels: [1, 2, 3, 4, 5, 6],
|
|
40
|
+
defaultLevel: 1,
|
|
41
|
+
placeholder: 'Type your heading here...'
|
|
42
|
+
},
|
|
43
|
+
inlineToolbar: ['link', 'bold', 'italic', 'marker']
|
|
44
|
+
},
|
|
45
|
+
list: {
|
|
46
|
+
class: asToolConstructable(List),
|
|
47
|
+
inlineToolbar: true,
|
|
48
|
+
config: {
|
|
49
|
+
defaultStyle: 'unordered',
|
|
50
|
+
placeholder: 'Enter a list item here...'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
paragraph: {
|
|
54
|
+
class: asToolConstructable(Paragraph),
|
|
55
|
+
inlineToolbar: true,
|
|
56
|
+
config: {
|
|
57
|
+
preserveBlank: true,
|
|
58
|
+
placeholder: 'Type your paragraph here...'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
quote: {
|
|
62
|
+
class: asToolConstructable(Quote),
|
|
63
|
+
inlineToolbar: true,
|
|
64
|
+
shortcut: 'CMD+SHIFT+Q',
|
|
65
|
+
config: {
|
|
66
|
+
quotePlaceholder: 'Enter a quote',
|
|
67
|
+
captionPlaceholder: 'Quote\'s author',
|
|
68
|
+
alignmentEnabled: true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
delimiter: {
|
|
72
|
+
class: asToolConstructable(Delimiter)
|
|
73
|
+
},
|
|
74
|
+
image: {
|
|
75
|
+
class: asToolConstructable(ImageTool),
|
|
76
|
+
config: {
|
|
77
|
+
endpoints: {
|
|
78
|
+
byFile: payload.imageUploadEndpoint,
|
|
79
|
+
byUrl: payload.imageFetchEndpoint
|
|
80
|
+
},
|
|
81
|
+
uploader: {
|
|
82
|
+
uploadByFile(file) {
|
|
83
|
+
// Custom upload logic
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
table: {
|
|
89
|
+
class: asToolConstructable(Table),
|
|
90
|
+
inlineToolbar: true,
|
|
91
|
+
config: {
|
|
92
|
+
rows: 2,
|
|
93
|
+
cols: 3
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
code: {
|
|
97
|
+
class: asToolConstructable(CodeTool),
|
|
98
|
+
config: {
|
|
99
|
+
placeholder: 'Enter code here...'
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
embed: {
|
|
103
|
+
class: asToolConstructable(Embed),
|
|
104
|
+
config: {
|
|
105
|
+
services: {
|
|
106
|
+
youtube: true,
|
|
107
|
+
codesandbox: true,
|
|
108
|
+
codepen: true
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
defaultBlock: 'paragraph',
|
|
114
|
+
hideToolbar: false,
|
|
115
|
+
data: payload.data,
|
|
116
|
+
readOnly: payload.readOnly,
|
|
117
|
+
logLevel: 'ERROR',
|
|
118
|
+
minHeight: 300,
|
|
119
|
+
onChange: (api, event) => {
|
|
120
|
+
payload.onChangeFn();
|
|
121
|
+
},
|
|
122
|
+
onReady: () => { },
|
|
123
|
+
sanitizer: {
|
|
124
|
+
p: true,
|
|
125
|
+
b: true,
|
|
126
|
+
a: {
|
|
127
|
+
href: true,
|
|
128
|
+
target: '_blank',
|
|
129
|
+
rel: 'nofollow'
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
i18n: {
|
|
133
|
+
messages: {
|
|
134
|
+
ui: {
|
|
135
|
+
blockTunes: {
|
|
136
|
+
toggler: {
|
|
137
|
+
'Click to tune': 'Click to tune',
|
|
138
|
+
'or drag to move': 'or drag to move'
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Element-level "pop out to full screen" shared by the rich-text editors in this folder.
|
|
149
|
+
*
|
|
150
|
+
* A plain `position: fixed` overlay is **not** sufficient here, and that is the whole point of
|
|
151
|
+
* this file. The editors render inside a `mat-form-field`, which consumers routinely nest inside
|
|
152
|
+
* a Material stepper, tab body, drawer or dialog. `position: fixed` is viewport-relative only
|
|
153
|
+
* while **no** ancestor establishes a containing block — any ancestor with `transform`, `filter`,
|
|
154
|
+
* `contain`, `will-change`, `backdrop-filter` or `perspective` captures it, and that ancestor's
|
|
155
|
+
* `overflow: hidden` then clips it. Which of those a consumer uses is unknowable from in here, so
|
|
156
|
+
* the pop-out has to stop depending on the host component altogether.
|
|
157
|
+
*
|
|
158
|
+
* The browser's **top layer** is what does that: elements promoted into it are painted outside
|
|
159
|
+
* the ancestor chain and are immune to ancestor `transform`, `overflow`, `z-index` and stacking
|
|
160
|
+
* contexts. Three strategies are tried, best first:
|
|
161
|
+
*
|
|
162
|
+
* 1. `requestFullscreen()` — top layer **and** drops the browser chrome. Needs a user gesture.
|
|
163
|
+
* 2. `showPopover()` — top layer, no gesture required; covers browsers where element full screen
|
|
164
|
+
* is unavailable (Safari on iPhone) or blocked by a `fullscreen` permissions policy in an
|
|
165
|
+
* iframe.
|
|
166
|
+
* 3. `position: fixed` — last resort for browsers with neither API.
|
|
167
|
+
*
|
|
168
|
+
* The element is promoted **in place** — never re-parented to `<body>`. Top-layer promotion
|
|
169
|
+
* changes painting, not inheritance, so the editor keeps inheriting the app's `--mat-sys-*` theme
|
|
170
|
+
* variables from its real ancestors; a portal to `<body>` would lose them.
|
|
171
|
+
*
|
|
172
|
+
* Only the standard, promise-returning `requestFullscreen` is used. The legacy
|
|
173
|
+
* `webkitRequestFullscreen` returns `void` and reports failure through a separate event, so a
|
|
174
|
+
* rejection could not be observed in time to fall through cleanly — those browsers take path 2/3.
|
|
175
|
+
*/
|
|
176
|
+
/**
|
|
177
|
+
* Class carried by the element while it is popped out. Each editor styles it in its own
|
|
178
|
+
* stylesheet, and that rule **must** set a `display` value: it is what keeps the element visible
|
|
179
|
+
* during the popover path (see {@link EditorFullScreenHost.enter}).
|
|
180
|
+
*/
|
|
181
|
+
const EDITOR_FULL_SCREEN_CLASS = 'is-fullscreen';
|
|
182
|
+
/**
|
|
183
|
+
* Owns the pop-out of a single element. One instance per editor; created behind the component's
|
|
184
|
+
* `isPlatformBrowser` guard so nothing here runs during SSR.
|
|
185
|
+
*/
|
|
186
|
+
class EditorFullScreenHost {
|
|
187
|
+
#document;
|
|
188
|
+
#onExternalExit;
|
|
189
|
+
#element;
|
|
190
|
+
#mode;
|
|
191
|
+
/**
|
|
192
|
+
* @param document The owning document, injected via `DOCUMENT` — never the global.
|
|
193
|
+
* @param onExternalExit Called when the browser closed the pop-out without going through
|
|
194
|
+
* {@link exit} (Escape, F11, another element claiming full screen).
|
|
195
|
+
*/
|
|
196
|
+
constructor(document, onExternalExit) {
|
|
197
|
+
this.#document = document;
|
|
198
|
+
this.#onExternalExit = onExternalExit;
|
|
199
|
+
this.#document.addEventListener('fullscreenchange', this.#handleFullScreenChange);
|
|
200
|
+
}
|
|
201
|
+
/** Whether an element is currently popped out. */
|
|
202
|
+
get active() {
|
|
203
|
+
return this.#mode !== undefined;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Pops `element` out using the best mechanism the browser allows, adding
|
|
207
|
+
* {@link EDITOR_FULL_SCREEN_CLASS} for the duration.
|
|
208
|
+
*
|
|
209
|
+
* Must be called synchronously from a user gesture, otherwise the Fullscreen API rejects and
|
|
210
|
+
* the pop-out silently degrades to the popover path.
|
|
211
|
+
*
|
|
212
|
+
* @param element The element to promote — must be the one carrying the editor chrome.
|
|
213
|
+
* @returns The mechanism that ended up being used.
|
|
214
|
+
*/
|
|
215
|
+
async enter(element) {
|
|
216
|
+
if (this.#mode !== undefined)
|
|
217
|
+
return this.#mode;
|
|
218
|
+
// Added first, and deliberately so: the class sets `display`, which — being author origin —
|
|
219
|
+
// beats the UA's `[popover]:not(:popover-open) { display: none }`. Without it the element
|
|
220
|
+
// would be display:none for the window between `setAttribute` and `showPopover()` below, and
|
|
221
|
+
// a style recalculation inside that window blurs whatever the user was typing in.
|
|
222
|
+
this.#element = element;
|
|
223
|
+
element.classList.add(EDITOR_FULL_SCREEN_CLASS);
|
|
224
|
+
// `fullscreenEnabled` is false when a permissions policy blocks it (an iframe without
|
|
225
|
+
// `allow="fullscreen"`) and where element full screen is unsupported (Safari on iPhone).
|
|
226
|
+
if (this.#document.fullscreenEnabled && typeof element.requestFullscreen === 'function') {
|
|
227
|
+
try {
|
|
228
|
+
await element.requestFullscreen();
|
|
229
|
+
this.#mode = 'fullscreen';
|
|
230
|
+
return this.#mode;
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
// Rejected — no transient activation, or the UA refused. Fall through to the top-layer
|
|
234
|
+
// popover, which needs neither.
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (typeof element.showPopover === 'function') {
|
|
238
|
+
element.setAttribute('popover', 'manual');
|
|
239
|
+
try {
|
|
240
|
+
element.showPopover();
|
|
241
|
+
this.#mode = 'popover';
|
|
242
|
+
return this.#mode;
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
element.removeAttribute('popover');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
this.#mode = 'fixed';
|
|
249
|
+
return this.#mode;
|
|
250
|
+
}
|
|
251
|
+
/** Closes the pop-out and returns the element to its place in the document flow. */
|
|
252
|
+
async exit() {
|
|
253
|
+
const element = this.#element;
|
|
254
|
+
const mode = this.#mode;
|
|
255
|
+
this.#element = undefined;
|
|
256
|
+
this.#mode = undefined;
|
|
257
|
+
if (!element || mode === undefined)
|
|
258
|
+
return;
|
|
259
|
+
try {
|
|
260
|
+
if (mode === 'fullscreen') {
|
|
261
|
+
// Leave full screen first: `exitFullscreen()` settles only once the browser's own
|
|
262
|
+
// transition has finished, and the class is what styles the surface until then.
|
|
263
|
+
if (this.#document.fullscreenElement === element)
|
|
264
|
+
await this.#document.exitFullscreen();
|
|
265
|
+
}
|
|
266
|
+
else if (mode === 'popover') {
|
|
267
|
+
element.hidePopover();
|
|
268
|
+
element.removeAttribute('popover');
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
finally {
|
|
272
|
+
element.classList.remove(EDITOR_FULL_SCREEN_CLASS);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/** Detaches the document listener and closes any open pop-out. Call from `ngOnDestroy`. */
|
|
276
|
+
destroy() {
|
|
277
|
+
this.#document.removeEventListener('fullscreenchange', this.#handleFullScreenChange);
|
|
278
|
+
void this.exit();
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The browser can close a native full screen behind our back — Escape, F11, or another element
|
|
282
|
+
* taking the top layer. Reconcile our own state and tell the owner so its toggle follows.
|
|
283
|
+
*/
|
|
284
|
+
#handleFullScreenChange = () => {
|
|
285
|
+
if (this.#mode !== 'fullscreen')
|
|
286
|
+
return;
|
|
287
|
+
if (this.#document.fullscreenElement === this.#element)
|
|
288
|
+
return;
|
|
289
|
+
this.#element?.classList.remove(EDITOR_FULL_SCREEN_CLASS);
|
|
290
|
+
this.#element = undefined;
|
|
291
|
+
this.#mode = undefined;
|
|
292
|
+
this.#onExternalExit();
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Floating action button that pops a rich-text editor out to full screen and back.
|
|
298
|
+
*
|
|
299
|
+
* Shared by the Quill and Editor.js inputs so both carry the same affordance, icon and
|
|
300
|
+
* accessible naming. It deliberately owns no state: the editor that hosts it drives {@link active}
|
|
301
|
+
* and performs the promotion (see `editor-full-screen.ts`).
|
|
302
|
+
*
|
|
303
|
+
* Positioning belongs to the host — this component styles only the button. Place it by targeting
|
|
304
|
+
* the element selector from the host's stylesheet.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* <lib-editor-full-screen-toggle [active]="fullScreen()" (toggled)="toggleFullScreen()" />
|
|
308
|
+
*/
|
|
309
|
+
class EditorFullScreenToggleComponent {
|
|
310
|
+
constructor() {
|
|
311
|
+
/** Whether the editor this controls is currently popped out. */
|
|
312
|
+
this.active = input.required(...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
313
|
+
/** Emitted when the user asks to enter or leave full screen. */
|
|
314
|
+
this.toggled = output();
|
|
315
|
+
/** Serves as both tooltip and accessible name, so the two can never drift apart. */
|
|
316
|
+
this.label = computed(() => (this.active() ? 'Exit full screen' : 'Full screen'), ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
317
|
+
}
|
|
318
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: EditorFullScreenToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
319
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: EditorFullScreenToggleComponent, isStandalone: true, selector: "lib-editor-full-screen-toggle", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { toggled: "toggled" }, host: { classAttribute: "lib-editor-full-screen-toggle" }, ngImport: i0, template: "<button\r\n type=\"button\"\r\n class=\"fab\"\r\n [title]=\"label()\"\r\n [attr.aria-label]=\"label()\"\r\n [attr.aria-pressed]=\"active()\"\r\n (click)=\"toggled.emit()\"\r\n>\r\n @if (active()) {\r\n <svg viewBox=\"0 0 18 18\" aria-hidden=\"true\">\r\n <polyline points=\"3 7 7 7 7 3\"></polyline>\r\n <polyline points=\"11 3 11 7 15 7\"></polyline>\r\n <polyline points=\"15 11 11 11 11 15\"></polyline>\r\n <polyline points=\"7 15 7 11 3 11\"></polyline>\r\n </svg>\r\n } @else {\r\n <svg viewBox=\"0 0 18 18\" aria-hidden=\"true\">\r\n <polyline points=\"7 3 3 3 3 7\"></polyline>\r\n <polyline points=\"11 3 15 3 15 7\"></polyline>\r\n <polyline points=\"15 11 15 15 11 15\"></polyline>\r\n <polyline points=\"3 11 3 15 7 15\"></polyline>\r\n </svg>\r\n }\r\n</button>\r\n", styles: [":host{display:block}.fab{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;border:none;border-radius:50%;background-color:var(--mat-sys-surface-container-high, var(--mat-app-surface-container-high));color:var(--mat-sys-on-surface-variant, var(--mat-app-on-surface));box-shadow:0 2px 8px #0000002e;cursor:pointer;transition:background-color .3s cubic-bezier(.16,1,.3,1),color .3s cubic-bezier(.16,1,.3,1),box-shadow .3s cubic-bezier(.16,1,.3,1);pointer-events:auto}.fab:hover,.fab:focus-visible{color:var(--mat-sys-primary, var(--mat-app-primary));background-color:var(--mat-sys-surface-container-highest, var(--mat-app-surface-container-high));box-shadow:0 4px 14px #0000003d}.fab:focus-visible{outline:2px solid var(--mat-sys-primary, var(--mat-app-primary));outline-offset:2px}.fab svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
320
|
+
}
|
|
321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: EditorFullScreenToggleComponent, decorators: [{
|
|
322
|
+
type: Component,
|
|
323
|
+
args: [{ selector: 'lib-editor-full-screen-toggle', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
324
|
+
'class': 'lib-editor-full-screen-toggle'
|
|
325
|
+
}, imports: [], template: "<button\r\n type=\"button\"\r\n class=\"fab\"\r\n [title]=\"label()\"\r\n [attr.aria-label]=\"label()\"\r\n [attr.aria-pressed]=\"active()\"\r\n (click)=\"toggled.emit()\"\r\n>\r\n @if (active()) {\r\n <svg viewBox=\"0 0 18 18\" aria-hidden=\"true\">\r\n <polyline points=\"3 7 7 7 7 3\"></polyline>\r\n <polyline points=\"11 3 11 7 15 7\"></polyline>\r\n <polyline points=\"15 11 11 11 11 15\"></polyline>\r\n <polyline points=\"7 15 7 11 3 11\"></polyline>\r\n </svg>\r\n } @else {\r\n <svg viewBox=\"0 0 18 18\" aria-hidden=\"true\">\r\n <polyline points=\"7 3 3 3 3 7\"></polyline>\r\n <polyline points=\"11 3 15 3 15 7\"></polyline>\r\n <polyline points=\"15 11 15 15 11 15\"></polyline>\r\n <polyline points=\"3 11 3 15 7 15\"></polyline>\r\n </svg>\r\n }\r\n</button>\r\n", styles: [":host{display:block}.fab{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;border:none;border-radius:50%;background-color:var(--mat-sys-surface-container-high, var(--mat-app-surface-container-high));color:var(--mat-sys-on-surface-variant, var(--mat-app-on-surface));box-shadow:0 2px 8px #0000002e;cursor:pointer;transition:background-color .3s cubic-bezier(.16,1,.3,1),color .3s cubic-bezier(.16,1,.3,1),box-shadow .3s cubic-bezier(.16,1,.3,1);pointer-events:auto}.fab:hover,.fab:focus-visible{color:var(--mat-sys-primary, var(--mat-app-primary));background-color:var(--mat-sys-surface-container-highest, var(--mat-app-surface-container-high));box-shadow:0 4px 14px #0000003d}.fab:focus-visible{outline:2px solid var(--mat-sys-primary, var(--mat-app-primary));outline-offset:2px}.fab svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n"] }]
|
|
326
|
+
}], propDecorators: { active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }], toggled: [{ type: i0.Output, args: ["toggled"] }] } });
|
|
327
|
+
|
|
328
|
+
const customInputConfig = {
|
|
329
|
+
controlType: 'lib-editor-js-input',
|
|
330
|
+
nextId: 0
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Rich-text input backed by the Editor.js block editor, wired into Angular
|
|
334
|
+
* Material's form-field via {@link MatFormFieldControl}.
|
|
335
|
+
*
|
|
336
|
+
* The Editor.js bundle is browser-only, so it is dynamically imported and
|
|
337
|
+
* instantiated inside `ngAfterViewInit` behind an `isPlatformBrowser` guard
|
|
338
|
+
* to stay SSR-safe. The editor instance is destroyed on `ngOnDestroy`.
|
|
339
|
+
*
|
|
340
|
+
* @deprecated Scheduled for removal. Do not use in new code; migrate existing
|
|
341
|
+
* usages to the supported rich-text input element. Retained only for backward
|
|
342
|
+
* compatibility with forms that still reference `lib-editor-js-input`.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* <lib-editor-js-input [inputConfig]="column()" (valueChanged)="onChange($event)" />
|
|
346
|
+
*/
|
|
347
|
+
class EditorJsInputComponent extends BaseCustomInput {
|
|
348
|
+
#platformId;
|
|
349
|
+
#document;
|
|
350
|
+
#fullScreenHost;
|
|
351
|
+
/** Guards against overlapping pop-out transitions (see `#toggleFullScreen`). */
|
|
352
|
+
#toggling;
|
|
353
|
+
constructor() {
|
|
354
|
+
super(inject(NgControl, { optional: true, self: true }), inject(ElementRef), customInputConfig);
|
|
355
|
+
/** Column definition describing the field's id, read-only state and metadata. */
|
|
356
|
+
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
357
|
+
/** Emits the editor's saved {@link OutputData} whenever its content changes. */
|
|
358
|
+
this.valueChanged = output();
|
|
359
|
+
/** Whether the editor is currently popped out to fill the screen. */
|
|
360
|
+
this.fullScreen = signal(false, ...(ngDevMode ? [{ debugName: "fullScreen" }] : /* istanbul ignore next */ []));
|
|
361
|
+
/**
|
|
362
|
+
* Height the in-flow wrapper holds onto while the editor is popped out. Set from the editor's
|
|
363
|
+
* measured height on the way in, cleared on the way out.
|
|
364
|
+
*/
|
|
365
|
+
this.reservedHeight = signal(null, ...(ngDevMode ? [{ debugName: "reservedHeight" }] : /* istanbul ignore next */ []));
|
|
366
|
+
/**
|
|
367
|
+
* The bordered surface carrying the editor — this is what gets promoted to the browser's top
|
|
368
|
+
* layer. (`viewChild` cannot sit on an ES-private field — NG1053.)
|
|
369
|
+
*/
|
|
370
|
+
this.editorContainer = viewChild.required('editorContainer');
|
|
371
|
+
this.#platformId = inject(PLATFORM_ID);
|
|
372
|
+
this.#document = inject(DOCUMENT);
|
|
373
|
+
/** Guards against overlapping pop-out transitions (see `#toggleFullScreen`). */
|
|
374
|
+
this.#toggling = false;
|
|
375
|
+
this._value = undefined;
|
|
376
|
+
}
|
|
377
|
+
get empty() {
|
|
378
|
+
const n = this.value;
|
|
379
|
+
// Check for null, undefined, or empty string, but allow 0
|
|
380
|
+
return n === null || n === undefined || n === '';
|
|
381
|
+
}
|
|
382
|
+
get shouldLabelFloat() {
|
|
383
|
+
return true;
|
|
384
|
+
}
|
|
385
|
+
set value(value) {
|
|
386
|
+
if (!_isEqual(this._value, value)) {
|
|
387
|
+
this._value = value;
|
|
388
|
+
this.onChange(value);
|
|
389
|
+
this.stateChanges.next();
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
get value() {
|
|
393
|
+
return this._value;
|
|
394
|
+
}
|
|
395
|
+
async ngAfterViewInit() {
|
|
396
|
+
if (!isPlatformBrowser(this.#platformId))
|
|
397
|
+
return;
|
|
398
|
+
this.#destroyEditor();
|
|
399
|
+
this.#fullScreenHost ??= new EditorFullScreenHost(this.#document, () => this.#setFullScreen(false));
|
|
400
|
+
const payload = {
|
|
401
|
+
holderId: this.inputConfig().id,
|
|
402
|
+
imageFetchEndpoint: '',
|
|
403
|
+
imageUploadEndpoint: '',
|
|
404
|
+
readOnly: this.inputConfig().readonly || this.inputConfig().disabled || false,
|
|
405
|
+
data: this.value || undefined,
|
|
406
|
+
onChangeFn: this.contentChangedSaveValue.bind(this)
|
|
407
|
+
};
|
|
408
|
+
// Browser-only dynamic load — see Trap 16 comment at the top of this file and in config.ts.
|
|
409
|
+
const [{ default: EditorJS }, config] = await Promise.all([
|
|
410
|
+
import('@editorjs/editorjs'),
|
|
411
|
+
loadEditorConfig(payload),
|
|
412
|
+
]);
|
|
413
|
+
this.editor = new EditorJS(config);
|
|
414
|
+
// A `setDisabledState` that arrived before the editor existed is applied here.
|
|
415
|
+
void this.#applyReadOnly();
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Keeps Editor.js's own read-only state in step with the control's. The pop-out re-enables
|
|
419
|
+
* pointer events on the popped-out surface (Material kills them field-wide when the control is
|
|
420
|
+
* disabled), so this is what actually keeps a disabled field uneditable — the CSS no longer
|
|
421
|
+
* does it.
|
|
422
|
+
*/
|
|
423
|
+
setDisabledState(isDisabled) {
|
|
424
|
+
super.setDisabledState(isDisabled);
|
|
425
|
+
void this.#applyReadOnly();
|
|
426
|
+
}
|
|
427
|
+
/** Read-only when either the column config or the reactive-form control says so. */
|
|
428
|
+
async #applyReadOnly() {
|
|
429
|
+
const editor = this.editor;
|
|
430
|
+
if (!editor)
|
|
431
|
+
return;
|
|
432
|
+
const config = this.inputConfig();
|
|
433
|
+
const readOnly = this.disabled || config.readonly || config.disabled || false;
|
|
434
|
+
try {
|
|
435
|
+
await editor.isReady;
|
|
436
|
+
if (editor.readOnly.isEnabled !== readOnly)
|
|
437
|
+
await editor.readOnly.toggle(readOnly);
|
|
438
|
+
}
|
|
439
|
+
catch {
|
|
440
|
+
// Editor.js rejects when the configured tool set has no read-only support. The field then
|
|
441
|
+
// keeps the state it was constructed with rather than the whole editor failing to load.
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
async contentChangedSaveValue() {
|
|
445
|
+
const value = await this.editor?.save();
|
|
446
|
+
this.value = value;
|
|
447
|
+
this.onChange(value);
|
|
448
|
+
this.valueChanged.emit(value);
|
|
449
|
+
}
|
|
450
|
+
/** Toggles the pop-out from the corner button. */
|
|
451
|
+
toggleFullScreen() {
|
|
452
|
+
void this.#toggleFullScreen();
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Escape leaves the pop-out. Native full screen is torn down by the browser itself (picked up
|
|
456
|
+
* through `fullscreenchange`); this covers the popover and fixed fallbacks. The event is
|
|
457
|
+
* stopped so Escape closes the editor rather than an enclosing dialog.
|
|
458
|
+
*/
|
|
459
|
+
onEscape(event) {
|
|
460
|
+
if (!this.fullScreen())
|
|
461
|
+
return;
|
|
462
|
+
event.preventDefault();
|
|
463
|
+
event.stopPropagation();
|
|
464
|
+
void this.#toggleFullScreen();
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Pops the editor out to fill the screen, or restores it. Runs inside the button's click
|
|
468
|
+
* gesture, which the Fullscreen API requires — everything up to the promotion is synchronous
|
|
469
|
+
* for that reason.
|
|
470
|
+
*
|
|
471
|
+
* Unlike the Quill sibling there is no caret to restore: the element is promoted in place, so
|
|
472
|
+
* the native selection inside Editor.js's contenteditable blocks survives untouched.
|
|
473
|
+
*/
|
|
474
|
+
async #toggleFullScreen() {
|
|
475
|
+
const fullScreenHost = this.#fullScreenHost;
|
|
476
|
+
// Both transitions settle asynchronously; ignore clicks that land mid-flight rather than
|
|
477
|
+
// letting a second `requestFullscreen()` race the first.
|
|
478
|
+
if (!fullScreenHost || this.#toggling)
|
|
479
|
+
return;
|
|
480
|
+
this.#toggling = true;
|
|
481
|
+
try {
|
|
482
|
+
if (this.fullScreen()) {
|
|
483
|
+
await fullScreenHost.exit();
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
const element = this.editorContainer().nativeElement;
|
|
487
|
+
this.reservedHeight.set(element.offsetHeight);
|
|
488
|
+
await fullScreenHost.enter(element);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
finally {
|
|
492
|
+
// `enter()` degrades rather than throwing, but `exit()` can reject if the browser refuses
|
|
493
|
+
// to leave full screen. Either way the controller has already settled its own state, so
|
|
494
|
+
// read it back instead of assuming the toggle succeeded.
|
|
495
|
+
this.#setFullScreen(fullScreenHost.active);
|
|
496
|
+
this.#toggling = false;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Single funnel for pop-out state, so the signal and the reserved space always agree —
|
|
501
|
+
* including when the browser closed full screen on its own.
|
|
502
|
+
*/
|
|
503
|
+
#setFullScreen(active) {
|
|
504
|
+
this.fullScreen.set(active);
|
|
505
|
+
if (!active)
|
|
506
|
+
this.reservedHeight.set(null);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Tears the live editor down, if there is one that can be torn down.
|
|
510
|
+
*
|
|
511
|
+
* Editor.js attaches its public API — `destroy` included — inside `exportAPI`, which runs
|
|
512
|
+
* from `isReady.then(...)`. An editor whose initialisation FAILED (the classic case: the
|
|
513
|
+
* holder element left the document before the dynamic `import()` settled, which is routine
|
|
514
|
+
* when a dialog or step closes early) is therefore a live instance carrying nothing but a
|
|
515
|
+
* rejected `isReady`. `this.editor?.destroy()` guards that the instance exists, not that it
|
|
516
|
+
* initialised, so that case threw `destroy is not a function` straight out of `ngOnDestroy`.
|
|
517
|
+
* Check the method, not just the instance.
|
|
518
|
+
*/
|
|
519
|
+
#destroyEditor() {
|
|
520
|
+
const editor = this.editor;
|
|
521
|
+
this.editor = undefined;
|
|
522
|
+
if (typeof editor?.destroy === 'function')
|
|
523
|
+
editor.destroy();
|
|
524
|
+
}
|
|
525
|
+
ngOnDestroy() {
|
|
526
|
+
this.#fullScreenHost?.destroy();
|
|
527
|
+
this.#fullScreenHost = undefined;
|
|
528
|
+
this.#destroyEditor();
|
|
529
|
+
// Tear the editor down first, then let the base complete `stateChanges` / `destroy$` and
|
|
530
|
+
// clear the temporary-error timer — none of which happened while this override skipped it.
|
|
531
|
+
super.ngOnDestroy();
|
|
532
|
+
}
|
|
533
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: EditorJsInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
534
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.12", type: EditorJsInputComponent, isStandalone: true, selector: "lib-editor-js-input", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { valueChanged: "valueChanged" }, host: { listeners: { "keydown.escape": "onEscape($event)" }, properties: { "class.floating": "shouldLabelFloat", "id": "id" } }, providers: [{ provide: MatFormFieldControl, useExisting: EditorJsInputComponent }], viewQueries: [{ propertyName: "editorContainer", first: true, predicate: ["editorContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "\r\n<!-- `.editor-shell` stays in the document flow and holds the editor's footprint while\r\n `.editor-container` is promoted to the browser's top layer for full screen. Without it the\r\n surrounding form-field collapses by the editor's height, and the page scroll position jumps\r\n when full screen is left. -->\r\n<div class=\"editor-shell\" [style.height.px]=\"reservedHeight()\">\r\n <div class=\"editor-container\" #editorContainer>\r\n <div class=\"editor-holder\" #editorJs [id]=\"inputConfig().id\"></div>\r\n\r\n <!-- Floats over the content; Editor.js has no toolbar of its own to host it. -->\r\n <lib-editor-full-screen-toggle\r\n [active]=\"fullScreen()\"\r\n (toggled)=\"toggleFullScreen()\"\r\n ></lib-editor-full-screen-toggle>\r\n </div>\r\n</div>\r\n", styles: [".editor-container{position:relative;border:solid 1px var(--mat-divider-color, var(--mat-app-outline));padding:16px;background:var(--mdc-elevated-card-container-color, var(--mat-app-surface-container-low))}.editor-container>lib-editor-full-screen-toggle{position:absolute;right:16px;bottom:16px;z-index:2}.editor-container.is-fullscreen{position:fixed;inset:0;z-index:1200;display:flex;flex-direction:column;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:none;background:var(--mat-sys-surface, var(--mat-app-surface));overflow:visible;pointer-events:auto;animation:editor-js-full-screen-enter .4s cubic-bezier(.16,1,.3,1)}.editor-container.is-fullscreen::backdrop{background-color:var(--mat-sys-surface, var(--mat-app-surface))}.editor-container.is-fullscreen>lib-editor-full-screen-toggle{right:2rem;bottom:2rem}.editor-container.is-fullscreen .editor-holder{flex:1 1 auto;min-height:0;overflow-y:auto;padding:2.5rem max(2rem,calc((100% - var(--lib-forms-editor-page-width, 210mm)) / 2))}@keyframes editor-js-full-screen-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.editor-container.is-fullscreen{animation:none}}\n"], dependencies: [{ kind: "component", type: EditorFullScreenToggleComponent, selector: "lib-editor-full-screen-toggle", inputs: ["active"], outputs: ["toggled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
535
|
+
}
|
|
536
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: EditorJsInputComponent, decorators: [{
|
|
537
|
+
type: Component,
|
|
538
|
+
args: [{ selector: 'lib-editor-js-input', imports: [EditorFullScreenToggleComponent], host: {
|
|
539
|
+
'[class.floating]': 'shouldLabelFloat',
|
|
540
|
+
'[id]': 'id',
|
|
541
|
+
'(keydown.escape)': 'onEscape($event)'
|
|
542
|
+
}, providers: [{ provide: MatFormFieldControl, useExisting: EditorJsInputComponent }], changeDetection: ChangeDetectionStrategy.OnPush, template: "\r\n<!-- `.editor-shell` stays in the document flow and holds the editor's footprint while\r\n `.editor-container` is promoted to the browser's top layer for full screen. Without it the\r\n surrounding form-field collapses by the editor's height, and the page scroll position jumps\r\n when full screen is left. -->\r\n<div class=\"editor-shell\" [style.height.px]=\"reservedHeight()\">\r\n <div class=\"editor-container\" #editorContainer>\r\n <div class=\"editor-holder\" #editorJs [id]=\"inputConfig().id\"></div>\r\n\r\n <!-- Floats over the content; Editor.js has no toolbar of its own to host it. -->\r\n <lib-editor-full-screen-toggle\r\n [active]=\"fullScreen()\"\r\n (toggled)=\"toggleFullScreen()\"\r\n ></lib-editor-full-screen-toggle>\r\n </div>\r\n</div>\r\n", styles: [".editor-container{position:relative;border:solid 1px var(--mat-divider-color, var(--mat-app-outline));padding:16px;background:var(--mdc-elevated-card-container-color, var(--mat-app-surface-container-low))}.editor-container>lib-editor-full-screen-toggle{position:absolute;right:16px;bottom:16px;z-index:2}.editor-container.is-fullscreen{position:fixed;inset:0;z-index:1200;display:flex;flex-direction:column;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:none;background:var(--mat-sys-surface, var(--mat-app-surface));overflow:visible;pointer-events:auto;animation:editor-js-full-screen-enter .4s cubic-bezier(.16,1,.3,1)}.editor-container.is-fullscreen::backdrop{background-color:var(--mat-sys-surface, var(--mat-app-surface))}.editor-container.is-fullscreen>lib-editor-full-screen-toggle{right:2rem;bottom:2rem}.editor-container.is-fullscreen .editor-holder{flex:1 1 auto;min-height:0;overflow-y:auto;padding:2.5rem max(2rem,calc((100% - var(--lib-forms-editor-page-width, 210mm)) / 2))}@keyframes editor-js-full-screen-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.editor-container.is-fullscreen{animation:none}}\n"] }]
|
|
543
|
+
}], ctorParameters: () => [], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: true }] }], valueChanged: [{ type: i0.Output, args: ["valueChanged"] }], editorContainer: [{ type: i0.ViewChild, args: ['editorContainer', { isSignal: true }] }], value: [{
|
|
544
|
+
type: Input
|
|
545
|
+
}] } });
|
|
546
|
+
|
|
547
|
+
var editorJsInput_component = /*#__PURE__*/Object.freeze({
|
|
548
|
+
__proto__: null,
|
|
549
|
+
EditorJsInputComponent: EditorJsInputComponent
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
export { EditorFullScreenHost as E, EditorFullScreenToggleComponent as a, EditorJsInputComponent as b, editorJsInput_component as e };
|
|
553
|
+
//# sourceMappingURL=ngx-t-forms-editor-js-input.component-C1dI_7rU.mjs.map
|