Skip to content

Commit

Permalink
Merge pull request #18 from Hinaser/v0.0.8
Browse files Browse the repository at this point in the history
V0.0.8
  • Loading branch information
Hinaser authored Apr 12, 2021
2 parents a33861a + c8ab61b commit 3d3dfff
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.0.8] - April 11, 2021
### Fixed
- Fixed an issue where IDE stops loading on startup.

## [0.0.7] - April 9, 2021
### Fixed
- Fixed an issue where IDE version limitation was not correctly removed.
Expand Down Expand Up @@ -39,6 +43,7 @@
### Fixed
- Fixed an issue where offline parser did not properly parse and render some gfm syntax.

[0.0.8]: https://github.com/Hinaser/gfm-advanced/compare/v0.0.7...v0.0.8
[0.0.7]: https://github.com/Hinaser/gfm-advanced/compare/v0.0.6...v0.0.7
[0.0.6]: https://github.com/Hinaser/gfm-advanced/compare/v0.0.5...v0.0.6
[0.0.5]: https://github.com/Hinaser/gfm-advanced/compare/v0.0.4...v0.0.5
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
apply plugin: 'org.jetbrains.changelog'

group 'com.github.hinaser'
version '0.0.7'
version '0.0.8'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class ChromiumBrowser implements IBrowser, Disposable {

public ChromiumBrowser() {
browser = new JBCefBrowser();
// To support older version, I intentionally use deprecated method here.
// If replaced to non-deprecated method, it eventually drops support on idea version <= 202.*.
jsQuery = JBCefJSQuery.create(browser);
isReadyToExecuteJavaScript = false;
addLoadHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public class GfmAToolWindow extends JPanel implements Disposable {
private static GfmAToolWindow instance = null;

private final ApplicationSettingsService appSettings = ApplicationSettingsService.getInstance();
private final IBrowser browser = new ChromiumBrowser();
private final ThrottlePoolExecutor rateLimiterForToolWindow = new ThrottlePoolExecutor(1000);;
private final MarkdownParsedAdapter markdownParsedAdapter;
private final String listenerId;
private IBrowser browser;
private final ThrottlePoolExecutor rateLimiterForToolWindow = new ThrottlePoolExecutor(1000);
private MarkdownParsedAdapter markdownParsedAdapter;
private String listenerId;

public static GfmAToolWindow getInstance(){
if(instance == null){
Expand All @@ -37,15 +37,28 @@ public static GfmAToolWindow getInstance(){
}

private GfmAToolWindow() {
this.markdownParsedAdapter = new MarkdownParsedAdapter(this.browser, "");
this.listenerId = EditorTabListenerManager.addListener(new TabSelectedListener());

this.appSettings.addApplicationSettingsChangedListener(new SettingsChangeListener(), this);
this.listenerId = EditorTabListenerManager.addListener(new TabSelectedListener());

JPanel container = new JPanel(new BorderLayout());
container.add(browser.getComponent(), BorderLayout.CENTER);
setLayout(new BorderLayout());
add(container, BorderLayout.CENTER);

/*
* I found that on IDE's startup, `new ChromiumBrowser()` possibly blocks thread somehow.
* In order to avoid that, here trying to defer browser instance initialization.
*/
new Thread(() -> {
try {
Thread.sleep(17);
this.browser = new ChromiumBrowser();
this.markdownParsedAdapter = new MarkdownParsedAdapter(this.browser, "");
container.add(browser.getComponent(), BorderLayout.CENTER);
}
catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
}).start();
}

public void render(String markdown) {
Expand Down

0 comments on commit 3d3dfff

Please sign in to comment.