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 = () => { getMenuList = () => {
return [ const { userPerm } = this.props;
const list = [];
if (userPerm == 'rw') {
list.push(
TextTranslation.NEW_FOLDER, TextTranslation.NEW_FOLDER,
TextTranslation.NEW_FILE, TextTranslation.NEW_FILE
TextTranslation.DISPLAY_FILES, );
]; }
list.push(TextTranslation.DISPLAY_FILES);
return list;
}; };
onNodeClick = (node) => { onNodeClick = (node) => {

View File

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

View File

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