Fix bug of preview content.

This commit is contained in:
Florian THIERRY
2024-09-21 22:20:00 +02:00
parent d893afa1f3
commit a3adfa8ee0
9 changed files with 77 additions and 45 deletions

View File

@@ -9,6 +9,7 @@ import { PublicationRestService } from "../../core/rest-services/publications/pu
import { copy } from "../../core/utils/ObjectUtils";
import { CodeBlockDialog } from "./code-block-dialog/code-block-dialog.component";
import { PictureSelectionDialog } from "./picture-selection-dialog/picture-selection-dialog.component";
import { PreviewContentRequest } from "../../core/rest-services/publications/model/preview";
declare let Prism: any;
@@ -76,7 +77,7 @@ export class PublicationEditionService implements OnDestroy {
}
private _save(state: PublicationEditionState): void {
this.stateSubject.next(state);
this.stateSubject.next(state);
}
get isLoading$(): Observable<boolean> {
@@ -268,9 +269,12 @@ export class PublicationEditionService implements OnDestroy {
const state = this._state;
this.isPreviewingSubject.next(true);
this.publicationRestService.preview(state.publication.text)
.then(parsedText => {
state.publication.parsedText = parsedText;
const request: PreviewContentRequest = {
text: state.publication.text
};
this.publicationRestService.preview(request)
.then(response => {
state.publication.parsedText = response.text;
this._save(state);
setTimeout(() => Prism.highlightAll(), 1000);
})