@dao42/d42paas-front 0.9.192 → 0.9.194

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/README.md CHANGED
@@ -1,4 +1,167 @@
1
1
  # 更新日志
2
+ ## v0.9.194
3
+ + 支持自定义编辑器右键菜单配置`aiCodeMenu`
4
+ > 1. 新增内置菜单行为`cut`, ` copy`, `paste`,`removeAllFlags`(删除所有AI标识),`removeFlag`(删除AI标识),`remove`(删除代码块)
5
+ > 2. 支持内置菜单行为,自定义菜单行为
6
+ > 3. 支持菜单自定义样式
7
+ > 4. `aiCodeMenu`配置是一个**二维数组**,可以针对菜单进行分组显示
8
+ ```ts
9
+ const dao = new DaoPaaS({
10
+ paasDomain:
11
+ process.env.PAAS_MANAGER_API_ORIGIN + (mockSdkInitFail ? '1' : ''),
12
+ ...,
13
+ aiCodeMenu: [
14
+ [
15
+ {
16
+ text: {
17
+ [I18nLanguageType.ZH]: '清空内容',
18
+ [I18nLanguageType.EN]: 'Cut',
19
+ },
20
+ actionName: 'remove',
21
+ shortcutClassName: '',
22
+ withCodeFlag: true,
23
+ },
24
+ {
25
+ text: {
26
+ [I18nLanguageType.ZH]: '复制代码',
27
+ [I18nLanguageType.EN]: 'Copy',
28
+ },
29
+ actionName: 'copy',
30
+ },
31
+ {
32
+ text: {
33
+ [I18nLanguageType.ZH]: '粘贴代码',
34
+ [I18nLanguageType.EN]: 'Paste',
35
+ },
36
+ actionName: 'paste',
37
+ },
38
+ {
39
+ text: {
40
+ [I18nLanguageType.ZH]: '取消标识',
41
+ [I18nLanguageType.EN]: 'Paste',
42
+ },
43
+ actionName: 'removeFlag',
44
+ },
45
+ {
46
+ text: {
47
+ [I18nLanguageType.ZH]: '取消所有标识',
48
+ [I18nLanguageType.EN]: 'Paste',
49
+ },
50
+ actionName: 'removeAllFlags',
51
+ },
52
+ ],
53
+ [
54
+ {
55
+ text: {
56
+ [I18nLanguageType.ZH]: '解释代码',
57
+ [I18nLanguageType.EN]: 'Cut(Custom)',
58
+ },
59
+ shortcutKey: 'Ctrl/Cmd+X',
60
+ actionFun: (view, commands) => {
61
+ const selections = dao?.daoEditor.getSelection();
62
+ console.log(selections);
63
+ const tr = view.state.replaceSelection('replaceCode');
64
+ view?.dispatch({
65
+ ...tr,
66
+ });
67
+ },
68
+ },
69
+ {
70
+ text: {
71
+ [I18nLanguageType.ZH]: '生成代码',
72
+ [I18nLanguageType.EN]: 'Cut(Custom)',
73
+ },
74
+ shortcutKey: 'Ctrl/Cmd+X',
75
+ actionFun: (view, commands) => {
76
+ // const tr = view.state.replaceSelection('');
77
+ // view?.dispatch({
78
+ // ...tr,
79
+ // });
80
+ },
81
+ },
82
+ {
83
+ text: {
84
+ [I18nLanguageType.ZH]: '交换代码',
85
+ [I18nLanguageType.EN]: 'Cut(Custom)',
86
+ },
87
+ shortcutKey: 'Ctrl/Cmd+X',
88
+ actionFun: (view, commands) => {
89
+ // const tr = view.state.replaceSelection('');
90
+ // view?.dispatch({
91
+ // ...tr,
92
+ // });
93
+ },
94
+ },
95
+ ],
96
+ ]
97
+ });
98
+ ```
99
+ + 新增`getAllUnConfirmAIBlock`,用于获取待确认的代码块信息
100
+ ```ts
101
+ const res = await daoPaasObj?.daoEditor.getAllUnConfirmAIBlock(
102
+ aiBlockPath,
103
+ );
104
+ messageBox.info(JSON.stringify(res));
105
+ }}
106
+ ```
107
+ + 新增`removeAllAiFlags`,用于移除指定文件的所有AI标识
108
+ ```ts
109
+ const res = await daoPaasObj?.daoEditor.removeAllAiFlags(
110
+ aiBlockPath,
111
+ );
112
+ messageBox.info(JSON.stringify(res));
113
+ }}
114
+ ```
115
+ ### 优化
116
+ + 优化`isEnableEditCode` 方法, 会返回对应代码块的`boundingClientRect` 等位置信息,方便业务方定位弹框位置
117
+ + 优化AI代码块文件,全选能够删除AI代码块标识
118
+ + 优化空白文件, AI编程,不需要确认弹框
119
+ + 优化点击AI代码菜单按钮, 选中代码区域
120
+ + 优化AI代码块高亮区域, 只有Hover/光标移至对应区域才显示
121
+
122
+ ## v0.9.193
123
+ ### 新增
124
+ + 新增支持**AI**编程代码块功能(AI编程用`replayCodeByRange` 方法进行代码的操作)
125
+ + 新增初始化配置参数`isSplitCode`,用于控制是否进行代码块的拆分
126
+ ```ts
127
+ const dao = new DaoPaaS({
128
+ ...
129
+ isSplitCode: true, // 用于控制是否判断进行代码块的拆分: 1024 配置true, 其他可以不用配置
130
+ ...
131
+ });
132
+ ```
133
+ + 新增`isEnableEditCode` 方法用于**AI**编程判断是否可以修改对应的代码块
134
+ ```ts
135
+ const res = await daoPaasObj?.daoEditor.isEnableEditCode({
136
+ path: path, // 修改的文件路径
137
+ selection: { start, end }, // 需要修改的范围
138
+ });
139
+ if (res.status) {
140
+ modifyCode();
141
+ } else {
142
+ confirm({
143
+ title:
144
+ '当前需要修改的代码是【用户】创建的,是否运行【AI导师】执行修改任务如下所示?',
145
+ icon: <ExclamationCircleFilled />,
146
+ content: <div>任务进度1/3: 子弹的移动</div>,
147
+ okText: '允许修改',
148
+ cancelText: '停止修改',
149
+ onOk() {
150
+ modifyCode();
151
+ },
152
+ onCancel() {},
153
+ });
154
+ }
155
+
156
+ ```
157
+ + 新增`stopInputCode` 方法用于**AI**模式编程,主动告知AI结束编程
158
+ ```ts
159
+ daoPaasObj.daoEditor.stopInputCode();
160
+ ```
161
+ ### 优化
162
+ + 优化**AI**模式下编程, 不能打开其他文件, 不能创建文件,关闭文件等行为
163
+ +
164
+
2
165
  ## v0.9.192
3
166
  ### 优化
4
167
  + 文件树按住 shift 键时阻止一些默认事件