Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading