@hmcts/ccd-case-ui-toolkit 7.3.91 → 7.3.93-exui-3879
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/hmcts-ccd-case-ui-toolkit.mjs +1311 -179
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/index.d.ts +70 -2
- package/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -37,9 +37,9 @@ import { Editor, NgxEditorModule } from 'ngx-editor';
|
|
|
37
37
|
import { nodes, marks } from 'ngx-editor/schema';
|
|
38
38
|
import { setBlockType } from 'prosemirror-commands';
|
|
39
39
|
import { redo, undo } from 'prosemirror-history';
|
|
40
|
-
import { Schema } from 'prosemirror-model';
|
|
40
|
+
import { Schema, Fragment } from 'prosemirror-model';
|
|
41
41
|
import { liftListItem, sinkListItem } from 'prosemirror-schema-list';
|
|
42
|
-
import { Plugin } from 'prosemirror-state';
|
|
42
|
+
import { Plugin, TextSelection } from 'prosemirror-state';
|
|
43
43
|
import * as i2 from '@angular/cdk/overlay';
|
|
44
44
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
45
45
|
import * as i6$1 from '@angular/cdk/tree';
|
|
@@ -22513,6 +22513,9 @@ var RaiseQueryErrorMessage;
|
|
|
22513
22513
|
RaiseQueryErrorMessage["QUERY_HEARING_DATE"] = "Enter a valid date";
|
|
22514
22514
|
RaiseQueryErrorMessage["QUERY_SUBJECT_MAX_LENGTH"] = "Query subject must be less than 201 characters in length";
|
|
22515
22515
|
RaiseQueryErrorMessage["RESPOND_QUERY_BODY"] = "Add a response before continue";
|
|
22516
|
+
RaiseQueryErrorMessage["QUERY_SUBJECT_MARKDOWN"] = "The data entered is not valid for Query subject. Link mark up characters are not allowed in this field";
|
|
22517
|
+
RaiseQueryErrorMessage["QUERY_BODY_MARKDOWN"] = "The data entered is not valid for Query detail. Link mark up characters are not allowed in this field";
|
|
22518
|
+
RaiseQueryErrorMessage["RESPOND_QUERY_BODY_MARKDOWN"] = "The data entered is not valid for Response detail. Link mark up characters are not allowed in this field";
|
|
22516
22519
|
})(RaiseQueryErrorMessage || (RaiseQueryErrorMessage = {}));
|
|
22517
22520
|
|
|
22518
22521
|
var QueryItemResponseStatus;
|
|
@@ -24745,7 +24748,7 @@ function QueryWriteRaiseQueryComponent_div_11_p_29_Template(rf, ctx) { if (rf &
|
|
|
24745
24748
|
i0.ɵɵadvance(2);
|
|
24746
24749
|
i0.ɵɵtextInterpolate1("", i0.ɵɵpipeBind1(3, 2, "Error:"), " ");
|
|
24747
24750
|
i0.ɵɵadvance(2);
|
|
24748
|
-
i0.ɵɵtextInterpolate1("", i0.ɵɵpipeBind1(5, 4, ctx_r0.
|
|
24751
|
+
i0.ɵɵtextInterpolate1("", i0.ɵɵpipeBind1(5, 4, ctx_r0.getBodyErrorMessage()), " ");
|
|
24749
24752
|
} }
|
|
24750
24753
|
function QueryWriteRaiseQueryComponent_div_11_p_38_Template(rf, ctx) { if (rf & 1) {
|
|
24751
24754
|
i0.ɵɵelementStart(0, "p", 35)(1, "span", 11);
|
|
@@ -24857,23 +24860,23 @@ function QueryWriteRaiseQueryComponent_div_11_Template(rf, ctx) { if (rf & 1) {
|
|
|
24857
24860
|
i0.ɵɵadvance(8);
|
|
24858
24861
|
i0.ɵɵproperty("content", i0.ɵɵpipeBind1(10, 23, ctx_r0.serviceMessage));
|
|
24859
24862
|
i0.ɵɵadvance(2);
|
|
24860
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(43, _c0$F, ctx_r0.submitted && ctx_r0.formGroup.get("subject").
|
|
24863
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(43, _c0$F, ctx_r0.submitted && ctx_r0.formGroup.get("subject").invalid));
|
|
24861
24864
|
i0.ɵɵadvance(3);
|
|
24862
24865
|
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(15, 25, "Query subject"), " ");
|
|
24863
24866
|
i0.ɵɵadvance(3);
|
|
24864
24867
|
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(18, 27, "The subject should be a summary of your query"), " ");
|
|
24865
24868
|
i0.ɵɵadvance(2);
|
|
24866
|
-
i0.ɵɵproperty("ngIf", ctx_r0.submitted &&
|
|
24869
|
+
i0.ɵɵproperty("ngIf", ctx_r0.submitted && ctx_r0.formGroup.get("subject").invalid);
|
|
24867
24870
|
i0.ɵɵadvance(2);
|
|
24868
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(45, _c0$F, ctx_r0.submitted && ctx_r0.formGroup.get("body").
|
|
24871
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(45, _c0$F, ctx_r0.submitted && ctx_r0.formGroup.get("body").invalid));
|
|
24869
24872
|
i0.ɵɵadvance(3);
|
|
24870
24873
|
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(25, 29, "Query detail"), " ");
|
|
24871
24874
|
i0.ɵɵadvance(3);
|
|
24872
24875
|
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(28, 31, "Include as many details as possible so case workers can respond to your query"), " ");
|
|
24873
24876
|
i0.ɵɵadvance(2);
|
|
24874
|
-
i0.ɵɵproperty("ngIf", ctx_r0.submitted && ctx_r0.formGroup.get("body").
|
|
24877
|
+
i0.ɵɵproperty("ngIf", ctx_r0.submitted && ctx_r0.formGroup.get("body").invalid);
|
|
24875
24878
|
i0.ɵɵadvance();
|
|
24876
|
-
i0.ɵɵclassProp("govuk-textarea--error", ctx_r0.submitted && ctx_r0.formGroup.get("body").
|
|
24879
|
+
i0.ɵɵclassProp("govuk-textarea--error", ctx_r0.submitted && ctx_r0.formGroup.get("body").invalid);
|
|
24877
24880
|
i0.ɵɵproperty("formControlName", "body");
|
|
24878
24881
|
i0.ɵɵadvance(2);
|
|
24879
24882
|
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(47, _c0$F, ctx_r0.submitted && ctx_r0.formGroup.get("isHearingRelated").hasError("required")));
|
|
@@ -24896,6 +24899,7 @@ class QueryWriteRaiseQueryComponent {
|
|
|
24896
24899
|
queryManagementService;
|
|
24897
24900
|
route;
|
|
24898
24901
|
logger = new StructuredLoggerService();
|
|
24902
|
+
static MARKDOWN_VALIDATOR = FormValidatorsService.markDownPatternValidator();
|
|
24899
24903
|
formGroup;
|
|
24900
24904
|
submitted;
|
|
24901
24905
|
caseDetails;
|
|
@@ -24915,10 +24919,11 @@ class QueryWriteRaiseQueryComponent {
|
|
|
24915
24919
|
this.route = route;
|
|
24916
24920
|
}
|
|
24917
24921
|
ngOnChanges() {
|
|
24922
|
+
this.addMarkdownValidators();
|
|
24918
24923
|
this.messageId = this.route.snapshot.params.dataid;
|
|
24919
24924
|
const isCollectionDataSet = this.setCaseQueriesCollectionData();
|
|
24920
24925
|
if (isCollectionDataSet) {
|
|
24921
|
-
if (this.triggerSubmission) {
|
|
24926
|
+
if (this.triggerSubmission && this.formGroup.valid) {
|
|
24922
24927
|
const data = this.generateCaseQueriesCollectionData();
|
|
24923
24928
|
this.queryDataCreated.emit(data);
|
|
24924
24929
|
}
|
|
@@ -24939,8 +24944,18 @@ class QueryWriteRaiseQueryComponent {
|
|
|
24939
24944
|
if (control.hasError('maxlength')) {
|
|
24940
24945
|
return this.raiseQueryErrorMessage.QUERY_SUBJECT_MAX_LENGTH;
|
|
24941
24946
|
}
|
|
24947
|
+
if (control.hasError('markDownPattern')) {
|
|
24948
|
+
return this.raiseQueryErrorMessage.QUERY_SUBJECT_MARKDOWN;
|
|
24949
|
+
}
|
|
24942
24950
|
return '';
|
|
24943
24951
|
}
|
|
24952
|
+
getBodyErrorMessage() {
|
|
24953
|
+
const control = this.formGroup.get('body');
|
|
24954
|
+
if (control.hasError('markDownPattern')) {
|
|
24955
|
+
return this.raiseQueryErrorMessage.QUERY_BODY_MARKDOWN;
|
|
24956
|
+
}
|
|
24957
|
+
return this.raiseQueryErrorMessage.QUERY_BODY;
|
|
24958
|
+
}
|
|
24944
24959
|
setCaseQueriesCollectionData() {
|
|
24945
24960
|
if (!this.eventData) {
|
|
24946
24961
|
this.logger.warn('Event data not available; skipping collection setup.');
|
|
@@ -24952,6 +24967,15 @@ class QueryWriteRaiseQueryComponent {
|
|
|
24952
24967
|
generateCaseQueriesCollectionData() {
|
|
24953
24968
|
return this.queryManagementService.generateCaseQueriesCollectionData(this.formGroup, this.queryCreateContext, this.queryItem, this.messageId);
|
|
24954
24969
|
}
|
|
24970
|
+
addMarkdownValidators() {
|
|
24971
|
+
['subject', 'body'].forEach((controlName) => {
|
|
24972
|
+
const control = this.formGroup?.get(controlName);
|
|
24973
|
+
if (control) {
|
|
24974
|
+
control.addValidators(QueryWriteRaiseQueryComponent.MARKDOWN_VALIDATOR);
|
|
24975
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
24976
|
+
}
|
|
24977
|
+
});
|
|
24978
|
+
}
|
|
24955
24979
|
static ɵfac = function QueryWriteRaiseQueryComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || QueryWriteRaiseQueryComponent)(i0.ɵɵdirectiveInject(QueryManagementService), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute)); };
|
|
24956
24980
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryWriteRaiseQueryComponent, selectors: [["ccd-query-write-raise-query"]], inputs: { formGroup: "formGroup", submitted: "submitted", caseDetails: "caseDetails", showForm: "showForm", serviceMessage: "serviceMessage", queryCreateContext: "queryCreateContext", eventData: "eventData", queryItem: "queryItem", validate: "validate", triggerSubmission: "triggerSubmission" }, outputs: { queryDataCreated: "queryDataCreated" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 12, vars: 8, consts: [[1, "govuk-!-margin-bottom-6"], [1, "govuk-caption-l"], [1, "govuk-heading-l", "govuk-!-margin-bottom-4"], [3, "caseDetails", 4, "ngIf"], ["class", "govuk-!-margin-bottom-4", 4, "ngIf"], [3, "caseDetails"], [1, "govuk-!-margin-bottom-4"], [3, "formGroup"], [1, "govuk-warning-text"], ["aria-hidden", "true", 1, "govuk-warning-text__icon"], [1, "govuk-warning-text__text"], [1, "govuk-visually-hidden"], [3, "content"], [1, "govuk-form-group", 3, "ngClass"], [1, "govuk-label-wrapper"], ["for", "subject", 1, "govuk-label", "govuk-label--m", "govuk-!-font-weight-bold"], ["id", "subject-hint", 1, "govuk-hint"], ["id", "subject-error", "class", "govuk-error-message", 4, "ngIf"], ["type", "text", "id", "subject", "formControlName", "subject", "maxlength", "200", "aria-describedby", "subject-error", 1, "govuk-input", 3, "input"], ["for", "body", 1, "govuk-label", "govuk-label--m", "govuk-!-font-weight-bold"], ["id", "body-hint", 1, "govuk-hint"], ["id", "body-error", "class", "govuk-error-message", 4, "ngIf"], ["id", "body", "name", "body", "rows", "5", "aria-describedby", "body-hint body-error", 1, "govuk-textarea", 3, "formControlName"], [1, "govuk-fieldset"], [1, "govuk-label", "govuk-label--m", "govuk-!-font-weight-bold"], ["id", "isHearingRelated-error", "class", "govuk-error-message", 4, "ngIf"], ["data-module", "govuk-radios", 1, "govuk-radios", "govuk-radios--inline"], [1, "govuk-radios__item"], ["id", "isHearingRelated-yes", "name", "isHearingRelated", "type", "radio", "formControlName", "isHearingRelated", 1, "govuk-radios__input", 3, "checked", "value"], ["for", "isHearingRelated-yes", 1, "govuk-label", "govuk-radios__label"], ["id", "isHearingRelated-no", "name", "isHearingRelated", "type", "radio", "formControlName", "isHearingRelated", 1, "govuk-radios__input", 3, "checked", "value"], ["for", "isHearingRelated-no", 1, "govuk-label", "govuk-radios__label"], [4, "ngIf"], ["id", "subject-error", 1, "govuk-error-message"], ["id", "body-error", 1, "govuk-error-message"], ["id", "isHearingRelated-error", 1, "govuk-error-message"], [1, "govuk-radios__conditional", "govuk-!-margin-top-1", 3, "ngClass"], ["role", "group", 1, "govuk-fieldset"], [1, "govuk-label", "govuk-label--s"], ["id", "hearingDate-error", "class", "govuk-error-message", 4, "ngIf"], ["formControlName", "hearingDate"], ["id", "hearingDate-error", 1, "govuk-error-message"]], template: function QueryWriteRaiseQueryComponent_Template(rf, ctx) { if (rf & 1) {
|
|
24957
24981
|
i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "div", 1);
|
|
@@ -24981,7 +25005,7 @@ class QueryWriteRaiseQueryComponent {
|
|
|
24981
25005
|
}
|
|
24982
25006
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(QueryWriteRaiseQueryComponent, [{
|
|
24983
25007
|
type: Component,
|
|
24984
|
-
args: [{ selector: 'ccd-query-write-raise-query', standalone: false, template: "<div>\n <div class=\"govuk-!-margin-bottom-6\">\n <div class=\"govuk-caption-l\">{{ 'Raise a query' | rpxTranslate }}</div>\n <h1 class=\"govuk-heading-l govuk-!-margin-bottom-4\">{{ 'Enter query details' | rpxTranslate }}</h1>\n </div>\n\n <div>\n <ccd-query-case-details-header [caseDetails]=\"caseDetails\" *ngIf=\"caseDetails\"></ccd-query-case-details-header>\n </div>\n\n <hr>\n\n <div class=\"govuk-!-margin-bottom-4\" *ngIf=\"showForm\">\n <div [formGroup]=\"formGroup\">\n <div>\n <div class=\"govuk-warning-text\">\n <span class=\"govuk-warning-text__icon\" aria-hidden=\"true\">!</span>\n <strong class=\"govuk-warning-text__text\">\n <span class=\"govuk-visually-hidden\">Warning</span>\n <ccd-markdown\n [content]=\"serviceMessage | rpxTranslate\">\n </ccd-markdown>\n </strong>\n </div>\n <div class=\"govuk-form-group\" [ngClass]=\"{'govuk-form-group--error': submitted && formGroup.get('subject').
|
|
25008
|
+
args: [{ selector: 'ccd-query-write-raise-query', standalone: false, template: "<div>\n <div class=\"govuk-!-margin-bottom-6\">\n <div class=\"govuk-caption-l\">{{ 'Raise a query' | rpxTranslate }}</div>\n <h1 class=\"govuk-heading-l govuk-!-margin-bottom-4\">{{ 'Enter query details' | rpxTranslate }}</h1>\n </div>\n\n <div>\n <ccd-query-case-details-header [caseDetails]=\"caseDetails\" *ngIf=\"caseDetails\"></ccd-query-case-details-header>\n </div>\n\n <hr>\n\n <div class=\"govuk-!-margin-bottom-4\" *ngIf=\"showForm\">\n <div [formGroup]=\"formGroup\">\n <div>\n <div class=\"govuk-warning-text\">\n <span class=\"govuk-warning-text__icon\" aria-hidden=\"true\">!</span>\n <strong class=\"govuk-warning-text__text\">\n <span class=\"govuk-visually-hidden\">Warning</span>\n <ccd-markdown\n [content]=\"serviceMessage | rpxTranslate\">\n </ccd-markdown>\n </strong>\n </div>\n <div class=\"govuk-form-group\" [ngClass]=\"{'govuk-form-group--error': submitted && formGroup.get('subject').invalid}\">\n <div class=\"govuk-label-wrapper\">\n <label class=\"govuk-label govuk-label--m govuk-!-font-weight-bold\" for=\"subject\">\n {{ 'Query subject' | rpxTranslate }}\n </label>\n </div>\n <div id=\"subject-hint\" class=\"govuk-hint\">\n {{ 'The subject should be a summary of your query' | rpxTranslate }}\n </div>\n <p id=\"subject-error\" class=\"govuk-error-message\"\n *ngIf=\"submitted && formGroup.get('subject').invalid\">\n <span class=\"govuk-visually-hidden\">{{ 'Error:' | rpxTranslate }}</span>\n {{ getSubjectErrorMessage() | rpxTranslate }}\n </p>\n\n <input type=\"text\"\n id=\"subject\"\n class=\"govuk-input\"\n formControlName=\"subject\"\n maxlength=\"200\"\n (input)=\"onSubjectInput()\"\n aria-describedby=\"subject-error\" />\n </div>\n\n <div class=\"govuk-form-group\"\n [ngClass]=\"{'govuk-form-group--error': submitted && formGroup.get('body').invalid}\">\n <div class=\"govuk-label-wrapper\">\n <label class=\"govuk-label govuk-label--m govuk-!-font-weight-bold\" for=\"body\">\n {{ 'Query detail' | rpxTranslate }}\n </label>\n </div>\n <div id=\"body-hint\" class=\"govuk-hint\">\n {{ 'Include as many details as possible so case workers can respond to your query' | rpxTranslate }}\n </div>\n <p id=\"body-error\" class=\"govuk-error-message\"\n *ngIf=\"submitted && formGroup.get('body').invalid\">\n <span class=\"govuk-visually-hidden\">{{ 'Error:' | rpxTranslate }} </span>{{ getBodyErrorMessage() | rpxTranslate }}\n </p>\n <textarea [formControlName]=\"'body'\"\n id=\"body\" name=\"body\" rows=\"5\"\n aria-describedby=\"body-hint body-error\"\n class=\"govuk-textarea\"\n [class.govuk-textarea--error]=\"submitted && formGroup.get('body').invalid\"\n >\n </textarea>\n </div>\n\n <div class=\"govuk-form-group\"\n [ngClass]=\"{'govuk-form-group--error': submitted && formGroup.get('isHearingRelated').hasError('required')}\">\n <fieldset class=\"govuk-fieldset\">\n <legend>\n <label class=\"govuk-label govuk-label--m govuk-!-font-weight-bold\">\n {{ 'Is the query hearing related?' | rpxTranslate }}\n </label>\n </legend>\n <p id=\"isHearingRelated-error\" class=\"govuk-error-message\"\n *ngIf=\"submitted && formGroup.get('isHearingRelated').hasError('required')\">\n <span class=\"govuk-visually-hidden\">{{ 'Error:' | rpxTranslate }} </span>{{ raiseQueryErrorMessage.QUERY_HEARING_RELATED | rpxTranslate }}\n </p>\n <div class=\"govuk-radios govuk-radios--inline\" data-module=\"govuk-radios\">\n <div class=\"govuk-radios__item\">\n <input class=\"govuk-radios__input\" id=\"isHearingRelated-yes\" name=\"isHearingRelated\"\n type=\"radio\"\n formControlName=\"isHearingRelated\"\n [checked]=\"formGroup.get('isHearingRelated').value === true\" [value]=\"true\"\n >\n <label class=\"govuk-label govuk-radios__label\" for=\"isHearingRelated-yes\">\n {{ 'Is the query hearing related?' | rpxTranslate: null : 'Yes' }}\n </label>\n </div>\n <div class=\"govuk-radios__item\">\n <input class=\"govuk-radios__input\" id=\"isHearingRelated-no\" name=\"isHearingRelated\"\n type=\"radio\"\n formControlName=\"isHearingRelated\"\n [checked]=\"formGroup.get('isHearingRelated').value === false\" [value]=\"false\"\n >\n <label class=\"govuk-label govuk-radios__label\" for=\"isHearingRelated-no\">\n {{ 'Is the query hearing related?' | rpxTranslate: null : 'No' }}\n </label>\n </div>\n </div>\n </fieldset>\n\n <ng-container *ngIf=\"formGroup.get('isHearingRelated').value\">\n <div class=\"govuk-radios__conditional govuk-!-margin-top-1\"\n [ngClass]=\"{'govuk-form-group--error': submitted &&\n formGroup.get('isHearingRelated').value === true &&\n formGroup.get('hearingDate').value === null}\">\n <fieldset class=\"govuk-fieldset\" role=\"group\">\n <legend>\n <label class=\"govuk-label govuk-label--s\">\n {{ 'What is the date of the hearing?' | rpxTranslate }}\n </label>\n </legend>\n <p id=\"hearingDate-error\" class=\"govuk-error-message\"\n *ngIf=\"submitted && formGroup.get('isHearingRelated').value === true && formGroup.get('hearingDate').value === null\">\n <span class=\"govuk-visually-hidden\">{{ 'Error:' | rpxTranslate }} </span>{{ raiseQueryErrorMessage.QUERY_HEARING_DATE | rpxTranslate }}\n </p>\n <ccd-query-write-date-input formControlName=\"hearingDate\"></ccd-query-write-date-input>\n </fieldset>\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n</div>\n" }]
|
|
24985
25009
|
}], () => [{ type: QueryManagementService }, { type: i1$1.ActivatedRoute }], { formGroup: [{
|
|
24986
25010
|
type: Input
|
|
24987
25011
|
}], submitted: [{
|
|
@@ -25005,7 +25029,7 @@ class QueryWriteRaiseQueryComponent {
|
|
|
25005
25029
|
}], queryDataCreated: [{
|
|
25006
25030
|
type: Output
|
|
25007
25031
|
}] }); })();
|
|
25008
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryWriteRaiseQueryComponent, { className: "QueryWriteRaiseQueryComponent", filePath: "lib/shared/components/palette/query-management/components/query-write/query-write-raise-query/query-write-raise-query.component.ts", lineNumber:
|
|
25032
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryWriteRaiseQueryComponent, { className: "QueryWriteRaiseQueryComponent", filePath: "lib/shared/components/palette/query-management/components/query-write/query-write-raise-query/query-write-raise-query.component.ts", lineNumber: 22 }); })();
|
|
25009
25033
|
|
|
25010
25034
|
function QueryWriteRespondToQueryComponent_ccd_query_case_details_header_9_Template(rf, ctx) { if (rf & 1) {
|
|
25011
25035
|
i0.ɵɵelement(0, "ccd-query-case-details-header", 8);
|
|
@@ -25026,7 +25050,7 @@ function QueryWriteRespondToQueryComponent_div_12_div_1_p_10_Template(rf, ctx) {
|
|
|
25026
25050
|
i0.ɵɵadvance(2);
|
|
25027
25051
|
i0.ɵɵtextInterpolate1("", i0.ɵɵpipeBind1(3, 2, "Error:"), " ");
|
|
25028
25052
|
i0.ɵɵadvance(2);
|
|
25029
|
-
i0.ɵɵtextInterpolate1("",
|
|
25053
|
+
i0.ɵɵtextInterpolate1("", i0.ɵɵpipeBind1(5, 4, ctx_r0.getBodyErrorMessage()), " ");
|
|
25030
25054
|
} }
|
|
25031
25055
|
function QueryWriteRespondToQueryComponent_div_12_div_1_Template(rf, ctx) { if (rf & 1) {
|
|
25032
25056
|
i0.ɵɵelementStart(0, "div")(1, "h1", 10);
|
|
@@ -25051,13 +25075,13 @@ function QueryWriteRespondToQueryComponent_div_12_div_1_Template(rf, ctx) { if (
|
|
|
25051
25075
|
i0.ɵɵadvance(2);
|
|
25052
25076
|
i0.ɵɵproperty("formGroup", ctx_r0.formGroup);
|
|
25053
25077
|
i0.ɵɵadvance();
|
|
25054
|
-
i0.ɵɵclassProp("govuk-form-group--error", ctx_r0.submitted && ((tmp_4_0 = ctx_r0.formGroup.get("body")) == null ? null : tmp_4_0.
|
|
25078
|
+
i0.ɵɵclassProp("govuk-form-group--error", ctx_r0.submitted && ((tmp_4_0 = ctx_r0.formGroup.get("body")) == null ? null : tmp_4_0.invalid));
|
|
25055
25079
|
i0.ɵɵadvance(3);
|
|
25056
25080
|
i0.ɵɵtextInterpolate1(" ", ctx_r0.queryCreateContext === ctx_r0.queryCreateContextEnum.RESPOND ? "Response detail" : i0.ɵɵpipeBind1(9, 11, "Query Body"), " ");
|
|
25057
25081
|
i0.ɵɵadvance(2);
|
|
25058
|
-
i0.ɵɵproperty("ngIf", ctx_r0.submitted && ((tmp_6_0 = ctx_r0.formGroup.get("body")) == null ? null : tmp_6_0.
|
|
25082
|
+
i0.ɵɵproperty("ngIf", ctx_r0.submitted && ((tmp_6_0 = ctx_r0.formGroup.get("body")) == null ? null : tmp_6_0.invalid));
|
|
25059
25083
|
i0.ɵɵadvance();
|
|
25060
|
-
i0.ɵɵclassProp("govuk-textarea--error", ctx_r0.submitted && ((tmp_7_0 = ctx_r0.formGroup.get("body")) == null ? null : tmp_7_0.
|
|
25084
|
+
i0.ɵɵclassProp("govuk-textarea--error", ctx_r0.submitted && ((tmp_7_0 = ctx_r0.formGroup.get("body")) == null ? null : tmp_7_0.invalid));
|
|
25061
25085
|
i0.ɵɵproperty("formControlName", "body");
|
|
25062
25086
|
} }
|
|
25063
25087
|
function QueryWriteRespondToQueryComponent_div_12_Template(rf, ctx) { if (rf & 1) {
|
|
@@ -25089,6 +25113,7 @@ class QueryWriteRespondToQueryComponent {
|
|
|
25089
25113
|
route;
|
|
25090
25114
|
queryManagementService;
|
|
25091
25115
|
logger = new StructuredLoggerService();
|
|
25116
|
+
static MARKDOWN_VALIDATOR = FormValidatorsService.markDownPatternValidator();
|
|
25092
25117
|
queryItem;
|
|
25093
25118
|
formGroup;
|
|
25094
25119
|
queryCreateContext;
|
|
@@ -25128,6 +25153,7 @@ class QueryWriteRespondToQueryComponent {
|
|
|
25128
25153
|
});
|
|
25129
25154
|
}
|
|
25130
25155
|
ngOnChanges() {
|
|
25156
|
+
this.addMarkdownValidator();
|
|
25131
25157
|
if (!this.caseQueriesCollections || this.caseQueriesCollections.length === 0) {
|
|
25132
25158
|
// Silent return – this is not an error.
|
|
25133
25159
|
return;
|
|
@@ -25157,7 +25183,7 @@ class QueryWriteRespondToQueryComponent {
|
|
|
25157
25183
|
this.queryResponseStatus = this.queryListData?.responseStatus;
|
|
25158
25184
|
const isCollectionDataSet = this.setCaseQueriesCollectionData();
|
|
25159
25185
|
if (isCollectionDataSet) {
|
|
25160
|
-
if (this.triggerSubmission) {
|
|
25186
|
+
if (this.triggerSubmission && this.formGroup.valid) {
|
|
25161
25187
|
const data = this.generateCaseQueriesCollectionData();
|
|
25162
25188
|
this.queryDataCreated.emit(data);
|
|
25163
25189
|
}
|
|
@@ -25167,6 +25193,16 @@ class QueryWriteRespondToQueryComponent {
|
|
|
25167
25193
|
this.hasRespondedToQuery = value;
|
|
25168
25194
|
this.hasRespondedToQueryTask.emit(value);
|
|
25169
25195
|
}
|
|
25196
|
+
getBodyErrorMessage() {
|
|
25197
|
+
if (this.formGroup.get('body')?.hasError('markDownPattern')) {
|
|
25198
|
+
return this.queryCreateContext === QueryCreateContext.RESPOND
|
|
25199
|
+
? this.raiseQueryErrorMessages.RESPOND_QUERY_BODY_MARKDOWN
|
|
25200
|
+
: this.raiseQueryErrorMessages.QUERY_BODY_MARKDOWN;
|
|
25201
|
+
}
|
|
25202
|
+
return this.queryCreateContext === QueryCreateContext.RESPOND
|
|
25203
|
+
? this.raiseQueryErrorMessages.RESPOND_QUERY_BODY
|
|
25204
|
+
: this.raiseQueryErrorMessages.QUERY_BODY;
|
|
25205
|
+
}
|
|
25170
25206
|
setCaseQueriesCollectionData() {
|
|
25171
25207
|
if (!this.eventData) {
|
|
25172
25208
|
this.logger.warn('Event data not available; skipping collection setup.');
|
|
@@ -25178,6 +25214,13 @@ class QueryWriteRespondToQueryComponent {
|
|
|
25178
25214
|
generateCaseQueriesCollectionData() {
|
|
25179
25215
|
return this.queryManagementService.generateCaseQueriesCollectionData(this.formGroup, this.queryCreateContext, this.queryItem, this.messageId);
|
|
25180
25216
|
}
|
|
25217
|
+
addMarkdownValidator() {
|
|
25218
|
+
const control = this.formGroup?.get('body');
|
|
25219
|
+
if (control) {
|
|
25220
|
+
control.addValidators(QueryWriteRespondToQueryComponent.MARKDOWN_VALIDATOR);
|
|
25221
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
25222
|
+
}
|
|
25223
|
+
}
|
|
25181
25224
|
static ɵfac = function QueryWriteRespondToQueryComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || QueryWriteRespondToQueryComponent)(i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(QueryManagementService)); };
|
|
25182
25225
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryWriteRespondToQueryComponent, selectors: [["ccd-query-write-respond-to-query"]], inputs: { queryItem: "queryItem", formGroup: "formGroup", queryCreateContext: "queryCreateContext", submitted: "submitted", caseQueriesCollections: "caseQueriesCollections", showForm: "showForm", triggerSubmission: "triggerSubmission", eventData: "eventData" }, outputs: { queryDataCreated: "queryDataCreated", hasRespondedToQueryTask: "hasRespondedToQueryTask" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 14, vars: 11, consts: [[1, "govuk-!-margin-bottom-6"], [1, "govuk-caption-l"], [1, "govuk-heading-l", "govuk-!-margin-bottom-0"], [1, "govuk-!-margin-bottom-4"], [3, "caseDetails", 4, "ngIf"], [3, "hasResponded", "query", "queryResponseStatus"], ["class", "query-respond", 4, "ngIf"], [4, "ngIf"], [3, "caseDetails"], [1, "query-respond"], [1, "govuk-heading-m"], [3, "formGroup"], [1, "govuk-form-group", "body-textarea"], [1, "govuk-label-wrapper"], ["for", "body", 1, "govuk-label", "govuk-label--m", "govuk-!-font-weight-bold"], ["id", "body-error", "class", "govuk-error-message", 4, "ngIf"], ["id", "body", "name", "body", "rows", "5", "aria-describedby", "body-hint body-error", 1, "govuk-textarea", 3, "formControlName"], ["id", "body-error", 1, "govuk-error-message"], [1, "govuk-visually-hidden"], [3, "formGroup", 4, "ngIf"]], template: function QueryWriteRespondToQueryComponent_Template(rf, ctx) { if (rf & 1) {
|
|
25183
25226
|
i0.ɵɵelementStart(0, "div", 0)(1, "div", 0)(2, "div", 1);
|
|
@@ -25212,7 +25255,7 @@ class QueryWriteRespondToQueryComponent {
|
|
|
25212
25255
|
}
|
|
25213
25256
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(QueryWriteRespondToQueryComponent, [{
|
|
25214
25257
|
type: Component,
|
|
25215
|
-
args: [{ selector: 'ccd-query-write-respond-to-query', standalone: false, template: "<div class=\"govuk-!-margin-bottom-6\">\n <div class=\"govuk-!-margin-bottom-6\">\n <div class=\"govuk-caption-l\">{{ 'Respond to a query' | rpxTranslate }}</div>\n <h1 class=\"govuk-heading-l govuk-!-margin-bottom-0\">{{ 'Query details' | rpxTranslate }}</h1>\n </div>\n\n <div class=\"govuk-!-margin-bottom-4\">\n <ccd-query-case-details-header [caseDetails]=\"caseDetails\" *ngIf=\"caseDetails\"></ccd-query-case-details-header>\n </div>\n\n <div>\n <ccd-query-details [query]=\"queryListData\"\n [queryResponseStatus]=\"queryResponseStatus\"\n (hasResponded)=\"hasResponded($event)\"></ccd-query-details>\n </div>\n</div>\n<div class=\"query-respond\" *ngIf=\"showForm\">\n <div *ngIf=\"!hasRespondedToQuery\">\n <h1 class=\"govuk-heading-m\">\n {{ queryCreateContext === queryCreateContextEnum.RESPOND ? 'Respond to a query' : 'Ask a follow-up question' | rpxTranslate }}\n </h1>\n\n <div [formGroup]=\"formGroup\">\n <div class=\"govuk-form-group body-textarea\"\n [class.govuk-form-group--error]=\"submitted && formGroup.get('body')?.
|
|
25258
|
+
args: [{ selector: 'ccd-query-write-respond-to-query', standalone: false, template: "<div class=\"govuk-!-margin-bottom-6\">\n <div class=\"govuk-!-margin-bottom-6\">\n <div class=\"govuk-caption-l\">{{ 'Respond to a query' | rpxTranslate }}</div>\n <h1 class=\"govuk-heading-l govuk-!-margin-bottom-0\">{{ 'Query details' | rpxTranslate }}</h1>\n </div>\n\n <div class=\"govuk-!-margin-bottom-4\">\n <ccd-query-case-details-header [caseDetails]=\"caseDetails\" *ngIf=\"caseDetails\"></ccd-query-case-details-header>\n </div>\n\n <div>\n <ccd-query-details [query]=\"queryListData\"\n [queryResponseStatus]=\"queryResponseStatus\"\n (hasResponded)=\"hasResponded($event)\"></ccd-query-details>\n </div>\n</div>\n<div class=\"query-respond\" *ngIf=\"showForm\">\n <div *ngIf=\"!hasRespondedToQuery\">\n <h1 class=\"govuk-heading-m\">\n {{ queryCreateContext === queryCreateContextEnum.RESPOND ? 'Respond to a query' : 'Ask a follow-up question' | rpxTranslate }}\n </h1>\n\n <div [formGroup]=\"formGroup\">\n <div class=\"govuk-form-group body-textarea\"\n [class.govuk-form-group--error]=\"submitted && formGroup.get('body')?.invalid\">\n <div class=\"govuk-label-wrapper\">\n <label class=\"govuk-label govuk-label--m govuk-!-font-weight-bold\" for=\"body\">\n {{ queryCreateContext === queryCreateContextEnum.RESPOND ? 'Response detail' : 'Query Body' | rpxTranslate }}\n </label>\n </div>\n <p id=\"body-error\" class=\"govuk-error-message\"\n *ngIf=\"submitted && formGroup.get('body')?.invalid\">\n <span class=\"govuk-visually-hidden\">{{ 'Error:' | rpxTranslate }} </span>{{ getBodyErrorMessage() | rpxTranslate }}\n </p>\n <textarea [formControlName]=\"'body'\" class=\"govuk-textarea\"\n [class.govuk-textarea--error]=\"submitted && formGroup.get('body')?.invalid\" id=\"body\"\n name=\"body\" rows=\"5\" aria-describedby=\"body-hint body-error\">\n </textarea>\n </div>\n </div>\n </div>\n</div>\n\n<ng-container *ngIf=\"queryCreateContext === queryCreateContextEnum.RESPOND\">\n <ccd-close-query *ngIf=\"!hasRespondedToQuery\"\n [formGroup]=\"formGroup\">\n </ccd-close-query>\n</ng-container>", styles: [".query-respond{width:100%;max-width:720px}\n"] }]
|
|
25216
25259
|
}], () => [{ type: CaseNotifier }, { type: i1$1.ActivatedRoute }, { type: QueryManagementService }], { queryItem: [{
|
|
25217
25260
|
type: Input
|
|
25218
25261
|
}], formGroup: [{
|
|
@@ -25234,7 +25277,7 @@ class QueryWriteRespondToQueryComponent {
|
|
|
25234
25277
|
}], hasRespondedToQueryTask: [{
|
|
25235
25278
|
type: Output
|
|
25236
25279
|
}] }); })();
|
|
25237
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryWriteRespondToQueryComponent, { className: "QueryWriteRespondToQueryComponent", filePath: "lib/shared/components/palette/query-management/components/query-write/query-write-respond-to-query/query-write-respond-to-query.component.ts", lineNumber:
|
|
25280
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryWriteRespondToQueryComponent, { className: "QueryWriteRespondToQueryComponent", filePath: "lib/shared/components/palette/query-management/components/query-write/query-write-respond-to-query/query-write-respond-to-query.component.ts", lineNumber: 21 }); })();
|
|
25238
25281
|
|
|
25239
25282
|
function QueryConfirmationComponent_main_0_ng_container_3_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
25240
25283
|
i0.ɵɵelementStart(0, "h1", 8);
|
|
@@ -25910,6 +25953,9 @@ function sanitiseRichTextDocument(documentElement) {
|
|
|
25910
25953
|
const listStart = tagName === 'ol' && /^\d{1,6}$/.test(element.getAttribute('start') || '')
|
|
25911
25954
|
? element.getAttribute('start')
|
|
25912
25955
|
: null;
|
|
25956
|
+
const listType = tagName === 'ol' && /^[ai]$/.test(element.getAttribute('type') || '')
|
|
25957
|
+
? element.getAttribute('type')
|
|
25958
|
+
: null;
|
|
25913
25959
|
while (element.attributes.length > 0) {
|
|
25914
25960
|
element.removeAttribute(element.attributes[0].name);
|
|
25915
25961
|
}
|
|
@@ -25922,6 +25968,9 @@ function sanitiseRichTextDocument(documentElement) {
|
|
|
25922
25968
|
if (listStart) {
|
|
25923
25969
|
element.setAttribute('start', listStart);
|
|
25924
25970
|
}
|
|
25971
|
+
if (listType) {
|
|
25972
|
+
element.setAttribute('type', listType);
|
|
25973
|
+
}
|
|
25925
25974
|
});
|
|
25926
25975
|
return documentElement.body.innerHTML;
|
|
25927
25976
|
}
|
|
@@ -25952,11 +26001,11 @@ class ReadRichTextAreaFieldComponent extends AbstractFieldReadComponent {
|
|
|
25952
26001
|
i0.ɵɵelement(0, "div", 0);
|
|
25953
26002
|
} if (rf & 2) {
|
|
25954
26003
|
i0.ɵɵproperty("innerHTML", ctx.sanitisedValue(), i0.ɵɵsanitizeHtml);
|
|
25955
|
-
} }, styles: ["@charset \"UTF-8\";.ccd-rich-text-area-read{overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal}.ccd-rich-text-area-read strong,.ccd-rich-text-area-read strong *,.ccd-rich-text-area-read b,.ccd-rich-text-area-read b *{font-weight:700}.ccd-rich-text-area-read strong u,.ccd-rich-text-area-read u strong,.ccd-rich-text-area-read b u,.ccd-rich-text-area-read u b{font-weight:700!important;text-decoration:underline}.ccd-rich-text-area-read p,.ccd-rich-text-area-read ul,.ccd-rich-text-area-read ol{margin-top:0;overflow-wrap:anywhere;word-break:normal}.ccd-rich-text-area-read p:empty:before{content:\"\\a0\"}.ccd-rich-text-area-read ul{list-style:disc outside;padding-left:25px}.ccd-rich-text-area-read ol{list-style:decimal outside;padding-left:25px}.ccd-rich-text-area-read li{display:list-item;margin-bottom:5px}.ccd-rich-text-area-read li>p{margin:0}.ccd-rich-text-area-read .ccd-rich-text-indent-1{margin-left:40px}.ccd-rich-text-area-read .ccd-rich-text-indent-2{margin-left:80px}.ccd-rich-text-area-read .ccd-rich-text-indent-3{margin-left:120px}.ccd-rich-text-area-read .ccd-rich-text-indent-4{margin-left:160px}.ccd-rich-text-area-read .ccd-rich-text-indent-5{margin-left:200px}.ccd-rich-text-area-read .ccd-rich-text-indent-6{margin-left:240px}\n"], encapsulation: 2 });
|
|
26004
|
+
} }, styles: ["@charset \"UTF-8\";.ccd-rich-text-area-read{overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal}.ccd-rich-text-area-read strong,.ccd-rich-text-area-read strong *,.ccd-rich-text-area-read b,.ccd-rich-text-area-read b *{font-weight:700}.ccd-rich-text-area-read strong u,.ccd-rich-text-area-read u strong,.ccd-rich-text-area-read b u,.ccd-rich-text-area-read u b{font-weight:700!important;text-decoration:underline}.ccd-rich-text-area-read p,.ccd-rich-text-area-read ul,.ccd-rich-text-area-read ol{margin-top:0;overflow-wrap:anywhere;word-break:normal}.ccd-rich-text-area-read p:empty:before{content:\"\\a0\"}.ccd-rich-text-area-read ul{list-style:disc outside;padding-left:25px}.ccd-rich-text-area-read ol{list-style:decimal outside;padding-left:25px}.ccd-rich-text-area-read ol[type=a]{list-style-type:lower-alpha}.ccd-rich-text-area-read ol[type=i]{list-style-type:lower-roman}.ccd-rich-text-area-read ol[type=i]>li::marker{content:\"(\" counter(list-item,lower-roman) \") \"}.ccd-rich-text-area-read li{display:list-item;margin-bottom:5px}.ccd-rich-text-area-read li>p{margin:0}.ccd-rich-text-area-read li>ul,.ccd-rich-text-area-read li>ol{margin-top:5px}.ccd-rich-text-area-read h1{font-size:20px;font-weight:700}.ccd-rich-text-area-read .ccd-rich-text-indent-1{margin-left:40px}.ccd-rich-text-area-read .ccd-rich-text-indent-2{margin-left:80px}.ccd-rich-text-area-read .ccd-rich-text-indent-3{margin-left:120px}.ccd-rich-text-area-read .ccd-rich-text-indent-4{margin-left:160px}.ccd-rich-text-area-read .ccd-rich-text-indent-5{margin-left:200px}.ccd-rich-text-area-read .ccd-rich-text-indent-6{margin-left:240px}\n"], encapsulation: 2 });
|
|
25956
26005
|
}
|
|
25957
26006
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadRichTextAreaFieldComponent, [{
|
|
25958
26007
|
type: Component,
|
|
25959
|
-
args: [{ selector: 'ccd-read-rich-text-area-field', template: `<div class="ccd-rich-text-area-read" [innerHTML]="sanitisedValue()"></div>`, encapsulation: ViewEncapsulation.None, standalone: false, styles: ["@charset \"UTF-8\";.ccd-rich-text-area-read{overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal}.ccd-rich-text-area-read strong,.ccd-rich-text-area-read strong *,.ccd-rich-text-area-read b,.ccd-rich-text-area-read b *{font-weight:700}.ccd-rich-text-area-read strong u,.ccd-rich-text-area-read u strong,.ccd-rich-text-area-read b u,.ccd-rich-text-area-read u b{font-weight:700!important;text-decoration:underline}.ccd-rich-text-area-read p,.ccd-rich-text-area-read ul,.ccd-rich-text-area-read ol{margin-top:0;overflow-wrap:anywhere;word-break:normal}.ccd-rich-text-area-read p:empty:before{content:\"\\a0\"}.ccd-rich-text-area-read ul{list-style:disc outside;padding-left:25px}.ccd-rich-text-area-read ol{list-style:decimal outside;padding-left:25px}.ccd-rich-text-area-read li{display:list-item;margin-bottom:5px}.ccd-rich-text-area-read li>p{margin:0}.ccd-rich-text-area-read .ccd-rich-text-indent-1{margin-left:40px}.ccd-rich-text-area-read .ccd-rich-text-indent-2{margin-left:80px}.ccd-rich-text-area-read .ccd-rich-text-indent-3{margin-left:120px}.ccd-rich-text-area-read .ccd-rich-text-indent-4{margin-left:160px}.ccd-rich-text-area-read .ccd-rich-text-indent-5{margin-left:200px}.ccd-rich-text-area-read .ccd-rich-text-indent-6{margin-left:240px}\n"] }]
|
|
26008
|
+
args: [{ selector: 'ccd-read-rich-text-area-field', template: `<div class="ccd-rich-text-area-read" [innerHTML]="sanitisedValue()"></div>`, encapsulation: ViewEncapsulation.None, standalone: false, styles: ["@charset \"UTF-8\";.ccd-rich-text-area-read{overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal}.ccd-rich-text-area-read strong,.ccd-rich-text-area-read strong *,.ccd-rich-text-area-read b,.ccd-rich-text-area-read b *{font-weight:700}.ccd-rich-text-area-read strong u,.ccd-rich-text-area-read u strong,.ccd-rich-text-area-read b u,.ccd-rich-text-area-read u b{font-weight:700!important;text-decoration:underline}.ccd-rich-text-area-read p,.ccd-rich-text-area-read ul,.ccd-rich-text-area-read ol{margin-top:0;overflow-wrap:anywhere;word-break:normal}.ccd-rich-text-area-read p:empty:before{content:\"\\a0\"}.ccd-rich-text-area-read ul{list-style:disc outside;padding-left:25px}.ccd-rich-text-area-read ol{list-style:decimal outside;padding-left:25px}.ccd-rich-text-area-read ol[type=a]{list-style-type:lower-alpha}.ccd-rich-text-area-read ol[type=i]{list-style-type:lower-roman}.ccd-rich-text-area-read ol[type=i]>li::marker{content:\"(\" counter(list-item,lower-roman) \") \"}.ccd-rich-text-area-read li{display:list-item;margin-bottom:5px}.ccd-rich-text-area-read li>p{margin:0}.ccd-rich-text-area-read li>ul,.ccd-rich-text-area-read li>ol{margin-top:5px}.ccd-rich-text-area-read h1{font-size:20px;font-weight:700}.ccd-rich-text-area-read .ccd-rich-text-indent-1{margin-left:40px}.ccd-rich-text-area-read .ccd-rich-text-indent-2{margin-left:80px}.ccd-rich-text-area-read .ccd-rich-text-indent-3{margin-left:120px}.ccd-rich-text-area-read .ccd-rich-text-indent-4{margin-left:160px}.ccd-rich-text-area-read .ccd-rich-text-indent-5{margin-left:200px}.ccd-rich-text-area-read .ccd-rich-text-indent-6{margin-left:240px}\n"] }]
|
|
25960
26009
|
}], () => [{ type: i1$5.DomSanitizer }], null); })();
|
|
25961
26010
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ReadRichTextAreaFieldComponent, { className: "ReadRichTextAreaFieldComponent", filePath: "lib/shared/components/palette/rich-text-area/read-rich-text-area-field.component.ts", lineNumber: 13 }); })();
|
|
25962
26011
|
|
|
@@ -25965,7 +26014,7 @@ const _c1$e = a0 => ({ "form-group-error": a0 });
|
|
|
25965
26014
|
const _c2$3 = a0 => ({ "ccd-rich-text-area__editor--error": a0 });
|
|
25966
26015
|
const _c3 = a0 => ({ "ccd-rich-text-area__toolbar-button--active": a0 });
|
|
25967
26016
|
function WriteRichTextAreaFieldComponent_span_2_Template(rf, ctx) { if (rf & 1) {
|
|
25968
|
-
i0.ɵɵelementStart(0, "span",
|
|
26017
|
+
i0.ɵɵelementStart(0, "span", 41);
|
|
25969
26018
|
i0.ɵɵtext(1);
|
|
25970
26019
|
i0.ɵɵpipe(2, "ccdFieldLabel");
|
|
25971
26020
|
i0.ɵɵelementEnd();
|
|
@@ -25975,7 +26024,7 @@ function WriteRichTextAreaFieldComponent_span_2_Template(rf, ctx) { if (rf & 1)
|
|
|
25975
26024
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r1.caseField));
|
|
25976
26025
|
} }
|
|
25977
26026
|
function WriteRichTextAreaFieldComponent_span_3_Template(rf, ctx) { if (rf & 1) {
|
|
25978
|
-
i0.ɵɵelementStart(0, "span",
|
|
26027
|
+
i0.ɵɵelementStart(0, "span", 42);
|
|
25979
26028
|
i0.ɵɵtext(1);
|
|
25980
26029
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
25981
26030
|
i0.ɵɵelementEnd();
|
|
@@ -25986,7 +26035,7 @@ function WriteRichTextAreaFieldComponent_span_3_Template(rf, ctx) { if (rf & 1)
|
|
|
25986
26035
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 2, ctx_r1.caseField.hint_text));
|
|
25987
26036
|
} }
|
|
25988
26037
|
function WriteRichTextAreaFieldComponent_span_4_Template(rf, ctx) { if (rf & 1) {
|
|
25989
|
-
i0.ɵɵelementStart(0, "span",
|
|
26038
|
+
i0.ɵɵelementStart(0, "span", 43);
|
|
25990
26039
|
i0.ɵɵtext(1);
|
|
25991
26040
|
i0.ɵɵpipe(2, "ccdFirstError");
|
|
25992
26041
|
i0.ɵɵelementEnd();
|
|
@@ -25996,6 +26045,29 @@ function WriteRichTextAreaFieldComponent_span_4_Template(rf, ctx) { if (rf & 1)
|
|
|
25996
26045
|
i0.ɵɵadvance();
|
|
25997
26046
|
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind2(2, 2, ctx_r1.richTextAreaControl.errors, ctx_r1.caseField.label), " ");
|
|
25998
26047
|
} }
|
|
26048
|
+
function WriteRichTextAreaFieldComponent_option_41_Template(rf, ctx) { if (rf & 1) {
|
|
26049
|
+
i0.ɵɵelementStart(0, "option", 44);
|
|
26050
|
+
i0.ɵɵtext(1, "No list");
|
|
26051
|
+
i0.ɵɵelementEnd();
|
|
26052
|
+
} }
|
|
26053
|
+
function orderedListStyleForType(type) {
|
|
26054
|
+
if (type === 'a') {
|
|
26055
|
+
return 'lower-alpha';
|
|
26056
|
+
}
|
|
26057
|
+
if (type === 'i') {
|
|
26058
|
+
return 'lower-roman';
|
|
26059
|
+
}
|
|
26060
|
+
return null;
|
|
26061
|
+
}
|
|
26062
|
+
function orderedListTypeForStyle(style) {
|
|
26063
|
+
if (style === 'lower-alpha') {
|
|
26064
|
+
return 'a';
|
|
26065
|
+
}
|
|
26066
|
+
if (style === 'lower-roman') {
|
|
26067
|
+
return 'i';
|
|
26068
|
+
}
|
|
26069
|
+
return null;
|
|
26070
|
+
}
|
|
25999
26071
|
const WORD_COLUMN_SPACING = 12;
|
|
26000
26072
|
const MAX_INDENT = 6;
|
|
26001
26073
|
const CSS_LENGTH_UNITS = ['rem', 'px', 'pt', 'in', 'cm', 'mm', 'em'];
|
|
@@ -26005,11 +26077,16 @@ const BLOCK_NODE_NAMES = new Set([
|
|
|
26005
26077
|
]);
|
|
26006
26078
|
const richTextNodes = {
|
|
26007
26079
|
...nodes,
|
|
26080
|
+
list_item: {
|
|
26081
|
+
...nodes.list_item,
|
|
26082
|
+
content: '(paragraph | heading) block*'
|
|
26083
|
+
},
|
|
26008
26084
|
ordered_list: {
|
|
26009
26085
|
...nodes.ordered_list,
|
|
26010
26086
|
attrs: {
|
|
26011
26087
|
order: { default: 1 },
|
|
26012
|
-
indent: { default: null }
|
|
26088
|
+
indent: { default: null },
|
|
26089
|
+
listStyle: { default: null }
|
|
26013
26090
|
},
|
|
26014
26091
|
parseDOM: [{
|
|
26015
26092
|
tag: 'ol',
|
|
@@ -26017,28 +26094,35 @@ const richTextNodes = {
|
|
|
26017
26094
|
const list = element;
|
|
26018
26095
|
return {
|
|
26019
26096
|
order: list.hasAttribute('start') ? Number(list.getAttribute('start')) : 1,
|
|
26020
|
-
indent: Number(list.
|
|
26097
|
+
indent: Number(list.dataset.indent) || null,
|
|
26098
|
+
listStyle: orderedListStyleForType(list.getAttribute('type'))
|
|
26021
26099
|
};
|
|
26022
26100
|
}
|
|
26023
26101
|
}],
|
|
26024
26102
|
toDOM: (node) => ['ol', {
|
|
26025
26103
|
start: node.attrs.order === 1 ? null : node.attrs.order,
|
|
26026
|
-
'data-indent': node.attrs.indent
|
|
26104
|
+
'data-indent': node.attrs.indent,
|
|
26105
|
+
type: orderedListTypeForStyle(node.attrs.listStyle)
|
|
26027
26106
|
}, 0]
|
|
26028
26107
|
},
|
|
26029
26108
|
bullet_list: {
|
|
26030
26109
|
...nodes.bullet_list,
|
|
26031
26110
|
attrs: {
|
|
26032
|
-
indent: { default: null }
|
|
26111
|
+
indent: { default: null },
|
|
26112
|
+
continuationOrder: { default: null }
|
|
26033
26113
|
},
|
|
26034
26114
|
parseDOM: [{
|
|
26035
26115
|
tag: 'ul',
|
|
26036
26116
|
getAttrs: (element) => {
|
|
26037
26117
|
const list = element;
|
|
26038
|
-
return {
|
|
26118
|
+
return {
|
|
26119
|
+
indent: Number(list.dataset.indent) || null
|
|
26120
|
+
};
|
|
26039
26121
|
}
|
|
26040
26122
|
}],
|
|
26041
|
-
toDOM: (node) => ['ul', {
|
|
26123
|
+
toDOM: (node) => ['ul', {
|
|
26124
|
+
'data-indent': node.attrs.indent
|
|
26125
|
+
}, 0]
|
|
26042
26126
|
}
|
|
26043
26127
|
};
|
|
26044
26128
|
const richTextSchema = new Schema({ nodes: richTextNodes, marks: marks });
|
|
@@ -26064,7 +26148,10 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26064
26148
|
plugins: [
|
|
26065
26149
|
new Plugin({
|
|
26066
26150
|
props: {
|
|
26067
|
-
handlePaste: (_view, event) => this.handleEditorPaste(event)
|
|
26151
|
+
handlePaste: (_view, event) => this.handleEditorPaste(event),
|
|
26152
|
+
handleDOMEvents: {
|
|
26153
|
+
keydown: (_view, event) => this.handleEditorKeyDown(event)
|
|
26154
|
+
}
|
|
26068
26155
|
}
|
|
26069
26156
|
})
|
|
26070
26157
|
],
|
|
@@ -26111,6 +26198,9 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26111
26198
|
errorId() {
|
|
26112
26199
|
return `${this.id()}_error`;
|
|
26113
26200
|
}
|
|
26201
|
+
listStyleId() {
|
|
26202
|
+
return `${this.id()}_list_style`;
|
|
26203
|
+
}
|
|
26114
26204
|
toolbarLabel() {
|
|
26115
26205
|
return `${this.caseField.label || this.caseField.id} formatting options`;
|
|
26116
26206
|
}
|
|
@@ -26124,6 +26214,53 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26124
26214
|
onToolbarButtonMouseDown(event) {
|
|
26125
26215
|
event.preventDefault();
|
|
26126
26216
|
}
|
|
26217
|
+
handleEditorKeyDown(event) {
|
|
26218
|
+
const isUnmodifiedEnter = event.key === 'Enter' &&
|
|
26219
|
+
!event.shiftKey &&
|
|
26220
|
+
!event.altKey &&
|
|
26221
|
+
!event.ctrlKey &&
|
|
26222
|
+
!event.metaKey;
|
|
26223
|
+
if (isUnmodifiedEnter && this.splitListContinuationParagraph()) {
|
|
26224
|
+
event.preventDefault();
|
|
26225
|
+
event.stopPropagation();
|
|
26226
|
+
return true;
|
|
26227
|
+
}
|
|
26228
|
+
if (event.key !== 'Tab' || !this.isNodeActive('list_item')) {
|
|
26229
|
+
return false;
|
|
26230
|
+
}
|
|
26231
|
+
this.executeToolbarCommand(event, event.shiftKey ? 'outdent' : 'indent');
|
|
26232
|
+
return true;
|
|
26233
|
+
}
|
|
26234
|
+
splitListContinuationParagraph() {
|
|
26235
|
+
const { state, dispatch } = this.editor.view;
|
|
26236
|
+
const { $from, empty } = state.selection;
|
|
26237
|
+
const textBlock = $from.parent;
|
|
26238
|
+
if (!empty || !textBlock.isTextblock) {
|
|
26239
|
+
return false;
|
|
26240
|
+
}
|
|
26241
|
+
let isContinuation = false;
|
|
26242
|
+
for (let depth = $from.depth - 1; depth > 0; depth--) {
|
|
26243
|
+
const node = $from.node(depth);
|
|
26244
|
+
if (node.type.name !== 'list_item') {
|
|
26245
|
+
continue;
|
|
26246
|
+
}
|
|
26247
|
+
isContinuation = depth < $from.depth &&
|
|
26248
|
+
$from.node(depth + 1) === textBlock &&
|
|
26249
|
+
node.firstChild !== textBlock;
|
|
26250
|
+
break;
|
|
26251
|
+
}
|
|
26252
|
+
if (!isContinuation) {
|
|
26253
|
+
return false;
|
|
26254
|
+
}
|
|
26255
|
+
const textBlockStart = $from.before($from.depth);
|
|
26256
|
+
const before = textBlock.type.create(textBlock.attrs, textBlock.content.cut(0, $from.parentOffset), textBlock.marks);
|
|
26257
|
+
const after = textBlock.type.create(textBlock.attrs, textBlock.content.cut($from.parentOffset), textBlock.marks);
|
|
26258
|
+
const transaction = state.tr.replaceWith(textBlockStart, $from.after($from.depth), Fragment.fromArray([before, after]));
|
|
26259
|
+
transaction.setSelection(TextSelection.create(transaction.doc, textBlockStart + before.nodeSize + 1));
|
|
26260
|
+
transaction.setStoredMarks(state.storedMarks || $from.marks());
|
|
26261
|
+
dispatch(transaction.scrollIntoView());
|
|
26262
|
+
return true;
|
|
26263
|
+
}
|
|
26127
26264
|
executeToolbarCommand(event, command) {
|
|
26128
26265
|
event.preventDefault();
|
|
26129
26266
|
event.stopPropagation();
|
|
@@ -26146,6 +26283,9 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26146
26283
|
case 'paragraph':
|
|
26147
26284
|
this.toggleParagraph();
|
|
26148
26285
|
break;
|
|
26286
|
+
case 'heading':
|
|
26287
|
+
this.toggleHeading();
|
|
26288
|
+
break;
|
|
26149
26289
|
case 'indent':
|
|
26150
26290
|
this.changeIndent(true);
|
|
26151
26291
|
break;
|
|
@@ -26153,11 +26293,10 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26153
26293
|
this.changeIndent(false);
|
|
26154
26294
|
break;
|
|
26155
26295
|
case 'ordered_list':
|
|
26156
|
-
this.
|
|
26157
|
-
this.paragraphCommandApplied = false;
|
|
26296
|
+
this.toggleOrderedList();
|
|
26158
26297
|
break;
|
|
26159
26298
|
case 'bullet_list':
|
|
26160
|
-
this.
|
|
26299
|
+
this.toggleBulletList();
|
|
26161
26300
|
this.paragraphCommandApplied = false;
|
|
26162
26301
|
break;
|
|
26163
26302
|
default:
|
|
@@ -26171,6 +26310,424 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26171
26310
|
isToolbarCommandActive(command) {
|
|
26172
26311
|
return !!this.activeToolbarCommands[command];
|
|
26173
26312
|
}
|
|
26313
|
+
currentListStyle() {
|
|
26314
|
+
const activeList = this.activeListNode();
|
|
26315
|
+
if (activeList?.type.name === 'ordered_list') {
|
|
26316
|
+
const orderedListStyle = activeList.attrs.listStyle || 'decimal';
|
|
26317
|
+
if (orderedListStyle === 'lower-alpha') {
|
|
26318
|
+
return 'ordered_alpha';
|
|
26319
|
+
}
|
|
26320
|
+
if (orderedListStyle === 'lower-roman') {
|
|
26321
|
+
return 'ordered_roman';
|
|
26322
|
+
}
|
|
26323
|
+
return 'ordered_list';
|
|
26324
|
+
}
|
|
26325
|
+
if (activeList?.type.name === 'bullet_list') {
|
|
26326
|
+
return 'bullet_list';
|
|
26327
|
+
}
|
|
26328
|
+
return '';
|
|
26329
|
+
}
|
|
26330
|
+
currentListSelectValue() {
|
|
26331
|
+
const currentListStyle = this.currentListStyle();
|
|
26332
|
+
return currentListStyle === 'bullet_list' ? '' : currentListStyle;
|
|
26333
|
+
}
|
|
26334
|
+
isOrderedListActive() {
|
|
26335
|
+
return this.listType(this.currentListStyle()) === 'ordered_list';
|
|
26336
|
+
}
|
|
26337
|
+
onListStyleChange(event) {
|
|
26338
|
+
const select = event.target;
|
|
26339
|
+
const listStyle = select.value;
|
|
26340
|
+
if (!listStyle) {
|
|
26341
|
+
select.value = this.currentListSelectValue();
|
|
26342
|
+
return;
|
|
26343
|
+
}
|
|
26344
|
+
this.applyListStyleSelection(listStyle);
|
|
26345
|
+
this.richTextAreaControl.markAsDirty();
|
|
26346
|
+
this.editor.view.focus();
|
|
26347
|
+
this.updateToolbarState();
|
|
26348
|
+
this.syncAccessibilityLater();
|
|
26349
|
+
}
|
|
26350
|
+
applyListStyleSelection(listStyle) {
|
|
26351
|
+
const currentListStyle = this.currentListStyle();
|
|
26352
|
+
if (listStyle === currentListStyle) {
|
|
26353
|
+
if (listStyle === 'ordered_list') {
|
|
26354
|
+
this.changeActiveListType('ordered_list', 'decimal');
|
|
26355
|
+
}
|
|
26356
|
+
return;
|
|
26357
|
+
}
|
|
26358
|
+
const currentListType = this.listType(currentListStyle);
|
|
26359
|
+
const nextListType = this.listType(listStyle);
|
|
26360
|
+
if (currentListType && nextListType && currentListType !== nextListType) {
|
|
26361
|
+
this.changeActiveListType(nextListType, this.orderedListStyle(listStyle));
|
|
26362
|
+
}
|
|
26363
|
+
else if (nextListType === 'ordered_list') {
|
|
26364
|
+
if (currentListType !== 'ordered_list') {
|
|
26365
|
+
const rebuiltIndentedList = this.rebuildSelectedIndentedBlocksAsList('ordered_list', this.orderedListStyle(listStyle));
|
|
26366
|
+
if (!rebuiltIndentedList) {
|
|
26367
|
+
this.editor.commands.toggleOrderedList().exec();
|
|
26368
|
+
}
|
|
26369
|
+
}
|
|
26370
|
+
this.applyOrderedListStyle(this.orderedListStyle(listStyle));
|
|
26371
|
+
}
|
|
26372
|
+
else if (listStyle === 'bullet_list') {
|
|
26373
|
+
if (currentListType !== 'bullet_list') {
|
|
26374
|
+
this.editor.commands.toggleBulletList().exec();
|
|
26375
|
+
}
|
|
26376
|
+
}
|
|
26377
|
+
else {
|
|
26378
|
+
this.applyParagraph();
|
|
26379
|
+
this.paragraphCommandApplied = true;
|
|
26380
|
+
}
|
|
26381
|
+
}
|
|
26382
|
+
changeActiveListType(listType, orderedListStyle) {
|
|
26383
|
+
const { state, dispatch } = this.editor.view;
|
|
26384
|
+
const { $from } = state.selection;
|
|
26385
|
+
const targetType = state.schema.nodes[listType];
|
|
26386
|
+
if (this.changeFullySelectedListHierarchy(listType, orderedListStyle)) {
|
|
26387
|
+
return;
|
|
26388
|
+
}
|
|
26389
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26390
|
+
const node = $from.node(depth);
|
|
26391
|
+
if (node.type.name !== 'ordered_list' && node.type.name !== 'bullet_list') {
|
|
26392
|
+
continue;
|
|
26393
|
+
}
|
|
26394
|
+
const transaction = state.tr;
|
|
26395
|
+
let nextOrder = 1;
|
|
26396
|
+
this.contiguousListPositions(depth, listType).forEach(({ position, list }) => {
|
|
26397
|
+
const indent = Number(list.attrs.indent) || null;
|
|
26398
|
+
const attrs = listType === 'ordered_list'
|
|
26399
|
+
? {
|
|
26400
|
+
order: nextOrder,
|
|
26401
|
+
indent,
|
|
26402
|
+
listStyle: orderedListStyle === 'decimal' ? null : orderedListStyle
|
|
26403
|
+
}
|
|
26404
|
+
: {
|
|
26405
|
+
indent,
|
|
26406
|
+
continuationOrder: Number(list.attrs.order) || null
|
|
26407
|
+
};
|
|
26408
|
+
transaction.setNodeMarkup(position, targetType, attrs);
|
|
26409
|
+
nextOrder += list.childCount;
|
|
26410
|
+
});
|
|
26411
|
+
dispatch(transaction);
|
|
26412
|
+
return;
|
|
26413
|
+
}
|
|
26414
|
+
}
|
|
26415
|
+
changeFullySelectedListHierarchy(listType, rootStyle) {
|
|
26416
|
+
const { state, dispatch } = this.editor.view;
|
|
26417
|
+
const { $from, $to, empty, from, to } = state.selection;
|
|
26418
|
+
const targetListType = state.schema.nodes[listType];
|
|
26419
|
+
if (empty || !targetListType) {
|
|
26420
|
+
return false;
|
|
26421
|
+
}
|
|
26422
|
+
for (let depth = 1; depth <= $from.depth; depth++) {
|
|
26423
|
+
const list = $from.node(depth);
|
|
26424
|
+
if (!this.isListNode(list) || $to.depth < depth || $to.node(depth) !== list ||
|
|
26425
|
+
$from.index(depth) !== 0 || $to.indexAfter(depth) !== list.childCount) {
|
|
26426
|
+
continue;
|
|
26427
|
+
}
|
|
26428
|
+
const listPosition = $from.before(depth);
|
|
26429
|
+
if (!this.selectionCoversListContent(list, listPosition, from, to)) {
|
|
26430
|
+
continue;
|
|
26431
|
+
}
|
|
26432
|
+
const transaction = state.tr;
|
|
26433
|
+
const changeListHierarchy = (node, position, listDepth) => {
|
|
26434
|
+
const orderedStyle = this.orderedListStyleAtDepth(rootStyle, listDepth);
|
|
26435
|
+
const indent = Number(node.attrs.indent) || null;
|
|
26436
|
+
const attrs = listType === 'ordered_list'
|
|
26437
|
+
? {
|
|
26438
|
+
order: 1,
|
|
26439
|
+
indent,
|
|
26440
|
+
listStyle: orderedStyle === 'decimal' ? null : orderedStyle
|
|
26441
|
+
}
|
|
26442
|
+
: {
|
|
26443
|
+
indent,
|
|
26444
|
+
continuationOrder: Number(node.attrs.order) || null
|
|
26445
|
+
};
|
|
26446
|
+
transaction.setNodeMarkup(position, targetListType, attrs);
|
|
26447
|
+
node.forEach((child, childOffset) => {
|
|
26448
|
+
const childPosition = position + 1 + childOffset;
|
|
26449
|
+
if (this.isListNode(child)) {
|
|
26450
|
+
changeListHierarchy(child, childPosition, listDepth + 1);
|
|
26451
|
+
return;
|
|
26452
|
+
}
|
|
26453
|
+
child.descendants((descendant, descendantOffset) => {
|
|
26454
|
+
if (!this.isListNode(descendant)) {
|
|
26455
|
+
return true;
|
|
26456
|
+
}
|
|
26457
|
+
changeListHierarchy(descendant, childPosition + descendantOffset + 1, listDepth + 1);
|
|
26458
|
+
return false;
|
|
26459
|
+
});
|
|
26460
|
+
});
|
|
26461
|
+
};
|
|
26462
|
+
changeListHierarchy(list, listPosition, 0);
|
|
26463
|
+
dispatch(transaction.scrollIntoView());
|
|
26464
|
+
return true;
|
|
26465
|
+
}
|
|
26466
|
+
return false;
|
|
26467
|
+
}
|
|
26468
|
+
contiguousListPositions(depth, targetListType) {
|
|
26469
|
+
const { $from } = this.editor.view.state.selection;
|
|
26470
|
+
const parentDepth = depth - 1;
|
|
26471
|
+
const parent = $from.node(parentDepth);
|
|
26472
|
+
const activeList = $from.node(depth);
|
|
26473
|
+
const activeIndex = $from.index(parentDepth);
|
|
26474
|
+
const includedIndexes = new Set([activeIndex]);
|
|
26475
|
+
this.collectContiguousListIndexes(parent, activeList, activeIndex, -1, targetListType, includedIndexes);
|
|
26476
|
+
this.collectContiguousListIndexes(parent, activeList, activeIndex, 1, targetListType, includedIndexes);
|
|
26477
|
+
const positions = [];
|
|
26478
|
+
parent.forEach((child, childOffset, index) => {
|
|
26479
|
+
if (includedIndexes.has(index) && this.isList(child)) {
|
|
26480
|
+
positions.push({ position: $from.start(parentDepth) + childOffset, list: child });
|
|
26481
|
+
}
|
|
26482
|
+
});
|
|
26483
|
+
return positions;
|
|
26484
|
+
}
|
|
26485
|
+
collectContiguousListIndexes(parent, activeList, activeIndex, direction, targetListType, includedIndexes) {
|
|
26486
|
+
let adjacentList = activeList;
|
|
26487
|
+
let crossedContent = false;
|
|
26488
|
+
let crossedSectionHeading = false;
|
|
26489
|
+
for (let index = activeIndex + direction; index >= 0 && index < parent.childCount; index += direction) {
|
|
26490
|
+
const child = parent.child(index);
|
|
26491
|
+
if (this.isEmptyParagraph(child)) {
|
|
26492
|
+
continue;
|
|
26493
|
+
}
|
|
26494
|
+
const matchesActiveList = this.hasMatchingListType(child, activeList);
|
|
26495
|
+
const isMixedListToRepair = crossedSectionHeading && this.isList(child) &&
|
|
26496
|
+
child.type.name !== activeList.type.name && targetListType === activeList.type.name;
|
|
26497
|
+
if (matchesActiveList || isMixedListToRepair) {
|
|
26498
|
+
const isHeadingSeparatedBulletList = activeList.type.name === 'bullet_list';
|
|
26499
|
+
if (matchesActiveList && crossedContent && !isHeadingSeparatedBulletList &&
|
|
26500
|
+
!this.isSequentialList(child, adjacentList, direction)) {
|
|
26501
|
+
return;
|
|
26502
|
+
}
|
|
26503
|
+
includedIndexes.add(index);
|
|
26504
|
+
adjacentList = child;
|
|
26505
|
+
crossedContent = false;
|
|
26506
|
+
crossedSectionHeading = false;
|
|
26507
|
+
continue;
|
|
26508
|
+
}
|
|
26509
|
+
if (this.isList(child)) {
|
|
26510
|
+
return;
|
|
26511
|
+
}
|
|
26512
|
+
if (activeList.type.name === 'bullet_list') {
|
|
26513
|
+
if (!this.isListSectionHeading(child)) {
|
|
26514
|
+
return;
|
|
26515
|
+
}
|
|
26516
|
+
}
|
|
26517
|
+
else if (!this.hasListContinuation(activeList)) {
|
|
26518
|
+
return;
|
|
26519
|
+
}
|
|
26520
|
+
crossedContent = true;
|
|
26521
|
+
crossedSectionHeading = crossedSectionHeading || this.isListSectionHeading(child);
|
|
26522
|
+
}
|
|
26523
|
+
}
|
|
26524
|
+
isSequentialList(candidateList, adjacentList, direction) {
|
|
26525
|
+
const candidateOrder = this.listContinuationOrder(candidateList);
|
|
26526
|
+
const adjacentOrder = this.listContinuationOrder(adjacentList);
|
|
26527
|
+
if (!candidateOrder || !adjacentOrder) {
|
|
26528
|
+
return false;
|
|
26529
|
+
}
|
|
26530
|
+
return direction === 1
|
|
26531
|
+
? candidateOrder === adjacentOrder + adjacentList.childCount
|
|
26532
|
+
: candidateOrder + candidateList.childCount === adjacentOrder;
|
|
26533
|
+
}
|
|
26534
|
+
hasListContinuation(list) {
|
|
26535
|
+
return list.type.name === 'ordered_list' || Boolean(list.attrs.continuationOrder);
|
|
26536
|
+
}
|
|
26537
|
+
listContinuationOrder(list) {
|
|
26538
|
+
return Number(list.type.name === 'ordered_list' ? list.attrs.order : list.attrs.continuationOrder) || null;
|
|
26539
|
+
}
|
|
26540
|
+
isList(node) {
|
|
26541
|
+
return node.type.name === 'ordered_list' || node.type.name === 'bullet_list';
|
|
26542
|
+
}
|
|
26543
|
+
hasMatchingListType(node, activeList) {
|
|
26544
|
+
if (node.type !== activeList.type) {
|
|
26545
|
+
return false;
|
|
26546
|
+
}
|
|
26547
|
+
return node.type.name !== 'ordered_list' ||
|
|
26548
|
+
(node.attrs.listStyle || 'decimal') === (activeList.attrs.listStyle || 'decimal');
|
|
26549
|
+
}
|
|
26550
|
+
isEmptyParagraph(node) {
|
|
26551
|
+
return node.type.name === 'paragraph' && !node.textContent.trim();
|
|
26552
|
+
}
|
|
26553
|
+
isListSectionHeading(node) {
|
|
26554
|
+
if (!node.textContent.trim()) {
|
|
26555
|
+
return false;
|
|
26556
|
+
}
|
|
26557
|
+
if (node.type.name === 'heading') {
|
|
26558
|
+
return true;
|
|
26559
|
+
}
|
|
26560
|
+
if (node.type.name !== 'paragraph') {
|
|
26561
|
+
return false;
|
|
26562
|
+
}
|
|
26563
|
+
let hasText = false;
|
|
26564
|
+
let allTextIsBold = true;
|
|
26565
|
+
node.descendants((child) => {
|
|
26566
|
+
if (child.isText && child.textContent.trim()) {
|
|
26567
|
+
hasText = true;
|
|
26568
|
+
allTextIsBold = allTextIsBold && child.marks.some((mark) => mark.type.name === 'strong');
|
|
26569
|
+
}
|
|
26570
|
+
});
|
|
26571
|
+
return hasText && allTextIsBold;
|
|
26572
|
+
}
|
|
26573
|
+
toggleBulletList() {
|
|
26574
|
+
const currentListStyle = this.currentListStyle();
|
|
26575
|
+
const currentListType = this.listType(currentListStyle);
|
|
26576
|
+
if (currentListType === 'ordered_list') {
|
|
26577
|
+
this.changeActiveListType('bullet_list', 'decimal');
|
|
26578
|
+
return;
|
|
26579
|
+
}
|
|
26580
|
+
if (currentListType === 'bullet_list') {
|
|
26581
|
+
this.applyParagraph();
|
|
26582
|
+
this.paragraphCommandApplied = false;
|
|
26583
|
+
return;
|
|
26584
|
+
}
|
|
26585
|
+
if (!this.rebuildSelectedIndentedBlocksAsList('bullet_list', 'decimal')) {
|
|
26586
|
+
this.editor.commands.toggleBulletList().exec();
|
|
26587
|
+
}
|
|
26588
|
+
this.joinAdjacentLists('bullet_list');
|
|
26589
|
+
this.paragraphCommandApplied = false;
|
|
26590
|
+
}
|
|
26591
|
+
toggleOrderedList() {
|
|
26592
|
+
if (this.isOrderedListActive()) {
|
|
26593
|
+
const continuation = this.orderedListContinuationAfterSelection();
|
|
26594
|
+
this.applyParagraph();
|
|
26595
|
+
this.restoreOrderedListContinuation(continuation);
|
|
26596
|
+
this.paragraphCommandApplied = false;
|
|
26597
|
+
return;
|
|
26598
|
+
}
|
|
26599
|
+
this.applyListStyleSelection('ordered_list');
|
|
26600
|
+
this.joinAdjacentLists('ordered_list');
|
|
26601
|
+
this.paragraphCommandApplied = false;
|
|
26602
|
+
}
|
|
26603
|
+
orderedListContinuationAfterSelection() {
|
|
26604
|
+
const { state } = this.editor.view;
|
|
26605
|
+
const { $from, $to } = state.selection;
|
|
26606
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26607
|
+
const list = $from.node(depth);
|
|
26608
|
+
if (list.type.name !== 'ordered_list') {
|
|
26609
|
+
continue;
|
|
26610
|
+
}
|
|
26611
|
+
const fromIndex = $from.index(depth);
|
|
26612
|
+
const toIndex = $to.depth >= depth && $to.node(depth) === list
|
|
26613
|
+
? $to.indexAfter(depth)
|
|
26614
|
+
: fromIndex + 1;
|
|
26615
|
+
if (toIndex >= list.childCount) {
|
|
26616
|
+
return null;
|
|
26617
|
+
}
|
|
26618
|
+
return {
|
|
26619
|
+
text: list.child(toIndex).textContent,
|
|
26620
|
+
order: (Number(list.attrs.order) || 1) + fromIndex,
|
|
26621
|
+
listStyle: list.attrs.listStyle || null
|
|
26622
|
+
};
|
|
26623
|
+
}
|
|
26624
|
+
return null;
|
|
26625
|
+
}
|
|
26626
|
+
restoreOrderedListContinuation(continuation) {
|
|
26627
|
+
if (!continuation) {
|
|
26628
|
+
return;
|
|
26629
|
+
}
|
|
26630
|
+
const { state, dispatch } = this.editor.view;
|
|
26631
|
+
let listPosition = null;
|
|
26632
|
+
let listNode = null;
|
|
26633
|
+
state.doc.descendants((node, position) => {
|
|
26634
|
+
if (listPosition !== null || node.type.name !== 'ordered_list' || !node.childCount) {
|
|
26635
|
+
return listPosition === null;
|
|
26636
|
+
}
|
|
26637
|
+
if (node.firstChild.textContent === continuation.text &&
|
|
26638
|
+
(node.attrs.listStyle || null) === continuation.listStyle) {
|
|
26639
|
+
listPosition = position;
|
|
26640
|
+
listNode = node;
|
|
26641
|
+
return false;
|
|
26642
|
+
}
|
|
26643
|
+
return true;
|
|
26644
|
+
});
|
|
26645
|
+
if (listPosition !== null && listNode && Number(listNode.attrs.order) !== continuation.order) {
|
|
26646
|
+
dispatch(state.tr.setNodeMarkup(listPosition, listNode.type, {
|
|
26647
|
+
...listNode.attrs,
|
|
26648
|
+
order: continuation.order
|
|
26649
|
+
}));
|
|
26650
|
+
}
|
|
26651
|
+
}
|
|
26652
|
+
joinAdjacentLists(listType) {
|
|
26653
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
26654
|
+
const { state, dispatch } = this.editor.view;
|
|
26655
|
+
const { $from } = state.selection;
|
|
26656
|
+
let joined = false;
|
|
26657
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26658
|
+
const activeList = $from.node(depth);
|
|
26659
|
+
if (activeList.type.name !== listType) {
|
|
26660
|
+
continue;
|
|
26661
|
+
}
|
|
26662
|
+
const parent = $from.node(depth - 1);
|
|
26663
|
+
const index = $from.index(depth - 1);
|
|
26664
|
+
const before = index > 0 ? parent.child(index - 1) : null;
|
|
26665
|
+
const after = index + 1 < parent.childCount ? parent.child(index + 1) : null;
|
|
26666
|
+
const hasSameStyle = (list) => Boolean(list &&
|
|
26667
|
+
list.type === activeList.type &&
|
|
26668
|
+
(list.attrs.listStyle || null) === (activeList.attrs.listStyle || null));
|
|
26669
|
+
if (hasSameStyle(before)) {
|
|
26670
|
+
dispatch(state.tr.join($from.before(depth)));
|
|
26671
|
+
joined = true;
|
|
26672
|
+
}
|
|
26673
|
+
else if (hasSameStyle(after)) {
|
|
26674
|
+
dispatch(state.tr.join($from.after(depth)));
|
|
26675
|
+
joined = true;
|
|
26676
|
+
}
|
|
26677
|
+
break;
|
|
26678
|
+
}
|
|
26679
|
+
if (!joined) {
|
|
26680
|
+
return;
|
|
26681
|
+
}
|
|
26682
|
+
}
|
|
26683
|
+
}
|
|
26684
|
+
listType(listStyle) {
|
|
26685
|
+
if (listStyle === 'bullet_list') {
|
|
26686
|
+
return 'bullet_list';
|
|
26687
|
+
}
|
|
26688
|
+
return listStyle ? 'ordered_list' : '';
|
|
26689
|
+
}
|
|
26690
|
+
orderedListStyle(listStyle) {
|
|
26691
|
+
if (listStyle === 'ordered_alpha') {
|
|
26692
|
+
return 'lower-alpha';
|
|
26693
|
+
}
|
|
26694
|
+
if (listStyle === 'ordered_roman') {
|
|
26695
|
+
return 'lower-roman';
|
|
26696
|
+
}
|
|
26697
|
+
return 'decimal';
|
|
26698
|
+
}
|
|
26699
|
+
activeListNode() {
|
|
26700
|
+
const { $from } = this.editor.view.state.selection;
|
|
26701
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26702
|
+
const node = $from.node(depth);
|
|
26703
|
+
if (node.type.name !== 'list_item') {
|
|
26704
|
+
continue;
|
|
26705
|
+
}
|
|
26706
|
+
const list = $from.node(depth - 1);
|
|
26707
|
+
if (!this.isList(list)) {
|
|
26708
|
+
return null;
|
|
26709
|
+
}
|
|
26710
|
+
// A lifted nested item remains inside its parent list item to retain its
|
|
26711
|
+
// indentation, but only the first block owns that parent's list marker.
|
|
26712
|
+
return depth < $from.depth && node.firstChild === $from.node(depth + 1) ? list : null;
|
|
26713
|
+
}
|
|
26714
|
+
return null;
|
|
26715
|
+
}
|
|
26716
|
+
applyOrderedListStyle(listStyle) {
|
|
26717
|
+
const { state, dispatch } = this.editor.view;
|
|
26718
|
+
const { $from } = state.selection;
|
|
26719
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26720
|
+
const node = $from.node(depth);
|
|
26721
|
+
if (node.type.name !== 'ordered_list') {
|
|
26722
|
+
continue;
|
|
26723
|
+
}
|
|
26724
|
+
dispatch(state.tr.setNodeMarkup($from.before(depth), node.type, {
|
|
26725
|
+
...node.attrs,
|
|
26726
|
+
listStyle: listStyle === 'decimal' ? null : listStyle
|
|
26727
|
+
}));
|
|
26728
|
+
return;
|
|
26729
|
+
}
|
|
26730
|
+
}
|
|
26174
26731
|
onPaste(event) {
|
|
26175
26732
|
if (event.defaultPrevented) {
|
|
26176
26733
|
return;
|
|
@@ -26225,11 +26782,14 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26225
26782
|
normalisePastedHtml(html) {
|
|
26226
26783
|
const documentElement = new DOMParser().parseFromString(html, 'text/html');
|
|
26227
26784
|
removeUnsafeRichTextElements(documentElement);
|
|
26785
|
+
this.normaliseWordStylesheetFormatting(documentElement);
|
|
26786
|
+
this.normaliseOrderedListStyles(documentElement);
|
|
26228
26787
|
this.removeWordNoise(documentElement);
|
|
26229
26788
|
this.normaliseWordSpacing(documentElement);
|
|
26230
26789
|
this.normaliseWordTables(documentElement);
|
|
26231
26790
|
this.normaliseWordSemanticBlocks(documentElement);
|
|
26232
26791
|
this.convertWordLists(documentElement);
|
|
26792
|
+
this.normaliseNestedListStructure(documentElement);
|
|
26233
26793
|
this.normaliseSupportedInlineFormatting(documentElement);
|
|
26234
26794
|
this.normaliseBlockFormatting(documentElement);
|
|
26235
26795
|
this.normalisePastedListSpacing(documentElement);
|
|
@@ -26244,6 +26804,8 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26244
26804
|
}
|
|
26245
26805
|
const documentElement = new DOMParser().parseFromString(value, 'text/html');
|
|
26246
26806
|
removeUnsafeRichTextElements(documentElement);
|
|
26807
|
+
this.normaliseWordStylesheetFormatting(documentElement);
|
|
26808
|
+
this.normaliseOrderedListStyles(documentElement);
|
|
26247
26809
|
this.normaliseWordSpacing(documentElement);
|
|
26248
26810
|
this.normaliseWordTables(documentElement);
|
|
26249
26811
|
this.normaliseWordSemanticBlocks(documentElement);
|
|
@@ -26310,15 +26872,26 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26310
26872
|
Italic: 'Control+I',
|
|
26311
26873
|
Underline: 'Control+U'
|
|
26312
26874
|
};
|
|
26313
|
-
const
|
|
26875
|
+
const toggleCommands = {
|
|
26876
|
+
Bold: 'bold',
|
|
26877
|
+
Italic: 'italic',
|
|
26878
|
+
Underline: 'underline',
|
|
26879
|
+
Paragraph: 'paragraph',
|
|
26880
|
+
'Heading level 1': 'heading',
|
|
26881
|
+
'Bullet List': 'bullet_list',
|
|
26882
|
+
'Numbered List': 'ordered_list'
|
|
26883
|
+
};
|
|
26314
26884
|
const buttons = this.editorHost.nativeElement.querySelectorAll('button');
|
|
26315
26885
|
buttons.forEach((button) => {
|
|
26316
26886
|
const label = button.getAttribute('aria-label') || button.title;
|
|
26317
26887
|
if (shortcutLabels[label]) {
|
|
26318
26888
|
button.setAttribute('aria-keyshortcuts', shortcutLabels[label]);
|
|
26319
26889
|
}
|
|
26320
|
-
if (
|
|
26321
|
-
|
|
26890
|
+
if (toggleCommands[label]) {
|
|
26891
|
+
const isActive = label === 'Numbered List'
|
|
26892
|
+
? this.isOrderedListActive()
|
|
26893
|
+
: this.isToolbarCommandActive(toggleCommands[label]);
|
|
26894
|
+
button.setAttribute('aria-pressed', `${isActive}`);
|
|
26322
26895
|
}
|
|
26323
26896
|
});
|
|
26324
26897
|
}
|
|
@@ -26371,6 +26944,82 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26371
26944
|
const officeParagraphs = Array.prototype.slice.call(documentElement.getElementsByTagName('o:p'));
|
|
26372
26945
|
officeParagraphs.forEach((element) => element.remove());
|
|
26373
26946
|
}
|
|
26947
|
+
normaliseWordStylesheetFormatting(documentElement) {
|
|
26948
|
+
const styleElements = Array.prototype.slice.call(documentElement.querySelectorAll('style'));
|
|
26949
|
+
styleElements.forEach((styleElement) => {
|
|
26950
|
+
const stylesheet = (styleElement.textContent || '').replace(/<!--|-->/g, '');
|
|
26951
|
+
const rules = this.stylesheetRules(stylesheet);
|
|
26952
|
+
rules.forEach(([selectors, declarations]) => {
|
|
26953
|
+
const hasBoldStyle = this.hasBoldStyle(declarations);
|
|
26954
|
+
const headingLevel = this.wordOutlineLevel(declarations);
|
|
26955
|
+
const orderedListType = this.orderedListTypeFromStyle(declarations);
|
|
26956
|
+
if (!hasBoldStyle && !headingLevel && !orderedListType) {
|
|
26957
|
+
return;
|
|
26958
|
+
}
|
|
26959
|
+
selectors.split(',').forEach((selector) => {
|
|
26960
|
+
const normalisedSelector = selector.trim();
|
|
26961
|
+
if (!normalisedSelector || normalisedSelector.startsWith('@')) {
|
|
26962
|
+
return;
|
|
26963
|
+
}
|
|
26964
|
+
try {
|
|
26965
|
+
const matchingElements = documentElement.body.querySelectorAll(normalisedSelector);
|
|
26966
|
+
matchingElements.forEach((element) => {
|
|
26967
|
+
if (orderedListType && element.tagName.toLowerCase() === 'ol') {
|
|
26968
|
+
element.setAttribute('type', orderedListType);
|
|
26969
|
+
}
|
|
26970
|
+
if (headingLevel) {
|
|
26971
|
+
element.dataset.wordHeadingLevel = headingLevel.toString();
|
|
26972
|
+
}
|
|
26973
|
+
if (hasBoldStyle) {
|
|
26974
|
+
this.wrapBoldInlineContents(documentElement, element);
|
|
26975
|
+
}
|
|
26976
|
+
});
|
|
26977
|
+
}
|
|
26978
|
+
catch {
|
|
26979
|
+
// Ignore Microsoft Office selectors that are not valid browser CSS selectors.
|
|
26980
|
+
}
|
|
26981
|
+
});
|
|
26982
|
+
});
|
|
26983
|
+
});
|
|
26984
|
+
}
|
|
26985
|
+
normaliseOrderedListStyles(documentElement) {
|
|
26986
|
+
const orderedLists = documentElement.body.querySelectorAll('ol');
|
|
26987
|
+
orderedLists.forEach((list) => {
|
|
26988
|
+
const listType = this.orderedListTypeFromStyle(list.getAttribute('style') || '');
|
|
26989
|
+
if (listType) {
|
|
26990
|
+
list.setAttribute('type', listType);
|
|
26991
|
+
}
|
|
26992
|
+
});
|
|
26993
|
+
}
|
|
26994
|
+
orderedListTypeFromStyle(style) {
|
|
26995
|
+
const listStyle = (this.cssStyleValue(style, 'list-style-type') || '').toLowerCase();
|
|
26996
|
+
const wordListStyle = (this.cssStyleValue(style, 'mso-level-number-format') || '').toLowerCase();
|
|
26997
|
+
if (listStyle === 'lower-alpha' || listStyle === 'lower-latin' || wordListStyle === 'alpha-lower') {
|
|
26998
|
+
return 'a';
|
|
26999
|
+
}
|
|
27000
|
+
if (listStyle === 'lower-roman' || wordListStyle === 'roman-lower') {
|
|
27001
|
+
return 'i';
|
|
27002
|
+
}
|
|
27003
|
+
return null;
|
|
27004
|
+
}
|
|
27005
|
+
stylesheetRules(stylesheet) {
|
|
27006
|
+
const rules = [];
|
|
27007
|
+
let searchFrom = 0;
|
|
27008
|
+
let openingBrace = stylesheet.indexOf('{', searchFrom);
|
|
27009
|
+
while (openingBrace !== -1) {
|
|
27010
|
+
const closingBrace = stylesheet.indexOf('}', openingBrace + 1);
|
|
27011
|
+
if (closingBrace === -1) {
|
|
27012
|
+
break;
|
|
27013
|
+
}
|
|
27014
|
+
rules.push([
|
|
27015
|
+
stylesheet.slice(searchFrom, openingBrace),
|
|
27016
|
+
stylesheet.slice(openingBrace + 1, closingBrace)
|
|
27017
|
+
]);
|
|
27018
|
+
searchFrom = closingBrace + 1;
|
|
27019
|
+
openingBrace = stylesheet.indexOf('{', searchFrom);
|
|
27020
|
+
}
|
|
27021
|
+
return rules;
|
|
27022
|
+
}
|
|
26374
27023
|
normaliseWordSpacing(documentElement) {
|
|
26375
27024
|
const spacerElements = Array.prototype.slice.call(documentElement.body.querySelectorAll('[style*="mso-spacerun"]'));
|
|
26376
27025
|
spacerElements.forEach((spacerElement) => {
|
|
@@ -26432,18 +27081,36 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26432
27081
|
});
|
|
26433
27082
|
}
|
|
26434
27083
|
normaliseWordSemanticBlocks(documentElement) {
|
|
26435
|
-
const
|
|
26436
|
-
|
|
26437
|
-
const
|
|
27084
|
+
const blocks = Array.prototype.slice.call(documentElement.body.querySelectorAll('p, h1, h2, h3, h4, h5, h6'));
|
|
27085
|
+
blocks.forEach((block) => {
|
|
27086
|
+
const namedHeadingLevel = this.namedWordHeadingLevel(block);
|
|
27087
|
+
const existingHeadingLevel = /^h([1-6])$/i.exec(block.tagName)?.[1];
|
|
27088
|
+
if (existingHeadingLevel) {
|
|
27089
|
+
const heading = existingHeadingLevel === '1'
|
|
27090
|
+
? block
|
|
27091
|
+
: this.replaceElementTag(documentElement, block, 'h1');
|
|
27092
|
+
if (namedHeadingLevel) {
|
|
27093
|
+
this.removeRedundantHeadingBold(heading);
|
|
27094
|
+
}
|
|
27095
|
+
return;
|
|
27096
|
+
}
|
|
27097
|
+
const headingLevel = this.wordHeadingLevel(block);
|
|
26438
27098
|
if (headingLevel) {
|
|
26439
|
-
this.replaceElementTag(documentElement,
|
|
27099
|
+
const heading = this.replaceElementTag(documentElement, block, 'h1');
|
|
27100
|
+
if (namedHeadingLevel) {
|
|
27101
|
+
this.removeRedundantHeadingBold(heading);
|
|
27102
|
+
}
|
|
26440
27103
|
}
|
|
26441
27104
|
});
|
|
26442
27105
|
}
|
|
27106
|
+
removeRedundantHeadingBold(heading) {
|
|
27107
|
+
const boldElements = Array.prototype.slice.call(heading.querySelectorAll('strong, b'));
|
|
27108
|
+
boldElements.reverse().forEach((element) => this.unwrapElement(element));
|
|
27109
|
+
}
|
|
26443
27110
|
wordHeadingLevel(element) {
|
|
26444
|
-
const
|
|
26445
|
-
if (
|
|
26446
|
-
return
|
|
27111
|
+
const namedHeadingLevel = this.namedWordHeadingLevel(element);
|
|
27112
|
+
if (namedHeadingLevel) {
|
|
27113
|
+
return namedHeadingLevel;
|
|
26447
27114
|
}
|
|
26448
27115
|
if (/MsoTitle/i.test(element.className || '')) {
|
|
26449
27116
|
return 1;
|
|
@@ -26455,6 +27122,34 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26455
27122
|
}, 0);
|
|
26456
27123
|
return largestFontSize >= 24 ? 1 : null;
|
|
26457
27124
|
}
|
|
27125
|
+
namedWordHeadingLevel(element) {
|
|
27126
|
+
const styledElements = [element].concat(Array.prototype.slice.call(element.querySelectorAll('*')));
|
|
27127
|
+
for (const styledElement of styledElements) {
|
|
27128
|
+
const storedHeadingLevel = Number(styledElement.dataset.wordHeadingLevel);
|
|
27129
|
+
if (storedHeadingLevel >= 1 && storedHeadingLevel <= 6) {
|
|
27130
|
+
return storedHeadingLevel;
|
|
27131
|
+
}
|
|
27132
|
+
const className = styledElement.className || '';
|
|
27133
|
+
const style = styledElement.getAttribute('style') || '';
|
|
27134
|
+
const headingDescription = `${className} ${style}`;
|
|
27135
|
+
const namedHeadingLevel = /(?:Mso)?Heading\s*([1-6])(?:Char)?/i.exec(headingDescription);
|
|
27136
|
+
if (namedHeadingLevel) {
|
|
27137
|
+
return Number(namedHeadingLevel[1]);
|
|
27138
|
+
}
|
|
27139
|
+
if (/heading/i.test(headingDescription)) {
|
|
27140
|
+
return 1;
|
|
27141
|
+
}
|
|
27142
|
+
const outlineLevel = this.wordOutlineLevel(style);
|
|
27143
|
+
if (outlineLevel) {
|
|
27144
|
+
return outlineLevel;
|
|
27145
|
+
}
|
|
27146
|
+
}
|
|
27147
|
+
return null;
|
|
27148
|
+
}
|
|
27149
|
+
wordOutlineLevel(style) {
|
|
27150
|
+
const outlineLevel = /mso-outline-level\s*:\s*([1-6])/i.exec(style || '');
|
|
27151
|
+
return outlineLevel ? Number(outlineLevel[1]) : null;
|
|
27152
|
+
}
|
|
26458
27153
|
replaceElementTag(documentElement, element, tagName) {
|
|
26459
27154
|
const replacement = documentElement.createElement(tagName);
|
|
26460
27155
|
Array.prototype.slice.call(element.attributes).forEach((attribute) => {
|
|
@@ -26507,6 +27202,9 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26507
27202
|
const listStart = element.tagName.toLowerCase() === 'ol'
|
|
26508
27203
|
? this.normaliseListStart(element.getAttribute('start'))
|
|
26509
27204
|
: null;
|
|
27205
|
+
const listType = element.tagName.toLowerCase() === 'ol' && /^[ai]$/.test(element.getAttribute('type') || '')
|
|
27206
|
+
? element.getAttribute('type')
|
|
27207
|
+
: null;
|
|
26510
27208
|
while (element.attributes.length > 0) {
|
|
26511
27209
|
element.removeAttribute(element.attributes[0].name);
|
|
26512
27210
|
}
|
|
@@ -26519,6 +27217,9 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26519
27217
|
if (listStart) {
|
|
26520
27218
|
element.setAttribute('start', listStart);
|
|
26521
27219
|
}
|
|
27220
|
+
if (listType) {
|
|
27221
|
+
element.setAttribute('type', listType);
|
|
27222
|
+
}
|
|
26522
27223
|
});
|
|
26523
27224
|
}
|
|
26524
27225
|
normaliseListStart(value) {
|
|
@@ -26619,7 +27320,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26619
27320
|
hasBoldStyle(style) {
|
|
26620
27321
|
const fontWeightMatch = /(?:mso-bidi-)?font-weight\s*:\s*([^;]+)/i.exec(style);
|
|
26621
27322
|
if (!fontWeightMatch) {
|
|
26622
|
-
return
|
|
27323
|
+
return /(?:^|;)\s*font\s*:[^;]*\bbold\b/i.test(style);
|
|
26623
27324
|
}
|
|
26624
27325
|
const fontWeight = fontWeightMatch[1].trim().toLowerCase();
|
|
26625
27326
|
return fontWeight === 'bold' || fontWeight === 'bolder' || Number(fontWeight) >= 600;
|
|
@@ -26886,61 +27587,96 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26886
27587
|
convertWordLists(documentElement) {
|
|
26887
27588
|
const childNodes = Array.prototype.slice.call(documentElement.body.querySelectorAll('p'));
|
|
26888
27589
|
const wordListIndents = this.wordListIndents(childNodes);
|
|
26889
|
-
const
|
|
26890
|
-
const
|
|
26891
|
-
|
|
26892
|
-
|
|
27590
|
+
const orderedListTypes = this.wordOrderedListTypes(childNodes);
|
|
27591
|
+
const state = {
|
|
27592
|
+
listStack: [],
|
|
27593
|
+
listParents: [],
|
|
27594
|
+
resetListLevels: new Map(),
|
|
27595
|
+
previousListId: null
|
|
27596
|
+
};
|
|
26893
27597
|
childNodes.forEach((node) => {
|
|
26894
|
-
|
|
26895
|
-
|
|
26896
|
-
|
|
26897
|
-
|
|
26898
|
-
|
|
26899
|
-
|
|
26900
|
-
|
|
26901
|
-
|
|
26902
|
-
|
|
26903
|
-
|
|
26904
|
-
|
|
26905
|
-
|
|
26906
|
-
|
|
26907
|
-
|
|
26908
|
-
|
|
26909
|
-
|
|
26910
|
-
|
|
26911
|
-
|
|
26912
|
-
|
|
26913
|
-
|
|
26914
|
-
|
|
26915
|
-
|
|
26916
|
-
|
|
26917
|
-
|
|
26918
|
-
|
|
26919
|
-
|
|
26920
|
-
|
|
26921
|
-
|
|
26922
|
-
|
|
26923
|
-
|
|
26924
|
-
|
|
26925
|
-
|
|
26926
|
-
|
|
26927
|
-
|
|
26928
|
-
|
|
26929
|
-
|
|
26930
|
-
|
|
26931
|
-
|
|
26932
|
-
|
|
26933
|
-
|
|
26934
|
-
|
|
26935
|
-
|
|
26936
|
-
|
|
26937
|
-
|
|
27598
|
+
this.convertWordListParagraph(documentElement, node, wordListIndents, orderedListTypes, state);
|
|
27599
|
+
});
|
|
27600
|
+
}
|
|
27601
|
+
convertWordListParagraph(documentElement, node, wordListIndents, orderedListTypes, state) {
|
|
27602
|
+
if (!this.isWordListParagraph(node)) {
|
|
27603
|
+
this.resetWordListConversionState(state);
|
|
27604
|
+
return;
|
|
27605
|
+
}
|
|
27606
|
+
const paragraph = node;
|
|
27607
|
+
const listType = this.wordListType(paragraph);
|
|
27608
|
+
const orderedListType = listType === 'ol' ? orderedListTypes.get(this.wordListLevelKey(paragraph)) || null : null;
|
|
27609
|
+
const listId = this.wordListId(paragraph);
|
|
27610
|
+
const requestedLevel = this.wordListRequestedLevel(paragraph, listId, wordListIndents, state);
|
|
27611
|
+
const level = Math.min(requestedLevel, state.listStack.length + 1);
|
|
27612
|
+
const currentList = this.wordListForParagraph(documentElement, paragraph, listType, orderedListType, level, state);
|
|
27613
|
+
const listItem = documentElement.createElement('li');
|
|
27614
|
+
this.copyListItemContents(documentElement, paragraph, listItem);
|
|
27615
|
+
currentList.appendChild(listItem);
|
|
27616
|
+
paragraph.remove();
|
|
27617
|
+
state.previousListId = listId;
|
|
27618
|
+
}
|
|
27619
|
+
resetWordListConversionState(state) {
|
|
27620
|
+
state.listStack.length = 0;
|
|
27621
|
+
state.listParents.length = 0;
|
|
27622
|
+
state.resetListLevels.clear();
|
|
27623
|
+
state.previousListId = null;
|
|
27624
|
+
}
|
|
27625
|
+
wordListRequestedLevel(paragraph, listId, wordListIndents, state) {
|
|
27626
|
+
const declaredLevel = this.wordListDeclaredLevel(paragraph);
|
|
27627
|
+
let requestedLevel = this.wordListLevel(paragraph, wordListIndents);
|
|
27628
|
+
const rememberedResetLevel = declaredLevel === 1 ? state.resetListLevels.get(listId) : null;
|
|
27629
|
+
if (rememberedResetLevel) {
|
|
27630
|
+
return Math.max(requestedLevel, rememberedResetLevel);
|
|
27631
|
+
}
|
|
27632
|
+
if (declaredLevel === 1 && listId !== state.previousListId && state.listStack.length > 1 && requestedLevel === state.listStack.length) {
|
|
27633
|
+
requestedLevel++;
|
|
27634
|
+
state.resetListLevels.set(listId, requestedLevel);
|
|
27635
|
+
}
|
|
27636
|
+
else if (declaredLevel === 1 && listId) {
|
|
27637
|
+
state.resetListLevels.set(listId, requestedLevel);
|
|
27638
|
+
}
|
|
27639
|
+
return requestedLevel;
|
|
27640
|
+
}
|
|
27641
|
+
wordListForParagraph(documentElement, paragraph, listType, orderedListType, level, state) {
|
|
27642
|
+
const stackIndex = level - 1;
|
|
27643
|
+
const parentListItem = stackIndex > 0 ? state.listStack[stackIndex - 1]?.lastElementChild : null;
|
|
27644
|
+
const listParent = parentListItem || paragraph.parentNode;
|
|
27645
|
+
let currentList = state.listStack[stackIndex];
|
|
27646
|
+
if (currentList?.tagName.toLowerCase() !== listType || currentList?.getAttribute('type') !== orderedListType ||
|
|
27647
|
+
state.listParents[stackIndex] !== listParent) {
|
|
27648
|
+
currentList = this.createWordList(documentElement, paragraph, listType, orderedListType, parentListItem);
|
|
27649
|
+
state.listStack[stackIndex] = currentList;
|
|
27650
|
+
state.listParents[stackIndex] = listParent;
|
|
27651
|
+
}
|
|
27652
|
+
state.listStack.length = level;
|
|
27653
|
+
state.listParents.length = level;
|
|
27654
|
+
return currentList;
|
|
27655
|
+
}
|
|
27656
|
+
createWordList(documentElement, paragraph, listType, orderedListType, parentListItem) {
|
|
27657
|
+
const list = documentElement.createElement(listType);
|
|
27658
|
+
const listStart = this.wordListStart(paragraph);
|
|
27659
|
+
if (listType === 'ol' && listStart > 1) {
|
|
27660
|
+
list.setAttribute('start', listStart.toString());
|
|
27661
|
+
}
|
|
27662
|
+
if (orderedListType) {
|
|
27663
|
+
list.setAttribute('type', orderedListType);
|
|
27664
|
+
}
|
|
27665
|
+
if (parentListItem) {
|
|
27666
|
+
parentListItem.appendChild(list);
|
|
27667
|
+
}
|
|
27668
|
+
else {
|
|
27669
|
+
paragraph.parentNode.insertBefore(list, paragraph);
|
|
27670
|
+
}
|
|
27671
|
+
return list;
|
|
27672
|
+
}
|
|
27673
|
+
normaliseNestedListStructure(documentElement) {
|
|
27674
|
+
const orphanedNestedLists = Array.prototype.slice.call(documentElement.body.querySelectorAll('ol > ol, ol > ul, ul > ol, ul > ul'));
|
|
27675
|
+
orphanedNestedLists.forEach((nestedList) => {
|
|
27676
|
+
const previousListItem = nestedList.previousElementSibling;
|
|
27677
|
+
if (previousListItem?.tagName.toLowerCase() === 'li') {
|
|
27678
|
+
previousListItem.appendChild(nestedList);
|
|
26938
27679
|
}
|
|
26939
|
-
listStack.length = level;
|
|
26940
|
-
listParents.length = level;
|
|
26941
|
-
currentList.appendChild(listItem);
|
|
26942
|
-
paragraph.remove();
|
|
26943
|
-
previousListId = listId;
|
|
26944
27680
|
});
|
|
26945
27681
|
}
|
|
26946
27682
|
isWordListParagraph(node) {
|
|
@@ -26950,8 +27686,39 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26950
27686
|
return /MsoListParagraph/i.test(node.className) || /mso-list/i.test(node.getAttribute('style') || '');
|
|
26951
27687
|
}
|
|
26952
27688
|
wordListType(paragraph) {
|
|
26953
|
-
|
|
26954
|
-
|
|
27689
|
+
return /^\(?(?:\d+|[a-z]+)[.)]/i.test(this.wordListMarker(paragraph)) ? 'ol' : 'ul';
|
|
27690
|
+
}
|
|
27691
|
+
wordOrderedListTypes(nodes) {
|
|
27692
|
+
const markersByLevel = new Map();
|
|
27693
|
+
nodes.filter((node) => this.isWordListParagraph(node)).forEach((node) => {
|
|
27694
|
+
const marker = this.wordListMarker(node);
|
|
27695
|
+
if (!/^\(?(?:\d+|[a-z]+)[.)]/i.test(marker)) {
|
|
27696
|
+
return;
|
|
27697
|
+
}
|
|
27698
|
+
const key = this.wordListLevelKey(node);
|
|
27699
|
+
markersByLevel.set(key, [...(markersByLevel.get(key) || []), marker]);
|
|
27700
|
+
});
|
|
27701
|
+
const listTypes = new Map();
|
|
27702
|
+
markersByLevel.forEach((markers, key) => {
|
|
27703
|
+
const markerPattern = /^\(?([a-z]+|\d+)[.)]/i;
|
|
27704
|
+
const markerTokens = markers.map((marker) => markerPattern.exec(marker)?.[1]?.toLowerCase());
|
|
27705
|
+
if (markers.some((marker) => /^\([ivxlcdm]+\)/i.test(marker)) ||
|
|
27706
|
+
markerTokens.some((token) => token?.length > 1 && /^[ivxlcdm]+$/.test(token))) {
|
|
27707
|
+
listTypes.set(key, 'i');
|
|
27708
|
+
}
|
|
27709
|
+
else if (markerTokens.every((token) => /^[a-z]$/.test(token || ''))) {
|
|
27710
|
+
listTypes.set(key, 'a');
|
|
27711
|
+
}
|
|
27712
|
+
});
|
|
27713
|
+
return listTypes;
|
|
27714
|
+
}
|
|
27715
|
+
wordListLevelKey(paragraph) {
|
|
27716
|
+
return `${this.wordListId(paragraph) || ''}:${this.wordListDeclaredLevel(paragraph)}`;
|
|
27717
|
+
}
|
|
27718
|
+
wordListMarker(paragraph) {
|
|
27719
|
+
const markerElement = Array.prototype.slice.call(paragraph.querySelectorAll('[style]'))
|
|
27720
|
+
.find((element) => /mso-list:\s*Ignore/i.test(element.getAttribute('style') || ''));
|
|
27721
|
+
return (markerElement ? markerElement.textContent : paragraph.textContent).trim();
|
|
26955
27722
|
}
|
|
26956
27723
|
wordListLevel(paragraph, wordListIndents) {
|
|
26957
27724
|
const declaredLevel = this.wordListDeclaredLevel(paragraph);
|
|
@@ -26970,8 +27737,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26970
27737
|
wordListIndents(nodes) {
|
|
26971
27738
|
const indents = nodes
|
|
26972
27739
|
.filter((node) => this.isWordListParagraph(node))
|
|
26973
|
-
.map((node) => this.wordListIndent(node))
|
|
26974
|
-
.filter((indent) => indent > 0);
|
|
27740
|
+
.map((node) => this.wordListIndent(node));
|
|
26975
27741
|
return Array.from(new Set(indents)).sort((left, right) => left - right);
|
|
26976
27742
|
}
|
|
26977
27743
|
wordListIndent(paragraph) {
|
|
@@ -26980,10 +27746,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26980
27746
|
return Math.round(indent);
|
|
26981
27747
|
}
|
|
26982
27748
|
wordListStart(paragraph) {
|
|
26983
|
-
const
|
|
26984
|
-
.find((element) => /mso-list:\s*Ignore/i.test(element.getAttribute('style') || ''));
|
|
26985
|
-
const marker = (markerElement ? markerElement.textContent : paragraph.textContent).trim();
|
|
26986
|
-
const match = marker.match(/^(\d+)[.)]/);
|
|
27749
|
+
const match = /^(\d+)[.)]/.exec(this.wordListMarker(paragraph));
|
|
26987
27750
|
return match ? Number(match[1]) : 1;
|
|
26988
27751
|
}
|
|
26989
27752
|
copyListItemContents(documentElement, paragraph, listItem) {
|
|
@@ -26991,7 +27754,12 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26991
27754
|
if (this.isWordListMarker(childNode)) {
|
|
26992
27755
|
return;
|
|
26993
27756
|
}
|
|
26994
|
-
|
|
27757
|
+
const clonedNode = childNode.cloneNode(true);
|
|
27758
|
+
this.removeNestedWordListMarkers(clonedNode);
|
|
27759
|
+
if (clonedNode instanceof HTMLElement && !clonedNode.textContent?.trim() && !clonedNode.querySelector('br')) {
|
|
27760
|
+
return;
|
|
27761
|
+
}
|
|
27762
|
+
listItem.appendChild(clonedNode);
|
|
26995
27763
|
});
|
|
26996
27764
|
this.removeLeadingListMarker(listItem);
|
|
26997
27765
|
this.trimListItemWhitespace(listItem);
|
|
@@ -27003,11 +27771,15 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27003
27771
|
if (!(node instanceof HTMLElement)) {
|
|
27004
27772
|
return false;
|
|
27005
27773
|
}
|
|
27006
|
-
|
|
27007
|
-
|
|
27774
|
+
return /mso-list:\s*Ignore/i.test(node.getAttribute('style') || '');
|
|
27775
|
+
}
|
|
27776
|
+
removeNestedWordListMarkers(node) {
|
|
27777
|
+
if (!(node instanceof HTMLElement)) {
|
|
27778
|
+
return;
|
|
27008
27779
|
}
|
|
27009
|
-
|
|
27010
|
-
.
|
|
27780
|
+
Array.prototype.slice.call(node.querySelectorAll('[style]'))
|
|
27781
|
+
.filter((element) => /mso-list:\s*Ignore/i.test(element.getAttribute('style') || ''))
|
|
27782
|
+
.forEach((element) => element.remove());
|
|
27011
27783
|
}
|
|
27012
27784
|
removeLeadingListMarker(listItem) {
|
|
27013
27785
|
const textNode = this.firstTextNode(listItem);
|
|
@@ -27032,13 +27804,15 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27032
27804
|
if (!this.editor?.view) {
|
|
27033
27805
|
return;
|
|
27034
27806
|
}
|
|
27807
|
+
const activeListType = this.activeListNode()?.type.name;
|
|
27035
27808
|
this.activeToolbarCommands = {
|
|
27036
27809
|
bold: this.isMarkActive('strong'),
|
|
27037
27810
|
italic: this.isMarkActive('em'),
|
|
27038
27811
|
underline: this.isMarkActive('u'),
|
|
27039
27812
|
paragraph: this.paragraphCommandApplied && this.isPlainParagraphActive(),
|
|
27040
|
-
|
|
27041
|
-
|
|
27813
|
+
heading: this.isHeadingOneActive(),
|
|
27814
|
+
ordered_list: activeListType === 'ordered_list',
|
|
27815
|
+
bullet_list: activeListType === 'bullet_list'
|
|
27042
27816
|
};
|
|
27043
27817
|
}
|
|
27044
27818
|
updateToolbarStateLater() {
|
|
@@ -27063,11 +27837,272 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27063
27837
|
if (!paragraphType) {
|
|
27064
27838
|
return;
|
|
27065
27839
|
}
|
|
27840
|
+
if (this.flattenSelectedNestedListItems()) {
|
|
27841
|
+
return;
|
|
27842
|
+
}
|
|
27843
|
+
if (this.flattenFullySelectedList()) {
|
|
27844
|
+
return;
|
|
27845
|
+
}
|
|
27066
27846
|
if (listItemType && this.isNodeActive('list_item')) {
|
|
27067
27847
|
liftListItem(listItemType)(state, dispatch);
|
|
27068
27848
|
}
|
|
27069
27849
|
setBlockType(paragraphType)(this.editor.view.state, this.editor.view.dispatch);
|
|
27070
27850
|
}
|
|
27851
|
+
flattenSelectedNestedListItems() {
|
|
27852
|
+
const { state, dispatch } = this.editor.view;
|
|
27853
|
+
const { $from, $to } = state.selection;
|
|
27854
|
+
const paragraphType = state.schema.nodes.paragraph;
|
|
27855
|
+
if (!paragraphType) {
|
|
27856
|
+
return false;
|
|
27857
|
+
}
|
|
27858
|
+
for (let depth = $from.depth; depth > 1; depth--) {
|
|
27859
|
+
const list = $from.node(depth);
|
|
27860
|
+
if (!this.isListNode(list) || $from.node(depth - 1).type.name !== 'list_item' ||
|
|
27861
|
+
$to.depth < depth || $to.node(depth) !== list) {
|
|
27862
|
+
continue;
|
|
27863
|
+
}
|
|
27864
|
+
const fromIndex = $from.index(depth);
|
|
27865
|
+
const toIndex = $to.indexAfter(depth);
|
|
27866
|
+
const replacement = [];
|
|
27867
|
+
const beforeItems = this.listItemsBetween(list, 0, fromIndex);
|
|
27868
|
+
const afterItems = this.listItemsBetween(list, toIndex, list.childCount);
|
|
27869
|
+
const sourceTextBlock = state.selection.empty && $from.parent.isTextblock ? $from.parent : null;
|
|
27870
|
+
const sourceCaretOffset = $from.parentOffset;
|
|
27871
|
+
const replacementStart = $from.before(depth);
|
|
27872
|
+
let caretPosition = null;
|
|
27873
|
+
if (beforeItems.length) {
|
|
27874
|
+
replacement.push(list.copy(Fragment.fromArray(beforeItems)));
|
|
27875
|
+
}
|
|
27876
|
+
const paragraphIndent = Number(list.attrs.indent) || 0;
|
|
27877
|
+
this.listItemsBetween(list, fromIndex, toIndex).forEach((listItem) => {
|
|
27878
|
+
listItem.forEach((child) => {
|
|
27879
|
+
if (child.isTextblock) {
|
|
27880
|
+
const indent = Math.min(MAX_INDENT, paragraphIndent + (Number(child.attrs.indent) || 0));
|
|
27881
|
+
const paragraph = paragraphType.create({
|
|
27882
|
+
...child.attrs,
|
|
27883
|
+
indent: indent || null
|
|
27884
|
+
}, child.content);
|
|
27885
|
+
if (child === sourceTextBlock) {
|
|
27886
|
+
const precedingSize = replacement.reduce((size, node) => size + node.nodeSize, 0);
|
|
27887
|
+
caretPosition = replacementStart + precedingSize + 1 +
|
|
27888
|
+
Math.min(sourceCaretOffset, paragraph.content.size);
|
|
27889
|
+
}
|
|
27890
|
+
replacement.push(paragraph);
|
|
27891
|
+
}
|
|
27892
|
+
else if (this.isListNode(child)) {
|
|
27893
|
+
replacement.push(child);
|
|
27894
|
+
}
|
|
27895
|
+
});
|
|
27896
|
+
});
|
|
27897
|
+
if (afterItems.length) {
|
|
27898
|
+
const afterListAttrs = list.type.name === 'ordered_list'
|
|
27899
|
+
? { ...list.attrs, order: (Number(list.attrs.order) || 1) + toIndex }
|
|
27900
|
+
: { ...list.attrs };
|
|
27901
|
+
replacement.push(list.type.create(afterListAttrs, Fragment.fromArray(afterItems)));
|
|
27902
|
+
}
|
|
27903
|
+
const transaction = state.tr.replaceWith(replacementStart, $from.after(depth), Fragment.fromArray(replacement));
|
|
27904
|
+
if (caretPosition !== null) {
|
|
27905
|
+
transaction.setSelection(TextSelection.create(transaction.doc, caretPosition));
|
|
27906
|
+
}
|
|
27907
|
+
dispatch(transaction.scrollIntoView());
|
|
27908
|
+
return true;
|
|
27909
|
+
}
|
|
27910
|
+
return false;
|
|
27911
|
+
}
|
|
27912
|
+
listItemsBetween(list, fromIndex, toIndex) {
|
|
27913
|
+
const items = [];
|
|
27914
|
+
for (let index = fromIndex; index < toIndex; index++) {
|
|
27915
|
+
items.push(list.child(index));
|
|
27916
|
+
}
|
|
27917
|
+
return items;
|
|
27918
|
+
}
|
|
27919
|
+
flattenFullySelectedList() {
|
|
27920
|
+
const { state, dispatch } = this.editor.view;
|
|
27921
|
+
const { $from, $to, empty } = state.selection;
|
|
27922
|
+
const paragraphType = state.schema.nodes.paragraph;
|
|
27923
|
+
if (empty || !paragraphType) {
|
|
27924
|
+
return false;
|
|
27925
|
+
}
|
|
27926
|
+
for (let depth = 1; depth <= $from.depth; depth++) {
|
|
27927
|
+
const list = $from.node(depth);
|
|
27928
|
+
if (!this.isListNode(list) || $to.depth < depth || $to.node(depth) !== list) {
|
|
27929
|
+
continue;
|
|
27930
|
+
}
|
|
27931
|
+
const selectionStartsInFirstItem = $from.index(depth) === 0;
|
|
27932
|
+
const selectionEndsInLastItem = $to.indexAfter(depth) === list.childCount;
|
|
27933
|
+
const selectionCoversListContent = this.selectionCoversListContent(list, $from.before(depth), state.selection.from, state.selection.to);
|
|
27934
|
+
if (!selectionStartsInFirstItem || !selectionEndsInLastItem ||
|
|
27935
|
+
!selectionCoversListContent) {
|
|
27936
|
+
continue;
|
|
27937
|
+
}
|
|
27938
|
+
const paragraphs = this.flattenListToParagraphs(list, 0);
|
|
27939
|
+
const transaction = state.tr.replaceWith($from.before(depth), $from.after(depth), Fragment.fromArray(paragraphs));
|
|
27940
|
+
dispatch(transaction.scrollIntoView());
|
|
27941
|
+
return true;
|
|
27942
|
+
}
|
|
27943
|
+
return false;
|
|
27944
|
+
}
|
|
27945
|
+
selectionCoversListContent(list, listPosition, from, to) {
|
|
27946
|
+
let firstTextBlockStart = null;
|
|
27947
|
+
let lastTextBlockEnd = null;
|
|
27948
|
+
list.descendants((node, position) => {
|
|
27949
|
+
if (!node.isTextblock) {
|
|
27950
|
+
return true;
|
|
27951
|
+
}
|
|
27952
|
+
const textBlockStart = listPosition + position + 2;
|
|
27953
|
+
firstTextBlockStart ??= textBlockStart;
|
|
27954
|
+
lastTextBlockEnd = textBlockStart + node.content.size;
|
|
27955
|
+
return false;
|
|
27956
|
+
});
|
|
27957
|
+
return firstTextBlockStart !== null && lastTextBlockEnd !== null &&
|
|
27958
|
+
from <= firstTextBlockStart && to >= lastTextBlockEnd;
|
|
27959
|
+
}
|
|
27960
|
+
flattenListToParagraphs(list, nestingIndent) {
|
|
27961
|
+
const paragraphType = this.editor.view.state.schema.nodes.paragraph;
|
|
27962
|
+
const listIndent = Number(list.attrs.indent) || 0;
|
|
27963
|
+
const itemIndent = Math.min(MAX_INDENT, nestingIndent + listIndent);
|
|
27964
|
+
const paragraphs = [];
|
|
27965
|
+
list.forEach((listItem) => {
|
|
27966
|
+
listItem.forEach((child) => {
|
|
27967
|
+
if (this.isListNode(child)) {
|
|
27968
|
+
paragraphs.push(...this.flattenListToParagraphs(child, itemIndent + 1));
|
|
27969
|
+
return;
|
|
27970
|
+
}
|
|
27971
|
+
if (child.isTextblock) {
|
|
27972
|
+
const existingIndent = Number(child.attrs.indent) || 0;
|
|
27973
|
+
const indent = Math.min(MAX_INDENT, itemIndent + existingIndent);
|
|
27974
|
+
paragraphs.push(paragraphType.create({
|
|
27975
|
+
...child.attrs,
|
|
27976
|
+
indent: indent || null
|
|
27977
|
+
}, child.content));
|
|
27978
|
+
}
|
|
27979
|
+
});
|
|
27980
|
+
});
|
|
27981
|
+
return paragraphs;
|
|
27982
|
+
}
|
|
27983
|
+
rebuildSelectedIndentedBlocksAsList(listType, orderedListStyle) {
|
|
27984
|
+
const { state, dispatch } = this.editor.view;
|
|
27985
|
+
const { from, to } = state.selection;
|
|
27986
|
+
const selectedBlocks = [];
|
|
27987
|
+
state.doc.forEach((node, position, index) => {
|
|
27988
|
+
if (!node.isTextblock) {
|
|
27989
|
+
return;
|
|
27990
|
+
}
|
|
27991
|
+
const contentStart = position + 1;
|
|
27992
|
+
const contentEnd = contentStart + node.content.size;
|
|
27993
|
+
if (from <= contentEnd && to >= contentStart) {
|
|
27994
|
+
selectedBlocks.push({
|
|
27995
|
+
node,
|
|
27996
|
+
position,
|
|
27997
|
+
index,
|
|
27998
|
+
indent: Number(node.attrs.indent) || 0
|
|
27999
|
+
});
|
|
28000
|
+
}
|
|
28001
|
+
});
|
|
28002
|
+
if (selectedBlocks.length === 1 && selectedBlocks[0].indent > 0) {
|
|
28003
|
+
const block = selectedBlocks[0];
|
|
28004
|
+
const { schema } = state;
|
|
28005
|
+
const listItemType = schema.nodes.list_item;
|
|
28006
|
+
const listNodeType = schema.nodes[listType];
|
|
28007
|
+
const textBlock = block.node.type.create({
|
|
28008
|
+
...block.node.attrs,
|
|
28009
|
+
indent: null
|
|
28010
|
+
}, block.node.content, block.node.marks);
|
|
28011
|
+
const orderedStyle = this.orderedListStyleAtDepth(orderedListStyle, 0);
|
|
28012
|
+
const attrs = listType === 'ordered_list'
|
|
28013
|
+
? {
|
|
28014
|
+
order: 1,
|
|
28015
|
+
indent: block.indent,
|
|
28016
|
+
listStyle: orderedStyle === 'decimal' ? null : orderedStyle
|
|
28017
|
+
}
|
|
28018
|
+
: {
|
|
28019
|
+
indent: block.indent,
|
|
28020
|
+
continuationOrder: null
|
|
28021
|
+
};
|
|
28022
|
+
const list = listNodeType.create(attrs, listItemType.create(null, textBlock));
|
|
28023
|
+
const transaction = state.tr.replaceWith(block.position, block.position + block.node.nodeSize, list);
|
|
28024
|
+
transaction.setSelection(TextSelection.create(transaction.doc, from + 2, to + 2));
|
|
28025
|
+
dispatch(transaction.scrollIntoView());
|
|
28026
|
+
return true;
|
|
28027
|
+
}
|
|
28028
|
+
if (selectedBlocks.length < 2 ||
|
|
28029
|
+
selectedBlocks[selectedBlocks.length - 1].index - selectedBlocks[0].index + 1 !== selectedBlocks.length) {
|
|
28030
|
+
return false;
|
|
28031
|
+
}
|
|
28032
|
+
const firstBlock = selectedBlocks[0];
|
|
28033
|
+
const lastBlock = selectedBlocks[selectedBlocks.length - 1];
|
|
28034
|
+
const selectionCoversBlocks = from <= firstBlock.position + 1 &&
|
|
28035
|
+
to >= lastBlock.position + 1 + lastBlock.node.content.size;
|
|
28036
|
+
const baseIndent = Math.min(...selectedBlocks.map((block) => block.indent));
|
|
28037
|
+
const normalisedBlocks = selectedBlocks.map((block) => ({
|
|
28038
|
+
...block,
|
|
28039
|
+
indent: Math.max(0, block.indent - baseIndent)
|
|
28040
|
+
}));
|
|
28041
|
+
if (!selectionCoversBlocks || (baseIndent === 0 && !normalisedBlocks.some((block) => block.indent > 0))) {
|
|
28042
|
+
return false;
|
|
28043
|
+
}
|
|
28044
|
+
const rebuilt = this.buildNestedList(normalisedBlocks, 0, 0, listType, orderedListStyle);
|
|
28045
|
+
if (rebuilt.nextIndex !== normalisedBlocks.length) {
|
|
28046
|
+
return false;
|
|
28047
|
+
}
|
|
28048
|
+
const rootList = baseIndent > 0
|
|
28049
|
+
? rebuilt.list.type.create({ ...rebuilt.list.attrs, indent: baseIndent }, rebuilt.list.content)
|
|
28050
|
+
: rebuilt.list;
|
|
28051
|
+
const transaction = state.tr.replaceWith(firstBlock.position, lastBlock.position + lastBlock.node.nodeSize, rootList);
|
|
28052
|
+
dispatch(transaction.scrollIntoView());
|
|
28053
|
+
return true;
|
|
28054
|
+
}
|
|
28055
|
+
buildNestedList(blocks, startIndex, depth, listType, rootOrderedListStyle) {
|
|
28056
|
+
const { schema } = this.editor.view.state;
|
|
28057
|
+
const listItemType = schema.nodes.list_item;
|
|
28058
|
+
const listNodeType = schema.nodes[listType];
|
|
28059
|
+
const listItems = [];
|
|
28060
|
+
let index = startIndex;
|
|
28061
|
+
while (index < blocks.length) {
|
|
28062
|
+
const block = blocks[index];
|
|
28063
|
+
if (block.indent < depth) {
|
|
28064
|
+
break;
|
|
28065
|
+
}
|
|
28066
|
+
if (block.indent > depth && listItems.length) {
|
|
28067
|
+
const nested = this.buildNestedList(blocks, index, depth + 1, listType, rootOrderedListStyle);
|
|
28068
|
+
const parentItem = listItems[listItems.length - 1];
|
|
28069
|
+
listItems[listItems.length - 1] = parentItem.copy(parentItem.content.append(Fragment.from(nested.list)));
|
|
28070
|
+
index = nested.nextIndex;
|
|
28071
|
+
continue;
|
|
28072
|
+
}
|
|
28073
|
+
const textBlock = block.node.type.create({
|
|
28074
|
+
...block.node.attrs,
|
|
28075
|
+
indent: null
|
|
28076
|
+
}, block.node.content, block.node.marks);
|
|
28077
|
+
listItems.push(listItemType.create(null, textBlock));
|
|
28078
|
+
index++;
|
|
28079
|
+
}
|
|
28080
|
+
const orderedStyle = this.orderedListStyleAtDepth(rootOrderedListStyle, depth);
|
|
28081
|
+
const attrs = listType === 'ordered_list'
|
|
28082
|
+
? {
|
|
28083
|
+
order: 1,
|
|
28084
|
+
indent: null,
|
|
28085
|
+
listStyle: orderedStyle === 'decimal' ? null : orderedStyle
|
|
28086
|
+
}
|
|
28087
|
+
: {
|
|
28088
|
+
indent: null,
|
|
28089
|
+
continuationOrder: null
|
|
28090
|
+
};
|
|
28091
|
+
return {
|
|
28092
|
+
list: listNodeType.create(attrs, Fragment.fromArray(listItems)),
|
|
28093
|
+
nextIndex: index
|
|
28094
|
+
};
|
|
28095
|
+
}
|
|
28096
|
+
orderedListStyleAtDepth(rootStyle, depth) {
|
|
28097
|
+
let listStyle = rootStyle;
|
|
28098
|
+
for (let currentDepth = 0; currentDepth < depth; currentDepth++) {
|
|
28099
|
+
listStyle = this.nextNestedOrderedListStyle(listStyle);
|
|
28100
|
+
}
|
|
28101
|
+
return listStyle;
|
|
28102
|
+
}
|
|
28103
|
+
isListNode(node) {
|
|
28104
|
+
return node.type.name === 'ordered_list' || node.type.name === 'bullet_list';
|
|
28105
|
+
}
|
|
27071
28106
|
changeIndent(increase) {
|
|
27072
28107
|
const { state, dispatch } = this.editor.view;
|
|
27073
28108
|
const listItemType = state.schema.nodes.list_item;
|
|
@@ -27077,6 +28112,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27077
28112
|
}
|
|
27078
28113
|
const listCommand = increase ? sinkListItem(listItemType) : liftListItem(listItemType);
|
|
27079
28114
|
if (listCommand(state, dispatch)) {
|
|
28115
|
+
this.applyOrderedListStyleForCurrentDepth();
|
|
27080
28116
|
return;
|
|
27081
28117
|
}
|
|
27082
28118
|
if (increase && this.changeListIndent(true, state, dispatch)) {
|
|
@@ -27090,6 +28126,35 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27090
28126
|
this.editor.commands.outdent().exec();
|
|
27091
28127
|
}
|
|
27092
28128
|
}
|
|
28129
|
+
applyOrderedListStyleForCurrentDepth() {
|
|
28130
|
+
const { state, dispatch } = this.editor.view;
|
|
28131
|
+
const { $from } = state.selection;
|
|
28132
|
+
const orderedListDepths = [];
|
|
28133
|
+
let activeOrderedListDepth = null;
|
|
28134
|
+
for (let depth = 1; depth <= $from.depth; depth++) {
|
|
28135
|
+
if ($from.node(depth).type.name === 'ordered_list') {
|
|
28136
|
+
orderedListDepths.push(depth);
|
|
28137
|
+
activeOrderedListDepth = depth;
|
|
28138
|
+
}
|
|
28139
|
+
}
|
|
28140
|
+
if (activeOrderedListDepth === null || orderedListDepths.length < 2) {
|
|
28141
|
+
return;
|
|
28142
|
+
}
|
|
28143
|
+
const activeList = $from.node(activeOrderedListDepth);
|
|
28144
|
+
const parentListDepth = orderedListDepths[orderedListDepths.length - 2];
|
|
28145
|
+
const parentListStyle = $from.node(parentListDepth).attrs.listStyle || 'decimal';
|
|
28146
|
+
const listStyle = this.nextNestedOrderedListStyle(parentListStyle);
|
|
28147
|
+
dispatch(state.tr.setNodeMarkup($from.before(activeOrderedListDepth), activeList.type, {
|
|
28148
|
+
...activeList.attrs,
|
|
28149
|
+
listStyle: listStyle === 'decimal' ? null : listStyle
|
|
28150
|
+
}));
|
|
28151
|
+
}
|
|
28152
|
+
nextNestedOrderedListStyle(parentListStyle) {
|
|
28153
|
+
if (parentListStyle === 'decimal') {
|
|
28154
|
+
return 'lower-alpha';
|
|
28155
|
+
}
|
|
28156
|
+
return 'lower-roman';
|
|
28157
|
+
}
|
|
27093
28158
|
changeListIndent(increase, state, dispatch) {
|
|
27094
28159
|
const { $from } = state.selection;
|
|
27095
28160
|
for (let depth = $from.depth; depth > 0; depth--) {
|
|
@@ -27118,6 +28183,44 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27118
28183
|
this.applyParagraph();
|
|
27119
28184
|
this.paragraphCommandApplied = true;
|
|
27120
28185
|
}
|
|
28186
|
+
toggleHeading() {
|
|
28187
|
+
if (this.isHeadingOneActive()) {
|
|
28188
|
+
const paragraphType = this.editor.view.state.schema.nodes.paragraph;
|
|
28189
|
+
if (paragraphType) {
|
|
28190
|
+
setBlockType(paragraphType)(this.editor.view.state, this.editor.view.dispatch);
|
|
28191
|
+
}
|
|
28192
|
+
this.paragraphCommandApplied = false;
|
|
28193
|
+
return;
|
|
28194
|
+
}
|
|
28195
|
+
const headingType = this.editor.view.state.schema.nodes.heading;
|
|
28196
|
+
if (headingType) {
|
|
28197
|
+
setBlockType(headingType, { level: 1 })(this.editor.view.state, this.editor.view.dispatch);
|
|
28198
|
+
}
|
|
28199
|
+
this.paragraphCommandApplied = false;
|
|
28200
|
+
}
|
|
28201
|
+
isHeadingOneActive() {
|
|
28202
|
+
const state = this.editor.view.state;
|
|
28203
|
+
const headingType = state.schema.nodes.heading;
|
|
28204
|
+
if (!headingType) {
|
|
28205
|
+
return false;
|
|
28206
|
+
}
|
|
28207
|
+
const { $from, from, to } = state.selection;
|
|
28208
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
28209
|
+
const node = $from.node(depth);
|
|
28210
|
+
if (node.type === headingType && node.attrs.level === 1) {
|
|
28211
|
+
return true;
|
|
28212
|
+
}
|
|
28213
|
+
}
|
|
28214
|
+
let isActive = false;
|
|
28215
|
+
state.doc.nodesBetween(from, to, (node) => {
|
|
28216
|
+
if (node.type === headingType && node.attrs.level === 1) {
|
|
28217
|
+
isActive = true;
|
|
28218
|
+
return false;
|
|
28219
|
+
}
|
|
28220
|
+
return true;
|
|
28221
|
+
});
|
|
28222
|
+
return isActive;
|
|
28223
|
+
}
|
|
27121
28224
|
isPlainParagraphActive() {
|
|
27122
28225
|
return this.isNodeActive('paragraph') &&
|
|
27123
28226
|
!this.isNodeActive('list_item') &&
|
|
@@ -27191,7 +28294,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27191
28294
|
} if (rf & 2) {
|
|
27192
28295
|
let _t;
|
|
27193
28296
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.editorHost = _t.first);
|
|
27194
|
-
} }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls:
|
|
28297
|
+
} }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 57, vars: 45, consts: [["editorHost", ""], [1, "form-group", "ccd-rich-text-area", 3, "ngClass"], [3, "id"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 3, "id", 4, "ngIf"], ["class", "error-message", 3, "id", 4, "ngIf"], [1, "ccd-rich-text-area__editor", 3, "click", "keydown", "keyup", "paste", "ngClass"], ["role", "toolbar", 1, "ccd-rich-text-area__toolbar"], ["type", "button", "aria-label", "Undo", "title", "Undo", "aria-keyshortcuts", "Control+Z", 1, "ccd-rich-text-area__toolbar-button", 3, "mousedown", "click"], ["viewBox", "0 0 24 24", "aria-hidden", "true", "focusable", "false", 1, "ccd-rich-text-area__toolbar-icon"], ["d", "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"], ["type", "button", "aria-label", "Redo", "title", "Redo", "aria-keyshortcuts", "Control+Y", 1, "ccd-rich-text-area__toolbar-button", 3, "mousedown", "click"], ["d", "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"], ["aria-hidden", "true", 1, "ccd-rich-text-area__toolbar-separator"], ["type", "button", "aria-label", "Bold", "title", "Bold", "aria-keyshortcuts", "Control+B", 1, "ccd-rich-text-area__toolbar-button", "ccd-rich-text-area__toolbar-button--bold", 3, "mousedown", "click", "ngClass"], ["d", "M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5S13.83 9.5 13 9.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"], ["type", "button", "aria-label", "Italic", "title", "Italic", "aria-keyshortcuts", "Control+I", 1, "ccd-rich-text-area__toolbar-button", "ccd-rich-text-area__toolbar-button--italic", 3, "mousedown", "click", "ngClass"], ["d", "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"], ["type", "button", "aria-label", "Underline", "title", "Underline", "aria-keyshortcuts", "Control+U", 1, "ccd-rich-text-area__toolbar-button", "ccd-rich-text-area__toolbar-button--underline", 3, "mousedown", "click", "ngClass"], ["d", "M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"], ["type", "button", "aria-label", "Paragraph", "title", "Paragraph", 1, "ccd-rich-text-area__toolbar-button", "ccd-rich-text-area__toolbar-button--paragraph", 3, "mousedown", "click", "ngClass"], ["aria-hidden", "true", 1, "ccd-rich-text-area__toolbar-icon", "ccd-rich-text-area__toolbar-icon--paragraph"], ["type", "button", "aria-label", "Heading level 1", "title", "Heading level 1", 1, "ccd-rich-text-area__toolbar-button", "ccd-rich-text-area__toolbar-button--heading", 3, "mousedown", "click", "ngClass"], ["aria-hidden", "true", 1, "ccd-rich-text-area__toolbar-icon", "ccd-rich-text-area__toolbar-icon--heading"], ["type", "button", "aria-label", "Bullet List", "title", "Bullet List", 1, "ccd-rich-text-area__toolbar-button", 3, "mousedown", "click", "ngClass"], ["d", "M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6C3.17 4.5 2.5 5.17 2.5 6S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zM7 13h14v-2H7v2zm0 6h14v-2H7v2zM7 5v2h14V5H7z"], ["type", "button", "aria-label", "Numbered List", "title", "Numbered List", 1, "ccd-rich-text-area__toolbar-button", 3, "mousedown", "click", "ngClass"], ["d", "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1V14h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"], [1, "ccd-rich-text-area__list-style"], [1, "ccd-rich-text-area__list-style-label", 3, "for"], [1, "ccd-rich-text-area__list-style-select", 3, "change", "id", "value"], ["value", "", 4, "ngIf"], ["value", "ordered_list"], ["value", "ordered_alpha"], ["value", "ordered_roman"], ["type", "button", "aria-label", "Decrease Indent", "title", "Decrease Indent", 1, "ccd-rich-text-area__toolbar-button", 3, "mousedown", "click"], ["d", "M11 17h10v-2H11v2zm-8-5 4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"], ["type", "button", "aria-label", "Increase Indent", "title", "Increase Indent", 1, "ccd-rich-text-area__toolbar-button", 3, "mousedown", "click"], ["d", "M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"], [1, "NgxEditor__Wrapper"], ["outputFormat", "html", 3, "focusIn", "focusOut", "editor", "formControl"], [1, "form-label"], [1, "form-hint", 3, "id"], [1, "error-message", 3, "id"], ["value", ""]], template: function WriteRichTextAreaFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
27195
28298
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
27196
28299
|
i0.ɵɵelementStart(0, "div", 1)(1, "div", 2);
|
|
27197
28300
|
i0.ɵɵtemplate(2, WriteRichTextAreaFieldComponent_span_2_Template, 3, 3, "span", 3);
|
|
@@ -27201,80 +28304,100 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27201
28304
|
i0.ɵɵlistener("click", function WriteRichTextAreaFieldComponent_Template_div_click_5_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.syncAccessibilityLater()); })("keydown", function WriteRichTextAreaFieldComponent_Template_div_keydown_5_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onEditorKeyDown($event)); })("keyup", function WriteRichTextAreaFieldComponent_Template_div_keyup_5_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.syncAccessibilityLater()); })("paste", function WriteRichTextAreaFieldComponent_Template_div_paste_5_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onPaste($event)); });
|
|
27202
28305
|
i0.ɵɵelementStart(7, "div", 7)(8, "button", 8);
|
|
27203
28306
|
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_8_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_8_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "undo")); });
|
|
27204
|
-
i0.ɵɵ
|
|
27205
|
-
i0.ɵɵ
|
|
28307
|
+
i0.ɵɵnamespaceSVG();
|
|
28308
|
+
i0.ɵɵelementStart(9, "svg", 9);
|
|
28309
|
+
i0.ɵɵelement(10, "path", 10);
|
|
27206
28310
|
i0.ɵɵelementEnd()();
|
|
27207
|
-
i0.ɵɵ
|
|
28311
|
+
i0.ɵɵnamespaceHTML();
|
|
28312
|
+
i0.ɵɵelementStart(11, "button", 11);
|
|
27208
28313
|
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_11_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_11_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "redo")); });
|
|
27209
|
-
i0.ɵɵ
|
|
27210
|
-
i0.ɵɵ
|
|
28314
|
+
i0.ɵɵnamespaceSVG();
|
|
28315
|
+
i0.ɵɵelementStart(12, "svg", 9);
|
|
28316
|
+
i0.ɵɵelement(13, "path", 12);
|
|
27211
28317
|
i0.ɵɵelementEnd()();
|
|
27212
|
-
i0.ɵɵ
|
|
27213
|
-
i0.ɵɵ
|
|
28318
|
+
i0.ɵɵnamespaceHTML();
|
|
28319
|
+
i0.ɵɵelement(14, "span", 13);
|
|
28320
|
+
i0.ɵɵelementStart(15, "button", 14);
|
|
27214
28321
|
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_15_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_15_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "bold")); });
|
|
27215
|
-
i0.ɵɵ
|
|
27216
|
-
i0.ɵɵ
|
|
28322
|
+
i0.ɵɵnamespaceSVG();
|
|
28323
|
+
i0.ɵɵelementStart(16, "svg", 9);
|
|
28324
|
+
i0.ɵɵelement(17, "path", 15);
|
|
27217
28325
|
i0.ɵɵelementEnd()();
|
|
27218
|
-
i0.ɵɵ
|
|
28326
|
+
i0.ɵɵnamespaceHTML();
|
|
28327
|
+
i0.ɵɵelementStart(18, "button", 16);
|
|
27219
28328
|
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_18_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_18_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "italic")); });
|
|
27220
|
-
i0.ɵɵ
|
|
27221
|
-
i0.ɵɵ
|
|
28329
|
+
i0.ɵɵnamespaceSVG();
|
|
28330
|
+
i0.ɵɵelementStart(19, "svg", 9);
|
|
28331
|
+
i0.ɵɵelement(20, "path", 17);
|
|
27222
28332
|
i0.ɵɵelementEnd()();
|
|
27223
|
-
i0.ɵɵ
|
|
28333
|
+
i0.ɵɵnamespaceHTML();
|
|
28334
|
+
i0.ɵɵelementStart(21, "button", 18);
|
|
27224
28335
|
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_21_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_21_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "underline")); });
|
|
27225
|
-
i0.ɵɵ
|
|
27226
|
-
i0.ɵɵ
|
|
28336
|
+
i0.ɵɵnamespaceSVG();
|
|
28337
|
+
i0.ɵɵelementStart(22, "svg", 9);
|
|
28338
|
+
i0.ɵɵelement(23, "path", 19);
|
|
27227
28339
|
i0.ɵɵelementEnd()();
|
|
27228
|
-
i0.ɵɵ
|
|
28340
|
+
i0.ɵɵnamespaceHTML();
|
|
28341
|
+
i0.ɵɵelementStart(24, "button", 20);
|
|
27229
28342
|
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_24_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_24_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "paragraph")); });
|
|
27230
|
-
i0.ɵɵelementStart(25, "span",
|
|
28343
|
+
i0.ɵɵelementStart(25, "span", 21);
|
|
27231
28344
|
i0.ɵɵtext(26, "P");
|
|
27232
28345
|
i0.ɵɵelementEnd()();
|
|
27233
|
-
i0.ɵɵelementStart(27, "button",
|
|
27234
|
-
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_27_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_27_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "
|
|
27235
|
-
i0.ɵɵelementStart(28, "span",
|
|
27236
|
-
i0.ɵɵtext(
|
|
27237
|
-
i0.ɵɵelementEnd();
|
|
27238
|
-
i0.ɵɵelement(
|
|
27239
|
-
i0.ɵɵelementStart(
|
|
27240
|
-
i0.ɵɵ
|
|
27241
|
-
i0.ɵɵ
|
|
27242
|
-
i0.ɵɵ
|
|
27243
|
-
i0.ɵɵ
|
|
27244
|
-
i0.ɵɵtext(36, "3");
|
|
27245
|
-
i0.ɵɵelementEnd();
|
|
27246
|
-
i0.ɵɵelement(37, "span", 24);
|
|
28346
|
+
i0.ɵɵelementStart(27, "button", 22);
|
|
28347
|
+
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_27_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_27_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "heading")); });
|
|
28348
|
+
i0.ɵɵelementStart(28, "span", 23);
|
|
28349
|
+
i0.ɵɵtext(29, "H");
|
|
28350
|
+
i0.ɵɵelementEnd()();
|
|
28351
|
+
i0.ɵɵelement(30, "span", 13);
|
|
28352
|
+
i0.ɵɵelementStart(31, "button", 24);
|
|
28353
|
+
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_31_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_31_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "bullet_list")); });
|
|
28354
|
+
i0.ɵɵnamespaceSVG();
|
|
28355
|
+
i0.ɵɵelementStart(32, "svg", 9);
|
|
28356
|
+
i0.ɵɵelement(33, "path", 25);
|
|
27247
28357
|
i0.ɵɵelementEnd()();
|
|
27248
|
-
i0.ɵɵ
|
|
27249
|
-
i0.ɵɵ
|
|
27250
|
-
i0.ɵɵ
|
|
27251
|
-
i0.ɵɵ
|
|
28358
|
+
i0.ɵɵnamespaceHTML();
|
|
28359
|
+
i0.ɵɵelementStart(34, "button", 26);
|
|
28360
|
+
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_34_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_34_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "ordered_list")); });
|
|
28361
|
+
i0.ɵɵnamespaceSVG();
|
|
28362
|
+
i0.ɵɵelementStart(35, "svg", 9);
|
|
28363
|
+
i0.ɵɵelement(36, "path", 27);
|
|
28364
|
+
i0.ɵɵelementEnd()();
|
|
28365
|
+
i0.ɵɵnamespaceHTML();
|
|
28366
|
+
i0.ɵɵelementStart(37, "div", 28)(38, "label", 29);
|
|
28367
|
+
i0.ɵɵtext(39, "List style");
|
|
27252
28368
|
i0.ɵɵelementEnd();
|
|
27253
|
-
i0.ɵɵ
|
|
27254
|
-
i0.ɵɵ
|
|
27255
|
-
i0.ɵɵ
|
|
28369
|
+
i0.ɵɵelementStart(40, "select", 30);
|
|
28370
|
+
i0.ɵɵlistener("change", function WriteRichTextAreaFieldComponent_Template_select_change_40_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onListStyleChange($event)); });
|
|
28371
|
+
i0.ɵɵtemplate(41, WriteRichTextAreaFieldComponent_option_41_Template, 2, 0, "option", 31);
|
|
28372
|
+
i0.ɵɵelementStart(42, "option", 32);
|
|
28373
|
+
i0.ɵɵtext(43, "Numbers (1, 2, 3)");
|
|
27256
28374
|
i0.ɵɵelementEnd();
|
|
27257
|
-
i0.ɵɵ
|
|
27258
|
-
i0.ɵɵ
|
|
27259
|
-
i0.ɵɵtext(47, "\u2022");
|
|
28375
|
+
i0.ɵɵelementStart(44, "option", 33);
|
|
28376
|
+
i0.ɵɵtext(45, "Letters (a, b, c)");
|
|
27260
28377
|
i0.ɵɵelementEnd();
|
|
27261
|
-
i0.ɵɵ
|
|
27262
|
-
i0.ɵɵ
|
|
27263
|
-
i0.ɵɵ
|
|
28378
|
+
i0.ɵɵelementStart(46, "option", 34);
|
|
28379
|
+
i0.ɵɵtext(47, "Roman numerals (i), (ii), (iii)");
|
|
28380
|
+
i0.ɵɵelementEnd()()();
|
|
28381
|
+
i0.ɵɵelement(48, "span", 13);
|
|
28382
|
+
i0.ɵɵelementStart(49, "button", 35);
|
|
27264
28383
|
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_49_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_49_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "outdent")); });
|
|
27265
|
-
i0.ɵɵ
|
|
27266
|
-
i0.ɵɵ
|
|
28384
|
+
i0.ɵɵnamespaceSVG();
|
|
28385
|
+
i0.ɵɵelementStart(50, "svg", 9);
|
|
28386
|
+
i0.ɵɵelement(51, "path", 36);
|
|
27267
28387
|
i0.ɵɵelementEnd()();
|
|
27268
|
-
i0.ɵɵ
|
|
27269
|
-
i0.ɵɵ
|
|
27270
|
-
i0.ɵɵ
|
|
27271
|
-
i0.ɵɵ
|
|
28388
|
+
i0.ɵɵnamespaceHTML();
|
|
28389
|
+
i0.ɵɵelementStart(52, "button", 37);
|
|
28390
|
+
i0.ɵɵlistener("mousedown", function WriteRichTextAreaFieldComponent_Template_button_mousedown_52_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onToolbarButtonMouseDown($event)); })("click", function WriteRichTextAreaFieldComponent_Template_button_click_52_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.executeToolbarCommand($event, "indent")); });
|
|
28391
|
+
i0.ɵɵnamespaceSVG();
|
|
28392
|
+
i0.ɵɵelementStart(53, "svg", 9);
|
|
28393
|
+
i0.ɵɵelement(54, "path", 38);
|
|
27272
28394
|
i0.ɵɵelementEnd()()();
|
|
27273
|
-
i0.ɵɵ
|
|
27274
|
-
i0.ɵɵ
|
|
28395
|
+
i0.ɵɵnamespaceHTML();
|
|
28396
|
+
i0.ɵɵelementStart(55, "div", 39)(56, "ngx-editor", 40);
|
|
28397
|
+
i0.ɵɵlistener("focusIn", function WriteRichTextAreaFieldComponent_Template_ngx_editor_focusIn_56_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.syncAccessibilityLater()); })("focusOut", function WriteRichTextAreaFieldComponent_Template_ngx_editor_focusOut_56_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onEditorFocusOut()); });
|
|
27275
28398
|
i0.ɵɵelementEnd()()()();
|
|
27276
28399
|
} if (rf & 2) {
|
|
27277
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28400
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(27, _c1$e, !ctx.richTextAreaControl.valid && ctx.richTextAreaControl.dirty));
|
|
27278
28401
|
i0.ɵɵadvance();
|
|
27279
28402
|
i0.ɵɵproperty("id", ctx.labelId());
|
|
27280
28403
|
i0.ɵɵadvance();
|
|
@@ -27284,39 +28407,48 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27284
28407
|
i0.ɵɵadvance();
|
|
27285
28408
|
i0.ɵɵproperty("ngIf", ctx.isInvalid());
|
|
27286
28409
|
i0.ɵɵadvance();
|
|
27287
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28410
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(29, _c2$3, ctx.isInvalid()));
|
|
27288
28411
|
i0.ɵɵadvance(2);
|
|
27289
28412
|
i0.ɵɵattribute("aria-label", ctx.toolbarLabel());
|
|
27290
28413
|
i0.ɵɵadvance(8);
|
|
27291
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28414
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(31, _c3, ctx.isToolbarCommandActive("bold")));
|
|
27292
28415
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("bold"));
|
|
27293
28416
|
i0.ɵɵadvance(3);
|
|
27294
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28417
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(33, _c3, ctx.isToolbarCommandActive("italic")));
|
|
27295
28418
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("italic"));
|
|
27296
28419
|
i0.ɵɵadvance(3);
|
|
27297
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28420
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(35, _c3, ctx.isToolbarCommandActive("underline")));
|
|
27298
28421
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("underline"));
|
|
27299
28422
|
i0.ɵɵadvance(3);
|
|
27300
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28423
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(37, _c3, ctx.isToolbarCommandActive("paragraph")));
|
|
27301
28424
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("paragraph"));
|
|
27302
28425
|
i0.ɵɵadvance(3);
|
|
27303
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
27304
|
-
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("
|
|
27305
|
-
i0.ɵɵadvance(
|
|
27306
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28426
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(39, _c3, ctx.isToolbarCommandActive("heading")));
|
|
28427
|
+
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("heading"));
|
|
28428
|
+
i0.ɵɵadvance(4);
|
|
28429
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(41, _c3, ctx.isToolbarCommandActive("bullet_list")));
|
|
27307
28430
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("bullet_list"));
|
|
27308
|
-
i0.ɵɵadvance(
|
|
28431
|
+
i0.ɵɵadvance(3);
|
|
28432
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(43, _c3, ctx.isOrderedListActive()));
|
|
28433
|
+
i0.ɵɵattribute("aria-pressed", ctx.isOrderedListActive());
|
|
28434
|
+
i0.ɵɵadvance(4);
|
|
28435
|
+
i0.ɵɵproperty("for", ctx.listStyleId());
|
|
28436
|
+
i0.ɵɵadvance(2);
|
|
28437
|
+
i0.ɵɵproperty("id", ctx.listStyleId())("value", ctx.currentListSelectValue());
|
|
28438
|
+
i0.ɵɵadvance();
|
|
28439
|
+
i0.ɵɵproperty("ngIf", !ctx.isOrderedListActive());
|
|
28440
|
+
i0.ɵɵadvance(15);
|
|
27309
28441
|
i0.ɵɵproperty("editor", ctx.editor)("formControl", ctx.richTextAreaControl);
|
|
27310
|
-
} }, dependencies: [i5.NgClass, i5.NgIf, i4.NgControlStatus, i4.FormControlDirective, i3$1.NgxEditorComponent, FieldLabelPipe, FirstErrorPipe, i1.RpxTranslatePipe], styles: [".ccd-rich-text-area{margin-bottom:30px}.ccd-rich-text-area__editor{max-width:100%}.ccd-rich-text-area__toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:
|
|
28442
|
+
} }, dependencies: [i5.NgClass, i5.NgIf, i4.NgSelectOption, i4.ɵNgSelectMultipleOption, i4.NgControlStatus, i4.FormControlDirective, i3$1.NgxEditorComponent, FieldLabelPipe, FirstErrorPipe, i1.RpxTranslatePipe], styles: [".ccd-rich-text-area{margin-bottom:30px}.ccd-rich-text-area__editor{max-width:100%}.ccd-rich-text-area__toolbar{align-items:center;background:#fff;border:1px solid #d8dde0;border-radius:6px;display:flex;flex-wrap:wrap;gap:2px;margin-bottom:10px;padding:6px 8px;width:fit-content}.ccd-rich-text-area .NgxEditor__Wrapper{border:1px solid #000;border-radius:0;box-sizing:border-box;height:255px;max-width:100%;min-height:255px;min-width:200px;overflow:hidden;resize:both;width:100%}.ccd-rich-text-area .NgxEditor__Wrapper:focus-within{outline:3px solid #ffdd00;outline-offset:0}.ccd-rich-text-area__toolbar-button{background:#fff;align-items:center;border:0;border-radius:2px;color:#0b0c0c;display:inline-flex;font-family:inherit;font-size:18px;font-weight:700;height:28px;justify-content:center;min-width:28px;padding:4px;width:28px}.ccd-rich-text-area__toolbar-button:hover{background:#f3f2f1}.ccd-rich-text-area__toolbar-button:focus{background:#fd0;box-shadow:0 0 0 2px #0b0c0c;outline:2px solid #ffdd00;outline-offset:0}.ccd-rich-text-area__toolbar-button--active,.ccd-rich-text-area__toolbar-button--active:hover{background:#1d70b8;color:#fff}.ccd-rich-text-area__toolbar-button--italic{font-style:italic}.ccd-rich-text-area__toolbar-button--underline{text-decoration:underline}.ccd-rich-text-area__toolbar-separator{border-left:1px solid #b1b4b6;height:24px;margin:0 5px 0 3px}.ccd-rich-text-area__list-style{align-items:center;display:inline-flex;gap:8px;margin:0 4px}.ccd-rich-text-area__list-style-label{font-weight:700;white-space:nowrap}.ccd-rich-text-area__list-style-select{background-color:#fff;border:1px solid #0b0c0c;border-radius:0;color:#0b0c0c;font-family:inherit;font-size:16px;height:32px;min-width:190px;padding:2px 28px 2px 8px}.ccd-rich-text-area__list-style-select:focus{box-shadow:0 0 0 2px #0b0c0c;outline:3px solid #ffdd00;outline-offset:0}.ccd-rich-text-area__toolbar-icon{display:block;fill:currentColor;height:20px;width:20px}.ccd-rich-text-area__toolbar-icon--paragraph{display:inline-flex;font-size:18px;line-height:1;width:auto}.ccd-rich-text-area__toolbar-icon--heading{display:inline-flex;font-size:18px;font-weight:700;line-height:1;width:auto}.ccd-rich-text-area .ProseMirror h1{font-size:20px;font-weight:700}.ccd-rich-text-area .NgxEditor__Wrapper .NgxEditor{border:0;border-radius:0;height:100%;min-height:0;overflow:hidden;width:100%}.ccd-rich-text-area__editor--error .NgxEditor__Wrapper{border-color:#d4351c}.ccd-rich-text-area .NgxEditor__Content{box-sizing:border-box;height:100%;min-height:0;overflow-x:hidden;overflow-y:auto;padding:12px 14px}.ccd-rich-text-area .ProseMirror{min-height:231px;outline:0;overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal}.ccd-rich-text-area .ProseMirror [data-indent=\"1\"]{margin-left:40px}.ccd-rich-text-area .ProseMirror [data-indent=\"2\"]{margin-left:80px}.ccd-rich-text-area .ProseMirror [data-indent=\"3\"]{margin-left:120px}.ccd-rich-text-area .ProseMirror [data-indent=\"4\"]{margin-left:160px}.ccd-rich-text-area .ProseMirror [data-indent=\"5\"]{margin-left:200px}.ccd-rich-text-area .ProseMirror [data-indent=\"6\"]{margin-left:240px}.ccd-rich-text-area .ProseMirror strong,.ccd-rich-text-area .ProseMirror strong *,.ccd-rich-text-area .ProseMirror b,.ccd-rich-text-area .ProseMirror b *{font-weight:700}.ccd-rich-text-area .ProseMirror strong u,.ccd-rich-text-area .ProseMirror u strong,.ccd-rich-text-area .ProseMirror b u,.ccd-rich-text-area .ProseMirror u b{font-weight:700!important;text-decoration:underline}.ccd-rich-text-area .ProseMirror:focus{box-shadow:none;outline:0}.ccd-rich-text-area .ProseMirror p,.ccd-rich-text-area .ProseMirror ul,.ccd-rich-text-area .ProseMirror ol{margin-top:0;overflow-wrap:anywhere;word-break:normal}.ccd-rich-text-area .ProseMirror p{margin-bottom:5px}.ccd-rich-text-area .ProseMirror ul{list-style:disc outside;padding-left:25px}.ccd-rich-text-area .ProseMirror ol{list-style:decimal outside;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"1\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"1\"]{margin-left:40px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"2\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"2\"]{margin-left:80px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"3\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"3\"]{margin-left:120px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"4\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"4\"]{margin-left:160px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"5\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"5\"]{margin-left:200px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"6\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"6\"]{margin-left:240px;padding-left:25px}.ccd-rich-text-area .ProseMirror ol[type=a]{list-style-type:lower-alpha}.ccd-rich-text-area .ProseMirror ol[type=i]{list-style-type:lower-roman}.ccd-rich-text-area .ProseMirror ol[type=i]>li::marker{content:\"(\" counter(list-item,lower-roman) \") \"}.ccd-rich-text-area .ProseMirror li{display:list-item;margin-bottom:5px}.ccd-rich-text-area .ProseMirror li>p{margin:0}.ccd-rich-text-area .ProseMirror li>ul,.ccd-rich-text-area .ProseMirror li>ol{margin-top:5px}\n"], encapsulation: 2 });
|
|
27311
28443
|
}
|
|
27312
28444
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteRichTextAreaFieldComponent, [{
|
|
27313
28445
|
type: Component,
|
|
27314
|
-
args: [{ selector: 'ccd-write-rich-text-area-field', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div class=\"form-group ccd-rich-text-area\" [ngClass]=\"{'form-group-error': !richTextAreaControl.valid && richTextAreaControl.dirty}\">\n <div [id]=\"labelId()\">\n <span class=\"form-label\" *ngIf=\"caseField.label\">{{caseField | ccdFieldLabel}}</span>\n </div>\n <span [id]=\"hintId()\" class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n <span [id]=\"errorId()\" class=\"error-message\" *ngIf=\"isInvalid()\">\n {{richTextAreaControl.errors | ccdFirstError:caseField.label}}\n </span>\n\n <div\n #editorHost\n class=\"ccd-rich-text-area__editor\"\n [ngClass]=\"{'ccd-rich-text-area__editor--error': isInvalid()}\"\n (click)=\"syncAccessibilityLater()\"\n (keydown)=\"onEditorKeyDown($event)\"\n (keyup)=\"syncAccessibilityLater()\"\n (paste)=\"onPaste($event)\">\n <div\n class=\"ccd-rich-text-area__toolbar\"\n role=\"toolbar\"\n [attr.aria-label]=\"toolbarLabel()\">\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n aria-label=\"Undo\"\n title=\"Undo\"\n aria-keyshortcuts=\"Control+Z\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'undo')\">\n <span class=\"ccd-rich-text-area__toolbar-icon ccd-rich-text-area__toolbar-icon--undo\" aria-hidden=\"true\">↶</span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n aria-label=\"Redo\"\n title=\"Redo\"\n aria-keyshortcuts=\"Control+Y\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'redo')\">\n <span class=\"ccd-rich-text-area__toolbar-icon ccd-rich-text-area__toolbar-icon--redo\" aria-hidden=\"true\">↷</span>\n </button>\n <span class=\"ccd-rich-text-area__toolbar-separator\" aria-hidden=\"true\"></span>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--bold\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('bold')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('bold')\"\n aria-label=\"Bold\"\n title=\"Bold\"\n aria-keyshortcuts=\"Control+B\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'bold')\">\n <span class=\"ccd-rich-text-area__toolbar-icon ccd-rich-text-area__toolbar-icon--bold\" aria-hidden=\"true\">B</span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--italic\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('italic')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('italic')\"\n aria-label=\"Italic\"\n title=\"Italic\"\n aria-keyshortcuts=\"Control+I\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'italic')\">\n <span class=\"ccd-rich-text-area__toolbar-icon ccd-rich-text-area__toolbar-icon--italic\" aria-hidden=\"true\">I</span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--underline\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('underline')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('underline')\"\n aria-label=\"Underline\"\n title=\"Underline\"\n aria-keyshortcuts=\"Control+U\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'underline')\">\n <span class=\"ccd-rich-text-area__toolbar-icon ccd-rich-text-area__toolbar-icon--underline\" aria-hidden=\"true\">U</span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--paragraph\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('paragraph')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('paragraph')\"\n aria-label=\"Paragraph\"\n title=\"Paragraph\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'paragraph')\">\n <span class=\"ccd-rich-text-area__toolbar-icon ccd-rich-text-area__toolbar-icon--paragraph\" aria-hidden=\"true\">P</span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('ordered_list')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('ordered_list')\"\n aria-label=\"Ordered List\"\n title=\"Ordered List\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'ordered_list')\">\n <span class=\"ccd-rich-text-area__list-icon ccd-rich-text-area__list-icon--ordered\" aria-hidden=\"true\">\n <span class=\"ccd-rich-text-area__list-marker\">1</span>\n <span class=\"ccd-rich-text-area__list-line\"></span>\n <span class=\"ccd-rich-text-area__list-marker\">2</span>\n <span class=\"ccd-rich-text-area__list-line\"></span>\n <span class=\"ccd-rich-text-area__list-marker\">3</span>\n <span class=\"ccd-rich-text-area__list-line\"></span>\n </span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('bullet_list')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('bullet_list')\"\n aria-label=\"Bullet List\"\n title=\"Bullet List\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'bullet_list')\">\n <span class=\"ccd-rich-text-area__list-icon ccd-rich-text-area__list-icon--bullet\" aria-hidden=\"true\">\n <span class=\"ccd-rich-text-area__list-marker\">•</span>\n <span class=\"ccd-rich-text-area__list-line\"></span>\n <span class=\"ccd-rich-text-area__list-marker\">•</span>\n <span class=\"ccd-rich-text-area__list-line\"></span>\n <span class=\"ccd-rich-text-area__list-marker\">•</span>\n <span class=\"ccd-rich-text-area__list-line\"></span>\n </span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n aria-label=\"Decrease Indent\"\n title=\"Decrease Indent\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'outdent')\">\n <span class=\"ccd-rich-text-area__indent-icon ccd-rich-text-area__indent-icon--outdent\" aria-hidden=\"true\">\n <span class=\"ccd-rich-text-area__indent-line ccd-rich-text-area__indent-line--top\"></span>\n <span class=\"ccd-rich-text-area__indent-line ccd-rich-text-area__indent-line--middle\"></span>\n <span class=\"ccd-rich-text-area__indent-line ccd-rich-text-area__indent-line--bottom\"></span>\n <span class=\"ccd-rich-text-area__indent-arrow\"></span>\n </span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n aria-label=\"Increase Indent\"\n title=\"Increase Indent\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'indent')\">\n <span class=\"ccd-rich-text-area__indent-icon ccd-rich-text-area__indent-icon--indent\" aria-hidden=\"true\">\n <span class=\"ccd-rich-text-area__indent-line ccd-rich-text-area__indent-line--top\"></span>\n <span class=\"ccd-rich-text-area__indent-line ccd-rich-text-area__indent-line--middle\"></span>\n <span class=\"ccd-rich-text-area__indent-line ccd-rich-text-area__indent-line--bottom\"></span>\n <span class=\"ccd-rich-text-area__indent-arrow\"></span>\n </span>\n </button>\n </div>\n\n <div class=\"NgxEditor__Wrapper\">\n <ngx-editor\n [editor]=\"editor\"\n [formControl]=\"richTextAreaControl\"\n outputFormat=\"html\"\n (focusIn)=\"syncAccessibilityLater()\"\n (focusOut)=\"onEditorFocusOut()\">\n </ngx-editor>\n </div>\n </div>\n</div>\n", styles: [".ccd-rich-text-area{margin-bottom:30px}.ccd-rich-text-area__editor{max-width:100%}.ccd-rich-text-area__toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:0 4px;margin-bottom:6px}.ccd-rich-text-area .NgxEditor__Wrapper{border:1px solid #000;border-radius:0;max-width:100%;width:100%}.ccd-rich-text-area .NgxEditor__Wrapper:focus-within{outline:3px solid #ffdd00;outline-offset:0}.ccd-rich-text-area__toolbar-button{background:#fff;align-items:center;border:1px solid #0b0c0c;border-radius:0;color:#0b0c0c;display:inline-flex;font-family:inherit;font-size:18px;font-weight:700;height:36px;justify-content:center;min-width:36px;padding:4px;width:36px}.ccd-rich-text-area__toolbar-button:hover{background:#f3f2f1}.ccd-rich-text-area__toolbar-button:focus{background:#fd0;box-shadow:0 0 0 2px #0b0c0c;outline:3px solid #ffdd00;outline-offset:0}.ccd-rich-text-area__toolbar-button--active{background:#1d70b8;color:#fff}.ccd-rich-text-area__toolbar-button--italic{font-style:italic}.ccd-rich-text-area__toolbar-button--underline{text-decoration:underline}.ccd-rich-text-area__toolbar-separator{border-left:1px solid #b1b4b6;height:36px;margin:0 8px 0 6px}.ccd-rich-text-area__toolbar-icon{display:inline-flex;line-height:1}.ccd-rich-text-area__toolbar-icon--undo,.ccd-rich-text-area__toolbar-icon--redo{font-size:23px;font-weight:400;transform:translateY(-1px)}.ccd-rich-text-area__toolbar-icon--bold{font-size:18px}.ccd-rich-text-area__toolbar-icon--italic{color:inherit;font-size:18px;font-style:italic}.ccd-rich-text-area__toolbar-icon--underline{font-size:18px;text-decoration:underline;text-underline-offset:3px}.ccd-rich-text-area__toolbar-icon--paragraph{font-size:18px}.ccd-rich-text-area__list-icon{column-gap:2px;display:grid;grid-template-columns:8px 13px;grid-template-rows:repeat(3,5px);height:17px;width:23px}.ccd-rich-text-area__list-marker{align-self:center;font-size:9px;font-weight:700;line-height:1;text-align:right}.ccd-rich-text-area__list-icon--ordered .ccd-rich-text-area__list-marker:after{content:\".\"}.ccd-rich-text-area__list-icon--bullet .ccd-rich-text-area__list-marker{font-size:14px;line-height:.5}.ccd-rich-text-area__list-line{align-self:center;border-top:2px solid currentColor;display:block;width:12px}.ccd-rich-text-area__indent-icon{display:block;height:18px;position:relative;width:23px}.ccd-rich-text-area__indent-line{background:currentColor;display:block;height:2px;position:absolute;right:0}.ccd-rich-text-area__indent-line--top{top:3px;width:18px}.ccd-rich-text-area__indent-line--middle{top:8px;width:13px}.ccd-rich-text-area__indent-line--bottom{top:13px;width:18px}.ccd-rich-text-area__indent-arrow{background:currentColor;display:block;height:2px;left:1px;position:absolute;top:8px;width:9px}.ccd-rich-text-area__indent-arrow:before,.ccd-rich-text-area__indent-arrow:after{background:currentColor;content:\"\";display:block;height:2px;position:absolute;top:0;width:6px}.ccd-rich-text-area__indent-icon--outdent .ccd-rich-text-area__indent-arrow:before{left:-1px;transform:rotate(45deg);transform-origin:left center}.ccd-rich-text-area__indent-icon--outdent .ccd-rich-text-area__indent-arrow:after{left:-1px;transform:rotate(-45deg);transform-origin:left center}.ccd-rich-text-area__indent-icon--indent .ccd-rich-text-area__indent-arrow:before{right:-1px;transform:rotate(45deg);transform-origin:right center}.ccd-rich-text-area__indent-icon--indent .ccd-rich-text-area__indent-arrow:after{right:-1px;transform:rotate(-45deg);transform-origin:right center}.ccd-rich-text-area .NgxEditor__Wrapper .NgxEditor{border:0;border-radius:0;height:255px;min-height:255px;overflow:hidden;width:100%}.ccd-rich-text-area__editor--error .NgxEditor__Wrapper{border-color:#d4351c}.ccd-rich-text-area .NgxEditor__Content{box-sizing:border-box;height:255px;min-height:255px;overflow-x:hidden;overflow-y:auto;padding:12px 14px}.ccd-rich-text-area .ProseMirror{min-height:231px;outline:0;overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal}.ccd-rich-text-area .ProseMirror [data-indent=\"1\"]{margin-left:40px}.ccd-rich-text-area .ProseMirror [data-indent=\"2\"]{margin-left:80px}.ccd-rich-text-area .ProseMirror [data-indent=\"3\"]{margin-left:120px}.ccd-rich-text-area .ProseMirror [data-indent=\"4\"]{margin-left:160px}.ccd-rich-text-area .ProseMirror [data-indent=\"5\"]{margin-left:200px}.ccd-rich-text-area .ProseMirror [data-indent=\"6\"]{margin-left:240px}.ccd-rich-text-area .ProseMirror strong,.ccd-rich-text-area .ProseMirror strong *,.ccd-rich-text-area .ProseMirror b,.ccd-rich-text-area .ProseMirror b *{font-weight:700}.ccd-rich-text-area .ProseMirror strong u,.ccd-rich-text-area .ProseMirror u strong,.ccd-rich-text-area .ProseMirror b u,.ccd-rich-text-area .ProseMirror u b{font-weight:700!important;text-decoration:underline}.ccd-rich-text-area .ProseMirror:focus{box-shadow:none;outline:0}.ccd-rich-text-area .ProseMirror p,.ccd-rich-text-area .ProseMirror ul,.ccd-rich-text-area .ProseMirror ol{margin-top:0;overflow-wrap:anywhere;word-break:normal}.ccd-rich-text-area .ProseMirror ul{list-style:disc outside;padding-left:25px}.ccd-rich-text-area .ProseMirror ol{list-style:decimal outside;padding-left:25px}.ccd-rich-text-area .ProseMirror li{display:list-item;margin-bottom:5px}.ccd-rich-text-area .ProseMirror li>p{margin:0}\n"] }]
|
|
28446
|
+
args: [{ selector: 'ccd-write-rich-text-area-field', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div class=\"form-group ccd-rich-text-area\" [ngClass]=\"{'form-group-error': !richTextAreaControl.valid && richTextAreaControl.dirty}\">\n <div [id]=\"labelId()\">\n <span class=\"form-label\" *ngIf=\"caseField.label\">{{caseField | ccdFieldLabel}}</span>\n </div>\n <span [id]=\"hintId()\" class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n <span [id]=\"errorId()\" class=\"error-message\" *ngIf=\"isInvalid()\">\n {{richTextAreaControl.errors | ccdFirstError:caseField.label}}\n </span>\n\n <div\n #editorHost\n class=\"ccd-rich-text-area__editor\"\n [ngClass]=\"{'ccd-rich-text-area__editor--error': isInvalid()}\"\n (click)=\"syncAccessibilityLater()\"\n (keydown)=\"onEditorKeyDown($event)\"\n (keyup)=\"syncAccessibilityLater()\"\n (paste)=\"onPaste($event)\">\n <div\n class=\"ccd-rich-text-area__toolbar\"\n role=\"toolbar\"\n [attr.aria-label]=\"toolbarLabel()\">\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n aria-label=\"Undo\"\n title=\"Undo\"\n aria-keyshortcuts=\"Control+Z\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'undo')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z\"></path>\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n aria-label=\"Redo\"\n title=\"Redo\"\n aria-keyshortcuts=\"Control+Y\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'redo')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z\"></path>\n </svg>\n </button>\n <span class=\"ccd-rich-text-area__toolbar-separator\" aria-hidden=\"true\"></span>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--bold\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('bold')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('bold')\"\n aria-label=\"Bold\"\n title=\"Bold\"\n aria-keyshortcuts=\"Control+B\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'bold')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5S13.83 9.5 13 9.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z\"></path>\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--italic\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('italic')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('italic')\"\n aria-label=\"Italic\"\n title=\"Italic\"\n aria-keyshortcuts=\"Control+I\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'italic')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z\"></path>\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--underline\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('underline')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('underline')\"\n aria-label=\"Underline\"\n title=\"Underline\"\n aria-keyshortcuts=\"Control+U\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'underline')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z\"></path>\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--paragraph\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('paragraph')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('paragraph')\"\n aria-label=\"Paragraph\"\n title=\"Paragraph\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'paragraph')\">\n <span class=\"ccd-rich-text-area__toolbar-icon ccd-rich-text-area__toolbar-icon--paragraph\" aria-hidden=\"true\">P</span>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button ccd-rich-text-area__toolbar-button--heading\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('heading')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('heading')\"\n aria-label=\"Heading level 1\"\n title=\"Heading level 1\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'heading')\">\n <span class=\"ccd-rich-text-area__toolbar-icon ccd-rich-text-area__toolbar-icon--heading\" aria-hidden=\"true\">H</span>\n </button>\n <span class=\"ccd-rich-text-area__toolbar-separator\" aria-hidden=\"true\"></span>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isToolbarCommandActive('bullet_list')}\"\n [attr.aria-pressed]=\"isToolbarCommandActive('bullet_list')\"\n aria-label=\"Bullet List\"\n title=\"Bullet List\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'bullet_list')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6C3.17 4.5 2.5 5.17 2.5 6S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zM7 13h14v-2H7v2zm0 6h14v-2H7v2zM7 5v2h14V5H7z\"></path>\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n [ngClass]=\"{'ccd-rich-text-area__toolbar-button--active': isOrderedListActive()}\"\n [attr.aria-pressed]=\"isOrderedListActive()\"\n aria-label=\"Numbered List\"\n title=\"Numbered List\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'ordered_list')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1V14h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z\"></path>\n </svg>\n </button>\n <div class=\"ccd-rich-text-area__list-style\">\n <label class=\"ccd-rich-text-area__list-style-label\" [for]=\"listStyleId()\">List style</label>\n <select\n class=\"ccd-rich-text-area__list-style-select\"\n [id]=\"listStyleId()\"\n [value]=\"currentListSelectValue()\"\n (change)=\"onListStyleChange($event)\">\n <option *ngIf=\"!isOrderedListActive()\" value=\"\">No list</option>\n <option value=\"ordered_list\">Numbers (1, 2, 3)</option>\n <option value=\"ordered_alpha\">Letters (a, b, c)</option>\n <option value=\"ordered_roman\">Roman numerals (i), (ii), (iii)</option>\n </select>\n </div>\n <span class=\"ccd-rich-text-area__toolbar-separator\" aria-hidden=\"true\"></span>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n aria-label=\"Decrease Indent\"\n title=\"Decrease Indent\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'outdent')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M11 17h10v-2H11v2zm-8-5 4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z\"></path>\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"ccd-rich-text-area__toolbar-button\"\n aria-label=\"Increase Indent\"\n title=\"Increase Indent\"\n (mousedown)=\"onToolbarButtonMouseDown($event)\"\n (click)=\"executeToolbarCommand($event, 'indent')\">\n <svg class=\"ccd-rich-text-area__toolbar-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z\"></path>\n </svg>\n </button>\n </div>\n\n <div class=\"NgxEditor__Wrapper\">\n <ngx-editor\n [editor]=\"editor\"\n [formControl]=\"richTextAreaControl\"\n outputFormat=\"html\"\n (focusIn)=\"syncAccessibilityLater()\"\n (focusOut)=\"onEditorFocusOut()\">\n </ngx-editor>\n </div>\n </div>\n</div>\n", styles: [".ccd-rich-text-area{margin-bottom:30px}.ccd-rich-text-area__editor{max-width:100%}.ccd-rich-text-area__toolbar{align-items:center;background:#fff;border:1px solid #d8dde0;border-radius:6px;display:flex;flex-wrap:wrap;gap:2px;margin-bottom:10px;padding:6px 8px;width:fit-content}.ccd-rich-text-area .NgxEditor__Wrapper{border:1px solid #000;border-radius:0;box-sizing:border-box;height:255px;max-width:100%;min-height:255px;min-width:200px;overflow:hidden;resize:both;width:100%}.ccd-rich-text-area .NgxEditor__Wrapper:focus-within{outline:3px solid #ffdd00;outline-offset:0}.ccd-rich-text-area__toolbar-button{background:#fff;align-items:center;border:0;border-radius:2px;color:#0b0c0c;display:inline-flex;font-family:inherit;font-size:18px;font-weight:700;height:28px;justify-content:center;min-width:28px;padding:4px;width:28px}.ccd-rich-text-area__toolbar-button:hover{background:#f3f2f1}.ccd-rich-text-area__toolbar-button:focus{background:#fd0;box-shadow:0 0 0 2px #0b0c0c;outline:2px solid #ffdd00;outline-offset:0}.ccd-rich-text-area__toolbar-button--active,.ccd-rich-text-area__toolbar-button--active:hover{background:#1d70b8;color:#fff}.ccd-rich-text-area__toolbar-button--italic{font-style:italic}.ccd-rich-text-area__toolbar-button--underline{text-decoration:underline}.ccd-rich-text-area__toolbar-separator{border-left:1px solid #b1b4b6;height:24px;margin:0 5px 0 3px}.ccd-rich-text-area__list-style{align-items:center;display:inline-flex;gap:8px;margin:0 4px}.ccd-rich-text-area__list-style-label{font-weight:700;white-space:nowrap}.ccd-rich-text-area__list-style-select{background-color:#fff;border:1px solid #0b0c0c;border-radius:0;color:#0b0c0c;font-family:inherit;font-size:16px;height:32px;min-width:190px;padding:2px 28px 2px 8px}.ccd-rich-text-area__list-style-select:focus{box-shadow:0 0 0 2px #0b0c0c;outline:3px solid #ffdd00;outline-offset:0}.ccd-rich-text-area__toolbar-icon{display:block;fill:currentColor;height:20px;width:20px}.ccd-rich-text-area__toolbar-icon--paragraph{display:inline-flex;font-size:18px;line-height:1;width:auto}.ccd-rich-text-area__toolbar-icon--heading{display:inline-flex;font-size:18px;font-weight:700;line-height:1;width:auto}.ccd-rich-text-area .ProseMirror h1{font-size:20px;font-weight:700}.ccd-rich-text-area .NgxEditor__Wrapper .NgxEditor{border:0;border-radius:0;height:100%;min-height:0;overflow:hidden;width:100%}.ccd-rich-text-area__editor--error .NgxEditor__Wrapper{border-color:#d4351c}.ccd-rich-text-area .NgxEditor__Content{box-sizing:border-box;height:100%;min-height:0;overflow-x:hidden;overflow-y:auto;padding:12px 14px}.ccd-rich-text-area .ProseMirror{min-height:231px;outline:0;overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal}.ccd-rich-text-area .ProseMirror [data-indent=\"1\"]{margin-left:40px}.ccd-rich-text-area .ProseMirror [data-indent=\"2\"]{margin-left:80px}.ccd-rich-text-area .ProseMirror [data-indent=\"3\"]{margin-left:120px}.ccd-rich-text-area .ProseMirror [data-indent=\"4\"]{margin-left:160px}.ccd-rich-text-area .ProseMirror [data-indent=\"5\"]{margin-left:200px}.ccd-rich-text-area .ProseMirror [data-indent=\"6\"]{margin-left:240px}.ccd-rich-text-area .ProseMirror strong,.ccd-rich-text-area .ProseMirror strong *,.ccd-rich-text-area .ProseMirror b,.ccd-rich-text-area .ProseMirror b *{font-weight:700}.ccd-rich-text-area .ProseMirror strong u,.ccd-rich-text-area .ProseMirror u strong,.ccd-rich-text-area .ProseMirror b u,.ccd-rich-text-area .ProseMirror u b{font-weight:700!important;text-decoration:underline}.ccd-rich-text-area .ProseMirror:focus{box-shadow:none;outline:0}.ccd-rich-text-area .ProseMirror p,.ccd-rich-text-area .ProseMirror ul,.ccd-rich-text-area .ProseMirror ol{margin-top:0;overflow-wrap:anywhere;word-break:normal}.ccd-rich-text-area .ProseMirror p{margin-bottom:5px}.ccd-rich-text-area .ProseMirror ul{list-style:disc outside;padding-left:25px}.ccd-rich-text-area .ProseMirror ol{list-style:decimal outside;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"1\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"1\"]{margin-left:40px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"2\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"2\"]{margin-left:80px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"3\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"3\"]{margin-left:120px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"4\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"4\"]{margin-left:160px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"5\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"5\"]{margin-left:200px;padding-left:25px}.ccd-rich-text-area .ProseMirror ul[data-indent=\"6\"],.ccd-rich-text-area .ProseMirror ol[data-indent=\"6\"]{margin-left:240px;padding-left:25px}.ccd-rich-text-area .ProseMirror ol[type=a]{list-style-type:lower-alpha}.ccd-rich-text-area .ProseMirror ol[type=i]{list-style-type:lower-roman}.ccd-rich-text-area .ProseMirror ol[type=i]>li::marker{content:\"(\" counter(list-item,lower-roman) \") \"}.ccd-rich-text-area .ProseMirror li{display:list-item;margin-bottom:5px}.ccd-rich-text-area .ProseMirror li>p{margin:0}.ccd-rich-text-area .ProseMirror li>ul,.ccd-rich-text-area .ProseMirror li>ol{margin-top:5px}\n"] }]
|
|
27315
28447
|
}], null, { editorHost: [{
|
|
27316
28448
|
type: ViewChild,
|
|
27317
28449
|
args: ['editorHost']
|
|
27318
28450
|
}] }); })();
|
|
27319
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WriteRichTextAreaFieldComponent, { className: "WriteRichTextAreaFieldComponent", filePath: "lib/shared/components/palette/rich-text-area/write-rich-text-area-field.component.ts", lineNumber:
|
|
28451
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WriteRichTextAreaFieldComponent, { className: "WriteRichTextAreaFieldComponent", filePath: "lib/shared/components/palette/rich-text-area/write-rich-text-area-field.component.ts", lineNumber: 128 }); })();
|
|
27320
28452
|
|
|
27321
28453
|
class ReadTextFieldComponent extends AbstractFieldReadComponent {
|
|
27322
28454
|
static ɵfac = /*@__PURE__*/ (() => { let ɵReadTextFieldComponent_BaseFactory; return function ReadTextFieldComponent_Factory(__ngFactoryType__) { return (ɵReadTextFieldComponent_BaseFactory || (ɵReadTextFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadTextFieldComponent)))(__ngFactoryType__ || ReadTextFieldComponent); }; })();
|