Opened 6 years ago

Closed 6 years ago

#6094 closed Bug (fixed)

Find & replace is not working properly with Tables in the content.

Reported by: satya Owned by: garry.yao
Priority: Normal Milestone: CKEditor 3.4.2
Component: General Version: 3.3
Keywords: IBM Cc: damo, joek

Description

To reproduce the defect:

  1. Open Ajax sample.
  1. Type the word test 2 times and then insert a Table with 3 rows and 2 columns.
  1. Type the word test in all Tables Table cells
  1. Open find and replace dialog, go to replace tab Enter the word(tt) in Find what field and word(xx) in Replace with field
  1. click on Replace button.

Expected result:

An error dialog should come up saying "The specified text was not found".

Actual Result:

It is highlighting last Char 't' in the last word before the table and first character 't' in the first word in first Table cell.

  1. Click on Replace button again.

It will create a new word xx in the new paragraph above the Table

  1. Click on Replace button again.

It is highlighting last Char 't' in the word in first Table cell and first character 't' in the first word in second Table cell.

  1. Click on Replace button again.

It is adding a new cell in between the first two cells with a new word xx

  1. Click on Replace button again

It is removing all Table cells and leaving just one Cell with word es

And when we Replace after that we are not getting any error dialog or any error.

if we repeat the above procedure by clicking on Replace All button we are getting a dialog saying 6 ocurrences replaced and it is adding anew cell between each Table Row and it is adding a new word xx above the table.

Attachments (2)

6094.patch (410 bytes) - added by Saare 6 years ago.
6094_2.patch (1.3 KB) - added by garry.yao 6 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 6 years ago by fredck

  • Cc damo joek added
  • Keywords IBM added; damo joek removed
  • Milestone set to CKEditor 3.5

comment:2 Changed 6 years ago by satya

This is also happening when we have words in 2 different paragraphs.

Type the same text (test test test ) in 2 different paragraphs click on find and replace and enter 'tt' in the Find what field and enter 'xxx' in th Replace with field.

Try to press Replace button and see that it will highlight the lats 't' in first paragraph and first 't' in second paragraph and when we click replace button for second time it will create a new word 'xxx' in a new paragraph between 2 paragraphs.

comment:3 Changed 6 years ago by Saare

  • Keywords Discussion HasPatch added

The problem is that we're not checking the boundary unless we use "match full word". It also happens with images. Fixing it is easy, but it might not be the expected behaviour so I think it'd be better to hear some more opinions. I'm attaching a patch for this approach meanwhile.

Changed 6 years ago by Saare

comment:4 Changed 6 years ago by damo

As I see it, the walker should not match across line breaks, cell boundaries etc. This seems just wrong. The majority of text editors/word processors that I've seen would not match words like this.

Changed 6 years ago by garry.yao

comment:5 Changed 6 years ago by garry.yao

  • Keywords Discussion HasPatch removed
  • Owner set to garry.yao
  • Status changed from new to assigned

It's definitely a bug as stated by damo and it's a regression of [5329].

comment:6 Changed 6 years ago by garry.yao

  • Status changed from assigned to review

@Sarre, as you caught, the checking the boundary logic should only be performed as guard when checking a full match.

comment:7 Changed 6 years ago by Saare

  • Status changed from review to review_passed

comment:8 Changed 6 years ago by garry.yao

  • Resolution set to fixed
  • Status changed from review_passed to closed

Fixed with [5955].

Note: See TracTickets for help on using tickets.
© 2003 – 2016 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy