Fix style state display in editor and stabilize command refresh #44
+8
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Kurzbeschreibung
Die Style-Dropdowns (BlockStyles und InlineStyles) in CKEditor zeigten bisher nicht an, welcher Style aktuell aktiv ist. Mit diesem PR wird der Zustand korrekt angezeigt und die Aktivierung/Deaktivierung der Block-Style-Kommandos stabilisiert. Das verbessert die Redakteurs-UX deutlich und behebt das als „Known Issue“ dokumentierte Verhalten.
Datum: 2025-11-11 14:54
Hintergrund/Motivation
In Projekten mit TechDivision.CkStyles wurden Styles korrekt angewendet, aber das Dropdown im Editor blieb visuell leer. Das Paket verwies bisher auf eine „autoparagraph“-Limitation des CKEditors. Die Analyse zeigte jedoch zwei konkrete Implementierungsfehler:
BlockStyleCommand.refresh()(kein Reset vonisEnabled)Änderungen im Detail
Packages/Plugins/TechDivision.CkStyles/Resources/Private/JavaScript/CkStyles/src/components/BlockStyleSelector.jsselectors.CR.Nodes.focusedNodePathSelector(state)→selectors.UI.ContentCanvas.formattingUnderCursor(state)Packages/Plugins/TechDivision.CkStyles/Resources/Private/JavaScript/CkStyles/src/components/InlineStyleSelector.jsselectors.CR.Nodes.focusedNodePathSelector(state)→selectors.UI.ContentCanvas.formattingUnderCursor(state)Packages/Plugins/TechDivision.CkStyles/Resources/Private/JavaScript/CkStyles/src/BlockStyleCommand.jsrefresh()vor der Schleife:this.isEnabled = false;break;Packages/Plugins/TechDivision.CkStyles/Resources/Public/JavaScript/CkStyles/Plugin.jsTechnische Erläuterung
formattingUnderCursorist der korrekte Redux-Selector, der den CKEditor-Formatierungszustand unter dem Cursor bereitstellt. Dieser enthält Keys wieinlineStyles:<preset>bzw.blockStyles:<preset>und deren aktuelle Werte.isEnabledkonnte der Zustand von Commands zwischen Selektionen „kleben“ bleiben. Der explizite Reset garantiert korrekte Aktivierung nur, wenn das Schema das Attribut wirklich erlaubt.