froala / wysiwyg-editor

The next generation Javascript WYSIWYG HTML Editor.
https://www.froala.com/wysiwyg-editor
Other
5.3k stars 675 forks source link

Disable Image/File drag-drop and upload feature #561

Closed ishaaggarwal closed 9 years ago

ishaaggarwal commented 9 years ago

I am using froala 1.2.7 and want to disable the image/file drag and drop and upload functionality for my app. I tried setting options 'imageUpload' and 'pasteImage' to false, but the features were not disabled. Anything I am missing here?

stefanneculai commented 9 years ago

If you don't want to upload files, you should simply not include the File Upload plugin. There was a problem and setting pasteImage to false together with imageUpload was not working. Last commit fixes that.

nicolasbocquet commented 8 years ago

I'm facing the same difficulty than ishaaggarwal with Froala v2.0.5, the File Upload plugin is not included, 'pasteImage' & 'imageUpload' are set to 'false'. But the features are not disabled...

Here my settings :

$('[data-editable-type="full"]').froalaEditor({ toolbarInline: true, placeholderText: null, imageUpload: false, pasteImage: false, toolbarButtons: ['bold','italic','formatUL','formatOL','|','insertLink','|','insertImage','insertVideo','emoticons'] })

Maybe I do something wrong ?

stefanneculai commented 8 years ago

In V2, the option names are different:

nicolasbocquet commented 8 years ago

Yes it works ! Thank you stefanneculai

lebart commented 8 years ago

Hi, I face the same question. I just want to let the url to allow inserting an image. I'm using V2. I set the imagePaste to false. I set the buttons correctly.

But if I drag and drop an image in the editor an image still got uploaded (to froala.com since I've not set the upload url). I drop an image directly on the froala form not in the section for image.

@nicolasbocquet can you confirm what you've done? @stefanneculai can you be explain what you mean by $.FroalaEditor.POPUP_TEMPLATES.imageInsert should be changed instead

Thanks!

stefanneculai commented 8 years ago

@lebart using image.beforeUpload event should help.

lebart commented 8 years ago

@stefanneculai Thanks for your answer. If I set something like .on('froalaEditor.image.beforeUpload', function (e, editor, images) { return false })

The editor shows the uploading progression bar and never stops. Can I do something better?

I think a good enhancement would be an option to select easily the way we allow images to be added. imageInsertingStrategy: "url | upload | both" imageAllowDragAndDrop: "false | true" Should I add an Issue to tag this as enhancement?

rejwood commented 8 years ago

@stefanneculai returning 'false' in the image.beforeUpload event will also disable the image being added to the editor.

Is there a way to prevent the upload but still keep the functionality of adding to the editor?

fmooreNS commented 8 years ago

I came across this page when searching for a way to disable image uploads in the froala editor. I was able to disable the feature by setting "allowedImageTypes" to an empty array. As far as I can tell, there are no other adverse effects from this change.

alpha1988 commented 8 years ago

I apologize in advance but I have some the uncomfortable bug. I put my redactor into the popup , and make next actions: 1) I open popup 2) open dialog for adding files 3) click cancel 4) close popup 5) open popup again 6) click ''Upload files btn" 7) and then trying to click on the popup that was showing, but it is closing and nothing is happens Also, I see that at first opening the popup , it adds tasks for click event into a listener, But at second opening it's not happening. Can somebody tell me , what it can be?

anasnakawa commented 8 years ago

If that will help anyone, looking at the source of image plugin, we find the following default setting

$.FE.DEFAULTS.imageInsertButtons = ['imageBack', '|', 'imageUpload', 'imageByURL'];

so to disable imageUpload, you can simply override the previous object to

$.FE.DEFAULTS.imageInsertButtons = ['imageBack', '|', 'imageByURL'];

and of course to enable imageByURL

$.FE.DEFAULTS.imageInsertButtons = ['imageBack', '|', 'imageUpload'];
passledevelopers commented 7 years ago

Contrary to the comment made up above, not including the plugin (image.min.js) worked for me in disabling image upload

nicolasconnault commented 7 years ago

@anasnakawa thanks, I applied your solution to disabling the video upload tab, and it worked perfectly!

angusgrant commented 7 years ago

Can someone please provide a codepen example of this. I wish to remove the upload image functionality but am unclear how this is done...

stefanneculai commented 7 years ago

@angusgrant you can easily do that by changing the imageInsertButton option and remove imageUpload from it.

aquibzahidi commented 2 years ago
imagePaste: false,
imageUpload: false,

with image plugins

version - 4.0.8

biswajitatgithub commented 2 years ago

Hi guys can you provide the code reference. I have the below code in the client side(still not working). I want to restict any type of file upload. <script> new FroalaEditor('textarea', { fileUpload: false, imagePaste: false, imageUpload: false, }); </script>

Lateworm commented 2 years ago

I think I've got this working. I've tested on OSX desktop Chrome, Safari, and Firefox.

Froala is configured as a few users have mentioned above:

imagePaste: false,
imageUpload: false,

But it looks like this config doesn't work as expected unless the image plugin is enabled:

pluginsEnabled: [ 'image' ]

One of the solutions presented above was to disable the image plugin. In my case, I had to do the opposite.

itorz7 commented 2 years ago

why, fileUpload didn't work for me ?? image image