Format as code in answer (monospaced font and no formating)

A lot of time in tickets we need to cut/paste code or shell exemple but as zammad has shortcut for italic/bold/h1 etc… i dont see any way to ask for a text formating for code.

This mean text that has monospaced fonts and no html interpretation. Basicaly <p> </p>.

This forum has it has ctrl+E preformated text but zammad does not allow this it seems.

Do you think this could be done ?

best regards.

4 Likes

ideal would be exactly like in this forum with this:

user@unknow-ms-7c52:[~]: ls -la /
total 92K
drwxr-xr-x  20 root root  4096 Jun 15  2022 .
drwxr-xr-x  20 root root  4096 Jun 15  2022 ..
lrwxrwxrwx   1 root root     7 Feb 25  2020 bin -> usr/bin
drwxr-xr-x   4 root root  4096 Mar  8 06:21 boot
drwxrwxr-x   2 root root  4096 Feb 25  2020 cdrom
drwxr-xr-x  21 root root  5460 Mar 23 17:10 dev
drwxr-xr-x 162 root root 12288 Mar 22 06:41 etc
drwxr-xr-x   4 root root  4096 Apr  7  2021 home
lrwxrwxrwx   1 root root     7 Feb 25  2020 lib -> usr/lib
lrwxrwxrwx   1 root root     9 Feb 25  2020 lib32 -> usr/lib32
lrwxrwxrwx   1 root root     9 Feb 25  2020 lib64 -> usr/lib64
lrwxrwxrwx   1 root root    10 Feb 25  2020 libx32 -> usr/libx32
drwx------   2 root root 16384 Feb 25  2020 lost+found
drwxr-xr-x   3 root root  4096 Sep 28 18:00 media
drwxr-xr-x   2 root root  4096 Oct 17  2019 mnt
drwxrwxr-x   8 root root  4096 Dec 30  2021 opt
dr-xr-xr-x 583 root root     0 Mar 16 05:26 proc
drwx------  20 root root  4096 Mar 19 13:43 root
drwxr-xr-x  39 root root  1140 Mar 24 06:31 run
lrwxrwxrwx   1 root root     8 Feb 25  2020 sbin -> usr/sbin
drwxr-xr-x  28 root root  4096 Mar  2 16:40 snap
drwxr-xr-x   2 root root  4096 Oct 17  2019 srv
dr-xr-xr-x  13 root root     0 Mar 16 05:26 sys
drwxrwxrwt  26 root root 12288 Mar 24 06:44 tmp
drwxr-xr-x  14 root root  4096 Oct 17  2019 usr
drwxr-xr-x  14 root root  4096 Oct 17  2019 var

i see numerous previous ask for this “code”/“shell” formatting but all are closed more than 5 years ago all with ‘too much people want that, closing because too much noise’ :smiley:

I tried to look in the code how is made the BOLD shortcut in hope to make it myself but is dont find where its done.

regards.

i tried to modify

/opt/zammad/app/assets/javascripts/app/lib/base/jquery.contenteditable.js

with a new bloc of code like this

      if (e.keyCode == 48) {
        document.execCommand('bold')
        document.execCommand('formatBlock', false, 'p')
        document.execCommand('fontName',false,'monospace')
      }

but it seems that this is not enough :slight_smile:
regards,