I am new to StackOverflow, please excuse me for any typos.
Well, I am developing angular 6 application therein I am having tinyMCE version 5 editor confgured as below:
tinymce.init({
selector: '.TinyMCE',
mode: 'exact',
height: 150,
menubar: false,
theme: 'silver',
statusbar: false,
plugins: 'placeholder',
content_style:
'#tinymce-body { min-height: 0px; } .mce-content-body { color: rgba(101, 99, 93, 1); overflow-x: hidden !important; }',
body_id: 'tinymce-body',
toolbar: 'bold underline italic addAttachment',
valid_elements: 'strong/b,i/italic,p,br',
inline_styles: false,
formats: {
underline: { inline: 'u', exact: true },
italic: { inline: 'i', exact: true },
bold: { inline: 'b', exact: true }
},
elements: this.elementID,
setup: this.tinyMCESetup.bind(this),
// setup: this.getSetup,
});
On setup function...
tinyMCESetup(ed) {
ed.on('keyup', this.tinyMCEOnKeyup.bind(this));
this.editor = ed;
//starts here
ed.ui.registry.addButton('Bold', {
text: '',
onAction: () => {
ed.execCommand('Bold');
return false;
}
});
}
However, when I send content to the after selecting text inside editor and making them bold does not work, I mean when I debug my application it simply sends the text as.
<p>Hello</p>
However I am expecting it to have
<p><strong>Hello</strong></p>
Attachced is the screenshot of my tinyMCE editor embedded in angular 6 chat application.
I solved it by changing below init property of tinymce.
schema:'html5',
formats: {
underline: { inline: 'u', exact: true },
italic: { inline: 'em', exact: true },
bold: { inline: 'b', exact: true }
}
this helped me to create bold , italic and underline.
Hope this helps to someone who needs it.
Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.