Skip to content

Commit

Permalink
Fix LT-21702: Reversal view fails on jump from Lexicon Edit without R…
Browse files Browse the repository at this point in the history
…efresh (#76)

Fix LT-21702: Reversal view fails on jump from Lexicon Edit without Refresh (#76)

Co-authored-by: Jason Naylor <[email protected]>
  • Loading branch information
jtmaxwell3 and jasonleenaylor authored Jun 13, 2024
1 parent f8043a2 commit d1bf4b5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Src/xWorks/XhtmlDocView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ internal class XhtmlDocView : XWorksViewBase, IFindAndReplaceContext, IPostLayou
internal string m_configObjectName;
internal const string CurrentSelectedEntryClass = "currentSelectedEntry";
private const string FieldWorksPrintLimitEnv = "FIELDWORKS_PRINT_LIMIT";
private bool m_jumpToRecord = false; // Whether we got a JumpToRecord signal

private GeckoWebBrowser GeckoBrowser => (GeckoWebBrowser)m_mainView.NativeBrowser;

Expand Down Expand Up @@ -177,6 +178,7 @@ public bool OnJumpToRecord(object argument)
GiveSimpleWarning(xrc);
}
}
m_jumpToRecord = true;
return false;
}

Expand Down Expand Up @@ -1077,12 +1079,21 @@ private void SetActiveSelectedEntryOnView(GeckoWebBrowser browser)
var currReversalWs = writingSystem.Id;
var currentConfig = m_propertyTable.GetStringProperty("ReversalIndexPublicationLayout", string.Empty);
var configuration = File.Exists(currentConfig) ? new DictionaryConfigurationModel(currentConfig, Cache) : null;
var currentPage = GetTopCurrentPageButton(browser.Document.Body);
if (configuration == null || configuration.WritingSystem != currReversalWs)
{
var newConfig = Path.Combine(DictionaryConfigurationListener.GetProjectConfigurationDirectory(m_propertyTable),
writingSystem.Id + DictionaryConfigurationModel.FileExtension);
m_propertyTable.SetProperty("ReversalIndexPublicationLayout", File.Exists(newConfig) ? newConfig : null, true);
} else if (currentPage == null && m_jumpToRecord)
{
// Force the content to be updated once (LT-21702).
// This isn't needed when ReversalIndexPublicationLayout is changed
// because it causes the content to be updated as a side effect.
UpdateContent(currentConfig);
}
// Clear m_jumpToRecord no matter what.
m_jumpToRecord = false;
}
var currentObjectGuid = Clerk.CurrentObject.Guid.ToString();
var currSelectedByGuid = browser.Document.GetHtmlElementById("g" + currentObjectGuid);
Expand Down

0 comments on commit d1bf4b5

Please sign in to comment.