Skip to content

Commit

Permalink
#26 | Field input is now stored in local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
skuzniak committed Jun 8, 2016
1 parent a5b6e3f commit ea06126
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/sc_ext/modules/fieldSearch/FieldSearchModule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference path='../../_all.ts'/>
/// <reference path='ConfigurableDataStore.ts'/>

namespace SitecoreExtensions.Modules.FieldSearch {
export class FieldSearchModule extends ModuleBase implements ISitecoreExtensionsModule {
Expand All @@ -15,6 +16,8 @@ namespace SitecoreExtensions.Modules.FieldSearch {
class: 'scSearchInput scIgnoreModified sc-ext-fieldSearch',
placeholder: 'Search for fields'
});
input.value = ConfigurableDataStore.getInputValue();

var data = this;
input.onkeyup = (e: KeyboardEvent) => {
data.doSearch(e);
Expand Down Expand Up @@ -102,15 +105,18 @@ namespace SitecoreExtensions.Modules.FieldSearch {
var searchString = (<HTMLInputElement>char).value;

if (searchString.length > 2) {
ConfigurableDataStore.storeInputValue(searchString);
this.toggleSections(true);
var hits: Element[] = this.findFields(searchString);
this.unhideResults(hits);
} else {
ConfigurableDataStore.clear();
this.toggleSections(false);
}
};

clearSearch(e: MouseEvent): void {
ConfigurableDataStore.clear();
var char = document.getElementById("scextFieldSearch");
(<HTMLInputElement>char).value = "";
this.toggleSections(false);
Expand Down Expand Up @@ -140,6 +146,8 @@ namespace SitecoreExtensions.Modules.FieldSearch {

var controlsTab = document.querySelector('.scEditorTabControlsTab5');
controlsTab.insertBefore(span, controlsTab.firstChild);

this.doSearch(null);
};

private searchFieldExists(): boolean {
Expand Down

0 comments on commit ea06126

Please sign in to comment.