Khan / Khan/live-editor

folds in HTML editor sometimes disappear

Open
#366 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
776
Forks
180
PR merge metrics
No merged PRs in 30d

Description

This has been bugging me for a long time but I just now got around to narrowing it down to a simple test case.

Sometimes, in the webpage environment the "folds" information seems to get lost or corrupted. I know there's a folds[ ] array in the scratchpad data, I assume something is going wrong there.

To demonstrate the issue: Visit https://www.khanacademy.org/computer-programming/trying-to-reproduce-2-editor-bugs/6653234476351488 and make a spin-off. Note that there is a triangle next to line 49.

On line 49, click the fold triangle to fold up the `bar` object that's inside the `foo()` function. Save the project, and refresh the page. You should no longer see a triangle by line 49 or be able to collapse/fold up that object.

If you hit the spacebar on line 49, the triangle appears. You can then backspace the space and fold up your object/function/whatever. Save the project again with it folded up and the triangle disappears on you again.

This frustrates me often on my large projects, as I often try to use the keyboard shortcut ALT-0 to collapse everything and not everything folds up until I manually go through and add spaces all over the place and backspace them or I just fumble around saving/reloading my project until the editor cooperates.

(If this isn't reproducible, or description isn't clear, let me know and I'll include pictures or screencast.)

I have only seen this issue in the HTML edtior, not the JS+PJS editor.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the linked HTML editor project: fold the object on line 49, save, refresh, and check whether the fold marker remains. Compare the saved folds data before and after reload; done means folds persist and the object can still be collapsed after saving and refreshing.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.