[wp-trac] [WordPress Trac] #36585: Editor: wptextpattern: space-triggered patterns are unreliable

WordPress Trac noreply at wordpress.org
Tue May 17 00:27:25 UTC 2016


#36585: Editor: wptextpattern: space-triggered patterns are unreliable
--------------------------------------+-----------------------------
 Reporter:  jnylen0                   |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  TinyMCE                   |     Version:  4.3
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  javascript
--------------------------------------+-----------------------------

Comment (by jnylen0):

 Uploading another patch per discussion in Slack:

 - Inline patterns (so far, `code` tags) are also affected
 - Previous patch did not account for backslash characters (`keyCode` 220)
 and probably others
 - Suggested approach:  "So I think it might be better to 'normalise' the
 events so the code processes them in order"

 This is '''almost''' a really nice solution, except that Firefox doesn't
 support the `selectionchange` event which I'm using to detect when the
 editor content has changed as a result of the keypress we're interested
 in.  I've hacked around this by adding a `setTimeout`, which seems to
 work, but breaks the tests because some of the logic is now asynchronous.

 Is there a better way to detect when the editor content has finished
 changing as a result of a keypress?

 If not, we will need to either refactor the failing tests to use
 `setTimeout` in the right places, or try another different approach.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36585#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list