Coder Social home page Coder Social logo

Comments (8)

Slembit avatar Slembit commented on June 4, 2024

Hi!
Did you solve this? I need to fetch the image from another editorjs instance in another application with another domain and was wondering the same hehe

from directus-extension-editorjs-interface.

dimitrov-adrian avatar dimitrov-adrian commented on June 4, 2024

The reason I didn't set absolute URL to the output for the images is because the portability, and if you already access it through the API, then for sure you are aware with the domain, so you simply could put it.

Anyway, as this seems to be asked more often, I can think of adding a URI property (which will be quite ease) with absolute address, the only think I am not sure if it's good or not is to add field for a static token or not.

from directus-extension-editorjs-interface.

Slembit avatar Slembit commented on June 4, 2024

Wow fast response!
I think it could be interesting to add the ability to manually do it, but maybe not necessary if there is a way to handle it dynamically.

How is the url constructed today? I’m thinking, if it’s possible, to use the configuration invironment variable PUBLIC_URL (or maybe some other unknown to me better variable) and then append the path to assets and image.
In that way, it would be reachable from another application. But maybe that’s the way it’s constructed today?

from directus-extension-editorjs-interface.

dimitrov-adrian avatar dimitrov-adrian commented on June 4, 2024

Well, internally it uses the {baseUrl}/assets/{file.id} (according the docs), where the baseUrl is PUBLIC_URL env as you already mention.

And for token it uses the current user's token, which is not good idea to be added to the output because of possible leakage.

Anyway, it might be really good idea to add it to the final output as separate uri or guid property with an optional static token configuration field, I'll try to do it in next days.

from directus-extension-editorjs-interface.

Slembit avatar Slembit commented on June 4, 2024

Okey haha, lucky guess from my side.

just to be clear, when you say “add it to the final output as separate uri“ are you referring to adding the complete uri of the image, including the baseurl to a different key in the image meta-data structure? Because I’m thinking this: What if one of the editors is in a directus invironment, and the other editor is used in an angular project, wouldn’t it be better if the image url is always stored as the complete uri?
that way both editors would work without having to convert the image path.

but maybe I’m missing something here

from directus-extension-editorjs-interface.

dimitrov-adrian avatar dimitrov-adrian commented on June 4, 2024

Yes, there are couple of cases where this is not the most suitable, for example:

  • domain is transferred/changed, then the content will point to the old one, so the stored JSON need a migration as well
  • if the directus is used on dedicated domain (protected), but the assets are served through proxy, so the domains will mismatch

So in such cases, it might be more reliable to use fileId or url

from directus-extension-editorjs-interface.

Slembit avatar Slembit commented on June 4, 2024

Ah yes. that is correct... didnt think of that

from directus-extension-editorjs-interface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.