WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#31263 closed defect (bug) (wontfix)

Enter in wp-view forces paragraph tag.

Reported by: programmin Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: TinyMCE Keywords:
Focuses: ui, javascript Cc:

Description (last modified by SergeyBiryukov)

When pressing enter while cursor is in wp-view's before/after position (the tall cursor from ticket #28595), it always inserts a new paragraph tag - no matter what the tinymce forced_root_block setting is.

If you have forced_root_block set to div tag (as most web email clients and other editors do), it is inconsistent whenever this happens, as it is the only paragraph in the editor.

Change History (9)

#1 @SergeyBiryukov
7 years ago

  • Description modified (diff)

#2 @iseulde
7 years ago

  • Keywords close added
  • Version changed from 4.1 to 3.9

One of the reasons we don't support it is this: http://www.tinymce.com/wiki.php/Configuration:forced_root_block
I bet this is not the only problem with wpviews if you set forced_root_block to something else, and not the only problem with the editor, or WordPress as a whole. If we really want to support this, everything should be looked at. TinyMCE itself, any plugins, auto-p... That would be a separate enhancement ticket.

#3 @programmin
7 years ago

I believe the documentation is incorrect and outdated on this point - "not using P elements as root block can severly cripple the functionality of the editor." The main thing that needs workaround when div is set in wp is #31219, and forced_root_block seems to be used by many people with minimal (if any?) bugs. See for example:

http://stackoverflow.com/questions/11037537/forced-root-block-option-in-tinymce

http://stackoverflow.com/questions/13585178/tinymce-with-div-tag/13585261#13585261

http://www.laptoptips.ca/projects/advanced-tinymce-configuration/

http://stackoverflow.com/questions/26623933/what-exactly-is-crippled-about-tinymce4s-forced-root-block

#4 @programmin
7 years ago

Why don't you do what the TinyMCE-lists plugin itself does?

		function createNewTextBlock(contentNode, blockName) {
			var node, textBlock, fragment = dom.createFragment(), hasContentNode;
			var blockElements = editor.schema.getBlockElements();

			if (editor.settings.forced_root_block) {
				blockName = blockName || editor.settings.forced_root_block;
			}

			if (blockName) {
				textBlock = dom.create(blockName);
                          ...

instead of dom.create('p')?

#5 @iseulde
6 years ago

  • Keywords close removed

I believe the documentation is incorrect and outdated on this point

I asked about it.

#6 @iseulde
6 years ago

From TinyMCE:

Yes. Might even remove that option in the future.

I guess we can still support it if it's set...

This ticket was mentioned in Slack in #core by jorbin. View the logs.


6 years ago

#8 @iseulde
6 years ago

I'll add this once we have tests for the views. Expecting them this release.

#9 @iseulde
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Since this does not work with TinyMCE's views either (https://codepen.io/iseulde/pen/beNKLe), and they have a warning about this setting (https://www.tinymce.com/docs/configure/content-filtering/#forced_root_block), I will close this ticket. This must be fixed upstream as we are just using contenteditable now.

Note: See TracTickets for help on using tickets.