@aj-shadow/z-abs-complayer-codeeditor-client 0.0.0-aj-beta.221
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/.gitattributes +26 -0
- package/LICENSE.txt +96 -0
- package/README.md +5 -0
- package/npm-shrinkwrap.json +13 -0
- package/package.json +10 -0
- package/project/client/_build/Bundle-CompLayer-Codeeditor-client.bld +41 -0
- package/project/client/_build/Client-CompLayer-Codeeditor-client-jsx.bld +10 -0
- package/project/client/_build/Client-CompLayer-Codeeditor-client.bld +10 -0
- package/project/client/_build/Client-css-CompLayer-Codeeditor-bundle.bld +9 -0
- package/project/client/_build/z-abs-complayer-codeeditor-client.prj +36 -0
- package/project/client/actions/action-code-editor-file.js +78 -0
- package/project/client/actions/action-code-editor-folder.js +41 -0
- package/project/client/actions/action-code-editor-persistent-data.js +23 -0
- package/project/client/actions/action-code-editor-project.js +23 -0
- package/project/client/actions/action-code-editor-workspace.js +35 -0
- package/project/client/actions/data-action-code-editor-file.js +41 -0
- package/project/client/actions/data-action-code-editor-folder.js +33 -0
- package/project/client/actions/data-action-code-editor-persistent-data.js +27 -0
- package/project/client/actions/data-action-code-editor-project.js +20 -0
- package/project/client/actions/data-action-code-editor-workspace.js +27 -0
- package/project/client/components/middle-code-editor-sidebar.jsx +117 -0
- package/project/client/components/middle-code-editor-toolbar.jsx +638 -0
- package/project/client/components/middle-code-editor-view.jsx +400 -0
- package/project/client/components/middle-code-editor.jsx +50 -0
- package/project/client/css/code-editor.css +44 -0
- package/project/client/css/scrollbar-dark.css +8 -0
- package/project/client/css/scrollbar-light.css +6 -0
- package/project/client/css/search.css +40 -0
- package/project/client/css/search_light.css +8 -0
- package/project/client/css/serach_dark.css +8 -0
- package/project/client/css/sidebar-dark.css +21 -0
- package/project/client/css/sidebar-light.css +18 -0
- package/project/client/css/tab.css +19 -0
- package/project/client/css/tab_dark.css +9 -0
- package/project/client/css/tab_light.css +9 -0
- package/project/client/css/view-dark.css +11 -0
- package/project/client/css/view-light.css +10 -0
- package/project/client/stores/code-editor-store.js +1044 -0
- package/project/z-abs-complayer-codeeditor-client.tree +40 -0
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import CodeEditorStore from '../stores/code-editor-store';
|
|
5
|
+
import { ActionCodeEditorWorkspaceNew, ActionCodeEditorWorkspaceGet, ActionCodeEditorWorkspaceSearch } from '../actions/action-code-editor-workspace';
|
|
6
|
+
import { ActionCodeEditorProjectUpdate, ActionCodeEditorProjectUpdateAll } from '../actions/action-code-editor-project';
|
|
7
|
+
import { ActionCodeEditorPersistentDataUpdate } from '../actions/action-code-editor-persistent-data';
|
|
8
|
+
import { ActionCodeEditorFolderNew, ActionCodeEditorFolderAdd, ActionCodeEditorFolderUpdate, ActionCodeEditorFolderRemove, ActionCodeEditorFolderDelete } from '../actions/action-code-editor-folder';
|
|
9
|
+
import { ActionCodeEditorFileNew, ActionCodeEditorFileAdd, ActionCodeEditorFileRename, ActionCodeEditorFileUpdate, ActionCodeEditorFileUpdateAll, ActionCodeEditorFileRemove, ActionCodeEditorFileDelete } from '../actions/action-code-editor-file';
|
|
10
|
+
import ModalDialogStore from 'z-abs-complayer-modaldialog-client/client/stores/modal-dialog-store';
|
|
11
|
+
import { ActionModalDialogShow, ActionModalDialogHide, ActionModalDialogPending, ActionModalDialogResult } from 'z-abs-complayer-modaldialog-client/client/actions/action-modal-dialog';
|
|
12
|
+
import ModalDialogWorkspaceNew from 'z-abs-complayer-modaldialog-client/client/modal-dialog-workspace-new';
|
|
13
|
+
import ModalDialogWorkspaceOpen from 'z-abs-complayer-modaldialog-client/client/modal-dialog-workspace-open';
|
|
14
|
+
import ModalDialogFolderAdd from 'z-abs-complayer-modaldialog-client/client/modal-dialog-folder-add';
|
|
15
|
+
import ModalDialogFolderNew from 'z-abs-complayer-modaldialog-client/client/modal-dialog-folder-new';
|
|
16
|
+
import ModalDialogFolderProperties from 'z-abs-complayer-modaldialog-client/client/modal-dialog-folder-properties';
|
|
17
|
+
import ModalDialogFolderRemove from 'z-abs-complayer-modaldialog-client/client/modal-dialog-folder-remove';
|
|
18
|
+
import ModalDialogFileAdd from 'z-abs-complayer-modaldialog-client/client/modal-dialog-file-add';
|
|
19
|
+
import ModalDialogFileNew from 'z-abs-complayer-modaldialog-client/client/modal-dialog-file-new';
|
|
20
|
+
import ModalDialogFileProperties from 'z-abs-complayer-modaldialog-client/client/modal-dialog-file-properties';
|
|
21
|
+
import ModalDialogFileRemove from 'z-abs-complayer-modaldialog-client/client/modal-dialog-file-remove';
|
|
22
|
+
import ModalDialogSearch from 'z-abs-complayer-modaldialog-client/client/modal-dialog-search';
|
|
23
|
+
import ButtonNew from 'z-abs-complayer-bootstrap-client/client/button-new';
|
|
24
|
+
import { ActionDialogFileGet, ActionDialogFileSet, ActionDialogWorkspaceSet } from 'z-abs-corelayer-client/client/actions/action-dialog-file';
|
|
25
|
+
import DialogFileStore from 'z-abs-corelayer-client/client/stores/dialog-file-store';
|
|
26
|
+
import {RouterContext} from 'z-abs-complayer-router-client/client/react-component/router-context';
|
|
27
|
+
import ReactComponentRealtime from 'z-abs-corelayer-client/client/react-component/react-component-realtime';
|
|
28
|
+
import React from 'react';
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export default class MiddleCodeEditorToolbar extends ReactComponentRealtime {
|
|
32
|
+
constructor(props) {
|
|
33
|
+
super(props, [CodeEditorStore, ModalDialogStore, DialogFileStore]);
|
|
34
|
+
this._modalDialogWorkspaceNew = null;
|
|
35
|
+
this.boundKeyDown = this._keyDown.bind(this);
|
|
36
|
+
this.buttonFileSaveDisabled = true;
|
|
37
|
+
this.buttonFileSaveAllDisabled = true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static TEMPLATE_NAMES = [
|
|
41
|
+
{name: 'Class [class js file]', type:'js', icon: ''},
|
|
42
|
+
{name: 'None [empty js file]', type:'js', icon: ''},
|
|
43
|
+
{name: 'None [empty jsx file]', type:'jsx', icon: ''},
|
|
44
|
+
{name: 'None [empty css file]', type:'css', icon: ''},
|
|
45
|
+
{name: 'None [empty html file]', type:'html', icon: ''},
|
|
46
|
+
{name: 'React Base', type:'jsx', icon: ''},
|
|
47
|
+
{name: 'React Store', type:'jsx', icon: ''},
|
|
48
|
+
{name: 'React Realtime', type:'jsx', icon: ''}
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
didMount() {
|
|
52
|
+
window.addEventListener('keydown', this.boundKeyDown, true);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
shouldUpdate(nextProps, nextState) {
|
|
56
|
+
return !this.shallowCompare(this.state.CodeEditorStore.project, nextState.CodeEditorStore.project)
|
|
57
|
+
|| !this.shallowCompareMapValues(this.state.CodeEditorStore.projects, nextState.CodeEditorStore.projects)
|
|
58
|
+
|| !this.shallowCompare(this.state.CodeEditorStore.current, nextState.CodeEditorStore.current)
|
|
59
|
+
|| !this.shallowCompareMapValues(this.state.CodeEditorStore.files, nextState.CodeEditorStore.files)
|
|
60
|
+
|| !this.shallowCompare(this.state.CodeEditorStore.persistentData, nextState.CodeEditorStore.persistentData)
|
|
61
|
+
|| !this.shallowCompareMapValues(this.state.ModalDialogStore.modalResults, nextState.ModalDialogStore.modalResults)
|
|
62
|
+
|| !this.shallowCompare(this.state.DialogFileStore.project, nextState.DialogFileStore.project)
|
|
63
|
+
|| !this.shallowCompare(this.state.DialogFileStore.current, nextState.DialogFileStore.current)
|
|
64
|
+
|| !this.shallowCompare(this.state.DialogFileStore.original, nextState.DialogFileStore.original)
|
|
65
|
+
|| !this.shallowCompare(this.state.DialogFileStore.workspace, nextState.DialogFileStore.workspace)
|
|
66
|
+
|| !this.shallowCompare(this.state.DialogFileStore.workspaces, nextState.DialogFileStore.workspaces);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
willUnmount() {
|
|
70
|
+
window.removeEventListener('keydown', this.boundKeyDown, true);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_fileSave() {
|
|
74
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileUpdate(this.state.CodeEditorStore.current.file.key));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_fileSaveAll() {
|
|
78
|
+
const keys = [];
|
|
79
|
+
this.state.CodeEditorStore.files.forEach((file) => {
|
|
80
|
+
if(file.codeChanged) {
|
|
81
|
+
keys.push(file.key);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileUpdateAll(keys));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_keyDown(e) {
|
|
88
|
+
if(e.ctrlKey && e.shiftKey && 'S' === e.key) {
|
|
89
|
+
if(!this.buttonFileSaveAllDisabled) {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
this._fileSaveAll();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if(e.ctrlKey && 's' === e.key) {
|
|
95
|
+
if(!this.buttonFileSaveDisabled) {
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
this._fileSave();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if(e.ctrlKey && e.shiftKey && 'F' === e.key) {
|
|
101
|
+
this._modalDialogSearch.show();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
renderButtonNewWorkspace() {
|
|
106
|
+
let disabled = true;
|
|
107
|
+
this.state.CodeEditorStore.files.forEach((file) => {
|
|
108
|
+
disabled = disabled && !file.codeChanged;
|
|
109
|
+
});
|
|
110
|
+
disabled = !disabled || !this.state.CodeEditorStore.project.isSaved();
|
|
111
|
+
return (
|
|
112
|
+
<ButtonNew colorMark="markup_color" icon="icon-not-implemented" size="aj_btn_sm" placement="bottom" heading="New" content="Workspace" disabled={disabled}
|
|
113
|
+
onClick={(e) => {
|
|
114
|
+
this._modalDialogWorkspaceNew.show(this.state.CodeEditorStore.current.folder);
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
renderButtonOpenWorkspace() {
|
|
121
|
+
return (
|
|
122
|
+
<ButtonNew colorMark="markup_color" icon="icon-not-implemented" size="aj_btn_sm" placement="bottom" heading="Open" content="Workspace"
|
|
123
|
+
onClick={(e) => {
|
|
124
|
+
const dir = '../../..';
|
|
125
|
+
this.dispatch(DialogFileStore, new ActionDialogFileGet(null, null, null, null, 'workspace'));
|
|
126
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_Workspace_Open'));
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
_areAllProjectsSaved() {
|
|
133
|
+
let isProjectsSaved = true;
|
|
134
|
+
const projectIds = [];
|
|
135
|
+
this.state.CodeEditorStore.projects.forEach((project) => {
|
|
136
|
+
isProjectsSaved = isProjectsSaved && project.isSaved();
|
|
137
|
+
if(!project.isSaved()) {
|
|
138
|
+
projectIds.push(project.projectId);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
if(!this.state.CodeEditorStore.project.isSaved()) {
|
|
142
|
+
projectIds.push(this.state.CodeEditorStore.project.projectId);
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
saved: 0 === projectIds.length,
|
|
146
|
+
projectIds: projectIds
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
renderButtonSaveAllProjects() {
|
|
151
|
+
const allProjectsSaved = this._areAllProjectsSaved();
|
|
152
|
+
const disabled = allProjectsSaved.saved;
|
|
153
|
+
return (
|
|
154
|
+
<ButtonNew id="code_editor_project_save" colorMark="markup_color" icon="icon-project-save" size="aj_btn_sm" placement="bottom" heading="Save All" content="Project" disabled={disabled}
|
|
155
|
+
onClick={(e) => {
|
|
156
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorProjectUpdateAll(allProjectsSaved.projectIds));
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
renderButtonFolderNew() {
|
|
163
|
+
const current = this.state.CodeEditorStore.current;
|
|
164
|
+
const enabled = 'folder' === current.type && 'project_folder' !== current.folder.data.type;
|
|
165
|
+
return (
|
|
166
|
+
<ButtonNew id="code_editor_folder_new" colorMark="markup_color" icon="icon-folder-new" size="aj_btn_sm" placement="bottom" heading="New" content="Folder" disabled={!enabled}
|
|
167
|
+
onClick={(e) => {
|
|
168
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_Folder_New'));
|
|
169
|
+
}}
|
|
170
|
+
/>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
renderButtonFolderAdd() {
|
|
175
|
+
const current = this.state.CodeEditorStore.current;
|
|
176
|
+
const enabled = 'folder' === current.type && 'project_folder' !== current.folder.data.type;
|
|
177
|
+
const workspaceName = this.state.CodeEditorStore.current.query?.workspace;
|
|
178
|
+
return (
|
|
179
|
+
<ButtonNew id="code_editor_folder_add" colorMark="markup_color" icon="icon-folder-add" size="aj_btn_sm" placement="bottom" heading="Add" content="Folder" disabled={!enabled}
|
|
180
|
+
onClick={(e) => {
|
|
181
|
+
const folder = current.folder;
|
|
182
|
+
if(this.state.CodeEditorStore.project.projectId === folder.projectId) {
|
|
183
|
+
const dir = `${folder.data.path}/${folder.title}`;
|
|
184
|
+
const project = this.state.CodeEditorStore.project;
|
|
185
|
+
this.dispatch(DialogFileStore, new ActionDialogFileGet(dir, project.getRootName(), [dir], project.getFileNames(dir), 'folder', null, false, workspaceName));
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
const dir = `${folder.data.path}/${folder.title}`;
|
|
189
|
+
const project = this.state.CodeEditorStore.projects.get(folder.projectId);
|
|
190
|
+
this.dispatch(DialogFileStore, new ActionDialogFileGet(dir, project.getRootName(), [dir], project.getFileNames(dir), 'folder', project.type, project.plugin, workspaceName));
|
|
191
|
+
}
|
|
192
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_Folder_Add'));
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
renderButtonFolderProperties() {
|
|
199
|
+
const current = this.state.CodeEditorStore.current;
|
|
200
|
+
const enabled = 'folder' === current.type && 'project_folder' !== current.folder.data.type && 'static_folder' !== current.folder.data.type;
|
|
201
|
+
return (
|
|
202
|
+
<ButtonNew id="code_editor_folder_property" colorMark="markup_color" icon="icon-folder-property" size="aj_btn_sm" placement="bottom" heading="Properties" content="Folder" disabled={!enabled}
|
|
203
|
+
onClick={(e) => {
|
|
204
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_Folder_Properties'));
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
renderButtonFolderDelete() {
|
|
211
|
+
const allProjectsSaved = this._areAllProjectsSaved();
|
|
212
|
+
const current = this.state.CodeEditorStore.current;
|
|
213
|
+
const enabledFolder = current && 'folder' === current.type && 'static_folder' !== current.folder.data.type && 'project_folder' !== current.folder.data.type;
|
|
214
|
+
const disabled = !enabledFolder || !allProjectsSaved.saved;
|
|
215
|
+
return (
|
|
216
|
+
<ButtonNew id="code_editor_folder_delete" colorMark="markup_color" icon="icon-folder-delete" size="aj_btn_sm" heading="Remove or Delete" content="Folder" disabled={disabled}
|
|
217
|
+
onClick={(e) => {
|
|
218
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_Folder_Remove'));
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
renderButtonFileNew() {
|
|
225
|
+
const current = this.state.CodeEditorStore.current;
|
|
226
|
+
const enabled = 'folder' === current.type && 'project_folder' !== current.folder.data.type;
|
|
227
|
+
return (
|
|
228
|
+
<ButtonNew id="code_editor_file_new" colorMark="markup_color" icon="icon-file-new" size="aj_btn_sm" placement="bottom" heading="New" content="File" disabled={!enabled}
|
|
229
|
+
onClick={(e) => {
|
|
230
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_File_New'));
|
|
231
|
+
}}
|
|
232
|
+
/>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
renderButtonFileAdd() {
|
|
237
|
+
const current = this.state.CodeEditorStore.current;
|
|
238
|
+
const enabled = 'folder' === current.type && 'project_folder' !== current.folder.data.type;
|
|
239
|
+
const workspaceName = this.state.CodeEditorStore.current.query?.workspace;
|
|
240
|
+
return (
|
|
241
|
+
<ButtonNew id="code_editor_file_add" colorMark="markup_color" icon="icon-file-add" size="aj_btn_sm" placement="bottom" heading="Add" content="File" disabled={!enabled}
|
|
242
|
+
onClick={(e) => {
|
|
243
|
+
const folder = current.folder;
|
|
244
|
+
if(this.state.CodeEditorStore.project.projectId === folder.projectId) {
|
|
245
|
+
const dir = `${folder.data.path}/${folder.title}`;
|
|
246
|
+
const project = this.state.CodeEditorStore.project;
|
|
247
|
+
this.dispatch(DialogFileStore, new ActionDialogFileGet(dir, project.getRootName(), [dir], project.getFileNames(dir), 'file', null, false, workspaceName));
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
const dir = `${folder.data.path}/${folder.title}`;
|
|
251
|
+
const project = this.state.CodeEditorStore.projects.get(folder.projectId);
|
|
252
|
+
this.dispatch(DialogFileStore, new ActionDialogFileGet(dir, project.getRootName(), [dir], project.getFileNames(dir), 'file', project.type, project.plugin, workspaceName));
|
|
253
|
+
}
|
|
254
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_File_Add'));
|
|
255
|
+
}}
|
|
256
|
+
/>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
renderButtonFileSave() {
|
|
261
|
+
this.buttonFileSaveDisabled = 'file' !== this.state.CodeEditorStore.current.type || !this.state.CodeEditorStore.current.file.codeChanged;
|
|
262
|
+
return (
|
|
263
|
+
<ButtonNew id="code_editor_file_save" colorMark="markup_color" icon="icon-file-save" size="aj_btn_sm" placement="bottom" heading="Save" content="File" shortcut="Ctrl+S" disabled={this.buttonFileSaveDisabled}
|
|
264
|
+
onClick={(e) => {
|
|
265
|
+
this._fileSave();
|
|
266
|
+
}}
|
|
267
|
+
/>
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
renderButtonFileSaveAll() {
|
|
272
|
+
this.buttonFileSaveAllDisabled = true;
|
|
273
|
+
this.state.CodeEditorStore.files.forEach((file) => {
|
|
274
|
+
this.buttonFileSaveAllDisabled = this.buttonFileSaveAllDisabled && !file.codeChanged;
|
|
275
|
+
});
|
|
276
|
+
return (
|
|
277
|
+
<ButtonNew id="code_editor_files_save" colorMark="markup_color" icon="icon-files-save" size="aj_btn_sm" placement="bottom" heading="Save" content="All Files" shortcut="Ctrl+Shift+S" disabled={this.buttonFileSaveAllDisabled}
|
|
278
|
+
onClick={(e) => {
|
|
279
|
+
this._fileSaveAll();
|
|
280
|
+
}}
|
|
281
|
+
/>
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
renderButtonFileProperties() {
|
|
286
|
+
return (
|
|
287
|
+
<ButtonNew id="code_editor_file_properties" colorMark="markup_color" icon="icon-file-property" size="aj_btn_sm" placement="bottom" heading="Properties" content="File" disabled={'file' !== this.state.CodeEditorStore.current.type}
|
|
288
|
+
onClick={(e) => {
|
|
289
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_File_Properties'));
|
|
290
|
+
}}
|
|
291
|
+
/>
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
renderButtonFileDelete() {
|
|
296
|
+
const allProjectsSaved = this._areAllProjectsSaved();
|
|
297
|
+
const disabled = 'file' !== this.state.CodeEditorStore.current.type && 'invalid_file' !== this.state.CodeEditorStore.current.type || !allProjectsSaved.saved;
|
|
298
|
+
return (
|
|
299
|
+
<ButtonNew id="code_editor_file_delete" colorMark="markup_color" icon="icon-file-delete" size="aj_btn_sm" placement="bottom" heading="Remove or Delete" content="File" disabled={disabled}
|
|
300
|
+
onClick={(e) => {
|
|
301
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogShow('Code_File_Remove'));
|
|
302
|
+
}}
|
|
303
|
+
/>
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
renderButtonInFileSearch() {
|
|
308
|
+
return (
|
|
309
|
+
<ButtonNew id="code_editor_file_search" colorMark="markup_color" icon="icon-file-search" size="aj_btn_sm" placement="bottom" heading="Search" content="In files"
|
|
310
|
+
onClick={(e) => {
|
|
311
|
+
this._modalDialogSearch.show();
|
|
312
|
+
}}
|
|
313
|
+
/>
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
renderButtonDarkMode() {
|
|
318
|
+
const darkMode = this.state.CodeEditorStore.persistentData.darkMode;
|
|
319
|
+
const icon = darkMode ? 'icon-mode-dark' : 'icon-mode-light';
|
|
320
|
+
return (
|
|
321
|
+
<ButtonNew id="code_editor_darkmode" icon={icon} size="aj_btn_sm" active={darkMode} placement="bottom" heading="View" content="Dark mode"
|
|
322
|
+
onClick={(e) => {
|
|
323
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorPersistentDataUpdate('', 'darkMode', !darkMode));
|
|
324
|
+
}}
|
|
325
|
+
/>
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
renderButtonEmptyLine() {
|
|
330
|
+
const emptyLine = this.state.CodeEditorStore.persistentData.emptyLine;
|
|
331
|
+
return (
|
|
332
|
+
<ButtonNew id="code_editor_empty_line" icon="icon-empty-line" size="aj_btn_sm" active={emptyLine} placement="bottom" heading="View" content="Empty Line"
|
|
333
|
+
onClick={(e) => {
|
|
334
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorPersistentDataUpdate('', 'emptyLine', !emptyLine));
|
|
335
|
+
}}
|
|
336
|
+
/>
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
renderModalDialogWorkspaceNew() {
|
|
341
|
+
return (
|
|
342
|
+
<ModalDialogWorkspaceNew ref={(c) => this._modalDialogWorkspaceNew = c} heading="New Workspace" result={'result'}
|
|
343
|
+
onWorkspaceNew={(appName, appType) => {
|
|
344
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorWorkspaceNew(appName, appType));
|
|
345
|
+
}}
|
|
346
|
+
onClear={() => {}}
|
|
347
|
+
/>
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
renderModalDialogWorkspaceOpen() {
|
|
352
|
+
const name = 'Code_Workspace_Open';
|
|
353
|
+
return (
|
|
354
|
+
<ModalDialogWorkspaceOpen name={name} heading="Open Workspace" workspaces={this.state.DialogFileStore.workspaces} modalResults={this.state.ModalDialogStore.modalResults}
|
|
355
|
+
onAdd={() => {
|
|
356
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
357
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorWorkspaceGet(this.state.DialogFileStore.workspace, this.state.DialogFileStore.workspace));
|
|
358
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, {
|
|
359
|
+
code: 'success',
|
|
360
|
+
error: null,
|
|
361
|
+
msg: ''
|
|
362
|
+
}));
|
|
363
|
+
this.props.onOpen(this.state.DialogFileStore.workspace);
|
|
364
|
+
}}
|
|
365
|
+
onChoose={(path) => {
|
|
366
|
+
this.dispatch(DialogFileStore, new ActionDialogWorkspaceSet(path));
|
|
367
|
+
}}
|
|
368
|
+
onHide={() => {
|
|
369
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
370
|
+
}}
|
|
371
|
+
/>
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
renderModalDialogFolderNew() {
|
|
376
|
+
const name = 'Code_Folder_New';
|
|
377
|
+
return (
|
|
378
|
+
<ModalDialogFolderNew name={name} folder={this.state.CodeEditorStore.current.folder} heading="New Folder" modalResults={this.state.ModalDialogStore.modalResults}
|
|
379
|
+
onFolderNew={(projectId, title, data) => {
|
|
380
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
381
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFolderNew(projectId, title, data), (response) => {
|
|
382
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, response.result));
|
|
383
|
+
});
|
|
384
|
+
}}
|
|
385
|
+
onHide={() => {
|
|
386
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
387
|
+
}}
|
|
388
|
+
/>
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
renderModalDialogFolderAdd() {
|
|
393
|
+
const name = 'Code_Folder_Add';
|
|
394
|
+
const folder = this.state.CodeEditorStore.current.folder;
|
|
395
|
+
const projectId = folder !== null ? folder.projectId : null;
|
|
396
|
+
return (
|
|
397
|
+
<ModalDialogFolderAdd name={name} heading="Add Folder" folder={this.state.CodeEditorStore.current.folder} project={this.state.DialogFileStore.project} current={this.state.DialogFileStore.current} original={this.state.DialogFileStore.original} modalResults={this.state.ModalDialogStore.modalResults}
|
|
398
|
+
onAdd={(projectId, title, data) => {
|
|
399
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
400
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFolderAdd(projectId, title, data));
|
|
401
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, {
|
|
402
|
+
code: 'success',
|
|
403
|
+
error: null,
|
|
404
|
+
msg: ''
|
|
405
|
+
}));
|
|
406
|
+
}}
|
|
407
|
+
onChoose={(path) => {
|
|
408
|
+
this.dispatch(DialogFileStore, new ActionDialogFileSet(path));
|
|
409
|
+
}}
|
|
410
|
+
onHide={() => {
|
|
411
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
412
|
+
}}
|
|
413
|
+
/>
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
renderModalDialogFolderProperties() {
|
|
418
|
+
const name = 'Code_Folder_Properties';
|
|
419
|
+
const workspaceName = this.state.CodeEditorStore.current.query?.workspace;
|
|
420
|
+
return (
|
|
421
|
+
<ModalDialogFolderProperties name={name} folder={this.state.CodeEditorStore.current.folder} heading="Folder Properties" modalResults={this.state.ModalDialogStore.modalResults}
|
|
422
|
+
onFolderProperties={(projectId, title, newTitle, data) => {
|
|
423
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
424
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFolderUpdate(projectId, title, newTitle, data, workspaceName), (response) => {
|
|
425
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, response.result));
|
|
426
|
+
});
|
|
427
|
+
}}
|
|
428
|
+
onHide={() => {
|
|
429
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
430
|
+
}}
|
|
431
|
+
/>
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
renderModalDialogFolderRemove() {
|
|
436
|
+
const name = 'Code_Folder_Remove';
|
|
437
|
+
const workspaceName = this.state.CodeEditorStore.current.query?.workspace;
|
|
438
|
+
return (
|
|
439
|
+
<ModalDialogFolderRemove name={name} folder={this.state.CodeEditorStore.current.folder} heading="Remove or Delete Folder" modalResults={this.state.ModalDialogStore.modalResults}
|
|
440
|
+
onFolderRemove={(projectId, title, key, data) => {
|
|
441
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
442
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFolderRemove(projectId, title, key, data));
|
|
443
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, {
|
|
444
|
+
code: 'success',
|
|
445
|
+
error: null,
|
|
446
|
+
msg: ''
|
|
447
|
+
}));
|
|
448
|
+
}}
|
|
449
|
+
onFolderDelete={(projectId, title, key, data) => {
|
|
450
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
451
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFolderDelete(projectId, title, key, data, workspaceName), (response) => {
|
|
452
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, response.result));
|
|
453
|
+
});
|
|
454
|
+
}}
|
|
455
|
+
onHide={() => {
|
|
456
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
457
|
+
}}
|
|
458
|
+
/>
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
renderModalDialogFileNew() {
|
|
463
|
+
const name = 'Code_File_New';
|
|
464
|
+
const workspaceName = this.state.CodeEditorStore.current.query?.workspace;
|
|
465
|
+
return (
|
|
466
|
+
<ModalDialogFileNew name={name} heading="New Code File" folder={this.state.CodeEditorStore.current.folder} templateNames={MiddleCodeEditorToolbar.TEMPLATE_NAMES} modalResults={this.state.ModalDialogStore.modalResults}
|
|
467
|
+
onFileNew={(projectId, path, title, type, templateName) => {
|
|
468
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
469
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileNew(projectId, path, title, type, templateName, null, workspaceName), (response) => {
|
|
470
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, response.result));
|
|
471
|
+
});
|
|
472
|
+
}}
|
|
473
|
+
onHide={() => {
|
|
474
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
475
|
+
}}
|
|
476
|
+
/>
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
renderModalDialogFileAdd() {
|
|
481
|
+
const name = 'Code_File_Add';
|
|
482
|
+
const folder = this.state.CodeEditorStore.current.folder;
|
|
483
|
+
const projectId = folder !== null ? folder.projectId : null;
|
|
484
|
+
return (
|
|
485
|
+
<ModalDialogFileAdd name={name} heading="Add Code File" folder={this.state.CodeEditorStore.current.folder} project={this.state.DialogFileStore.project} current={this.state.DialogFileStore.current} original={this.state.DialogFileStore.original} modalResults={this.state.ModalDialogStore.modalResults}
|
|
486
|
+
onAdd={(projectId, title, path, type) => {
|
|
487
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
488
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileAdd(projectId, title, path, type));
|
|
489
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, {
|
|
490
|
+
code: 'success',
|
|
491
|
+
error: null,
|
|
492
|
+
msg: ''
|
|
493
|
+
}));
|
|
494
|
+
}}
|
|
495
|
+
onChoose={(path) => {
|
|
496
|
+
this.dispatch(DialogFileStore, new ActionDialogFileSet(path));
|
|
497
|
+
}}
|
|
498
|
+
onHide={() => {
|
|
499
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
500
|
+
}}
|
|
501
|
+
/>
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
renderModalDialogFileProperties() {
|
|
506
|
+
const name = 'Code_File_Properties';
|
|
507
|
+
const workspaceName = this.state.CodeEditorStore.current.query?.workspace;
|
|
508
|
+
return (
|
|
509
|
+
<ModalDialogFileProperties name={name} heading="File Properties" file={this.state.CodeEditorStore.current.file} modalResults={this.state.ModalDialogStore.modalResults}
|
|
510
|
+
onFileProperties={(projectId, path, title, newTitle) => {
|
|
511
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
512
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileRename(projectId, path, title, newTitle, workspaceName), (response) => {
|
|
513
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, response.result));
|
|
514
|
+
});
|
|
515
|
+
}}
|
|
516
|
+
onHide={() => {
|
|
517
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
518
|
+
}}
|
|
519
|
+
/>
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
renderModalDialogFileRemove() {
|
|
524
|
+
const name = 'Code_File_Remove';
|
|
525
|
+
const workspaceName = this.state.CodeEditorStore.current.query?.workspace;
|
|
526
|
+
return (
|
|
527
|
+
<ModalDialogFileRemove name={name} file={this.state.CodeEditorStore.current.file} doDelete={'invalid_file' !== this.state.CodeEditorStore.current.type} heading="Remove or Delete Code File" modalResults={this.state.ModalDialogStore.modalResults}
|
|
528
|
+
onFileRemove={(projectId, key) => {
|
|
529
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
530
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileRemove(projectId, key));
|
|
531
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, {
|
|
532
|
+
code: 'success',
|
|
533
|
+
error: null,
|
|
534
|
+
msg: ''
|
|
535
|
+
}));
|
|
536
|
+
}}
|
|
537
|
+
onFileDelete={(projectId, key, plugin) => {
|
|
538
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogPending(name));
|
|
539
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileDelete(projectId, key, plugin, workspaceName), (response) => {
|
|
540
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogResult(name, response.result));
|
|
541
|
+
});
|
|
542
|
+
}}
|
|
543
|
+
onHide={() => {
|
|
544
|
+
this.dispatch(ModalDialogStore, new ActionModalDialogHide(name));
|
|
545
|
+
}}
|
|
546
|
+
/>
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
renderModalDialogSearch() {
|
|
551
|
+
return (
|
|
552
|
+
<ModalDialogSearch ref={(c) => this._modalDialogSearch = c} result={'result'}
|
|
553
|
+
onSearch={(search, rules) => {
|
|
554
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorWorkspaceSearch(search, rules));
|
|
555
|
+
}}
|
|
556
|
+
onClear={() => {}}
|
|
557
|
+
/>
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
renderWorkspaceModals() {
|
|
562
|
+
if(this.props.showWorkspace) {
|
|
563
|
+
return (
|
|
564
|
+
<>
|
|
565
|
+
{this.renderModalDialogWorkspaceNew()}
|
|
566
|
+
{this.renderModalDialogWorkspaceOpen()}
|
|
567
|
+
</>
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
renderWorkspaceButtons() {
|
|
576
|
+
if(this.props.showWorkspace) {
|
|
577
|
+
return (
|
|
578
|
+
<>
|
|
579
|
+
<div className="btn-group btn-group-sm" role="group" aria-label="...">
|
|
580
|
+
{this.renderButtonNewWorkspace()}
|
|
581
|
+
{this.renderButtonOpenWorkspace()}
|
|
582
|
+
</div>
|
|
583
|
+
</>
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
render() {
|
|
592
|
+
return (
|
|
593
|
+
<div className="middle_toolbar middle_code_editor_toolbar">
|
|
594
|
+
{this.renderWorkspaceModals()}
|
|
595
|
+
{this.renderModalDialogFolderNew()}
|
|
596
|
+
{this.renderModalDialogFolderAdd()}
|
|
597
|
+
{this.renderModalDialogFolderProperties()}
|
|
598
|
+
{this.renderModalDialogFolderRemove()}
|
|
599
|
+
{this.renderModalDialogFileNew()}
|
|
600
|
+
{this.renderModalDialogFileAdd()}
|
|
601
|
+
{this.renderModalDialogFileProperties()}
|
|
602
|
+
{this.renderModalDialogFileRemove()}
|
|
603
|
+
{this.renderModalDialogSearch()}
|
|
604
|
+
<div className="toolbar" role="toolbar" aria-label="...">
|
|
605
|
+
{this.renderWorkspaceButtons()}
|
|
606
|
+
<div className="aj_btn_group" role="group" aria-label="...">
|
|
607
|
+
{this.renderButtonSaveAllProjects()}
|
|
608
|
+
</div>
|
|
609
|
+
<div className="aj_btn_group" role="group" aria-label="...">
|
|
610
|
+
{this.renderButtonFolderNew()}
|
|
611
|
+
{this.renderButtonFolderAdd()}
|
|
612
|
+
{this.renderButtonFolderProperties()}
|
|
613
|
+
{this.renderButtonFolderDelete()}
|
|
614
|
+
</div>
|
|
615
|
+
<div className="aj_btn_group" role="group" aria-label="...">
|
|
616
|
+
{this.renderButtonFileNew()}
|
|
617
|
+
{this.renderButtonFileAdd()}
|
|
618
|
+
{this.renderButtonFileSave()}
|
|
619
|
+
{this.renderButtonFileSaveAll()}
|
|
620
|
+
{this.renderButtonFileProperties()}
|
|
621
|
+
{this.renderButtonFileDelete()}
|
|
622
|
+
</div>
|
|
623
|
+
<div className="aj_btn_group" role="group" aria-label="...">
|
|
624
|
+
{this.renderButtonInFileSearch()}
|
|
625
|
+
</div>
|
|
626
|
+
<div className="aj_btn_group pull-right" role="group" aria-label="...">
|
|
627
|
+
{this.renderButtonEmptyLine()}
|
|
628
|
+
{this.renderButtonDarkMode()}
|
|
629
|
+
</div>
|
|
630
|
+
</div>
|
|
631
|
+
</div>
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
MiddleCodeEditorToolbar.contextType = RouterContext;
|
|
638
|
+
|