-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Option to insert an image from a URL #893
Comments
Any progress on this? |
Also interested in this :) |
[edit]Best Approach is something like the adding a matcher to the clipboard module, watching for copypasted urls and converting them to images (new Delta().insert({image: url}); works) like the code found here: #109 by @schneidmaster [edit 2] this custom matcher converts urls to links and in case they link to image, converts the urls to inline images (put it in
|
Would love to see this as well. As a side note, this was how images were handled in the early stages of QuillJS. Any reason why this was removed? |
I don't understand why there is base64 upload images and no support for third-party image upload. This is VERY important! |
Still no update :( |
I got it working like this: |
I think here #863 (comment) it is written pretty well. All you need to do is to create custom handler |
+6666 |
+1 |
I too would like to make public my desire for such a feature. |
+1 |
+1 how is this not a feature yet? |
Could someone from the team maybe shed some light on this please? This feature is really, REALLY needed. |
+1 my team would love this feature. |
For what it's worth... would be really really nice to have... |
Keeping the fire alive for this request 🔥 |
I toss some bricks into that fire so it keeps burning longer |
We got it working by extracting the base64 encoded image, storing it on the hard drive and replacing the +1 would also like to see this feature built-in |
|
啥 |
Hey there! Any progress? |
@siberiadev in case you're working with laravel, for extracting the image you can use Or just have a look at the function here and extract what you need. In terms of displaying I haven't seen any progress. |
@repat, thank you. I use Node.js for backend. |
PHP and Laravel (MVC, similar to express I think) is fairly eary to read so you could:
=> Translate it into a js function |
I posted a solution above |
This works like a charm
|
For anyone coming here using ngx-quill:
|
@chrisbmoore this works great for ngx-quill! However, it clobbers the tooltip saves for links and videos. Need to set the original save back when done. Instead of this:
do something like this:
|
@pburrows You're right, the original save function should be reset. Thanks! |
@pburrows @chrisbmoore If the tooltip is closed without clicking "Save" the original save function is not restored, as the save method is not called. Do you have any idea how to solve this? I did not find some callback that is called in that case. Update: I found a solution myself by overriding tooltip.hide() with the restore code: tooltip.hide = function(this: any) {
tooltip.save = originalSave;
tooltip.hide = originalHide;
tooltip.hide();
}; |
@digilist Thanks for the correction! Yep your solution makes sense and I'll add it to my code. |
Any Update on this ? |
I tried to find a better way to do this... the tooltips in Quill are hidden quite effectively so that consumers can't extend on them cleanly. Anyway, one more bit that you'll need to customize the label is this CSS snippet: .ql-tooltip[data-mode=image]::before {
content: "Enter image URL:";
} |
It doesn't work |
Other solutions did not work for me :( function imageHandler() {
const { tooltip } = this.quill.theme;
const originalSave = tooltip.save;
const originalHide = tooltip.hide;
tooltip.save = () => {
const range = this.quill.getSelection(true);
const { value } = tooltip.textbox;
if (isValidURL(value)) { //isValidURL is a validator
this.quill.insertEmbed(range.index, 'image', value, Quill.sources.USER);
} else {
// error message handler
}
};
// Called on hide and save.
tooltip.hide = () => {
tooltip.save = originalSave;
tooltip.hide = originalHide;
tooltip.hide();
};
tooltip.edit('image');
tooltip.textbox.placeholder = 'Embed URL';
} const modules = {
toolbar: {
container: [
[{ header: '1' }, { header: '2' }, { font: [] }],
[{ size: [] }],
['bold', 'italic', 'underline', 'strike', 'blockquote'],
[{ list: 'ordered' }, { list: 'bullet' }],
['link', 'image', 'video'],
],
handlers: {
image: imageHandler,
},
},
}; |
Inserting images with |
Thanks @Milutin-P, your code helped in 1.3.5, unfortunately something changed on 1.3.7 and now your code snippet doesn't work. I think the issue lies with trying to get the tooltip. thanks, |
The Image button on the toolbar allows you to insert an image from your local machine.
It would be brilliant if this could be extended to also allow an image URL to be provided.
It is possible to drag & drop an image from the web, but this may not be obvious to all users. Also, in our particular case, we have custom drag & drop handling which prevents this from working in our applications.
Version: 1.0.0-rc2
P.S. Thank you for all your hard work on 1.0 - it really is fantastic.
The text was updated successfully, but these errors were encountered: