Config with dynamic values
Permalink Browser Info Environment
Hi there,
I am trying to use the following add on:https://ckeditor.com/cke4/addon/autosave...
This add on accepts dynamic values in the configuration, such as:
SaveKey : 'autosave_' + window.location + "_" + $('#' + editor.name).attr('name')
When I set these values on a standalone configuration of ckeditor, they work without any issues. However, if I try to set them using the pluginator it seems like the values aren't available. Is it because the config using pluginator is happening prior to the page being rendered? Please let me know if you require more details.
I am trying to use the following add on:https://ckeditor.com/cke4/addon/autosave...
This add on accepts dynamic values in the configuration, such as:
SaveKey : 'autosave_' + window.location + "_" + $('#' + editor.name).attr('name')
When I set these values on a standalone configuration of ckeditor, they work without any issues. However, if I try to set them using the pluginator it seems like the values aren't available. Is it because the config using pluginator is happening prior to the page being rendered? Please let me know if you require more details.
Type: | Ticket |
---|---|
Status: | Resolved |
Sorry, I should have specified. The code snippet I included is just what the autosave github doc shows, not what I actually want to use. If you exclude that config it uses that savekey by default. However, leaving the default setting doesn't work with Concrete as the ckeditor names are generated dynamically as is the browser url. So it does autosave to local storage, but the key it uses is essentially a "one time" key that won't match up again if you refresh the page.
I assume it isn't an issue for me to just update /application/files/js/ck4editor/autosave/plugin.js and put the additional config in there? I'm guessing if I updated the autosave plugin to a newer version I would need to add my config back in, but at this point this seems to be working for me. I added this on line 40:
config.SaveKey = 'autosave_' + window.location.hostname + '_' + $('.ccm-block-edit-inline-active').data('block-id');
It's true that the one I showed as an example doesn't have a dynamic name.
changing the script itself is not a problem
changing the script itself is not a problem
I don't think this is going to work however, the version of autosave I'm using on my website is already saving using the page's URL and the editor's name attribute when not specifying the SaveKey config.
I didn't use the one from the CKEditor market though, I downloaded the one from GitHub which is another version that works better and I think it saves like that by default. You can check it here on my website:https://www.kalmoya.com/add-ons-concrete5/ckeditor-plugin-installer...
Check the local storage to see what key it uses for saving.
My settings are like this:
As you can see I don't specify SaveKey so it saves it the way you want it.