mirror of
https://github.com/r2r90/canvas-label.git
synced 2025-12-17 05:29:27 +00:00
text toolbar - delete text button added
This commit is contained in:
@@ -36,7 +36,7 @@ export const appSlice = createSlice({
|
||||
|
||||
addText: (state, action: PayloadAction<{ initialValue: string }>) => {
|
||||
const textId = v1();
|
||||
|
||||
console.log(state);
|
||||
state.texts.push({
|
||||
text: action.payload.initialValue,
|
||||
id: textId,
|
||||
@@ -68,8 +68,22 @@ export const appSlice = createSlice({
|
||||
...action.payload,
|
||||
};
|
||||
},
|
||||
|
||||
deleteShape: (state, action: PayloadAction<string>) => {
|
||||
console.log(state.texts);
|
||||
return {
|
||||
...state,
|
||||
texts: state.texts.filter((shape) => shape.id !== action.payload),
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { addImage, addText, selectItem, deselectItem, updateText } =
|
||||
appSlice.actions;
|
||||
export const {
|
||||
addImage,
|
||||
addText,
|
||||
selectItem,
|
||||
deselectItem,
|
||||
updateText,
|
||||
deleteShape,
|
||||
} = appSlice.actions;
|
||||
|
||||
Reference in New Issue
Block a user