simsalabim/sisyphus

CKEditor not saving

andresteves opened this issue · 2 comments

Hi,

I am using CKEditor 4 and it is not saving any information I add into it.
Any ideas on why?

<form name="addfaq" action="" accept-charset="UTF-8" method="post" id="addfaq">
<textarea form="addfaq" id="addfaqtext" style="width:100%; max-width:100%;" rows=4 type="text" name="answer"></textarea>
<script> CKEDITOR.replace('addfaqtext'); $(function(){ $('form').sisyphus(); }); </script>

Thanks,
Andre

I feel your frustration but I still think that one opened issue would suffice meaning there was no need to leave this comment on other discussions irrelevant to your problem.

As to the problem itself, I have no idea why the integration broke mainly because I'm not actively watching 3rd party releases, such as CKEditor. But I can give you a few hints, hopefully, it will point you in the right direction.

  1. WYSIWYG editors exist to decorate HTML form elements; what most of them do is hide the real HTML element and create a nicely looking "shadow copy". Think of a textarea element that is actually a div and renders bold and italic and does other fancy stuff. But what is submitted to the server must come from the HTML form. This means, there is a binding mechanism that keeps "what you see" (nicely looking div) in sync with "what you get" (the value of the underlying form element, textarea or an input).
  2. This plugin stores data that you put in form elements in browser's localStorage. It means it takes values of the actual HTML form elements and stores them elsewhere.

The above two points are intended to illustrate how the plugin is supposed to work with a decorated form. If the form is decorated, its real fields are hidden. When you change values of fancy looking components, a WYSIWYG editor synchronizes it with the underlying HTML elements; once that happens, this plugin takes the HTML elements values and saves them to localStorage. To make it all work you need to keep an eye on the WYSIWYG's markup.

My hunch is that the way CKEditor decorates elements changed, meaning markup is different now.

Hope it helps. As always, all contributions are welcome. If you solve this issue for yourself please share it with the others in the comments or pull requests. Thanks!

Here's an example of the plugin working with CKEditor v4.7.3. The official demo site features its work with CKEditor v4.1

I did not debug your code but if there are any adjustments you need to make, I'm sure they are minimal.