Why tinymce buttons disappear when the user introduce content with multiple paragraphs?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Why tinymce buttons disappear when the user introduce content with multiple paragraphs?



Im using tinymce with image upload using the package "laravel-tinymce-simple-imageupload". So I have a page where the user can select a registration type and enter some content in the tinymce textarea to associated that content to the selected registration type.



But there is an issue. For example the user can select a registration type and then in the text area write for example "certificate 1" and click in the form "Store" button. In the database the content introduced in the tinymce is stored like:


<p>certificate 1</p>



So this is correct.



But the issue is for example if the user in the text area instead of write just "certificate 1" writes "certificate 1" and then give a enter and in the next line write also for example "test" and click in the form "Store" button the page is refreshed and the tinymce buttons disappear from the textarea and the content introduced in the textarea is inserted in db like:


<p>certificate 1</p>
<p>test</p>



But if i change in the db to "<p>certificate 1</p><p>test</p>", that is have the content in the same line, the button appear again when the page is refreshed.


<p>certificate 1</p><p>test</p>



Do you know what can be the issue?



Code in certificateController that inserts the certificate content (the content introduced in the tinymce textarea) in the DB:


public function update(Request $request){

$registrationType = RegistrationType::where('id', $request->registrationType)->first();

$certificate = $registrationType->certificate;

// if no certificate exists for this type, create it
if(!$certificate ) {
$certificate = new Certificate();
}

// the certificate_content is the textarea with the tinymce plugin
$certificate->content = $request->certificate_content;
$certificate->save();

$registrationType->certificate_id = $certificate->id;
$registrationType->save();

$certificateContent = RegistrationType::with('certificate')->where('id', $request->registrationType)->first();

Session::flash('success','Certificate configured with success for the selected registration type.');

return redirect()->back();

}



tinymce code:


tinymce.init({
selector:'textarea',
plugins: 'image code link',
relative_urls: true,

file_browser_callback: function(field_name, url, type, win) {
// trigger file upload form
if (type == 'image') $('#formUpload input').click();
}
});




1 Answer
1



Since last year I had used tinymce plugin for generation word doc for one of my project. That time also I faced same issue. Actually in tinymce having some bugs means you have to select image twice to update and upload in system. Then it appears on webpage. In the first attempt it does not accepted.
You should do one thing first you upload the image then once it accepted to system then write content.





Thanks, but the issue is also without inserting any image, the issue seems that is when there are paragraphs.
– John
2 mins ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

CRM reporting Extension - SSRS instance is blank

Keycloak server returning user_not_found error when user is already imported with LDAP