7

アイテムをクリックすると、 bootstrap-editable のおかげでフィールドを編集できます。アイテムをドラッグ アンド ドロップすると、 jquery.ui.sortable
のおかげでアイテムの位置を変更できます。

Google Chrome を使用すると、すべて正常に動作します。
Firefox15.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

さて、ここに私が見つけた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

mouseupイベントではなく、e.preventDefault() イベントを使用する必要がありsortreceive jquery.uiます。たぶん、このようなものがうまくいくでしょう(テストされていません):

'mouseup li': 'liMouseUp'

/* ... */

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