dfdsf
This commit is contained in:
@@ -96,16 +96,20 @@
|
|||||||
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: {
|
}
|
||||||
|
placeholderDefaults.name = 'Placeholder';
|
||||||
|
placeholderDefaults.tagName = 'span';
|
||||||
|
placeholderDefaults.droppable = false;
|
||||||
|
placeholderDefaults.attributes = {
|
||||||
'data-placeholder-type': 'custom',
|
'data-placeholder-type': 'custom',
|
||||||
'data-placeholder-key': 'UEBERSCHRIFT',
|
'data-placeholder-key': 'UEBERSCHRIFT',
|
||||||
},
|
};
|
||||||
traits: [
|
placeholderDefaults.traits = [
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
name: 'data-placeholder-type',
|
name: 'data-placeholder-type',
|
||||||
@@ -137,9 +141,9 @@
|
|||||||
options: [],
|
options: [],
|
||||||
changeProp: true,
|
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 };
|
||||||
|
|||||||
Reference in New Issue
Block a user