ijprest / keyboard-layout-editor

Web application to enable the design & editing of keyboard layouts
http://www.keyboard-layout-editor.com/
Other
1.3k stars 241 forks source link

[Bug] After saving, the sizes disappear #223

Open optozorax opened 6 years ago

optozorax commented 6 years ago

I have the gist.

This key on gist has legend center size 3: image

I select all(Ctrl+A) and set the center size of Center legend to 4.

image

Then I saved this to JSON, loaded it, and the key despite everything has center size of Center Legend is 3!

This is the bug: site can't save the changed size when I change it by select all keys.

Something like this I have with colors of legend changed by selection of all.

Sorry for bad English.

Sushiimi commented 6 years ago

I am also having the same issue with some colors and sizes not saving.

Before saving: screenshot_1

After saving: screenshot_2

From the screenshots you can see that the Top Left Legend is not saving correctly on some of the keys while others are saving correctly. Sometimes the colors are not saved as well.

sunbart commented 6 years ago

I am having the same problem. The only workaround I found is editing the Gist directly, which is not ideal. If it would be helpful, I can make the problematic Gists public a share a link.

sunbart commented 6 years ago

Also, this happens both while selecting multiple keys and changing the legend size and doing the same thing one key at a time.

sunbart commented 6 years ago

Okay, interesting. I manually adjusted the Gist to fix the legend sizes and loaded it in KLE and the changes I did to the Gist were visible (the problematic keys now had the desired legend size). Then I moves some keys around in KLE, saved the layout and the changes I made to the Gist previously were removed. I guess my manual changes were correct enough to read the layout, but didn't get written back to the Gist.

Here's the Gist: https://gist.github.com/sunbart/cc8a4340999310235d170ab8a8624a1d and here's the KLE link: http://www.keyboard-layout-editor.com/#/gists/cc8a4340999310235d170ab8a8624a1d

In this particular layout, the problematic keys are: "1", "3", "_", "-" and "/"

HughP commented 5 years ago

@optozorax @Sushiimi @sunbart I can confirm that this happens to me too. It's annoying. I haven't found a solution yet.

optozorax commented 5 years ago

This is my solution. I am don't know JS, therefore I deleted source algorithm of files saving and replaced it with stupid saving of all data. It solve the issue, but result file is big (> 100kB). To run server with this changes you can clone my fork and use Python 3 in the directory as python3 -m http.server 80 and visit localhost in your browser.

Sorry for bad English.

ijprest commented 5 years ago

I've been able to reproduce the issue from the original post. Seems to be a problem in the serialization logic.

Last night I found the place where it's going wrong... now I just need to fix it.