matcha-components 20.236.0 → 20.238.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 +130 -87
- 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,
|
|
@@ -14568,58 +14569,91 @@ const DEFAULT_CONFIG = {
|
|
|
14568
14569
|
showMarkdown: false,
|
|
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
|
-
|
|
14605
|
-
|
|
14606
|
-
const
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
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
|
+
};
|
|
14588
|
+
}
|
|
14589
|
+
function _buildButtonList(opts) {
|
|
14590
|
+
// Desktop toolbar — mirrors suneditor.html reference exactly
|
|
14591
|
+
const desktop = [['undo', 'redo']];
|
|
14592
|
+
if (opts.showFormats || opts.showFont) {
|
|
14593
|
+
desktop.push('|', ['blockStyle', 'font', 'fontSize']);
|
|
14594
|
+
}
|
|
14595
|
+
if (opts.showBold || opts.showItalic || opts.showUnderline || opts.showStrike) {
|
|
14596
|
+
desktop.push('|', ['bold', 'italic', 'underline', 'strike']);
|
|
14597
|
+
}
|
|
14598
|
+
if (opts.showFontColor || opts.showHiliteColor) {
|
|
14599
|
+
desktop.push('|', ['fontColor', 'backgroundColor']);
|
|
14600
|
+
}
|
|
14601
|
+
desktop.push('|', ['removeFormat'], '/');
|
|
14602
|
+
if (opts.showInOutDent || opts.showAlign || opts.showList) {
|
|
14603
|
+
desktop.push(['outdent', 'indent', 'align', 'list']);
|
|
14604
|
+
}
|
|
14605
|
+
if (opts.showTable || opts.showLink || opts.showImage || opts.showVideo) {
|
|
14606
|
+
desktop.push('|', ['table', 'link', 'image', 'video']);
|
|
14607
|
+
}
|
|
14608
|
+
const viewBtns = [
|
|
14609
|
+
...(opts.showFullScreen ? ['fullScreen'] : []),
|
|
14610
|
+
...(opts.showCodeView ? ['codeView'] : []),
|
|
14611
|
+
];
|
|
14612
|
+
if (viewBtns.length)
|
|
14613
|
+
desktop.push('|', viewBtns);
|
|
14614
|
+
// Responsive breakpoints — mirrors suneditor.html reference exactly
|
|
14615
|
+
return [
|
|
14616
|
+
...desktop,
|
|
14617
|
+
['%992', [
|
|
14618
|
+
['undo', 'redo'],
|
|
14619
|
+
'|',
|
|
14620
|
+
[':Format-default.more_paragraph', 'blockStyle', 'font', 'fontSize'],
|
|
14621
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
14622
|
+
'|',
|
|
14623
|
+
['fontColor', 'backgroundColor'],
|
|
14624
|
+
'|',
|
|
14625
|
+
['removeFormat'],
|
|
14626
|
+
'|',
|
|
14627
|
+
['outdent', 'indent', 'align', 'list'],
|
|
14628
|
+
'|',
|
|
14629
|
+
['table', 'link', 'image', 'video'],
|
|
14630
|
+
'|',
|
|
14631
|
+
['fullScreen', 'codeView'],
|
|
14632
|
+
]],
|
|
14633
|
+
['%768', [
|
|
14634
|
+
['undo', 'redo'],
|
|
14635
|
+
'|',
|
|
14636
|
+
[':Format-default.more_paragraph', 'blockStyle', 'font', 'fontSize', '|', 'removeFormat'],
|
|
14637
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
14638
|
+
'|',
|
|
14639
|
+
['fontColor', 'backgroundColor'],
|
|
14640
|
+
['outdent', 'indent', 'align', 'list'],
|
|
14641
|
+
'|',
|
|
14642
|
+
[':Insert-default.more_plus', 'table', 'link', 'image', 'video'],
|
|
14643
|
+
'|',
|
|
14644
|
+
['fullScreen', 'codeView'],
|
|
14645
|
+
]],
|
|
14646
|
+
['%576', [
|
|
14647
|
+
['undo', 'redo'],
|
|
14648
|
+
'|',
|
|
14649
|
+
[':Format-default.more_paragraph', 'blockStyle', 'font', 'fontSize'],
|
|
14650
|
+
[':Text-default.more_text', 'bold', 'italic', 'underline', 'strike', '|', 'fontColor', 'backgroundColor', '|', 'removeFormat'],
|
|
14651
|
+
['outdent', 'indent', 'align', 'list'],
|
|
14652
|
+
'|',
|
|
14653
|
+
[':Insert-default.more_plus', 'table', 'link', 'image', 'video'],
|
|
14654
|
+
['-right', 'fullScreen', 'codeView'],
|
|
14655
|
+
]],
|
|
14656
|
+
];
|
|
14623
14657
|
}
|
|
14624
14658
|
|
|
14625
14659
|
class MatchaSkeletonComponent {
|
|
@@ -14718,7 +14752,7 @@ class MatchaTextEditorComponent {
|
|
|
14718
14752
|
this._el = _el;
|
|
14719
14753
|
this.editorId = `matcha-text-editor-${Math.random().toString(36).substring(2, 11)}`;
|
|
14720
14754
|
this.isLoading = true;
|
|
14721
|
-
this._config = {
|
|
14755
|
+
this._config = {};
|
|
14722
14756
|
this.contentChange = new EventEmitter();
|
|
14723
14757
|
this._editor = null;
|
|
14724
14758
|
this._pendingValue = '';
|
|
@@ -14734,11 +14768,12 @@ class MatchaTextEditorComponent {
|
|
|
14734
14768
|
this._initEditor();
|
|
14735
14769
|
}
|
|
14736
14770
|
catch (error) {
|
|
14737
|
-
console.error('[
|
|
14771
|
+
console.error('[matcha-text-editor] Falha ao inicializar o SunEditor:', error);
|
|
14738
14772
|
}
|
|
14739
14773
|
});
|
|
14740
14774
|
}
|
|
14741
14775
|
ngOnDestroy() {
|
|
14776
|
+
this._editor?.destroy();
|
|
14742
14777
|
this._editor = null;
|
|
14743
14778
|
}
|
|
14744
14779
|
// ControlValueAccessor
|
|
@@ -14746,7 +14781,7 @@ class MatchaTextEditorComponent {
|
|
|
14746
14781
|
const v = value || '';
|
|
14747
14782
|
this._isSettingValue = true;
|
|
14748
14783
|
if (this._editor) {
|
|
14749
|
-
this._editor.
|
|
14784
|
+
this._editor.setContents(v);
|
|
14750
14785
|
}
|
|
14751
14786
|
else {
|
|
14752
14787
|
this._pendingValue = v;
|
|
@@ -14761,9 +14796,9 @@ class MatchaTextEditorComponent {
|
|
|
14761
14796
|
}
|
|
14762
14797
|
setDisabledState(isDisabled) {
|
|
14763
14798
|
this._disabled = isDisabled;
|
|
14764
|
-
if (this._editor)
|
|
14765
|
-
|
|
14766
|
-
|
|
14799
|
+
if (!this._editor)
|
|
14800
|
+
return;
|
|
14801
|
+
isDisabled ? this._editor.disabled() : this._editor.enabled();
|
|
14767
14802
|
}
|
|
14768
14803
|
// Private
|
|
14769
14804
|
_injectScript(id, url) {
|
|
@@ -14783,7 +14818,7 @@ class MatchaTextEditorComponent {
|
|
|
14783
14818
|
script.id = id;
|
|
14784
14819
|
script.src = url;
|
|
14785
14820
|
script.onload = () => { script.setAttribute('data-loaded', 'true'); resolve(); };
|
|
14786
|
-
script.onerror = () => { console.warn(`[
|
|
14821
|
+
script.onerror = () => { console.warn(`[matcha-text-editor] Falha ao carregar: ${id}`); resolve(); };
|
|
14787
14822
|
document.head.appendChild(script);
|
|
14788
14823
|
});
|
|
14789
14824
|
}
|
|
@@ -14803,62 +14838,70 @@ class MatchaTextEditorComponent {
|
|
|
14803
14838
|
});
|
|
14804
14839
|
}
|
|
14805
14840
|
async _loadAssets() {
|
|
14806
|
-
|
|
14841
|
+
// CSS loads in parallel
|
|
14842
|
+
await Promise.all([
|
|
14843
|
+
this._injectStyle('suneditor-css', `${CDN_BASE}/css/suneditor.min.css`),
|
|
14844
|
+
this._injectStyle('codemirror-css', `${CDN_BASE}/css/codemirror.min.css`),
|
|
14845
|
+
]);
|
|
14846
|
+
// JS loads sequentially — order matters
|
|
14847
|
+
await this._injectScript('codemirror-js', `${CDN_BASE}/js/codemirror.min.js`);
|
|
14848
|
+
await this._injectScript('codemirror-xml', `${CDN_BASE}/js/xml.min.js`);
|
|
14849
|
+
await this._injectScript('codemirror-css-mode', `${CDN_BASE}/js/css.js`);
|
|
14850
|
+
await this._injectScript('codemirror-js-mode', `${CDN_BASE}/js/javascript.js`);
|
|
14851
|
+
await this._injectScript('codemirror-htmlmixed', `${CDN_BASE}/js/htmlmixed.js`);
|
|
14807
14852
|
await this._injectScript('suneditor-js', `${CDN_BASE}/js/suneditor.min.js`);
|
|
14853
|
+
await this._injectScript('suneditor-lang-ptbr', `${CDN_BASE}/langs/pt-br.js`);
|
|
14808
14854
|
}
|
|
14809
14855
|
_reloadEditor() {
|
|
14810
|
-
this.
|
|
14811
|
-
|
|
14856
|
+
const content = this._editor?.getContents() ?? '';
|
|
14857
|
+
this._editor?.destroy();
|
|
14812
14858
|
this._editor = null;
|
|
14813
14859
|
this._pendingValue = content;
|
|
14814
14860
|
this.isLoading = true;
|
|
14815
14861
|
this._cdr.detectChanges();
|
|
14816
|
-
this._ngZone.runOutsideAngular(() =>
|
|
14817
|
-
this._initEditor();
|
|
14818
|
-
});
|
|
14862
|
+
this._ngZone.runOutsideAngular(() => this._initEditor());
|
|
14819
14863
|
}
|
|
14820
14864
|
_initEditor() {
|
|
14821
14865
|
const SUNEDITOR = window.SUNEDITOR;
|
|
14822
14866
|
if (!SUNEDITOR) {
|
|
14823
|
-
console.error('[
|
|
14867
|
+
console.error('[matcha-text-editor] SUNEDITOR global não encontrado após injeção.');
|
|
14824
14868
|
return;
|
|
14825
14869
|
}
|
|
14826
|
-
|
|
14870
|
+
const textarea = document.getElementById(this.editorId);
|
|
14871
|
+
if (!textarea) {
|
|
14827
14872
|
requestAnimationFrame(() => this._ngZone.runOutsideAngular(() => this._initEditor()));
|
|
14828
14873
|
return;
|
|
14829
14874
|
}
|
|
14830
|
-
|
|
14831
|
-
this._editor = SUNEDITOR.create(`#${this.editorId}`, {
|
|
14875
|
+
this._editor = SUNEDITOR.create(textarea, {
|
|
14832
14876
|
plugins: SUNEDITOR.plugins,
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14877
|
+
lang: window.SUNEDITOR_LANG?.pt_br,
|
|
14878
|
+
externalLibs: {
|
|
14879
|
+
codeMirror: { src: window.CodeMirror },
|
|
14880
|
+
},
|
|
14881
|
+
toolbar_sticky: 0,
|
|
14882
|
+
...buildSunEditorConfig(this._config),
|
|
14883
|
+
events: {
|
|
14884
|
+
onChange: ({ data }) => {
|
|
14885
|
+
if (this._isSettingValue)
|
|
14886
|
+
return;
|
|
14887
|
+
this._ngZone.run(() => {
|
|
14888
|
+
this._onChange(data);
|
|
14889
|
+
this.contentChange.emit(data);
|
|
14890
|
+
});
|
|
14891
|
+
},
|
|
14892
|
+
onBlur: () => this._ngZone.run(() => this._onTouched()),
|
|
14893
|
+
},
|
|
14839
14894
|
});
|
|
14840
14895
|
if (this._disabled) {
|
|
14841
|
-
this._editor.
|
|
14896
|
+
this._editor.disabled();
|
|
14842
14897
|
}
|
|
14843
|
-
// Hide immediately so the skeleton doesn't overlap the editor during initialization
|
|
14844
14898
|
const sunEditorEl = this._el.nativeElement.querySelector('.sun-editor');
|
|
14845
14899
|
if (sunEditorEl)
|
|
14846
14900
|
sunEditorEl.style.display = 'none';
|
|
14847
|
-
this._editor.on('onChange', (content) => {
|
|
14848
|
-
if (this._isSettingValue)
|
|
14849
|
-
return;
|
|
14850
|
-
this._ngZone.run(() => {
|
|
14851
|
-
this._onChange(content);
|
|
14852
|
-
this.contentChange.emit(content);
|
|
14853
|
-
});
|
|
14854
|
-
});
|
|
14855
|
-
this._editor.on('onBlur', () => {
|
|
14856
|
-
this._ngZone.run(() => this._onTouched());
|
|
14857
|
-
});
|
|
14858
14901
|
setTimeout(() => {
|
|
14859
14902
|
if (this._pendingValue) {
|
|
14860
14903
|
this._isSettingValue = true;
|
|
14861
|
-
this._editor.
|
|
14904
|
+
this._editor.setContents(this._pendingValue);
|
|
14862
14905
|
this._pendingValue = '';
|
|
14863
14906
|
setTimeout(() => { this._isSettingValue = false; }, 0);
|
|
14864
14907
|
}
|
|
@@ -15746,5 +15789,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
15746
15789
|
* Generated bundle index. Do not edit.
|
|
15747
15790
|
*/
|
|
15748
15791
|
|
|
15749
|
-
export { CopyButtonComponent,
|
|
15792
|
+
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 };
|
|
15750
15793
|
//# sourceMappingURL=matcha-components.mjs.map
|