Skip to content

Commit

Permalink
Optimize text action menu
Browse files Browse the repository at this point in the history
  • Loading branch information
shuzijun committed Mar 19, 2023
1 parent 3b0db69 commit a4147db
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,39 @@

# Markdown Editor Changelog

## 2.0.5

### Added

- Support Absolute Path。[#84](https://github.com/shuzijun/markdown-editor/issues/84)

### Changed

- Optimize text action menu.
- Upgrade vditor to `3.9.1`

### Fixed

- fix [#62](https://github.com/shuzijun/markdown-editor/issues/62)

### Removed

## 2.0.4

### Added

- Open file wait for animation

### Changed

### Fixed

- fix [#81](https://github.com/shuzijun/markdown-editor/issues/81)
- fix [#72](https://github.com/shuzijun/markdown-editor/issues/72)
- fix [#65](https://github.com/shuzijun/markdown-editor/issues/65)

### Removed

- Remove the shortcut key to close the search box by default

## 2.0.2
Expand All @@ -22,6 +44,7 @@
### Changed

- fix [#68](https://github.com/shuzijun/markdown-editor/issues/68)

### Fixed

### Removed
Expand All @@ -33,6 +56,7 @@
### Changed

- Upgrade vditor to `3.8.17`

### Fixed

### Removed
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginGroup = com.shuzijun.markdown
pluginName = markdown-editor
pluginVersion = 2.0.4
pluginVersion = 2.0.5

pluginSinceBuild = 221.0
pluginUntilBuild =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.shuzijun.markdown.editor;

import com.alibaba.fastjson.JSONObject;
import com.intellij.CommonBundle;
import com.intellij.ide.*;
import com.intellij.ide.actions.searcheverywhere.SearchEverywhereManager;
Expand Down Expand Up @@ -205,6 +204,7 @@ protected DefaultCefContextMenuHandler createDefaultContextMenuHandler() {
@Override
public void onBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams params, CefMenuModel model) {
if (isFileEditor) {
getCefBrowser().executeJavaScript("jsAddBlur()", getCefBrowser().getURL(), 0);
model.clear();
ActionGroup anAction = (ActionGroup) ActionManager.getInstance().getAction("EditorPopupMenu");
ActionPopupMenu actionPopupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.EDITOR_POPUP, anAction);
Expand Down Expand Up @@ -302,7 +302,11 @@ public String getInjectScript() {
String paste = "function jsPaste(value){\n" +
" vditor.updateValue(value);\n" +
" }\n";
return savaTime + copy + cut + paste;

String blur = "function jsAddBlur(){\n" +
" vditor.vditor.ir.element.addEventListener('blur',(event) => {event.stopImmediatePropagation();}, {capture: true,once: true});\n" +
" }\n";
return savaTime + copy + cut + paste + blur;
}

public void browserFind(String txt, boolean forward) {
Expand Down

0 comments on commit a4147db

Please sign in to comment.