Ticket #3674: TestDirty_2.html

File TestDirty_2.html, 1015 bytes (added by Garry Yao, 13 years ago)

Possible workaround

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>Test</title>     
5<script type="text/javascript" src="http://nightly.ckeditor.com/ckeditor/ckeditor_source.js"></script>
6<script type="text/javascript"> 
7function loadEditor() {
8  editor = CKEDITOR.appendTo( 'div1',
9    {
10      on :
11        {
12          instanceReady : function( ev )
13          {
14                        // CKEDITOR.editor::setData is asynchorous for 'wysiwyg' mode,
15                        // and synchronous for 'source' mode.
16                        // Here we listen to 'contentDom' event as callback.
17                        ev.editor.on( 'contentDom', function( evt )
18                          {
19                                  evt.removeListener();
20                                  ev.editor.resetDirty();
21                          } );
22            ev.editor.setData( '<div><h1>This is some sample data</h1></div>' );
23          }
24        }
25    }); 
26        }
27</script>
28</head>
29  <body onLoad="loadEditor();">
30    <div id="div1"></div>
31    <input type="button" onClick="alert(editor.checkDirty());" value="Test Dirty"/>
32  </body>
33</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy