Closed derekdkim closed 6 years ago
Have you tested your code? It doesn't seem working.
Hi @derekdkim, you have a keen eye for detail. Thanks for catching some of the typos and some discrepencies in the coding style. It's something we're currently working on.
Pssst, you actually missed one when you were refactoring a line. This line should be:
tag.targetShape.tags.splice(tag.targetShape.tags.indexOf(tagText) ,1); // Remove space before comma
tag.targetShape.tags.splice(tag.targetShape.tags.indexOf(tagText), 1); // Insert space after comma
^.^
@amitguptagwl, what problems did you face when you were checking? The implementation seems correct. Currently the categories aren't being saved in the save file. Hence when you open the save file, the categories won't be present.
Thanks @alextychan for reviews. I haven't checked the project file part yet so will check as soon as I'll be done with nimn v2. However, the main issue described in #113 seems not fixed.
@amitguptagwl, I've tested the master branch which contains the merged code on Firefox. All seems to work well.
If you take a look at the code, you'll see that to save a custom category, you need to hit enter/return on your keyboard.
$("#category-select-box").on('keyup', function(e){
//Add
var val = $(this).val().toLowerCase();
// User needs to hit enter to save the custom category.
if(e.keyCode === 13 && suggestedCategories.indexOf(val) === -1){
$("#category-select-box").editableSelect('add', val , 0);
suggestedCategories.push(val);
tag.targetShape.category = val;
}
});
Please check if you did hit enter after typing a custom category. If you still experience any problems then I'll take a look at it.
My bad. there was some caching issue. It worked when I tried another browser. Many thanks for your time.
It's all good. Just wanted to make sure all is well. :)
This is a fix for Custom category of a shape is not being saved (Issue #113).
All I needed to do was change the value of the current target shape's category to the newly appended value. Previously, the value of the newly inputted category was pushed into the suggestedCategories array, but it didn't actually assign the value to the shape's category.
I also fixed a couple of typos and formatting inconsistencies as I was reading through the codebase to learn it.
I tested the fix on my local environment.
Type