修复 KBChatPanel 发送内容校验
This commit is contained in:
@@ -93,13 +93,25 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
NSString *trim =
|
||||
[rawText stringByTrimmingCharactersInSet:
|
||||
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
NSString *textToClear = rawText;
|
||||
if (trim.length == 0) {
|
||||
// 兼容「先输入再打开聊天面板」场景:
|
||||
// 此时新增文本为空,但当前输入框已有可发送内容,应该允许直接发送。
|
||||
NSString *fullTrim =
|
||||
[fullText stringByTrimmingCharactersInSet:
|
||||
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (fullTrim.length > 0) {
|
||||
trim = fullTrim;
|
||||
textToClear = fullText;
|
||||
}
|
||||
}
|
||||
if (trim.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"请输入内容")];
|
||||
return;
|
||||
}
|
||||
[self kb_sendChatText:trim];
|
||||
// 只清除新增的文本,保留基线文本
|
||||
[self kb_clearHostInputForText:rawText];
|
||||
// 默认只清新增文本;若命中兜底则清当前全文,避免“已发送但输入框残留”。
|
||||
[self kb_clearHostInputForText:textToClear];
|
||||
}
|
||||
|
||||
- (void)kb_sendChatText:(NSString *)text {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict/>
|
||||
</plist>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildLocationStyle</key>
|
||||
<string>UseAppPreferences</string>
|
||||
<key>CustomBuildLocationType</key>
|
||||
<string>RelativeToDerivedData</string>
|
||||
<key>DerivedDataLocationStyle</key>
|
||||
<string>Default</string>
|
||||
<key>ShowSharedSchemesAutomaticallyEnabled</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user