@scm-manager/scm-code-editor-plugin 1.0.2-20230013-143301 → 1.0.2-20230016-123218
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-manager/scm-code-editor-plugin",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.2-
|
|
4
|
+
"version": "1.0.2-20230016-123218",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./src/main/js/index.tsx",
|
|
7
7
|
"scripts": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"react-hook-form": "^7.5.1",
|
|
23
23
|
"react-i18next": "^10.13.1",
|
|
24
24
|
"react-redux": "^5.0.7",
|
|
25
|
+
"react-router": "^5.3.1",
|
|
25
26
|
"react-router-dom": "^5.1.2",
|
|
26
27
|
"redux": "^4.0.0",
|
|
27
28
|
"styled-components": "^5.1.0"
|
|
@@ -39,12 +40,12 @@
|
|
|
39
40
|
"extends": "@scm-manager/eslint-config"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@scm-manager/babel-preset": "^2.
|
|
43
|
-
"@scm-manager/eslint-config": "^2.
|
|
44
|
-
"@scm-manager/jest-preset": "^2.
|
|
45
|
-
"@scm-manager/plugin-scripts": "1.
|
|
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/plugin-scripts": "^1.2.2",
|
|
46
47
|
"@scm-manager/prettier-config": "^2.10.1",
|
|
47
|
-
"@scm-manager/tsconfig": "^2.
|
|
48
|
+
"@scm-manager/tsconfig": "^2.13.0",
|
|
48
49
|
"@scm-manager/ui-scripts": "^2.26.0",
|
|
49
50
|
"@scm-manager/ui-tests": "^2.26.0",
|
|
50
51
|
"@scm-manager/ui-types": "^2.26.0",
|
|
@@ -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
|
|
|
@@ -46,6 +47,11 @@ type State = {
|
|
|
46
47
|
language?: string;
|
|
47
48
|
};
|
|
48
49
|
|
|
50
|
+
const StyledAceEditor = styled(AceEditor)`
|
|
51
|
+
resize: vertical;
|
|
52
|
+
min-height: 500px;
|
|
53
|
+
`;
|
|
54
|
+
|
|
49
55
|
class CodeEditor extends Component<Props, State> {
|
|
50
56
|
constructor(props: Props) {
|
|
51
57
|
super(props);
|
|
@@ -94,6 +100,11 @@ class CodeEditor extends Component<Props, State> {
|
|
|
94
100
|
});
|
|
95
101
|
};
|
|
96
102
|
|
|
103
|
+
reloadEditor = (editor: Ace.Editor) => {
|
|
104
|
+
editor.resize(true);
|
|
105
|
+
editor.renderer.updateFull(true);
|
|
106
|
+
}
|
|
107
|
+
|
|
97
108
|
render() {
|
|
98
109
|
const { content, disabled, className, onChange, initialFocus = false, t } = this.props;
|
|
99
110
|
const { language, loading, error } = this.state;
|
|
@@ -105,7 +116,7 @@ class CodeEditor extends Component<Props, State> {
|
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
return (
|
|
108
|
-
<
|
|
119
|
+
<StyledAceEditor
|
|
109
120
|
className={`is-family-monospace ${className}`}
|
|
110
121
|
mode={language}
|
|
111
122
|
theme="scm-manager"
|
|
@@ -115,7 +126,9 @@ class CodeEditor extends Component<Props, State> {
|
|
|
115
126
|
readOnly={disabled}
|
|
116
127
|
width="100%"
|
|
117
128
|
fontSize="14px"
|
|
118
|
-
|
|
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 }}
|
|
119
132
|
placeholder={t("scm-editor-plugin.edit.placeholder")}
|
|
120
133
|
focus={initialFocus}
|
|
121
134
|
navigateToFileEnd={false}
|