BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
15.22k stars 1.9k forks source link

New editor codemirror changes TAB behaviour #4446

Open busyninja opened 1 year ago

busyninja commented 1 year ago

Describe the Bug

Before changing the editor to code mirror, I was able to tab properly when editing pages with the markdown editor.

For example if I have the line:

foo bar

And I place cursor in the space between words and press tabulate, before the output was:

foo{space}{space}{space}{space}{space}bar (edited as removes spaces from output)

And now the output is: {space}{space}{space}{space}foo{space}bar (edited as removes spaces from the output)

This is a deep change in the user editor experience.

After some research y see this might be related to codemirror configuration for parameter tabmode : https://codemirror.net/1/manual.html

Would be nice having an option to configure that setting, as it deeply change user experience.

I do appreciate a lot you help.

Steps to Reproduce

  1. Go to settings and review markdown editor is set.
  2. Create a new Page.
  3. Input the text : foo bar
  4. Go to space between foo and bar and press TAB

Expected Behaviour

Introduces 4 spaces within words.

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v23.06.2

PHP Version

No response

Hosting Environment

I have tried two environments:

ssddanbrown commented 1 year ago

Hi @busyninja,

After some research y see this might be related to codemirror configuration for parameter tabmode :

We can't really follow those docs, since we're using CodeMirror 6, not CodeMirror 1 which is very much a different beast.

Could you explain the value/importance/use of being able to use tabs within lines? Specifically supporting this case to emulate the previous behaviour will add some complexity to manage, and it would be good to have a use-case, or functional reason, to justify the added complexity.

busyninja commented 1 year ago

Hi @ssddanbrown ,

Thanks for your response.

Despite is Codemirror 1 or 6, the bug comes from there. In the versions before codemirror is installed, the bug doesn't exist.

It was very surprising to me read your questions but I will try to do my best to answer them.

Screenshot 2023-08-22 at 11 38 16

I do attach a picture of this case.

Before the editor change we were able to tabulate within document which allows us a much more cleaner and readable output of items within it.

IMHO this is a huge change in user experience while using the editor and I haven't seen this behaviour in any other editor before. In all editors to have this behaviour you have to select whole line. In this particular case, it's much better leave a transition period with both editors and let users decide which editor they want to use, more than forcing all to a new user experience without letting them have the option of going back nor decide.

I do appreciate your time.

Bests, M.