@provoly/dashboard 0.25.0 → 0.25.2
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/assets/svgs/format_bold.svg +1 -0
- package/assets/svgs/format_details.svg +1 -0
- package/assets/svgs/format_italic.svg +1 -0
- package/assets/svgs/format_list_bulleted.svg +1 -0
- package/assets/svgs/format_list_numbered.svg +1 -0
- package/assets/svgs/format_quote.svg +1 -0
- package/assets/svgs/format_strikethrough.svg +1 -0
- package/assets/svgs/format_table.svg +1 -0
- package/assets/svgs/format_title.svg +1 -0
- package/assets/svgs/format_underlined.svg +1 -0
- package/components/text-editor/component/text-editor.component.d.ts +38 -0
- package/components/text-editor/i18n/en.translations.d.ts +22 -0
- package/components/text-editor/i18n/fr.translations.d.ts +22 -0
- package/components/text-editor/index.d.ts +5 -0
- package/components/text-editor/mdToHtml.pipe.d.ts +7 -0
- package/components/text-editor/public-api.d.ts +5 -0
- package/components/text-editor/service/text-editor.service.d.ts +40 -0
- package/components/text-editor/style/_o-text-editor.scss +120 -0
- package/components/text-editor/style/css.component.d.ts +5 -0
- package/components/text-editor/text-editor.module.d.ts +17 -0
- package/dataset/components/dataset-detail/dataset-detail.component.d.ts +11 -4
- package/dataset/components/dataset-version-form/dataset-version-form.component.d.ts +23 -0
- package/dataset/dataset.module.d.ts +7 -5
- package/dataset/i18n/en.translations.d.ts +6 -0
- package/dataset/i18n/fr.translations.d.ts +6 -0
- package/dataset/style/_o-pry-dataset-detail.scss +61 -25
- package/dataset/style/_o-pry-dataset-version-form.scss +7 -0
- package/esm2022/admin/components/admin-classes/admin-classes-customize/admin-classes-customize.component.mjs +1 -1
- package/esm2022/admin/components/admin-classes/admin-classes-select/admin-classes-select.component.mjs +1 -1
- package/esm2022/admin/components/admin-classes/admin-classes-view/admin-attributes-select/admin-attributes-select.component.mjs +1 -1
- package/esm2022/admin/components/admin-dataset/admin-select-dataset/admin-select-dataset.component.mjs +1 -1
- package/esm2022/admin/components/admin-environment/admin-environment-select/admin-environment-select.component.mjs +1 -1
- package/esm2022/admin/components/admin-fields/admin-fields-select/admin-fields-select.component.mjs +1 -1
- package/esm2022/admin/components/admin-metadata/admin-select-metadata/admin-select-metadata.component.mjs +1 -1
- package/esm2022/admin/components/admin-metadata-rules/admin-select-metadata-rules/admin-select-metadata-rules.component.mjs +1 -1
- package/esm2022/admin/components/admin-metadata-user/admin-user-select-metadata/admin-user-select-metadata.component.mjs +1 -1
- package/esm2022/admin/components/admin-predicates/admin-predicates-select/admin-predicates-select.component.mjs +1 -1
- package/esm2022/admin/components/admin-relation-types/admin-relation-types-select/admin-relation-types-select.component.mjs +1 -1
- package/esm2022/admin/components/admin-user/admin-user-select/admin-user-select.component.mjs +1 -1
- package/esm2022/components/text-editor/component/text-editor.component.mjs +126 -0
- package/esm2022/components/text-editor/i18n/en.translations.mjs +23 -0
- package/esm2022/components/text-editor/i18n/fr.translations.mjs +23 -0
- package/esm2022/components/text-editor/mdToHtml.pipe.mjs +17 -0
- package/esm2022/components/text-editor/provoly-dashboard-components-text-editor.mjs +5 -0
- package/esm2022/components/text-editor/public-api.mjs +6 -0
- package/esm2022/components/text-editor/service/text-editor.service.mjs +136 -0
- package/esm2022/components/text-editor/style/css.component.mjs +11 -0
- package/esm2022/components/text-editor/text-editor.module.mjs +32 -0
- package/esm2022/dataset/components/dataset-card/dataset-card.component.mjs +1 -1
- package/esm2022/dataset/components/dataset-detail/dataset-detail.component.mjs +42 -9
- package/esm2022/dataset/components/dataset-version-form/dataset-version-form.component.mjs +58 -0
- package/esm2022/dataset/dataset.module.mjs +25 -8
- package/esm2022/dataset/i18n/en.translations.mjs +7 -1
- package/esm2022/dataset/i18n/fr.translations.mjs +7 -1
- package/esm2022/dataset/style/css.component.mjs +3 -3
- package/esm2022/filters/autocomplete/autocomplete.component.mjs +2 -2
- package/esm2022/import/components/import.component.mjs +39 -21
- package/esm2022/import/import.module.mjs +12 -5
- package/esm2022/import/store/import.actions.mjs +1 -1
- package/esm2022/import/store/import.effects.mjs +4 -2
- package/esm2022/import/store/import.service.mjs +3 -2
- package/esm2022/lib/core/components/share/group-share/group-share.component.mjs +3 -3
- package/esm2022/lib/core/components/tabs/tab-group.component.mjs +7 -3
- package/esm2022/lib/core/i18n/en.translations.mjs +4 -3
- package/esm2022/lib/core/i18n/fr.translations.mjs +2 -1
- package/esm2022/lib/core/store/data-source/data-source.actions.mjs +4 -2
- package/esm2022/lib/core/store/data-source/data-source.effects.mjs +2 -1
- package/esm2022/lib/core/store/data-source/data-source.model.mjs +1 -1
- package/esm2022/lib/core/store/data-source/data-source.reducer.mjs +4 -1
- package/esm2022/lib/core/store/data-source/data-source.service.mjs +13 -1
- package/esm2022/lib/core/store/search/filter-param-encoder.mjs +27 -0
- package/esm2022/lib/core/store/search/search.selectors.mjs +2 -2
- package/esm2022/lib/core/store/search/search.service.mjs +4 -3
- package/esm2022/restitution/style/css.component.mjs +2 -2
- package/esm2022/toolbox/components/share/share.component.mjs +47 -18
- package/esm2022/toolbox/style/css.component.mjs +2 -2
- package/esm2022/widgets/widget-map/component/widget-map.component.mjs +3 -3
- package/fesm2022/provoly-dashboard-admin.mjs +12 -12
- package/fesm2022/provoly-dashboard-admin.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-components-text-editor.mjs +356 -0
- package/fesm2022/provoly-dashboard-components-text-editor.mjs.map +1 -0
- package/fesm2022/provoly-dashboard-dataset.mjs +128 -18
- package/fesm2022/provoly-dashboard-dataset.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-filters-autocomplete.mjs +1 -1
- package/fesm2022/provoly-dashboard-filters-autocomplete.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-import.mjs +53 -25
- package/fesm2022/provoly-dashboard-import.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-restitution.mjs +2 -2
- package/fesm2022/provoly-dashboard-restitution.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-toolbox.mjs +47 -19
- package/fesm2022/provoly-dashboard-toolbox.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-widgets-widget-map.mjs +2 -2
- package/fesm2022/provoly-dashboard-widgets-widget-map.mjs.map +1 -1
- package/fesm2022/provoly-dashboard.mjs +72 -10
- package/fesm2022/provoly-dashboard.mjs.map +1 -1
- package/import/components/import.component.d.ts +10 -5
- package/import/import.module.d.ts +2 -1
- package/import/store/import.actions.d.ts +2 -0
- package/import/store/import.service.d.ts +1 -1
- package/lib/core/components/tabs/tab-group.component.d.ts +3 -2
- package/lib/core/i18n/en.translations.d.ts +2 -1
- package/lib/core/i18n/fr.translations.d.ts +1 -0
- package/lib/core/store/data-source/data-source.actions.d.ts +10 -0
- package/lib/core/store/data-source/data-source.effects.d.ts +8 -5
- package/lib/core/store/data-source/data-source.model.d.ts +3 -0
- package/lib/core/store/data-source/data-source.service.d.ts +2 -0
- package/lib/core/store/search/filter-param-encoder.d.ts +5 -0
- package/package.json +36 -30
- package/restitution/style/_o-restitution.scss +0 -1
- package/styles/base/_utils.scss +4 -0
- package/styles/components/_o-text-panel.scss +64 -0
- package/styles/main.scss +1 -0
- package/styles-theme/components-theme/_a-form-field.theme.scss +2 -0
- package/toolbox/components/share/share.component.d.ts +13 -7
- package/toolbox/style/_o-dashboard-details.component.scss +3 -25
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Component, ViewEncapsulation, Injectable, Pipe, Input, ViewChild, NgModule } from '@angular/core';
|
|
4
|
+
import * as i2 from '@angular/forms';
|
|
5
|
+
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import * as i3 from '@provoly/dashboard';
|
|
7
|
+
import { PryCoreModule, PryIconModule, PryI18nModule } from '@provoly/dashboard';
|
|
8
|
+
import { Subject, distinctUntilChanged } from 'rxjs';
|
|
9
|
+
import { debounceTime } from 'rxjs/operators';
|
|
10
|
+
import { marked } from 'marked';
|
|
11
|
+
import { CdkOverlayOrigin, CdkConnectedOverlay } from '@angular/cdk/overlay';
|
|
12
|
+
import { PryToolboxModule } from '@provoly/dashboard/toolbox';
|
|
13
|
+
|
|
14
|
+
class PryTextEditorCssComponent {
|
|
15
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PryTextEditorCssComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
16
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: PryTextEditorCssComponent, selector: "pry-text-editor-css", ngImport: i0, template: '', isInline: true, styles: [".o-draggable-menu__list,.o-draggable-menu__list__submenu{margin:0;padding:0}.o-draggable-menu__list li,.o-draggable-menu__list__submenu li{list-style:none}.o-text-editor__preview h1,.o-text-editor__preview h2,.o-text-editor__preview h3,.o-text-editor__preview h4,.o-text-editor__preview h5,.o-text-editor__preview h6{padding:0;margin:0;color:#253043}.o-text-editor__preview h5{font-size:.875rem}.o-text-editor__preview span,.o-text-editor__preview p{font-size:.875rem;color:#263340;white-space:pre-wrap}.o-text-editor__preview div{padding-bottom:10px}.o-text-editor__preview ul,.o-text-editor__preview ol{margin:0;line-height:1rem}.o-text-editor__preview li{color:#253043;font-size:.875rem}.o-text-editor__preview table{border-collapse:collapse}.o-text-editor__preview table thead tr{border-bottom-width:.0625rem;border-bottom-style:solid}.o-text-editor__preview table thead tr th{padding-top:.75rem;padding-bottom:.75rem;text-align:left}.o-text-editor__preview table tbody tr{border-bottom-width:.0625rem;border-bottom-style:solid}.o-text-editor__preview table tbody tr td{padding:.75rem .5rem;text-align:left}.o-draggable-menu,.o-draggable-menu--text-editor{display:flex;flex-direction:column;width:10.625rem;padding:.375rem}.o-draggable-menu.-dropdown,.-dropdown.o-draggable-menu--text-editor{width:fit-content}.o-draggable-menu.-dropdown button,.-dropdown.o-draggable-menu--text-editor button{border:none}.o-draggable-menu__list__item .a-btn,.o-draggable-menu__list__item .a-link{display:flex;align-items:center;justify-content:flex-start;gap:.3125rem;width:100%;min-width:max-content;height:auto;padding:.25rem .625rem;word-break:keep-all;cursor:pointer}.o-draggable-menu__list__item .a-btn[aria-expanded=true]+.o-draggable-menu__list__submenu,.o-draggable-menu__list__item .a-btn:hover+.o-draggable-menu__list__submenu,.o-draggable-menu__list__item .a-link[aria-expanded=true]+.o-draggable-menu__list__submenu,.o-draggable-menu__list__item .a-link:hover+.o-draggable-menu__list__submenu{display:block}.o-draggable-menu__list__submenu{position:absolute;left:96%;display:none;min-width:max-content;margin-top:-2.1875rem;padding:.375rem}.o-draggable-menu__list__submenu [draggable]{cursor:move}.o-draggable-menu__list__submenu.is-active,.o-draggable-menu__list__submenu:hover{display:block}.o-draggable-menu,.o-draggable-menu--text-editor{border-radius:.5rem;background-color:#fff;box-shadow:0 1px 3px #0000001a}.o-draggable-menu__list__item .a-btn,.o-draggable-menu__list__item .a-link{border-radius:.375rem;font-family:Ubuntu,sans-serif;font-size:.875rem;line-height:1.0625rem;font-weight:400;font-style:normal}.o-draggable-menu__list__submenu{border-radius:.3125rem;background-color:#fff;box-shadow:0 1px 3px #0000001a}.o-text-editor{display:flex;flex-direction:column}.o-text-editor__header{display:flex;justify-content:space-between;align-items:center}.o-text-editor__header>.a-tooltip:last-child.a-tooltip[data-tooltip][data-tooltip-position=bottom]:after{left:calc(50% - 15px)}.o-text-editor__tabs{display:flex;gap:.3125rem}.o-text-editor__tab{padding:0 .625rem;font-size:.625rem;height:1.125rem;margin-top:-3px}.o-text-editor__tab.-active{margin-top:-1px;background-color:#fff;border:1px solid #BCCAD8;border-top:none;border-radius:0 0 4px 4px;font-weight:700;z-index:2}.o-text-editor__buttons{display:flex;flex-wrap:wrap;align-items:center}.o-text-editor__button{padding:.3125rem;overflow:visible;color:#113b6e}.o-text-editor__button:hover{transition:background-color .3s ease,color .3s ease;background-color:#d8e7f7}.o-text-editor__content{display:flex;gap:.625rem;min-height:12.6875rem;width:100%}.o-text-editor__tab-panel{width:100%}.o-text-editor__textarea.-half-width{flex-grow:0;width:auto}.o-text-editor__textarea.-full-width{flex-grow:1;width:100%}.o-text-editor__textarea.-remove-corner-radius{border-bottom-left-radius:0}.o-text-editor__preview{flex:1;background-color:#fff;padding:.4375rem .75rem .25rem;border:1px solid #BCCAD8;border-radius:4px;width:100%;height:100%;overflow-y:auto}.o-draggable-menu--text-editor{display:flex;flex-direction:column}.o-draggable-menu--text-editor .o-draggable-menu__list__item{width:100%;font-size:.875rem}.o-draggable-menu--text-editor .o-text-editor__button{display:flex;align-items:center;gap:.3125rem}\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
|
17
|
+
}
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PryTextEditorCssComponent, decorators: [{
|
|
19
|
+
type: Component,
|
|
20
|
+
args: [{ selector: 'pry-text-editor-css', template: '', encapsulation: ViewEncapsulation.None, styles: [".o-draggable-menu__list,.o-draggable-menu__list__submenu{margin:0;padding:0}.o-draggable-menu__list li,.o-draggable-menu__list__submenu li{list-style:none}.o-text-editor__preview h1,.o-text-editor__preview h2,.o-text-editor__preview h3,.o-text-editor__preview h4,.o-text-editor__preview h5,.o-text-editor__preview h6{padding:0;margin:0;color:#253043}.o-text-editor__preview h5{font-size:.875rem}.o-text-editor__preview span,.o-text-editor__preview p{font-size:.875rem;color:#263340;white-space:pre-wrap}.o-text-editor__preview div{padding-bottom:10px}.o-text-editor__preview ul,.o-text-editor__preview ol{margin:0;line-height:1rem}.o-text-editor__preview li{color:#253043;font-size:.875rem}.o-text-editor__preview table{border-collapse:collapse}.o-text-editor__preview table thead tr{border-bottom-width:.0625rem;border-bottom-style:solid}.o-text-editor__preview table thead tr th{padding-top:.75rem;padding-bottom:.75rem;text-align:left}.o-text-editor__preview table tbody tr{border-bottom-width:.0625rem;border-bottom-style:solid}.o-text-editor__preview table tbody tr td{padding:.75rem .5rem;text-align:left}.o-draggable-menu,.o-draggable-menu--text-editor{display:flex;flex-direction:column;width:10.625rem;padding:.375rem}.o-draggable-menu.-dropdown,.-dropdown.o-draggable-menu--text-editor{width:fit-content}.o-draggable-menu.-dropdown button,.-dropdown.o-draggable-menu--text-editor button{border:none}.o-draggable-menu__list__item .a-btn,.o-draggable-menu__list__item .a-link{display:flex;align-items:center;justify-content:flex-start;gap:.3125rem;width:100%;min-width:max-content;height:auto;padding:.25rem .625rem;word-break:keep-all;cursor:pointer}.o-draggable-menu__list__item .a-btn[aria-expanded=true]+.o-draggable-menu__list__submenu,.o-draggable-menu__list__item .a-btn:hover+.o-draggable-menu__list__submenu,.o-draggable-menu__list__item .a-link[aria-expanded=true]+.o-draggable-menu__list__submenu,.o-draggable-menu__list__item .a-link:hover+.o-draggable-menu__list__submenu{display:block}.o-draggable-menu__list__submenu{position:absolute;left:96%;display:none;min-width:max-content;margin-top:-2.1875rem;padding:.375rem}.o-draggable-menu__list__submenu [draggable]{cursor:move}.o-draggable-menu__list__submenu.is-active,.o-draggable-menu__list__submenu:hover{display:block}.o-draggable-menu,.o-draggable-menu--text-editor{border-radius:.5rem;background-color:#fff;box-shadow:0 1px 3px #0000001a}.o-draggable-menu__list__item .a-btn,.o-draggable-menu__list__item .a-link{border-radius:.375rem;font-family:Ubuntu,sans-serif;font-size:.875rem;line-height:1.0625rem;font-weight:400;font-style:normal}.o-draggable-menu__list__submenu{border-radius:.3125rem;background-color:#fff;box-shadow:0 1px 3px #0000001a}.o-text-editor{display:flex;flex-direction:column}.o-text-editor__header{display:flex;justify-content:space-between;align-items:center}.o-text-editor__header>.a-tooltip:last-child.a-tooltip[data-tooltip][data-tooltip-position=bottom]:after{left:calc(50% - 15px)}.o-text-editor__tabs{display:flex;gap:.3125rem}.o-text-editor__tab{padding:0 .625rem;font-size:.625rem;height:1.125rem;margin-top:-3px}.o-text-editor__tab.-active{margin-top:-1px;background-color:#fff;border:1px solid #BCCAD8;border-top:none;border-radius:0 0 4px 4px;font-weight:700;z-index:2}.o-text-editor__buttons{display:flex;flex-wrap:wrap;align-items:center}.o-text-editor__button{padding:.3125rem;overflow:visible;color:#113b6e}.o-text-editor__button:hover{transition:background-color .3s ease,color .3s ease;background-color:#d8e7f7}.o-text-editor__content{display:flex;gap:.625rem;min-height:12.6875rem;width:100%}.o-text-editor__tab-panel{width:100%}.o-text-editor__textarea.-half-width{flex-grow:0;width:auto}.o-text-editor__textarea.-full-width{flex-grow:1;width:100%}.o-text-editor__textarea.-remove-corner-radius{border-bottom-left-radius:0}.o-text-editor__preview{flex:1;background-color:#fff;padding:.4375rem .75rem .25rem;border:1px solid #BCCAD8;border-radius:4px;width:100%;height:100%;overflow-y:auto}.o-draggable-menu--text-editor{display:flex;flex-direction:column}.o-draggable-menu--text-editor .o-draggable-menu__list__item{width:100%;font-size:.875rem}.o-draggable-menu--text-editor .o-text-editor__button{display:flex;align-items:center;gap:.3125rem}\n"] }]
|
|
21
|
+
}] });
|
|
22
|
+
|
|
23
|
+
const mdStyles = {
|
|
24
|
+
h1: '# ',
|
|
25
|
+
h2: '## ',
|
|
26
|
+
h3: '### ',
|
|
27
|
+
h4: '#### ',
|
|
28
|
+
h5: '##### ',
|
|
29
|
+
h6: '###### ',
|
|
30
|
+
bold: '**',
|
|
31
|
+
italic: '*',
|
|
32
|
+
underline: '<u>',
|
|
33
|
+
strikeThrough: '~~',
|
|
34
|
+
code: '`',
|
|
35
|
+
blockquote: '> ',
|
|
36
|
+
list: '- ',
|
|
37
|
+
orderedList: '\\d+\\. ',
|
|
38
|
+
table: '| | |\n| --- | --- |\n| | |',
|
|
39
|
+
details: '<details>\n<summary></summary>\n'
|
|
40
|
+
};
|
|
41
|
+
const wrapperStyles = ['bold', 'italic', 'underline', 'strikeThrough', 'code'];
|
|
42
|
+
const selfClosingStyles = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
43
|
+
const listStyles = ['blockquote', 'list', 'orderedList'];
|
|
44
|
+
const otherStyles = ['table', 'details'];
|
|
45
|
+
class TextEditorService {
|
|
46
|
+
constructor() { }
|
|
47
|
+
getClosingTag(style) {
|
|
48
|
+
switch (style) {
|
|
49
|
+
case 'underline':
|
|
50
|
+
return '</u>';
|
|
51
|
+
case 'details':
|
|
52
|
+
return '\n</details>';
|
|
53
|
+
case 'bold':
|
|
54
|
+
case 'italic':
|
|
55
|
+
case 'strikeThrough':
|
|
56
|
+
case 'code':
|
|
57
|
+
return mdStyles[style];
|
|
58
|
+
default:
|
|
59
|
+
return '';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
addMarkdown(text, style) {
|
|
63
|
+
if (wrapperStyles.includes(style)) {
|
|
64
|
+
return this.toggleWrapperStyle(text, style);
|
|
65
|
+
}
|
|
66
|
+
if (selfClosingStyles.includes(style)) {
|
|
67
|
+
return this.toggleSelfClosingStyle(text, style);
|
|
68
|
+
}
|
|
69
|
+
if (listStyles.includes(style)) {
|
|
70
|
+
return this.toggleListStyle(text, style);
|
|
71
|
+
}
|
|
72
|
+
if (otherStyles.includes(style)) {
|
|
73
|
+
return this.insertOtherStyle(text, style);
|
|
74
|
+
}
|
|
75
|
+
console.error(`Markdown style ${style} not supported`);
|
|
76
|
+
return text;
|
|
77
|
+
}
|
|
78
|
+
toggleWrapperStyle(text, style) {
|
|
79
|
+
if (text.startsWith(mdStyles[style])) {
|
|
80
|
+
const startRegex = new RegExp(`^${this.escapeRegExp(mdStyles[style])}`);
|
|
81
|
+
const endRegex = new RegExp(`${this.escapeRegExp(this.getClosingTag(style))}$`);
|
|
82
|
+
return text.replace(startRegex, '').replace(endRegex, '');
|
|
83
|
+
}
|
|
84
|
+
return `${mdStyles[style]}${text}${this.getClosingTag(style)}`;
|
|
85
|
+
}
|
|
86
|
+
toggleSelfClosingStyle(text, style) {
|
|
87
|
+
if (text.startsWith(mdStyles[style])) {
|
|
88
|
+
const startRegex = new RegExp(`^${this.escapeRegExp(mdStyles[style])}`);
|
|
89
|
+
return text.replace(startRegex, '');
|
|
90
|
+
}
|
|
91
|
+
return `${mdStyles[style]}${text}`;
|
|
92
|
+
}
|
|
93
|
+
toggleListStyle(text, style) {
|
|
94
|
+
const listStyle = mdStyles[style];
|
|
95
|
+
const lines = text.split('\n');
|
|
96
|
+
const startRegex = new RegExp(`^${style === 'orderedList' ? listStyle : this.escapeRegExp(listStyle)}`);
|
|
97
|
+
const isListAlready = lines.every((line) => startRegex.test(line));
|
|
98
|
+
const newLines = lines.map((line, index) => {
|
|
99
|
+
if (isListAlready) {
|
|
100
|
+
return line.replace(startRegex, '');
|
|
101
|
+
}
|
|
102
|
+
return `${style === 'orderedList' ? (index + 1).toString() + '. ' : listStyle}${line}`;
|
|
103
|
+
});
|
|
104
|
+
return newLines.join('\n');
|
|
105
|
+
}
|
|
106
|
+
insertOtherStyle(text, style) {
|
|
107
|
+
return `${mdStyles[style]}${text}${this.getClosingTag(style)}`;
|
|
108
|
+
}
|
|
109
|
+
escapeRegExp(text) {
|
|
110
|
+
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
111
|
+
}
|
|
112
|
+
isListLine(line) {
|
|
113
|
+
return /^(\d+\.|- |\* |\> )/.test(line);
|
|
114
|
+
}
|
|
115
|
+
isOrderedListLine(text) {
|
|
116
|
+
return /^\d+\./.test(text);
|
|
117
|
+
}
|
|
118
|
+
getListCharacter(previousLine) {
|
|
119
|
+
if (this.isOrderedListLine(previousLine)) {
|
|
120
|
+
const match = previousLine.match(/^\d+/)?.[0];
|
|
121
|
+
return (parseInt(match ?? '1') + 1).toString() + '. ';
|
|
122
|
+
}
|
|
123
|
+
if (/^- /.test(previousLine)) {
|
|
124
|
+
return '- ';
|
|
125
|
+
}
|
|
126
|
+
if (/^\* /.test(previousLine)) {
|
|
127
|
+
return '* ';
|
|
128
|
+
}
|
|
129
|
+
if (/^\> /.test(previousLine)) {
|
|
130
|
+
return '> ';
|
|
131
|
+
}
|
|
132
|
+
return 'list';
|
|
133
|
+
}
|
|
134
|
+
updateOrderedListLines(text) {
|
|
135
|
+
let order = 1;
|
|
136
|
+
return text
|
|
137
|
+
.split('\n')
|
|
138
|
+
.map((line) => {
|
|
139
|
+
if (/^\d+\./.test(line)) {
|
|
140
|
+
return line.replace(/^\d+\. /, `${order++}. `);
|
|
141
|
+
}
|
|
142
|
+
order = 1;
|
|
143
|
+
return line;
|
|
144
|
+
})
|
|
145
|
+
.join('\n');
|
|
146
|
+
}
|
|
147
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: TextEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
148
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: TextEditorService, providedIn: 'root' }); }
|
|
149
|
+
}
|
|
150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: TextEditorService, decorators: [{
|
|
151
|
+
type: Injectable,
|
|
152
|
+
args: [{
|
|
153
|
+
providedIn: 'root'
|
|
154
|
+
}]
|
|
155
|
+
}], ctorParameters: () => [] });
|
|
156
|
+
|
|
157
|
+
class MdToHtmlPipe {
|
|
158
|
+
transform(value) {
|
|
159
|
+
return marked.parse(value ?? '');
|
|
160
|
+
}
|
|
161
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: MdToHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
162
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.3", ngImport: i0, type: MdToHtmlPipe, name: "mdToHtml" }); }
|
|
163
|
+
}
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: MdToHtmlPipe, decorators: [{
|
|
165
|
+
type: Pipe,
|
|
166
|
+
args: [{
|
|
167
|
+
name: 'mdToHtml'
|
|
168
|
+
}]
|
|
169
|
+
}] });
|
|
170
|
+
|
|
171
|
+
class PryTextEditorComponent {
|
|
172
|
+
constructor(service) {
|
|
173
|
+
this.service = service;
|
|
174
|
+
this.value = '';
|
|
175
|
+
this.onChange = (value) => { };
|
|
176
|
+
this.onTouched = () => { };
|
|
177
|
+
this.touched = false;
|
|
178
|
+
this.disabled = false;
|
|
179
|
+
this.valueChanged$ = new Subject();
|
|
180
|
+
this.tabView = true;
|
|
181
|
+
this.tabs = ['write', 'preview'];
|
|
182
|
+
this.activeTab = 'write';
|
|
183
|
+
this.buttons = [
|
|
184
|
+
{ style: 'h3', icon: 'format_title' },
|
|
185
|
+
{ style: 'bold', icon: 'format_bold' },
|
|
186
|
+
{ style: 'italic', icon: 'format_italic' },
|
|
187
|
+
{ style: 'underline', icon: 'format_underlined' },
|
|
188
|
+
{ style: 'strikeThrough', icon: 'format_strikethrough' },
|
|
189
|
+
{ style: 'blockquote', icon: 'format_quote' },
|
|
190
|
+
{ style: 'list', icon: 'format_list_bulleted' },
|
|
191
|
+
{ style: 'orderedList', icon: 'format_list_numbered' },
|
|
192
|
+
{ style: 'table', icon: 'format_table' },
|
|
193
|
+
{ style: 'details', icon: 'format_details' }
|
|
194
|
+
];
|
|
195
|
+
this.valueChanged$.pipe(debounceTime(500), distinctUntilChanged()).subscribe((value) => {
|
|
196
|
+
this.onChange(value);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
writeValue(value) {
|
|
200
|
+
this.value = value;
|
|
201
|
+
}
|
|
202
|
+
registerOnChange(onChange) {
|
|
203
|
+
this.onChange = onChange;
|
|
204
|
+
}
|
|
205
|
+
registerOnTouched(onTouched) {
|
|
206
|
+
this.onTouched = onTouched;
|
|
207
|
+
}
|
|
208
|
+
markAsTouched() {
|
|
209
|
+
if (!this.touched) {
|
|
210
|
+
this.onTouched();
|
|
211
|
+
this.touched = true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
setDisabledState(disabled) {
|
|
215
|
+
this.disabled = disabled;
|
|
216
|
+
}
|
|
217
|
+
onValueChange($event) {
|
|
218
|
+
this.valueChanged$.next($event);
|
|
219
|
+
}
|
|
220
|
+
get textarea() {
|
|
221
|
+
return this.textareaRef.nativeElement;
|
|
222
|
+
}
|
|
223
|
+
getActiveTabIndex() {
|
|
224
|
+
return this.tabs.findIndex((t) => t === this.activeTab);
|
|
225
|
+
}
|
|
226
|
+
formatText(style) {
|
|
227
|
+
const start = listStyles.includes(style) ? this.getSelectionLineIndex() : this.textarea.selectionStart, selection = this.value.substring(start, this.textarea.selectionEnd);
|
|
228
|
+
this.writeValue(this.getUpdatedValue(this.service.addMarkdown(selection, style), start));
|
|
229
|
+
this.onChange(this.value);
|
|
230
|
+
this.focusSelection(start, start + this.service.addMarkdown(selection, style).length);
|
|
231
|
+
}
|
|
232
|
+
getUpdatedValue(value, lineStart) {
|
|
233
|
+
const len = this.value.length, start = lineStart ?? this.textarea.selectionStart;
|
|
234
|
+
return this.value.substring(0, start) + value + this.value.substring(this.textarea.selectionEnd, len);
|
|
235
|
+
}
|
|
236
|
+
getSelectionLineIndex() {
|
|
237
|
+
const previousNewlineIndex = this.value.substring(0, this.textarea.selectionStart).lastIndexOf('\n');
|
|
238
|
+
return previousNewlineIndex ? previousNewlineIndex + 1 : 0;
|
|
239
|
+
}
|
|
240
|
+
focusSelection(start, end) {
|
|
241
|
+
setTimeout(() => {
|
|
242
|
+
this.textarea.focus();
|
|
243
|
+
this.textarea.setSelectionRange(start, end);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
insertListStyleCharacter() {
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
const start = 0;
|
|
249
|
+
const end = this.textarea.selectionStart;
|
|
250
|
+
const text = this.value.substring(start, end);
|
|
251
|
+
const previousLine = text?.split('\n')[text?.split('\n').length - 2];
|
|
252
|
+
if (previousLine && this.service.isListLine(previousLine)) {
|
|
253
|
+
const updatedValue = this.getUpdatedValue(this.service.getListCharacter(previousLine));
|
|
254
|
+
this.writeValue(this.service.isOrderedListLine(previousLine)
|
|
255
|
+
? this.service.updateOrderedListLines(updatedValue)
|
|
256
|
+
: updatedValue);
|
|
257
|
+
this.onChange(this.value);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PryTextEditorComponent, deps: [{ token: TextEditorService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
262
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: PryTextEditorComponent, selector: "pry-text-editor", inputs: { tabView: "tabView" }, providers: [
|
|
263
|
+
{
|
|
264
|
+
provide: NG_VALUE_ACCESSOR,
|
|
265
|
+
multi: true,
|
|
266
|
+
useExisting: PryTextEditorComponent
|
|
267
|
+
}
|
|
268
|
+
], viewQueries: [{ propertyName: "textareaRef", first: true, predicate: ["textarea"], descendants: true }], ngImport: i0, template: "<pry-text-editor-css></pry-text-editor-css>\n<div class=\"o-text-editor\">\n <div class=\"o-text-editor__header\">\n <div class=\"o-text-editor__buttons\">\n @for (button of buttons; track button.style) {\n <button\n type=\"button\"\n class=\"o-text-editor__button a-tooltip\"\n (click)=\"formatText(button.style)\"\n [attr.data-tooltip]=\"'@pry.component.textEditor.' + button.style | i18n\"\n data-tooltip-position=\"bottom\"\n [attr.aria-label]=\"'@pry.component.textEditor.' + button.style | i18n\"\n >\n <pry-icon [height]=\"16\" [width]=\"16\" [iconSvg]=\"button.icon\"></pry-icon>\n </button>\n }\n </div>\n </div>\n <div class=\"o-text-editor__content\">\n @if (tabView) {\n <div\n class=\"o-text-editor__tab-panel\"\n [id]=\"'text-editor-panel-' + activeTab\"\n [attr.aria-labelledby]=\"'text-editor-tab-' + getActiveTabIndex()\"\n >\n @if (activeTab === 'write') {\n <textarea\n class=\"o-text-editor__textarea a-form-field -full-width -remove-corner-radius\"\n cols=\"64\"\n rows=\"10\"\n [(ngModel)]=\"value\"\n [attr.aria-label]=\"'@pry.component.textEditor.textAreaLabel' | i18n\"\n (keydown.enter)=\"insertListStyleCharacter()\"\n #textarea\n >\n </textarea>\n } @else {\n <div class=\"o-text-editor__preview\" [innerHTML]=\"value | mdToHtml\"></div>\n }\n </div>\n } @else {\n <textarea\n class=\"o-text-editor__textarea a-form-field -half-width\"\n cols=\"64\"\n rows=\"10\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [attr.aria-label]=\"'@pry.component.textEditor.textAreaLabel' | i18n\"\n (keydown.enter)=\"insertListStyleCharacter()\"\n #textarea\n >\n </textarea>\n <div class=\"o-text-editor__preview\" [innerHTML]=\"value | mdToHtml\"></div>\n }\n </div>\n @if (tabView) {\n <div class=\"o-text-editor__tabs\">\n @for (tab of tabs; track tab; let i = $index) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"o-text-editor__tab\"\n [id]=\"'text-editor-tab-' + i\"\n [class.-active]=\"tab === activeTab\"\n [attr.aria-selected]=\"tab === activeTab\"\n [attr.aria-controls]=\"'text-editor-panel-' + activeTab\"\n (click)=\"activeTab = tab\"\n >\n {{ '@pry.component.textEditor.' + tab | i18n }}\n </button>\n }\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.PryIconComponent, selector: "pry-icon", inputs: ["color", "iconSvg", "animation", "iconImage", "alt", "width", "height", "classes"] }, { kind: "component", type: PryTextEditorCssComponent, selector: "pry-text-editor-css" }, { kind: "pipe", type: i3.I18nPipe, name: "i18n" }, { kind: "pipe", type: MdToHtmlPipe, name: "mdToHtml" }] }); }
|
|
269
|
+
}
|
|
270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PryTextEditorComponent, decorators: [{
|
|
271
|
+
type: Component,
|
|
272
|
+
args: [{ selector: 'pry-text-editor', providers: [
|
|
273
|
+
{
|
|
274
|
+
provide: NG_VALUE_ACCESSOR,
|
|
275
|
+
multi: true,
|
|
276
|
+
useExisting: PryTextEditorComponent
|
|
277
|
+
}
|
|
278
|
+
], template: "<pry-text-editor-css></pry-text-editor-css>\n<div class=\"o-text-editor\">\n <div class=\"o-text-editor__header\">\n <div class=\"o-text-editor__buttons\">\n @for (button of buttons; track button.style) {\n <button\n type=\"button\"\n class=\"o-text-editor__button a-tooltip\"\n (click)=\"formatText(button.style)\"\n [attr.data-tooltip]=\"'@pry.component.textEditor.' + button.style | i18n\"\n data-tooltip-position=\"bottom\"\n [attr.aria-label]=\"'@pry.component.textEditor.' + button.style | i18n\"\n >\n <pry-icon [height]=\"16\" [width]=\"16\" [iconSvg]=\"button.icon\"></pry-icon>\n </button>\n }\n </div>\n </div>\n <div class=\"o-text-editor__content\">\n @if (tabView) {\n <div\n class=\"o-text-editor__tab-panel\"\n [id]=\"'text-editor-panel-' + activeTab\"\n [attr.aria-labelledby]=\"'text-editor-tab-' + getActiveTabIndex()\"\n >\n @if (activeTab === 'write') {\n <textarea\n class=\"o-text-editor__textarea a-form-field -full-width -remove-corner-radius\"\n cols=\"64\"\n rows=\"10\"\n [(ngModel)]=\"value\"\n [attr.aria-label]=\"'@pry.component.textEditor.textAreaLabel' | i18n\"\n (keydown.enter)=\"insertListStyleCharacter()\"\n #textarea\n >\n </textarea>\n } @else {\n <div class=\"o-text-editor__preview\" [innerHTML]=\"value | mdToHtml\"></div>\n }\n </div>\n } @else {\n <textarea\n class=\"o-text-editor__textarea a-form-field -half-width\"\n cols=\"64\"\n rows=\"10\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [attr.aria-label]=\"'@pry.component.textEditor.textAreaLabel' | i18n\"\n (keydown.enter)=\"insertListStyleCharacter()\"\n #textarea\n >\n </textarea>\n <div class=\"o-text-editor__preview\" [innerHTML]=\"value | mdToHtml\"></div>\n }\n </div>\n @if (tabView) {\n <div class=\"o-text-editor__tabs\">\n @for (tab of tabs; track tab; let i = $index) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"o-text-editor__tab\"\n [id]=\"'text-editor-tab-' + i\"\n [class.-active]=\"tab === activeTab\"\n [attr.aria-selected]=\"tab === activeTab\"\n [attr.aria-controls]=\"'text-editor-panel-' + activeTab\"\n (click)=\"activeTab = tab\"\n >\n {{ '@pry.component.textEditor.' + tab | i18n }}\n </button>\n }\n </div>\n }\n</div>\n" }]
|
|
279
|
+
}], ctorParameters: () => [{ type: TextEditorService }], propDecorators: { tabView: [{
|
|
280
|
+
type: Input
|
|
281
|
+
}], textareaRef: [{
|
|
282
|
+
type: ViewChild,
|
|
283
|
+
args: ['textarea']
|
|
284
|
+
}] } });
|
|
285
|
+
|
|
286
|
+
const enTranslations = {
|
|
287
|
+
'@pry': {
|
|
288
|
+
component: {
|
|
289
|
+
textEditor: {
|
|
290
|
+
textAreaLabel: 'Text editor',
|
|
291
|
+
preview: 'Preview',
|
|
292
|
+
write: 'Write',
|
|
293
|
+
h3: 'Title',
|
|
294
|
+
bold: 'Bold',
|
|
295
|
+
italic: 'Italic',
|
|
296
|
+
underline: 'Underline',
|
|
297
|
+
strikeThrough: 'Strikethrough',
|
|
298
|
+
blockquote: 'Quote',
|
|
299
|
+
list: 'List',
|
|
300
|
+
orderedList: 'Ordered list',
|
|
301
|
+
table: 'Table',
|
|
302
|
+
details: 'Details',
|
|
303
|
+
more: 'More'
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const frTranslations = {
|
|
310
|
+
'@pry': {
|
|
311
|
+
component: {
|
|
312
|
+
textEditor: {
|
|
313
|
+
textAreaLabel: 'Éditeur de texte',
|
|
314
|
+
preview: 'Aperçu',
|
|
315
|
+
write: 'Écrire',
|
|
316
|
+
h3: 'Titre',
|
|
317
|
+
bold: 'Gras',
|
|
318
|
+
italic: 'Italique',
|
|
319
|
+
underline: 'Souligné',
|
|
320
|
+
strikeThrough: 'Barré',
|
|
321
|
+
blockquote: 'Citation',
|
|
322
|
+
list: 'Liste',
|
|
323
|
+
orderedList: 'Liste ordonnée',
|
|
324
|
+
table: 'Tableau',
|
|
325
|
+
details: 'Détails',
|
|
326
|
+
more: 'Voir plus'
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
class PryTextEditorModule {
|
|
333
|
+
constructor(pryTranslateService) {
|
|
334
|
+
this.pryTranslateService = pryTranslateService;
|
|
335
|
+
this.pryTranslateService.addLangObject('fr', 'textEditor', frTranslations);
|
|
336
|
+
this.pryTranslateService.addLangObject('en', 'textEditor', enTranslations);
|
|
337
|
+
}
|
|
338
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PryTextEditorModule, deps: [{ token: i3.PryI18nService }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
339
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.3", ngImport: i0, type: PryTextEditorModule, declarations: [PryTextEditorComponent, PryTextEditorCssComponent, MdToHtmlPipe], imports: [CommonModule, FormsModule, ReactiveFormsModule, PryCoreModule, PryIconModule, PryI18nModule, CdkOverlayOrigin, CdkConnectedOverlay, PryToolboxModule], exports: [PryTextEditorComponent, MdToHtmlPipe] }); }
|
|
340
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PryTextEditorModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, PryCoreModule, PryIconModule, PryI18nModule, PryToolboxModule] }); }
|
|
341
|
+
}
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PryTextEditorModule, decorators: [{
|
|
343
|
+
type: NgModule,
|
|
344
|
+
args: [{
|
|
345
|
+
declarations: [PryTextEditorComponent, PryTextEditorCssComponent, MdToHtmlPipe],
|
|
346
|
+
exports: [PryTextEditorComponent, MdToHtmlPipe],
|
|
347
|
+
imports: [CommonModule, FormsModule, ReactiveFormsModule, PryCoreModule, PryIconModule, PryI18nModule, CdkOverlayOrigin, CdkConnectedOverlay, PryToolboxModule]
|
|
348
|
+
}]
|
|
349
|
+
}], ctorParameters: () => [{ type: i3.PryI18nService }] });
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Generated bundle index. Do not edit.
|
|
353
|
+
*/
|
|
354
|
+
|
|
355
|
+
export { MdToHtmlPipe, PryTextEditorComponent, PryTextEditorCssComponent, PryTextEditorModule, TextEditorService, listStyles, mdStyles, otherStyles, selfClosingStyles, wrapperStyles };
|
|
356
|
+
//# sourceMappingURL=provoly-dashboard-components-text-editor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provoly-dashboard-components-text-editor.mjs","sources":["../../../../projects/provoly/dashboard/components/text-editor/style/css.component.ts","../../../../projects/provoly/dashboard/components/text-editor/service/text-editor.service.ts","../../../../projects/provoly/dashboard/components/text-editor/mdToHtml.pipe.ts","../../../../projects/provoly/dashboard/components/text-editor/component/text-editor.component.ts","../../../../projects/provoly/dashboard/components/text-editor/component/text-editor.component.html","../../../../projects/provoly/dashboard/components/text-editor/i18n/en.translations.ts","../../../../projects/provoly/dashboard/components/text-editor/i18n/fr.translations.ts","../../../../projects/provoly/dashboard/components/text-editor/text-editor.module.ts","../../../../projects/provoly/dashboard/components/text-editor/provoly-dashboard-components-text-editor.ts"],"sourcesContent":["import { Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'pry-text-editor-css',\n template: '',\n styleUrls: ['./_o-text-editor.scss'],\n encapsulation: ViewEncapsulation.None\n})\nexport class PryTextEditorCssComponent {}\n","import { Injectable } from '@angular/core';\n\nexport const mdStyles = {\n h1: '# ',\n h2: '## ',\n h3: '### ',\n h4: '#### ',\n h5: '##### ',\n h6: '###### ',\n bold: '**',\n italic: '*',\n underline: '<u>',\n strikeThrough: '~~',\n code: '`',\n blockquote: '> ',\n list: '- ',\n orderedList: '\\\\d+\\\\. ',\n table: '| | |\\n| --- | --- |\\n| | |',\n details: '<details>\\n<summary></summary>\\n'\n};\n\nexport type MdStyle = keyof typeof mdStyles;\n\nexport const wrapperStyles: MdStyle[] = ['bold', 'italic', 'underline', 'strikeThrough', 'code'];\nexport const selfClosingStyles: MdStyle[] = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\nexport const listStyles: MdStyle[] = ['blockquote', 'list', 'orderedList'];\nexport const otherStyles: MdStyle[] = ['table', 'details'];\n\n@Injectable({\n providedIn: 'root'\n})\nexport class TextEditorService {\n constructor() {}\n\n getClosingTag(style: MdStyle) {\n switch (style) {\n case 'underline':\n return '</u>';\n case 'details':\n return '\\n</details>';\n case 'bold':\n case 'italic':\n case 'strikeThrough':\n case 'code':\n return mdStyles[style];\n default:\n return '';\n }\n }\n\n addMarkdown(text: string, style: MdStyle) {\n if (wrapperStyles.includes(style)) {\n return this.toggleWrapperStyle(text, style);\n }\n if (selfClosingStyles.includes(style)) {\n return this.toggleSelfClosingStyle(text, style);\n }\n if (listStyles.includes(style)) {\n return this.toggleListStyle(text, style);\n }\n if (otherStyles.includes(style)) {\n return this.insertOtherStyle(text, style);\n }\n console.error(`Markdown style ${style} not supported`);\n return text;\n }\n\n toggleWrapperStyle(text: string, style: MdStyle) {\n if (text.startsWith(mdStyles[style])) {\n const startRegex = new RegExp(`^${this.escapeRegExp(mdStyles[style])}`);\n const endRegex = new RegExp(`${this.escapeRegExp(this.getClosingTag(style))}$`);\n return text.replace(startRegex, '').replace(endRegex, '');\n }\n return `${mdStyles[style]}${text}${this.getClosingTag(style)}`;\n }\n\n toggleSelfClosingStyle(text: string, style: MdStyle) {\n if (text.startsWith(mdStyles[style])) {\n const startRegex = new RegExp(`^${this.escapeRegExp(mdStyles[style])}`);\n return text.replace(startRegex, '');\n }\n return `${mdStyles[style]}${text}`;\n }\n\n toggleListStyle(text: string, style: MdStyle) {\n const listStyle = mdStyles[style];\n const lines = text.split('\\n');\n const startRegex = new RegExp(`^${style === 'orderedList' ? listStyle : this.escapeRegExp(listStyle)}`);\n const isListAlready = lines.every((line) => startRegex.test(line));\n const newLines = lines.map((line, index) => {\n if (isListAlready) {\n return line.replace(startRegex, '');\n }\n return `${style === 'orderedList' ? (index + 1).toString() + '. ' : listStyle}${line}`;\n });\n return newLines.join('\\n');\n }\n\n insertOtherStyle(text: string, style: MdStyle) {\n return `${mdStyles[style]}${text}${this.getClosingTag(style)}`;\n }\n\n escapeRegExp(text: string): string {\n return text.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&');\n }\n\n isListLine(line: string) {\n return /^(\\d+\\.|- |\\* |\\> )/.test(line);\n }\n\n isOrderedListLine(text: string) {\n return /^\\d+\\./.test(text);\n }\n\n getListCharacter(previousLine: string) {\n if (this.isOrderedListLine(previousLine)) {\n const match = previousLine.match(/^\\d+/)?.[0];\n return (parseInt(match ?? '1') + 1).toString() + '. ';\n }\n if (/^- /.test(previousLine)) {\n return '- ';\n }\n if (/^\\* /.test(previousLine)) {\n return '* ';\n }\n if (/^\\> /.test(previousLine)) {\n return '> ';\n }\n return 'list';\n }\n\n updateOrderedListLines(text: string) {\n let order = 1;\n return text\n .split('\\n')\n .map((line) => {\n if (/^\\d+\\./.test(line)) {\n return line.replace(/^\\d+\\. /, `${order++}. `);\n }\n order = 1;\n return line;\n })\n .join('\\n');\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { marked } from 'marked';\n\n@Pipe({\n name: 'mdToHtml'\n})\nexport class MdToHtmlPipe implements PipeTransform {\n transform(value?: string): string | Promise<string> {\n return marked.parse(value ?? '');\n }\n}\n","import { Component, ElementRef, Input, ViewChild } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { listStyles, MdStyle, TextEditorService } from '../service/text-editor.service';\nimport { distinctUntilChanged, Subject } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\n\n@Component({\n selector: 'pry-text-editor',\n templateUrl: 'text-editor.component.html',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: PryTextEditorComponent\n }\n ]\n})\nexport class PryTextEditorComponent implements ControlValueAccessor {\n value = '';\n onChange = (value: string) => {};\n onTouched = () => {};\n touched = false;\n disabled = false;\n valueChanged$ = new Subject<string>();\n\n @Input() tabView = true;\n tabs = ['write', 'preview'];\n activeTab = 'write';\n\n @ViewChild('textarea') textareaRef?: ElementRef<HTMLTextAreaElement>;\n buttons: { style: MdStyle; icon: string }[] = [\n { style: 'h3', icon: 'format_title' },\n { style: 'bold', icon: 'format_bold' },\n { style: 'italic', icon: 'format_italic' },\n { style: 'underline', icon: 'format_underlined' },\n { style: 'strikeThrough', icon: 'format_strikethrough' },\n { style: 'blockquote', icon: 'format_quote' },\n { style: 'list', icon: 'format_list_bulleted' },\n { style: 'orderedList', icon: 'format_list_numbered' },\n { style: 'table', icon: 'format_table' },\n { style: 'details', icon: 'format_details' }\n ];\n\n constructor(private service: TextEditorService) {\n this.valueChanged$.pipe(debounceTime(500), distinctUntilChanged()).subscribe((value) => {\n this.onChange(value);\n });\n }\n\n writeValue(value: string) {\n this.value = value;\n }\n\n registerOnChange(onChange: any) {\n this.onChange = onChange;\n }\n\n registerOnTouched(onTouched: any) {\n this.onTouched = onTouched;\n }\n\n markAsTouched() {\n if (!this.touched) {\n this.onTouched();\n this.touched = true;\n }\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled = disabled;\n }\n\n onValueChange($event: string) {\n this.valueChanged$.next($event);\n }\n\n get textarea(): HTMLTextAreaElement {\n return this.textareaRef!.nativeElement;\n }\n\n getActiveTabIndex(): number {\n return this.tabs.findIndex((t) => t === this.activeTab);\n }\n\n formatText(style: MdStyle) {\n const start = listStyles.includes(style) ? this.getSelectionLineIndex() : this.textarea.selectionStart,\n selection = this.value.substring(start, this.textarea.selectionEnd);\n\n this.writeValue(this.getUpdatedValue(this.service.addMarkdown(selection, style), start));\n this.onChange(this.value);\n\n this.focusSelection(start, start + this.service.addMarkdown(selection, style).length);\n }\n\n getUpdatedValue(value: string, lineStart?: number) {\n const len = this.value.length,\n start = lineStart ?? this.textarea.selectionStart;\n return this.value.substring(0, start) + value + this.value.substring(this.textarea.selectionEnd, len);\n }\n\n getSelectionLineIndex() {\n const previousNewlineIndex = this.value.substring(0, this.textarea.selectionStart).lastIndexOf('\\n');\n return previousNewlineIndex ? previousNewlineIndex + 1 : 0;\n }\n\n focusSelection(start: number, end: number) {\n setTimeout(() => {\n this.textarea.focus();\n this.textarea.setSelectionRange(start, end);\n });\n }\n\n insertListStyleCharacter() {\n setTimeout(() => {\n const start = 0;\n const end = this.textarea.selectionStart;\n const text = this.value.substring(start, end);\n const previousLine = text?.split('\\n')[text?.split('\\n').length - 2];\n if (previousLine && this.service.isListLine(previousLine)) {\n const updatedValue = this.getUpdatedValue(this.service.getListCharacter(previousLine));\n this.writeValue(\n this.service.isOrderedListLine(previousLine)\n ? this.service.updateOrderedListLines(updatedValue)\n : updatedValue\n );\n this.onChange(this.value);\n }\n });\n }\n}\n","<pry-text-editor-css></pry-text-editor-css>\n<div class=\"o-text-editor\">\n <div class=\"o-text-editor__header\">\n <div class=\"o-text-editor__buttons\">\n @for (button of buttons; track button.style) {\n <button\n type=\"button\"\n class=\"o-text-editor__button a-tooltip\"\n (click)=\"formatText(button.style)\"\n [attr.data-tooltip]=\"'@pry.component.textEditor.' + button.style | i18n\"\n data-tooltip-position=\"bottom\"\n [attr.aria-label]=\"'@pry.component.textEditor.' + button.style | i18n\"\n >\n <pry-icon [height]=\"16\" [width]=\"16\" [iconSvg]=\"button.icon\"></pry-icon>\n </button>\n }\n </div>\n </div>\n <div class=\"o-text-editor__content\">\n @if (tabView) {\n <div\n class=\"o-text-editor__tab-panel\"\n [id]=\"'text-editor-panel-' + activeTab\"\n [attr.aria-labelledby]=\"'text-editor-tab-' + getActiveTabIndex()\"\n >\n @if (activeTab === 'write') {\n <textarea\n class=\"o-text-editor__textarea a-form-field -full-width -remove-corner-radius\"\n cols=\"64\"\n rows=\"10\"\n [(ngModel)]=\"value\"\n [attr.aria-label]=\"'@pry.component.textEditor.textAreaLabel' | i18n\"\n (keydown.enter)=\"insertListStyleCharacter()\"\n #textarea\n >\n </textarea>\n } @else {\n <div class=\"o-text-editor__preview\" [innerHTML]=\"value | mdToHtml\"></div>\n }\n </div>\n } @else {\n <textarea\n class=\"o-text-editor__textarea a-form-field -half-width\"\n cols=\"64\"\n rows=\"10\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [attr.aria-label]=\"'@pry.component.textEditor.textAreaLabel' | i18n\"\n (keydown.enter)=\"insertListStyleCharacter()\"\n #textarea\n >\n </textarea>\n <div class=\"o-text-editor__preview\" [innerHTML]=\"value | mdToHtml\"></div>\n }\n </div>\n @if (tabView) {\n <div class=\"o-text-editor__tabs\">\n @for (tab of tabs; track tab; let i = $index) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"o-text-editor__tab\"\n [id]=\"'text-editor-tab-' + i\"\n [class.-active]=\"tab === activeTab\"\n [attr.aria-selected]=\"tab === activeTab\"\n [attr.aria-controls]=\"'text-editor-panel-' + activeTab\"\n (click)=\"activeTab = tab\"\n >\n {{ '@pry.component.textEditor.' + tab | i18n }}\n </button>\n }\n </div>\n }\n</div>\n","export const enTranslations = {\n '@pry': {\n component: {\n textEditor: {\n textAreaLabel: 'Text editor',\n preview: 'Preview',\n write: 'Write',\n h3: 'Title',\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n strikeThrough: 'Strikethrough',\n blockquote: 'Quote',\n list: 'List',\n orderedList: 'Ordered list',\n table: 'Table',\n details: 'Details',\n more: 'More'\n }\n }\n }\n};\n","export const frTranslations = {\n '@pry': {\n component: {\n textEditor: {\n textAreaLabel: 'Éditeur de texte',\n preview: 'Aperçu',\n write: 'Écrire',\n h3: 'Titre',\n bold: 'Gras',\n italic: 'Italique',\n underline: 'Souligné',\n strikeThrough: 'Barré',\n blockquote: 'Citation',\n list: 'Liste',\n orderedList: 'Liste ordonnée',\n table: 'Tableau',\n details: 'Détails',\n more: 'Voir plus'\n }\n }\n }\n};\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { PryCoreModule, PryI18nModule, PryI18nService, PryIconModule } from '@provoly/dashboard';\nimport { PryTextEditorCssComponent } from './style/css.component';\nimport { PryTextEditorComponent } from './component/text-editor.component';\nimport { MdToHtmlPipe } from './mdToHtml.pipe';\nimport { enTranslations } from './i18n/en.translations';\nimport { frTranslations } from './i18n/fr.translations';\nimport { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';\nimport { PryToolboxModule } from '@provoly/dashboard/toolbox';\n\n@NgModule({\n declarations: [PryTextEditorComponent, PryTextEditorCssComponent, MdToHtmlPipe],\n exports: [PryTextEditorComponent, MdToHtmlPipe],\n imports: [CommonModule, FormsModule, ReactiveFormsModule, PryCoreModule, PryIconModule, PryI18nModule, CdkOverlayOrigin, CdkConnectedOverlay, PryToolboxModule]\n})\nexport class PryTextEditorModule {\n constructor(private pryTranslateService: PryI18nService) {\n this.pryTranslateService.addLangObject('fr', 'textEditor', frTranslations);\n this.pryTranslateService.addLangObject('en', 'textEditor', enTranslations);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.Text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