From 746aa53bc3e7d9028d59c54c21bce9c4f6b29dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Fri, 17 Oct 2025 17:41:30 +0200 Subject: [PATCH] Fixed dropdown button visibility for ckeditor label placeholder plugin This fixes issue #1056 --- .../plugins/PartDBLabel/PartDBLabelUI.js | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/assets/ckeditor/plugins/PartDBLabel/PartDBLabelUI.js b/assets/ckeditor/plugins/PartDBLabel/PartDBLabelUI.js index 095b0d25..860a2a2e 100644 --- a/assets/ckeditor/plugins/PartDBLabel/PartDBLabelUI.js +++ b/assets/ckeditor/plugins/PartDBLabel/PartDBLabelUI.js @@ -24,7 +24,7 @@ require('./lang/de.js'); import { addListToDropdown, createDropdown } from 'ckeditor5'; import {Collection} from 'ckeditor5'; -import {Model} from 'ckeditor5'; +import {UIModel} from 'ckeditor5'; export default class PartDBLabelUI extends Plugin { init() { @@ -151,18 +151,28 @@ const PLACEHOLDERS = [ function getDropdownItemsDefinitions(t) { const itemDefinitions = new Collection(); + let first = true; + for ( const group of PLACEHOLDERS) { + //Add group header - itemDefinitions.add({ - 'type': 'separator', - model: new Model( { - withText: true, - }) - }); + + //Skip separator for first group + if (!first) { + + itemDefinitions.add({ + 'type': 'separator', + model: new UIModel( { + withText: true, + }) + }); + } else { + first = false; + } itemDefinitions.add({ type: 'button', - model: new Model( { + model: new UIModel( { label: t(group.label), withText: true, isEnabled: false, @@ -173,7 +183,7 @@ function getDropdownItemsDefinitions(t) { for ( const entry of group.entries) { const definition = { type: 'button', - model: new Model( { + model: new UIModel( { commandParam: entry[0], label: t(entry[1]), tooltip: entry[0],