Ticket #1208 (closed defect: fixed)

Opened 2 years ago

Last modified 19 months ago

Bug with option chkToggleLinks,

Reported by: MartinBudden Owned by: JeremyRuston
Priority: minor Milestone: 2.6.1
Component: core Version:
Severity: undefined Keywords:
Cc:

Description

From John B Thiel:

In v2.5.3 there appears a bug with option chkToggleLinks, such that it will close a tiddler with an edit in progress (thus destroying data). The problem is the direct call to closeTiddler() in:

Story.prototype.displayTiddler =
function(srcElement,tiddler,template,animate,unused,customFields,toggle,animationSrc)
{
       var title = (tiddler instanceof Tiddler) ? tiddler.title : tiddler;
       var tiddlerElem = this.getTiddler(title);
       if(tiddlerElem) {
               if(toggle)
                       this.closeTiddler(title,true);
else
                       this.refreshTiddler(title,template,false,customFields);
       } else {
               var place = this.getContainer();
               var before = this.positionTiddler(srcElement);
               tiddlerElem =
this.createTiddler(place,before,title,template,customFields);
       }

The code should be doing some check as in

Story.prototype.closeAllTiddlers = function(exclude)
{
       clearMessage();
       this.forEachTiddler(function(title,element) {
               if((title != exclude) && element.getAttribute("dirty")
!= "true")
                       this.closeTiddler(title);
       });
       window.scrollTo(0,ensureVisible(this.container));
};

Also note for future tidying, I would say a function called "displayTiddler" should not be closing tiddlers at all. The logic to toggle close/open should probably be at another level/function.

Change History

Changed 2 years ago by MartinBudden

  • milestone changed from 2.6 to 2.6.1

Changed 19 months ago by MartinBudden

  • status changed from new to closed
  • resolution set to fixed

Fixed in changeset:12274

Note: See TracTickets for help on using tickets.