Opened 7 years ago

Closed 7 years ago

#5367 closed New Feature (fixed)

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

Reported by: Frederico Caldeira Knabben 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 7 years ago.
5367_2.patch (8.8 KB) - added by Garry Yao 7 years ago.
5367_3.patch (17.7 KB) - added by Garry Yao 7 years ago.
5367_4.patch (18.1 KB) - added by Garry Yao 7 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 7 years ago by Garry Yao

We'll be working on this at #5309.

comment:2 Changed 7 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.4CKEditor 3.5

comment:3 Changed 7 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.4.1CKEditor 3.5

comment:4 Changed 7 years ago by Garry Yao

Milestone: CKEditor 3.5CKEditor 3.6

Defer as #5309 is not in 3.5.

comment:5 Changed 7 years ago by Garry Yao

Milestone: CKEditor 3.6CKEditor 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 7 years ago by Garry Yao

Attachment: 5367.patch added

comment:6 Changed 7 years ago by Garry Yao

Owner: set to Garry Yao
Status: confirmedreview

comment:7 Changed 7 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 7 years ago by Tobiasz Cudnik

Status: reviewreview_failed

Changed 7 years ago by Garry Yao

Attachment: 5367_2.patch added

comment:9 Changed 7 years ago by Garry Yao

Status: review_failedreview

Changed 7 years ago by Garry Yao

Attachment: 5367_3.patch added

comment:10 Changed 7 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 7 years ago by Tobiasz Cudnik

Status: reviewreview_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 7 years ago by Garry Yao

Status: review_failedreview
  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 7 years ago by Garry Yao

Attachment: 5367_4.patch added

comment:13 Changed 7 years ago by Tobiasz Cudnik

Status: reviewreview_passed

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

comment:14 Changed 7 years ago by Garry Yao

Resolution: fixed
Status: review_passedclosed

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

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