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.

Type: Ticket
Status: Resolved
derekairdrie
View Replies:
mnakalay replied on at Permalink Reply
mnakalay
Hello.

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:
autosave = {"messageType" : "statusbar", "delay" : 15, "diffType" : "inline", "saveOnDestroy" : true}

As you can see I don't specify SaveKey so it saves it the way you want it.
derekairdrie replied on at Permalink Reply
derekairdrie
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.
derekairdrie replied on at Permalink Reply
derekairdrie
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');
mnakalay replied on at Permalink Reply
mnakalay
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

concrete5 Environment Information

# concrete5 Version
Core Version - 8.5.5
Version Installed - 8.5.5
Database Version - 20201116182100

# Database Information
Version: 8.0.25-commercial
SQL Mode: STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION

# concrete5 Packages
CoA Page Redirect (1.0), Content Editor Pluginator (1.2.2), Debug Kit (0.9.5), Page Status Display (1.0.0)

# concrete5 Overrides
blocks/coa_address/add.php, blocks/coa_address/controller.php, blocks/coa_address/db.xml, blocks/coa_address/edit.php, blocks/coa_address/icon.png, blocks/coa_address/view.php, blocks/coa_address, blocks/coa_hours/add.php, blocks/coa_hours/controller.php, blocks/coa_hours/db.xml, blocks/coa_hours/edit.php, blocks/coa_hours/icon.png, blocks/coa_hours/view.php, blocks/coa_hours, controllers/single_page/community_calendar.php, controllers/single_page, mail/basic_workflow_notification.php, mail/default_template.php, single_pages/community_calendar/view.php, single_pages/community_calendar, single_pages/dashboard/calendar/events.php, single_pages/dashboard/calendar, single_pages/dashboard, src/CoA/BasicWorkflow.php, src/CoA/Sitemap.php, src/CoA

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Microsoft-IIS/10.0

# Server API
cgi-fcgi

# PHP Version
7.4.20

# PHP Extensions
bcmath, calendar, cgi-fcgi, Core, ctype, curl, date, dom, exif, fileinfo, filter, gd, hash, iconv, intl, json, libxml, mbstring, mcrypt, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, Phar, readline, Reflection, session, SimpleXML, sodium, SPL, standard, tokenizer, xml, xmlreader, xmlwriter, zip, zlib

# PHP Settings
max_execution_time - 600
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 1000
memory_limit - 256M
post_max_size - 12M
upload_max_filesize - 2M
mbstring.regex_retry_limit - 1000000
mbstring.regex_stack_limit - 100000
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
unserialize_max_depth - 4096

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.