Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buggy drag and drop #82

Merged
merged 4 commits into from
May 31, 2020
Merged

Fix buggy drag and drop #82

merged 4 commits into from
May 31, 2020

Conversation

KyrneDev
Copy link
Contributor

@KyrneDev KyrneDev commented May 17, 2020

The current Tags drag and drop in admin is really buggy and hard to use. It is almost impossible to use on mobile. This updates the sortable library to something more modern which makes it much, much easier to use (and has a nice little animation).

Before:

OldVersion

Mobile (totally unusable):

Old Mobile

New:

NewVersion

Mobile:

New Mobile

@KyrneDev
Copy link
Contributor Author

Please note that I changed to Dragula as per @datitisev's request. The functionality on mobile remains the same, but there is no animation as shown above.

@askvortsov1
Copy link
Member

@KyrneDev @datitisev are there plans to make additional changes in animation to this, or is this ready for review?

@dsevillamartin
Copy link
Member

dsevillamartin commented May 19, 2020

Imma play around with it. Regarding animation - that's not important here, and I see the sortablejs implementation as an unintended feature more than the focus of the PR.

@dsevillamartin
Copy link
Member

FYI - you removed the dist files instead of resetting them to a previous commit. That is fine, but you got me confused as to why the dist folder didn't exist.

Copy link
Member

@dsevillamartin dsevillamartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use dragula because it hasn't been updated since 2018.

Revert your latest commit(s) so we are using sortablejs again, and add the following line to make sure our styles are applied.

image

@askvortsov1 askvortsov1 merged commit 1d8c70b into flarum:master May 31, 2020
@dsevillamartin
Copy link
Member

Oh, one thing I forgot to add. We probably want to expose sortablejs to window - so other extensions can take advantage of it or lazy load their own.

@askvortsov1
Copy link
Member

How would we do that? webpack/importing/exporting JS is still a minefield for me

@dsevillamartin
Copy link
Member

dsevillamartin commented May 31, 2020

With expose-loader. It'd be like this, so import 'expose-loader?sortable!sortablejs' (with testing to make sure that it works)

@clarkwinkelmann
Copy link
Member

@datitisev We probably want to expose sortablejs to window - so other extensions can take advantage of it or lazy load their own

I'm not seeing a benefit here. If another extensions needs sortable but doesn't depend on the Tags extension, they will need to include the sortable library in their dist file anyway in case Tags isn't being used.

Unless we also have a way for extension to conditionally add javascript dependencies only when it's not already registered, there won't be any benefit from a bundle size perspective, and I'm not seeing any other possible benefit.

@dsevillamartin
Copy link
Member

@clarkwinkelmann I mentioned lazy-loading because they can still request a JS file after building - it'll just need to be in the extension's assets folder or use an external CDN.

See https://github.com/FriendsOfFlarum/drafts/blob/aece8dfe3f0b294f17807258b229f16857a0957a/js/src/forum/components/ScheduleDraftModal.js for an example.

askvortsov1 pushed a commit that referenced this pull request Mar 11, 2022
Switch to the SortableJs library to fix the buggy tags drag-and-drop admin UI.
askvortsov1 pushed a commit that referenced this pull request May 10, 2022
Switch to the SortableJs library to fix the buggy tags drag-and-drop admin UI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants