text icon indicating copy to clipboard operation
text copied to clipboard

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

Open rotdrop opened this issue 3 years ago • 3 comments

  • Resolves: #2164
  • Target version: master

Summary

See linked issue.

rotdrop avatar Feb 07 '22 09:02 rotdrop

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

rotdrop avatar Feb 07 '22 10:02 rotdrop

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 avatar Mar 02 '22 10:03 max-nextcloud

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.

max-nextcloud avatar Mar 02 '22 10:03 max-nextcloud

Thanks again for the PR @rotdrop. A similar fix got implemented in https://github.com/nextcloud/text/pull/3269

mejo- avatar Nov 01 '22 09:11 mejo-