matcha-components 20.237.0 → 20.239.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/text-editor/css/codemirror.min.css +499 -0
- package/assets/text-editor/css/suneditor.min.css +5375 -1
- package/assets/text-editor/js/codemirror.min.js +8 -0
- package/assets/text-editor/js/css.js +8 -0
- package/assets/text-editor/js/htmlmixed copy.js +1 -0
- package/assets/text-editor/js/htmlmixed.js +8 -0
- package/assets/text-editor/js/javascript.js +8 -0
- package/assets/text-editor/js/xml.min.js +8 -0
- package/assets/text-editor/langs/pt-br.js +241 -0
- package/assets/text-editor/suneditor.html +95 -22
- package/fesm2022/matcha-components.mjs +123 -90
- package/fesm2022/matcha-components.mjs.map +1 -1
- package/index.d.ts +2 -3
- package/package.json +1 -1
|
@@ -14547,8 +14547,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
14547
14547
|
}]
|
|
14548
14548
|
}] });
|
|
14549
14549
|
|
|
14550
|
-
const
|
|
14550
|
+
const DEFAULT_OPTIONS = {
|
|
14551
14551
|
height: '400px',
|
|
14552
|
+
width: '100%',
|
|
14552
14553
|
showFont: true,
|
|
14553
14554
|
showFormats: true,
|
|
14554
14555
|
showBold: true,
|
|
@@ -14565,61 +14566,96 @@ const DEFAULT_CONFIG = {
|
|
|
14565
14566
|
showLink: true,
|
|
14566
14567
|
showImage: true,
|
|
14567
14568
|
showVideo: true,
|
|
14568
|
-
showMarkdown:
|
|
14569
|
+
showMarkdown: true,
|
|
14569
14570
|
showFullScreen: true,
|
|
14570
14571
|
showCodeView: true,
|
|
14572
|
+
addFont: [],
|
|
14571
14573
|
videoX: 560,
|
|
14572
14574
|
videoY: 315,
|
|
14573
14575
|
imageSize: '350px',
|
|
14574
14576
|
};
|
|
14575
|
-
function
|
|
14576
|
-
const
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
if (
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
]
|
|
14612
|
-
if (
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14577
|
+
function buildSunEditorConfig(options = {}) {
|
|
14578
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
14579
|
+
return {
|
|
14580
|
+
height: opts.height,
|
|
14581
|
+
width: opts.width,
|
|
14582
|
+
buttonList: _buildButtonList(opts),
|
|
14583
|
+
imageWidth: opts.imageSize,
|
|
14584
|
+
videoWidth: opts.videoX,
|
|
14585
|
+
videoHeight: opts.videoY,
|
|
14586
|
+
font: opts.addFont?.length ? opts.addFont.map(f => f.value) : undefined,
|
|
14587
|
+
defaultStyle: 'font-family: Arial, sans-serif; font-size: 16px;',
|
|
14588
|
+
};
|
|
14589
|
+
}
|
|
14590
|
+
function _buildButtonList(opts) {
|
|
14591
|
+
// Desktop toolbar — mirrors suneditor.html reference exactly
|
|
14592
|
+
const desktop = [['undo', 'redo']];
|
|
14593
|
+
if (opts.showFormats || opts.showFont) {
|
|
14594
|
+
desktop.push('|', ['blockStyle', 'font', 'fontSize']);
|
|
14595
|
+
}
|
|
14596
|
+
if (opts.showBold || opts.showItalic || opts.showUnderline || opts.showStrike) {
|
|
14597
|
+
desktop.push('|', ['bold', 'italic', 'underline', 'strike']);
|
|
14598
|
+
}
|
|
14599
|
+
if (opts.showFontColor || opts.showHiliteColor) {
|
|
14600
|
+
desktop.push('|', ['fontColor', 'backgroundColor']);
|
|
14601
|
+
}
|
|
14602
|
+
desktop.push('|', ['removeFormat'], '/');
|
|
14603
|
+
if (opts.showInOutDent || opts.showAlign || opts.showList) {
|
|
14604
|
+
desktop.push(['outdent', 'indent', 'align', 'list']);
|
|
14605
|
+
}
|
|
14606
|
+
if (opts.showTable || opts.showLink || opts.showImage || opts.showVideo) {
|
|
14607
|
+
desktop.push('|', ['table', 'link', 'image', 'video']);
|
|
14608
|
+
}
|
|
14609
|
+
const viewBtns = [
|
|
14610
|
+
...(opts.showFullScreen ? ['fullScreen'] : []),
|
|
14611
|
+
...(opts.showCodeView ? ['codeView'] : []),
|
|
14612
|
+
...(opts.showMarkdown ? ['markdownView'] : []),
|
|
14613
|
+
];
|
|
14614
|
+
if (viewBtns.length)
|
|
14615
|
+
desktop.push('|', viewBtns);
|
|
14616
|
+
// Responsive breakpoints — mirrors suneditor.html reference exactly
|
|
14617
|
+
return [
|
|
14618
|
+
...desktop,
|
|
14619
|
+
['%992', [
|
|
14620
|
+
['undo', 'redo'],
|
|
14621
|
+
'|',
|
|
14622
|
+
[':Format-default.more_paragraph', 'blockStyle', 'font', 'fontSize'],
|
|
14623
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
14624
|
+
'|',
|
|
14625
|
+
['fontColor', 'backgroundColor'],
|
|
14626
|
+
'|',
|
|
14627
|
+
['removeFormat'],
|
|
14628
|
+
'|',
|
|
14629
|
+
['outdent', 'indent', 'align', 'list'],
|
|
14630
|
+
'|',
|
|
14631
|
+
['table', 'link', 'image', 'video'],
|
|
14632
|
+
'|',
|
|
14633
|
+
['fullScreen', 'codeView', 'markdownView'],
|
|
14634
|
+
]],
|
|
14635
|
+
['%768', [
|
|
14636
|
+
['undo', 'redo'],
|
|
14637
|
+
'|',
|
|
14638
|
+
[':Format-default.more_paragraph', 'blockStyle', 'font', 'fontSize', '|', 'removeFormat'],
|
|
14639
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
14640
|
+
'|',
|
|
14641
|
+
['fontColor', 'backgroundColor'],
|
|
14642
|
+
['outdent', 'indent', 'align', 'list'],
|
|
14643
|
+
'|',
|
|
14644
|
+
[':Insert-default.more_plus', 'table', 'link', 'image', 'video'],
|
|
14645
|
+
'|',
|
|
14646
|
+
['fullScreen', 'codeView', 'markdownView'],
|
|
14647
|
+
]],
|
|
14648
|
+
['%576', [
|
|
14649
|
+
['undo', 'redo'],
|
|
14650
|
+
'|',
|
|
14651
|
+
[':Format-default.more_paragraph', 'blockStyle', 'font', 'fontSize'],
|
|
14652
|
+
[':Text-default.more_text', 'bold', 'italic', 'underline', 'strike', '|', 'fontColor', 'backgroundColor', '|', 'removeFormat'],
|
|
14653
|
+
['outdent', 'indent', 'align', 'list'],
|
|
14654
|
+
'|',
|
|
14655
|
+
[':Insert-default.more_plus', 'table', 'link', 'image', 'video'],
|
|
14656
|
+
['-right', 'fullScreen', 'codeView', 'markdownView'],
|
|
14657
|
+
]],
|
|
14658
|
+
];
|
|
14623
14659
|
}
|
|
14624
14660
|
|
|
14625
14661
|
class MatchaSkeletonComponent {
|
|
@@ -14718,7 +14754,7 @@ class MatchaTextEditorComponent {
|
|
|
14718
14754
|
this._el = _el;
|
|
14719
14755
|
this.editorId = `matcha-text-editor-${Math.random().toString(36).substring(2, 11)}`;
|
|
14720
14756
|
this.isLoading = true;
|
|
14721
|
-
this._config = {
|
|
14757
|
+
this._config = {};
|
|
14722
14758
|
this.contentChange = new EventEmitter();
|
|
14723
14759
|
this._editor = null;
|
|
14724
14760
|
this._pendingValue = '';
|
|
@@ -14734,11 +14770,12 @@ class MatchaTextEditorComponent {
|
|
|
14734
14770
|
this._initEditor();
|
|
14735
14771
|
}
|
|
14736
14772
|
catch (error) {
|
|
14737
|
-
console.error('[
|
|
14773
|
+
console.error('[matcha-text-editor] Falha ao inicializar o SunEditor:', error);
|
|
14738
14774
|
}
|
|
14739
14775
|
});
|
|
14740
14776
|
}
|
|
14741
14777
|
ngOnDestroy() {
|
|
14778
|
+
this._editor?.destroy();
|
|
14742
14779
|
this._editor = null;
|
|
14743
14780
|
}
|
|
14744
14781
|
// ControlValueAccessor
|
|
@@ -14746,7 +14783,7 @@ class MatchaTextEditorComponent {
|
|
|
14746
14783
|
const v = value || '';
|
|
14747
14784
|
this._isSettingValue = true;
|
|
14748
14785
|
if (this._editor) {
|
|
14749
|
-
this._editor
|
|
14786
|
+
this._editor.html.set(v);
|
|
14750
14787
|
}
|
|
14751
14788
|
else {
|
|
14752
14789
|
this._pendingValue = v;
|
|
@@ -14761,17 +14798,9 @@ class MatchaTextEditorComponent {
|
|
|
14761
14798
|
}
|
|
14762
14799
|
setDisabledState(isDisabled) {
|
|
14763
14800
|
this._disabled = isDisabled;
|
|
14764
|
-
if (this._editor)
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
this._editor.$.toolbar.disable();
|
|
14768
|
-
wysiwyg?.setAttribute('contenteditable', 'false');
|
|
14769
|
-
}
|
|
14770
|
-
else {
|
|
14771
|
-
this._editor.$.toolbar.enable();
|
|
14772
|
-
wysiwyg?.setAttribute('contenteditable', 'true');
|
|
14773
|
-
}
|
|
14774
|
-
}
|
|
14801
|
+
if (!this._editor)
|
|
14802
|
+
return;
|
|
14803
|
+
isDisabled ? this._editor.toolbar.disable() : this._editor.toolbar.enable();
|
|
14775
14804
|
}
|
|
14776
14805
|
// Private
|
|
14777
14806
|
_injectScript(id, url) {
|
|
@@ -14791,7 +14820,7 @@ class MatchaTextEditorComponent {
|
|
|
14791
14820
|
script.id = id;
|
|
14792
14821
|
script.src = url;
|
|
14793
14822
|
script.onload = () => { script.setAttribute('data-loaded', 'true'); resolve(); };
|
|
14794
|
-
script.onerror = () => { console.warn(`[
|
|
14823
|
+
script.onerror = () => { console.warn(`[matcha-text-editor] Falha ao carregar: ${id}`); resolve(); };
|
|
14795
14824
|
document.head.appendChild(script);
|
|
14796
14825
|
});
|
|
14797
14826
|
}
|
|
@@ -14811,39 +14840,48 @@ class MatchaTextEditorComponent {
|
|
|
14811
14840
|
});
|
|
14812
14841
|
}
|
|
14813
14842
|
async _loadAssets() {
|
|
14814
|
-
|
|
14843
|
+
// CSS loads in parallel
|
|
14844
|
+
await Promise.all([
|
|
14845
|
+
this._injectStyle('suneditor-css', `${CDN_BASE}/css/suneditor.min.css`),
|
|
14846
|
+
this._injectStyle('codemirror-css', `${CDN_BASE}/css/codemirror.min.css`),
|
|
14847
|
+
]);
|
|
14848
|
+
// JS loads sequentially — order matters
|
|
14849
|
+
await this._injectScript('codemirror-js', `${CDN_BASE}/js/codemirror.min.js`);
|
|
14850
|
+
await this._injectScript('codemirror-xml', `${CDN_BASE}/js/xml.min.js`);
|
|
14851
|
+
await this._injectScript('codemirror-css-mode', `${CDN_BASE}/js/css.js`);
|
|
14852
|
+
await this._injectScript('codemirror-js-mode', `${CDN_BASE}/js/javascript.js`);
|
|
14853
|
+
await this._injectScript('codemirror-htmlmixed', `${CDN_BASE}/js/htmlmixed.js`);
|
|
14815
14854
|
await this._injectScript('suneditor-js', `${CDN_BASE}/js/suneditor.min.js`);
|
|
14855
|
+
await this._injectScript('suneditor-lang-ptbr', `${CDN_BASE}/langs/pt-br.js`);
|
|
14816
14856
|
}
|
|
14817
14857
|
_reloadEditor() {
|
|
14818
|
-
this.
|
|
14819
|
-
|
|
14858
|
+
const content = this._editor?.html.get() ?? '';
|
|
14859
|
+
this._editor?.destroy();
|
|
14820
14860
|
this._editor = null;
|
|
14821
14861
|
this._pendingValue = content;
|
|
14822
14862
|
this.isLoading = true;
|
|
14823
14863
|
this._cdr.detectChanges();
|
|
14824
|
-
this._ngZone.runOutsideAngular(() =>
|
|
14825
|
-
this._initEditor();
|
|
14826
|
-
});
|
|
14864
|
+
this._ngZone.runOutsideAngular(() => this._initEditor());
|
|
14827
14865
|
}
|
|
14828
14866
|
_initEditor() {
|
|
14829
14867
|
const SUNEDITOR = window.SUNEDITOR;
|
|
14830
14868
|
if (!SUNEDITOR) {
|
|
14831
|
-
console.error('[
|
|
14869
|
+
console.error('[matcha-text-editor] SUNEDITOR global não encontrado após injeção.');
|
|
14832
14870
|
return;
|
|
14833
14871
|
}
|
|
14834
|
-
|
|
14872
|
+
const textarea = document.getElementById(this.editorId);
|
|
14873
|
+
if (!textarea) {
|
|
14835
14874
|
requestAnimationFrame(() => this._ngZone.runOutsideAngular(() => this._initEditor()));
|
|
14836
14875
|
return;
|
|
14837
14876
|
}
|
|
14838
|
-
|
|
14839
|
-
this._editor = SUNEDITOR.create(`#${this.editorId}`, {
|
|
14877
|
+
this._editor = SUNEDITOR.create(textarea, {
|
|
14840
14878
|
plugins: SUNEDITOR.plugins,
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14879
|
+
lang: window.SUNEDITOR_LANG?.pt_br,
|
|
14880
|
+
externalLibs: {
|
|
14881
|
+
codeMirror: { src: window.CodeMirror },
|
|
14882
|
+
},
|
|
14883
|
+
toolbar_sticky: 0,
|
|
14884
|
+
...buildSunEditorConfig(this._config),
|
|
14847
14885
|
events: {
|
|
14848
14886
|
onChange: ({ data }) => {
|
|
14849
14887
|
if (this._isSettingValue)
|
|
@@ -14853,24 +14891,19 @@ class MatchaTextEditorComponent {
|
|
|
14853
14891
|
this.contentChange.emit(data);
|
|
14854
14892
|
});
|
|
14855
14893
|
},
|
|
14856
|
-
onBlur: () =>
|
|
14857
|
-
this._ngZone.run(() => this._onTouched());
|
|
14858
|
-
},
|
|
14894
|
+
onBlur: () => this._ngZone.run(() => this._onTouched()),
|
|
14859
14895
|
},
|
|
14860
14896
|
});
|
|
14861
14897
|
if (this._disabled) {
|
|
14862
|
-
|
|
14863
|
-
this._editor.$.toolbar.disable();
|
|
14864
|
-
wysiwyg?.setAttribute('contenteditable', 'false');
|
|
14898
|
+
this._editor.toolbar.disable();
|
|
14865
14899
|
}
|
|
14866
|
-
// Hide immediately so the skeleton doesn't overlap the editor during initialization
|
|
14867
14900
|
const sunEditorEl = this._el.nativeElement.querySelector('.sun-editor');
|
|
14868
14901
|
if (sunEditorEl)
|
|
14869
14902
|
sunEditorEl.style.display = 'none';
|
|
14870
14903
|
setTimeout(() => {
|
|
14871
14904
|
if (this._pendingValue) {
|
|
14872
14905
|
this._isSettingValue = true;
|
|
14873
|
-
this._editor
|
|
14906
|
+
this._editor.html.set(this._pendingValue);
|
|
14874
14907
|
this._pendingValue = '';
|
|
14875
14908
|
setTimeout(() => { this._isSettingValue = false; }, 0);
|
|
14876
14909
|
}
|
|
@@ -15758,5 +15791,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
15758
15791
|
* Generated bundle index. Do not edit.
|
|
15759
15792
|
*/
|
|
15760
15793
|
|
|
15761
|
-
export { CopyButtonComponent,
|
|
15794
|
+
export { CopyButtonComponent, INITIAL_CONFIG, MATCHA_MASK_CONFIG, MATCHA_OPTION_PARENT, MatchaAccordionComponent, MatchaAccordionContentComponent, MatchaAccordionHeaderComponent, MatchaAccordionItemComponent, MatchaAccordionModule, MatchaAutocompleteComponent, MatchaAutocompleteModule, MatchaAutocompleteTriggerDirective, MatchaAvatarComponent, MatchaAvatarModule, MatchaBreakpointObservableModule, MatchaBreakpointObserver, MatchaButtonComponent, MatchaButtonModule, MatchaButtonToggleComponent, MatchaButtonToggleModule, MatchaCardComponent, MatchaCardModule, MatchaCheckboxComponent, MatchaCheckboxModule, MatchaChipComponent, MatchaChipListComponent, MatchaChipModule, MatchaComponentsModule, MatchaDateComponent, MatchaDateModule, MatchaDateRangeComponent, MatchaDateRangeModule, MatchaDividerComponent, MatchaDividerModule, MatchaDragDirective, MatchaDragHandleDirective, MatchaDrawerComponent, MatchaDrawerContainerComponent, MatchaDrawerContentComponent, MatchaDrawerModule, MatchaDropListComponent, MatchaDropListModule, MatchaElevationDirective, MatchaElevationModule, MatchaErrorComponent, MatchaFormFieldComponent, MatchaFormFieldModule, MatchaGridComponent, MatchaGridModule, MatchaHighlightComponent, MatchaHighlightModule, MatchaHintTextComponent, MatchaHintTextModule, MatchaIconComponent, MatchaIconModule, MatchaInfiniteScrollComponent, MatchaInfiniteScrollDataComponent, MatchaInfiniteScrollModule, MatchaInputPhoneComponent, MatchaInputPhoneModule, MatchaLabelComponent, MatchaLazyloadComponent, MatchaLazyloadDataComponent, MatchaLazyloadModule, MatchaListComponent, MatchaListItemComponent, MatchaListModule, MatchaMaskApplierService, MatchaMaskCompatibleDirective, MatchaMaskModule, MatchaMaskPipe, MatchaMaskService, MatchaMasonryComponent, MatchaMasonryModule, MatchaMenuComponent, MatchaMenuItemDirective, MatchaMenuModule, MatchaMenuTriggerDirective, MatchaModalComponent, MatchaModalContentComponent, MatchaModalFooterComponent, MatchaModalHeaderComponent, MatchaModalModule, MatchaModalOptionsComponent, MatchaModalService, MatchaMsgBoxActionsComponent, MatchaMsgBoxComponent, MatchaMsgBoxModule, MatchaOptionComponent, MatchaOptionModule, MatchaOverlayService, MatchaPageLayoutComponent, MatchaPageLayoutModule, MatchaPaginatorComponent, MatchaPaginatorIntl, MatchaPaginatorModule, MatchaPanelComponent, MatchaPanelModule, MatchaProgressBarComponent, MatchaProgressBarModule, MatchaRadioComponent, MatchaRadioGroupComponent, MatchaRadioModule, MatchaRippleDirective, MatchaRippleModule, MatchaSelectComponent, MatchaSelectModule, MatchaSelectTriggerDirective, MatchaSkeletonComponent, MatchaSkeletonModule, MatchaSlideToggleComponent, MatchaSlideToggleModule, MatchaSliderComponent, MatchaSliderModule, MatchaSnackBarComponent, MatchaSnackBarModule, MatchaSnackBarService, MatchaSpinComponent, MatchaSpinModule, MatchaSpinnerComponent, MatchaSpinnerModule, MatchaStepperComponent, MatchaStepperContentComponent, MatchaStepperControllerComponent, MatchaStepperModule, MatchaStepperStateService, MatchaSubmenuTriggerDirective, MatchaTabItemComponent, MatchaTableComponent, MatchaTableModule, MatchaTabsComponent, MatchaTabsModule, MatchaTextEditorComponent, MatchaTextEditorModule, MatchaTimeComponent, MatchaTimeModule, MatchaTimeRangeComponent, MatchaTimeRangeModule, MatchaTitleComponent, MatchaTitleModule, MatchaToolbarButtonComponent, MatchaToolbarComponent, MatchaToolbarContentComponent, MatchaToolbarCustomButtonComponent, MatchaToolbarMainButtonComponent, MatchaToolbarModule, MatchaTooltipDirective, MatchaTooltipModule, NEW_CONFIG, NextStepDirective, PrevStepDirective, StepComponent, StepContentDirective, buildSunEditorConfig, compatibleOptions, initialConfig, timeMasks, withoutValidation };
|
|
15762
15795
|
//# sourceMappingURL=matcha-components.mjs.map
|