Permalink
Browse files

Added new bramble API properties to control hints pref

  • Loading branch information...
marcobeltempo committed Dec 22, 2017
1 parent 21e91f1 commit c8d2bd42b6079a9809ed7a11aba2ec9e03daba5d
Showing with 16 additions and 0 deletions.
  1. +3 −0 README.md
  2. +13 −0 src/bramble/client/main.js
@@ -287,6 +287,7 @@ a number of read-only getters are available in order to access state information
* `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).
* `getAllowJavaScript()` - returns the current allow javascript setting as a `Boolean` (i.e., enabled or disabled).
* `getAllowHints()` - returns the current allow hints 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)
@@ -335,6 +336,8 @@ to be notified when the action completes:
* `disableAutoUpdate([callback])` - turns off auto-update for the preview (manual reloads still work)
* `enableJavaScript([callback])` - turns on JavaScript execution for the preview (default)
* `disableJavaScript([callback])` - turns off JavaScript execution for the preview
* `enableHints([callback])` - turns on hints/suggestions for the editor (default)
* `disableHints([callback])` - turns off hints/suggestions for the editor
* `enableInspector([callback])` - turns on the preview inspector (shows code for hovered/clicked element)
* `disableInspector([callback])` - turns off the preview inspector (default)
* `enableWordWrap([callback])` - turns on word wrap for the editor (default)
@@ -314,6 +314,7 @@ define([
self.getAutocomplete = function() { return _state.allowAutocomplete; };
self.getAutoCloseTags = function() { return _state.autoCloseTags; };
self.getAllowJavaScript = function() { return _state.allowJavaScript; };
self.getAllowHints = function() { return _state.allowHints; };
self.getAllowWhiteSpace = function() { return _state.allowWhiteSpace; };
self.getAutoUpdate = function() { return _state.autoUpdate; };
self.getOpenSVGasXML = function() { return _state.openSVGasXML; };
@@ -407,6 +408,7 @@ define([
_state.wordWrap = data.wordWrap;
_state.autoCloseTags = data.autoCloseTags;
_state.allowJavaScript = data.allowJavaScript;
_state.allowHints = data.allowHints;
_state.allowWhiteSpace = data.allowWhiteSpace;
_state.autocomplete = data.autocomplete;
_state.autoUpdate = data.autoUpdate;
@@ -452,6 +454,8 @@ define([
_state.openSVGasXML = data.openSVGasXML;
} else if (eventName === "allowJavaScriptChange") {
_state.allowJavaScript = data.allowJavaScript;
} else if (eventName === "allowHintsChange"){
_state.allowHints = data.allowHints;
} else if (eventName === "allowWhiteSpaceChange") {
_state.allowWhiteSpace = data.allowWhiteSpace;
} else if (eventName === "tutorialVisibilityChange") {
@@ -579,6 +583,7 @@ define([
autoUpdate: _state.autoUpdate,
openSVGasXML: _state.openSVGasXML,
allowJavaScript: _state.allowJavaScript,
allowHints: _state.allowHints,
allowWhiteSpace: _state.allowWhiteSpace,
// Allow overriding the default name for project zip files
zipFilenamePrefix: options.zipFilenamePrefix
@@ -1079,6 +1084,14 @@ define([
this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DISABLE_SCRIPTS"}, callback);
};
BrambleProxy.prototype.enableHints = function(callback) {
this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_ENABLE_HINTS"}, callback);
};
BrambleProxy.prototype.disableHints = function(callback) {
this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DISABLE_HINTS"}, callback);
};
BrambleProxy.prototype.enableWhiteSpace = function(callback) {
this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_ENABLE_WHITESPACE"}, callback);
};

1 comment on commit c8d2bd4

@marcobeltempo

This comment has been minimized.

Owner

marcobeltempo commented on c8d2bd4 Dec 28, 2017

Please sign in to comment.