Make WordPress Core

Opened 10 years ago

Closed 7 years ago

Last modified 6 years ago

#36890 closed enhancement (fixed)

TinyMCE: add settings for the wptextpatterns plugin to add or override the default text patterns

Reported by: azaozz Owned by:
Priority: normal Milestone: 4.7
Component: TinyMCE Version:
Severity: normal Keywords:
Cc: Focuses:

Description

Continues from #33300.

Currently a WordPress plugin has to replace the whole wptextpattern editor plugin to add or change the text patterns. It would be better to let the patterns be changed by setting an editor option in the init array.

Attachments (1)

36890.patch​ (5.5 KB ) - added by azaozz 10 years ago.

Download all attachments as: .zip

Change History (6)

@azaozz
10 years ago

#1 @azaozz
10 years ago

36890.patch is almost identical to https://core.trac.wordpress.org/attachment/ticket/33300/33300.6.patch. It adds editor settings to add or override the default text patterns.

Example:

add_filter( 'tiny_mce_before_init', 'textpatterns_test' );
function textpatterns_test( $init ) {
	$init['wptextpattern_inline_patterns'] = '{
		strong: { start: "*", end: "*", format: "bold" },
		strong2: { start: "**", end: "**", format: "bold" },
		em: { start: "_", end: "_", format: "italic" }
	}';

	return $init;
}

This ticket was mentioned in ​Slack in #core-editor by mrwweb. ​View the logs.


10 years ago

#3 @iseulde
10 years ago

We added this in [39075]. :) The question now is if we should add methods to add and remove patterns more easily and/or if we should add any PHP filters just for this. At the moment you can only replace the settings.

#4 @azaozz
7 years ago

  • Milestone Future Release
  • Resolution → fixed
  • Status new → closed

The code added in [39075] seems sufficient.

#5 @SergeyBiryukov
6 years ago

  • Milestone → 4.7
Note: See TracTickets for help on using tickets.