Skip to content

RemoveTool to use splice#1509

Open
fizdalf wants to merge 2 commits intotextAngular:masterfrom
fizdalf:master
Open

RemoveTool to use splice#1509
fizdalf wants to merge 2 commits intotextAngular:masterfrom
fizdalf:master

Conversation

@fizdalf
Copy link
Copy Markdown

@fizdalf fizdalf commented Apr 25, 2017

The removeTool function..should remove the tool from the array, but right now it's using slice, that doesn't modify the array,

@fizdalf
Copy link
Copy Markdown
Author

fizdalf commented Apr 25, 2017

Also fixed add tool function, it was swapping the last tool in the toolbar group, instead of adding it.

@pbassut
Copy link
Copy Markdown
Contributor

pbassut commented Apr 25, 2017

Hi! Huge thanks for the PR!
Can you remind me of what issue is this fixing?

@fizdalf
Copy link
Copy Markdown
Author

fizdalf commented Apr 25, 2017

I didn't see the issues created but I've found the bugs when experimenting with adding and removing tools.

This PR should fix two issues:

  • removeTool function, it's using 'slice' for removing the tool, from the array of tools ( an array of keys) of a toolbar group, but the result of 'slice' is not being used, in turn the tool doesn't get deleted. I changed it to splice as splice actually modifies the array without having to reassign to itself.

  • addTool function: when adding a tool and not giving the function an index, instead of adding the key to the array of tools of a toolbar group, the code is just overwriting the last tool key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants