1- import { Cell } from '@jupyterlab/cells' ;
1+ import { Cell , MarkdownCell } from '@jupyterlab/cells' ;
22import { checkIcon , ToolbarButton , undoIcon } from '@jupyterlab/ui-components' ;
33import { ICellFooterTracker } from 'jupyterlab-cell-input-footer' ;
44import {
@@ -38,6 +38,7 @@ export class UnifiedCellDiffManager extends BaseUnifiedDiffManager {
3838
3939 private static _activeDiffCount = 0 ;
4040 private _toolbarObserver ?: MutationObserver ;
41+ private _wasRendered = false ;
4142
4243 /**
4344 * Get the shared model for source manipulation
@@ -50,6 +51,15 @@ export class UnifiedCellDiffManager extends BaseUnifiedDiffManager {
5051 * Activate the diff view without cell toolbar.
5152 */
5253 protected activate ( ) : void {
54+ const { model } = this . _cell ;
55+ if ( model . type === 'markdown' ) {
56+ const md = this . _cell as MarkdownCell ;
57+ if ( md . rendered ) {
58+ this . _wasRendered = true ;
59+ md . rendered = false ;
60+ }
61+ }
62+
5363 super . activate ( ) ;
5464 UnifiedCellDiffManager . _activeDiffCount ++ ;
5565
@@ -75,6 +85,11 @@ export class UnifiedCellDiffManager extends BaseUnifiedDiffManager {
7585 UnifiedCellDiffManager . _activeDiffCount - 1
7686 ) ;
7787
88+ if ( this . _wasRendered && this . _cell . model . type === 'markdown' ) {
89+ ( this . _cell as MarkdownCell ) . rendered = true ;
90+ this . _wasRendered = false ;
91+ }
92+
7893 if ( this . _toolbarObserver ) {
7994 this . _toolbarObserver . disconnect ( ) ;
8095 this . _toolbarObserver = undefined ;
0 commit comments