Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#10911 closed defect (fixed)

Bizarre behavior in EnterKeyHandling plugin

Reported by: Jared Jurkiewicz Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.5
Component: Editor Version: 1.4.0
Keywords: Cc: liucougar, Douglas Hays
Blocked By: Blocking:

Description

Use dijit/tests/test_Editor.html to run the following step

1.) Enable EnterKeyHandling? in DIV mode, then do the following:

  1. clear the content of the first editor
  2. enter some text in the first line
  3. hit enter key for 3 times
  4. enter some text agian
  5. hit enter key for 3 times

Then you can get the following:

editor1 onChange handler: <div>test</div><div></div><div> </div><div>test<br /><br/></div><div> </div>

Why the plugin would be leaving/using those double-BR tags when it is in DIV mode?

I cannot for the life of me figure out the plugin flow enough to try and resolve this issue.

Attachments (2)

EnterKeyHandling.2.patch (2.8 KB) - added by Jared Jurkiewicz 10 years ago.
Patch for enter key issue with enter in the middle of content and in div/p/whatever container mode.
IE8_run.jpg (188.5 KB) - added by Jared Jurkiewicz 10 years ago.
Screenshot of IE8 passing

Download all attachments as: .zip

Change History (22)

comment:1 Changed 10 years ago by Jared Jurkiewicz

The only thing I have determined so far is this:

It happens when you hit enter before a space at the end of the line.

This engages some sort of 'splitting mode' of the plugin. Not sure why it creates/leaves those double brs, though.

comment:2 Changed 10 years ago by Jared Jurkiewicz

I figured out where the the issue is:

function: handleEnterKey

Section for handling P/DIV/etc. Issue is in the else (where you press enter in the middle of a block.)

This is just letting the 'browser' handle it, and the browser is inserting the double br. The code needs to 'split' the block instead of letting the browser 'handle' it.

Trying to figure out the best way to do that.

comment:3 Changed 10 years ago by Jared Jurkiewicz

Cc: wildbill added
Milestone: tbd1.5

Okay, so I have a patch for this I think resolves it, more or less. Would like input

comment:4 Changed 10 years ago by Jared Jurkiewicz

Cc: Douglas Hays added

Changed 10 years ago by Jared Jurkiewicz

Attachment: EnterKeyHandling.2.patch added

Patch for enter key issue with enter in the middle of content and in div/p/whatever container mode.

comment:5 Changed 10 years ago by Jared Jurkiewicz

(In [21672]) Fixing up the EnterKetHandling? plugin to handle enter in the middle of content in a block better. Still needs tests. refs #10911

comment:6 Changed 10 years ago by Jared Jurkiewicz

(In [21675]) Further tweak, need to clone some styles. refs #10911

comment:7 Changed 10 years ago by bill

Cc: wildbill removed
Owner: set to Jared Jurkiewicz

Jared and I looked over the code together, it looks good to me....

FYI my login is just bill, but I get CC'd on all tickets automatically.

comment:8 Changed 10 years ago by bill

FYI, the existing EnterKeyHandling robot test is failing now on IE8 (hopefully just a problem with the test), so it needs to be updated, in addition to adding new tests for hitting enter in the middle of a paragraph.

comment:9 Changed 10 years ago by Jared Jurkiewicz

Passes for me: {{ LOG: debug: 2 tests to run in 1 groups LOG: debug: ------------------------------------------------------------ LOG: debug: GROUP "blockNodeForEnter=BR / IE tests" has 2 tests to run LOG: debug: PASSED test: initial input 0 ms LOG: debug: Total time for GROUP " blockNodeForEnter=BR / IE tests " is 0ms LOG: debug: PASSED test: type in some text 2812 ms LOG: debug: Total time for GROUP " blockNodeForEnter=BR / IE tests " is 2.8s LOG: debug: WOOHOO!! LOG: debug: ------------------------------------------------------------ LOG: debug: | TEST SUMMARY: LOG: debug: ------------------------------------------------------------ LOG: debug: 2 tests in 1 groups LOG: debug: 0 errors LOG: debug: 0 failures }}

comment:10 Changed 10 years ago by Jared Jurkiewicz

Passes for me:

LOG: debug: 2 tests to run in 1 groups
LOG: debug: ------------------------------------------------------------
LOG: debug: GROUP "blockNodeForEnter=BR / IE tests" has 2 tests to run
LOG: debug: PASSED test: initial input 0 ms
LOG: debug: Total time for GROUP " blockNodeForEnter=BR / IE tests " is  0ms
LOG: debug: PASSED test: type in some text 2812 ms
LOG: debug: Total time for GROUP " blockNodeForEnter=BR / IE tests " is  2.8s
LOG: debug: WOOHOO!!
LOG: debug: ------------------------------------------------------------
LOG: debug: | TEST SUMMARY:
LOG: debug: ------------------------------------------------------------
LOG: debug: 	 2 tests in 1 groups
LOG: debug: 	 0 errors
LOG: debug: 	 0 failures

comment:11 Changed 10 years ago by Jared Jurkiewicz

And that's from IE8's console.

Changed 10 years ago by Jared Jurkiewicz

Attachment: IE8_run.jpg added

Screenshot of IE8 passing

comment:12 Changed 10 years ago by Jared Jurkiewicz

Anyway, I suspect if you reran it would pass. Probably a test timing issue. Will look at it when I add the other tests.

comment:13 Changed 10 years ago by bill

Oh OK, I ran it again and it passed fine (although FullScreen failed on the ctrl-shift-f11 test, maybe there's a timing condition there too).

comment:14 Changed 10 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [21840]) Adding in two simple tests for the EnterKeyHandling? and being inside a block (p/div) somewhere in the content and pressing enter and validating content properly splits. fixes #10911

comment:15 Changed 10 years ago by Jared Jurkiewicz

(In [21841]) Updating tests to run on all browsers + added one to test style clones across split. refs #10911

comment:16 Changed 10 years ago by Jared Jurkiewicz

(In [21842]) Fixing tabs. refs #10911

comment:17 Changed 9 years ago by Jared Jurkiewicz

(In [21896]) Tweak to EnterKeyHandling? tests. refs #10911

comment:18 Changed 9 years ago by Jared Jurkiewicz

(In [21897]) Tweak to EnterKeyHandling? tests. refs #10911

comment:19 Changed 9 years ago by Jared Jurkiewicz

(In [21898]) Tweak to EnterKeyHandling? tests further, mozilla issues. refs #10911

comment:20 Changed 9 years ago by bill

(In [22717]) Make test run correctly on FF/mac; the exception case code should only be FF/win. Refs #10911.

Note: See TracTickets for help on using tickets.