Skip to content

Commit 7a77374

Browse files
authored
feat: remove the onRemove processing logic in the built-in FolderTree extension (#617)
1 parent 99754f9 commit 7a77374

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/extensions/folderTree/index.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ export const ExtendsFolderTree: IExtension = {
55
id: 'ExtendsFolderTree',
66
name: 'Extends FolderTree',
77
activate() {
8-
molecule.folderTree.onRemove((id) => {
9-
molecule.folderTree.remove(id);
10-
});
11-
128
molecule.folderTree.onRename((id) => {
139
molecule.folderTree.update({
1410
id,

stories/extensions/test/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,9 @@ export const ExtendsTestPane: IExtension = {
172172
};
173173
molecule.editor.open(tabData);
174174
});
175+
176+
molecule.folderTree.onRemove((id) => {
177+
molecule.folderTree.remove(id);
178+
});
175179
},
176180
};

website/docs/guides/extend-builtin-ui.md

+4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ molecule.folderTree.toggleAutoSort();
114114

115115
For more information about the use of FolderTree, please refer to the [API](../api/classes/molecule.FolderTreeService) documentation.
116116

117+
:::caution
118+
We don't have default node removal logic built into FolderTree, but you can customize it using `remove` method.
119+
:::
120+
117121
## [EditorTree](../api/interfaces/molecule.IEditorTreeService)
118122

119123
[EditorTree](../api/interfaces/molecule.IEditorTreeService) is responsible for displaying some **editing tags** currently working in [Explorer](#explorer). Molecule currently does not provide too many APIs to support the extension of this UI, but more basic **event handling**.

website/i18n/zh-CN/docusaurus-plugin-content-docs/current/guides/extend-builtin-ui.md

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ molecule.folderTree.toggleAutoSort();
115115

116116
更多关于 FolderTree 的使用,请参考 [API](../api/classes/molecule.FolderTreeService) 文档。
117117

118+
:::caution
119+
我们没有在 FolderTree 中内置默认的节点移除逻辑,开发者可以使用 `remove` 方法来自定义。
120+
:::
121+
118122
## [编辑器树(EditorTree)](../api/interfaces/molecule.IEditorTreeService)
119123

120124
[EditorTree](../api/interfaces/molecule.IEditorTreeService)[Explorer](#浏览面板explorer) 中负责展示当前正在工作的一些**编辑标签**。Molecule 目前并未提供太多的 API 来支持扩展这个 UI, 更多还是一些基本的**事件处理**

0 commit comments

Comments
 (0)