@scm-manager/scm-code-editor-plugin 1.1.0-20220007-142124 → 1.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 +13 -1
- package/package.json +68 -66
- package/src/main/js/components/CodeEditor.tsx +19 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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
|
-
##
|
|
7
|
+
## 1.1.0 - 2023-01-23
|
|
8
|
+
### Added
|
|
9
|
+
- Make editor resizable
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Make the editor component auto focusable
|
|
13
|
+
|
|
14
|
+
## 1.0.1 - 2022-01-07
|
|
15
|
+
### Fixed
|
|
16
|
+
- High contrast mode findings ([#4](https://github.com/scm-manager/scm-code-editor-plugin/pull/4))
|
|
17
|
+
|
|
18
|
+
## 1.0.0 - 2020-10-27
|
|
8
19
|
### Added
|
|
9
20
|
- Provides code-editor which can be used by other plugins
|
|
21
|
+
|
package/package.json
CHANGED
|
@@ -1,68 +1,70 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
"name": "@scm-manager/scm-code-editor-plugin",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "1.1.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./src/main/js/index.tsx",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"gen-languages": "node scripts/gen-languages.js",
|
|
9
|
+
"build": "plugin-scripts build",
|
|
10
|
+
"watch": "plugin-scripts watch",
|
|
11
|
+
"postinstall": "plugin-scripts postinstall",
|
|
12
|
+
"deploy": "plugin-scripts publish"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@scm-manager/ui-components": "^2.26.0",
|
|
16
|
+
"@scm-manager/ui-extensions": "^2.26.0",
|
|
17
|
+
"@scm-manager/ui-plugins": "2.26.0",
|
|
18
|
+
"classnames": "^2.2.6",
|
|
19
|
+
"query-string": "^5.0.1",
|
|
20
|
+
"react": "^17.0.1",
|
|
21
|
+
"react-ace": "^9.1.4",
|
|
22
|
+
"react-i18next": "^10.13.1",
|
|
23
|
+
"react-redux": "^5.0.7",
|
|
24
|
+
"react-router-dom": "^5.1.2",
|
|
25
|
+
"redux": "^4.0.0",
|
|
26
|
+
"styled-components": "^5.1.0",
|
|
27
|
+
"react-hook-form": "^7.5.1",
|
|
28
|
+
"react-router": "^5.3.1"
|
|
29
|
+
},
|
|
30
|
+
"babel": {
|
|
31
|
+
"presets": [
|
|
32
|
+
"@scm-manager/babel-preset"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"jest": {
|
|
36
|
+
"preset": "@scm-manager/jest-preset"
|
|
37
|
+
},
|
|
38
|
+
"prettier": "@scm-manager/prettier-config",
|
|
39
|
+
"eslintConfig": {
|
|
40
|
+
"extends": "@scm-manager/eslint-config"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@scm-manager/babel-preset": "^2.13.1",
|
|
44
|
+
"@scm-manager/eslint-config": "^2.15.1",
|
|
45
|
+
"@scm-manager/jest-preset": "^2.13.0",
|
|
46
|
+
"@scm-manager/prettier-config": "^2.10.1",
|
|
47
|
+
"@scm-manager/tsconfig": "^2.13.0",
|
|
48
|
+
"@scm-manager/ui-scripts": "^2.26.0",
|
|
49
|
+
"@scm-manager/ui-tests": "^2.26.0",
|
|
50
|
+
"@scm-manager/ui-types": "^2.26.0",
|
|
51
|
+
"@types/classnames": "^2.2.9",
|
|
52
|
+
"@types/enzyme": "^3.10.3",
|
|
53
|
+
"@types/fetch-mock": "^7.3.1",
|
|
54
|
+
"@types/i18next": "^13.0.0",
|
|
55
|
+
"@types/jest": "^24.0.19",
|
|
56
|
+
"@types/query-string": "5",
|
|
57
|
+
"@types/react": "^17.0.1",
|
|
58
|
+
"@types/react-redux": "5.0.7",
|
|
59
|
+
"@types/react-router-dom": "^5.1.0",
|
|
60
|
+
"@types/styled-components": "^5.1.0",
|
|
61
|
+
"jest": "^24.9.0",
|
|
62
|
+
"@scm-manager/plugin-scripts": "^1.2.2"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"files": [
|
|
68
|
+
"src/main/js"
|
|
31
69
|
]
|
|
32
|
-
|
|
33
|
-
"jest": {
|
|
34
|
-
"preset": "@scm-manager/jest-preset"
|
|
35
|
-
},
|
|
36
|
-
"prettier": "@scm-manager/prettier-config",
|
|
37
|
-
"eslintConfig": {
|
|
38
|
-
"extends": "@scm-manager/eslint-config"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@scm-manager/babel-preset": "^2.8.0",
|
|
42
|
-
"@scm-manager/eslint-config": "^2.8.0",
|
|
43
|
-
"@scm-manager/jest-preset": "^2.12.3",
|
|
44
|
-
"@scm-manager/plugin-scripts": "1.0.1",
|
|
45
|
-
"@scm-manager/prettier-config": "^2.8.0",
|
|
46
|
-
"@scm-manager/tsconfig": "^2.8.0",
|
|
47
|
-
"@scm-manager/ui-scripts": "^2.8.0",
|
|
48
|
-
"@scm-manager/ui-tests": "^2.8.0",
|
|
49
|
-
"@scm-manager/ui-types": "^2.8.0",
|
|
50
|
-
"@types/classnames": "^2.2.9",
|
|
51
|
-
"@types/enzyme": "^3.10.3",
|
|
52
|
-
"@types/fetch-mock": "^7.3.1",
|
|
53
|
-
"@types/i18next": "^13.0.0",
|
|
54
|
-
"@types/jest": "^24.0.19",
|
|
55
|
-
"@types/query-string": "5",
|
|
56
|
-
"@types/react": "^16.9.9",
|
|
57
|
-
"@types/react-redux": "5.0.7",
|
|
58
|
-
"@types/react-router-dom": "^5.1.0",
|
|
59
|
-
"@types/styled-components": "^5.1.0",
|
|
60
|
-
"jest": "^24.9.0"
|
|
61
|
-
},
|
|
62
|
-
"publishConfig": {
|
|
63
|
-
"access": "public"
|
|
64
|
-
},
|
|
65
|
-
"files": [
|
|
66
|
-
"src/main/js"
|
|
67
|
-
]
|
|
68
|
-
}
|
|
70
|
+
}
|
|
@@ -28,6 +28,7 @@ import { WithTranslation, withTranslation } from "react-i18next";
|
|
|
28
28
|
import AceEditor from "react-ace";
|
|
29
29
|
import "./EditorTheme.js";
|
|
30
30
|
import findLanguage from "./findLanguage";
|
|
31
|
+
import styled from "styled-components";
|
|
31
32
|
|
|
32
33
|
const defaultLanguage = "text";
|
|
33
34
|
|
|
@@ -36,6 +37,7 @@ type Props = WithTranslation & {
|
|
|
36
37
|
language: string;
|
|
37
38
|
disabled?: boolean;
|
|
38
39
|
className?: string;
|
|
40
|
+
initialFocus?: boolean;
|
|
39
41
|
onChange: (value: string) => void;
|
|
40
42
|
};
|
|
41
43
|
|
|
@@ -45,6 +47,11 @@ type State = {
|
|
|
45
47
|
language?: string;
|
|
46
48
|
};
|
|
47
49
|
|
|
50
|
+
const StyledAceEditor = styled(AceEditor)`
|
|
51
|
+
resize: vertical;
|
|
52
|
+
min-height: 500px;
|
|
53
|
+
`;
|
|
54
|
+
|
|
48
55
|
class CodeEditor extends Component<Props, State> {
|
|
49
56
|
constructor(props: Props) {
|
|
50
57
|
super(props);
|
|
@@ -93,8 +100,13 @@ class CodeEditor extends Component<Props, State> {
|
|
|
93
100
|
});
|
|
94
101
|
};
|
|
95
102
|
|
|
103
|
+
reloadEditor = (editor: Ace.Editor) => {
|
|
104
|
+
editor.resize(true);
|
|
105
|
+
editor.renderer.updateFull(true);
|
|
106
|
+
}
|
|
107
|
+
|
|
96
108
|
render() {
|
|
97
|
-
const { content, disabled, className, onChange, t } = this.props;
|
|
109
|
+
const { content, disabled, className, onChange, initialFocus = false, t } = this.props;
|
|
98
110
|
const { language, loading, error } = this.state;
|
|
99
111
|
|
|
100
112
|
if (loading) {
|
|
@@ -104,7 +116,7 @@ class CodeEditor extends Component<Props, State> {
|
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
return (
|
|
107
|
-
<
|
|
119
|
+
<StyledAceEditor
|
|
108
120
|
className={`is-family-monospace ${className}`}
|
|
109
121
|
mode={language}
|
|
110
122
|
theme="scm-manager"
|
|
@@ -114,8 +126,12 @@ class CodeEditor extends Component<Props, State> {
|
|
|
114
126
|
readOnly={disabled}
|
|
115
127
|
width="100%"
|
|
116
128
|
fontSize="14px"
|
|
117
|
-
|
|
129
|
+
onFocus={(event, editor: Ace.Editor) => this.reloadEditor(editor)}
|
|
130
|
+
onScroll={(editor: Ace.Editor) => this.reloadEditor(editor) }
|
|
131
|
+
setOptions={{ useWorker: false, cursorStyle: "smooth", autoScrollEditorIntoView: true }}
|
|
118
132
|
placeholder={t("scm-editor-plugin.edit.placeholder")}
|
|
133
|
+
focus={initialFocus}
|
|
134
|
+
navigateToFileEnd={false}
|
|
119
135
|
/>
|
|
120
136
|
);
|
|
121
137
|
}
|