Opened 7 years ago

Closed 6 years ago

#5367 closed New Feature (fixed)

Implement editor.insertText and use it in the special chars dialog

Reported by: fredck Owned by: garry.yao
Priority: Normal Milestone: CKEditor 3.5
Component: General Version: SVN (CKEditor) - OLD
Keywords: Cc:

Description

We must have an insertText function which inserts plain text into the editor, contextual to the current selection.

This ticket is being opened because of [5273]. It fixes the undesired behavior we have in the insert special char dialog because of the usage of insertHtml. We should revert those changes and use the new insertText function instead.

Attachments (4)

5367.patch (5.9 KB) - added by garry.yao 6 years ago.
5367_2.patch (8.8 KB) - added by garry.yao 6 years ago.
5367_3.patch (17.7 KB) - added by garry.yao 6 years ago.
5367_4.patch (18.1 KB) - added by garry.yao 6 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 6 years ago by garry.yao

We'll be working on this at #5309.

comment:2 Changed 6 years ago by fredck

  • Milestone changed from CKEditor 3.4 to CKEditor 3.5

comment:3 Changed 6 years ago by fredck

  • Milestone changed from CKEditor 3.4.1 to CKEditor 3.5

comment:4 Changed 6 years ago by garry.yao

  • Milestone changed from CKEditor 3.5 to CKEditor 3.6

Defer as #5309 is not in 3.5.

comment:5 Changed 6 years ago by garry.yao

  • Milestone changed from CKEditor 3.6 to CKEditor 3.5

Move this back to 3.5 as it could be implemented as a separately thing and helps to work around issues like #4746.

Changed 6 years ago by garry.yao

comment:6 Changed 6 years ago by garry.yao

  • Owner set to garry.yao
  • Status changed from confirmed to review

comment:7 Changed 6 years ago by tobiasz.cudnik

It doesn't remove a selection content when used with CKEDITOR.editor#insertText. Although the Special Chars dialog removes such content.

Is this a correct behavior?

comment:8 Changed 6 years ago by tobiasz.cudnik

  • Status changed from review to review_failed

Changed 6 years ago by garry.yao

comment:9 Changed 6 years ago by garry.yao

  • Status changed from review_failed to review

Changed 6 years ago by garry.yao

comment:10 Changed 6 years ago by garry.yao

New patch changes a bit the original way of handling line-breaks in plain text, the major problem for the original way of using enterKey was performance penalty.

comment:11 Changed 6 years ago by tobiasz.cudnik

  • Status changed from review to review_failed

It works fine in FF and IE, although in Webkit (Chrome) i've got an extra paragraph and the inline style if not preserved.

Steps

  1. Use such content with the selection:
    <p>
    	This is some <strong>sample [text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.]</p>
    
  2. Execute the command:
    CKEDITOR.instances.editor1.insertText('foo\nbar');
    

Result:

<p>
	This is some <strong>sample&nbsp;</strong>foo</p>
<p>
	bar</p>

comment:12 Changed 6 years ago by garry.yao

  • Status changed from review_failed to review
  1. Extra paragraph issue: this's actually a regression from [5728], addressed in new patch;
  2. No inline style issue: this been a webkit bug instead, but only happens with text with multiple lines, so we'd probably have to go the same way with Gecko because of this.

Changed 6 years ago by garry.yao

comment:13 Changed 6 years ago by tobiasz.cudnik

  • Status changed from review to review_passed

It works fine now, although i had some issues when applying the patch on the newest revision.

comment:14 Changed 6 years ago by garry.yao

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

Fixed with [6143], sample page updated with [6144].

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