Opened 7 years ago

Closed 6 years ago

#7580 closed Bug (expired)

div contenteditable + removeFormatCmd + insertHtml

Reported by: pgteam Owned by:
Priority: Normal Milestone:
Component: General Version: 3.5.2
Keywords: Cc:

Description

i tried to use removeFormat command followed by insertHtml for ensuring inserted html will not be formated by previous styling. . . .

so i tried this case. . <div contenteditable="false"> some dummy text</div> <p>this statement <b>will</b> be removed</p>

after i selected whole sentence(included the front most space if any) right below the <div> tag and then i call myFunction from some button which look like

function myFunction (){
//instance already created with the name 'editor1'
        CKEDITOR.instances.editor1.execCommand( 'removeFormat' ); 
        insertHtml("<p>text to be inserted</p>");
}

Obviously, myFunction can be called, format of selected text can be removed, at last, insertHtml can't perform. . .

I discovered that it occurs, only when contenteditable is defined with the combination of removeFormatCmd + InsertHtml with the situation i described above...

It wouldn't happen if contenteditable is defined and then just InsertHtml...

Is there any contradiction among contenteditable attribute, removeFormat Command and insertHtml???

Change History (2)

comment:1 Changed 7 years ago by Jakub Ś

Status: newpending

I have tried to use your code (improved it a little):

function myFunction (){
//instance already created with the name 'editor1'
	CKEDITOR.instances.editor1.execCommand( 'removeFormat' ); 
	CKEDITOR.instances.editor1.insertHtml("<p>text to be inserted</p>");
}

in latest stable version 3.6 and in the one you mentioned 3.5.2. InsertHTML works as it should.

Could it be that you have forgotten to add

CKEDITOR.instances.editor1.

before the function or you can still reproduce the issue with the above code in clean version of CKEditor?

comment:2 Changed 6 years ago by Jakub Ś

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