@internetarchive/bookreader 5.0.0-44-a1 → 5.0.0-44-a4

Sign up to get free protection for your applications and to get access to all the features.
@@ -217,6 +217,12 @@ BookReader.prototype.search = async function(term = '', overrides = {}) {
217
217
  cache: true,
218
218
  beforeSend: xhr => { this.searchXHR = xhr; },
219
219
  }));
220
+
221
+ if (!this.searchTerm) {
222
+ this.bookreader?.urlPlugin?.removeUrlParam('q');
223
+ } else {
224
+ this.bookreader?.urlPlugin?.setUrlParam('q', this.searchTerm);
225
+ }
220
226
  };
221
227
 
222
228
  /**
@@ -230,6 +236,7 @@ BookReader.prototype._cancelSearch = function () {
230
236
  this.searchXHR = null;
231
237
  this.searchCancelled = true;
232
238
  this.searchResults = [];
239
+ this.bookreader?.urlPlugin?.removeUrlParam('q');
233
240
  };
234
241
 
235
242
  /**
@@ -243,6 +250,7 @@ BookReader.prototype.cancelSearchRequest = function () {
243
250
  this.searchView.toggleSearchPending();
244
251
  this.trigger('SearchCanceled', { term: this.searchTerm, instance: this });
245
252
  }
253
+ this?.urlPlugin?.removeUrlParam('q');
246
254
  };
247
255
 
248
256
  /**
@@ -118,6 +118,7 @@ export class UrlPlugin {
118
118
  * @param {string} key
119
119
  */
120
120
  removeUrlParam(key) {
121
+ console.log(' removeUrlParam removeUrlParam ', { key, urlState: this.urlState });
121
122
  delete this.urlState[key];
122
123
 
123
124
  this.pushToAddressBar();