This is barely working proof of concept that just confirms it's possible to use TinyMCE in Zammad using either browser console or TamperMonkey user scripts.
It was created with some help from the awemsome Kagi Assistant / Claude 3.7 Sonnet (never wrote/used user scripts in browsers or the TinyMCE itself, didn't write Javascript for a decade). Developed mostly in Firefox's browser console before finally wrapping it up in TamperMonkey script.
It adds 3 custom shortcuts:
// Register keyboard shortcuts
editor.shortcuts.add('alt+m', 'Monospace', toggleMonospace);
editor.shortcuts.add('meta+alt+m', 'Code', toggleCode);
editor.shortcuts.add('meta+shift+c', 'Pre Block', togglePre);
Disable Zammad shortcuts completely (didn't check whether they clash at all).
Add the zammad-tinymce.js
to TamperMonkey scripts
Set up your instance's domain at script edition > Settings
tab > Includes/Excludes
> User Matches
list (middle column).
The entry format will be like https://zammad.example.com/*
.
Adjust Content Security Policy on your instance to allow downloading scripts and styles from the CDN: there will be a lot plugin files/styles downloaded.
In Caddyfile you could do it by regex-replacing script-src
and style-src
CSP directives like this:
header {
>Content-Security-Policy "script-src ([^;]*)" "script-src $1 https://cdn.jsdelivr.net"
>Content-Security-Policy "style-src ([^;]*)" "style-src $1 https://cdn.jsdelivr.net"
}
- it should probably render a full editor, instead of popup above the div, but is still very useful
- the pop-up does not "stick" to the
<div>
: stays in the same place on the screen while scrolling the page
- the pop-up does not "stick" to the
- use a DOM element watcher instead of
setInterval()