Menu

#32 Local Storage for values

open
nobody
None
5
2006-01-18
2006-01-18
No

This plugin (it could be added as part of the core
FCKeditor without any changes) isn't meant to be used
as a standalone, it's just some little code to help
other plugins or changes in the core editor to preserve
values between different sessions.

To use this plugin as I've said you must be a developer
as it doesn't do any magic, it's just some helper code.

The user make some changes, pick some color, etc...,
then it is stored in this storage (just a cookie), so
the next time the same tool is shown to the user
instead of showing always the same default value now
it's possible to remember his selection.

example:
while loading the table dialog (if no table is selected):
//recover previous values:
document.getElementById('txtRows').value =
FCKStorage.GetValue( 'tables' , 'rows', '3');
document.getElementById('txtColumns').value =
FCKStorage.GetValue( 'tables' , 'cols', '3');

And when the users press OK, then save it

//save the default values here:
FCKStorage.SetValue( 'tables' , 'rows',
document.getElementById('txtRows').value);
FCKStorage.SetValue( 'tables' , 'cols',
document.getElementById('txtColumns').value);

The syntax of both functions is similar: module, name,
and value (for setting) or defaultValue (when trying to
read)
"Module" could be removed if the name it's always
different, but I think that this helps avoiding problems.

Discussion

  • Denny Valliant

    Denny Valliant - 2006-02-13

    Logged In: YES
    user_id=1101621

    Sounds kind of cool man. I think you forgot to attach the
    plugin code though... :-)

     
  • Alfonso Martinez

    Logged In: YES
    user_id=1356422

    I see: I missed marking that checkbox.

     
  • Alfonso Martinez

    Logged In: YES
    user_id=1356422

    Ok, finally I've updated it to use something better than
    cookies (as I initially envisioned it) for those browsers
    that can do it (IE & Fx2)
    The final step would be to include the ability to use flash
    storage.

    This can be seen in action in the rtSpellChecker plugin
    (it's included inside to avoid downloading two files for
    those that want an easy install)

     
  • Alfonso Martinez

    updated plugin

     

Log in to post a comment.

Monday.com Logo