Topic: How to set Content default to wysiwyg plug in for editing existed content

Venky pro asked 5 years ago


How to set value/content to wysiwyg plug in on load while editing old content


Damian Gemza staff commented 5 years ago

Dear @Venky

I'm not sure if I understand you well. Could you please describe your question one more time?

What do you mean by setting value in on load while editing old content? This is not clear to me.

Best Regards,

Damian


Otto free commented 4 years ago

How can you load content from a file. Format "code" .


Arkadiusz Idzikowski staff commented 4 years ago

Please provide an example of such a feature.


jesselimatech pro commented 3 years ago

Well, I have the same question. I believe the scenario is this below:

You open a page with the WYSIWYG editor, then you create the content inside it. Let's suppose create a blog post. Then, after saving the post to the remote server, you come back to edit the same post. You need to put the previous HTML content inside the WYSIWYG to edit em update the post content.

The documentation shows how to get data from the WYSIWYG into the TS code. (There are two ways to get the latest WYSIWYG value. The docs say: "You can use (valueChange) event, or you can subscribe to the valueChange$ observable.)". [https://mdbootstrap.com/plugins/angular/wysiwyg/#docsTabsOverview]

It does not show to set HTML code from the TS into the WYSIWYG.

I the info above is not good, please let me know that I help to make it more clear :D.


jesselimatech pro commented 3 years ago

I just found out. That's easy.

Just set the value to the WYSIWYG instance with your remote raw Html payload In my case, it was like this: this.wysiwyg.value = post.bodyHtml;

This WYSIWYG instance is the one you need to declare after the constructor like this: @ViewChild(MdbWysiwygComponent, { static: true }) WYSIWYG: MdbWysiwygComponent;



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Opened

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.5.1
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: No