Swapnil Mali
Swapnil Mali

Reputation: 11

add custom html source code button in p-editor of primeng

please give a brief idea with example of how to add a custom html source code edit button in p-editor of primeng! As, it is not provided in default p-editor format. Please help me in this context.

Thanks in advance :)

Upvotes: 1

Views: 1695

Answers (1)

nestor moya
nestor moya

Reputation: 41

If you load the content in "ngOnInit" or in the constructor, the editor won't fail. However if you want to load dynamically, I think that you must use a different var and then replace it

OR

Use this function before assign that var

escapeHtml(text) {
    if (!text) {
      text = '';
    }
    text += '';
    text = text
      .replace(/&/g, '&')
      .replace(/&lt;/g, '<')
      .replace(/&gt;/g, '>')
      .replace(/&quot;/g, '"')
      .replace(/&#039;/g, '\'');
    return text;
  }

Upvotes: 1

Related Questions