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
image URL address #380
Comments
Hi, @daybat |
no. I don't want the website hostname to be added to ImageURL. |
yes. right. I'm sorry. I mean relative path. I don't want my images to be connected with my development host address. So I don't want the website name be in the path to the image. Only /upload/img1.jpg but not http://website.com/upload/img1.jpg Is it possible to remove the hostname from the image path ? |
"/upload/img1.jpg" is mean "http://website.com/upload/img1.jpg" in the web browser. |
for example there are2 websites: one is for editing the texts and the other is working web site. They both have common folder /upload After editing the text with images the path of images contains the hostname of the editing site. And on the working web site the images can not be shown because the access to editing site is restricted. Hope I could clear describe my problem |
Hmm.. |
server1: upload image to server1/upload/ Apache server config server1: Apache server config website1: Just add please in the Suneditor configuration a key to remove the hostname from the image URL or not |
There is no relative path on the web browser. The Apache server configuration is independent of the web browser. |
I open the SunEditor to edit the text on the website1 through server1 (server1 is for editing information on website1(2,3,4...). I need to attach some images I have in the folder /upload/ on my server1 (folder /upload/ is shared both among server1 & website1). I know the path to image1.jpg: /upload/1/image1.jpg. I don't need to upload image to server because the image is already in the folder on the server. So I click on 'image' button on the SunEditor menu to open the modal window to attach the image. In the "Image URL" input field I type "/upload/1/image1.jpg", then "Submit" and I have the image in text editor. Everything is OK. I open the "Code View" mode and see |
If you don't have access, then can't you give the "access-control-allow-origin" header? |
now I solve the image path problem with the help of the following code: |
If you don't have access, then can't you give the "access-control-allow-origin" header? Don't like this due to security reason |
This issue cannot be reflected in common options. This code sets the src of the image in the url input tag. image.js#L745 import plugins from 'suneditor/src/plugins'
plugins.image.openModify = function (notOpen) {
const contextImage = this.context.image;
/*** Set the image(contextImage._element) src ***/
if (contextImage.imgUrlFile) contextImage.imgUrlFile.value = contextImage._element.src;
/*** ↑↑↑↑↑↑ Change this code. ↑↑↑↑↑↑ ***/
contextImage._altText = contextImage.altText.value = contextImage._element.alt;
contextImage._linkValue = contextImage.imgLink.value = contextImage._linkElement === null ? '' : contextImage._linkElement.href;
contextImage.imgLinkNewWindowCheck.checked = contextImage._linkElement && contextImage._linkElement.target === '_blank';
contextImage.modal.querySelector('input[name="suneditor_image_radio"][value="' + contextImage._align + '"]').checked = true;
contextImage._align = contextImage.modal.querySelector('input[name="suneditor_image_radio"]:checked').value;
contextImage._captionChecked = contextImage.captionCheckEl.checked = !!contextImage._caption;
if (contextImage._resizing) {
this.plugins.resizing._module_setModifyInputSize.call(this, contextImage, this.plugins.image);
}
if (!notOpen) this.plugins.dialog.open.call(this, 'image', true);
} Can your problem be solved? |
thank you for help. I have redefined the openModify function of the image plugin and now it works as I need. |
hello.
The image URL adds the website address.
for example, I add only the absolute path like this: /upload/img1.jpg
But the editor adds the website address and now the path is like this: http://website.com/upload/img1.jpg
How to avid adding the website address?
The text was updated successfully, but these errors were encountered: