Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mingchiuli committed Jan 1, 2025
1 parent 09ad3d8 commit c023b3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 5 additions & 3 deletions src/utils/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const watchInput = (
if (!preCheck(n, o, operateStatus)) return
commonPreDeal(FieldType.NON_PARA, FieldName.DESCRIPTION, form, pushActionForm, operateStatus)
deal(n, o, operateStatus, pushActionForm, form)
recheckSensitive(pushActionForm, form)
recheckSensitive(pushActionForm, form, pushActionForm.indexStart!)
}
)

Expand Down Expand Up @@ -75,7 +75,7 @@ export const watchInput = (
if (!preCheck(n, o, operateStatus)) return
commonPreDeal(FieldType.NON_PARA, FieldName.TITLE, form, pushActionForm, operateStatus)
deal(n, o, operateStatus, pushActionForm, form)
recheckSensitive(pushActionForm, form)
recheckSensitive(pushActionForm, form, pushActionForm.indexStart!)
}
)

Expand All @@ -90,12 +90,14 @@ export const watchInput = (

//本段内操作
if (nArr.length === oArr.length) {
let idxStart = 0
for (let i = 0; i < nArr.length; i++) {
if (nArr[i] !== oArr[i]) {
pushActionForm.paraNo = i + 1
deal(nArr[i], oArr[i], operateStatus, pushActionForm, form)
recheckSensitive(pushActionForm, form)
recheckSensitive(pushActionForm, form, idxStart + pushActionForm.indexStart!)
}
idxStart += nArr.length
}
return
}
Expand Down
12 changes: 4 additions & 8 deletions src/utils/editUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,13 @@ export const dealAction = (
return ActionType.PUSH_ALL
}

export const recheckSensitive = (pushActionForm: PushActionForm, form: EditForm) => {
export const recheckSensitive = (pushActionForm: PushActionForm, form: EditForm, idxStart: number) => {
if (form.status !== Status.SENSITIVE_FILTER) {
return
}
const field = pushActionForm.field
const operateType = pushActionForm.operateTypeCode
const len = form.sensitiveContentList.length
const indexStart = pushActionForm.indexStart!
/**
* type 1
*/
Expand Down Expand Up @@ -248,7 +247,7 @@ export const recheckSensitive = (pushActionForm: PushActionForm, form: EditForm)
operateType === OperateTypeCode.NON_PARA_REPLACE)
) {
const sensitiveList = form.sensitiveContentList.filter(
(item) => item.type !== SensitiveType.TITLE || item.endIndex - 1 < indexStart
(item) => item.type !== SensitiveType.TITLE || item.endIndex - 1 < idxStart
)
if (sensitiveList.length !== len) {
form.sensitiveContentList = sensitiveList
Expand All @@ -262,7 +261,7 @@ export const recheckSensitive = (pushActionForm: PushActionForm, form: EditForm)
operateType === OperateTypeCode.NON_PARA_REPLACE)
) {
const sensitiveList = form.sensitiveContentList.filter(
(item) => item.type !== SensitiveType.DESCRIPTION || item.endIndex - 1 < indexStart
(item) => item.type !== SensitiveType.DESCRIPTION || item.endIndex - 1 < idxStart
)
if (sensitiveList.length !== len) {
form.sensitiveContentList = sensitiveList
Expand All @@ -275,12 +274,9 @@ export const recheckSensitive = (pushActionForm: PushActionForm, form: EditForm)
(operateType === OperateTypeCode.PARA_TAIL_SUBTRACT ||
operateType === OperateTypeCode.PARA_REPLACE)
) {
console.log(form.sensitiveContentList)
console.log(indexStart)
const sensitiveList = form.sensitiveContentList.filter(
(item) => item.type !== SensitiveType.CONTENT || item.endIndex - 1 < indexStart
(item) => item.type !== SensitiveType.CONTENT || item.endIndex - 1 < idxStart
)
console.log(sensitiveList)
if (sensitiveList.length !== len) {
form.sensitiveContentList = sensitiveList
}
Expand Down

0 comments on commit c023b3f

Please sign in to comment.