matcha-components 20.17.0 → 20.21.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.
|
@@ -5679,12 +5679,52 @@ class MatchaHighlightComponent {
|
|
|
5679
5679
|
// // Add new theme class
|
|
5680
5680
|
// element.classList.add(`theme-${this.theme}`);
|
|
5681
5681
|
// }
|
|
5682
|
+
/**
|
|
5683
|
+
* Carrega o PrismJS dinamicamente
|
|
5684
|
+
*/
|
|
5685
|
+
async loadPrismJS() {
|
|
5686
|
+
return new Promise((resolve, reject) => {
|
|
5687
|
+
// Verifica se já está carregado
|
|
5688
|
+
if (typeof window.Prism !== 'undefined') {
|
|
5689
|
+
resolve();
|
|
5690
|
+
return;
|
|
5691
|
+
}
|
|
5692
|
+
// Carrega o PrismJS principal
|
|
5693
|
+
const script = document.createElement('script');
|
|
5694
|
+
script.src = '/assets/prismjs/prism.js';
|
|
5695
|
+
script.onload = () => {
|
|
5696
|
+
// Carrega os componentes de linguagem
|
|
5697
|
+
this.loadPrismComponent('/assets/prismjs/components/prism-javascript.js');
|
|
5698
|
+
this.loadPrismComponent('/assets/prismjs/components/prism-css.js');
|
|
5699
|
+
this.loadPrismComponent('/assets/prismjs/components/prism-markup.js');
|
|
5700
|
+
console.log('PrismJS carregado com sucesso');
|
|
5701
|
+
resolve();
|
|
5702
|
+
};
|
|
5703
|
+
script.onerror = () => {
|
|
5704
|
+
console.error('Erro ao carregar PrismJS');
|
|
5705
|
+
reject(new Error('Erro ao carregar PrismJS'));
|
|
5706
|
+
};
|
|
5707
|
+
document.head.appendChild(script);
|
|
5708
|
+
});
|
|
5709
|
+
}
|
|
5710
|
+
/**
|
|
5711
|
+
* Carrega um componente do PrismJS
|
|
5712
|
+
*/
|
|
5713
|
+
loadPrismComponent(src) {
|
|
5714
|
+
const script = document.createElement('script');
|
|
5715
|
+
script.src = src;
|
|
5716
|
+
document.head.appendChild(script);
|
|
5717
|
+
}
|
|
5682
5718
|
/**
|
|
5683
5719
|
* Highlight the given source code
|
|
5684
5720
|
*
|
|
5685
5721
|
* @param sourceCode
|
|
5686
5722
|
*/
|
|
5687
|
-
highlight(sourceCode) {
|
|
5723
|
+
async highlight(sourceCode) {
|
|
5724
|
+
// Carrega o PrismJS dinamicamente se não estiver disponível
|
|
5725
|
+
if (typeof window.Prism === 'undefined') {
|
|
5726
|
+
await this.loadPrismJS();
|
|
5727
|
+
}
|
|
5688
5728
|
const Prism = window.Prism;
|
|
5689
5729
|
console.log('Highlighting code:', sourceCode.substring(0, 50) + '...');
|
|
5690
5730
|
console.log('Language:', this.lang);
|
|
@@ -7754,12 +7794,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
7754
7794
|
}]
|
|
7755
7795
|
}] });
|
|
7756
7796
|
|
|
7757
|
-
|
|
7758
|
-
require('./prismjs/components/prism-javascript');
|
|
7759
|
-
require('./prismjs/components/prism-css');
|
|
7760
|
-
require('./prismjs/components/prism-markup');
|
|
7761
|
-
// Torna o Prism disponível globalmente
|
|
7762
|
-
window.Prism = PrismCore;
|
|
7797
|
+
// Prism.js será carregado dinamicamente no componente quando necessário
|
|
7763
7798
|
class MatchaHighlightModule {
|
|
7764
7799
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
7765
7800
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: MatchaHighlightModule, declarations: [MatchaHighlightComponent,
|