Topic: Cannot get data from mdbWYSIWYG plugin or customize the functionality of the upload image button

Ruben Chevez pro asked 5 years ago


*Expected behavior*I expected to be able to edit the content from inside the which the mdbWYSIWYG plugin works using jquery $("#textarea-container").html(content) or $("#textarea-container").val(content) . Also, the image button only allows to include link to images, I expected to be able to upload images.

*Actual behavior*Cannot get/set data from/to mdbWYSIWYG plugin using jquery or customize the functionality of the upload image button. I need to upload data when clicking the image button.

Resources (screenshots, code snippets, etc.)$("#post_description").mdbWYSIWYG();

The following code snippets do not work.


$("#textarea-container").html(description);

let content = $("#container").html();


$("#textarea-container").val(description);

let content = $("#container").val();


Krzysztof Wilk staff answered 4 years ago


Hi!

You can set WYSIWYG content before initializing it using JS. Your code should look like this:

$('#demo').val('Example')

$("#demo").mdbWYSIWYG();

Of course, you can set it using HTML too, just put your HTML code between <textarea></textarea> tags.

You can check effects here: https://mdbootstrap.com/snippets/jquery/krzysztof-wilk/2362676#html-tab-view

But for now, I'm afraid you can't set content after initializing a WYSIWYG Editor, you have to do it before.

Best regards



Hi, @Ruben Chevez!

I've just initialized my WYSIWYG like this:

$("#demo").mdbWYSIWYG();

And then, I was able to get its content:

$('#demo').val();

Everything looks like it works fine. What's the issue you're facing?

About the image upload, currently, it's not possible. I hope this will be added soon


Otto free commented 4 years ago

Can you please show us how to set the content in both views visual and code.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.0
  • Device: Desktop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No