From 69ac49eb970fd24a11c7ab6e806cdea5ed2646f1 Mon Sep 17 00:00:00 2001 From: harkirat Date: Fri, 31 Mar 2017 02:35:45 +0530 Subject: [PATCH 01/10] Included new state in StateManager.js --- src/bramble/client/StateManager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bramble/client/StateManager.js b/src/bramble/client/StateManager.js index 97189ffce3b..9502dfb6938 100644 --- a/src/bramble/client/StateManager.js +++ b/src/bramble/client/StateManager.js @@ -139,6 +139,10 @@ define(function() { get: function() { return getBool(storage, "allowJavaScript"); }, set: function(v) { storage.setItem(prefix("allowJavaScript"), v); } }, + allowAutoCorrect: { + get: function() { return getBool(storage, "allowAutoCorrect"); }, + set: function(v) { storage.setItem(prefix("allowAutoCorrect"), v); } + }, autoUpdate: { get: function() { return getBool(storage, "autoUpdate"); }, set: function(v) { storage.setItem(prefix("autoUpdate"), v); } From 85e3a534c22ab5ef88af39ce00d5830ce31b57e1 Mon Sep 17 00:00:00 2001 From: harkirat Date: Fri, 31 Mar 2017 05:19:01 +0530 Subject: [PATCH 02/10] Added events to implement AutoComplete toggle --- src/bramble/client/main.js | 6 ++++++ .../default/bramble/lib/RemoteCommandHandler.js | 9 +++++++++ .../default/bramble/lib/RemoteEvents.js | 16 ++++++++++++++++ src/extensions/default/bramble/lib/UI.js | 6 ++++++ src/extensions/default/bramble/main.js | 1 + 5 files changed, 38 insertions(+) diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index eb68d09c34e..167804ca5a4 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -204,6 +204,7 @@ define([ self.getSidebarVisible = function() { return _state.sidebarVisible; }; self.getRootDir = function() { return _root; }; self.getWordWrap = function() { return _state.wordWrap; }; + self.getAutoCorrect = function() { return _state.allowAutoCorrect; }; self.getAutoCloseTags = function() { return _state.autoCloseTags; }; self.getAllowJavaScript = function() { return _state.allowJavaScript; }; self.getAutoUpdate = function() { return _state.autoUpdate; }; @@ -267,6 +268,7 @@ define([ _state.wordWrap = data.wordWrap; _state.autoCloseTags = data.autoCloseTags; _state.allowJavaScript = data.allowJavaScript; + _state.autoCorrect = data.autoCorrect; _state.autoUpdate = data.autoUpdate; setReadyState(Bramble.READY); @@ -309,6 +311,10 @@ define([ _state.allowJavaScript = data.allowJavaScript; } else if (eventName === "tutorialVisibilityChange") { _tutorialVisible = data.visible; + } else if (eventName === "TagHintsChange") { + _state.allowAutoCorrect = data.value; + } else if (eventName === "AttrHintsChange") { + _state.allowAutoCorrect = data.value; } else if (eventName === "autoUpdateChange") { _state.autoUpdate = data.autoUpdate; } diff --git a/src/extensions/default/bramble/lib/RemoteCommandHandler.js b/src/extensions/default/bramble/lib/RemoteCommandHandler.js index 3771c0b9e71..dd967e29396 100644 --- a/src/extensions/default/bramble/lib/RemoteCommandHandler.js +++ b/src/extensions/default/bramble/lib/RemoteCommandHandler.js @@ -102,6 +102,15 @@ define(function (require, exports, module) { case "BRAMBLE_ENABLE_INSPECTOR": MouseManager.enableInspector(); break; + case "STOP_AUTO_COMPLETE": + PreferencesManager.set("codehint.TagHints", true); + PreferencesManager.set("codehint.AttrHints", true); + break; + case "START_AUTO_COMPLETE": + PreferencesManager.set("codehint.TagHints", false); + PreferencesManager.set("codehint.AttrHints", false); + break; + case "BRAMBLE_DISABLE_INSPECTOR": // Disable the inspector, and clear any marks in the preview/editor MouseManager.disableInspector(true); diff --git a/src/extensions/default/bramble/lib/RemoteEvents.js b/src/extensions/default/bramble/lib/RemoteEvents.js index 462ab32c01b..6c5daa19a96 100644 --- a/src/extensions/default/bramble/lib/RemoteEvents.js +++ b/src/extensions/default/bramble/lib/RemoteEvents.js @@ -157,6 +157,22 @@ define(function (require, exports, module) { }); }); + // Listen for changes to allow TagHints + PreferencesManager.on("change", "codehint.TagHints", function () { + sendEvent({ + type: "bramble:TagHintsChange", + value: PreferencesManager.get("codehint.TagHints") + }); + }); + + // Listen for changes to AttrHints + PreferencesManager.on("change", "codehint.AttrHints", function () { + sendEvent({ + type: "bramble:AttrHintsChange", + value: PreferencesManager.get("codehint.AttrHints") + }); + }); + //Listen for changes to auto update PreferencesManager.on("change", "autoUpdate", function () { sendEvent({ diff --git a/src/extensions/default/bramble/lib/UI.js b/src/extensions/default/bramble/lib/UI.js index 2368fc456df..9283889a4d6 100644 --- a/src/extensions/default/bramble/lib/UI.js +++ b/src/extensions/default/bramble/lib/UI.js @@ -98,6 +98,12 @@ define(function (require, exports, module) { PreferencesManager.set("allowJavaScript", allowJavaScript); } + var allowAutoCorrect = BrambleStartupState.ui("allowAutoCorrect"); + if(typeof allowAutoCorrect === "boolean") { + PreferencesManager.set("codehint.AttrHints", allowAutoCorrect); + PreferencesManager.set("codehint.TagHints", allowAutoCorrect); + } + var autoUpdate = BrambleStartupState.ui("autoUpdate"); if(typeof autoUpdate === "boolean") { PreferencesManager.set("autoUpdate", autoUpdate); diff --git a/src/extensions/default/bramble/main.js b/src/extensions/default/bramble/main.js index 54e0a8cd345..349dc098ebc 100644 --- a/src/extensions/default/bramble/main.js +++ b/src/extensions/default/bramble/main.js @@ -190,6 +190,7 @@ define(function (require, exports, module) { previewMode: data.state.previewMode, wordWrap: data.state.wordWrap, allowJavaScript: data.state.allowJavaScript, + allowAutoCorrect: data.state.allowAutoCorrect, autoCloseTags: data.state.autoCloseTags, autoUpdate: data.state.autoUpdate }); From fb208bc68e55334256fa51c5ee97d6960400ec67 Mon Sep 17 00:00:00 2001 From: harkirat Date: Fri, 31 Mar 2017 05:47:39 +0530 Subject: [PATCH 03/10] Added start and stop functions in bramble --- src/bramble/client/main.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index 167804ca5a4..ed4960cbfbe 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -915,6 +915,14 @@ define([ this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DISABLE_SCRIPTS"}, callback); }; + BrambleProxy.prototype.startAutoComplete = function(callback) { + this._executeRemoteCommand({commandCategory: "bramble", command: "START_AUTO_COMPLETE"}, callback); + }; + + BrambleProxy.prototype.stopAutoComplete = function(callback) { + this._executeRemoteCommand({commandCategory: "bramble", command: "STOP_AUTO_COMPLETE"}, callback); + }; + BrambleProxy.prototype.enableInspector = function(callback) { this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_ENABLE_INSPECTOR"}, callback); }; From 7bf5372d2d7a1cdceaead60a5b529984205036dc Mon Sep 17 00:00:00 2001 From: harkirat Date: Fri, 31 Mar 2017 17:19:34 +0530 Subject: [PATCH 04/10] Added allowAutoCorrect to main.js --- src/bramble/client/main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index ed4960cbfbe..47e89ebc5a3 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -432,6 +432,7 @@ define([ previewMode: _state.previewMode, wordWrap: _state.wordWrap, allowJavaScript: _state.allowJavaScript, + allowAutoCorrect: _state.allowAutoCorrect, autoCloseTags: _state.autoCloseTags, autoUpdate: _state.autoUpdate } From 7e423d10922bfdb81f0b1557bc3cdaebcb0fb98a Mon Sep 17 00:00:00 2001 From: harkirat Date: Fri, 31 Mar 2017 17:50:38 +0530 Subject: [PATCH 05/10] Fixes typos --- src/bramble/client/StateManager.js | 6 +++--- src/bramble/client/main.js | 10 +++++----- src/extensions/default/bramble/lib/RemoteEvents.js | 2 +- src/extensions/default/bramble/lib/UI.js | 8 ++++---- src/extensions/default/bramble/main.js | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/bramble/client/StateManager.js b/src/bramble/client/StateManager.js index 9502dfb6938..b767041b407 100644 --- a/src/bramble/client/StateManager.js +++ b/src/bramble/client/StateManager.js @@ -139,9 +139,9 @@ define(function() { get: function() { return getBool(storage, "allowJavaScript"); }, set: function(v) { storage.setItem(prefix("allowJavaScript"), v); } }, - allowAutoCorrect: { - get: function() { return getBool(storage, "allowAutoCorrect"); }, - set: function(v) { storage.setItem(prefix("allowAutoCorrect"), v); } + allowAutoComplete: { + get: function() { return getBool(storage, "allowAutoComplete"); }, + set: function(v) { storage.setItem(prefix("allowAutoComplete"), v); } }, autoUpdate: { get: function() { return getBool(storage, "autoUpdate"); }, diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index 47e89ebc5a3..c66b9799f81 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -204,7 +204,7 @@ define([ self.getSidebarVisible = function() { return _state.sidebarVisible; }; self.getRootDir = function() { return _root; }; self.getWordWrap = function() { return _state.wordWrap; }; - self.getAutoCorrect = function() { return _state.allowAutoCorrect; }; + self.getAutoComplete = function() { return _state.allowAutoComplete; }; self.getAutoCloseTags = function() { return _state.autoCloseTags; }; self.getAllowJavaScript = function() { return _state.allowJavaScript; }; self.getAutoUpdate = function() { return _state.autoUpdate; }; @@ -268,7 +268,7 @@ define([ _state.wordWrap = data.wordWrap; _state.autoCloseTags = data.autoCloseTags; _state.allowJavaScript = data.allowJavaScript; - _state.autoCorrect = data.autoCorrect; + _state.autoComplete = data.autoComplete; _state.autoUpdate = data.autoUpdate; setReadyState(Bramble.READY); @@ -312,9 +312,9 @@ define([ } else if (eventName === "tutorialVisibilityChange") { _tutorialVisible = data.visible; } else if (eventName === "TagHintsChange") { - _state.allowAutoCorrect = data.value; + _state.allowAutoComplete = data.value; } else if (eventName === "AttrHintsChange") { - _state.allowAutoCorrect = data.value; + _state.allowAutoComplete = data.value; } else if (eventName === "autoUpdateChange") { _state.autoUpdate = data.autoUpdate; } @@ -432,7 +432,7 @@ define([ previewMode: _state.previewMode, wordWrap: _state.wordWrap, allowJavaScript: _state.allowJavaScript, - allowAutoCorrect: _state.allowAutoCorrect, + allowAutoComplete: _state.allowAutoComplete, autoCloseTags: _state.autoCloseTags, autoUpdate: _state.autoUpdate } diff --git a/src/extensions/default/bramble/lib/RemoteEvents.js b/src/extensions/default/bramble/lib/RemoteEvents.js index 6c5daa19a96..40d1547daed 100644 --- a/src/extensions/default/bramble/lib/RemoteEvents.js +++ b/src/extensions/default/bramble/lib/RemoteEvents.js @@ -157,7 +157,7 @@ define(function (require, exports, module) { }); }); - // Listen for changes to allow TagHints + // Listen for changes to TagHints PreferencesManager.on("change", "codehint.TagHints", function () { sendEvent({ type: "bramble:TagHintsChange", diff --git a/src/extensions/default/bramble/lib/UI.js b/src/extensions/default/bramble/lib/UI.js index 9283889a4d6..0c93f01019a 100644 --- a/src/extensions/default/bramble/lib/UI.js +++ b/src/extensions/default/bramble/lib/UI.js @@ -98,10 +98,10 @@ define(function (require, exports, module) { PreferencesManager.set("allowJavaScript", allowJavaScript); } - var allowAutoCorrect = BrambleStartupState.ui("allowAutoCorrect"); - if(typeof allowAutoCorrect === "boolean") { - PreferencesManager.set("codehint.AttrHints", allowAutoCorrect); - PreferencesManager.set("codehint.TagHints", allowAutoCorrect); + var allowAutoComplete = BrambleStartupState.ui("allowAutoComplete"); + if(typeof allowAutoComplete === "boolean") { + PreferencesManager.set("codehint.AttrHints", allowAutoComplete); + PreferencesManager.set("codehint.TagHints", allowAutoComplete); } var autoUpdate = BrambleStartupState.ui("autoUpdate"); diff --git a/src/extensions/default/bramble/main.js b/src/extensions/default/bramble/main.js index 349dc098ebc..c60d68aaac4 100644 --- a/src/extensions/default/bramble/main.js +++ b/src/extensions/default/bramble/main.js @@ -190,7 +190,7 @@ define(function (require, exports, module) { previewMode: data.state.previewMode, wordWrap: data.state.wordWrap, allowJavaScript: data.state.allowJavaScript, - allowAutoCorrect: data.state.allowAutoCorrect, + allowAutoComplete: data.state.allowAutoComplete, autoCloseTags: data.state.autoCloseTags, autoUpdate: data.state.autoUpdate }); From c82a850178e75da0b24daa9942168a18faf864bc Mon Sep 17 00:00:00 2001 From: harkirat Date: Tue, 4 Apr 2017 13:26:43 +0530 Subject: [PATCH 06/10] Added toggle functionality to JS and CSS hints --- src/bramble/client/main.js | 4 ++++ .../bramble/lib/RemoteCommandHandler.js | 4 ++++ .../default/bramble/lib/RemoteEvents.js | 18 ++++++++++++++++++ src/extensions/default/bramble/lib/UI.js | 2 ++ 4 files changed, 28 insertions(+) diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index c66b9799f81..e68efffd4b3 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -315,6 +315,10 @@ define([ _state.allowAutoComplete = data.value; } else if (eventName === "AttrHintsChange") { _state.allowAutoComplete = data.value; + } else if (eventName === "JSHintsChange") { + _state.allowAutoComplete = data.value; + } else if (eventName === "CssPropHintsChange") { + _state.allowAutoComplete = data.value; } else if (eventName === "autoUpdateChange") { _state.autoUpdate = data.autoUpdate; } diff --git a/src/extensions/default/bramble/lib/RemoteCommandHandler.js b/src/extensions/default/bramble/lib/RemoteCommandHandler.js index dd967e29396..b59f5ccf32a 100644 --- a/src/extensions/default/bramble/lib/RemoteCommandHandler.js +++ b/src/extensions/default/bramble/lib/RemoteCommandHandler.js @@ -105,10 +105,14 @@ define(function (require, exports, module) { case "STOP_AUTO_COMPLETE": PreferencesManager.set("codehint.TagHints", true); PreferencesManager.set("codehint.AttrHints", true); + PreferencesManager.set("codehint.JSHints", true); + PreferencesManager.set("codehint.CssPropHints", true); break; case "START_AUTO_COMPLETE": PreferencesManager.set("codehint.TagHints", false); PreferencesManager.set("codehint.AttrHints", false); + PreferencesManager.set("codehint.JSHints", false); + PreferencesManager.set("codehint.CssPropHints", false); break; case "BRAMBLE_DISABLE_INSPECTOR": diff --git a/src/extensions/default/bramble/lib/RemoteEvents.js b/src/extensions/default/bramble/lib/RemoteEvents.js index 40d1547daed..8b8368947fc 100644 --- a/src/extensions/default/bramble/lib/RemoteEvents.js +++ b/src/extensions/default/bramble/lib/RemoteEvents.js @@ -173,6 +173,24 @@ define(function (require, exports, module) { }); }); + + // Listen for changes to JSHints + PreferencesManager.on("change", "codehint.JSHints", function () { + sendEvent({ + type: "bramble:JSHintsChange", + value: PreferencesManager.get("codehint.JSHints") + }); + }); + + + // Listen for changes to CssPropHints + PreferencesManager.on("change", "codehint.CssPropHints", function () { + sendEvent({ + type: "bramble:CssPropHintsChange", + value: PreferencesManager.get("codehint.CssPropHints") + }); + }); + //Listen for changes to auto update PreferencesManager.on("change", "autoUpdate", function () { sendEvent({ diff --git a/src/extensions/default/bramble/lib/UI.js b/src/extensions/default/bramble/lib/UI.js index 0c93f01019a..a89aec57528 100644 --- a/src/extensions/default/bramble/lib/UI.js +++ b/src/extensions/default/bramble/lib/UI.js @@ -102,6 +102,8 @@ define(function (require, exports, module) { if(typeof allowAutoComplete === "boolean") { PreferencesManager.set("codehint.AttrHints", allowAutoComplete); PreferencesManager.set("codehint.TagHints", allowAutoComplete); + PreferencesManager.set("codehint.JSHints", allowAutoComplete); + PreferencesManager.set("codehint.CssPropHints", allowAutoComplete); } var autoUpdate = BrambleStartupState.ui("autoUpdate"); From c50d758f79492560da35027ceaf9eeb4312cd3f0 Mon Sep 17 00:00:00 2001 From: harkirat Date: Thu, 6 Apr 2017 14:50:54 +0530 Subject: [PATCH 07/10] Changed all variable names to Autocomplete --- src/bramble/client/StateManager.js | 6 +++--- src/bramble/client/main.js | 18 +++++++++--------- src/extensions/default/bramble/lib/UI.js | 12 ++++++------ src/extensions/default/bramble/main.js | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/bramble/client/StateManager.js b/src/bramble/client/StateManager.js index b767041b407..968539cb758 100644 --- a/src/bramble/client/StateManager.js +++ b/src/bramble/client/StateManager.js @@ -139,9 +139,9 @@ define(function() { get: function() { return getBool(storage, "allowJavaScript"); }, set: function(v) { storage.setItem(prefix("allowJavaScript"), v); } }, - allowAutoComplete: { - get: function() { return getBool(storage, "allowAutoComplete"); }, - set: function(v) { storage.setItem(prefix("allowAutoComplete"), v); } + allowAutocomplete: { + get: function() { return getBool(storage, "allowAutocomplete"); }, + set: function(v) { storage.setItem(prefix("allowAutocomplete"), v); } }, autoUpdate: { get: function() { return getBool(storage, "autoUpdate"); }, diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index e68efffd4b3..c615e4b1425 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -204,7 +204,7 @@ define([ self.getSidebarVisible = function() { return _state.sidebarVisible; }; self.getRootDir = function() { return _root; }; self.getWordWrap = function() { return _state.wordWrap; }; - self.getAutoComplete = function() { return _state.allowAutoComplete; }; + self.getAutocomplete = function() { return _state.allowAutocomplete; }; self.getAutoCloseTags = function() { return _state.autoCloseTags; }; self.getAllowJavaScript = function() { return _state.allowJavaScript; }; self.getAutoUpdate = function() { return _state.autoUpdate; }; @@ -268,7 +268,7 @@ define([ _state.wordWrap = data.wordWrap; _state.autoCloseTags = data.autoCloseTags; _state.allowJavaScript = data.allowJavaScript; - _state.autoComplete = data.autoComplete; + _state.autocomplete = data.autocomplete; _state.autoUpdate = data.autoUpdate; setReadyState(Bramble.READY); @@ -312,13 +312,13 @@ define([ } else if (eventName === "tutorialVisibilityChange") { _tutorialVisible = data.visible; } else if (eventName === "TagHintsChange") { - _state.allowAutoComplete = data.value; + _state.allowAutocomplete = data.value; } else if (eventName === "AttrHintsChange") { - _state.allowAutoComplete = data.value; + _state.allowAutocomplete = data.value; } else if (eventName === "JSHintsChange") { - _state.allowAutoComplete = data.value; + _state.allowAutocomplete = data.value; } else if (eventName === "CssPropHintsChange") { - _state.allowAutoComplete = data.value; + _state.allowAutocomplete = data.value; } else if (eventName === "autoUpdateChange") { _state.autoUpdate = data.autoUpdate; } @@ -436,7 +436,7 @@ define([ previewMode: _state.previewMode, wordWrap: _state.wordWrap, allowJavaScript: _state.allowJavaScript, - allowAutoComplete: _state.allowAutoComplete, + allowAutocomplete: _state.allowAutocomplete, autoCloseTags: _state.autoCloseTags, autoUpdate: _state.autoUpdate } @@ -920,11 +920,11 @@ define([ this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DISABLE_SCRIPTS"}, callback); }; - BrambleProxy.prototype.startAutoComplete = function(callback) { + BrambleProxy.prototype.enableAutocomplete = function(callback) { this._executeRemoteCommand({commandCategory: "bramble", command: "START_AUTO_COMPLETE"}, callback); }; - BrambleProxy.prototype.stopAutoComplete = function(callback) { + BrambleProxy.prototype.disableAutocomplete = function(callback) { this._executeRemoteCommand({commandCategory: "bramble", command: "STOP_AUTO_COMPLETE"}, callback); }; diff --git a/src/extensions/default/bramble/lib/UI.js b/src/extensions/default/bramble/lib/UI.js index a89aec57528..043923746fa 100644 --- a/src/extensions/default/bramble/lib/UI.js +++ b/src/extensions/default/bramble/lib/UI.js @@ -98,12 +98,12 @@ define(function (require, exports, module) { PreferencesManager.set("allowJavaScript", allowJavaScript); } - var allowAutoComplete = BrambleStartupState.ui("allowAutoComplete"); - if(typeof allowAutoComplete === "boolean") { - PreferencesManager.set("codehint.AttrHints", allowAutoComplete); - PreferencesManager.set("codehint.TagHints", allowAutoComplete); - PreferencesManager.set("codehint.JSHints", allowAutoComplete); - PreferencesManager.set("codehint.CssPropHints", allowAutoComplete); + var allowAutocomplete = BrambleStartupState.ui("allowAutocomplete"); + if(typeof allowAutocomplete === "boolean") { + PreferencesManager.set("codehint.AttrHints", allowAutocomplete); + PreferencesManager.set("codehint.TagHints", allowAutocomplete); + PreferencesManager.set("codehint.JSHints", allowAutocomplete); + PreferencesManager.set("codehint.CssPropHints", allowAutocomplete); } var autoUpdate = BrambleStartupState.ui("autoUpdate"); diff --git a/src/extensions/default/bramble/main.js b/src/extensions/default/bramble/main.js index c60d68aaac4..1e2afefee46 100644 --- a/src/extensions/default/bramble/main.js +++ b/src/extensions/default/bramble/main.js @@ -190,7 +190,7 @@ define(function (require, exports, module) { previewMode: data.state.previewMode, wordWrap: data.state.wordWrap, allowJavaScript: data.state.allowJavaScript, - allowAutoComplete: data.state.allowAutoComplete, + allowAutocomplete: data.state.allowAutocomplete, autoCloseTags: data.state.autoCloseTags, autoUpdate: data.state.autoUpdate }); From 2b23253164cdfa515dac1d19542a17e47ee79926 Mon Sep 17 00:00:00 2001 From: harkirat Date: Thu, 6 Apr 2017 14:56:27 +0530 Subject: [PATCH 08/10] Emitted a single event(autocompleteChange) when Hints Change --- src/bramble/client/main.js | 8 +------- src/extensions/default/bramble/lib/RemoteEvents.js | 8 ++++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index c615e4b1425..3d9287b454b 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -311,13 +311,7 @@ define([ _state.allowJavaScript = data.allowJavaScript; } else if (eventName === "tutorialVisibilityChange") { _tutorialVisible = data.visible; - } else if (eventName === "TagHintsChange") { - _state.allowAutocomplete = data.value; - } else if (eventName === "AttrHintsChange") { - _state.allowAutocomplete = data.value; - } else if (eventName === "JSHintsChange") { - _state.allowAutocomplete = data.value; - } else if (eventName === "CssPropHintsChange") { + } else if (eventName === "autocompleteChange") { _state.allowAutocomplete = data.value; } else if (eventName === "autoUpdateChange") { _state.autoUpdate = data.autoUpdate; diff --git a/src/extensions/default/bramble/lib/RemoteEvents.js b/src/extensions/default/bramble/lib/RemoteEvents.js index 8b8368947fc..a8ec16710b0 100644 --- a/src/extensions/default/bramble/lib/RemoteEvents.js +++ b/src/extensions/default/bramble/lib/RemoteEvents.js @@ -160,7 +160,7 @@ define(function (require, exports, module) { // Listen for changes to TagHints PreferencesManager.on("change", "codehint.TagHints", function () { sendEvent({ - type: "bramble:TagHintsChange", + type: "bramble:autocompleteChange", value: PreferencesManager.get("codehint.TagHints") }); }); @@ -168,7 +168,7 @@ define(function (require, exports, module) { // Listen for changes to AttrHints PreferencesManager.on("change", "codehint.AttrHints", function () { sendEvent({ - type: "bramble:AttrHintsChange", + type: "bramble:autocompleteChange", value: PreferencesManager.get("codehint.AttrHints") }); }); @@ -177,7 +177,7 @@ define(function (require, exports, module) { // Listen for changes to JSHints PreferencesManager.on("change", "codehint.JSHints", function () { sendEvent({ - type: "bramble:JSHintsChange", + type: "bramble:autocompleteChange", value: PreferencesManager.get("codehint.JSHints") }); }); @@ -186,7 +186,7 @@ define(function (require, exports, module) { // Listen for changes to CssPropHints PreferencesManager.on("change", "codehint.CssPropHints", function () { sendEvent({ - type: "bramble:CssPropHintsChange", + type: "bramble:autocompleteChange", value: PreferencesManager.get("codehint.CssPropHints") }); }); From b1dc373a7154d5de98553e08e8ee75fb90df6ab3 Mon Sep 17 00:00:00 2001 From: harkirat Date: Thu, 6 Apr 2017 15:34:44 +0530 Subject: [PATCH 09/10] Added note in README related to new getAutocomplete function --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3aa81231f74..a0d9c4f3d02 100644 --- a/README.md +++ b/README.md @@ -310,6 +310,7 @@ a number of read-only getters are available in order to access state information * `getTheme()` - returns the name of the current theme. * `getFontSize()` - returns the current font size as a string (e.g., `"12px"`). * `getWordWrap()` - returns the current word wrap setting as a `Boolean` (i.e., enabled or disabled). +* `getAutocomplete()` - returns the current autocomplete settings as a `Boolean` (i.e., enabled or disabled). * `getAutoCloseTags()` - returns the current close tags setting as an `Object` with three properties: `whenOpening` a boolean that determines whether opening tags are closed upon typing ">", `whenClosing` a boolean that determines whether closing tags are closed upon typing "/", and an array of tags `indentTags`, that when opened, has a blank line. These values default to, respectively: `true`, `true`, and an empty array. * `getTutorialExists()` - returns `true` or `false` depending on whether or not there is a tutorial in the project (i.e., if `tutorial.html` is present) * `getTutorialVisible()` - returns `true` or `false` depending on whether or not the preview browser is showing a tutorial or not. From 709988076a365844cbb06c9845481b2ae4183d63 Mon Sep 17 00:00:00 2001 From: harkirat Date: Thu, 6 Apr 2017 18:31:14 +0530 Subject: [PATCH 10/10] Modified Remote Command Strings --- src/bramble/client/main.js | 4 ++-- src/extensions/default/bramble/lib/RemoteCommandHandler.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bramble/client/main.js b/src/bramble/client/main.js index 3d9287b454b..c264bb8fb58 100644 --- a/src/bramble/client/main.js +++ b/src/bramble/client/main.js @@ -915,11 +915,11 @@ define([ }; BrambleProxy.prototype.enableAutocomplete = function(callback) { - this._executeRemoteCommand({commandCategory: "bramble", command: "START_AUTO_COMPLETE"}, callback); + this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_ENABLE_AUTOCOMPLETE"}, callback); }; BrambleProxy.prototype.disableAutocomplete = function(callback) { - this._executeRemoteCommand({commandCategory: "bramble", command: "STOP_AUTO_COMPLETE"}, callback); + this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DISABLE_AUTOCOMPLETE"}, callback); }; BrambleProxy.prototype.enableInspector = function(callback) { diff --git a/src/extensions/default/bramble/lib/RemoteCommandHandler.js b/src/extensions/default/bramble/lib/RemoteCommandHandler.js index b59f5ccf32a..f74b7bc0fa5 100644 --- a/src/extensions/default/bramble/lib/RemoteCommandHandler.js +++ b/src/extensions/default/bramble/lib/RemoteCommandHandler.js @@ -102,13 +102,13 @@ define(function (require, exports, module) { case "BRAMBLE_ENABLE_INSPECTOR": MouseManager.enableInspector(); break; - case "STOP_AUTO_COMPLETE": + case "BRAMBLE_ENABLE_AUTOCOMPLETE": PreferencesManager.set("codehint.TagHints", true); PreferencesManager.set("codehint.AttrHints", true); PreferencesManager.set("codehint.JSHints", true); PreferencesManager.set("codehint.CssPropHints", true); break; - case "START_AUTO_COMPLETE": + case "BRAMBLE_DISABLE_AUTOCOMPLETE": PreferencesManager.set("codehint.TagHints", false); PreferencesManager.set("codehint.AttrHints", false); PreferencesManager.set("codehint.JSHints", false);