mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 11:09:29 +00:00
Fixed dropdown button visibility for ckeditor label placeholder plugin
This fixes issue #1056
This commit is contained in:
parent
7b61a00f21
commit
746aa53bc3
1 changed files with 19 additions and 9 deletions
|
|
@ -24,7 +24,7 @@ require('./lang/de.js');
|
||||||
import { addListToDropdown, createDropdown } from 'ckeditor5';
|
import { addListToDropdown, createDropdown } from 'ckeditor5';
|
||||||
|
|
||||||
import {Collection} from 'ckeditor5';
|
import {Collection} from 'ckeditor5';
|
||||||
import {Model} from 'ckeditor5';
|
import {UIModel} from 'ckeditor5';
|
||||||
|
|
||||||
export default class PartDBLabelUI extends Plugin {
|
export default class PartDBLabelUI extends Plugin {
|
||||||
init() {
|
init() {
|
||||||
|
|
@ -151,18 +151,28 @@ const PLACEHOLDERS = [
|
||||||
function getDropdownItemsDefinitions(t) {
|
function getDropdownItemsDefinitions(t) {
|
||||||
const itemDefinitions = new Collection();
|
const itemDefinitions = new Collection();
|
||||||
|
|
||||||
|
let first = true;
|
||||||
|
|
||||||
for ( const group of PLACEHOLDERS) {
|
for ( const group of PLACEHOLDERS) {
|
||||||
|
|
||||||
//Add group header
|
//Add group header
|
||||||
|
|
||||||
|
//Skip separator for first group
|
||||||
|
if (!first) {
|
||||||
|
|
||||||
itemDefinitions.add({
|
itemDefinitions.add({
|
||||||
'type': 'separator',
|
'type': 'separator',
|
||||||
model: new Model( {
|
model: new UIModel( {
|
||||||
withText: true,
|
withText: true,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
itemDefinitions.add({
|
itemDefinitions.add({
|
||||||
type: 'button',
|
type: 'button',
|
||||||
model: new Model( {
|
model: new UIModel( {
|
||||||
label: t(group.label),
|
label: t(group.label),
|
||||||
withText: true,
|
withText: true,
|
||||||
isEnabled: false,
|
isEnabled: false,
|
||||||
|
|
@ -173,7 +183,7 @@ function getDropdownItemsDefinitions(t) {
|
||||||
for ( const entry of group.entries) {
|
for ( const entry of group.entries) {
|
||||||
const definition = {
|
const definition = {
|
||||||
type: 'button',
|
type: 'button',
|
||||||
model: new Model( {
|
model: new UIModel( {
|
||||||
commandParam: entry[0],
|
commandParam: entry[0],
|
||||||
label: t(entry[1]),
|
label: t(entry[1]),
|
||||||
tooltip: entry[0],
|
tooltip: entry[0],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue