We have a couple of forms that have boxes for notes I changed them to tinyMCE. The problem is that it wraps them with a p tag causing:
tested forced_root_block = '' in nuwysiwyg.js tinyMCE init fixes the problem
Thank You
Is there a way we could get the tinyMCE option in the nuconfig file to either disable (forced_root_block = '' in the init will do it) or change it to a div at least so it won't affect the browse form.Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
tinyMCE p tag wrappers Topic is solved
-
- Posts: 72
- Joined: Mon Jun 10, 2019 5:00 pm
- Has thanked: 6 times
- Been thanked: 4 times
tinyMCE p tag wrappers
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: tinyMCE p tag wrappers
Hi,
I found this in the docs
There is going to be a new option newline_behavior (dev channel) according to this discussion.
I found this in the docs
That means as soon as TinyMCE is bumped to v6, forced_root_block will no longer work.Setting forced_root_block to false or an empty string has been deprecated in TinyMCE 5.10. For TinyMCE 6.0, this option will only accept valid block elements.
There is going to be a new option newline_behavior (dev channel) according to this discussion.
-
- Posts: 72
- Joined: Mon Jun 10, 2019 5:00 pm
- Has thanked: 6 times
- Been thanked: 4 times
Re: tinyMCE p tag wrappers
If i'm reading that correctly they are not getting rid of forced_root_block it can just no longer be set to false and must have a block element. So there could just be an option to change it to a div which should fix my particular problem. However I will go ahead and add a patch file in my updater to make the change on my local nuwysiwyg.js file for the time being.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: tinyMCE p tag wrappers
I'm not quite sure what the behaviour will be like then. If you have the chance, please try it out.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: tinyMCE p tag wrappers
I updated nuwysiwyg.js so you can use custom options. Could you try it?
[Attachment removed, incorporated update]
JS in the form's Custom Code:
[Attachment removed, incorporated update]
JS in the form's Custom Code:
Code: Select all
function nuOnEditorLoad() {
$('.nuEditor').each((index, element) => {
let options = {
forced_root_block = ''
};
nuInitTinyMCE(element.id, options);
});
}
-
- Posts: 72
- Joined: Mon Jun 10, 2019 5:00 pm
- Has thanked: 6 times
- Been thanked: 4 times
Re: tinyMCE p tag wrappers
With either your code or mine if it is set to an empty string you get an error in the console about V6. when set to div with my patch:
I get both old and new lines in the editor with yours it changes it on the browse form when I make an edit but is not loading existing content into the editor. I did try changing
to
as well. the ACE editor was complaining about the =.
I do know that yours is at least loading it into the options because of the warning about V6.
Code: Select all
--- nuwysiwyg.js.master 2022-06-13 11:10:05.098250842 -0400
+++ nuwysiwyg.js 2022-06-13 09:22:20.776065213 -0400
@@ -71,6 +71,7 @@
tinymce.init({
selector: "#" + idContainer,
+ forced_root_block : 'div',
plugins: _plugins,
mobile: _mobile,
menu: {
Code: Select all
let options = {
forced_root_block = ''
};
Code: Select all
let options = {
forced_root_block : '',
};
I do know that yours is at least loading it into the options because of the warning about V6.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: tinyMCE p tag wrappers
Please try again with this patched file:
[Attachment removed, patch incorporated]
[Attachment removed, patch incorporated]
-
- Posts: 72
- Joined: Mon Jun 10, 2019 5:00 pm
- Has thanked: 6 times
- Been thanked: 4 times