在葡萄中使用绝对拖动模式



在我的角度应用程序中,我正在尝试使用这样的绝对dragMode

所以在我的组件.ts中,我添加了拖动模式:

grapesjs.init({
container: '#gjs',
autorender: true,
forceClass: false,
dragMode: 'absolute',
components: '',
style: '',

它给出了一个错误,说拖动块时未定义编辑器,我该如何解决此问题以及如何使特定块具有绝对dragMode.

黑客:如果编辑器在全球范围内可用,那么它可以工作。就像将编辑器分配给窗口编辑器一样。我遇到了同样的问题。到目前为止,还没有解释为什么编辑器在绝对模式下未定义。

window.editor = this.editor;

我不确定这是否是最好的方法。

component.set('dmode', 'absolute'(; 或

editor.on("component:selected", function (model) {
if (component.attributes.type === 'Your component type') {
model.set('dmode', 'absolute');
}
});

最新更新