matcha-components 20.267.0 → 20.268.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.
@@ -15622,8 +15622,10 @@ class MatchaPageBuilderComponent {
15622
15622
  }
15623
15623
  constructor(ngZone) {
15624
15624
  this.ngZone = ngZone;
15625
- this.showControls = true;
15625
+ this.showControls = false;
15626
15626
  this.onSave = new EventEmitter();
15627
+ this.onChange = new EventEmitter();
15628
+ this._changeDebounceTimer = null;
15627
15629
  this.containerId = 'gjs-' + Math.random().toString(36).substring(2, 9);
15628
15630
  this.isLoading = true;
15629
15631
  this._text = '';
@@ -16114,6 +16116,16 @@ class MatchaPageBuilderComponent {
16114
16116
  this.editor.setComponents(this._text);
16115
16117
  }
16116
16118
  this.ngZone.run(() => { this.isLoading = false; });
16119
+ editor.on('update', () => {
16120
+ clearTimeout(this._changeDebounceTimer);
16121
+ this._changeDebounceTimer = setTimeout(() => {
16122
+ const html = editor.getHtml();
16123
+ const css = editor.getCss();
16124
+ this.ngZone.run(() => {
16125
+ this.onChange.emit(`<style>${css}</style>${html}`);
16126
+ });
16127
+ }, 300);
16128
+ });
16117
16129
  });
16118
16130
  // Se o evento 'load' demorar, podemos tentar setar os componentes se já estiver inicializado
16119
16131
  if (this.editor && !this.isEditorInitialized && this._text) {
@@ -16134,12 +16146,13 @@ class MatchaPageBuilderComponent {
16134
16146
  this.onSave.emit(combinedOutput);
16135
16147
  }
16136
16148
  ngOnDestroy() {
16149
+ clearTimeout(this._changeDebounceTimer);
16137
16150
  if (this.editor) {
16138
16151
  this.editor.destroy();
16139
16152
  }
16140
16153
  }
16141
16154
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaPageBuilderComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
16142
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaPageBuilderComponent, isStandalone: false, selector: "matcha-page-builder", inputs: { showControls: "showControls", text: "text" }, outputs: { onSave: "onSave" }, viewQueries: [{ propertyName: "gjsContainer", first: true, predicate: ["gjsContainer"], descendants: true }], ngImport: i0, template: "<div class=\"matcha-page-builder\">\n <matcha-spinner *ngIf=\"isLoading\"></matcha-spinner>\n <div class=\"editor-shell\" [style.display]=\"isLoading ? 'none' : 'block'\">\n <div [id]=\"containerId\"></div>\n </div>\n <div class=\"editor-controls\" *ngIf=\"showControls && !isLoading\">\n <button matcha-button (click)=\"save()\">Salvar</button>\n </div>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatchaButtonComponent, selector: "[matcha-button]", inputs: ["size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl", "gap", "color", "basic", "outline", "alpha", "pill", "link", "icon", "badge"] }, { kind: "component", type: MatchaSpinnerComponent, selector: "matcha-spinner", inputs: ["progress", "color", "size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl"] }], encapsulation: i0.ViewEncapsulation.None }); }
16155
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaPageBuilderComponent, isStandalone: false, selector: "matcha-page-builder", inputs: { showControls: "showControls", text: "text" }, outputs: { onSave: "onSave", onChange: "onChange" }, viewQueries: [{ propertyName: "gjsContainer", first: true, predicate: ["gjsContainer"], descendants: true }], ngImport: i0, template: "<div class=\"matcha-page-builder\">\n <matcha-spinner *ngIf=\"isLoading\"></matcha-spinner>\n <div class=\"editor-shell\" [style.display]=\"isLoading ? 'none' : 'block'\">\n <div [id]=\"containerId\"></div>\n </div>\n <div class=\"editor-controls\" *ngIf=\"showControls && !isLoading\">\n <button matcha-button (click)=\"save()\">Salvar</button>\n </div>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatchaButtonComponent, selector: "[matcha-button]", inputs: ["size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl", "gap", "color", "basic", "outline", "alpha", "pill", "link", "icon", "badge"] }, { kind: "component", type: MatchaSpinnerComponent, selector: "matcha-spinner", inputs: ["progress", "color", "size", "size-xs", "size-sm", "size-md", "size-lg", "size-xl"] }], encapsulation: i0.ViewEncapsulation.None }); }
16143
16156
  }
16144
16157
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaPageBuilderComponent, decorators: [{
16145
16158
  type: Component,
@@ -16151,6 +16164,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
16151
16164
  type: Input
16152
16165
  }], onSave: [{
16153
16166
  type: Output
16167
+ }], onChange: [{
16168
+ type: Output
16154
16169
  }], text: [{
16155
16170
  type: Input
16156
16171
  }] } });