Skip to content

Commit

Permalink
Fix drag image of dragged section in Safari
Browse files Browse the repository at this point in the history
Safari apparently get confused with the scaled section thumbnail and
incorrectly uses a much larger rectangle when generating the drag
image of a dragged section item. The image then also includes text of
other chapters and section items of the outline and parts of the
sidebar footer.

Use fallback instead of native draggable for sections in Safari.

Related: SortableJS/Sortable#291

REDMINE-20837
  • Loading branch information
tf committed Oct 2, 2024
1 parent 57f9487 commit 7c6eda6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Marionette from 'backbone.marionette';

import {editor, modelLifecycleTrackingView} from 'pageflow/editor';
import {cssModulesUtils, SortableCollectionView} from 'pageflow/ui';
import {browser} from 'pageflow/frontend';

import {SectionItemView} from './SectionItemView';

Expand Down Expand Up @@ -58,7 +59,8 @@ export const ChapterItemView = Marionette.Layout.extend({
itemViewOptions: {
entry: this.options.entry
},
connectWith: cssModulesUtils.selector(styles, 'sections')
connectWith: cssModulesUtils.selector(styles, 'sections'),
forceDraggableFallback: browser.agent.matchesDesktopSafari()
}));

this.update();
Expand Down
3 changes: 3 additions & 0 deletions package/src/ui/views/SortableCollectionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export const SortableCollectionView = CollectionView.extend({

ghostClass: 'sortable-placeholder',

forceFallback: this.options.forceDraggableFallback,
fallbackTolerance: 3,

onEnd: event => {
const item = $(event.item);

Expand Down

0 comments on commit 7c6eda6

Please sign in to comment.