Opened 10 years ago

Last modified 9 years ago

#12891 confirmed Bug

Inline mode + Widgets( codeSnippet or formula ): CheckDirty() always returns "true" after page is loaded

Reported by: Airocat Owned by:
Priority: Normal Milestone:
Component: General Version: 4.3 Beta
Keywords: Cc: airocat@…, michele.dolfi@…

Description (last modified by Jakub Ś)

checkDirty() function does not work properly with CodeSnippet and Mathematical plugins in Inline mode.

If there is a codesnippet or a formula in the ckeditor element, CheckDirty() always returns "true" after page has been loaded.

Steps to reproduce:

  1. Select any editable element on the page and add codeSnippet or a Formula
  2. Save the element and reload the page
  3. Execute in JS console:

CKEDITOR.instances.editor_instance.checkDirty()

where editor_instance is id of the element. It will return "True" but it should be "False"

This issue emerges only in Inline mode, not in classic mode.

Software versions:

Ckeditor: 4.4.7 (custom build)

OS: Ubuntu 12.04 x86_64

Browsers: Chrome 40 and Firefox 35 (latest versions at this time)

Edit: Please also see comment:8 because this issue also occurs when you just load the editor (checked in CKEditor 4.5.6 at the time of writing).

Attachments (1)

build-config.js (2.2 KB) - added by Airocat 10 years ago.
build config

Download all attachments as: .zip

Change History (10)

Changed 10 years ago by Airocat

Attachment: build-config.js added

build config

comment:1 Changed 10 years ago by Airocat

Cc: airocat@… added

comment:2 Changed 10 years ago by Airocat

Summary: Inline mode + Widgets( codeSnippet or formula ): CheckDirty() always returns "true" after page is LoadedInline mode + Widgets( codeSnippet or formula ): CheckDirty() always returns "true" after page is loaded

comment:3 Changed 10 years ago by Jakub Ś

I can confirm that this is happening in default samples. To reproduce, I have modified inline editor part accordingly.

var e2 = CKEDITOR.inline( 'editable', CKEDITOR.tools.extend( {}, config, {
	extraPlugins: 'codesnippet'
}, true ) );

console.log( e2.checkDirty() );
e2.on( 'instanceReady', function(){
	console.log( e2.checkDirty() );
	setTimeout( function(){ console.log( e2.checkDirty() ); }, 1000);				
});

I was only able to reproduce this problem in mathjax and codesnippet samples.

comment:4 Changed 10 years ago by Marek Lewandowski

Status: newconfirmed

In case of codesnippet, the highlighting markup is not applied in CKEDITOR.instances.editable._.previousValue (only in inline).

So getSnapshot returns HTML with following widget innerHTML:

<span class="hljs-keyword">for</span> ( <span class="hljs-keyword">var</span> i <span class="hljs-keyword">in</span> object ) { (...)

While previousValue has plain text:

for ( var i in object ) { (...)

comment:5 Changed 10 years ago by Jakub Ś

Version: 4.4.74.3 Beta

From what I have checked, this issue can be reproduced from CKEditor 4.3 beta.

comment:6 Changed 10 years ago by Jakub Ś

Similar issue: #14294.

Last edited 9 years ago by Jakub Ś (previous) (diff)

comment:7 Changed 10 years ago by Jonathan Paul Costello

I just ran across this. It seems to be the case(for formula at least) that it doesn't matter if it's inline or not. It's reproducible from the mathjax demo page(http://sdk.ckeditor.com/samples/mathjax.html). Just load that page, open a console and CKEDITOR.instances.editor1.checkDirty() returns true instead of false.

comment:8 Changed 9 years ago by dolfim

Cc: michele.dolfi@… added

comment:9 Changed 9 years ago by Jakub Ś

Description: modified (diff)

@joncostello - from what I have checked MathJax returns true for both editors while Code Snippet returns true only for inline editor. It is enough to load editors in that case and execute checkDirty() method.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy