WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#46071 closed defect (bug) (fixed)

TinyMCE Classic Block: fix "Advanced Link" modal

Reported by: azaozz Owned by: azaozz
Milestone: 5.1 Priority: normal
Severity: normal Version: 5.0
Component: TinyMCE Keywords: has-patch commit
Focuses: Cc:

Description (last modified by azaozz)

The "Advanced Link" modal doesn't work reliably in the Classic Block instance. Sometimes it doesn't insert a link, sometimes it inserts it at the beginning of the text instead of the cursor position.

This was reported for Gutenberg some time ago. See https://github.com/WordPress/gutenberg/issues/7932 and the 6-7 issues closed as duplicates. Opening this ticket here as it is an issue with one of our old custom TinyMCE plugins.

Attachments (1)

46071.diff (5.2 KB) - added by azaozz 3 months ago.

Download all attachments as: .zip

Change History (7)

@azaozz
3 months ago

#1 @azaozz
3 months ago

There are few reasons for these bugs. Most importantly the editor instance is inline and some "utility" functions work a bit differently.

In 46071.diff:

  • Refresh the wpLink modal and wplink editor plugin a bit.
  • Always select the (newly inserted or existing) link node after the modal has been opened. Passing it from the editor plugin breaks as the editor content is reloaded on editor.blur(), and opening the modal and clicking in it triggers that.
  • Remove outdated editor.focus() on opening the modal (was bad for accessibility).

Tested in Firefox, Chrome and Edge on Win10.

#2 @azaozz
3 months ago

  • Keywords has-patch added

#3 @azaozz
3 months ago

  • Description modified (diff)

#4 @iseulde
3 months ago

  • Keywords commit added

Ok, looks good.

#5 @azaozz
3 months ago

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

In 44696:

TinyMCE Classic Block: fix the Advanced Link modal (accessible when clicking on the cogwheel in the inline link modal in a Classic Block).

Fixes #46071.

#6 @ocean90
3 months ago

In 44699:

TinyMCE Classic Block: Remove unused variable.

See #46071.

Note: See TracTickets for help on using tickets.