Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/diff/unified-cell.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Cell } from '@jupyterlab/cells';
import { Cell, MarkdownCell } from '@jupyterlab/cells';
import { checkIcon, ToolbarButton, undoIcon } from '@jupyterlab/ui-components';
import { ICellFooterTracker } from 'jupyterlab-cell-input-footer';
import {
Expand Down Expand Up @@ -38,6 +38,7 @@ export class UnifiedCellDiffManager extends BaseUnifiedDiffManager {

private static _activeDiffCount = 0;
private _toolbarObserver?: MutationObserver;
private _wasRendered = false;

/**
* Get the shared model for source manipulation
Expand All @@ -50,6 +51,15 @@ export class UnifiedCellDiffManager extends BaseUnifiedDiffManager {
* Activate the diff view without cell toolbar.
*/
protected activate(): void {
const { model } = this._cell;
if (model.type === 'markdown') {
const md = this._cell as MarkdownCell;
if (md.rendered) {
this._wasRendered = true;
md.rendered = false;
}
}

super.activate();
UnifiedCellDiffManager._activeDiffCount++;

Expand All @@ -75,6 +85,11 @@ export class UnifiedCellDiffManager extends BaseUnifiedDiffManager {
UnifiedCellDiffManager._activeDiffCount - 1
);

if (this._wasRendered && this._cell.model.type === 'markdown') {
(this._cell as MarkdownCell).rendered = true;
this._wasRendered = false;
}

if (this._toolbarObserver) {
this._toolbarObserver.disconnect();
this._toolbarObserver = undefined;
Expand Down
Loading