Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. for ( instance in CKEDITOR.instances )
  2. CKEDITOR.instances[instance].updateElement();
  3.  
  4. CKEDITOR.instances["editor1"].on("instanceReady", function()
  5. {
  6. //set keyup event
  7. this.document.on("keyup", CK_jQ);
  8.  
  9. //and paste event
  10. this.document.on("paste", CK_jQ);
  11. });
  12.  
  13. function CK_jQ()
  14. {
  15.  
  16. CKEDITOR.tools.setTimeout( function()
  17. {
  18. $("#editor1").val(CKEDITOR.instances.editor1.getData());
  19. }, 0);
  20. }
  21.  
  22. CKEDITOR.instances["editor1"].document.on('keydown', function(event)
  23. {
  24. CKEDITOR.tools.setTimeout( function()
  25. {
  26. $("#editor1").val(CKEDITOR.instances.editor1.getData());
  27. }, 0);
  28. });
  29.  
  30. CKEDITOR.instances["editor1"].document.on('paste', function(event)
  31. {
  32. CKEDITOR.tools.setTimeout( function()
  33. {
  34. $("#editor1").val(CKEDITOR.instances.editor1.getData());
  35. }, 0);
  36. });
  37.  
  38. console.log(CKEDITOR.instances.editor1.getData());
  39.  
  40. CKEDITOR.instances["editor1"].on("instanceReady", function()
  41. {
  42. //set keyup event
  43. this.document.on("keyup", CK_jQ);
  44.  
  45. //and paste event
  46. this.document.on("paste", CK_jQ);
  47. }
  48.  
  49. function CK_jQ()
  50. {
  51. CKEDITOR.instances.editor1.updateElement();
  52. }
  53.  
  54. CKEDITOR.instances.editor1.on('contentDom', function() {
  55. CKEDITOR.instances.editor1.document.on('keyup', function(event) {/*your instructions*/});
  56. });
  57.  
  58. var editor = CKEDITOR.replace('editor');
  59.  
  60. CKEDITOR.instances.editor.on("instanceReady", function(){
  61. this.on('contentDom', function() {
  62. this.document.on('keydown', function(event) {
  63. CKEDITOR.tools.setTimeout( function(){
  64. $(".seldiv").html(CKEDITOR.instances.editor.getData());
  65. }, 1);
  66. });
  67. });
  68. this.on('contentDom', function() {
  69. this.document.on('paste', function(event) {
  70. CKEDITOR.tools.setTimeout( function(){
  71. $(".seldiv").html(CKEDITOR.instances.editor.getData());
  72. }, 1);
  73. });
  74. });
  75. edits_clix();
  76. var td = setTimeout("ebuttons()", 1);
  77. })
  78.  
  79. <script type="text/javascript">
  80. var editor = CKEDITOR.replace( 'editor1' );
  81. editor.on("instanceReady", updateInstance() )
  82. </script>
  83.  
  84. function updateInstance()
  85. {
  86. CKEDITOR.instances["editor1"].document.on('keydown', function(event)
  87. {
  88. CKEDITOR.tools.setTimeout( function()
  89. {
  90. $("#editor1").val(CKEDITOR.instances.editor1.getData());
  91. }, 0);
  92. });
  93.  
  94. CKEDITOR.instances["editor1"].document.on('paste', function(event)
  95. {
  96. CKEDITOR.tools.setTimeout( function()
  97. {
  98. $("#editor1").val(CKEDITOR.instances.editor1.getData());
  99. }, 0);
  100. });
  101.  
  102. }
  103.  
  104. $(document).ready(function() {
  105. $('#form').submit(function(){
  106. if ( CKEDITOR.instances.editor1.getData() == '' ){
  107. alert( 'There is no data available' );//an alert just to check if its working
  108. }else{
  109. var editor_data = CKEDITOR.instances.editor1.getData();
  110. $("#editor1").val(editor_data); //at this point i give the value to the textarea
  111. $.ajax({
  112. //do your ajax here
  113.  
  114. });
  115.  
  116. }
  117. return false;
  118. });
  119. });
  120.  
  121. if (typeof CKEDITOR !== "undefined") {
  122. for ( instance in CKEDITOR.instances )
  123. CKEDITOR.instances[instance].updateElement();
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement