Skip to content

Inserting/Pasting image into markdown/WYSIWYG editor displays wrong URL #4486

@niklasmh

Description

@niklasmh

Describe the bug

I really, really like the insert/paste image function in the markdown/WYSIWYG editor, but as I am serving the website using your docker image strapi/strapi I get URLs like: http://localhost:1337/uploads/bca173c38e484f678322c0207aef56e0.png, even though it is hosted at https://wheremystrapiishosted.com.

Steps to reproduce the behavior

  1. Copy any image on you computer (ctrl + c).
  2. Go to a markdown editor.
  3. Paste the image (ctrl + v).

Expected behavior

I would like that the URL points to the current domain: https://wheremystrapiishosted.com/uploads/.... (aka not http://localhost:1337/uploads/...)

Screenshots

image

The image also jumps to the end of the file, but that is another issue: #978.

System

  • Docker image: strapi/strapi:44112fe (which basically sums up the versions below)
  • Node.js version: v11.1
  • NPM version: 6.4.1
  • Strapi version: 3.0.0-alpha.26.2
  • Database: mongo
  • Operating system: ubuntu / your docker image

Additional context

... and ideas that may solve the problem

I am guessing this url (localhost:1337 in the image above) is set using the host and port from ./config/environments/development/server.json. But changing this is not an option as this is the path through the docker container to the host machine.

  1. One idea is to somewhere be able to configure a "public url" and use this instead if set.
  2. A second idea is to just use the url you are currently on. There may be use cases I am not aware of, but in the front-end you know all about the location (window.location.origin) so this should be quite easy.

It may be that the first idea is already possible, thus if it is, I would like to know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions