-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
TinyMCE tries to be too smart with external links #1116
Comments
We are handling this overriding Plone's |
I think the right solution would be to simply not convert the link if it cannot be resolved to an UID. You are right that the assumption that the whole domain is handled by Plone is not a correct assumption (inside out hosting and all that stuff). |
I've just set |
I would say, quoting the Zen of Python "explicit is better than implicit": if I want to add an "external" link, leave it as it is please. |
OK, the url handling settings of TinyMCE only has these options: https://www.tiny.cloud/docs/configure/url-handling/ |
I came accross this one https://www.tiny.cloud/docs/configure/url-handling/#exampleusingurlconverter_callback ... we can use this to determine, whether we place an external or interal link and skip Tiny's url handling completely for external urls... since |
I think that the internal link thing works pretty OK with Tiny and later UID based transformations. Can't we just disable the external link handling, which I think is in a JS file of our own, and let plone.outputfilters handle it without transforming it at all? |
Unfortunately this is a Tiny thing ... our plonelink/ploneimage plugins always generates absolute paths like We now can hook into this behavior with the The transform itself has an early exit if he finds absolute url schemas and doesn't need to be changed. As I'm in need for this too in a project, I'm about to prepare a PR now to outline my idea ... I'd be happy if you can review it then. |
OK, if it's tiny's call... I will be happy to review it of course. |
The PR #1320 in it's current state would break a scenario where different domains are used for the same site and people add links with absolute URLs pointing to the same site. For example:
That scenario would have been supported until now. I see these options:
For reference, this is the Link widget from the Plone Classic UI demo: |
I would say, TinyMCE should keep its fingers off from URL transforming completely. Maybe we should always return the original url in the |
Actually, I also favor bypassing the If we agree that the scenario outlined above is not an issue, let's go forward with #1320 and let's even bypass the urlconverter at all. It seems more natural to not do any url transformation when using the "External" link feature. |
The mentioned PR is merged and released in |
Thanks! |
When we enter an external link pointing to the current portal TinyMCE tries to be too smart and tries to build an internal link from it
Our use-case is the following:
In our portal we have many URLs coming from an external database and their urls are traversal based URLs, for instance:
http://portal.com/en/course/slug
wherecourse
is the view that handles the traversal andslug
the identifier we use to query the database.If we want to link that URL from some other content in Plone, we need to add the link as an external link, but then TinyMCE starts doing a lot of fancy stuff with those external links and converts them to
../../../en/course/slug
which in the end renders invalid links.I think that when entering external links TinyMCE should just accept anything incoming and let it as is and not try to be too smart.
The text was updated successfully, but these errors were encountered: