@scm-manager/scm-code-editor-plugin 2.0.1-20240127-101222 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +14 -14
- package/src/main/js/components/CodeEditor.tsx +16 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## 2.1.0 - 2024-03-14
|
|
8
|
+
### Added
|
|
9
|
+
- Esc shortcut to the editor
|
|
10
|
+
|
|
7
11
|
## 2.0.0 - 2024-02-27
|
|
8
12
|
### Added
|
|
9
13
|
- added an on blur callback and additional keybinds to blur the editor
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-manager/scm-code-editor-plugin",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./src/main/js/index.tsx",
|
|
7
7
|
"scripts": {
|
|
@@ -12,27 +12,27 @@
|
|
|
12
12
|
"deploy": "plugin-scripts publish"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@scm-manager/ui-api": "3.0.0",
|
|
16
|
-
"@scm-manager/ui-buttons": "3.0.0",
|
|
17
15
|
"@scm-manager/ui-components": "3.0.0",
|
|
18
16
|
"@scm-manager/ui-extensions": "3.0.0",
|
|
19
|
-
"@scm-manager/ui-forms": "3.0.0",
|
|
20
|
-
"@scm-manager/ui-layout": "3.0.0",
|
|
21
|
-
"@scm-manager/ui-overlays": "3.0.0",
|
|
22
17
|
"@scm-manager/ui-plugins": "3.0.0",
|
|
23
18
|
"classnames": "^2.2.6",
|
|
24
19
|
"query-string": "6.14.1",
|
|
25
20
|
"react": "17",
|
|
26
21
|
"react-ace": "^9.1.4",
|
|
27
|
-
"react-dom": "17",
|
|
28
|
-
"react-hook-form": "^7.5.1",
|
|
29
22
|
"react-i18next": "11",
|
|
30
|
-
"react-query": "^3.25.1",
|
|
31
23
|
"react-redux": "^5.0.7",
|
|
32
|
-
"react-router": "^5.3.1",
|
|
33
24
|
"react-router-dom": "^5.3.1",
|
|
34
25
|
"redux": "^4.0.0",
|
|
35
|
-
"styled-components": "^5.3.5"
|
|
26
|
+
"styled-components": "^5.3.5",
|
|
27
|
+
"react-hook-form": "^7.5.1",
|
|
28
|
+
"react-router": "^5.3.1",
|
|
29
|
+
"react-dom": "17",
|
|
30
|
+
"@scm-manager/ui-api": "3.0.0",
|
|
31
|
+
"@scm-manager/ui-forms": "3.0.0",
|
|
32
|
+
"@scm-manager/ui-buttons": "3.0.0",
|
|
33
|
+
"@scm-manager/ui-overlays": "3.0.0",
|
|
34
|
+
"@scm-manager/ui-layout": "3.0.0",
|
|
35
|
+
"react-query": "^3.25.1"
|
|
36
36
|
},
|
|
37
37
|
"babel": {
|
|
38
38
|
"presets": [
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"@scm-manager/babel-preset": "^2.13.1",
|
|
51
51
|
"@scm-manager/eslint-config": "^2.17.0",
|
|
52
52
|
"@scm-manager/jest-preset": "^2.13.0",
|
|
53
|
-
"@scm-manager/plugin-scripts": "^1.2.2",
|
|
54
53
|
"@scm-manager/prettier-config": "^2.10.1",
|
|
55
54
|
"@scm-manager/tsconfig": "^2.13.0",
|
|
56
55
|
"@scm-manager/ui-scripts": "^2.32.2",
|
|
@@ -66,7 +65,8 @@
|
|
|
66
65
|
"@types/react-redux": "5.0.7",
|
|
67
66
|
"@types/react-router-dom": "^5.3.3",
|
|
68
67
|
"@types/styled-components": "^5.1.25",
|
|
69
|
-
"jest": "^24.9.0"
|
|
68
|
+
"jest": "^24.9.0",
|
|
69
|
+
"@scm-manager/plugin-scripts": "^1.2.2"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
@@ -74,4 +74,4 @@
|
|
|
74
74
|
"files": [
|
|
75
75
|
"src/main/js"
|
|
76
76
|
]
|
|
77
|
-
}
|
|
77
|
+
}
|
|
@@ -32,6 +32,11 @@ import styled from "styled-components";
|
|
|
32
32
|
|
|
33
33
|
const defaultLanguage = "text";
|
|
34
34
|
|
|
35
|
+
type OnBlurCallbacks = {
|
|
36
|
+
esc: () => void;
|
|
37
|
+
strgEnter: () => void;
|
|
38
|
+
};
|
|
39
|
+
|
|
35
40
|
type Props = WithTranslation & {
|
|
36
41
|
content?: string;
|
|
37
42
|
language: string;
|
|
@@ -39,7 +44,7 @@ type Props = WithTranslation & {
|
|
|
39
44
|
className?: string;
|
|
40
45
|
initialFocus?: boolean;
|
|
41
46
|
onChange: (value: string) => void;
|
|
42
|
-
onBlur?:
|
|
47
|
+
onBlur?: OnBlurCallbacks;
|
|
43
48
|
};
|
|
44
49
|
|
|
45
50
|
type State = {
|
|
@@ -125,7 +130,6 @@ class CodeEditor extends Component<Props, State> {
|
|
|
125
130
|
name="UNIQUE_ID_OF_DIV"
|
|
126
131
|
value={content}
|
|
127
132
|
readOnly={disabled}
|
|
128
|
-
onBlur={this.props.onBlur}
|
|
129
133
|
width="100%"
|
|
130
134
|
fontSize="14px"
|
|
131
135
|
onFocus={(event, editor: Ace.Editor) => this.reloadEditor(editor)}
|
|
@@ -136,10 +140,19 @@ class CodeEditor extends Component<Props, State> {
|
|
|
136
140
|
navigateToFileEnd={false}
|
|
137
141
|
commands={[
|
|
138
142
|
{
|
|
139
|
-
name: "
|
|
143
|
+
name: "ToCommitMessage",
|
|
140
144
|
bindKey: { mac: "Command-Enter", win: "Ctrl-Enter" },
|
|
141
145
|
exec: editor => {
|
|
142
146
|
editor.blur();
|
|
147
|
+
this.props.onBlur?.strgEnter();
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "ToCancelButton",
|
|
152
|
+
bindKey: { mac: "Esc", win: "Esc" },
|
|
153
|
+
exec: editor => {
|
|
154
|
+
editor.blur();
|
|
155
|
+
this.props.onBlur?.esc();
|
|
143
156
|
}
|
|
144
157
|
}
|
|
145
158
|
]}
|