Skip to content

feat: property-editor#533

Open
henry9610 wants to merge 3 commits into
devfrom
feature/property-editor
Open

feat: property-editor#533
henry9610 wants to merge 3 commits into
devfrom
feature/property-editor

Conversation

@henry9610

Copy link
Copy Markdown
Contributor

Add file property editor

@henry9610 henry9610 force-pushed the feature/property-editor branch from 835a24e to 03afbc6 Compare June 12, 2026 14:35
@henry9610 henry9610 requested a review from lilthree June 12, 2026 14:44
#import "../Chips/SeafCollaboratorChipView.h"
#import "../Chips/SeafTagChipView.h"
#import "../Selectors/SeafTagSelectorViewController.h"
#import "../Services/SeafSdocService.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接文件名导入就行,不需要用相对路径,工程配置文件里面有文件搜索路径的配置

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,已修改

}];
}
return [UIColor colorWithRed:0x66/255.0 green:0x66/255.0 blue:0x66/255.0 alpha:1.0];
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些uikit相关的能力,不推荐用C 静态函数,可以直接写个专门的子类或者UIView的分类。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这几个样式函数仅在本文件内使用,scope 有限,暂保持现状,后续迭代再考虑抽分类。

[self.scrollView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor],
[self.scrollView.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor],
[self.scrollView.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor],
[self.scrollView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里底部对其safeArea bottom是不是更合理

@henry9610 henry9610 Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不用修改,scrollView bottom 用物理边是为了底部的safeArea的穿透显示效果,避免内容过长时,底部安全区域显示纯色遮挡

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面keyboardWillChangeFrame里面中用 CGRectGetMaxY(self.view.bounds) 把bottomSafeArea的高度算计去了,这里可以确认下距离键盘的高度是不是偏高了。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已确认,这里的计算是正确的,真机测试了一下看起来也没有问题。
scrollView 是延伸到屏幕最底部的,与 CGRectGetMaxY(self.view.bounds) 的基准一致

[self.stackView.leadingAnchor constraintGreaterThanOrEqualToAnchor:self.scrollView.contentLayoutGuide.leadingAnchor],
[self.scrollView.contentLayoutGuide.widthAnchor constraintEqualToAnchor:self.scrollView.frameLayoutGuide.widthAnchor],
[self.stackView.widthAnchor constraintLessThanOrEqualToConstant:700],
fullWidth,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个布局在iPad上可能会有冲突

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我在iPad 上实测了一下没有约束冲突。fullWidth 用了 priority 750,会被 maxWidth ≤ 700自动打破,表单居中显示,左右两侧有留白。

// Dismiss the profile sheet first, then present editor
__weak typeof(self) weakSelf = self;
[self dismissViewControllerAnimated:YES completion:^{
if (!weakSelf.connection || !weakSelf.aggregate || !weakSelf.repoId) return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种dismiss回调可能存在销毁的情况,最好是加上strongself
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf.connection || !strongSelf.aggregate || !strongSelf.repoId) return;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对的,这里加上更安全,已修复


if (editable) {
[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
objc_setAssociatedObject(textField, "metadataKey", key, OBJC_ASSOCIATION_COPY_NONATOMIC);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objc_setAssociatedObject的key判断的是指针不是字符串,应该是用static const void *kMetadataKey = &kMetadataKey。这个vc里面掺杂了对UIView、UITextField、UILabel等的关联属性动态绑定的方法,代码结构上不太优雅,建议封装一个UIView的分类,把这些属性添加到分类中。另外也可把buildTextFieldForKey和buildNumberFieldForKey修改成UITextField的子类SeafProfileTextField和SeafNumberTextField。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,key 会改成 static const void * 的标准写法。子类抽取改动较大,可以先等版本和功能页面稳定后,后续迭代再优化。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个vc的代码过于庞大了,可以考虑把数据解析与转换和UI 构建的逻辑单独抽离出来。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个VC支持的字段较多,做大范围改动需要再完整的检查和测试。当前版本先保持,待功能稳定后,后续迭代中可以考虑用 Category 或完整的重构做进一步的文件级拆分

// Uses UITableView with chip-style tag cells and selection checkmarks.

#import "SeafTagSelectorViewController.h"
#import "../Chips/SeafTagChipView.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里导入也不需要路径

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

#import "SeafSdocProfileSheetViewController.h"
#import "Editor/SeafSdocProfileEditorViewController.h"
#import "Chips/SeafTagChipView.h"
#import "Services/SeafSdocService.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import "SeafSdocProfileEditorViewController.h"、import "SeafTagChipView.h"、import "SeafSdocService.h"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

Comment thread seafile/SeafPhotoInfoView.m Outdated
@@ -1,5 +1,6 @@
#import "SeafPhotoInfoView.h"
#import "Debug.h"
#import "SDoc/Chips/SeafCollaboratorChipView.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#import "SeafCollaboratorChipView.h"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants