单击拖动项目时触发的事件(Firefox)

ant*_*njs 7 javascript jquery jquery-ui-sortable backbone.js twitter-bootstrap

当我点击一个项目时,我可以编辑该字段,这要归功于bootstrap-editable.
当我拖放项目时,由于jquery.ui.sortable,我可以更改项目的位置.

使用Google Chrome一切正常.
通过使用Firefox 15.0.1我有以下问题.

移动项目后,会出现弹出窗口以编辑该字段.
我想这个事件是由事件传播引起的.
我试图解决它,但没有成功......

这是我的部分代码:

    onSortReceive: function (e, ui) {
        this.$(ui.item[0]).trigger('drop', this.options.taskType);
        // TODO just on firefox there is a issue related to bootstrap-editable
        // it shows the popup even if there is e.stopPropagation() here
        // the only way to fix this issue is to re-render the view
        e.stopPropagation(); // it makes no difference 
        this.render(); // it fix the problem 
                       // but I want to avoid to re-render the view
    },
Run Code Online (Sandbox Code Playgroud)

有关完整代码,您可以继续:https:
//github.com/antonioJs/CoCoTask/pull/21/files

对于工作版本,您可以继续:
http://computerone.altervista.org/CoCoTask/(问题仅在于Firefox)

知道如何解决这个问题吗?

谢谢

rin*_*.io 1

好的,这是我发现的一种工作方式。在您的taskItem.js替换onRender为以下代码:

    onRender: function () {
        var sortInAction = false;
        this.$el.find('label').mouseup(function(e) {
          sortInAction = 'absolute' === $(e.target).closest('li').css('position');
        }).click(function(e) {
            if (sortInAction)
              e.stopImmediatePropagation();
        }).editable({
            type: 'textarea',
            name: 'task-name',
            validate: this.editTaskName,
            template: '<textarea rows="3"></textarea>'
        });
    },
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你。