Setting an ID in custom instance of VIE

10 views
Skip to first unread message

Till K.

unread,
Apr 18, 2013, 10:23:06 AM4/18/13
to crea...@googlegroups.com
Hi,

I am trying to create a custom instance of VIE so I can possibly/maybe supply an identifier to it to make it unique.

Reason why I am doing this is — I have two different pages (identical content), where I am trying to use two different editors (redactor and ACE).

Currently — when someone leaves the page where ACE/redactor is open and goes to the opposite. The editor is still open but the content is not refreshed. I think it's using the same instance underneath. I couldn't figure out if there's a way to refresh the content so I thought I'd give each instance a unique identifier so it would be in "browse" instead of "edit".

Another possibility would be switching the editor on the same page, but I couldn't identify a hook or event either.

Any thoughts?

Till

Henri Bergius

unread,
Apr 18, 2013, 10:28:13 AM4/18/13
to crea...@googlegroups.com

Hi,

On 18 Apr 2013 16:23, "Till K." <ti...@php.net> wrote:
> Currently — when someone leaves the page where ACE/redactor is open
> and goes to the opposite. The editor is still open but the content is not
> refreshed. I think it's using the same instance underneath.

If they're completely different pages, then this is probably because of localStorage and sessionStorage used by Create.

You can pass an arbitrary 'storagePrefix' configuration option when instantiating Create. All sessionStorage keys will be prefixed with that.

https://github.com/bergie/create/blob/master/src/jquery.Midgard.midgardCreate.js#L59

This will solve the edit/browse state issue. However, unfortunately midgardStorage doesn't yet obey that prefix for its localStorage usage.

Should be easy to fix, however. I'll look at that.

> Till

/Henri

Till K.

unread,
Apr 18, 2013, 11:17:58 AM4/18/13
to crea...@googlegroups.com


On Thursday, April 18, 2013 4:28:13 PM UTC+2, Henri Bergius wrote:

Hi,

On 18 Apr 2013 16:23, "Till K." <ti...@php.net> wrote:
> Currently — when someone leaves the page where ACE/redactor is open
> and goes to the opposite. The editor is still open but the content is not
> refreshed. I think it's using the same instance underneath.

If they're completely different pages, then this is probably because of localStorage and sessionStorage used by Create.

You can pass an arbitrary 'storagePrefix' configuration option when instantiating Create. All sessionStorage keys will be prefixed with that.

https://github.com/bergie/create/blob/master/src/jquery.Midgard.midgardCreate.js#L59

Thanks! 

This will solve the edit/browse state issue. However, unfortunately midgardStorage doesn't yet obey that prefix for its localStorage usage.

Should be easy to fix, however. I'll look at that.

And, thanks! :)

I'm also running into an issue where the save button becomes inactive and is not triggered to be active (clickable) by changes in the box. Any idea what I could look into there?

We are still on 1.0.4 — not sure if there were BC breaks. Do you think it's save to update?

Till

Henri Bergius

unread,
Apr 18, 2013, 11:34:40 AM4/18/13
to crea...@googlegroups.com

Hi,

On 18 Apr 2013 17:18, "Till K." <ti...@php.net> wrote:
>> This will solve the edit/browse state issue. However, unfortunately midgardStorage doesn't yet obey that prefix for its localStorage usage.
>>
>> Should be easy to fix, however. I'll look at that.
>
> And, thanks! :)

Try with this commit:
https://github.com/bergie/create/commit/4a4586b9945a5f6f39cd7cdc5834dd952d6d699e

> I'm also running into an issue where the save button becomes inactive and
> is not triggered to be active (clickable) by changes in the box. Any idea
> what I could look into there?

Sounds like some editing widget doesn't communicate changes correctly. Try with latest git version, and then report an issue (mentioning the editors you use) if needed.

> Till

/Henri

Reply all
Reply to author
Forward
0 new messages