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

baseHref ignored in inline editor #5402

Open
lnewmanheggie opened this issue Jan 11, 2023 · 2 comments
Open

baseHref ignored in inline editor #5402

lnewmanheggie opened this issue Jan 11, 2023 · 2 comments
Labels
core The issue is caused by the editor core code. plugin:wysiwygarea The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:feature A feature request.

Comments

@lnewmanheggie
Copy link

lnewmanheggie commented Jan 11, 2023

Type of report

Bug

Provide detailed reproduction steps (if any)

I have been attempting to integrate the inline ckeditor into grapes.js

I have been using the inline ckeditor with a third party image manager. The issue I am running into is that after choosing an image from this manager, ckeditor sets the baseHref for the image using the baseHref for the page, which is not correct. This results in a 404 image not found error. I have tried to set the baseHref in the ckeditor configuration, but it is ignored.

I found a similar issue from 2017 that got closed without any resolution. Hopefully I can work with you guys to provide enough of an example to get this fixed.
#896

Including a simple sample reproducing the issue is also a good idea. It can drastically
decrease the time needed to reproduce the issue by our team, which means it can speed up helping you!

I've created a codepen to help me better explain this:

https://codepen.io/lnewmanheggie/pen/dyjWRpw

Step 1: Open the image upload window and paste 1600x900/p07ryyyj.webp into the url input. Notice that it does not find the image.
Step 2: Open the inspector js console. It logs a 404 of the image it is trying to find, https://cdpn.io/cpe/boomboom/1600x900/p07ryyyj.webp. In this case, I think the baseHref is the codepen url.

Expected result

What is the expected result of the above steps?

Since I set the baseHref in the ckeditor config to be https://ychef.files.bbci.co.uk/, I would expect the full url to be https://ychef.files.bbci.co.uk/1600x900/p07ryyyj.webp instead of the codepen url before it.

Actual result

What is the actual result of the above steps?

Codepen url is prepended to the image instead of the baseHref that was set in the config.

Other details

This is just an example, but what is happening in my application is that the baseHref of the page is https://base-mongoose-10/admin/, but my images come from https://base-mongoose-10/. However, when I choose an image from my image manager, it appears in ckeditor as https://base-mongoose-10/admin/[imageName] instead of https://base-mongoose-10/[imageName], even though I configured my baseHref as https://base-mongoose-10/ in the ckeditor config.

  • Browser: chrome
  • OS: windows
  • CKEditor version: 4.9.2
  • Installed CKEditor plugins: …
@lnewmanheggie lnewmanheggie added the type:bug A bug. label Jan 11, 2023
@Comandeer Comandeer added type:feature A feature request. status:confirmed An issue confirmed by the development team. plugin:wysiwygarea The plugin which probably causes the issue. core The issue is caused by the editor core code. and removed type:bug A bug. labels Jan 12, 2023
@Comandeer
Copy link
Member

I can confirm the issue.

However, I've changed the type of the report to the "feature request" as the config.baseHref config variable is implemented only for iframe-based editor and it was intended to work only there. Currently, CKEditor 4 does not support this config variable in inline editors as there is no straightforward way of doing so.

In the case of the iframe-based editor, the feature is simply implemented by adding the base element to the frame with the editor's content. However, as the content in an inline editor is not isolated from the surrounding page, adding the base element would result in changing the base of all links on a page with the editor. Therefore, supporting the config.baseHref option in inline editors requires a completely different approach which needs to be further researched.

@lnewmanheggie
Copy link
Author

Thanks. I appreciate the response. I will be on the lookout for this feature in future updates.

@ckeditor ckeditor deleted a comment Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core The issue is caused by the editor core code. plugin:wysiwygarea The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:feature A feature request.
Projects
None yet
Development

No branches or pull requests

4 participants
@Comandeer @lnewmanheggie and others