Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 3 years ago

#41590 closed enhancement (fixed)

Original TinyMCE "link" plugin should be added in Core

Reported by: turtlepod's profile turtlepod Owned by: azaozz's profile azaozz
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords:
Focuses: Cc:

Description

WordPress uses custom "wplink" plugin, and it's great as content editor, because we can easily search for our content.

But a lot of plugin uses wp_editor() as front end form, and link is crucial feature, but there's no easy way to remove this search ability in wplink.

why remove the original tinymce "link" plugin?
I think it's best to just leave it there, and plugin can use this plugin instead of using wplink (better for general use editor, and not content editor)

Attachments (2)

link.zip (11.0 KB) - added by turtlepod 7 years ago.
TinyMCE Link Plugin
41590.patch (88.2 KB) - added by turtlepod 7 years ago.
TinyMCE Link Plugin

Download all attachments as: .zip

Change History (9)

@turtlepod
7 years ago

TinyMCE Link Plugin

#2 @SergeyBiryukov
7 years ago

  • Component changed from Editor to TinyMCE

#3 @azaozz
7 years ago

  • Focuses ui accessibility javascript removed
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.9
  • Version 4.8.1 deleted

The link plugin can be added quite easy from a (WordPress) plugin. After #35760 it probably makes sense to add it and not enable it as it can be used in some cases. Then plugins can just replace wplink with link when needed.

@turtlepod
7 years ago

TinyMCE Link Plugin

#4 follow-up: @turtlepod
7 years ago

Thank you @azaozz I upload a patch (not sure if i did it correctly, I hope I do)

#5 in reply to: ↑ 4 @azaozz
7 years ago

  • Keywords needs-patch removed

Replying to turtlepod:

The patch looks good.

#6 @azaozz
7 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 41259:

TinyMCE: Add the default link plugin without enabling it. This makes it easy for WordPress plugins to use it at places where wplink is not suitable, for example when initializing the editor from JS.

Props turtlepod.
Fixes #41590.

#7 @danielbachhuber
3 years ago

For the next person that comes across this...

I ran into the problem of wplink not working when I mounted an editor instance into a Vue component. Fortunately, swapping in link worked just fine.

Switching the plugins was all that was required:

add_filter(
	'teeny_mce_plugin',
	function ( $plugins, $editor_id ) {
		$key = array_search( 'wplink', $plugins, true );
		if ( false !== $key ) {
			unset( $plugins[ $key ] );
			$plugins[] = 'link';
		}
		return $plugins;
	},
	10,
	2
);
Note: See TracTickets for help on using tickets.