Skip to content

Commit 859f56b

Browse files
authored
Merge pull request #69 from cameron-toy/mdfix2
markdown fixes
2 parents c2c7d52 + 64ba6be commit 859f56b

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,8 @@ function addCommands(
408408
icon: runIcon,
409409
execute: (args) => {
410410
const widget = outputTracker.currentWidget;
411-
const cell = widget.cell as CodeCell;
412411
const sessionContext = widget.notebook.sessionContext;
413-
CodeCell.execute(cell, sessionContext);
412+
CodeCell.execute(widget.cell as CodeCell, sessionContext);
414413
},
415414
});
416415

src/widget.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,17 @@ export class DashboardWidget extends Widget {
9393
let clone: Widget;
9494
const cellType = cell.model.type;
9595
const container = document.createElement('div');
96+
let cloneNode: HTMLElement;
97+
let nodes: HTMLCollectionOf<Element>;
98+
let node: HTMLElement;
9699

97100
switch (cellType) {
98101
case 'markdown':
99-
clone = (cell as MarkdownCell).clone().editorWidget.parent;
102+
cloneNode = (cell as MarkdownCell).clone().node;
103+
nodes = cloneNode.getElementsByClassName('jp-MarkdownOutput');
104+
node = nodes[0] as HTMLElement;
105+
node.style.paddingRight = '0';
106+
clone = new Widget({ node });
100107
container.classList.add(MARKDOWN_OUTPUT_CLASS);
101108
break;
102109
case 'code':
@@ -569,6 +576,14 @@ export class DashboardWidget extends Widget {
569576
this._locked = newState;
570577
}
571578

579+
get content(): Widget {
580+
return this._content;
581+
}
582+
set content(newContent: Widget) {
583+
this._content.dispose();
584+
this._content = newContent;
585+
}
586+
572587
private _notebook: NotebookPanel;
573588
private _notebookId: string;
574589
private _index: number;

style/index.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
}
44

55
.pr-DashboardWidget {
6-
display: flex;
6+
display: inline-flex;
77
align-items: center;
88
justify-content: center;
99
}
1010

11+
.pr-DashboardWidget .pr-MarkdownOutput {
12+
display: inline-block;
13+
}
14+
1115
.pr-EditableWidget {
1216
border: var(--jp-border-width) solid var(--jp-inverse-layout-color4);
1317
background: var(--jp-layout-color0);
@@ -63,10 +67,6 @@
6367
display: inline-block;
6468
}
6569

66-
.pr-DashboardWidgetChild.pr-MarkdownOutput {
67-
flex-grow: 1;
68-
}
69-
7070
.pr-EditableWidget:hover .pr-Resizer {
7171
display: block;
7272
}

0 commit comments

Comments
 (0)