(categoryName, oldText, newText)
| 233 | |
| 234 | // 编辑回复文本 |
| 235 | function editReplyText(categoryName, oldText, newText) { |
| 236 | if (!newText || newText.trim() === '' || oldText === newText) return false; |
| 237 | |
| 238 | const replies = getQuickReplies(); |
| 239 | if (!replies[categoryName]) return false; |
| 240 | |
| 241 | const trimmedNewText = newText.trim(); |
| 242 | const index = replies[categoryName].indexOf(oldText); |
| 243 | |
| 244 | if (index > -1 && !replies[categoryName].includes(trimmedNewText)) { |
| 245 | replies[categoryName][index] = trimmedNewText; |
| 246 | setQuickReplies(replies); |
| 247 | return true; |
| 248 | } |
| 249 | return false; |
| 250 | } |
| 251 | |
| 252 | // 重新排序分类中的回复 |
| 253 | function reorderRepliesInCategory(categoryName, newOrder) { |
no test coverage detected