This commit is contained in:
2025-12-08 00:41:26 +01:00
parent 87f093f99a
commit 9ceeecaf4e

View File

@@ -96,50 +96,54 @@
const BaseModel = baseType.model || editor.DomComponents.Component; const BaseModel = baseType.model || editor.DomComponents.Component;
const BaseView = baseType.view || editor.DomComponents.View; const BaseView = baseType.view || editor.DomComponents.View;
const PlaceholderModel = BaseModel.extend({ const placeholderDefaults = {};
defaults: { if (BaseModel.prototype && BaseModel.prototype.defaults) {
name: 'Placeholder', for (const key in BaseModel.prototype.defaults) {
tagName: 'span', placeholderDefaults[key] = BaseModel.prototype.defaults[key];
droppable: false, }
attributes: { }
'data-placeholder-type': 'custom', placeholderDefaults.name = 'Placeholder';
'data-placeholder-key': 'UEBERSCHRIFT', placeholderDefaults.tagName = 'span';
}, placeholderDefaults.droppable = false;
traits: [ placeholderDefaults.attributes = {
{ 'data-placeholder-type': 'custom',
type: 'select', 'data-placeholder-key': 'UEBERSCHRIFT',
name: 'data-placeholder-type', };
label: 'Typ', placeholderDefaults.traits = [
options: [ {
{ id: 'custom', label: 'Allgemein' }, type: 'select',
{ id: 'database', label: 'Datenbank' }, name: 'data-placeholder-type',
], label: 'Typ',
changeProp: true, options: [
}, { id: 'custom', label: 'Allgemein' },
{ { id: 'database', label: 'Datenbank' },
type: 'text',
name: 'data-placeholder-key',
label: 'Bezeichner',
placeholder: 'UEBERSCHRIFT',
changeProp: true,
},
{
type: 'select',
name: 'data-placeholder-table',
label: 'Tabelle',
options: [],
changeProp: true,
},
{
type: 'select',
name: 'data-placeholder-column',
label: 'Feld',
options: [],
changeProp: true,
},
], ],
changeProp: true,
}, },
{
type: 'text',
name: 'data-placeholder-key',
label: 'Bezeichner',
placeholder: 'UEBERSCHRIFT',
changeProp: true,
},
{
type: 'select',
name: 'data-placeholder-table',
label: 'Tabelle',
options: [],
changeProp: true,
},
{
type: 'select',
name: 'data-placeholder-column',
label: 'Feld',
options: [],
changeProp: true,
},
];
const PlaceholderModel = BaseModel.extend({
init() { init() {
this.listenTo(this, 'change:attributes', this.updatePlaceholderState); this.listenTo(this, 'change:attributes', this.updatePlaceholderState);
this.updatePlaceholderState(); this.updatePlaceholderState();
@@ -229,6 +233,8 @@
} }
}); });
PlaceholderModel.prototype.defaults = placeholderDefaults;
PlaceholderModel.isComponent = function (el) { PlaceholderModel.isComponent = function (el) {
if (el && el.hasAttribute && el.hasAttribute('data-placeholder-type')) { if (el && el.hasAttribute && el.hasAttribute('data-placeholder-type')) {
return { type: PLACEHOLDER_COMPONENT }; return { type: PLACEHOLDER_COMPONENT };