1 | |
---|
2 | <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> |
---|
3 | <script src="//cdnjs.cloudflare.com/ajax/libs/ckeditor/4.2/ckeditor.js"></script> |
---|
4 | <script src="//cdnjs.cloudflare.com/ajax/libs/ckeditor/4.2/adapters/jquery.js"></script> |
---|
5 | |
---|
6 | <button id=go>Go!</button> |
---|
7 | <div id=timer></div> |
---|
8 | |
---|
9 | <div id=modal> |
---|
10 | </div> |
---|
11 | |
---|
12 | |
---|
13 | <script> |
---|
14 | |
---|
15 | var timer = -1; |
---|
16 | |
---|
17 | window.setInterval(function() { |
---|
18 | if (timer < 0) { |
---|
19 | return; |
---|
20 | } |
---|
21 | if (timer == 1) { |
---|
22 | timer = -1; |
---|
23 | $('#timer').html('destroying ckeditor'); |
---|
24 | CKEDITOR.instances.foo.destroy(); |
---|
25 | } |
---|
26 | timer--; |
---|
27 | $('#timer').html('' + timer + ' seconds left'); |
---|
28 | }, 1000); |
---|
29 | |
---|
30 | $('button#go').click(function() { |
---|
31 | timer = 10; |
---|
32 | |
---|
33 | $('#modal').html("<h2>this is modal</h2><textarea id=foo style='width: 400px; height: 400px'>Some initial text.</textarea>"); |
---|
34 | |
---|
35 | $('textarea#foo').ckeditor({ |
---|
36 | height: "300px", |
---|
37 | toolbarStartupExpanded: true, |
---|
38 | width: "100%" |
---|
39 | }); |
---|
40 | }); |
---|
41 | </script> |
---|