New editor codemirror changes TAB behaviour #3977

Open
opened 2026-02-05 08:00:27 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @busyninja on GitHub (Aug 17, 2023).

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:

  • debian 11 with php 8.2, installed from puppet recipe we had.
  • docker image from solidnerd to double check wasn't an issue related to my instalation.
Originally created by @busyninja on GitHub (Aug 17, 2023). ### 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: - debian 11 with php 8.2, installed from puppet recipe we had. - docker image from solidnerd to double check wasn't an issue related to my instalation.
OVERLORD added the 🐛 Bug> Markdown Editor labels 2026-02-05 08:00:27 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Aug 21, 2023):

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.

@ssddanbrown commented on GitHub (Aug 21, 2023): 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.
Author
Owner

@busyninja commented on GitHub (Aug 22, 2023):

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.

  • Could you explain the value/importance/use of being able to use tabs within lines?
    Well it's one of the most basic features of all editors. For example when I'm doing tables in MD format those are unintelligible if not used tabs to make them readable. The indent behaviour we have now, should only happen when you have all line selected.
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.

@busyninja commented on GitHub (Aug 22, 2023): 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. - Could you explain the value/importance/use of being able to use tabs within lines? Well it's one of the most basic features of all editors. For example when I'm doing tables in MD format those are unintelligible if not used tabs to make them readable. The indent behaviour we have now, should only happen when you have all line selected. <img width="1249" alt="Screenshot 2023-08-22 at 11 38 16" src="https://github.com/BookStackApp/BookStack/assets/24222607/b188f6a9-afec-4ec4-af01-32ea707dba28"> 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3977