7

当我单击一个项目时,我可以通过bootstrap-editable编辑该字段。
当我拖放项目时,我可以通过jquery.ui.sortable更改项目的位置。

使用谷歌浏览器一切正常。
通过使用 Firefox 15.0.1,我遇到了以下问题。

移动项目后,会出现编辑字段的弹出窗口。
我想这个事件是由于事件传播造成的。
我试图修复它,但没有成功……</p>

这是我的代码:

    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
    },

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

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

知道如何解决问题吗?

谢谢

4

2 回答 2

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>'
        });
    },

希望能帮助到你。

于 2012-10-02T16:31:12.540 回答
0

您应该 e.preventDefault()mouseup事件,而不是sortreceive jquery.ui事件。也许这样的事情会起作用(未经测试):

'mouseup li': 'liMouseUp'

/* ... */

liMouseUp: function(e) {
    if ($(e.target).is('.ui-draggable-dragging')) {
        e.preventDefault();
    }
}
于 2012-10-01T18:20:51.220 回答