Improve tinymce autosave and notification web click solved

This commit is contained in:
Eudes Inácio
2023-08-08 15:40:10 +01:00
parent 5cf48c1b2f
commit bf89e46841
10 changed files with 109 additions and 63 deletions
+2 -1
View File
@@ -26,7 +26,7 @@
language: 'pt_PT',
height: 600,
menubar: false,
autosave_interval:30,
autosave_interval:'3s',
plugins: [
'advlist autolink autosave lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
@@ -40,4 +40,5 @@
initialValue='{{content}}'
[(ngModel)]="content"
(onSaveContent)="somefunction()"
(ngModelChange)="onEditorContentChange()"
></editor>
+25 -23
View File
@@ -19,7 +19,7 @@ export class TinyMCEPage implements OnDestroy {
editorContent: "";
value: "";
private intervalId: any;
private intervalTime: number = 30000;
private intervalTime: number = 3000;
loadingTiny = true
@@ -37,7 +37,7 @@ export class TinyMCEPage implements OnDestroy {
this.waitForTiny();
this.saveDraft();
/* this.saveDraft(); */
}
waitForTiny() {
@@ -59,37 +59,39 @@ export class TinyMCEPage implements OnDestroy {
ngOnDestroy() {
// Certifique-se de limpar o intervalo quando o componente é destruído
if (this.intervalId) {
clearInterval(this.intervalId);
}
window['tinyupdate']()
}
close() {
this.modalController.dismiss()
}
onEditorContentChange() {
console.log('Autosave successful! Content saved to local storage1.');
this.saveDraft()
}
saveDraft() {
this.intervalId = setInterval(() => {
// Lógica que deseja executar em intervalos regulares
console.log('Intervalo de 30 segundos...');
console.log(document)
let objectDraft = {
"status": false,
"description": this.Document.Assunto,
"content": this.content,
"path": this.Document.path,
"ownerId": this.Document.ownerId
}
this.processService.SaveDraftByID(this.Document.DocId, objectDraft).subscribe((res) => {
window['tinyupdate']()
}, (error) => {
this.erroHandler.httpStatusHandle(error)
})
}, this.intervalTime);
// Lógica que deseja executar em intervalos regulares
console.log('Intervalo de 3 segundos...');
console.log(document)
let objectDraft = {
"status": false,
"description": this.Document.Assunto,
"content": this.content,
"path": this.Document.path,
"ownerId": this.Document.ownerId
}
this.processService.SaveDraftByID(this.Document.DocId, objectDraft).subscribe((res) => {
console.log('Saved tinymce')
}, (error) => {
this.erroHandler.httpStatusHandle(error)
})
}
somefunction() {
console.log('Saved tinymce')
}
async openOptions() {