1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 04:48:03 +00:00

Readonly misc fixup (#7274)

* ['dir view'] fixup for the tree panel: don't display 'New Folder', 'New File' in the menu for library shared with 'r' permission

* ['dir view'] don't display empty 'right icons' when hover on the tree nodes in the tree panel

* [codemirror] improved the configuration for the 'readOnly' mode(Don't display cursor for readOnly files)

* fixed eslint warnings
This commit is contained in:
llj
2024-12-27 20:46:35 +08:00
committed by GitHub
parent 76695e5c90
commit 1058cf2151
3 changed files with 21 additions and 17 deletions

View File

@@ -83,11 +83,16 @@ class DirFiles extends React.Component {
}
getMenuList = () => {
return [
TextTranslation.NEW_FOLDER,
TextTranslation.NEW_FILE,
TextTranslation.DISPLAY_FILES,
];
const { userPerm } = this.props;
const list = [];
if (userPerm == 'rw') {
list.push(
TextTranslation.NEW_FOLDER,
TextTranslation.NEW_FILE
);
}
list.push(TextTranslation.DISPLAY_FILES);
return list;
};
onNodeClick = (node) => {

View File

@@ -37,6 +37,7 @@ class SeafileCodeMirror extends React.Component {
basicSetup={DEFAULT_CODEMIRROR_OPTIONS}
theme={myTheme}
readOnly={readOnly}
editable={!readOnly}
extensions={extensions}
onChange={this.onChange}
/>

View File

@@ -321,19 +321,17 @@ class TreeNodeView extends React.Component {
)}
<i className="tree-node-icon">{icon}</i>
</div>
{isNodeMenuShow && (
{isNodeMenuShow && ((userPerm === 'rw' || permission || isCustomPermission) && this.state.isShowOperationMenu) && (
<div className="right-icon">
{((userPerm === 'rw' || permission || isCustomPermission) && this.state.isShowOperationMenu) && (
<ItemDropdownMenu
item={this.props.node}
toggleClass={'sf3-font sf3-font-more-vertical'}
getMenuList={this.calculateMenuList}
onMenuItemClick={this.onMenuItemClick}
freezeItem={this.props.freezeItem}
unfreezeItem={this.unfreezeItem}
menuStyle={isMobile ? { zIndex: 1050 } : {}}
/>
)}
<ItemDropdownMenu
item={this.props.node}
toggleClass={'sf3-font sf3-font-more-vertical'}
getMenuList={this.calculateMenuList}
onMenuItemClick={this.onMenuItemClick}
freezeItem={this.props.freezeItem}
unfreezeItem={this.unfreezeItem}
menuStyle={isMobile ? { zIndex: 1050 } : {}}
/>
</div>
)}
</div>