Skip to content

Add custom CSS, editor styles and custom JS under Settings > System > Design - #461

Merged
itshypax merged 5 commits into
mainfrom
feat/custom-code
Nov 15, 2026
Merged

itshypax merged 5 commits into
mainfrom
feat/custom-code

Conversation

@itshypax

Copy link
Copy Markdown
Collaborator

New page Settings > System > Design with three parts: custom SCSS, editor styles and custom JS. Built on emergencyforge/theme 0.1 and editor 0.12 from EmergencyForge/WebPackages#44. Lex gets the same in EmergencyForge/Lex#69.

  • SCSS is compiled on save. Errors keep the input and name the line (422).
  • Editor styles appear in the style menu of documents, articles and mails. PDFs, KB articles, mail bodies and training text units render only the stored style classes; the PDF gets the style CSS. The KB sanitizer keeps efs- classes.
  • Custom JS for head and body end. Page, SCSS and styles need system.admin, JS also needs full_admin (Admin+), otherwise 403.
  • /theme/<hash>.css|js serves the code with an immutable cache header and works without login.
  • Each save writes an audit entry with hashes before and after, never the code.
  • ?safemode=1 switches custom CSS and JS off for the session, a yellow bar ends it.
  • The head and body calls sit in the admin and desk layouts, login, verify and the personnel document view, not in head.php, because fireTab and the eNOTF settings include that head and stay without custom code.
  • Migration 20261115000001_insert_config_custom_code adds the five keys as non-editable design rows, written through the new ConfigManager::set().
  • scssphp added to THIRD_PARTY_NOTICES, changelog entry under "Unveröffentlicht".

Checked: new DesignSettingsTest (7), PHPStan, full suite in the intrarp-app image (2174, the only failures are the SystemUpdater tests, which pass with IGNIS_RUNTIME cleared). Not checked in the browser yet: login here is OAuth only.

Draft until WebPackages#44 is merged and tagged (editor/v0.12.0, theme/v0.1.0). Then .github/webpackages-ref, composer.lock and the dist follow in this branch, so CI fails until then.

… Design

Admins can store SCSS, compiled on save, and styles for the editor's
style menu. Documents, mails, knowledge base articles and text units let
those classes through when rendering, the PDF gets their CSS, and the
knowledge base sanitizer keeps efs- classes. Custom JS for head and body
end needs full_admin, because such a script acts in every session.

Everything is served from /theme/<hash>.css|js without login and with an
immutable cache header, so a later CSP can allow 'self' without inline
scripts. The code goes in at the end of head and body of the admin and
desk layouts, login, verify and the document view; eNOTF and fireTab
load none. ?safemode=1 turns it off for the session. Every change writes
an audit entry with the hashes before and after, not the code.

The values live in intra_config as non-editable rows, written through
the new ConfigManager::set(). Needs emergencyforge/theme 0.1 and
editor-php 0.11 from WebPackages.
WebPackages tagged 0.11.0 for the i18n release, so the style menu ships
as editor 0.12.0. The dist comes from that tree.
# Conflicts:
#	composer.json
#	composer.lock
#	public/assets/dist/editor.css
#	public/assets/dist/editor.iife.js
@itshypax
itshypax marked this pull request as ready for review November 15, 2026 10:44
@emergencyforge

Copy link
Copy Markdown

✅ Alle Checks bestanden

25 Dateien geändert · +1189 -6

Übersicht

Check Status Details
Build (PHP 8.3/8.4) ✅ Bestanden
Unit Tests (8.3/8.4) ✅ Bestanden Keine Tests
Integration Tests ✅ Bestanden Keine Tests
Feature Tests (HTTP) ✅ Bestanden Keine Tests
Frontend Build ✅ Bestanden
Security Audit ✅ Bestanden
PHPStan ✅ Bestanden

Unit Tests ✅

✅ 0 Tests bestanden.

Integration Tests ✅

✅ 0 Tests bestanden.

Feature Tests (HTTP) ✅

✅ 0 Tests bestanden.

Frontend Build ✅

Assets in Sync mit Source (SCSS + Vite gebaut, kein Diff).

PHPStan: Statische Analyse ✅

Keine Fehler gefunden.

Security Audit ✅

Keine bekannten Schwachstellen.


Workflow-Log ansehen

@itshypax
itshypax merged commit dd5308e into main Nov 15, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant