Topic Closed
a2exfr
242 Posts
23.8K Downloads
2 Themes
10 Plugins

I have to say that I founfd another thing.

in new  version when editing section, button to save section became active only when trigger text change inline, as I undestood.

But some section do not do inline editing, they have own edit js and just some selects or input fields.

Such as FullCalendar for gpEasy or Masonry Gallery, Tabs plugin section.

In such sections button stays inactive and section options could not be saved.

Edit: should we include triggers for every option  in plugins in edit js, or way be change behavior of save button(may be for separate sections)?

 

Edited: 3 years ago#8622

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins

I took a look at the FullCalendar to see what the problem was. This is part of the edit.js file:

  gp_editor = {
    save_path          : gp_editing.get_path(area_id),
    destroy            : function() {},
    checkDirty         : function() { return false; },
    resetDirty         : function() {},

The reason the Save button never shows up is because the checkDirty() function always returns false. checkDirty() is an optional method for the gp_editor object, but one that can be very helpful if it is set up to return true when the section has been edited.

 

3 years ago#8623

juergen
1.4K Posts
50.3K Downloads
16 Plugins
design, web development & visual effects

Good to know. Seems we have to review/rework section editing components a bit for 5.0.

I yet had no chance to deal with the new behavior and I'm glad you're discussing it.

Josh, is there a way to skip the autosave mechanism or pause the timer? E.g. for possible cases where a partial/truncated input could cause hassle.

edit: It also worries me because most of my section-editors do have live preview to play around with the settings and see what happens. In such cases auto-save is inanppropriate.

Edited: 3 years ago#8624

a2exfr
242 Posts
23.8K Downloads
2 Themes
10 Plugins

set up to return true when the section has been edited

That's all I need to know. Now my plugins is ready  for new 5.0b1 :)

 

is there a way to skip the autosave mechanism or pause the timer?

now is set to 5sek:

window.setInterval(gp_editing.save_changes,5000);

 I try window.clearInterval but no.

3 years ago#8626

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins

 is there a way to skip the autosave mechanism or pause the timer

Would something like this work for you guys? This would be an optional method

gp_editor = {
    /**
     * @return bool Return true to allow autosaving, false to disable
     */
    canAutoSave    : function(){
        
        return true;
    }

 

3 years ago#8627

juergen
1.4K Posts
50.3K Downloads
16 Plugins
design, web development & visual effects

Would something like this work for you guys?

That's fine. If it will be called every time autosave is executed, we will be able to even control it dynamically.
IMO, if the canAutoSave function does not exist, it should be treated same as returning false.

Edited: 3 years ago#8628

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins

I've added a check for CanAutoSave() which is called every time autosave is executed.

If the method doesn't exist, It's set up be treated as returning true. Since all pages are saved as drafts, it doesn't hurt to save what the user is editing and helps protect the user from losing their work.

3 years ago#8662

juergen
1.4K Posts
50.3K Downloads
16 Plugins
design, web development & visual effects

If the method doesn't exist, It's set up be treated as returning true.

Ok, that's probably the best to keep User Experience consistent.

For plugins with complex settings, we should consider to implement a "Revert" or "Restore previous" button in case the user messed sth. up.
So it's up to the plugin developer to decide how the editor behaves.

It's not always easy to decide if a section type should have extensive options or better have a separate Admin Page where one can define presets to be selected in section editing.
It's again the question about separating roles/user levels (developer - desiger - editor). I'm always torn between this different approaches.

3 years ago#8667

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins
Update on the need for CheckDirty() within the gp_editor object. I'm considering adding a generic CheckDirty() method to the Typesetter core.  If added, addons that create gp_editor objects would not need their own CheckDirty() methods.
3 years ago#8727

juergen
1.4K Posts
50.3K Downloads
16 Plugins
design, web development & visual effects

If added, addons that create gp_editor objects would not need their own CheckDirty() methods.

Hmm, yes... which data would this function check? Section Content, Section Object or even all gp_editor values/subobjects?

For my part I'm fine with current checkDirty(). I figured out that I simply need to return my already exising gp_editor.optionsChanged boolean to make it work, so it's not a big thing to make all my plugins TS5 compatible.

Edited: 3 years ago#8732

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins

which data would this function check?

It would compare the return values of gp_editor.gp_saveData(). When editing is initiated, we would cache value returned by gp_saveData(). Then, to see if an area has been edited, we'd get the value of gp_saveData() again and compare to the cached value...

The reason for this change is because CKEditor's CheckDirty() doesn't always work. When editing content via the "Source" dialog, CheckDirty() will return false when it should return true.

3 years ago#8733

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins
Well, it might not work after all. It doesn't look like I can call the gp_saveData() at the right time for all the different section types.
3 years ago#8735

a2exfr
242 Posts
23.8K Downloads
2 Themes
10 Plugins
So should i leave own check dirty check in plugins? I have already change all my existing plugins to be workable with 5.0...
3 years ago#8737

juergen
1.4K Posts
50.3K Downloads
16 Plugins
design, web development & visual effects
I'd leave it as it is for now. The amount of special sections with own editors is yet small and should be easy to make TS-ready.
3 years ago#8738

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins
Yeah, sorry for the false alarm. The generic CheckDirty() method isn't going to work. Each inline editor should have it's own CheckDirty() method.
3 years ago#8741

Topic Closed

 

News

Typesetter 5.1
8/12/2017

Typesetter 5.0.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

Over 8 Times Faster Than Wordpress
5/3/2016

We've known for a long time that Typesetter is fast. It's something we take pride ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register