-
-
Notifications
You must be signed in to change notification settings - Fork 96
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 TinyMCE external url handling #1320
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
According to the discussion on #1116 (comment) ff, this can be simplified to:
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.
I've just tried that locally and this breaks
plone.outputfilters
regex matchingresolveuid
in an url. So no transformation is done for/Plone/resolveuid/<uid>
which is returned by the plonelink/ploneimage plugin for internal links/images.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.
Ah, that's interesting. Then just ignore my suggestion.
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.
yap ... unfortunately this cannot work without further changes to
plone.outputfilters
though it's a simple non-breaking change to theresolveuid_re
fromto
otherwise url patterns like
/<plonesiteid>/resolveuid/<uid>
will not get resolved.Note that this is what you get if you edit your Plone site without virtual hosting. My local virtualhosting test resolves to
/resolveuid/<uid>
which the outputfilter would match though ...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.
Let's be not too intrusive for now and keep this as a fix for the external urls. We can fix/generalize internal url transformation later...
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.
Actually, that kind of url converting is probably really needed. Otherwise the portal path could end up being added to the text, which is not what we want.
<thinking/>
I was wondering why this resolveuid is inserted - with the - full path, where in this case a relative-to-the-context URL could be inserted in the first place and thus not needing to rely on the TinyMCE
urlconverter_callback
.I did some software archeology. The
appendToUrl
setting was initially relative-to-the-context. It become an relative URL with the full path due to the wrong assumptions in this commit: plone/Products.CMFPlone@243773d - also see the comments there.So, there would be another angle to fix the issue: Reverting the change where the full path was inserted in CMFPlone, adding
@@resolveuid
instead onlyresuloveuid
as mentioned in the comment of the commit referenced above and allowing an@@
in the resoloveuid_and_caption filter in plone.outputfilters. 🤯Since that's getting absurdly complex, let's stick with your PR as-is!
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.
Created an issue out of this possible enhancement: #1321
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.
As in plone/plone.app.contenttypes#675 the problem is that
plone.outputfilters
and the WYSIWYG editor (TinyMCE) does not share the same code for UID resolving. Theplone.outputfilters
uid resolver should be an util imported and exposed by aplone.api
call which than TinyMCE can call via a browser view. The same code should be imported inplone.restapi
. So one place, one policy, one service and everybody is happy.