Skip to content

Commit 746aa53

Browse files
committed
Fixed dropdown button visibility for ckeditor label placeholder plugin
This fixes issue #1056
1 parent 7b61a00 commit 746aa53

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

assets/ckeditor/plugins/PartDBLabel/PartDBLabelUI.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require('./lang/de.js');
2424
import { addListToDropdown, createDropdown } from 'ckeditor5';
2525

2626
import {Collection} from 'ckeditor5';
27-
import {Model} from 'ckeditor5';
27+
import {UIModel} from 'ckeditor5';
2828

2929
export default class PartDBLabelUI extends Plugin {
3030
init() {
@@ -151,18 +151,28 @@ const PLACEHOLDERS = [
151151
function getDropdownItemsDefinitions(t) {
152152
const itemDefinitions = new Collection();
153153

154+
let first = true;
155+
154156
for ( const group of PLACEHOLDERS) {
157+
155158
//Add group header
156-
itemDefinitions.add({
157-
'type': 'separator',
158-
model: new Model( {
159-
withText: true,
160-
})
161-
});
159+
160+
//Skip separator for first group
161+
if (!first) {
162+
163+
itemDefinitions.add({
164+
'type': 'separator',
165+
model: new UIModel( {
166+
withText: true,
167+
})
168+
});
169+
} else {
170+
first = false;
171+
}
162172

163173
itemDefinitions.add({
164174
type: 'button',
165-
model: new Model( {
175+
model: new UIModel( {
166176
label: t(group.label),
167177
withText: true,
168178
isEnabled: false,
@@ -173,7 +183,7 @@ function getDropdownItemsDefinitions(t) {
173183
for ( const entry of group.entries) {
174184
const definition = {
175185
type: 'button',
176-
model: new Model( {
186+
model: new UIModel( {
177187
commandParam: entry[0],
178188
label: t(entry[1]),
179189
tooltip: entry[0],

0 commit comments

Comments
 (0)