|
@@ -206,7 +206,7 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
|
|
|
}
|
|
|
}else{//删除完标签内容则删除该标签
|
|
|
const num = nextIsDot?2:1;
|
|
|
- handleLocalDelTag('4',index,res.data[index]);
|
|
|
+ handleLocalDelTag('4',index,res.data[index],res.selecteds[index]);
|
|
|
res.data.splice(index,num);
|
|
|
res.selecteds.splice(index,num);//杂音类样式选中状态对应
|
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
@@ -235,39 +235,37 @@ export function backspaceText(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
const {delIndex,flag} = action;
|
|
|
const data = res.data;
|
|
|
+ let inx = delIndex-1; //要删除的(非文本)标签的index
|
|
|
if(flag == 'backsp'){
|
|
|
// 前一个是文本标签或者子模板,只改变值
|
|
|
- if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删
|
|
|
+ if(data[inx].flag&&data[inx].flag==3){//子模板不删
|
|
|
// data[delIndex].value = text;
|
|
|
- }else if(data[delIndex-1].tagType==8){
|
|
|
+ }else if(data[inx].tagType==8){
|
|
|
data.splice(delIndex,1);
|
|
|
res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
res.saveText.splice(delIndex,1);
|
|
|
- }
|
|
|
- else{
|
|
|
- handleLocalDelTag(4,delIndex-1,data[delIndex-1]);
|
|
|
- data.splice(delIndex-1,action.text.length>0?1:2);
|
|
|
- res.selecteds.splice(delIndex-1,action.text.length>0?1:2);
|
|
|
- res.saveText.splice(delIndex-1,action.text.length>0?1:2);
|
|
|
+ }else{
|
|
|
+ handleLocalDelTag(4,inx,data[inx],res.selecteds[inx]);
|
|
|
+ const n = action.text.length>0?1:2;
|
|
|
+ data.splice(inx,n);
|
|
|
+ res.selecteds.splice(inx,n);
|
|
|
+ res.saveText.splice(inx,n);
|
|
|
}
|
|
|
}else if(flag == 'del'){
|
|
|
- if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){//子模板不删
|
|
|
+ inx = delIndex+1;
|
|
|
+ if(!data[inx]||(data[inx] && data[inx].flag&&data[inx].flag==3)){//子模板不删
|
|
|
|
|
|
- }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
|
|
|
+ }else if(data[inx] && data[inx].tagType==8){
|
|
|
data.splice(delIndex,1);
|
|
|
res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
res.saveText.splice(delIndex,1);
|
|
|
- }else if(!data[delIndex+1]){//最后一个文本标签不删除
|
|
|
-
|
|
|
- }
|
|
|
- else{
|
|
|
- handleLocalDelTag(4,delIndex,data[delIndex+1]);
|
|
|
+ }else{
|
|
|
+ handleLocalDelTag(4,delIndex,data[inx],res.selecteds[inx]);
|
|
|
data.splice(delIndex,2);
|
|
|
res.selecteds.splice(delIndex,2);
|
|
|
res.saveText.splice(delIndex,2);
|
|
|
}
|
|
|
}
|
|
|
- // res.saveText = fullfillText(data).saveText;
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|
|
@@ -326,7 +324,9 @@ export function setImportCheckbodyLabel(state,action) {
|
|
|
export function recoveTag(state,action) {
|
|
|
let res = Object.assign({},state);
|
|
|
let arr = [...res.data];
|
|
|
+ let slts = [...res.selecteds];
|
|
|
arr.splice(action.index,0,action.data);
|
|
|
+ slts.splice(action.index,0,action.select);
|
|
|
const dataArr = checkFullfillText(arr);
|
|
|
let nextLabel = dataArr.newArr[(+action.index)+1];
|
|
|
//展开收起状态
|
|
@@ -335,6 +335,7 @@ export function recoveTag(state,action) {
|
|
|
}
|
|
|
res.data = dataArr.newArr;
|
|
|
res.saveText = dataArr.saveText;
|
|
|
+ res.selecteds = slts;
|
|
|
shiftLocalDelTag();
|
|
|
res.update = Math.random();
|
|
|
return res;
|