Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
src/Bloom.suo
*.user
lib/GeckoFx/Skybound.Gecko/*
output/*
lib/GeckoFx/Skybound.Gecko/
output/
*/.svn
*/bin/*
*/obj
bin/
obj/
userProject
templates/A4LandscapeBooklet/starter.pdf
src/_ReSharper.Bloom/*
Expand Down Expand Up @@ -89,6 +89,6 @@ DistFiles/ReleaseNotes.html
ReadMe_*.html
B3.sln
B2.sln
node_modules/*
node_modules/
*.usertasks
Andika-R.ttf
15 changes: 1 addition & 14 deletions src/BloomBrowserUI/bookEdit/readerSetup/readerSetup.ui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions src/BloomBrowserUI/bookEdit/readerSetup/readerSetup.ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,20 +610,6 @@ function firstSetupLetters(): boolean {
return false;
}

/**
* Fires an event for C# to handle.
* The listeners in C# are set up in EditingModel.cs, in the function "DocumentCompleted()", and using this
* syntax: _view.AddMessageEventListener("nameOfEvent", FunctionThatHandlesTheEvent);
* @param {String} eventName
* @param {String} eventData Note: use JSON.stringify if passing object data.
*/
function fireCSharpSetupEvent(eventName: string, eventData: any) {

//noinspection TaskProblemsInspection
var event = new MessageEvent(eventName, {'view' : window, 'bubbles' : true, 'cancelable' : true, 'data' : eventData});
document.dispatchEvent(event);
}

/**
* Event handlers
*
Expand All @@ -636,7 +622,7 @@ function attachEventHandlers(): void {
if (typeof ($) === "function") {

$("#open-text-folder").onOnce('click', function() {
fireCSharpSetupEvent('openTextsFolderEvent', 'open');
getIframeChannel().simpleAjaxNoCallback('/bloom/readers/openTextsFolder');
return false;
});

Expand Down
11 changes: 0 additions & 11 deletions src/BloomExe/Edit/EditingModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ void OnIdleAfterDocumentSupposedlyCompleted(object sender, EventArgs e)
}
// listen for events raised by javascript
_view.AddMessageEventListener("saveAccordionSettingsEvent", SaveAccordionSettings);
_view.AddMessageEventListener("openTextsFolderEvent", OpenTextsFolder);
_view.AddMessageEventListener("setModalStateEvent", SetModalState);
_view.AddMessageEventListener("preparePageForEditingAfterOrigamiChangesEvent", PreparePageForEditingAfterOrigamiChanges);
}
Expand Down Expand Up @@ -695,16 +694,6 @@ private static string CleanUpJsonDataForJavascript(string jsonData)
return CleanUpDataForJavascript(jsonData);
}

/// <summary>Opens Explorer (or Linux equivalent) displaying the contents of the Sample Texts directory</summary>
/// <param name="arg">Not Used, but required because it is being called by a javascrip MessageEvent</param>
private void OpenTextsFolder(string arg)
{
if (_collectionSettings.SettingsFilePath == null) return;
var path = Path.Combine(Path.GetDirectoryName(_collectionSettings.SettingsFilePath), "Sample Texts");
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
Process.Start(path);
}

private string MakeAccordionContent()
{
var path = FileLocator.GetFileDistributedWithApplication("BloomBrowserUI/bookEdit/accordion", "Accordion.htm");
Expand Down
14 changes: 14 additions & 0 deletions src/BloomExe/web/ReadersHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ public static bool HandleRequest(string localPath, IRequestInfo info, Collection
info.ContentType = "text/plain";
info.WriteCompleteOutput("OK");
return true;

case "openTextsFolder":
OpenTextsFolder();
info.ContentType = "text/plain";
info.WriteCompleteOutput("OK");
return true;
}

return false;
Expand Down Expand Up @@ -275,5 +281,13 @@ private static string SaveReaderToolsWordsFile(string jsonString)

return "OK";
}

private static void OpenTextsFolder()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the code which was doing this before (from the event) be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should, my mistake.

{
if (CurrentBook.CollectionSettings.SettingsFilePath == null) return;
var path = Path.Combine(Path.GetDirectoryName(CurrentBook.CollectionSettings.SettingsFilePath), "Sample Texts");
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
Process.Start(path);
}
}
}