Skip to content

Commit 2be2b9c

Browse files
author
lgajos
committed
refresh markdown only if note changed
1 parent f7e1277 commit 2be2b9c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/main/java/notepack/noterender/MarkdownController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class MarkdownController extends TextAreaController {
6060
private MenuButton btnActions;
6161

6262
private String currentCssValue = "";
63+
private String lastNoteValue = "";
6364

6465
@Override
6566
public void initialize(URL url, ResourceBundle rb) {
@@ -86,10 +87,16 @@ public void initialize(URL url, ResourceBundle rb) {
8687
}
8788

8889
private void refreshWebview(String value) {
90+
91+
if (lastNoteValue.equals(value)) {
92+
return;
93+
}
94+
8995
Node document = parser.parse(value);
9096
String html = renderer.render(document);
9197
String htmlDoc = "<html><head><style>" + currentCssValue + "</style></head><body>" + html + "</body>";
9298
markdownWebRender.getEngine().loadContent(htmlDoc);
99+
lastNoteValue = value;
93100
}
94101

95102
@Override

0 commit comments

Comments
 (0)