可拖动或可调整大小的文本区域不起作用

Textarea draggable or resizable does not work

本文关键字:文本 区域 不起作用 拖动 可调整      更新时间:2023-10-23

最近我将extjs 4升级到5,然后我发现文本区域没有可拖动和可调整大小的功能,但它在extjs v4上运行得很好。我创造小提琴来测试它:Fiddle

我该怎么修?这是个bug还是我错了?

这是我使用的代码:

Ext.define('Textarea', {
    extend: 'Ext.form.field.TextArea',
    alias: 'widget.ddtext',
    contextMenu: true,
    root: null,
    name: 'text',
    emptyText: "Enter your text here",
    cls: "textInput",
    resizable: true,
    draggable: {
        constrain: true,
        preventDefault: false,
        stopEvent: true
    }
});
Ext.define('TestWindow', {
    extend: "Ext.window.Window",
    alias: "widget.ddwindow",
    title: 'Window',
    width: 550,
    height: 670,
    resizable: false,
    layout: 'fit',
    modal: true,
    items: {
        itemId: "windowContainer",
        autoScroll: true,
        xtype: "container",
        layout: {
            type: 'vbox',
            padding: 5
        },
        defaults: {
            width: "100%"
        },
        items: [
            {
                itemId: "container",
                xtype: "container",
                layout: 'vbox',
                items: [
                    {
                        itemId: "dropZone",
                        xtype: "container",
                        height: 500,
                        width: 500,
                        style:{
                            backgroundColor: "#000"  
                        },
                        layout: "absolute",
                        scope: this,
                        items: [
                            {
                                xtype: 'ddtext'
                            }
                        ]
                    }
                ]
            }
        ]
    }
});
Ext.application({
    name : 'Fiddle',
    launch : function() {
        Ext.create("TestWindow").show();
    }
});

我可以通过以下任一方式使其工作:

  • 完全移除dropZone容器https://fiddle.sencha.com/#fiddle/i60
  • 将dropZone的布局从"绝对"更改为"适合"https://fiddle.sencha.com/#fiddle/i5v

在一个绝对容器中有一个可调整大小的组件似乎有一些问题。