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

Work around OCA.Viewer.file not set when editing in richworkspace mode. #2163

Conversation

rotdrop
Copy link

@rotdrop rotdrop commented Feb 7, 2022

Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
@rotdrop rotdrop force-pushed the bugfix/work-around-richworkspace-viewer-file-not-set branch from e56cb15 to a1d6ed7 Compare February 7, 2022 09:06
Introduce a global property

OCA.Text.RichWorkspaceFilePath

which is used in helpers/links.js if the Viewer-property OCA.Viewer.file
is not available.

This fixes the problem that opening linked files from the enriched
workspace does not work, as OCA.Viewer.file is empty in this case. So
somehow the base MD-file has to be to communicated to domHref() in
links.js.

Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
@rotdrop
Copy link
Author

rotdrop commented Feb 7, 2022

The second commit removes the extra "context=BASEFILE.md" from the generated links which would modify the Readme.md markdown in an irritating manner.

@juliushaertl juliushaertl added 3. to review bug Something isn't working labels Feb 14, 2022
@juliushaertl juliushaertl added this to the Nextcloud 24 milestone Feb 14, 2022
@juliushaertl juliushaertl self-requested a review February 14, 2022 09:23
@max-nextcloud max-nextcloud self-requested a review March 2, 2022 07:26
@max-nextcloud
Copy link
Collaborator

Hey @rotdrop,
Thanks a lot for the analysis of the proplem and proposed fix. Your fix is perfectly in line with what we did there so far.
However I'd prefer to avoid introducing another global variable that magically switches behavior inside the helper. Using OCA.Viewer inside that helper was a mistake in the first place.

I think we could hand the currentDir to the domHref function in the helper. My understanding is that it's only called from the link mark which should have access to the editor state. We could inject currentDir the way we do it for the Image node.

@max-nextcloud
Copy link
Collaborator

Actually it would probably be better to get this fixed and backported first and clean it up after. Would be good to have a test for the broken behavior to make sure this fixes it and also to prevent it from braking during the refactor afterwards.

@mejo-
Copy link
Member

mejo- commented Nov 1, 2022

Thanks again for the PR @rotdrop. A similar fix got implemented in #3269

@mejo- mejo- closed this Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing bug Something isn't working
Projects
None yet
5 participants