@hmcts/ccd-case-ui-toolkit 7.3.91 → 7.3.92
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 +1252 -163
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/index.d.ts +60 -1
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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';
|
|
@@ -25910,6 +25910,9 @@ function sanitiseRichTextDocument(documentElement) {
|
|
|
25910
25910
|
const listStart = tagName === 'ol' && /^\d{1,6}$/.test(element.getAttribute('start') || '')
|
|
25911
25911
|
? element.getAttribute('start')
|
|
25912
25912
|
: null;
|
|
25913
|
+
const listType = tagName === 'ol' && /^[ai]$/.test(element.getAttribute('type') || '')
|
|
25914
|
+
? element.getAttribute('type')
|
|
25915
|
+
: null;
|
|
25913
25916
|
while (element.attributes.length > 0) {
|
|
25914
25917
|
element.removeAttribute(element.attributes[0].name);
|
|
25915
25918
|
}
|
|
@@ -25922,6 +25925,9 @@ function sanitiseRichTextDocument(documentElement) {
|
|
|
25922
25925
|
if (listStart) {
|
|
25923
25926
|
element.setAttribute('start', listStart);
|
|
25924
25927
|
}
|
|
25928
|
+
if (listType) {
|
|
25929
|
+
element.setAttribute('type', listType);
|
|
25930
|
+
}
|
|
25925
25931
|
});
|
|
25926
25932
|
return documentElement.body.innerHTML;
|
|
25927
25933
|
}
|
|
@@ -25952,11 +25958,11 @@ class ReadRichTextAreaFieldComponent extends AbstractFieldReadComponent {
|
|
|
25952
25958
|
i0.ɵɵelement(0, "div", 0);
|
|
25953
25959
|
} if (rf & 2) {
|
|
25954
25960
|
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 });
|
|
25961
|
+
} }, 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
25962
|
}
|
|
25957
25963
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadRichTextAreaFieldComponent, [{
|
|
25958
25964
|
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"] }]
|
|
25965
|
+
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
25966
|
}], () => [{ type: i1$5.DomSanitizer }], null); })();
|
|
25961
25967
|
(() => { (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
25968
|
|
|
@@ -25965,7 +25971,7 @@ const _c1$e = a0 => ({ "form-group-error": a0 });
|
|
|
25965
25971
|
const _c2$3 = a0 => ({ "ccd-rich-text-area__editor--error": a0 });
|
|
25966
25972
|
const _c3 = a0 => ({ "ccd-rich-text-area__toolbar-button--active": a0 });
|
|
25967
25973
|
function WriteRichTextAreaFieldComponent_span_2_Template(rf, ctx) { if (rf & 1) {
|
|
25968
|
-
i0.ɵɵelementStart(0, "span",
|
|
25974
|
+
i0.ɵɵelementStart(0, "span", 41);
|
|
25969
25975
|
i0.ɵɵtext(1);
|
|
25970
25976
|
i0.ɵɵpipe(2, "ccdFieldLabel");
|
|
25971
25977
|
i0.ɵɵelementEnd();
|
|
@@ -25975,7 +25981,7 @@ function WriteRichTextAreaFieldComponent_span_2_Template(rf, ctx) { if (rf & 1)
|
|
|
25975
25981
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r1.caseField));
|
|
25976
25982
|
} }
|
|
25977
25983
|
function WriteRichTextAreaFieldComponent_span_3_Template(rf, ctx) { if (rf & 1) {
|
|
25978
|
-
i0.ɵɵelementStart(0, "span",
|
|
25984
|
+
i0.ɵɵelementStart(0, "span", 42);
|
|
25979
25985
|
i0.ɵɵtext(1);
|
|
25980
25986
|
i0.ɵɵpipe(2, "rpxTranslate");
|
|
25981
25987
|
i0.ɵɵelementEnd();
|
|
@@ -25986,7 +25992,7 @@ function WriteRichTextAreaFieldComponent_span_3_Template(rf, ctx) { if (rf & 1)
|
|
|
25986
25992
|
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 2, ctx_r1.caseField.hint_text));
|
|
25987
25993
|
} }
|
|
25988
25994
|
function WriteRichTextAreaFieldComponent_span_4_Template(rf, ctx) { if (rf & 1) {
|
|
25989
|
-
i0.ɵɵelementStart(0, "span",
|
|
25995
|
+
i0.ɵɵelementStart(0, "span", 43);
|
|
25990
25996
|
i0.ɵɵtext(1);
|
|
25991
25997
|
i0.ɵɵpipe(2, "ccdFirstError");
|
|
25992
25998
|
i0.ɵɵelementEnd();
|
|
@@ -25996,6 +26002,29 @@ function WriteRichTextAreaFieldComponent_span_4_Template(rf, ctx) { if (rf & 1)
|
|
|
25996
26002
|
i0.ɵɵadvance();
|
|
25997
26003
|
i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind2(2, 2, ctx_r1.richTextAreaControl.errors, ctx_r1.caseField.label), " ");
|
|
25998
26004
|
} }
|
|
26005
|
+
function WriteRichTextAreaFieldComponent_option_41_Template(rf, ctx) { if (rf & 1) {
|
|
26006
|
+
i0.ɵɵelementStart(0, "option", 44);
|
|
26007
|
+
i0.ɵɵtext(1, "No list");
|
|
26008
|
+
i0.ɵɵelementEnd();
|
|
26009
|
+
} }
|
|
26010
|
+
function orderedListStyleForType(type) {
|
|
26011
|
+
if (type === 'a') {
|
|
26012
|
+
return 'lower-alpha';
|
|
26013
|
+
}
|
|
26014
|
+
if (type === 'i') {
|
|
26015
|
+
return 'lower-roman';
|
|
26016
|
+
}
|
|
26017
|
+
return null;
|
|
26018
|
+
}
|
|
26019
|
+
function orderedListTypeForStyle(style) {
|
|
26020
|
+
if (style === 'lower-alpha') {
|
|
26021
|
+
return 'a';
|
|
26022
|
+
}
|
|
26023
|
+
if (style === 'lower-roman') {
|
|
26024
|
+
return 'i';
|
|
26025
|
+
}
|
|
26026
|
+
return null;
|
|
26027
|
+
}
|
|
25999
26028
|
const WORD_COLUMN_SPACING = 12;
|
|
26000
26029
|
const MAX_INDENT = 6;
|
|
26001
26030
|
const CSS_LENGTH_UNITS = ['rem', 'px', 'pt', 'in', 'cm', 'mm', 'em'];
|
|
@@ -26005,11 +26034,16 @@ const BLOCK_NODE_NAMES = new Set([
|
|
|
26005
26034
|
]);
|
|
26006
26035
|
const richTextNodes = {
|
|
26007
26036
|
...nodes,
|
|
26037
|
+
list_item: {
|
|
26038
|
+
...nodes.list_item,
|
|
26039
|
+
content: '(paragraph | heading) block*'
|
|
26040
|
+
},
|
|
26008
26041
|
ordered_list: {
|
|
26009
26042
|
...nodes.ordered_list,
|
|
26010
26043
|
attrs: {
|
|
26011
26044
|
order: { default: 1 },
|
|
26012
|
-
indent: { default: null }
|
|
26045
|
+
indent: { default: null },
|
|
26046
|
+
listStyle: { default: null }
|
|
26013
26047
|
},
|
|
26014
26048
|
parseDOM: [{
|
|
26015
26049
|
tag: 'ol',
|
|
@@ -26017,28 +26051,35 @@ const richTextNodes = {
|
|
|
26017
26051
|
const list = element;
|
|
26018
26052
|
return {
|
|
26019
26053
|
order: list.hasAttribute('start') ? Number(list.getAttribute('start')) : 1,
|
|
26020
|
-
indent: Number(list.
|
|
26054
|
+
indent: Number(list.dataset.indent) || null,
|
|
26055
|
+
listStyle: orderedListStyleForType(list.getAttribute('type'))
|
|
26021
26056
|
};
|
|
26022
26057
|
}
|
|
26023
26058
|
}],
|
|
26024
26059
|
toDOM: (node) => ['ol', {
|
|
26025
26060
|
start: node.attrs.order === 1 ? null : node.attrs.order,
|
|
26026
|
-
'data-indent': node.attrs.indent
|
|
26061
|
+
'data-indent': node.attrs.indent,
|
|
26062
|
+
type: orderedListTypeForStyle(node.attrs.listStyle)
|
|
26027
26063
|
}, 0]
|
|
26028
26064
|
},
|
|
26029
26065
|
bullet_list: {
|
|
26030
26066
|
...nodes.bullet_list,
|
|
26031
26067
|
attrs: {
|
|
26032
|
-
indent: { default: null }
|
|
26068
|
+
indent: { default: null },
|
|
26069
|
+
continuationOrder: { default: null }
|
|
26033
26070
|
},
|
|
26034
26071
|
parseDOM: [{
|
|
26035
26072
|
tag: 'ul',
|
|
26036
26073
|
getAttrs: (element) => {
|
|
26037
26074
|
const list = element;
|
|
26038
|
-
return {
|
|
26075
|
+
return {
|
|
26076
|
+
indent: Number(list.dataset.indent) || null
|
|
26077
|
+
};
|
|
26039
26078
|
}
|
|
26040
26079
|
}],
|
|
26041
|
-
toDOM: (node) => ['ul', {
|
|
26080
|
+
toDOM: (node) => ['ul', {
|
|
26081
|
+
'data-indent': node.attrs.indent
|
|
26082
|
+
}, 0]
|
|
26042
26083
|
}
|
|
26043
26084
|
};
|
|
26044
26085
|
const richTextSchema = new Schema({ nodes: richTextNodes, marks: marks });
|
|
@@ -26064,7 +26105,10 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26064
26105
|
plugins: [
|
|
26065
26106
|
new Plugin({
|
|
26066
26107
|
props: {
|
|
26067
|
-
handlePaste: (_view, event) => this.handleEditorPaste(event)
|
|
26108
|
+
handlePaste: (_view, event) => this.handleEditorPaste(event),
|
|
26109
|
+
handleDOMEvents: {
|
|
26110
|
+
keydown: (_view, event) => this.handleEditorKeyDown(event)
|
|
26111
|
+
}
|
|
26068
26112
|
}
|
|
26069
26113
|
})
|
|
26070
26114
|
],
|
|
@@ -26111,6 +26155,9 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26111
26155
|
errorId() {
|
|
26112
26156
|
return `${this.id()}_error`;
|
|
26113
26157
|
}
|
|
26158
|
+
listStyleId() {
|
|
26159
|
+
return `${this.id()}_list_style`;
|
|
26160
|
+
}
|
|
26114
26161
|
toolbarLabel() {
|
|
26115
26162
|
return `${this.caseField.label || this.caseField.id} formatting options`;
|
|
26116
26163
|
}
|
|
@@ -26124,6 +26171,53 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26124
26171
|
onToolbarButtonMouseDown(event) {
|
|
26125
26172
|
event.preventDefault();
|
|
26126
26173
|
}
|
|
26174
|
+
handleEditorKeyDown(event) {
|
|
26175
|
+
const isUnmodifiedEnter = event.key === 'Enter' &&
|
|
26176
|
+
!event.shiftKey &&
|
|
26177
|
+
!event.altKey &&
|
|
26178
|
+
!event.ctrlKey &&
|
|
26179
|
+
!event.metaKey;
|
|
26180
|
+
if (isUnmodifiedEnter && this.splitListContinuationParagraph()) {
|
|
26181
|
+
event.preventDefault();
|
|
26182
|
+
event.stopPropagation();
|
|
26183
|
+
return true;
|
|
26184
|
+
}
|
|
26185
|
+
if (event.key !== 'Tab' || !this.isNodeActive('list_item')) {
|
|
26186
|
+
return false;
|
|
26187
|
+
}
|
|
26188
|
+
this.executeToolbarCommand(event, event.shiftKey ? 'outdent' : 'indent');
|
|
26189
|
+
return true;
|
|
26190
|
+
}
|
|
26191
|
+
splitListContinuationParagraph() {
|
|
26192
|
+
const { state, dispatch } = this.editor.view;
|
|
26193
|
+
const { $from, empty } = state.selection;
|
|
26194
|
+
const textBlock = $from.parent;
|
|
26195
|
+
if (!empty || !textBlock.isTextblock) {
|
|
26196
|
+
return false;
|
|
26197
|
+
}
|
|
26198
|
+
let isContinuation = false;
|
|
26199
|
+
for (let depth = $from.depth - 1; depth > 0; depth--) {
|
|
26200
|
+
const node = $from.node(depth);
|
|
26201
|
+
if (node.type.name !== 'list_item') {
|
|
26202
|
+
continue;
|
|
26203
|
+
}
|
|
26204
|
+
isContinuation = depth < $from.depth &&
|
|
26205
|
+
$from.node(depth + 1) === textBlock &&
|
|
26206
|
+
node.firstChild !== textBlock;
|
|
26207
|
+
break;
|
|
26208
|
+
}
|
|
26209
|
+
if (!isContinuation) {
|
|
26210
|
+
return false;
|
|
26211
|
+
}
|
|
26212
|
+
const textBlockStart = $from.before($from.depth);
|
|
26213
|
+
const before = textBlock.type.create(textBlock.attrs, textBlock.content.cut(0, $from.parentOffset), textBlock.marks);
|
|
26214
|
+
const after = textBlock.type.create(textBlock.attrs, textBlock.content.cut($from.parentOffset), textBlock.marks);
|
|
26215
|
+
const transaction = state.tr.replaceWith(textBlockStart, $from.after($from.depth), Fragment.fromArray([before, after]));
|
|
26216
|
+
transaction.setSelection(TextSelection.create(transaction.doc, textBlockStart + before.nodeSize + 1));
|
|
26217
|
+
transaction.setStoredMarks(state.storedMarks || $from.marks());
|
|
26218
|
+
dispatch(transaction.scrollIntoView());
|
|
26219
|
+
return true;
|
|
26220
|
+
}
|
|
26127
26221
|
executeToolbarCommand(event, command) {
|
|
26128
26222
|
event.preventDefault();
|
|
26129
26223
|
event.stopPropagation();
|
|
@@ -26146,6 +26240,9 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26146
26240
|
case 'paragraph':
|
|
26147
26241
|
this.toggleParagraph();
|
|
26148
26242
|
break;
|
|
26243
|
+
case 'heading':
|
|
26244
|
+
this.toggleHeading();
|
|
26245
|
+
break;
|
|
26149
26246
|
case 'indent':
|
|
26150
26247
|
this.changeIndent(true);
|
|
26151
26248
|
break;
|
|
@@ -26153,11 +26250,10 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26153
26250
|
this.changeIndent(false);
|
|
26154
26251
|
break;
|
|
26155
26252
|
case 'ordered_list':
|
|
26156
|
-
this.
|
|
26157
|
-
this.paragraphCommandApplied = false;
|
|
26253
|
+
this.toggleOrderedList();
|
|
26158
26254
|
break;
|
|
26159
26255
|
case 'bullet_list':
|
|
26160
|
-
this.
|
|
26256
|
+
this.toggleBulletList();
|
|
26161
26257
|
this.paragraphCommandApplied = false;
|
|
26162
26258
|
break;
|
|
26163
26259
|
default:
|
|
@@ -26171,6 +26267,424 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26171
26267
|
isToolbarCommandActive(command) {
|
|
26172
26268
|
return !!this.activeToolbarCommands[command];
|
|
26173
26269
|
}
|
|
26270
|
+
currentListStyle() {
|
|
26271
|
+
const activeList = this.activeListNode();
|
|
26272
|
+
if (activeList?.type.name === 'ordered_list') {
|
|
26273
|
+
const orderedListStyle = activeList.attrs.listStyle || 'decimal';
|
|
26274
|
+
if (orderedListStyle === 'lower-alpha') {
|
|
26275
|
+
return 'ordered_alpha';
|
|
26276
|
+
}
|
|
26277
|
+
if (orderedListStyle === 'lower-roman') {
|
|
26278
|
+
return 'ordered_roman';
|
|
26279
|
+
}
|
|
26280
|
+
return 'ordered_list';
|
|
26281
|
+
}
|
|
26282
|
+
if (activeList?.type.name === 'bullet_list') {
|
|
26283
|
+
return 'bullet_list';
|
|
26284
|
+
}
|
|
26285
|
+
return '';
|
|
26286
|
+
}
|
|
26287
|
+
currentListSelectValue() {
|
|
26288
|
+
const currentListStyle = this.currentListStyle();
|
|
26289
|
+
return currentListStyle === 'bullet_list' ? '' : currentListStyle;
|
|
26290
|
+
}
|
|
26291
|
+
isOrderedListActive() {
|
|
26292
|
+
return this.listType(this.currentListStyle()) === 'ordered_list';
|
|
26293
|
+
}
|
|
26294
|
+
onListStyleChange(event) {
|
|
26295
|
+
const select = event.target;
|
|
26296
|
+
const listStyle = select.value;
|
|
26297
|
+
if (!listStyle) {
|
|
26298
|
+
select.value = this.currentListSelectValue();
|
|
26299
|
+
return;
|
|
26300
|
+
}
|
|
26301
|
+
this.applyListStyleSelection(listStyle);
|
|
26302
|
+
this.richTextAreaControl.markAsDirty();
|
|
26303
|
+
this.editor.view.focus();
|
|
26304
|
+
this.updateToolbarState();
|
|
26305
|
+
this.syncAccessibilityLater();
|
|
26306
|
+
}
|
|
26307
|
+
applyListStyleSelection(listStyle) {
|
|
26308
|
+
const currentListStyle = this.currentListStyle();
|
|
26309
|
+
if (listStyle === currentListStyle) {
|
|
26310
|
+
if (listStyle === 'ordered_list') {
|
|
26311
|
+
this.changeActiveListType('ordered_list', 'decimal');
|
|
26312
|
+
}
|
|
26313
|
+
return;
|
|
26314
|
+
}
|
|
26315
|
+
const currentListType = this.listType(currentListStyle);
|
|
26316
|
+
const nextListType = this.listType(listStyle);
|
|
26317
|
+
if (currentListType && nextListType && currentListType !== nextListType) {
|
|
26318
|
+
this.changeActiveListType(nextListType, this.orderedListStyle(listStyle));
|
|
26319
|
+
}
|
|
26320
|
+
else if (nextListType === 'ordered_list') {
|
|
26321
|
+
if (currentListType !== 'ordered_list') {
|
|
26322
|
+
const rebuiltIndentedList = this.rebuildSelectedIndentedBlocksAsList('ordered_list', this.orderedListStyle(listStyle));
|
|
26323
|
+
if (!rebuiltIndentedList) {
|
|
26324
|
+
this.editor.commands.toggleOrderedList().exec();
|
|
26325
|
+
}
|
|
26326
|
+
}
|
|
26327
|
+
this.applyOrderedListStyle(this.orderedListStyle(listStyle));
|
|
26328
|
+
}
|
|
26329
|
+
else if (listStyle === 'bullet_list') {
|
|
26330
|
+
if (currentListType !== 'bullet_list') {
|
|
26331
|
+
this.editor.commands.toggleBulletList().exec();
|
|
26332
|
+
}
|
|
26333
|
+
}
|
|
26334
|
+
else {
|
|
26335
|
+
this.applyParagraph();
|
|
26336
|
+
this.paragraphCommandApplied = true;
|
|
26337
|
+
}
|
|
26338
|
+
}
|
|
26339
|
+
changeActiveListType(listType, orderedListStyle) {
|
|
26340
|
+
const { state, dispatch } = this.editor.view;
|
|
26341
|
+
const { $from } = state.selection;
|
|
26342
|
+
const targetType = state.schema.nodes[listType];
|
|
26343
|
+
if (this.changeFullySelectedListHierarchy(listType, orderedListStyle)) {
|
|
26344
|
+
return;
|
|
26345
|
+
}
|
|
26346
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26347
|
+
const node = $from.node(depth);
|
|
26348
|
+
if (node.type.name !== 'ordered_list' && node.type.name !== 'bullet_list') {
|
|
26349
|
+
continue;
|
|
26350
|
+
}
|
|
26351
|
+
const transaction = state.tr;
|
|
26352
|
+
let nextOrder = 1;
|
|
26353
|
+
this.contiguousListPositions(depth, listType).forEach(({ position, list }) => {
|
|
26354
|
+
const indent = Number(list.attrs.indent) || null;
|
|
26355
|
+
const attrs = listType === 'ordered_list'
|
|
26356
|
+
? {
|
|
26357
|
+
order: nextOrder,
|
|
26358
|
+
indent,
|
|
26359
|
+
listStyle: orderedListStyle === 'decimal' ? null : orderedListStyle
|
|
26360
|
+
}
|
|
26361
|
+
: {
|
|
26362
|
+
indent,
|
|
26363
|
+
continuationOrder: Number(list.attrs.order) || null
|
|
26364
|
+
};
|
|
26365
|
+
transaction.setNodeMarkup(position, targetType, attrs);
|
|
26366
|
+
nextOrder += list.childCount;
|
|
26367
|
+
});
|
|
26368
|
+
dispatch(transaction);
|
|
26369
|
+
return;
|
|
26370
|
+
}
|
|
26371
|
+
}
|
|
26372
|
+
changeFullySelectedListHierarchy(listType, rootStyle) {
|
|
26373
|
+
const { state, dispatch } = this.editor.view;
|
|
26374
|
+
const { $from, $to, empty, from, to } = state.selection;
|
|
26375
|
+
const targetListType = state.schema.nodes[listType];
|
|
26376
|
+
if (empty || !targetListType) {
|
|
26377
|
+
return false;
|
|
26378
|
+
}
|
|
26379
|
+
for (let depth = 1; depth <= $from.depth; depth++) {
|
|
26380
|
+
const list = $from.node(depth);
|
|
26381
|
+
if (!this.isListNode(list) || $to.depth < depth || $to.node(depth) !== list ||
|
|
26382
|
+
$from.index(depth) !== 0 || $to.indexAfter(depth) !== list.childCount) {
|
|
26383
|
+
continue;
|
|
26384
|
+
}
|
|
26385
|
+
const listPosition = $from.before(depth);
|
|
26386
|
+
if (!this.selectionCoversListContent(list, listPosition, from, to)) {
|
|
26387
|
+
continue;
|
|
26388
|
+
}
|
|
26389
|
+
const transaction = state.tr;
|
|
26390
|
+
const changeListHierarchy = (node, position, listDepth) => {
|
|
26391
|
+
const orderedStyle = this.orderedListStyleAtDepth(rootStyle, listDepth);
|
|
26392
|
+
const indent = Number(node.attrs.indent) || null;
|
|
26393
|
+
const attrs = listType === 'ordered_list'
|
|
26394
|
+
? {
|
|
26395
|
+
order: 1,
|
|
26396
|
+
indent,
|
|
26397
|
+
listStyle: orderedStyle === 'decimal' ? null : orderedStyle
|
|
26398
|
+
}
|
|
26399
|
+
: {
|
|
26400
|
+
indent,
|
|
26401
|
+
continuationOrder: Number(node.attrs.order) || null
|
|
26402
|
+
};
|
|
26403
|
+
transaction.setNodeMarkup(position, targetListType, attrs);
|
|
26404
|
+
node.forEach((child, childOffset) => {
|
|
26405
|
+
const childPosition = position + 1 + childOffset;
|
|
26406
|
+
if (this.isListNode(child)) {
|
|
26407
|
+
changeListHierarchy(child, childPosition, listDepth + 1);
|
|
26408
|
+
return;
|
|
26409
|
+
}
|
|
26410
|
+
child.descendants((descendant, descendantOffset) => {
|
|
26411
|
+
if (!this.isListNode(descendant)) {
|
|
26412
|
+
return true;
|
|
26413
|
+
}
|
|
26414
|
+
changeListHierarchy(descendant, childPosition + descendantOffset + 1, listDepth + 1);
|
|
26415
|
+
return false;
|
|
26416
|
+
});
|
|
26417
|
+
});
|
|
26418
|
+
};
|
|
26419
|
+
changeListHierarchy(list, listPosition, 0);
|
|
26420
|
+
dispatch(transaction.scrollIntoView());
|
|
26421
|
+
return true;
|
|
26422
|
+
}
|
|
26423
|
+
return false;
|
|
26424
|
+
}
|
|
26425
|
+
contiguousListPositions(depth, targetListType) {
|
|
26426
|
+
const { $from } = this.editor.view.state.selection;
|
|
26427
|
+
const parentDepth = depth - 1;
|
|
26428
|
+
const parent = $from.node(parentDepth);
|
|
26429
|
+
const activeList = $from.node(depth);
|
|
26430
|
+
const activeIndex = $from.index(parentDepth);
|
|
26431
|
+
const includedIndexes = new Set([activeIndex]);
|
|
26432
|
+
this.collectContiguousListIndexes(parent, activeList, activeIndex, -1, targetListType, includedIndexes);
|
|
26433
|
+
this.collectContiguousListIndexes(parent, activeList, activeIndex, 1, targetListType, includedIndexes);
|
|
26434
|
+
const positions = [];
|
|
26435
|
+
parent.forEach((child, childOffset, index) => {
|
|
26436
|
+
if (includedIndexes.has(index) && this.isList(child)) {
|
|
26437
|
+
positions.push({ position: $from.start(parentDepth) + childOffset, list: child });
|
|
26438
|
+
}
|
|
26439
|
+
});
|
|
26440
|
+
return positions;
|
|
26441
|
+
}
|
|
26442
|
+
collectContiguousListIndexes(parent, activeList, activeIndex, direction, targetListType, includedIndexes) {
|
|
26443
|
+
let adjacentList = activeList;
|
|
26444
|
+
let crossedContent = false;
|
|
26445
|
+
let crossedSectionHeading = false;
|
|
26446
|
+
for (let index = activeIndex + direction; index >= 0 && index < parent.childCount; index += direction) {
|
|
26447
|
+
const child = parent.child(index);
|
|
26448
|
+
if (this.isEmptyParagraph(child)) {
|
|
26449
|
+
continue;
|
|
26450
|
+
}
|
|
26451
|
+
const matchesActiveList = this.hasMatchingListType(child, activeList);
|
|
26452
|
+
const isMixedListToRepair = crossedSectionHeading && this.isList(child) &&
|
|
26453
|
+
child.type.name !== activeList.type.name && targetListType === activeList.type.name;
|
|
26454
|
+
if (matchesActiveList || isMixedListToRepair) {
|
|
26455
|
+
const isHeadingSeparatedBulletList = activeList.type.name === 'bullet_list';
|
|
26456
|
+
if (matchesActiveList && crossedContent && !isHeadingSeparatedBulletList &&
|
|
26457
|
+
!this.isSequentialList(child, adjacentList, direction)) {
|
|
26458
|
+
return;
|
|
26459
|
+
}
|
|
26460
|
+
includedIndexes.add(index);
|
|
26461
|
+
adjacentList = child;
|
|
26462
|
+
crossedContent = false;
|
|
26463
|
+
crossedSectionHeading = false;
|
|
26464
|
+
continue;
|
|
26465
|
+
}
|
|
26466
|
+
if (this.isList(child)) {
|
|
26467
|
+
return;
|
|
26468
|
+
}
|
|
26469
|
+
if (activeList.type.name === 'bullet_list') {
|
|
26470
|
+
if (!this.isListSectionHeading(child)) {
|
|
26471
|
+
return;
|
|
26472
|
+
}
|
|
26473
|
+
}
|
|
26474
|
+
else if (!this.hasListContinuation(activeList)) {
|
|
26475
|
+
return;
|
|
26476
|
+
}
|
|
26477
|
+
crossedContent = true;
|
|
26478
|
+
crossedSectionHeading = crossedSectionHeading || this.isListSectionHeading(child);
|
|
26479
|
+
}
|
|
26480
|
+
}
|
|
26481
|
+
isSequentialList(candidateList, adjacentList, direction) {
|
|
26482
|
+
const candidateOrder = this.listContinuationOrder(candidateList);
|
|
26483
|
+
const adjacentOrder = this.listContinuationOrder(adjacentList);
|
|
26484
|
+
if (!candidateOrder || !adjacentOrder) {
|
|
26485
|
+
return false;
|
|
26486
|
+
}
|
|
26487
|
+
return direction === 1
|
|
26488
|
+
? candidateOrder === adjacentOrder + adjacentList.childCount
|
|
26489
|
+
: candidateOrder + candidateList.childCount === adjacentOrder;
|
|
26490
|
+
}
|
|
26491
|
+
hasListContinuation(list) {
|
|
26492
|
+
return list.type.name === 'ordered_list' || Boolean(list.attrs.continuationOrder);
|
|
26493
|
+
}
|
|
26494
|
+
listContinuationOrder(list) {
|
|
26495
|
+
return Number(list.type.name === 'ordered_list' ? list.attrs.order : list.attrs.continuationOrder) || null;
|
|
26496
|
+
}
|
|
26497
|
+
isList(node) {
|
|
26498
|
+
return node.type.name === 'ordered_list' || node.type.name === 'bullet_list';
|
|
26499
|
+
}
|
|
26500
|
+
hasMatchingListType(node, activeList) {
|
|
26501
|
+
if (node.type !== activeList.type) {
|
|
26502
|
+
return false;
|
|
26503
|
+
}
|
|
26504
|
+
return node.type.name !== 'ordered_list' ||
|
|
26505
|
+
(node.attrs.listStyle || 'decimal') === (activeList.attrs.listStyle || 'decimal');
|
|
26506
|
+
}
|
|
26507
|
+
isEmptyParagraph(node) {
|
|
26508
|
+
return node.type.name === 'paragraph' && !node.textContent.trim();
|
|
26509
|
+
}
|
|
26510
|
+
isListSectionHeading(node) {
|
|
26511
|
+
if (!node.textContent.trim()) {
|
|
26512
|
+
return false;
|
|
26513
|
+
}
|
|
26514
|
+
if (node.type.name === 'heading') {
|
|
26515
|
+
return true;
|
|
26516
|
+
}
|
|
26517
|
+
if (node.type.name !== 'paragraph') {
|
|
26518
|
+
return false;
|
|
26519
|
+
}
|
|
26520
|
+
let hasText = false;
|
|
26521
|
+
let allTextIsBold = true;
|
|
26522
|
+
node.descendants((child) => {
|
|
26523
|
+
if (child.isText && child.textContent.trim()) {
|
|
26524
|
+
hasText = true;
|
|
26525
|
+
allTextIsBold = allTextIsBold && child.marks.some((mark) => mark.type.name === 'strong');
|
|
26526
|
+
}
|
|
26527
|
+
});
|
|
26528
|
+
return hasText && allTextIsBold;
|
|
26529
|
+
}
|
|
26530
|
+
toggleBulletList() {
|
|
26531
|
+
const currentListStyle = this.currentListStyle();
|
|
26532
|
+
const currentListType = this.listType(currentListStyle);
|
|
26533
|
+
if (currentListType === 'ordered_list') {
|
|
26534
|
+
this.changeActiveListType('bullet_list', 'decimal');
|
|
26535
|
+
return;
|
|
26536
|
+
}
|
|
26537
|
+
if (currentListType === 'bullet_list') {
|
|
26538
|
+
this.applyParagraph();
|
|
26539
|
+
this.paragraphCommandApplied = false;
|
|
26540
|
+
return;
|
|
26541
|
+
}
|
|
26542
|
+
if (!this.rebuildSelectedIndentedBlocksAsList('bullet_list', 'decimal')) {
|
|
26543
|
+
this.editor.commands.toggleBulletList().exec();
|
|
26544
|
+
}
|
|
26545
|
+
this.joinAdjacentLists('bullet_list');
|
|
26546
|
+
this.paragraphCommandApplied = false;
|
|
26547
|
+
}
|
|
26548
|
+
toggleOrderedList() {
|
|
26549
|
+
if (this.isOrderedListActive()) {
|
|
26550
|
+
const continuation = this.orderedListContinuationAfterSelection();
|
|
26551
|
+
this.applyParagraph();
|
|
26552
|
+
this.restoreOrderedListContinuation(continuation);
|
|
26553
|
+
this.paragraphCommandApplied = false;
|
|
26554
|
+
return;
|
|
26555
|
+
}
|
|
26556
|
+
this.applyListStyleSelection('ordered_list');
|
|
26557
|
+
this.joinAdjacentLists('ordered_list');
|
|
26558
|
+
this.paragraphCommandApplied = false;
|
|
26559
|
+
}
|
|
26560
|
+
orderedListContinuationAfterSelection() {
|
|
26561
|
+
const { state } = this.editor.view;
|
|
26562
|
+
const { $from, $to } = state.selection;
|
|
26563
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26564
|
+
const list = $from.node(depth);
|
|
26565
|
+
if (list.type.name !== 'ordered_list') {
|
|
26566
|
+
continue;
|
|
26567
|
+
}
|
|
26568
|
+
const fromIndex = $from.index(depth);
|
|
26569
|
+
const toIndex = $to.depth >= depth && $to.node(depth) === list
|
|
26570
|
+
? $to.indexAfter(depth)
|
|
26571
|
+
: fromIndex + 1;
|
|
26572
|
+
if (toIndex >= list.childCount) {
|
|
26573
|
+
return null;
|
|
26574
|
+
}
|
|
26575
|
+
return {
|
|
26576
|
+
text: list.child(toIndex).textContent,
|
|
26577
|
+
order: (Number(list.attrs.order) || 1) + fromIndex,
|
|
26578
|
+
listStyle: list.attrs.listStyle || null
|
|
26579
|
+
};
|
|
26580
|
+
}
|
|
26581
|
+
return null;
|
|
26582
|
+
}
|
|
26583
|
+
restoreOrderedListContinuation(continuation) {
|
|
26584
|
+
if (!continuation) {
|
|
26585
|
+
return;
|
|
26586
|
+
}
|
|
26587
|
+
const { state, dispatch } = this.editor.view;
|
|
26588
|
+
let listPosition = null;
|
|
26589
|
+
let listNode = null;
|
|
26590
|
+
state.doc.descendants((node, position) => {
|
|
26591
|
+
if (listPosition !== null || node.type.name !== 'ordered_list' || !node.childCount) {
|
|
26592
|
+
return listPosition === null;
|
|
26593
|
+
}
|
|
26594
|
+
if (node.firstChild.textContent === continuation.text &&
|
|
26595
|
+
(node.attrs.listStyle || null) === continuation.listStyle) {
|
|
26596
|
+
listPosition = position;
|
|
26597
|
+
listNode = node;
|
|
26598
|
+
return false;
|
|
26599
|
+
}
|
|
26600
|
+
return true;
|
|
26601
|
+
});
|
|
26602
|
+
if (listPosition !== null && listNode && Number(listNode.attrs.order) !== continuation.order) {
|
|
26603
|
+
dispatch(state.tr.setNodeMarkup(listPosition, listNode.type, {
|
|
26604
|
+
...listNode.attrs,
|
|
26605
|
+
order: continuation.order
|
|
26606
|
+
}));
|
|
26607
|
+
}
|
|
26608
|
+
}
|
|
26609
|
+
joinAdjacentLists(listType) {
|
|
26610
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
26611
|
+
const { state, dispatch } = this.editor.view;
|
|
26612
|
+
const { $from } = state.selection;
|
|
26613
|
+
let joined = false;
|
|
26614
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26615
|
+
const activeList = $from.node(depth);
|
|
26616
|
+
if (activeList.type.name !== listType) {
|
|
26617
|
+
continue;
|
|
26618
|
+
}
|
|
26619
|
+
const parent = $from.node(depth - 1);
|
|
26620
|
+
const index = $from.index(depth - 1);
|
|
26621
|
+
const before = index > 0 ? parent.child(index - 1) : null;
|
|
26622
|
+
const after = index + 1 < parent.childCount ? parent.child(index + 1) : null;
|
|
26623
|
+
const hasSameStyle = (list) => Boolean(list &&
|
|
26624
|
+
list.type === activeList.type &&
|
|
26625
|
+
(list.attrs.listStyle || null) === (activeList.attrs.listStyle || null));
|
|
26626
|
+
if (hasSameStyle(before)) {
|
|
26627
|
+
dispatch(state.tr.join($from.before(depth)));
|
|
26628
|
+
joined = true;
|
|
26629
|
+
}
|
|
26630
|
+
else if (hasSameStyle(after)) {
|
|
26631
|
+
dispatch(state.tr.join($from.after(depth)));
|
|
26632
|
+
joined = true;
|
|
26633
|
+
}
|
|
26634
|
+
break;
|
|
26635
|
+
}
|
|
26636
|
+
if (!joined) {
|
|
26637
|
+
return;
|
|
26638
|
+
}
|
|
26639
|
+
}
|
|
26640
|
+
}
|
|
26641
|
+
listType(listStyle) {
|
|
26642
|
+
if (listStyle === 'bullet_list') {
|
|
26643
|
+
return 'bullet_list';
|
|
26644
|
+
}
|
|
26645
|
+
return listStyle ? 'ordered_list' : '';
|
|
26646
|
+
}
|
|
26647
|
+
orderedListStyle(listStyle) {
|
|
26648
|
+
if (listStyle === 'ordered_alpha') {
|
|
26649
|
+
return 'lower-alpha';
|
|
26650
|
+
}
|
|
26651
|
+
if (listStyle === 'ordered_roman') {
|
|
26652
|
+
return 'lower-roman';
|
|
26653
|
+
}
|
|
26654
|
+
return 'decimal';
|
|
26655
|
+
}
|
|
26656
|
+
activeListNode() {
|
|
26657
|
+
const { $from } = this.editor.view.state.selection;
|
|
26658
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26659
|
+
const node = $from.node(depth);
|
|
26660
|
+
if (node.type.name !== 'list_item') {
|
|
26661
|
+
continue;
|
|
26662
|
+
}
|
|
26663
|
+
const list = $from.node(depth - 1);
|
|
26664
|
+
if (!this.isList(list)) {
|
|
26665
|
+
return null;
|
|
26666
|
+
}
|
|
26667
|
+
// A lifted nested item remains inside its parent list item to retain its
|
|
26668
|
+
// indentation, but only the first block owns that parent's list marker.
|
|
26669
|
+
return depth < $from.depth && node.firstChild === $from.node(depth + 1) ? list : null;
|
|
26670
|
+
}
|
|
26671
|
+
return null;
|
|
26672
|
+
}
|
|
26673
|
+
applyOrderedListStyle(listStyle) {
|
|
26674
|
+
const { state, dispatch } = this.editor.view;
|
|
26675
|
+
const { $from } = state.selection;
|
|
26676
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
26677
|
+
const node = $from.node(depth);
|
|
26678
|
+
if (node.type.name !== 'ordered_list') {
|
|
26679
|
+
continue;
|
|
26680
|
+
}
|
|
26681
|
+
dispatch(state.tr.setNodeMarkup($from.before(depth), node.type, {
|
|
26682
|
+
...node.attrs,
|
|
26683
|
+
listStyle: listStyle === 'decimal' ? null : listStyle
|
|
26684
|
+
}));
|
|
26685
|
+
return;
|
|
26686
|
+
}
|
|
26687
|
+
}
|
|
26174
26688
|
onPaste(event) {
|
|
26175
26689
|
if (event.defaultPrevented) {
|
|
26176
26690
|
return;
|
|
@@ -26225,11 +26739,14 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26225
26739
|
normalisePastedHtml(html) {
|
|
26226
26740
|
const documentElement = new DOMParser().parseFromString(html, 'text/html');
|
|
26227
26741
|
removeUnsafeRichTextElements(documentElement);
|
|
26742
|
+
this.normaliseWordStylesheetFormatting(documentElement);
|
|
26743
|
+
this.normaliseOrderedListStyles(documentElement);
|
|
26228
26744
|
this.removeWordNoise(documentElement);
|
|
26229
26745
|
this.normaliseWordSpacing(documentElement);
|
|
26230
26746
|
this.normaliseWordTables(documentElement);
|
|
26231
26747
|
this.normaliseWordSemanticBlocks(documentElement);
|
|
26232
26748
|
this.convertWordLists(documentElement);
|
|
26749
|
+
this.normaliseNestedListStructure(documentElement);
|
|
26233
26750
|
this.normaliseSupportedInlineFormatting(documentElement);
|
|
26234
26751
|
this.normaliseBlockFormatting(documentElement);
|
|
26235
26752
|
this.normalisePastedListSpacing(documentElement);
|
|
@@ -26244,6 +26761,8 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26244
26761
|
}
|
|
26245
26762
|
const documentElement = new DOMParser().parseFromString(value, 'text/html');
|
|
26246
26763
|
removeUnsafeRichTextElements(documentElement);
|
|
26764
|
+
this.normaliseWordStylesheetFormatting(documentElement);
|
|
26765
|
+
this.normaliseOrderedListStyles(documentElement);
|
|
26247
26766
|
this.normaliseWordSpacing(documentElement);
|
|
26248
26767
|
this.normaliseWordTables(documentElement);
|
|
26249
26768
|
this.normaliseWordSemanticBlocks(documentElement);
|
|
@@ -26310,15 +26829,26 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26310
26829
|
Italic: 'Control+I',
|
|
26311
26830
|
Underline: 'Control+U'
|
|
26312
26831
|
};
|
|
26313
|
-
const
|
|
26832
|
+
const toggleCommands = {
|
|
26833
|
+
Bold: 'bold',
|
|
26834
|
+
Italic: 'italic',
|
|
26835
|
+
Underline: 'underline',
|
|
26836
|
+
Paragraph: 'paragraph',
|
|
26837
|
+
'Heading level 1': 'heading',
|
|
26838
|
+
'Bullet List': 'bullet_list',
|
|
26839
|
+
'Numbered List': 'ordered_list'
|
|
26840
|
+
};
|
|
26314
26841
|
const buttons = this.editorHost.nativeElement.querySelectorAll('button');
|
|
26315
26842
|
buttons.forEach((button) => {
|
|
26316
26843
|
const label = button.getAttribute('aria-label') || button.title;
|
|
26317
26844
|
if (shortcutLabels[label]) {
|
|
26318
26845
|
button.setAttribute('aria-keyshortcuts', shortcutLabels[label]);
|
|
26319
26846
|
}
|
|
26320
|
-
if (
|
|
26321
|
-
|
|
26847
|
+
if (toggleCommands[label]) {
|
|
26848
|
+
const isActive = label === 'Numbered List'
|
|
26849
|
+
? this.isOrderedListActive()
|
|
26850
|
+
: this.isToolbarCommandActive(toggleCommands[label]);
|
|
26851
|
+
button.setAttribute('aria-pressed', `${isActive}`);
|
|
26322
26852
|
}
|
|
26323
26853
|
});
|
|
26324
26854
|
}
|
|
@@ -26371,6 +26901,82 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26371
26901
|
const officeParagraphs = Array.prototype.slice.call(documentElement.getElementsByTagName('o:p'));
|
|
26372
26902
|
officeParagraphs.forEach((element) => element.remove());
|
|
26373
26903
|
}
|
|
26904
|
+
normaliseWordStylesheetFormatting(documentElement) {
|
|
26905
|
+
const styleElements = Array.prototype.slice.call(documentElement.querySelectorAll('style'));
|
|
26906
|
+
styleElements.forEach((styleElement) => {
|
|
26907
|
+
const stylesheet = (styleElement.textContent || '').replace(/<!--|-->/g, '');
|
|
26908
|
+
const rules = this.stylesheetRules(stylesheet);
|
|
26909
|
+
rules.forEach(([selectors, declarations]) => {
|
|
26910
|
+
const hasBoldStyle = this.hasBoldStyle(declarations);
|
|
26911
|
+
const headingLevel = this.wordOutlineLevel(declarations);
|
|
26912
|
+
const orderedListType = this.orderedListTypeFromStyle(declarations);
|
|
26913
|
+
if (!hasBoldStyle && !headingLevel && !orderedListType) {
|
|
26914
|
+
return;
|
|
26915
|
+
}
|
|
26916
|
+
selectors.split(',').forEach((selector) => {
|
|
26917
|
+
const normalisedSelector = selector.trim();
|
|
26918
|
+
if (!normalisedSelector || normalisedSelector.startsWith('@')) {
|
|
26919
|
+
return;
|
|
26920
|
+
}
|
|
26921
|
+
try {
|
|
26922
|
+
const matchingElements = documentElement.body.querySelectorAll(normalisedSelector);
|
|
26923
|
+
matchingElements.forEach((element) => {
|
|
26924
|
+
if (orderedListType && element.tagName.toLowerCase() === 'ol') {
|
|
26925
|
+
element.setAttribute('type', orderedListType);
|
|
26926
|
+
}
|
|
26927
|
+
if (headingLevel) {
|
|
26928
|
+
element.dataset.wordHeadingLevel = headingLevel.toString();
|
|
26929
|
+
}
|
|
26930
|
+
if (hasBoldStyle) {
|
|
26931
|
+
this.wrapBoldInlineContents(documentElement, element);
|
|
26932
|
+
}
|
|
26933
|
+
});
|
|
26934
|
+
}
|
|
26935
|
+
catch {
|
|
26936
|
+
// Ignore Microsoft Office selectors that are not valid browser CSS selectors.
|
|
26937
|
+
}
|
|
26938
|
+
});
|
|
26939
|
+
});
|
|
26940
|
+
});
|
|
26941
|
+
}
|
|
26942
|
+
normaliseOrderedListStyles(documentElement) {
|
|
26943
|
+
const orderedLists = documentElement.body.querySelectorAll('ol');
|
|
26944
|
+
orderedLists.forEach((list) => {
|
|
26945
|
+
const listType = this.orderedListTypeFromStyle(list.getAttribute('style') || '');
|
|
26946
|
+
if (listType) {
|
|
26947
|
+
list.setAttribute('type', listType);
|
|
26948
|
+
}
|
|
26949
|
+
});
|
|
26950
|
+
}
|
|
26951
|
+
orderedListTypeFromStyle(style) {
|
|
26952
|
+
const listStyle = (this.cssStyleValue(style, 'list-style-type') || '').toLowerCase();
|
|
26953
|
+
const wordListStyle = (this.cssStyleValue(style, 'mso-level-number-format') || '').toLowerCase();
|
|
26954
|
+
if (listStyle === 'lower-alpha' || listStyle === 'lower-latin' || wordListStyle === 'alpha-lower') {
|
|
26955
|
+
return 'a';
|
|
26956
|
+
}
|
|
26957
|
+
if (listStyle === 'lower-roman' || wordListStyle === 'roman-lower') {
|
|
26958
|
+
return 'i';
|
|
26959
|
+
}
|
|
26960
|
+
return null;
|
|
26961
|
+
}
|
|
26962
|
+
stylesheetRules(stylesheet) {
|
|
26963
|
+
const rules = [];
|
|
26964
|
+
let searchFrom = 0;
|
|
26965
|
+
let openingBrace = stylesheet.indexOf('{', searchFrom);
|
|
26966
|
+
while (openingBrace !== -1) {
|
|
26967
|
+
const closingBrace = stylesheet.indexOf('}', openingBrace + 1);
|
|
26968
|
+
if (closingBrace === -1) {
|
|
26969
|
+
break;
|
|
26970
|
+
}
|
|
26971
|
+
rules.push([
|
|
26972
|
+
stylesheet.slice(searchFrom, openingBrace),
|
|
26973
|
+
stylesheet.slice(openingBrace + 1, closingBrace)
|
|
26974
|
+
]);
|
|
26975
|
+
searchFrom = closingBrace + 1;
|
|
26976
|
+
openingBrace = stylesheet.indexOf('{', searchFrom);
|
|
26977
|
+
}
|
|
26978
|
+
return rules;
|
|
26979
|
+
}
|
|
26374
26980
|
normaliseWordSpacing(documentElement) {
|
|
26375
26981
|
const spacerElements = Array.prototype.slice.call(documentElement.body.querySelectorAll('[style*="mso-spacerun"]'));
|
|
26376
26982
|
spacerElements.forEach((spacerElement) => {
|
|
@@ -26432,18 +27038,36 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26432
27038
|
});
|
|
26433
27039
|
}
|
|
26434
27040
|
normaliseWordSemanticBlocks(documentElement) {
|
|
26435
|
-
const
|
|
26436
|
-
|
|
26437
|
-
const
|
|
27041
|
+
const blocks = Array.prototype.slice.call(documentElement.body.querySelectorAll('p, h1, h2, h3, h4, h5, h6'));
|
|
27042
|
+
blocks.forEach((block) => {
|
|
27043
|
+
const namedHeadingLevel = this.namedWordHeadingLevel(block);
|
|
27044
|
+
const existingHeadingLevel = /^h([1-6])$/i.exec(block.tagName)?.[1];
|
|
27045
|
+
if (existingHeadingLevel) {
|
|
27046
|
+
const heading = existingHeadingLevel === '1'
|
|
27047
|
+
? block
|
|
27048
|
+
: this.replaceElementTag(documentElement, block, 'h1');
|
|
27049
|
+
if (namedHeadingLevel) {
|
|
27050
|
+
this.removeRedundantHeadingBold(heading);
|
|
27051
|
+
}
|
|
27052
|
+
return;
|
|
27053
|
+
}
|
|
27054
|
+
const headingLevel = this.wordHeadingLevel(block);
|
|
26438
27055
|
if (headingLevel) {
|
|
26439
|
-
this.replaceElementTag(documentElement,
|
|
27056
|
+
const heading = this.replaceElementTag(documentElement, block, 'h1');
|
|
27057
|
+
if (namedHeadingLevel) {
|
|
27058
|
+
this.removeRedundantHeadingBold(heading);
|
|
27059
|
+
}
|
|
26440
27060
|
}
|
|
26441
27061
|
});
|
|
26442
27062
|
}
|
|
27063
|
+
removeRedundantHeadingBold(heading) {
|
|
27064
|
+
const boldElements = Array.prototype.slice.call(heading.querySelectorAll('strong, b'));
|
|
27065
|
+
boldElements.reverse().forEach((element) => this.unwrapElement(element));
|
|
27066
|
+
}
|
|
26443
27067
|
wordHeadingLevel(element) {
|
|
26444
|
-
const
|
|
26445
|
-
if (
|
|
26446
|
-
return
|
|
27068
|
+
const namedHeadingLevel = this.namedWordHeadingLevel(element);
|
|
27069
|
+
if (namedHeadingLevel) {
|
|
27070
|
+
return namedHeadingLevel;
|
|
26447
27071
|
}
|
|
26448
27072
|
if (/MsoTitle/i.test(element.className || '')) {
|
|
26449
27073
|
return 1;
|
|
@@ -26455,6 +27079,34 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26455
27079
|
}, 0);
|
|
26456
27080
|
return largestFontSize >= 24 ? 1 : null;
|
|
26457
27081
|
}
|
|
27082
|
+
namedWordHeadingLevel(element) {
|
|
27083
|
+
const styledElements = [element].concat(Array.prototype.slice.call(element.querySelectorAll('*')));
|
|
27084
|
+
for (const styledElement of styledElements) {
|
|
27085
|
+
const storedHeadingLevel = Number(styledElement.dataset.wordHeadingLevel);
|
|
27086
|
+
if (storedHeadingLevel >= 1 && storedHeadingLevel <= 6) {
|
|
27087
|
+
return storedHeadingLevel;
|
|
27088
|
+
}
|
|
27089
|
+
const className = styledElement.className || '';
|
|
27090
|
+
const style = styledElement.getAttribute('style') || '';
|
|
27091
|
+
const headingDescription = `${className} ${style}`;
|
|
27092
|
+
const namedHeadingLevel = /(?:Mso)?Heading\s*([1-6])(?:Char)?/i.exec(headingDescription);
|
|
27093
|
+
if (namedHeadingLevel) {
|
|
27094
|
+
return Number(namedHeadingLevel[1]);
|
|
27095
|
+
}
|
|
27096
|
+
if (/heading/i.test(headingDescription)) {
|
|
27097
|
+
return 1;
|
|
27098
|
+
}
|
|
27099
|
+
const outlineLevel = this.wordOutlineLevel(style);
|
|
27100
|
+
if (outlineLevel) {
|
|
27101
|
+
return outlineLevel;
|
|
27102
|
+
}
|
|
27103
|
+
}
|
|
27104
|
+
return null;
|
|
27105
|
+
}
|
|
27106
|
+
wordOutlineLevel(style) {
|
|
27107
|
+
const outlineLevel = /mso-outline-level\s*:\s*([1-6])/i.exec(style || '');
|
|
27108
|
+
return outlineLevel ? Number(outlineLevel[1]) : null;
|
|
27109
|
+
}
|
|
26458
27110
|
replaceElementTag(documentElement, element, tagName) {
|
|
26459
27111
|
const replacement = documentElement.createElement(tagName);
|
|
26460
27112
|
Array.prototype.slice.call(element.attributes).forEach((attribute) => {
|
|
@@ -26507,6 +27159,9 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26507
27159
|
const listStart = element.tagName.toLowerCase() === 'ol'
|
|
26508
27160
|
? this.normaliseListStart(element.getAttribute('start'))
|
|
26509
27161
|
: null;
|
|
27162
|
+
const listType = element.tagName.toLowerCase() === 'ol' && /^[ai]$/.test(element.getAttribute('type') || '')
|
|
27163
|
+
? element.getAttribute('type')
|
|
27164
|
+
: null;
|
|
26510
27165
|
while (element.attributes.length > 0) {
|
|
26511
27166
|
element.removeAttribute(element.attributes[0].name);
|
|
26512
27167
|
}
|
|
@@ -26519,6 +27174,9 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26519
27174
|
if (listStart) {
|
|
26520
27175
|
element.setAttribute('start', listStart);
|
|
26521
27176
|
}
|
|
27177
|
+
if (listType) {
|
|
27178
|
+
element.setAttribute('type', listType);
|
|
27179
|
+
}
|
|
26522
27180
|
});
|
|
26523
27181
|
}
|
|
26524
27182
|
normaliseListStart(value) {
|
|
@@ -26619,7 +27277,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26619
27277
|
hasBoldStyle(style) {
|
|
26620
27278
|
const fontWeightMatch = /(?:mso-bidi-)?font-weight\s*:\s*([^;]+)/i.exec(style);
|
|
26621
27279
|
if (!fontWeightMatch) {
|
|
26622
|
-
return
|
|
27280
|
+
return /(?:^|;)\s*font\s*:[^;]*\bbold\b/i.test(style);
|
|
26623
27281
|
}
|
|
26624
27282
|
const fontWeight = fontWeightMatch[1].trim().toLowerCase();
|
|
26625
27283
|
return fontWeight === 'bold' || fontWeight === 'bolder' || Number(fontWeight) >= 600;
|
|
@@ -26886,61 +27544,96 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26886
27544
|
convertWordLists(documentElement) {
|
|
26887
27545
|
const childNodes = Array.prototype.slice.call(documentElement.body.querySelectorAll('p'));
|
|
26888
27546
|
const wordListIndents = this.wordListIndents(childNodes);
|
|
26889
|
-
const
|
|
26890
|
-
const
|
|
26891
|
-
|
|
26892
|
-
|
|
27547
|
+
const orderedListTypes = this.wordOrderedListTypes(childNodes);
|
|
27548
|
+
const state = {
|
|
27549
|
+
listStack: [],
|
|
27550
|
+
listParents: [],
|
|
27551
|
+
resetListLevels: new Map(),
|
|
27552
|
+
previousListId: null
|
|
27553
|
+
};
|
|
26893
27554
|
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
|
-
|
|
27555
|
+
this.convertWordListParagraph(documentElement, node, wordListIndents, orderedListTypes, state);
|
|
27556
|
+
});
|
|
27557
|
+
}
|
|
27558
|
+
convertWordListParagraph(documentElement, node, wordListIndents, orderedListTypes, state) {
|
|
27559
|
+
if (!this.isWordListParagraph(node)) {
|
|
27560
|
+
this.resetWordListConversionState(state);
|
|
27561
|
+
return;
|
|
27562
|
+
}
|
|
27563
|
+
const paragraph = node;
|
|
27564
|
+
const listType = this.wordListType(paragraph);
|
|
27565
|
+
const orderedListType = listType === 'ol' ? orderedListTypes.get(this.wordListLevelKey(paragraph)) || null : null;
|
|
27566
|
+
const listId = this.wordListId(paragraph);
|
|
27567
|
+
const requestedLevel = this.wordListRequestedLevel(paragraph, listId, wordListIndents, state);
|
|
27568
|
+
const level = Math.min(requestedLevel, state.listStack.length + 1);
|
|
27569
|
+
const currentList = this.wordListForParagraph(documentElement, paragraph, listType, orderedListType, level, state);
|
|
27570
|
+
const listItem = documentElement.createElement('li');
|
|
27571
|
+
this.copyListItemContents(documentElement, paragraph, listItem);
|
|
27572
|
+
currentList.appendChild(listItem);
|
|
27573
|
+
paragraph.remove();
|
|
27574
|
+
state.previousListId = listId;
|
|
27575
|
+
}
|
|
27576
|
+
resetWordListConversionState(state) {
|
|
27577
|
+
state.listStack.length = 0;
|
|
27578
|
+
state.listParents.length = 0;
|
|
27579
|
+
state.resetListLevels.clear();
|
|
27580
|
+
state.previousListId = null;
|
|
27581
|
+
}
|
|
27582
|
+
wordListRequestedLevel(paragraph, listId, wordListIndents, state) {
|
|
27583
|
+
const declaredLevel = this.wordListDeclaredLevel(paragraph);
|
|
27584
|
+
let requestedLevel = this.wordListLevel(paragraph, wordListIndents);
|
|
27585
|
+
const rememberedResetLevel = declaredLevel === 1 ? state.resetListLevels.get(listId) : null;
|
|
27586
|
+
if (rememberedResetLevel) {
|
|
27587
|
+
return Math.max(requestedLevel, rememberedResetLevel);
|
|
27588
|
+
}
|
|
27589
|
+
if (declaredLevel === 1 && listId !== state.previousListId && state.listStack.length > 1 && requestedLevel === state.listStack.length) {
|
|
27590
|
+
requestedLevel++;
|
|
27591
|
+
state.resetListLevels.set(listId, requestedLevel);
|
|
27592
|
+
}
|
|
27593
|
+
else if (declaredLevel === 1 && listId) {
|
|
27594
|
+
state.resetListLevels.set(listId, requestedLevel);
|
|
27595
|
+
}
|
|
27596
|
+
return requestedLevel;
|
|
27597
|
+
}
|
|
27598
|
+
wordListForParagraph(documentElement, paragraph, listType, orderedListType, level, state) {
|
|
27599
|
+
const stackIndex = level - 1;
|
|
27600
|
+
const parentListItem = stackIndex > 0 ? state.listStack[stackIndex - 1]?.lastElementChild : null;
|
|
27601
|
+
const listParent = parentListItem || paragraph.parentNode;
|
|
27602
|
+
let currentList = state.listStack[stackIndex];
|
|
27603
|
+
if (currentList?.tagName.toLowerCase() !== listType || currentList?.getAttribute('type') !== orderedListType ||
|
|
27604
|
+
state.listParents[stackIndex] !== listParent) {
|
|
27605
|
+
currentList = this.createWordList(documentElement, paragraph, listType, orderedListType, parentListItem);
|
|
27606
|
+
state.listStack[stackIndex] = currentList;
|
|
27607
|
+
state.listParents[stackIndex] = listParent;
|
|
27608
|
+
}
|
|
27609
|
+
state.listStack.length = level;
|
|
27610
|
+
state.listParents.length = level;
|
|
27611
|
+
return currentList;
|
|
27612
|
+
}
|
|
27613
|
+
createWordList(documentElement, paragraph, listType, orderedListType, parentListItem) {
|
|
27614
|
+
const list = documentElement.createElement(listType);
|
|
27615
|
+
const listStart = this.wordListStart(paragraph);
|
|
27616
|
+
if (listType === 'ol' && listStart > 1) {
|
|
27617
|
+
list.setAttribute('start', listStart.toString());
|
|
27618
|
+
}
|
|
27619
|
+
if (orderedListType) {
|
|
27620
|
+
list.setAttribute('type', orderedListType);
|
|
27621
|
+
}
|
|
27622
|
+
if (parentListItem) {
|
|
27623
|
+
parentListItem.appendChild(list);
|
|
27624
|
+
}
|
|
27625
|
+
else {
|
|
27626
|
+
paragraph.parentNode.insertBefore(list, paragraph);
|
|
27627
|
+
}
|
|
27628
|
+
return list;
|
|
27629
|
+
}
|
|
27630
|
+
normaliseNestedListStructure(documentElement) {
|
|
27631
|
+
const orphanedNestedLists = Array.prototype.slice.call(documentElement.body.querySelectorAll('ol > ol, ol > ul, ul > ol, ul > ul'));
|
|
27632
|
+
orphanedNestedLists.forEach((nestedList) => {
|
|
27633
|
+
const previousListItem = nestedList.previousElementSibling;
|
|
27634
|
+
if (previousListItem?.tagName.toLowerCase() === 'li') {
|
|
27635
|
+
previousListItem.appendChild(nestedList);
|
|
26938
27636
|
}
|
|
26939
|
-
listStack.length = level;
|
|
26940
|
-
listParents.length = level;
|
|
26941
|
-
currentList.appendChild(listItem);
|
|
26942
|
-
paragraph.remove();
|
|
26943
|
-
previousListId = listId;
|
|
26944
27637
|
});
|
|
26945
27638
|
}
|
|
26946
27639
|
isWordListParagraph(node) {
|
|
@@ -26950,8 +27643,39 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26950
27643
|
return /MsoListParagraph/i.test(node.className) || /mso-list/i.test(node.getAttribute('style') || '');
|
|
26951
27644
|
}
|
|
26952
27645
|
wordListType(paragraph) {
|
|
26953
|
-
|
|
26954
|
-
|
|
27646
|
+
return /^\(?(?:\d+|[a-z]+)[.)]/i.test(this.wordListMarker(paragraph)) ? 'ol' : 'ul';
|
|
27647
|
+
}
|
|
27648
|
+
wordOrderedListTypes(nodes) {
|
|
27649
|
+
const markersByLevel = new Map();
|
|
27650
|
+
nodes.filter((node) => this.isWordListParagraph(node)).forEach((node) => {
|
|
27651
|
+
const marker = this.wordListMarker(node);
|
|
27652
|
+
if (!/^\(?(?:\d+|[a-z]+)[.)]/i.test(marker)) {
|
|
27653
|
+
return;
|
|
27654
|
+
}
|
|
27655
|
+
const key = this.wordListLevelKey(node);
|
|
27656
|
+
markersByLevel.set(key, [...(markersByLevel.get(key) || []), marker]);
|
|
27657
|
+
});
|
|
27658
|
+
const listTypes = new Map();
|
|
27659
|
+
markersByLevel.forEach((markers, key) => {
|
|
27660
|
+
const markerPattern = /^\(?([a-z]+|\d+)[.)]/i;
|
|
27661
|
+
const markerTokens = markers.map((marker) => markerPattern.exec(marker)?.[1]?.toLowerCase());
|
|
27662
|
+
if (markers.some((marker) => /^\([ivxlcdm]+\)/i.test(marker)) ||
|
|
27663
|
+
markerTokens.some((token) => token?.length > 1 && /^[ivxlcdm]+$/.test(token))) {
|
|
27664
|
+
listTypes.set(key, 'i');
|
|
27665
|
+
}
|
|
27666
|
+
else if (markerTokens.every((token) => /^[a-z]$/.test(token || ''))) {
|
|
27667
|
+
listTypes.set(key, 'a');
|
|
27668
|
+
}
|
|
27669
|
+
});
|
|
27670
|
+
return listTypes;
|
|
27671
|
+
}
|
|
27672
|
+
wordListLevelKey(paragraph) {
|
|
27673
|
+
return `${this.wordListId(paragraph) || ''}:${this.wordListDeclaredLevel(paragraph)}`;
|
|
27674
|
+
}
|
|
27675
|
+
wordListMarker(paragraph) {
|
|
27676
|
+
const markerElement = Array.prototype.slice.call(paragraph.querySelectorAll('[style]'))
|
|
27677
|
+
.find((element) => /mso-list:\s*Ignore/i.test(element.getAttribute('style') || ''));
|
|
27678
|
+
return (markerElement ? markerElement.textContent : paragraph.textContent).trim();
|
|
26955
27679
|
}
|
|
26956
27680
|
wordListLevel(paragraph, wordListIndents) {
|
|
26957
27681
|
const declaredLevel = this.wordListDeclaredLevel(paragraph);
|
|
@@ -26970,8 +27694,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26970
27694
|
wordListIndents(nodes) {
|
|
26971
27695
|
const indents = nodes
|
|
26972
27696
|
.filter((node) => this.isWordListParagraph(node))
|
|
26973
|
-
.map((node) => this.wordListIndent(node))
|
|
26974
|
-
.filter((indent) => indent > 0);
|
|
27697
|
+
.map((node) => this.wordListIndent(node));
|
|
26975
27698
|
return Array.from(new Set(indents)).sort((left, right) => left - right);
|
|
26976
27699
|
}
|
|
26977
27700
|
wordListIndent(paragraph) {
|
|
@@ -26980,10 +27703,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26980
27703
|
return Math.round(indent);
|
|
26981
27704
|
}
|
|
26982
27705
|
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+)[.)]/);
|
|
27706
|
+
const match = /^(\d+)[.)]/.exec(this.wordListMarker(paragraph));
|
|
26987
27707
|
return match ? Number(match[1]) : 1;
|
|
26988
27708
|
}
|
|
26989
27709
|
copyListItemContents(documentElement, paragraph, listItem) {
|
|
@@ -26991,7 +27711,12 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
26991
27711
|
if (this.isWordListMarker(childNode)) {
|
|
26992
27712
|
return;
|
|
26993
27713
|
}
|
|
26994
|
-
|
|
27714
|
+
const clonedNode = childNode.cloneNode(true);
|
|
27715
|
+
this.removeNestedWordListMarkers(clonedNode);
|
|
27716
|
+
if (clonedNode instanceof HTMLElement && !clonedNode.textContent?.trim() && !clonedNode.querySelector('br')) {
|
|
27717
|
+
return;
|
|
27718
|
+
}
|
|
27719
|
+
listItem.appendChild(clonedNode);
|
|
26995
27720
|
});
|
|
26996
27721
|
this.removeLeadingListMarker(listItem);
|
|
26997
27722
|
this.trimListItemWhitespace(listItem);
|
|
@@ -27003,11 +27728,15 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27003
27728
|
if (!(node instanceof HTMLElement)) {
|
|
27004
27729
|
return false;
|
|
27005
27730
|
}
|
|
27006
|
-
|
|
27007
|
-
|
|
27731
|
+
return /mso-list:\s*Ignore/i.test(node.getAttribute('style') || '');
|
|
27732
|
+
}
|
|
27733
|
+
removeNestedWordListMarkers(node) {
|
|
27734
|
+
if (!(node instanceof HTMLElement)) {
|
|
27735
|
+
return;
|
|
27008
27736
|
}
|
|
27009
|
-
|
|
27010
|
-
.
|
|
27737
|
+
Array.prototype.slice.call(node.querySelectorAll('[style]'))
|
|
27738
|
+
.filter((element) => /mso-list:\s*Ignore/i.test(element.getAttribute('style') || ''))
|
|
27739
|
+
.forEach((element) => element.remove());
|
|
27011
27740
|
}
|
|
27012
27741
|
removeLeadingListMarker(listItem) {
|
|
27013
27742
|
const textNode = this.firstTextNode(listItem);
|
|
@@ -27032,13 +27761,15 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27032
27761
|
if (!this.editor?.view) {
|
|
27033
27762
|
return;
|
|
27034
27763
|
}
|
|
27764
|
+
const activeListType = this.activeListNode()?.type.name;
|
|
27035
27765
|
this.activeToolbarCommands = {
|
|
27036
27766
|
bold: this.isMarkActive('strong'),
|
|
27037
27767
|
italic: this.isMarkActive('em'),
|
|
27038
27768
|
underline: this.isMarkActive('u'),
|
|
27039
27769
|
paragraph: this.paragraphCommandApplied && this.isPlainParagraphActive(),
|
|
27040
|
-
|
|
27041
|
-
|
|
27770
|
+
heading: this.isHeadingOneActive(),
|
|
27771
|
+
ordered_list: activeListType === 'ordered_list',
|
|
27772
|
+
bullet_list: activeListType === 'bullet_list'
|
|
27042
27773
|
};
|
|
27043
27774
|
}
|
|
27044
27775
|
updateToolbarStateLater() {
|
|
@@ -27063,11 +27794,272 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27063
27794
|
if (!paragraphType) {
|
|
27064
27795
|
return;
|
|
27065
27796
|
}
|
|
27797
|
+
if (this.flattenSelectedNestedListItems()) {
|
|
27798
|
+
return;
|
|
27799
|
+
}
|
|
27800
|
+
if (this.flattenFullySelectedList()) {
|
|
27801
|
+
return;
|
|
27802
|
+
}
|
|
27066
27803
|
if (listItemType && this.isNodeActive('list_item')) {
|
|
27067
27804
|
liftListItem(listItemType)(state, dispatch);
|
|
27068
27805
|
}
|
|
27069
27806
|
setBlockType(paragraphType)(this.editor.view.state, this.editor.view.dispatch);
|
|
27070
27807
|
}
|
|
27808
|
+
flattenSelectedNestedListItems() {
|
|
27809
|
+
const { state, dispatch } = this.editor.view;
|
|
27810
|
+
const { $from, $to } = state.selection;
|
|
27811
|
+
const paragraphType = state.schema.nodes.paragraph;
|
|
27812
|
+
if (!paragraphType) {
|
|
27813
|
+
return false;
|
|
27814
|
+
}
|
|
27815
|
+
for (let depth = $from.depth; depth > 1; depth--) {
|
|
27816
|
+
const list = $from.node(depth);
|
|
27817
|
+
if (!this.isListNode(list) || $from.node(depth - 1).type.name !== 'list_item' ||
|
|
27818
|
+
$to.depth < depth || $to.node(depth) !== list) {
|
|
27819
|
+
continue;
|
|
27820
|
+
}
|
|
27821
|
+
const fromIndex = $from.index(depth);
|
|
27822
|
+
const toIndex = $to.indexAfter(depth);
|
|
27823
|
+
const replacement = [];
|
|
27824
|
+
const beforeItems = this.listItemsBetween(list, 0, fromIndex);
|
|
27825
|
+
const afterItems = this.listItemsBetween(list, toIndex, list.childCount);
|
|
27826
|
+
const sourceTextBlock = state.selection.empty && $from.parent.isTextblock ? $from.parent : null;
|
|
27827
|
+
const sourceCaretOffset = $from.parentOffset;
|
|
27828
|
+
const replacementStart = $from.before(depth);
|
|
27829
|
+
let caretPosition = null;
|
|
27830
|
+
if (beforeItems.length) {
|
|
27831
|
+
replacement.push(list.copy(Fragment.fromArray(beforeItems)));
|
|
27832
|
+
}
|
|
27833
|
+
const paragraphIndent = Number(list.attrs.indent) || 0;
|
|
27834
|
+
this.listItemsBetween(list, fromIndex, toIndex).forEach((listItem) => {
|
|
27835
|
+
listItem.forEach((child) => {
|
|
27836
|
+
if (child.isTextblock) {
|
|
27837
|
+
const indent = Math.min(MAX_INDENT, paragraphIndent + (Number(child.attrs.indent) || 0));
|
|
27838
|
+
const paragraph = paragraphType.create({
|
|
27839
|
+
...child.attrs,
|
|
27840
|
+
indent: indent || null
|
|
27841
|
+
}, child.content);
|
|
27842
|
+
if (child === sourceTextBlock) {
|
|
27843
|
+
const precedingSize = replacement.reduce((size, node) => size + node.nodeSize, 0);
|
|
27844
|
+
caretPosition = replacementStart + precedingSize + 1 +
|
|
27845
|
+
Math.min(sourceCaretOffset, paragraph.content.size);
|
|
27846
|
+
}
|
|
27847
|
+
replacement.push(paragraph);
|
|
27848
|
+
}
|
|
27849
|
+
else if (this.isListNode(child)) {
|
|
27850
|
+
replacement.push(child);
|
|
27851
|
+
}
|
|
27852
|
+
});
|
|
27853
|
+
});
|
|
27854
|
+
if (afterItems.length) {
|
|
27855
|
+
const afterListAttrs = list.type.name === 'ordered_list'
|
|
27856
|
+
? { ...list.attrs, order: (Number(list.attrs.order) || 1) + toIndex }
|
|
27857
|
+
: { ...list.attrs };
|
|
27858
|
+
replacement.push(list.type.create(afterListAttrs, Fragment.fromArray(afterItems)));
|
|
27859
|
+
}
|
|
27860
|
+
const transaction = state.tr.replaceWith(replacementStart, $from.after(depth), Fragment.fromArray(replacement));
|
|
27861
|
+
if (caretPosition !== null) {
|
|
27862
|
+
transaction.setSelection(TextSelection.create(transaction.doc, caretPosition));
|
|
27863
|
+
}
|
|
27864
|
+
dispatch(transaction.scrollIntoView());
|
|
27865
|
+
return true;
|
|
27866
|
+
}
|
|
27867
|
+
return false;
|
|
27868
|
+
}
|
|
27869
|
+
listItemsBetween(list, fromIndex, toIndex) {
|
|
27870
|
+
const items = [];
|
|
27871
|
+
for (let index = fromIndex; index < toIndex; index++) {
|
|
27872
|
+
items.push(list.child(index));
|
|
27873
|
+
}
|
|
27874
|
+
return items;
|
|
27875
|
+
}
|
|
27876
|
+
flattenFullySelectedList() {
|
|
27877
|
+
const { state, dispatch } = this.editor.view;
|
|
27878
|
+
const { $from, $to, empty } = state.selection;
|
|
27879
|
+
const paragraphType = state.schema.nodes.paragraph;
|
|
27880
|
+
if (empty || !paragraphType) {
|
|
27881
|
+
return false;
|
|
27882
|
+
}
|
|
27883
|
+
for (let depth = 1; depth <= $from.depth; depth++) {
|
|
27884
|
+
const list = $from.node(depth);
|
|
27885
|
+
if (!this.isListNode(list) || $to.depth < depth || $to.node(depth) !== list) {
|
|
27886
|
+
continue;
|
|
27887
|
+
}
|
|
27888
|
+
const selectionStartsInFirstItem = $from.index(depth) === 0;
|
|
27889
|
+
const selectionEndsInLastItem = $to.indexAfter(depth) === list.childCount;
|
|
27890
|
+
const selectionCoversListContent = this.selectionCoversListContent(list, $from.before(depth), state.selection.from, state.selection.to);
|
|
27891
|
+
if (!selectionStartsInFirstItem || !selectionEndsInLastItem ||
|
|
27892
|
+
!selectionCoversListContent) {
|
|
27893
|
+
continue;
|
|
27894
|
+
}
|
|
27895
|
+
const paragraphs = this.flattenListToParagraphs(list, 0);
|
|
27896
|
+
const transaction = state.tr.replaceWith($from.before(depth), $from.after(depth), Fragment.fromArray(paragraphs));
|
|
27897
|
+
dispatch(transaction.scrollIntoView());
|
|
27898
|
+
return true;
|
|
27899
|
+
}
|
|
27900
|
+
return false;
|
|
27901
|
+
}
|
|
27902
|
+
selectionCoversListContent(list, listPosition, from, to) {
|
|
27903
|
+
let firstTextBlockStart = null;
|
|
27904
|
+
let lastTextBlockEnd = null;
|
|
27905
|
+
list.descendants((node, position) => {
|
|
27906
|
+
if (!node.isTextblock) {
|
|
27907
|
+
return true;
|
|
27908
|
+
}
|
|
27909
|
+
const textBlockStart = listPosition + position + 2;
|
|
27910
|
+
firstTextBlockStart ??= textBlockStart;
|
|
27911
|
+
lastTextBlockEnd = textBlockStart + node.content.size;
|
|
27912
|
+
return false;
|
|
27913
|
+
});
|
|
27914
|
+
return firstTextBlockStart !== null && lastTextBlockEnd !== null &&
|
|
27915
|
+
from <= firstTextBlockStart && to >= lastTextBlockEnd;
|
|
27916
|
+
}
|
|
27917
|
+
flattenListToParagraphs(list, nestingIndent) {
|
|
27918
|
+
const paragraphType = this.editor.view.state.schema.nodes.paragraph;
|
|
27919
|
+
const listIndent = Number(list.attrs.indent) || 0;
|
|
27920
|
+
const itemIndent = Math.min(MAX_INDENT, nestingIndent + listIndent);
|
|
27921
|
+
const paragraphs = [];
|
|
27922
|
+
list.forEach((listItem) => {
|
|
27923
|
+
listItem.forEach((child) => {
|
|
27924
|
+
if (this.isListNode(child)) {
|
|
27925
|
+
paragraphs.push(...this.flattenListToParagraphs(child, itemIndent + 1));
|
|
27926
|
+
return;
|
|
27927
|
+
}
|
|
27928
|
+
if (child.isTextblock) {
|
|
27929
|
+
const existingIndent = Number(child.attrs.indent) || 0;
|
|
27930
|
+
const indent = Math.min(MAX_INDENT, itemIndent + existingIndent);
|
|
27931
|
+
paragraphs.push(paragraphType.create({
|
|
27932
|
+
...child.attrs,
|
|
27933
|
+
indent: indent || null
|
|
27934
|
+
}, child.content));
|
|
27935
|
+
}
|
|
27936
|
+
});
|
|
27937
|
+
});
|
|
27938
|
+
return paragraphs;
|
|
27939
|
+
}
|
|
27940
|
+
rebuildSelectedIndentedBlocksAsList(listType, orderedListStyle) {
|
|
27941
|
+
const { state, dispatch } = this.editor.view;
|
|
27942
|
+
const { from, to } = state.selection;
|
|
27943
|
+
const selectedBlocks = [];
|
|
27944
|
+
state.doc.forEach((node, position, index) => {
|
|
27945
|
+
if (!node.isTextblock) {
|
|
27946
|
+
return;
|
|
27947
|
+
}
|
|
27948
|
+
const contentStart = position + 1;
|
|
27949
|
+
const contentEnd = contentStart + node.content.size;
|
|
27950
|
+
if (from <= contentEnd && to >= contentStart) {
|
|
27951
|
+
selectedBlocks.push({
|
|
27952
|
+
node,
|
|
27953
|
+
position,
|
|
27954
|
+
index,
|
|
27955
|
+
indent: Number(node.attrs.indent) || 0
|
|
27956
|
+
});
|
|
27957
|
+
}
|
|
27958
|
+
});
|
|
27959
|
+
if (selectedBlocks.length === 1 && selectedBlocks[0].indent > 0) {
|
|
27960
|
+
const block = selectedBlocks[0];
|
|
27961
|
+
const { schema } = state;
|
|
27962
|
+
const listItemType = schema.nodes.list_item;
|
|
27963
|
+
const listNodeType = schema.nodes[listType];
|
|
27964
|
+
const textBlock = block.node.type.create({
|
|
27965
|
+
...block.node.attrs,
|
|
27966
|
+
indent: null
|
|
27967
|
+
}, block.node.content, block.node.marks);
|
|
27968
|
+
const orderedStyle = this.orderedListStyleAtDepth(orderedListStyle, 0);
|
|
27969
|
+
const attrs = listType === 'ordered_list'
|
|
27970
|
+
? {
|
|
27971
|
+
order: 1,
|
|
27972
|
+
indent: block.indent,
|
|
27973
|
+
listStyle: orderedStyle === 'decimal' ? null : orderedStyle
|
|
27974
|
+
}
|
|
27975
|
+
: {
|
|
27976
|
+
indent: block.indent,
|
|
27977
|
+
continuationOrder: null
|
|
27978
|
+
};
|
|
27979
|
+
const list = listNodeType.create(attrs, listItemType.create(null, textBlock));
|
|
27980
|
+
const transaction = state.tr.replaceWith(block.position, block.position + block.node.nodeSize, list);
|
|
27981
|
+
transaction.setSelection(TextSelection.create(transaction.doc, from + 2, to + 2));
|
|
27982
|
+
dispatch(transaction.scrollIntoView());
|
|
27983
|
+
return true;
|
|
27984
|
+
}
|
|
27985
|
+
if (selectedBlocks.length < 2 ||
|
|
27986
|
+
selectedBlocks[selectedBlocks.length - 1].index - selectedBlocks[0].index + 1 !== selectedBlocks.length) {
|
|
27987
|
+
return false;
|
|
27988
|
+
}
|
|
27989
|
+
const firstBlock = selectedBlocks[0];
|
|
27990
|
+
const lastBlock = selectedBlocks[selectedBlocks.length - 1];
|
|
27991
|
+
const selectionCoversBlocks = from <= firstBlock.position + 1 &&
|
|
27992
|
+
to >= lastBlock.position + 1 + lastBlock.node.content.size;
|
|
27993
|
+
const baseIndent = Math.min(...selectedBlocks.map((block) => block.indent));
|
|
27994
|
+
const normalisedBlocks = selectedBlocks.map((block) => ({
|
|
27995
|
+
...block,
|
|
27996
|
+
indent: Math.max(0, block.indent - baseIndent)
|
|
27997
|
+
}));
|
|
27998
|
+
if (!selectionCoversBlocks || (baseIndent === 0 && !normalisedBlocks.some((block) => block.indent > 0))) {
|
|
27999
|
+
return false;
|
|
28000
|
+
}
|
|
28001
|
+
const rebuilt = this.buildNestedList(normalisedBlocks, 0, 0, listType, orderedListStyle);
|
|
28002
|
+
if (rebuilt.nextIndex !== normalisedBlocks.length) {
|
|
28003
|
+
return false;
|
|
28004
|
+
}
|
|
28005
|
+
const rootList = baseIndent > 0
|
|
28006
|
+
? rebuilt.list.type.create({ ...rebuilt.list.attrs, indent: baseIndent }, rebuilt.list.content)
|
|
28007
|
+
: rebuilt.list;
|
|
28008
|
+
const transaction = state.tr.replaceWith(firstBlock.position, lastBlock.position + lastBlock.node.nodeSize, rootList);
|
|
28009
|
+
dispatch(transaction.scrollIntoView());
|
|
28010
|
+
return true;
|
|
28011
|
+
}
|
|
28012
|
+
buildNestedList(blocks, startIndex, depth, listType, rootOrderedListStyle) {
|
|
28013
|
+
const { schema } = this.editor.view.state;
|
|
28014
|
+
const listItemType = schema.nodes.list_item;
|
|
28015
|
+
const listNodeType = schema.nodes[listType];
|
|
28016
|
+
const listItems = [];
|
|
28017
|
+
let index = startIndex;
|
|
28018
|
+
while (index < blocks.length) {
|
|
28019
|
+
const block = blocks[index];
|
|
28020
|
+
if (block.indent < depth) {
|
|
28021
|
+
break;
|
|
28022
|
+
}
|
|
28023
|
+
if (block.indent > depth && listItems.length) {
|
|
28024
|
+
const nested = this.buildNestedList(blocks, index, depth + 1, listType, rootOrderedListStyle);
|
|
28025
|
+
const parentItem = listItems[listItems.length - 1];
|
|
28026
|
+
listItems[listItems.length - 1] = parentItem.copy(parentItem.content.append(Fragment.from(nested.list)));
|
|
28027
|
+
index = nested.nextIndex;
|
|
28028
|
+
continue;
|
|
28029
|
+
}
|
|
28030
|
+
const textBlock = block.node.type.create({
|
|
28031
|
+
...block.node.attrs,
|
|
28032
|
+
indent: null
|
|
28033
|
+
}, block.node.content, block.node.marks);
|
|
28034
|
+
listItems.push(listItemType.create(null, textBlock));
|
|
28035
|
+
index++;
|
|
28036
|
+
}
|
|
28037
|
+
const orderedStyle = this.orderedListStyleAtDepth(rootOrderedListStyle, depth);
|
|
28038
|
+
const attrs = listType === 'ordered_list'
|
|
28039
|
+
? {
|
|
28040
|
+
order: 1,
|
|
28041
|
+
indent: null,
|
|
28042
|
+
listStyle: orderedStyle === 'decimal' ? null : orderedStyle
|
|
28043
|
+
}
|
|
28044
|
+
: {
|
|
28045
|
+
indent: null,
|
|
28046
|
+
continuationOrder: null
|
|
28047
|
+
};
|
|
28048
|
+
return {
|
|
28049
|
+
list: listNodeType.create(attrs, Fragment.fromArray(listItems)),
|
|
28050
|
+
nextIndex: index
|
|
28051
|
+
};
|
|
28052
|
+
}
|
|
28053
|
+
orderedListStyleAtDepth(rootStyle, depth) {
|
|
28054
|
+
let listStyle = rootStyle;
|
|
28055
|
+
for (let currentDepth = 0; currentDepth < depth; currentDepth++) {
|
|
28056
|
+
listStyle = this.nextNestedOrderedListStyle(listStyle);
|
|
28057
|
+
}
|
|
28058
|
+
return listStyle;
|
|
28059
|
+
}
|
|
28060
|
+
isListNode(node) {
|
|
28061
|
+
return node.type.name === 'ordered_list' || node.type.name === 'bullet_list';
|
|
28062
|
+
}
|
|
27071
28063
|
changeIndent(increase) {
|
|
27072
28064
|
const { state, dispatch } = this.editor.view;
|
|
27073
28065
|
const listItemType = state.schema.nodes.list_item;
|
|
@@ -27077,6 +28069,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27077
28069
|
}
|
|
27078
28070
|
const listCommand = increase ? sinkListItem(listItemType) : liftListItem(listItemType);
|
|
27079
28071
|
if (listCommand(state, dispatch)) {
|
|
28072
|
+
this.applyOrderedListStyleForCurrentDepth();
|
|
27080
28073
|
return;
|
|
27081
28074
|
}
|
|
27082
28075
|
if (increase && this.changeListIndent(true, state, dispatch)) {
|
|
@@ -27090,6 +28083,35 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27090
28083
|
this.editor.commands.outdent().exec();
|
|
27091
28084
|
}
|
|
27092
28085
|
}
|
|
28086
|
+
applyOrderedListStyleForCurrentDepth() {
|
|
28087
|
+
const { state, dispatch } = this.editor.view;
|
|
28088
|
+
const { $from } = state.selection;
|
|
28089
|
+
const orderedListDepths = [];
|
|
28090
|
+
let activeOrderedListDepth = null;
|
|
28091
|
+
for (let depth = 1; depth <= $from.depth; depth++) {
|
|
28092
|
+
if ($from.node(depth).type.name === 'ordered_list') {
|
|
28093
|
+
orderedListDepths.push(depth);
|
|
28094
|
+
activeOrderedListDepth = depth;
|
|
28095
|
+
}
|
|
28096
|
+
}
|
|
28097
|
+
if (activeOrderedListDepth === null || orderedListDepths.length < 2) {
|
|
28098
|
+
return;
|
|
28099
|
+
}
|
|
28100
|
+
const activeList = $from.node(activeOrderedListDepth);
|
|
28101
|
+
const parentListDepth = orderedListDepths[orderedListDepths.length - 2];
|
|
28102
|
+
const parentListStyle = $from.node(parentListDepth).attrs.listStyle || 'decimal';
|
|
28103
|
+
const listStyle = this.nextNestedOrderedListStyle(parentListStyle);
|
|
28104
|
+
dispatch(state.tr.setNodeMarkup($from.before(activeOrderedListDepth), activeList.type, {
|
|
28105
|
+
...activeList.attrs,
|
|
28106
|
+
listStyle: listStyle === 'decimal' ? null : listStyle
|
|
28107
|
+
}));
|
|
28108
|
+
}
|
|
28109
|
+
nextNestedOrderedListStyle(parentListStyle) {
|
|
28110
|
+
if (parentListStyle === 'decimal') {
|
|
28111
|
+
return 'lower-alpha';
|
|
28112
|
+
}
|
|
28113
|
+
return 'lower-roman';
|
|
28114
|
+
}
|
|
27093
28115
|
changeListIndent(increase, state, dispatch) {
|
|
27094
28116
|
const { $from } = state.selection;
|
|
27095
28117
|
for (let depth = $from.depth; depth > 0; depth--) {
|
|
@@ -27118,6 +28140,44 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27118
28140
|
this.applyParagraph();
|
|
27119
28141
|
this.paragraphCommandApplied = true;
|
|
27120
28142
|
}
|
|
28143
|
+
toggleHeading() {
|
|
28144
|
+
if (this.isHeadingOneActive()) {
|
|
28145
|
+
const paragraphType = this.editor.view.state.schema.nodes.paragraph;
|
|
28146
|
+
if (paragraphType) {
|
|
28147
|
+
setBlockType(paragraphType)(this.editor.view.state, this.editor.view.dispatch);
|
|
28148
|
+
}
|
|
28149
|
+
this.paragraphCommandApplied = false;
|
|
28150
|
+
return;
|
|
28151
|
+
}
|
|
28152
|
+
const headingType = this.editor.view.state.schema.nodes.heading;
|
|
28153
|
+
if (headingType) {
|
|
28154
|
+
setBlockType(headingType, { level: 1 })(this.editor.view.state, this.editor.view.dispatch);
|
|
28155
|
+
}
|
|
28156
|
+
this.paragraphCommandApplied = false;
|
|
28157
|
+
}
|
|
28158
|
+
isHeadingOneActive() {
|
|
28159
|
+
const state = this.editor.view.state;
|
|
28160
|
+
const headingType = state.schema.nodes.heading;
|
|
28161
|
+
if (!headingType) {
|
|
28162
|
+
return false;
|
|
28163
|
+
}
|
|
28164
|
+
const { $from, from, to } = state.selection;
|
|
28165
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
28166
|
+
const node = $from.node(depth);
|
|
28167
|
+
if (node.type === headingType && node.attrs.level === 1) {
|
|
28168
|
+
return true;
|
|
28169
|
+
}
|
|
28170
|
+
}
|
|
28171
|
+
let isActive = false;
|
|
28172
|
+
state.doc.nodesBetween(from, to, (node) => {
|
|
28173
|
+
if (node.type === headingType && node.attrs.level === 1) {
|
|
28174
|
+
isActive = true;
|
|
28175
|
+
return false;
|
|
28176
|
+
}
|
|
28177
|
+
return true;
|
|
28178
|
+
});
|
|
28179
|
+
return isActive;
|
|
28180
|
+
}
|
|
27121
28181
|
isPlainParagraphActive() {
|
|
27122
28182
|
return this.isNodeActive('paragraph') &&
|
|
27123
28183
|
!this.isNodeActive('list_item') &&
|
|
@@ -27191,7 +28251,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27191
28251
|
} if (rf & 2) {
|
|
27192
28252
|
let _t;
|
|
27193
28253
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.editorHost = _t.first);
|
|
27194
|
-
} }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls:
|
|
28254
|
+
} }, 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
28255
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
27196
28256
|
i0.ɵɵelementStart(0, "div", 1)(1, "div", 2);
|
|
27197
28257
|
i0.ɵɵtemplate(2, WriteRichTextAreaFieldComponent_span_2_Template, 3, 3, "span", 3);
|
|
@@ -27201,80 +28261,100 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27201
28261
|
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
28262
|
i0.ɵɵelementStart(7, "div", 7)(8, "button", 8);
|
|
27203
28263
|
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.ɵɵ
|
|
28264
|
+
i0.ɵɵnamespaceSVG();
|
|
28265
|
+
i0.ɵɵelementStart(9, "svg", 9);
|
|
28266
|
+
i0.ɵɵelement(10, "path", 10);
|
|
27206
28267
|
i0.ɵɵelementEnd()();
|
|
27207
|
-
i0.ɵɵ
|
|
28268
|
+
i0.ɵɵnamespaceHTML();
|
|
28269
|
+
i0.ɵɵelementStart(11, "button", 11);
|
|
27208
28270
|
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.ɵɵ
|
|
28271
|
+
i0.ɵɵnamespaceSVG();
|
|
28272
|
+
i0.ɵɵelementStart(12, "svg", 9);
|
|
28273
|
+
i0.ɵɵelement(13, "path", 12);
|
|
27211
28274
|
i0.ɵɵelementEnd()();
|
|
27212
|
-
i0.ɵɵ
|
|
27213
|
-
i0.ɵɵ
|
|
28275
|
+
i0.ɵɵnamespaceHTML();
|
|
28276
|
+
i0.ɵɵelement(14, "span", 13);
|
|
28277
|
+
i0.ɵɵelementStart(15, "button", 14);
|
|
27214
28278
|
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.ɵɵ
|
|
28279
|
+
i0.ɵɵnamespaceSVG();
|
|
28280
|
+
i0.ɵɵelementStart(16, "svg", 9);
|
|
28281
|
+
i0.ɵɵelement(17, "path", 15);
|
|
27217
28282
|
i0.ɵɵelementEnd()();
|
|
27218
|
-
i0.ɵɵ
|
|
28283
|
+
i0.ɵɵnamespaceHTML();
|
|
28284
|
+
i0.ɵɵelementStart(18, "button", 16);
|
|
27219
28285
|
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.ɵɵ
|
|
28286
|
+
i0.ɵɵnamespaceSVG();
|
|
28287
|
+
i0.ɵɵelementStart(19, "svg", 9);
|
|
28288
|
+
i0.ɵɵelement(20, "path", 17);
|
|
27222
28289
|
i0.ɵɵelementEnd()();
|
|
27223
|
-
i0.ɵɵ
|
|
28290
|
+
i0.ɵɵnamespaceHTML();
|
|
28291
|
+
i0.ɵɵelementStart(21, "button", 18);
|
|
27224
28292
|
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.ɵɵ
|
|
28293
|
+
i0.ɵɵnamespaceSVG();
|
|
28294
|
+
i0.ɵɵelementStart(22, "svg", 9);
|
|
28295
|
+
i0.ɵɵelement(23, "path", 19);
|
|
27227
28296
|
i0.ɵɵelementEnd()();
|
|
27228
|
-
i0.ɵɵ
|
|
28297
|
+
i0.ɵɵnamespaceHTML();
|
|
28298
|
+
i0.ɵɵelementStart(24, "button", 20);
|
|
27229
28299
|
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",
|
|
28300
|
+
i0.ɵɵelementStart(25, "span", 21);
|
|
27231
28301
|
i0.ɵɵtext(26, "P");
|
|
27232
28302
|
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);
|
|
28303
|
+
i0.ɵɵelementStart(27, "button", 22);
|
|
28304
|
+
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")); });
|
|
28305
|
+
i0.ɵɵelementStart(28, "span", 23);
|
|
28306
|
+
i0.ɵɵtext(29, "H");
|
|
28307
|
+
i0.ɵɵelementEnd()();
|
|
28308
|
+
i0.ɵɵelement(30, "span", 13);
|
|
28309
|
+
i0.ɵɵelementStart(31, "button", 24);
|
|
28310
|
+
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")); });
|
|
28311
|
+
i0.ɵɵnamespaceSVG();
|
|
28312
|
+
i0.ɵɵelementStart(32, "svg", 9);
|
|
28313
|
+
i0.ɵɵelement(33, "path", 25);
|
|
27247
28314
|
i0.ɵɵelementEnd()();
|
|
27248
|
-
i0.ɵɵ
|
|
27249
|
-
i0.ɵɵ
|
|
27250
|
-
i0.ɵɵ
|
|
27251
|
-
i0.ɵɵ
|
|
28315
|
+
i0.ɵɵnamespaceHTML();
|
|
28316
|
+
i0.ɵɵelementStart(34, "button", 26);
|
|
28317
|
+
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")); });
|
|
28318
|
+
i0.ɵɵnamespaceSVG();
|
|
28319
|
+
i0.ɵɵelementStart(35, "svg", 9);
|
|
28320
|
+
i0.ɵɵelement(36, "path", 27);
|
|
28321
|
+
i0.ɵɵelementEnd()();
|
|
28322
|
+
i0.ɵɵnamespaceHTML();
|
|
28323
|
+
i0.ɵɵelementStart(37, "div", 28)(38, "label", 29);
|
|
28324
|
+
i0.ɵɵtext(39, "List style");
|
|
27252
28325
|
i0.ɵɵelementEnd();
|
|
27253
|
-
i0.ɵɵ
|
|
27254
|
-
i0.ɵɵ
|
|
27255
|
-
i0.ɵɵ
|
|
28326
|
+
i0.ɵɵelementStart(40, "select", 30);
|
|
28327
|
+
i0.ɵɵlistener("change", function WriteRichTextAreaFieldComponent_Template_select_change_40_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onListStyleChange($event)); });
|
|
28328
|
+
i0.ɵɵtemplate(41, WriteRichTextAreaFieldComponent_option_41_Template, 2, 0, "option", 31);
|
|
28329
|
+
i0.ɵɵelementStart(42, "option", 32);
|
|
28330
|
+
i0.ɵɵtext(43, "Numbers (1, 2, 3)");
|
|
27256
28331
|
i0.ɵɵelementEnd();
|
|
27257
|
-
i0.ɵɵ
|
|
27258
|
-
i0.ɵɵ
|
|
27259
|
-
i0.ɵɵtext(47, "\u2022");
|
|
28332
|
+
i0.ɵɵelementStart(44, "option", 33);
|
|
28333
|
+
i0.ɵɵtext(45, "Letters (a, b, c)");
|
|
27260
28334
|
i0.ɵɵelementEnd();
|
|
27261
|
-
i0.ɵɵ
|
|
27262
|
-
i0.ɵɵ
|
|
27263
|
-
i0.ɵɵ
|
|
28335
|
+
i0.ɵɵelementStart(46, "option", 34);
|
|
28336
|
+
i0.ɵɵtext(47, "Roman numerals (i), (ii), (iii)");
|
|
28337
|
+
i0.ɵɵelementEnd()()();
|
|
28338
|
+
i0.ɵɵelement(48, "span", 13);
|
|
28339
|
+
i0.ɵɵelementStart(49, "button", 35);
|
|
27264
28340
|
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.ɵɵ
|
|
28341
|
+
i0.ɵɵnamespaceSVG();
|
|
28342
|
+
i0.ɵɵelementStart(50, "svg", 9);
|
|
28343
|
+
i0.ɵɵelement(51, "path", 36);
|
|
27267
28344
|
i0.ɵɵelementEnd()();
|
|
27268
|
-
i0.ɵɵ
|
|
27269
|
-
i0.ɵɵ
|
|
27270
|
-
i0.ɵɵ
|
|
27271
|
-
i0.ɵɵ
|
|
28345
|
+
i0.ɵɵnamespaceHTML();
|
|
28346
|
+
i0.ɵɵelementStart(52, "button", 37);
|
|
28347
|
+
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")); });
|
|
28348
|
+
i0.ɵɵnamespaceSVG();
|
|
28349
|
+
i0.ɵɵelementStart(53, "svg", 9);
|
|
28350
|
+
i0.ɵɵelement(54, "path", 38);
|
|
27272
28351
|
i0.ɵɵelementEnd()()();
|
|
27273
|
-
i0.ɵɵ
|
|
27274
|
-
i0.ɵɵ
|
|
28352
|
+
i0.ɵɵnamespaceHTML();
|
|
28353
|
+
i0.ɵɵelementStart(55, "div", 39)(56, "ngx-editor", 40);
|
|
28354
|
+
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
28355
|
i0.ɵɵelementEnd()()()();
|
|
27276
28356
|
} if (rf & 2) {
|
|
27277
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28357
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(27, _c1$e, !ctx.richTextAreaControl.valid && ctx.richTextAreaControl.dirty));
|
|
27278
28358
|
i0.ɵɵadvance();
|
|
27279
28359
|
i0.ɵɵproperty("id", ctx.labelId());
|
|
27280
28360
|
i0.ɵɵadvance();
|
|
@@ -27284,39 +28364,48 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
|
|
|
27284
28364
|
i0.ɵɵadvance();
|
|
27285
28365
|
i0.ɵɵproperty("ngIf", ctx.isInvalid());
|
|
27286
28366
|
i0.ɵɵadvance();
|
|
27287
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28367
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(29, _c2$3, ctx.isInvalid()));
|
|
27288
28368
|
i0.ɵɵadvance(2);
|
|
27289
28369
|
i0.ɵɵattribute("aria-label", ctx.toolbarLabel());
|
|
27290
28370
|
i0.ɵɵadvance(8);
|
|
27291
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28371
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(31, _c3, ctx.isToolbarCommandActive("bold")));
|
|
27292
28372
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("bold"));
|
|
27293
28373
|
i0.ɵɵadvance(3);
|
|
27294
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28374
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(33, _c3, ctx.isToolbarCommandActive("italic")));
|
|
27295
28375
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("italic"));
|
|
27296
28376
|
i0.ɵɵadvance(3);
|
|
27297
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28377
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(35, _c3, ctx.isToolbarCommandActive("underline")));
|
|
27298
28378
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("underline"));
|
|
27299
28379
|
i0.ɵɵadvance(3);
|
|
27300
|
-
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(
|
|
28380
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(37, _c3, ctx.isToolbarCommandActive("paragraph")));
|
|
27301
28381
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("paragraph"));
|
|
27302
28382
|
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(
|
|
28383
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(39, _c3, ctx.isToolbarCommandActive("heading")));
|
|
28384
|
+
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("heading"));
|
|
28385
|
+
i0.ɵɵadvance(4);
|
|
28386
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(41, _c3, ctx.isToolbarCommandActive("bullet_list")));
|
|
27307
28387
|
i0.ɵɵattribute("aria-pressed", ctx.isToolbarCommandActive("bullet_list"));
|
|
27308
|
-
i0.ɵɵadvance(
|
|
28388
|
+
i0.ɵɵadvance(3);
|
|
28389
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(43, _c3, ctx.isOrderedListActive()));
|
|
28390
|
+
i0.ɵɵattribute("aria-pressed", ctx.isOrderedListActive());
|
|
28391
|
+
i0.ɵɵadvance(4);
|
|
28392
|
+
i0.ɵɵproperty("for", ctx.listStyleId());
|
|
28393
|
+
i0.ɵɵadvance(2);
|
|
28394
|
+
i0.ɵɵproperty("id", ctx.listStyleId())("value", ctx.currentListSelectValue());
|
|
28395
|
+
i0.ɵɵadvance();
|
|
28396
|
+
i0.ɵɵproperty("ngIf", !ctx.isOrderedListActive());
|
|
28397
|
+
i0.ɵɵadvance(15);
|
|
27309
28398
|
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:
|
|
28399
|
+
} }, 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
28400
|
}
|
|
27312
28401
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteRichTextAreaFieldComponent, [{
|
|
27313
28402
|
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"] }]
|
|
28403
|
+
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
28404
|
}], null, { editorHost: [{
|
|
27316
28405
|
type: ViewChild,
|
|
27317
28406
|
args: ['editorHost']
|
|
27318
28407
|
}] }); })();
|
|
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:
|
|
28408
|
+
(() => { (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
28409
|
|
|
27321
28410
|
class ReadTextFieldComponent extends AbstractFieldReadComponent {
|
|
27322
28411
|
static ɵfac = /*@__PURE__*/ (() => { let ɵReadTextFieldComponent_BaseFactory; return function ReadTextFieldComponent_Factory(__ngFactoryType__) { return (ɵReadTextFieldComponent_BaseFactory || (ɵReadTextFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadTextFieldComponent)))(__ngFactoryType__ || ReadTextFieldComponent); }; })();
|