matcha-components 20.237.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 +120 -89
- 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,17 +14796,9 @@ class MatchaTextEditorComponent {
|
|
|
14761
14796
|
}
|
|
14762
14797
|
setDisabledState(isDisabled) {
|
|
14763
14798
|
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
|
-
}
|
|
14799
|
+
if (!this._editor)
|
|
14800
|
+
return;
|
|
14801
|
+
isDisabled ? this._editor.disabled() : this._editor.enabled();
|
|
14775
14802
|
}
|
|
14776
14803
|
// Private
|
|
14777
14804
|
_injectScript(id, url) {
|
|
@@ -14791,7 +14818,7 @@ class MatchaTextEditorComponent {
|
|
|
14791
14818
|
script.id = id;
|
|
14792
14819
|
script.src = url;
|
|
14793
14820
|
script.onload = () => { script.setAttribute('data-loaded', 'true'); resolve(); };
|
|
14794
|
-
script.onerror = () => { console.warn(`[
|
|
14821
|
+
script.onerror = () => { console.warn(`[matcha-text-editor] Falha ao carregar: ${id}`); resolve(); };
|
|
14795
14822
|
document.head.appendChild(script);
|
|
14796
14823
|
});
|
|
14797
14824
|
}
|
|
@@ -14811,39 +14838,48 @@ class MatchaTextEditorComponent {
|
|
|
14811
14838
|
});
|
|
14812
14839
|
}
|
|
14813
14840
|
async _loadAssets() {
|
|
14814
|
-
|
|
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`);
|
|
14815
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`);
|
|
14816
14854
|
}
|
|
14817
14855
|
_reloadEditor() {
|
|
14818
|
-
this.
|
|
14819
|
-
|
|
14856
|
+
const content = this._editor?.getContents() ?? '';
|
|
14857
|
+
this._editor?.destroy();
|
|
14820
14858
|
this._editor = null;
|
|
14821
14859
|
this._pendingValue = content;
|
|
14822
14860
|
this.isLoading = true;
|
|
14823
14861
|
this._cdr.detectChanges();
|
|
14824
|
-
this._ngZone.runOutsideAngular(() =>
|
|
14825
|
-
this._initEditor();
|
|
14826
|
-
});
|
|
14862
|
+
this._ngZone.runOutsideAngular(() => this._initEditor());
|
|
14827
14863
|
}
|
|
14828
14864
|
_initEditor() {
|
|
14829
14865
|
const SUNEDITOR = window.SUNEDITOR;
|
|
14830
14866
|
if (!SUNEDITOR) {
|
|
14831
|
-
console.error('[
|
|
14867
|
+
console.error('[matcha-text-editor] SUNEDITOR global não encontrado após injeção.');
|
|
14832
14868
|
return;
|
|
14833
14869
|
}
|
|
14834
|
-
|
|
14870
|
+
const textarea = document.getElementById(this.editorId);
|
|
14871
|
+
if (!textarea) {
|
|
14835
14872
|
requestAnimationFrame(() => this._ngZone.runOutsideAngular(() => this._initEditor()));
|
|
14836
14873
|
return;
|
|
14837
14874
|
}
|
|
14838
|
-
|
|
14839
|
-
this._editor = SUNEDITOR.create(`#${this.editorId}`, {
|
|
14875
|
+
this._editor = SUNEDITOR.create(textarea, {
|
|
14840
14876
|
plugins: SUNEDITOR.plugins,
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14877
|
+
lang: window.SUNEDITOR_LANG?.pt_br,
|
|
14878
|
+
externalLibs: {
|
|
14879
|
+
codeMirror: { src: window.CodeMirror },
|
|
14880
|
+
},
|
|
14881
|
+
toolbar_sticky: 0,
|
|
14882
|
+
...buildSunEditorConfig(this._config),
|
|
14847
14883
|
events: {
|
|
14848
14884
|
onChange: ({ data }) => {
|
|
14849
14885
|
if (this._isSettingValue)
|
|
@@ -14853,24 +14889,19 @@ class MatchaTextEditorComponent {
|
|
|
14853
14889
|
this.contentChange.emit(data);
|
|
14854
14890
|
});
|
|
14855
14891
|
},
|
|
14856
|
-
onBlur: () =>
|
|
14857
|
-
this._ngZone.run(() => this._onTouched());
|
|
14858
|
-
},
|
|
14892
|
+
onBlur: () => this._ngZone.run(() => this._onTouched()),
|
|
14859
14893
|
},
|
|
14860
14894
|
});
|
|
14861
14895
|
if (this._disabled) {
|
|
14862
|
-
|
|
14863
|
-
this._editor.$.toolbar.disable();
|
|
14864
|
-
wysiwyg?.setAttribute('contenteditable', 'false');
|
|
14896
|
+
this._editor.disabled();
|
|
14865
14897
|
}
|
|
14866
|
-
// Hide immediately so the skeleton doesn't overlap the editor during initialization
|
|
14867
14898
|
const sunEditorEl = this._el.nativeElement.querySelector('.sun-editor');
|
|
14868
14899
|
if (sunEditorEl)
|
|
14869
14900
|
sunEditorEl.style.display = 'none';
|
|
14870
14901
|
setTimeout(() => {
|
|
14871
14902
|
if (this._pendingValue) {
|
|
14872
14903
|
this._isSettingValue = true;
|
|
14873
|
-
this._editor
|
|
14904
|
+
this._editor.setContents(this._pendingValue);
|
|
14874
14905
|
this._pendingValue = '';
|
|
14875
14906
|
setTimeout(() => { this._isSettingValue = false; }, 0);
|
|
14876
14907
|
}
|
|
@@ -15758,5 +15789,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
15758
15789
|
* Generated bundle index. Do not edit.
|
|
15759
15790
|
*/
|
|
15760
15791
|
|
|
15761
|
-
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 };
|
|
15762
15793
|
//# sourceMappingURL=matcha-components.mjs.map
|