-
Notifications
You must be signed in to change notification settings - Fork 157
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
Text-editor extensions #7967
Text-editor extensions #7967
Conversation
efc2f8a
to
50bc489
Compare
It looks like |
Yes, at the moment an app that handles a specific file extension explicitly (like the |
That would be the best, but I would be surprised if we could have that in the short term, or am I wrong? :) I've asked @elizavetaRa to have a look and suggested we order the actions like following: 1st To me it makes more sense that we use an app if one is registered. What do you think, @kulmann ? |
Yes, nothing for short term.
The name |
Isn't this what we're doing already in a way? Should we rename it? |
Yes and yes 😄 Do you have a proposal for a better var name? |
|
works for me, So as a result: we want to sort all the apps and external-apps in one pool by following criteria:
Correct? |
sounds good! The priority sort should apply after the "external apps last" sort |
Ok. What's the next step, can you take care of finishing this PR? |
d3d76bd
to
42f1656
Compare
Kudos, SonarCloud Quality Gate passed! |
Results for e2e-tests oCIS https://drone.owncloud.com/owncloud/web/36303/12/1 💥 To see the trace, please open the link in the console ...
npx playwright show-trace https://cache.owncloud.com/public/owncloud/web/36303/tracing/public-link-for-space-alice-2023-6-6-08-49-46.zip |
@kulmann please let us know if you prefer to split the PR into text-editor stuff and the more general default extensions handling. |
@kulmann and please let us know if you see the use case to implement |
@@ -12,6 +12,7 @@ export interface Action<T = ActionOptions> { | |||
componentType: 'button' | 'router-link' | |||
class: string | |||
canBeDefault?: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @diocas and @elizavetaRa
my intend (see discussion, I think yours as well at some point) was to rephrase canBeDefault
to hasPriority
. Meaning, having both in parallel now makes things unnecessarily complex. 🙈
On top of that: I think the approach with the app provider - define via config which app has priority - is the way to go. An extension developer should never be the one who decides which application has priority over another one. The admin has to decide that, so that's configuration only, not code.
Could you look into realizing the following?
- get rid of
canBeDefault
entirely - introduce
hasPriority
but only through configuration, nothing hardcoded. For the app provider apps it's already there with thedefault_application
attribute on mime types. - determine the app that gets opened on click in file list (= "default app") by throwing all standalone apps and all app provider apps into one list, sort them by priority, then by internal vs app provider, and pick the first.
What do you think? Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diocas @elizavetaRa anything we can do to support you here? Do you have feedback or further need for clarification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elizavetaRa has been a bit busy. I'll check with her tomorrow when she can fit this in her tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diocas if you're generally fine with what Benedikt suggested I could also take over?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pascalwengerter @kulmann I'll take this issue, will update the pr these days, thanks for waiting!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kulmann 2 questions:
- what is the purpose of "canBeDefault" in terms priority in the composables/actions files like
web-app-files/src/composables/actions/files/useFileActionsCreateNewFile.ts
? - "introduce
hasPriority
but only through configuration, nothing hardcoded." You mean move settinghasPriority
of all the extensions, also editors to config.json instead of index.ts of each extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @elizavetaRa - cool that you are working on this, thank you! 🤩
- in the case of file action composables,
canBeDefault
doesn't belong there. Could be removed entirely, doesn't make sense. - yes, that's exactly what I meant. :-) Please note that providing config for an app is not possible in the
apps
array of the config.json, but only for theexternal_apps
array. That one is a bit misleading, name wise, but that's fine for now. Only means that if an admin wants to give an app priority over another one for the same file type they need to define the app inexternal_apps
. We need to clean that up (big time), but I wouldn't do that in the scope of this PR. So please just keep the assumption that providing config for an app is only possible in theexternal_apps
array of the config.json. That's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kulmann @pascalwengerter Following example of config.json with use case: extension A (not external app) opens file types.aaa
and .txt
. Type .txt
should have hasPriority
over internal text editor. Would it look something like that?
"external_apps": [
...,
{
"id": "A",
"path": "/aaa",
"config": {
"fileExtensions": [
{
"extension": "txt",
"hasPriority": true
}
]
}
}
],
Or should we call the option something like "priorityExtensions" and set priority to all file types that are in this list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So proposal 2 for config.json:
"external_apps": [
...,
{
"id": "A",
"path": "/aaa",
"config": {
"priorityExtensions": ["txt"]
]
}
}
],
42f1656
to
ca5a310
Compare
ca5a310
to
586dfe7
Compare
@elizavetaRa you will take care of this, right? |
@tbsbdr on it, yes |
2b7b602
to
bd3ddce
Compare
bd3ddce
to
06bead3
Compare
@elizavetaRa could you add a changelog item? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tiny nitpick (see comment), otherwise works like a charm 👍
let primaryExtensions = (window as any).__$store.getters.extensionConfigByAppId(appId) | ||
.primaryExtensions || ['txt', 'md'] | ||
|
||
let extraExtensions = config.extraExtensions || [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the extraExtensions
are never re-used after they got pushed into the extensions
array. So I'd be in favour of the following one liner to keep it shorter / without the extraExtensions
variable assignment:
extensions.push(...(config.extraExtensions || []).map((ext) => ({ extension: ext })))
Also, please move that line directly below const config = ...
and above let primaryExtensions = ...
for following logical grouping:
- assign all possible extensions into the
extensions
array. - define primaryExtensions
- return the extensions in the correct format
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thank you for taking care! 💪
relates to 323030a |
Sets
canBeDefault: true
to ensure that files are not downloaded first.Adds a new configuration parameter that allows us to open a configurable number of other extensions.