Inline code in comments disappear #6003

Closed
opened 2026-01-28 12:01:52 +01:00 by mueller-contria 2 comments
[]
mueller-contria commented 2026-01-28 12:01:52 +01:00 (Migrated from github.com)

Describe the Bug

When adding a new or editing an existing comment on a page, I can press ctrl+8 to add text formatted as Inline Code.
After saving the comment, everything added as Code is gone. It is not, that the code-formatting would not work, but the text itself is gone.

Steps to Reproduce

  1. Go to any page where you have permissions to add a comment
  2. Add some normal text, Press ctrl+8, add some code, Press ctrl+8 again. -> the code is visible in the comment- editor, inside the tags <code><span class="editor-theme-code">
  3. Click "Save comment"
  4. The comment appears, but only the normal text before and after the code. The code itself is gone, source-code reveals neither <code>-tags nor the text.

Expected Behaviour

Code in Comment should be visible.
Ideally it would be inside <code>-Tags as it is with code in other parts of a page.

Screenshots or Additional Context

While ctrl+8 seems to work in the editor, but not while saving; most other shortcuts from the normal editor do not work at all and produce a javascript-error:
ctrl+[1-4]
ctrl+6 / ctrl+Q
ctrl+7 / ctrl+E
ctrl+9
all give the following error on the javascript-console:
wysiwyg.js?version=v25.12.2:13 TypeError: Cannot read properties of null (reading 'open')

As these are the shortcuts with no equivalent Icon in the Comment-Editor; and as the shortcuts for commends with an Icon (ctrl+b, ctrl+i, ctrl+o, ctrl+p, ctrl+shift+k) do work as expected, I guess this is not an unexpected behaviour.

But ctrl+8 seems to be a different case, as it seems to be working correctly while editing, but not on saving.

As source code in comments seems to have worked earlier, I guess this is a problem with the new WYSIWYG-Editor

Browser Details

Firefox 147.0.1 (64-Bit) on Windows 11

Exact BookStack Version

v25.12.2

### Describe the Bug When adding a new or editing an existing comment on a page, I can press `ctrl+8` to add text formatted as Inline Code. After saving the comment, everything added as Code is gone. It is not, that the code-formatting would not work, but the text itself is gone. ### Steps to Reproduce 1. Go to [any page](https://demo.bookstackapp.com/books/bookstack-demo-site/page/mixed-content-example-page) where you have permissions to add a comment 2. Add some normal text, Press `ctrl+8`, add some code, Press `ctrl+8` again. -> the code is visible in the comment- editor, inside the tags `<code><span class="editor-theme-code">` 3. Click "Save comment" 4. The comment appears, but only the normal text before and after the code. The code itself is gone, source-code reveals neither `<code>`-tags nor the text. ### Expected Behaviour Code in Comment should be visible. Ideally it would be inside `<code>`-Tags as it is with code in other parts of a page. ### Screenshots or Additional Context While `ctrl+8` seems to work in the editor, but not while saving; most other shortcuts from the normal editor do not work at all and produce a javascript-error: `ctrl+[1-4]` `ctrl+6` / `ctrl+Q` `ctrl+7` / `ctrl+E` `ctrl+9` all give the following error on the javascript-console: `wysiwyg.js?version=v25.12.2:13 TypeError: Cannot read properties of null (reading 'open')` As these are the shortcuts with no equivalent Icon in the Comment-Editor; and as the shortcuts for commends with an Icon (`ctrl+b`, `ctrl+i`, `ctrl+o`, `ctrl+p`, `ctrl+shift+k`) do work as expected, I guess this is not an unexpected behaviour. But `ctrl+8` seems to be a different case, as it seems to be working correctly while editing, but not on saving. As source code in comments seems to [have worked earlier](https://github.com/BookStackApp/BookStack/issues/860), I guess this is a problem with the new WYSIWYG-Editor ### Browser Details Firefox 147.0.1 (64-Bit) on Windows 11 ### Exact BookStack Version v25.12.2
[]
joachimtingvold commented 2026-02-16 07:28:18 +01:00 (Migrated from github.com)

Stumbled upon this issue when trying to figure out why comments added via the API didn't have code formatting. I'm using v25.12.3.

edit: Looking at it closer, the issue seems to be even "deeper" on the API-side. The API expects html-content via the html parameter, and even if you feed it content like the following;

This is a test with normal text followed by code-segment:

<pre><code class="text">
Some code
</code></pre>

or:

<pre><code class="text">
Just code, no normal text
</code></pre>

Both of these entries are "sucess"/OK (based on the API-response), but the content stored in the database is completely blank (i.e. not even the normal text of the first example is stored).

Stumbled upon this issue when trying to figure out why comments added via the API didn't have code formatting. I'm using v25.12.3. edit: Looking at it closer, the issue seems to be even "deeper" on the API-side. The API expects html-content via the `html` parameter, and even if you feed it content like the following; ``` This is a test with normal text followed by code-segment: <pre><code class="text"> Some code </code></pre> ``` or: ``` <pre><code class="text"> Just code, no normal text </code></pre> ``` Both of these entries are "sucess"/OK (based on the API-response), but the content stored in the database is completely blank (i.e. not even the normal text of the first example is stored).
[]
ssddanbrown commented 2026-04-16 12:30:24 +02:00 (Migrated from github.com)

Thanks for reporting @mueller-contria, and for the extra input @joachimtingvold

The description/comment editors are (purposefully) cut down minimal versions of the main page editor, with stricter back-end content control/filtering. I had left the same range of shortcuts active though, leading to this scenario where inline code could be used but was then filtered out on the back-end.

In #6100 I've updated things so now only relevant shortcuts are registered, and I've added inline code as a supported type for the minimal editor (with its button also added to the toolbar).

These changes will be part of the next feature release.

Code blocks will still not be supported, you may find these are either removed, or become inline code sections.
If there's a need for these, I'd welcome a specific feature request to be raised for consideration.

Thanks for reporting @mueller-contria, and for the extra input @joachimtingvold The description/comment editors are (purposefully) cut down minimal versions of the main page editor, with stricter back-end content control/filtering. I had left the same range of shortcuts active though, leading to this scenario where inline code could be used but was then filtered out on the back-end. In #6100 I've updated things so now only relevant shortcuts are registered, and I've added inline code as a supported type for the minimal editor (with its button also added to the toolbar). These changes will be part of the next feature release. Code blocks will still not be supported, you may find these are either removed, or become inline code sections. If there's a need for these, I'd welcome a specific feature request to be raised for consideration.
Sign in to join this conversation.
[Go]
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bookstack/bookstack#6003
Write Preview
Loading
Add table
Rows
Columns
Cancel OK
Add a link
Url Description
Hint: With a URL in your clipboard, you can paste directly into the editor to create a link.
Cancel OK
Cancel Save
No description provided.