Skip to content

Commit

Permalink
Just renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
hatton committed Apr 29, 2024
1 parent ababfd2 commit f483d5b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,5 @@ src/content/.yarn/*
!src/content/.yarn/releases
!src/content/.yarn/sdks
!src/content/.yarn/versions

.vite/vitest/results.json
18 changes: 13 additions & 5 deletions src/BloomExe/Edit/EditingModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -718,14 +718,17 @@ public void ViewVisibleNowDoSlowStuff()
// completed saving it.
int _selChangeCount = 0;
object _selChangeLock = new object();

private void OnPageSelectionChanging(object sender, EventArgs eventArgs)
{
try
{
lock (_selChangeLock)
{
Debug.Assert(_selChangeCount == 0,
$"Multiple active OnPageSelectionChanging calls, possible empty marginBox cause? (count={_selChangeLock})");
Debug.Assert(
_selChangeCount == 0,
$"Multiple active OnPageSelectionChanging calls, possible empty marginBox cause? (count={_selChangeLock})"
);
_selChangeCount++;
}
OnPageSelectionChangingInternal(sender, eventArgs);
Expand All @@ -738,6 +741,7 @@ private void OnPageSelectionChanging(object sender, EventArgs eventArgs)
}
}
}

private void OnPageSelectionChangingInternal(object sender, EventArgs eventArgs)
{
CheckForBL2634("start of page selection changing--should have old IDs");
Expand Down Expand Up @@ -1255,14 +1259,17 @@ private bool CannotSavePage()

int _saveCount = 0;
object _saveCountLock = new object();

public void SaveNow(bool forceFullSave = false)
{
try
{
lock (_saveCountLock)
{
Debug.Assert(_saveCount == 0,
$"Trying to save while already saving: possible empty marginBox cause? (save count={_saveCount})");
Debug.Assert(
_saveCount == 0,
$"Trying to save while already saving: possible empty marginBox cause? (save count={_saveCount})"
);
_saveCount++;
}
SaveNowInternal(forceFullSave);
Expand All @@ -1275,6 +1282,7 @@ public void SaveNow(bool forceFullSave = false)
}
}
}

private void SaveNowInternal(bool forceFullSave = false)
{
if (_domForCurrentPage != null && !_inProcessOfSaving && !NavigatingSoSuspendSaving)
Expand Down Expand Up @@ -1308,7 +1316,7 @@ private void SaveNowInternal(bool forceFullSave = false)
CheckForBL2634("beginning SaveNow");
_inProcessOfSaving = true;
_tasksToDoAfterSaving.Clear();
_view.CleanHtmlAndCopyToPageDom();
_view.GetHtmlFromBrowserAndCopyToPageDom();

//BL-1064 (and several other reports) were about not being able to save a page. The problem appears to be that
//this old code:
Expand Down
4 changes: 2 additions & 2 deletions src/BloomExe/Edit/EditingView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ public void UpdateAllThumbnails()
/// this started as an experiment, where our textareas were not being read when we saved because of the need
/// to change the picture
/// </summary>
public void CleanHtmlAndCopyToPageDom()
public async Task GetHtmlFromBrowserAndCopyToPageDom()
{
// NOTE: these calls to may lead to API calls from the JS. These are async, so the actions
// that JS might perform may not actually happen until well after this method. We ran into a problem in
Expand All @@ -1510,7 +1510,7 @@ public void CleanHtmlAndCopyToPageDom()
userCssContent = combinedData.Substring(endHtml + "<SPLIT-DATA>".Length);
}
}
_browser1.ReadEditableAreasNow(bodyHtml, userCssContent);
_browser1.ReadEditedHtmlNow(bodyHtml, userCssContent); // TODO this makes no sense being in browser. Has nothing to do with the browser.
}

private void _copyButton_Click(object sender, EventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions src/BloomExe/IBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ public void OnOpenPageInEdge(object sender, EventArgs e)
// intentionally letting any errors just escape, give us an error
}

public void ReadEditableAreasNow(string bodyHtml, string userCssContent)
public void ReadEditedHtmlNow(string bodyHtml, string userCssContent)
{
if (Url != "about:blank")
{
LoadPageDomFromBrowser(bodyHtml, userCssContent);
LoadPageDomFromHtml(bodyHtml, userCssContent);
}
}

Expand All @@ -302,7 +302,7 @@ public void ReadEditableAreasNow(string bodyHtml, string userCssContent)
/// We're now obtaining the new content another way, so this code doesn't have any reason
/// to be in this class...but we're aiming for a minimal change, maximal safety fix for 4.9
/// </summary>
private void LoadPageDomFromBrowser(string bodyHtml, string userCssContent)
private void LoadPageDomFromHtml(string bodyHtml, string userCssContent)
{
Debug.Assert(!InvokeRequired);
if (_pageEditDom == null)
Expand Down

0 comments on commit f483d5b

Please sign in to comment.