find_options.js

/* eslint-disable prettier/prettier */
/**
 * Find options
 */
class FindOptions {
  constructor(findBar) {
    this._caseSensitive = false;
    this._highlightAll = false;
    this._wholeWord = false;
    this.findBar = findBar;
  }

  /**
   * Is search case sensitive?
   */
  get caseSensitive() {
    return this._caseSensitive;
  }

  set caseSensitive(val) {
    if (this._caseSensitive === val) {
      return;
    }

    this._caseSensitive = val;
    this.findBar.caseSensitive.checked = val;
  }

  /**
   * Should I highlight all matches?
   */
  get highlightAll() {
    return this._highlightAll;
  }

  set highlightAll(val) {
    if (this._highlightAll === val) {
      return;
    }

    this._highlightAll = val;
    this.findBar.highlightAll.checked = val;
  }

  /**
   * Should I search for whole word only?
   */
  get wholeWord() {
    return this._wholeWord;
  }

  set wholeWord(val) {
    if (this._wholeWord === val) {
      return;
    }

    this._wholeWord = val;
    this.findBar.wholeWord.checked = val;
  }
}

export { FindOptions };