dfdsf
This commit is contained in:
@@ -96,50 +96,54 @@
|
||||
const BaseModel = baseType.model || editor.DomComponents.Component;
|
||||
const BaseView = baseType.view || editor.DomComponents.View;
|
||||
|
||||
const PlaceholderModel = BaseModel.extend({
|
||||
defaults: {
|
||||
name: 'Placeholder',
|
||||
tagName: 'span',
|
||||
droppable: false,
|
||||
attributes: {
|
||||
'data-placeholder-type': 'custom',
|
||||
'data-placeholder-key': 'UEBERSCHRIFT',
|
||||
},
|
||||
traits: [
|
||||
{
|
||||
type: 'select',
|
||||
name: 'data-placeholder-type',
|
||||
label: 'Typ',
|
||||
options: [
|
||||
{ id: 'custom', label: 'Allgemein' },
|
||||
{ id: 'database', label: 'Datenbank' },
|
||||
],
|
||||
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 placeholderDefaults = {};
|
||||
if (BaseModel.prototype && BaseModel.prototype.defaults) {
|
||||
for (const key in BaseModel.prototype.defaults) {
|
||||
placeholderDefaults[key] = BaseModel.prototype.defaults[key];
|
||||
}
|
||||
}
|
||||
placeholderDefaults.name = 'Placeholder';
|
||||
placeholderDefaults.tagName = 'span';
|
||||
placeholderDefaults.droppable = false;
|
||||
placeholderDefaults.attributes = {
|
||||
'data-placeholder-type': 'custom',
|
||||
'data-placeholder-key': 'UEBERSCHRIFT',
|
||||
};
|
||||
placeholderDefaults.traits = [
|
||||
{
|
||||
type: 'select',
|
||||
name: 'data-placeholder-type',
|
||||
label: 'Typ',
|
||||
options: [
|
||||
{ id: 'custom', label: 'Allgemein' },
|
||||
{ id: 'database', label: 'Datenbank' },
|
||||
],
|
||||
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() {
|
||||
this.listenTo(this, 'change:attributes', this.updatePlaceholderState);
|
||||
this.updatePlaceholderState();
|
||||
@@ -229,6 +233,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
PlaceholderModel.prototype.defaults = placeholderDefaults;
|
||||
|
||||
PlaceholderModel.isComponent = function (el) {
|
||||
if (el && el.hasAttribute && el.hasAttribute('data-placeholder-type')) {
|
||||
return { type: PLACEHOLDER_COMPONENT };
|
||||
|
||||
Reference in New Issue
Block a user