Opened 4 years ago
Closed 4 weeks ago
#50817 closed enhancement (wontfix)
TinyMCE: default_link_target is ignored
Reported by: | utoppo | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | TinyMCE | Keywords: | needs-patch |
Focuses: | javascript | Cc: |
Description
I use the following filter, to set the default_link_target for TinyMCE to _blank:
<?php function default_link_target_blank($opt) { $opt['default_link_target'] = "_blank"; return $opt; } add_filter( 'tiny_mce_before_init', 'default_link_target_blank');
The setting itself works. I can access the setting inside a TinyMCE plugin via the follwing JavaScript-Code:
editor.on('init', () => { console.log(editor.getParam('default_link_target')) }) // output is: ‘_blank’
The problem is, that the default_link_target-setting is never taken into account inside the wplink-Plugin of WordPress:
src/wp-includes/js/tinymce/plugins/wplink/plugin.js
I have a Bugfix ready on a cloned repository of https://github.com/WordPress/wordpress-develop
Unfortunately there is the following inside the .gitignore-file of the repository:
/src/wp-includes/js
Is there any other place, where I could commit changes to the JavaScript code? Did I miss something? How could I create a pull-request on the github-repository with changed JS-Code?
Change History (5)
#1
in reply to:
↑ description
@
4 years ago
#2
follow-up:
↓ 3
@
4 years ago
Hey Sergey,
thank you very much for pointing me in the right direction!
Unfortunately my time is a bit short right now, so it will take a little time until the pull-request is ready.
I still have a question regarding tests:
There seems to be one tinymce-related test
tests/qunit/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js
However, there seems to be no tests for the wplink-plugin. Am I right? Is it necessary to create tests in order for a pull-request to be accepted?
#3
in reply to:
↑ 2
@
4 years ago
Replying to utoppo:
There seems to be one tinymce-related test
tests/qunit/wp-includes/js/tinymce/plugins/wptextpattern/plugin.jsHowever, there seems to be no tests for the wplink-plugin. Am I right? Is it necessary to create tests in order for a pull-request to be accepted?
Adding some tests would be nice, but I don't think that should block the bug fix here, assuming the fix can be tested manually and works as expected.
#4
@
3 years ago
- Milestone changed from Awaiting Review to Future Release
- Type changed from defect (bug) to enhancement
- Version 5.5 deleted
The default_link_target
setting for TinyMCE affects the built-in link dialog there. To use it you'll have to disable the WordPress link plugin (wplink
) and enable the default link
one.
It is possible to enhance the WordPress "Insert/edit link" dialog to use that setting if there is enough interest (somebody makes a patch and tests it).
Hi there, welcome to WordPress Trac! Thanks for the report.
You can find the
wplink
plugin at this location:https://github.com/WordPress/wordpress-develop/tree/master/src/js/_enqueues/vendor/tinymce/plugins/wplink
It is moved to
wp-includes/js
as part of the build process.