From d1bf4b53a5d9333050b1cc13b883cd1ad3d7daad Mon Sep 17 00:00:00 2001 From: John T Maxwell III Date: Thu, 13 Jun 2024 11:23:22 -0700 Subject: [PATCH] Fix LT-21702: Reversal view fails on jump from Lexicon Edit without Refresh (#76) Fix LT-21702: Reversal view fails on jump from Lexicon Edit without Refresh (#76) Co-authored-by: Jason Naylor --- Src/xWorks/XhtmlDocView.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Src/xWorks/XhtmlDocView.cs b/Src/xWorks/XhtmlDocView.cs index 6f28d26888..a240eb2b57 100644 --- a/Src/xWorks/XhtmlDocView.cs +++ b/Src/xWorks/XhtmlDocView.cs @@ -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; @@ -177,6 +178,7 @@ public bool OnJumpToRecord(object argument) GiveSimpleWarning(xrc); } } + m_jumpToRecord = true; return false; } @@ -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);