Comments (10)
Here is an example code :
<script type="text/javascript">
editor = new Dante.Editor(
{
el: "#editor",
upload_url: "/images.json", //it expect an url string in response like /your/server/image.jpg or http://app.com/images/image.jpg
}
);
editor.start()
</script>
Dante will send a post request to /images.json , your server receive it and return a image link (like /your/server/image.jpg ).
from dante.
Wow! sir that was so fast, and I am eagerly waiting for an image actions
from dante.
Hi @akkias , thanks for your kind comment.
As @thangngoc89 said the upload_url attribute will set the path where you have your image uploader which will return the upload image path in response.
If you need more help on this just reopen this ticket.
best!
from dante.
@michelson is there any plan on the response mapping? Currently, our api send back a json data and we don't want to edit the api.
from dante.
@thangngoc89 currently there are no plans to change that behavior.
do you have some ideas of how the response mapping would be ? patches welcome!
from dante.
@michelson here is my example :
I assume my api return this data :
{
'link' : 'http://your.server/image.jpg'
}
There will be a callback function like :
<script type="text/javascript">
editor = new Dante.Editor(
{
el: "#editor",
upload_url: "/images.json", //it expect an url string in response like /your/server/image.jpg or http://app.com/images/image.jpg
upload_callback: function(data)
{
return data.link;
}
}
);
editor.start()
</script>
If there is no upload_callback, default behaviour will be triggered
from dante.
looks good, maybe we could use the same upload_url to accepts a string or function
from dante.
yes, a lot of js package do it this way. Just pass the result into a closure (if there is any) and do the same job.
from dante.
@thangngoc89 please check the branch upload_url_mapping
and test it using bundle exec rackup config.ru
I think this is what you are looking, I'll merge this later.
from dante.
@thangngoc89 the upload_callback option was released as 0.0.10 , thanks !
from dante.
Related Issues (20)
- How to multi-column? HOT 4
- how can i compile it to plain vanillaJS? HOT 1
- prosemirror-state package constructor issue HOT 2
- "Cannot load such file -- coffee_script" for Rails 7 HOT 1
- Cannot Start a New Line When Uploading Images & Image Gets Deleted When Pressed Enter [Video Included] HOT 2
- prosemirrorState Error HOT 37
- cannot build dante3 HOT 2
- running Dante locally with errors... HOT 1
- where can I find "Clear Format" ? HOT 3
- prosemirrorState.PluginKey is not a constructor HOT 7
- Dante3 not working with vite HOT 7
- RangeError: Adding different instances of a keyed plugin (plugin$) HOT 4
- Is that possible? Add JS dynamic charts. HOT 13
- How would I get the "raw" html for image block?
- TypeError: Cannot read properties of undefined (reading 'Extension') HOT 3
- How can I use Dante with JQuery?
- Dante 3 Nextjs page to Nextjs app HOT 9
- Dante3 doesn't work with Vite HOT 1
- Need help in fixing Dante-3 issues HOT 1
- Uncaught TypeError: styled.div is not a function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dante.