From d42fdb63cc196c6e346e81d3142e4b585dbe3c52 Mon Sep 17 00:00:00 2001 From: Matthieu Dumont Date: Tue, 26 Apr 2016 19:12:30 +0200 Subject: [PATCH] feat(app): debug parameter --- app/README.md | 1 + app/src/AlgoliasearchZendeskHC.js | 1 + app/src/autocomplete.js | 3 ++- docs/documentation.md | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/README.md b/app/README.md index 8d9dd4dc..bebfda5c 100644 --- a/app/README.md +++ b/app/README.md @@ -56,6 +56,7 @@ Here is a full breakdown of the available options for the JavaScript library: indexPrefix: 'zendesk_', // or your custom baseUrl: '/hc/', // the base URL of your Help Center poweredBy: true, // show the "Search by Algolia" link (required if you're on Algolia's FREE plan) + debug: false, // debug mode prevents the autocomplete to close when trying to inspect it color: '#D4D4D4', // main color (used for links) highlightColor: '#D4D4D4', // highlight color to emphasize matching text responsive: true, // responsive instantsearch page diff --git a/app/src/AlgoliasearchZendeskHC.js b/app/src/AlgoliasearchZendeskHC.js index 4ee39ac3..6efb8d2d 100644 --- a/app/src/AlgoliasearchZendeskHC.js +++ b/app/src/AlgoliasearchZendeskHC.js @@ -20,6 +20,7 @@ const optionsStructure = {required: true, type: 'Object', children: { }}, baseUrl: {type: 'string', value: '/hc/'}, color: {type: 'string', value: '#158EC2'}, + debug: {type: 'boolean', value: false}, highlightColor: {type: 'string'}, indexPrefix: {type: 'string', value: 'zendesk_'}, instantsearch: {type: 'Object', value: {}, children: { diff --git a/app/src/autocomplete.js b/app/src/autocomplete.js index f0fe5e0e..6b4fa7a2 100644 --- a/app/src/autocomplete.js +++ b/app/src/autocomplete.js @@ -37,6 +37,7 @@ class Autocomplete { }, baseUrl, color, + debug, highlightColor, poweredBy, translations @@ -84,7 +85,7 @@ class Autocomplete { $input.setAttribute('placeholder', translations.placeholder_autocomplete); let aa = autocomplete($input, { hint: false, - debug: process.env.NODE_ENV === 'development', + debug: process.env.NODE_ENV === 'development' || debug, templates: this._templates({poweredBy, translations}) }, [{ source: this._source(params), diff --git a/docs/documentation.md b/docs/documentation.md index fbd3e4d7..49c15ef0 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -48,6 +48,7 @@ Here is a full breakdown of the available options for the JavaScript library: indexPrefix: 'zendesk_', // or your custom baseUrl: '/hc/', // the base URL of your Help Center poweredBy: true, // show the "Search by Algolia" link (required if you're on Algolia's FREE plan) + debug: false, // debug mode prevents the autocomplete to close when trying to inspect it color: '#D4D4D4', // main color (used for links) highlightColor: '#D4D4D4', // highlight color to emphasize matching text responsive: true, // responsive instantsearch page