nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.84k stars 4.01k forks source link

Allow prioritizing default file actions for a mime type (per user) #5065

Open nickvergessen opened 7 years ago

nickvergessen commented 7 years ago

Steps to reproduce

  1. Enable richdocuments to have rich editing for odt files
  2. Enable files_texteditor because you want txt files to be simple
  3. Open an txt file: richdocuments starts

I think it would be nice to have something like a priority of the actions. Currently the last one wins, and since richdocuments is after files_texteditor in the alphabet, files_texteditor has no way to ever win this.

Proposal is to add something like priority to: https://github.com/nextcloud/server/blob/2b794902014264a3793daf42a2ecfa95a1a07342/apps/files/js/fileactions.js#L144-L144

and then:

            if (!!this.actions[mime][name] && this.actions[mime][name].priority < actionSpec.priority) {
                return;
            }

This would allow the files_texteditor to register for text files, while richdocuments can also, so in case files_texteditor is not there, you can still edit them.

Alternate approach would be hacking into richdocuments to only register, when files_texteditor is not there.

cc @MorrisJobke @LukasReschke

cc @RealKelsar for reporting it in IRC

MorrisJobke commented 7 years ago

This would allow the files_texteditor to register for text files, while richdocuments can also, so in case files_texteditor is not there, you can still edit them.

I like that approach more. The cleaner hack. But still feels like a hack.

LukasReschke commented 7 years ago

I'd rather prefer a "Open with" dialogue but yay, JavaScript 😉

szaimen commented 3 years ago

I suppose this issue is still valid? If not, please close this issue!

susnux commented 1 month ago

There are priorities for file actions now, but we still have two problems:

  1. Actions that register as default actions -> if there are multiple we use the most important one without letting the user choose.
  2. multiple handlers on the viewer (e.g. richdocuments and text both use the viewer)

1 is a server issue (this on) and 2 is a viewer issue and handled here: https://github.com/nextcloud/viewer/issues/2393