diff --git a/docs/API-Reference/view/PanelView.md b/docs/API-Reference/view/PanelView.md new file mode 100644 index 000000000..c4663e07c --- /dev/null +++ b/docs/API-Reference/view/PanelView.md @@ -0,0 +1,110 @@ +### Import : +```js +const PanelView = brackets.getModule("view/PanelView") +``` + + + +## Panel +**Kind**: global class + +* [Panel](#Panel) + * [new Panel($panel)](#new_Panel_new) + * [.$panel](#Panel+$panel) : jQueryObject + * [.isVisible()](#Panel+isVisible) ⇒ boolean + * [.registerCanBeShownHandler(canShowHandlerFn)](#Panel+registerCanBeShownHandler) ⇒ boolean + * [.canBeShown()](#Panel+canBeShown) ⇒ boolean + * [.show()](#Panel+show) + * [.hide()](#Panel+hide) + * [.setVisible(visible)](#Panel+setVisible) + * [.getPanelType()](#Panel+getPanelType) ⇒ string + + + +### new Panel($panel) +Represents a panel below the editor area (a child of ".content"). + + +| Param | Type | Description | +| --- | --- | --- | +| $panel | jQueryObject | The entire panel, including any chrome, already in the DOM. | + + + +### panel.$panel : jQueryObject +Dom node holding the rendered panel + +**Kind**: instance property of [Panel](#Panel) + + +### panel.isVisible() ⇒ boolean +Determines if the panel is visible + +**Kind**: instance method of [Panel](#Panel) +**Returns**: boolean - true if visible, false if not + + +### panel.registerCanBeShownHandler(canShowHandlerFn) ⇒ boolean +Registers a call back function that will be called just before panel is shown. The handler should return true +if the panel can be shown, else return false and the panel will not be shown. + +**Kind**: instance method of [Panel](#Panel) +**Returns**: boolean - true if visible, false if not + +| Param | Type | Description | +| --- | --- | --- | +| canShowHandlerFn | function \| null | function that should return true of false if the panel can be shown/not. or null to clear the handler. | + + + +### panel.canBeShown() ⇒ boolean +Returns true if th panel can be shown, else false. + +**Kind**: instance method of [Panel](#Panel) + + +### panel.show() +Shows the panel + +**Kind**: instance method of [Panel](#Panel) + + +### panel.hide() +Hides the panel + +**Kind**: instance method of [Panel](#Panel) + + +### panel.setVisible(visible) +Sets the panel's visibility state + +**Kind**: instance method of [Panel](#Panel) + +| Param | Type | Description | +| --- | --- | --- | +| visible | boolean | true to show, false to hide | + + + +### panel.getPanelType() ⇒ string +gets the Panel's type + +**Kind**: instance method of [Panel](#Panel) + + +## EVENT\_PANEL\_HIDDEN : string +Event when panel is hidden + +**Kind**: global constant + + +## EVENT\_PANEL\_SHOWN : string +Event when panel is shown + +**Kind**: global constant + + +## PANEL\_TYPE\_BOTTOM\_PANEL : string +type for bottom panel + +**Kind**: global constant diff --git a/docs/API-Reference/view/PluginPanelView.md b/docs/API-Reference/view/PluginPanelView.md new file mode 100644 index 000000000..43f609b9d --- /dev/null +++ b/docs/API-Reference/view/PluginPanelView.md @@ -0,0 +1,114 @@ +### Import : +```js +const PluginPanelView = brackets.getModule("view/PluginPanelView") +``` + + + +## Panel +**Kind**: global class + +* [Panel](#Panel) + * [new Panel($panel, id, $toolbarIcon, [minWidth], [initialSize])](#new_Panel_new) + * [.$panel](#Panel+$panel) : jQueryObject + * [.isVisible()](#Panel+isVisible) ⇒ boolean + * [.registerCanBeShownHandler(canShowHandlerFn)](#Panel+registerCanBeShownHandler) ⇒ boolean + * [.canBeShown()](#Panel+canBeShown) ⇒ boolean + * [.show()](#Panel+show) + * [.hide()](#Panel+hide) + * [.setVisible(visible)](#Panel+setVisible) + * [.getPanelType()](#Panel+getPanelType) ⇒ string + + + +### new Panel($panel, id, $toolbarIcon, [minWidth], [initialSize]) +Represents a panel below the editor area (a child of ".content"). + + +| Param | Type | Description | +| --- | --- | --- | +| $panel | jQueryObject | The entire panel, including any chrome, already in the DOM. | +| id | string | Unique id for this panel. Use package-style naming, e.g. "myextension.panelname". will overwrite an existing panel id if present. | +| $toolbarIcon | jQueryObject | An icon that should be present in main-toolbar to associate this panel to. The panel will be shown only if the icon is visible on the toolbar and the user clicks on the icon. | +| [minWidth] | number | Minimum width of panel in px. | +| [initialSize] | number | Optional Initial size of panel in px. If not given, panel will use minsize or current size. | + + + +### panel.$panel : jQueryObject +Dom node holding the rendered panel + +**Kind**: instance property of [Panel](#Panel) + + +### panel.isVisible() ⇒ boolean +Determines if the panel is visible + +**Kind**: instance method of [Panel](#Panel) +**Returns**: boolean - true if visible, false if not + + +### panel.registerCanBeShownHandler(canShowHandlerFn) ⇒ boolean +Registers a call back function that will be called just before panel is shown. The handler should return true +if the panel can be shown, else return false and the panel will not be shown. + +**Kind**: instance method of [Panel](#Panel) +**Returns**: boolean - true if visible, false if not + +| Param | Type | Description | +| --- | --- | --- | +| canShowHandlerFn | function \| null | function that should return true of false if the panel can be shown/not. or null to clear the handler. | + + + +### panel.canBeShown() ⇒ boolean +Returns true if th panel can be shown, else false. + +**Kind**: instance method of [Panel](#Panel) + + +### panel.show() +Shows the panel + +**Kind**: instance method of [Panel](#Panel) + + +### panel.hide() +Hides the panel + +**Kind**: instance method of [Panel](#Panel) + + +### panel.setVisible(visible) +Sets the panel's visibility state + +**Kind**: instance method of [Panel](#Panel) + +| Param | Type | Description | +| --- | --- | --- | +| visible | boolean | true to show, false to hide | + + + +### panel.getPanelType() ⇒ string +gets the Panel's type + +**Kind**: instance method of [Panel](#Panel) + + +## EVENT\_PANEL\_HIDDEN : string +Event when panel is hidden + +**Kind**: global constant + + +## EVENT\_PANEL\_SHOWN : string +Event when panel is shown + +**Kind**: global constant + + +## PANEL\_TYPE\_PLUGIN\_PANEL : string +type for plugin panel + +**Kind**: global constant diff --git a/docs/API-Reference/view/ThemeManager.md b/docs/API-Reference/view/ThemeManager.md new file mode 100644 index 000000000..34e47ab73 --- /dev/null +++ b/docs/API-Reference/view/ThemeManager.md @@ -0,0 +1,85 @@ +### Import : +```js +const ThemeManager = brackets.getModule("view/ThemeManager") +``` + + + +## EVENT\_THEME\_CHANGE : string +Event when theme is changed + +**Kind**: global constant + + +## EVENT\_THEME\_LOADED : string +Event when theme is loaded + +**Kind**: global constant + + +## getCurrentTheme() ⇒ [Theme](#new_Theme_new) +Get current theme object that is loaded in the editor. + +**Kind**: global function +**Returns**: [Theme](#new_Theme_new) - the current theme instance + + +## getAllThemes() ⇒ [Array.<Theme>](#new_Theme_new) +Gets all available themes + +**Kind**: global function +**Returns**: [Array.<Theme>](#new_Theme_new) - collection of all available themes + + +## refresh(force) +Refresh current theme in the editor + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| force | boolean | Forces a reload of the current theme. It reloads the theme file. | + + + +## loadFile(fileName, options) ⇒ $.Promise +Loads a theme from a file. + +**Kind**: global function +**Returns**: $.Promise - promise object resolved with the theme to be loaded from fileName + +| Param | Type | Description | +| --- | --- | --- | +| fileName | string | is the full path to the file to be opened | +| options | Object | is an optional parameter to specify metadata for the theme. | + + + +## loadPackage(themePackage) ⇒ $.Promise +Loads a theme from an extension package. + +**Kind**: global function +**Returns**: $.Promise - promise object resolved with the theme to be loaded from the pacakge + +| Param | Type | Description | +| --- | --- | --- | +| themePackage | Object | is a package from the extension manager for the theme to be loaded. | + + + +## isOSInDarkTheme() +Detects if the os settings is set to dark theme or not + +**Kind**: global function + + +## setCurrentTheme(themeID) ⇒ boolean +Sets the current theme for the given theme id if present. + +**Kind**: global function +**Returns**: boolean - true if the theme was applied, else false + +| Param | Type | +| --- | --- | +| themeID | string | + diff --git a/docs/API-Reference/view/ViewCommandHandlers.md b/docs/API-Reference/view/ViewCommandHandlers.md new file mode 100644 index 000000000..00527c335 --- /dev/null +++ b/docs/API-Reference/view/ViewCommandHandlers.md @@ -0,0 +1,70 @@ +### Import : +```js +const ViewCommandHandlers = brackets.getModule("view/ViewCommandHandlers") +``` + + + +## Commands +The ViewCommandHandlers object dispatches the following event(s): + - fontSizeChange -- Triggered when the font size is changed via the + Increase Font Size, Decrease Font Size, or Restore Font Size commands. + The 2nd arg to the listener is the amount of the change. The 3rd arg + is a string containing the new font size after applying the change. + +**Kind**: global variable + + +## validFontSizeRegExpStr +Font sizes should be validated by this regexp + +**Kind**: global variable + + +## setFontSize(fontSize) +Font size setter to set the font size for the document editor + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| fontSize | string | The font size with size unit as 'px' or 'em' | + + + +## getFontSize() ⇒ string +Font size getter to get the current font size for the document editor + +**Kind**: global function +**Returns**: string - Font size with size unit as 'px' or 'em' + + +## setFontFamily(fontFamily) +Font family setter to set the font family for the document editor + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| fontFamily | string | The font family to be set. It can be a string with multiple comma separated fonts | + + + +## getFontFamily() ⇒ string +Font family getter to get the currently configured font family for the document editor + +**Kind**: global function +**Returns**: string - The font family for the document editor + + +## restoreFontSize() +Restores the font size using the saved style and migrates the old fontSizeAdjustment +view state to the new fontSize, when required + +**Kind**: global function + + +## restoreFonts() +Restores the font size and font family back to factory settings. + +**Kind**: global function diff --git a/docs/API-Reference/view/WorkspaceManager.md b/docs/API-Reference/view/WorkspaceManager.md index 6455a081c..34948a266 100644 --- a/docs/API-Reference/view/WorkspaceManager.md +++ b/docs/API-Reference/view/WorkspaceManager.md @@ -3,6 +3,18 @@ const WorkspaceManager = brackets.getModule("view/WorkspaceManager") ``` + + +## PANEL\_TYPE\_BOTTOM\_PANEL : string +Constant representing the type of bottom panel + +**Kind**: global variable + + +## PANEL\_TYPE\_PLUGIN\_PANEL : string +Constant representing the type of plugin panel + +**Kind**: global variable ## AppInit diff --git a/src/view/PanelView.js b/src/view/PanelView.js index c237b19f1..d3c6e266f 100644 --- a/src/view/PanelView.js +++ b/src/view/PanelView.js @@ -16,6 +16,7 @@ * */ +// @INCLUDE_IN_API_DOCS /*global fs, Phoenix, process*/ /*eslint no-console: 0*/ @@ -25,10 +26,29 @@ define(function (require, exports, module) { const EventDispatcher = require("utils/EventDispatcher"), - Resizer = require("utils/Resizer"), - EVENT_PANEL_HIDDEN = 'panelHidden', - EVENT_PANEL_SHOWN = 'panelShown', - PANEL_TYPE_BOTTOM_PANEL = "bottomPanel"; + Resizer = require("utils/Resizer"); + + /** + * Event when panel is hidden + * @type {string} + * @constant + */ + const EVENT_PANEL_HIDDEN = 'panelHidden'; + + /** + * Event when panel is shown + * @type {string} + * @constant + */ + const EVENT_PANEL_SHOWN = 'panelShown'; + + /** + * type for bottom panel + * @type {string} + * @constant + */ + const PANEL_TYPE_BOTTOM_PANEL = 'bottomPanel'; + /** * Represents a panel below the editor area (a child of ".content"). @@ -113,7 +133,7 @@ define(function (require, exports, module) { }; /** - * gets the Panle's type + * gets the Panel's type * @return {string} */ Panel.prototype.getPanelType = function () { diff --git a/src/view/PluginPanelView.js b/src/view/PluginPanelView.js index e1a8ec4a3..8d1e829a4 100644 --- a/src/view/PluginPanelView.js +++ b/src/view/PluginPanelView.js @@ -16,6 +16,7 @@ * */ +// @INCLUDE_IN_API_DOCS /*global fs, Phoenix, process*/ /*eslint no-console: 0*/ @@ -24,10 +25,28 @@ define(function (require, exports, module) { - const EventDispatcher = require("utils/EventDispatcher"), - EVENT_PANEL_SHOWN = "panelShown", - EVENT_PANEL_HIDDEN = "panelHidden", - PANEL_TYPE_PLUGIN_PANEL = "pluginPanel"; + const EventDispatcher = require("utils/EventDispatcher"); + + /** + * Event when panel is hidden + * @type {string} + * @constant + */ + const EVENT_PANEL_HIDDEN = 'panelHidden'; + + /** + * Event when panel is shown + * @type {string} + * @constant + */ + const EVENT_PANEL_SHOWN = 'panelShown'; + + /** + * type for plugin panel + * @type {string} + * @constant + */ + const PANEL_TYPE_PLUGIN_PANEL = 'pluginPanel'; /** * Represents a panel below the editor area (a child of ".content"). @@ -125,7 +144,7 @@ define(function (require, exports, module) { }; /** - * gets the Panle's type + * gets the Panel's type * @return {string} */ Panel.prototype.getPanelType = function () { diff --git a/src/view/ThemeManager.js b/src/view/ThemeManager.js index 6360d52e0..4a06887db 100644 --- a/src/view/ThemeManager.js +++ b/src/view/ThemeManager.js @@ -21,6 +21,8 @@ * */ +// @INCLUDE_IN_API_DOCS + /*jslint regexp: true */ /*global less, path, Phoenix */ @@ -48,8 +50,19 @@ define(function (require, exports, module) { scrollbarsRegex = /((?:[^}|,]*)::-webkit-scrollbar(?:[^{]*)[{](?:[^}]*?)[}])/mgi, stylesPath = FileUtils.getNativeBracketsDirectoryPath() + "/styles/"; - const EVENT_THEME_CHANGE = "themeChange", - EVENT_THEME_LOADED = "themeLoaded"; + /** + * Event when theme is changed + * @type {string} + * @const + */ + const EVENT_THEME_CHANGE = "themeChange"; + + /** + * Event when theme is loaded + * @type {string} + * @const + */ + const EVENT_THEME_LOADED = "themeLoaded"; /** * @private @@ -71,6 +84,7 @@ define(function (require, exports, module) { /** * @constructor + * @private * Theme contains all the essential bit to load a theme from disk, display a theme in the settings * dialog, and to properly add a theme into CodeMirror along with the rest of brackets. * @@ -375,7 +389,7 @@ define(function (require, exports, module) { /** * Loads a theme from a url. - * + * @private * @param {string} url is the full http/https url of the theme file * @param {Object} options is an optional parameter to specify metadata * for the theme. diff --git a/src/view/ViewCommandHandlers.js b/src/view/ViewCommandHandlers.js index 7a4c6045c..280d1b6f3 100644 --- a/src/view/ViewCommandHandlers.js +++ b/src/view/ViewCommandHandlers.js @@ -19,6 +19,8 @@ * */ +// @INCLUDE_IN_API_DOCS + /*global less, Phoenix */ /** @@ -75,12 +77,14 @@ define(function (require, exports, module) { /** * @const * @type {string} + * @private */ var DYNAMIC_FONT_STYLE_ID = "codemirror-dynamic-fonts"; /** * @const * @type {string} + * @private */ var DYNAMIC_FONT_FAMILY_ID = "codemirror-dynamic-font-family"; @@ -340,7 +344,10 @@ define(function (require, exports, module) { return true; } - /** Increases the font size by 1 */ + /** + * Increases the font size by 1 + * @private + */ function _handleIncreaseFontSize() { _adjustFontSize(1); } @@ -385,12 +392,18 @@ define(function (require, exports, module) { } } - /** Decreases the font size by 1 */ + /** + * Decreases the font size by 1 + * @private + */ function _handleDecreaseFontSize() { _adjustFontSize(-1); } - /** Restores the font size to the original size */ + /** + * Restores the font size to the original size + * @private + */ function _handleRestoreFontSize() { setFontSize(DEFAULT_FONT_SIZE + "px"); } @@ -418,6 +431,7 @@ define(function (require, exports, module) { /** * Initializes the different settings that need to loaded + * @private */ function init() { currFontFamily = prefs.get("fontFamily"); @@ -537,17 +551,26 @@ define(function (require, exports, module) { editor.setScrollPos(scrollInfo.left, (textHeight * lines) + removedScroll); } - /** Scrolls one line up */ + /** + * Scrolls one line up + * @private + */ function _handleScrollLineUp() { _scrollLine(-1); } - /** Scrolls one line down */ + /** + * Scrolls one line down + * @private + */ function _handleScrollLineDown() { _scrollLine(1); } - /** Open theme settings dialog */ + /** + * Open theme settings dialog + * @private + */ function _handleThemeSettings() { ThemeSettings.showDialog(); } diff --git a/src/view/WorkspaceManager.js b/src/view/WorkspaceManager.js index 50faee184..bfab7b05d 100644 --- a/src/view/WorkspaceManager.js +++ b/src/view/WorkspaceManager.js @@ -548,6 +548,16 @@ define(function (require, exports, module) { exports.EVENT_WORKSPACE_UPDATE_LAYOUT = EVENT_WORKSPACE_UPDATE_LAYOUT; exports.EVENT_WORKSPACE_PANEL_SHOWN = EVENT_WORKSPACE_PANEL_SHOWN; exports.EVENT_WORKSPACE_PANEL_HIDDEN = EVENT_WORKSPACE_PANEL_HIDDEN; + + /** + * Constant representing the type of bottom panel + * @type {string} + */ exports.PANEL_TYPE_BOTTOM_PANEL = PanelView.PANEL_TYPE_BOTTOM_PANEL; + + /** + * Constant representing the type of plugin panel + * @type {string} + */ exports.PANEL_TYPE_PLUGIN_PANEL = PluginPanelView.PANEL_TYPE_PLUGIN_PANEL; });