diff --git a/docs/API-Reference/command/Commands.md b/docs/API-Reference/command/Commands.md
index 65772392f9..d3ef7ac883 100644
--- a/docs/API-Reference/command/Commands.md
+++ b/docs/API-Reference/command/Commands.md
@@ -1053,3 +1053,15 @@ Shows authors of current file
Toggles display of untracked files
**Kind**: global variable
+
+
+## CMD\_GIT\_HISTORY\_GLOBAL
+Toggles global history view in history panel
+
+**Kind**: global variable
+
+
+## CMD\_GIT\_HISTORY\_FILE
+Toggles file history view in history panel
+
+**Kind**: global variable
diff --git a/docs/API-Reference/file/FileUtils.md b/docs/API-Reference/file/FileUtils.md
index d5030c7317..b364a88850 100644
--- a/docs/API-Reference/file/FileUtils.md
+++ b/docs/API-Reference/file/FileUtils.md
@@ -26,7 +26,7 @@ file size (in bytes)
**Kind**: global constant
-## readAsText(file, bypassCache) ⇒ $.Promise
+## readAsText(file, bypassCache, [options]) ⇒ $.Promise
Asynchronously reads a file as UTF-8 encoded text.
**Kind**: global function
@@ -38,6 +38,9 @@ Asynchronously reads a file as UTF-8 encoded text.
| --- | --- | --- |
| file | File | File to read |
| bypassCache | boolean | an optional argument, if specified will read from disc instead of using cache. |
+| [options] | object | |
+| [options.ignoreFileSizeLimits] | boolean | Will read larger files than 16MB limit. will bypassCache + won't cache if enabled. |
+| [options.doNotCache] | boolean | will not cache if enabled. Auto-enabled if ignoreFileSizeLimits = true |
diff --git a/docs/API-Reference/filesystem/File.md b/docs/API-Reference/filesystem/File.md
index ce1ff92b1e..e4acf111e4 100644
--- a/docs/API-Reference/filesystem/File.md
+++ b/docs/API-Reference/filesystem/File.md
@@ -10,13 +10,18 @@ const File = brackets.getModule("filesystem/File")
* [File](#File)
* [new File(fullPath, fileSystem)](#new_File_new)
- * [.read([options], callback)](#File+read)
+ * [.read(options, callback)](#File+read)
* [.write(data, [options], [callback])](#File+write)
### new File(fullPath, fileSystem)
-Model for a File.
This class should *not* be instantiated directly. Use FileSystem.getFileForPath,
FileSystem.resolve, or Directory.getContents to create an instance of this class.
See the FileSystem class for more details.
+Model for a File.
+
+This class should *not* be instantiated directly. Use FileSystem.getFileForPath,
+FileSystem.resolve, or Directory.getContents to create an instance of this class.
+
+See the FileSystem class for more details.
| Param | Type | Description |
@@ -26,14 +31,17 @@ Model for a File.
This class should *not* be instantiated directly. Use FileSys
-### file.read([options], callback)
+### file.read(options, callback)
Read a file.
**Kind**: instance method of [File](#File)
| Param | Type | Description |
| --- | --- | --- |
-| [options] | Object | properties \{encoding: 'one of format supported here: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding'} |
+| options | Object | |
+| [options.encoding] | string | 'one of format supported here: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding' |
+| [options.ignoreFileSizeLimits] | boolean | by default max file size that can be read is 16MB. |
+| [options.doNotCache] | boolean | will not cache if enabled. Auto-enabled if ignoreFileSizeLimits = true |
| callback | function | Callback that is passed the FileSystemError string or the file's contents and its stats. |
diff --git a/src/brackets.js b/src/brackets.js
index 372b5315ff..75aabed6d2 100644
--- a/src/brackets.js
+++ b/src/brackets.js
@@ -121,7 +121,6 @@ define(function (require, exports, module) {
// load modules for later use
require("utils/Global");
require("editor/CSSInlineEditor");
- require("preferences/AllPreferences");
require("project/WorkingSetSort");
require("search/QuickOpen");
require("search/QuickOpenHelper");
diff --git a/src/command/Commands.js b/src/command/Commands.js
index ec82adfb48..7b0bd6e8d5 100644
--- a/src/command/Commands.js
+++ b/src/command/Commands.js
@@ -215,6 +215,8 @@ define(function (require, exports, module) {
/** Toggles code beautification on save */
exports.EDIT_BEAUTIFY_CODE_ON_SAVE = "edit.beautifyOnSave"; // CodeHintManager.js _startNewSession()
+ exports.EDIT_EMMET = "edit.emmet"; // HTMLCodeHints CSSCodeHints
+
/** Opens find dialog */
exports.CMD_FIND = "cmd.find"; // FindReplace.js _launchFind()
@@ -580,4 +582,3 @@ define(function (require, exports, module) {
DeprecationWarning.deprecateConstant(exports, "SORT_WORKINGSET_BY_TYPE", "CMD_WORKINGSET_SORT_BY_TYPE");
DeprecationWarning.deprecateConstant(exports, "SORT_WORKINGSET_AUTO", "CMD_WORKING_SORT_TOGGLE_AUTO");
});
-
diff --git a/src/command/DefaultMenus.js b/src/command/DefaultMenus.js
index 1e25c912ec..b488abbe9b 100644
--- a/src/command/DefaultMenus.js
+++ b/src/command/DefaultMenus.js
@@ -185,6 +185,8 @@ define(function (require, exports, module) {
menu.addMenuItem(Commands.SHOW_CODE_HINTS);
menu.addMenuDivider();
menu.addMenuItem(Commands.TOGGLE_CLOSE_BRACKETS);
+ menu.addMenuItem(Commands.EDIT_EMMET);
+
/*
* Find menu
@@ -472,4 +474,4 @@ define(function (require, exports, module) {
Menus.getContextMenu(Menus.ContextMenuIds.WORKING_SET_CONTEXT_MENU).on("beforeContextMenuOpen", _setMenuItemsVisible);
Menus.getContextMenu(Menus.ContextMenuIds.PROJECT_MENU).on("beforeContextMenuOpen", _setMenuItemsVisible);
});
-});
+});
\ No newline at end of file
diff --git a/src/document/DocumentCommandHandlers.js b/src/document/DocumentCommandHandlers.js
index 773166668a..ede5a641b1 100644
--- a/src/document/DocumentCommandHandlers.js
+++ b/src/document/DocumentCommandHandlers.js
@@ -140,6 +140,30 @@ define(function (require, exports, module) {
});
EventDispatcher.makeEventDispatcher(exports);
+
+ PreferencesManager.definePreference("emmet", "boolean", true, {
+ description: Strings.DESCRIPTION_EMMET
+ });
+
+ // Register the Emmet toggle command
+ const EMMET_COMMAND_ID = "edit.emmet";
+ const emmetCommand = CommandManager.register(Strings.CMD_TOGGLE_EMMET, EMMET_COMMAND_ID, toggleEmmet);
+
+ // Set initial state based on the preference
+ emmetCommand.setChecked(PreferencesManager.get("emmet"));
+
+ // Helper function to toggle the Emmet preference
+ function toggleEmmet() {
+ PreferencesManager.set("emmet", !PreferencesManager.get("emmet"));
+ emmetCommand.setChecked(PreferencesManager.get("emmet"));
+ }
+
+ // Listen for any change in the "emmet" preference and update the menu's toggle state
+ // this is needed because else the menu is not getting updated when the preference is changed
+ PreferencesManager.on("change", "emmet", function () {
+ emmetCommand.setChecked(PreferencesManager.get("emmet"));
+ });
+
/**
* Event triggered when File Save is cancelled, when prompted to save dirty files
*/
diff --git a/src/extensions/default/CSSCodeHints/main.js b/src/extensions/default/CSSCodeHints/main.js
index 2d4e417839..3ab75fe97c 100644
--- a/src/extensions/default/CSSCodeHints/main.js
+++ b/src/extensions/default/CSSCodeHints/main.js
@@ -36,7 +36,6 @@ define(function (require, exports, module) {
KeyEvent = brackets.getModule("utils/KeyEvent"),
LiveDevelopment = brackets.getModule("LiveDevelopment/main"),
Metrics = brackets.getModule("utils/Metrics"),
- AllPreferences = brackets.getModule("preferences/AllPreferences"),
CSSProperties = require("text!CSSProperties.json"),
properties = JSON.parse(CSSProperties);
@@ -74,7 +73,7 @@ define(function (require, exports, module) {
// the Emmet icon serves as a clickable link that redirects to the MDN page for the property (if available).
// This object follows the structure:
// { PROPERTY_NAME: MDN_URL }
- const MDN_PROPERTIES_URLS = {};
+ const mdnPropertiesUrls = {};
PreferencesManager.definePreference("codehint.CssPropHints", "boolean", true, {
description: Strings.DESCRIPTION_CSS_PROP_HINTS
@@ -477,7 +476,7 @@ define(function (require, exports, module) {
const propertyKey = computedPropertyKeys[resultItem.sourceIndex];
if (properties[propertyKey] && properties[propertyKey].MDN_URL) {
resultItem.MDN_URL = properties[propertyKey].MDN_URL;
- MDN_PROPERTIES_URLS[propertyKey] = resultItem.MDN_URL;
+ mdnPropertiesUrls[propertyKey] = resultItem.MDN_URL;
}
}
@@ -517,8 +516,8 @@ define(function (require, exports, module) {
let $icon = $(`Emmet`);
// if MDN_URL is available for the property, add the href attribute to redirect to mdn
- if (MDN_PROPERTIES_URLS[expandedAbbr]) {
- $icon.attr("href", MDN_PROPERTIES_URLS[expandedAbbr]);
+ if (mdnPropertiesUrls[expandedAbbr]) {
+ $icon.attr("href", mdnPropertiesUrls[expandedAbbr]);
$icon.attr("title", Strings.DOCS_MORE_LINK_MDN_TITLE);
}
@@ -825,7 +824,7 @@ define(function (require, exports, module) {
* Checks for preference changes, to enable/disable Emmet
*/
function preferenceChanged() {
- enabled = PreferencesManager.get(AllPreferences.EMMET);
+ enabled = PreferencesManager.get("emmet");
}
@@ -833,7 +832,7 @@ define(function (require, exports, module) {
var cssPropHints = new CssPropHints();
CodeHintManager.registerHintProvider(cssPropHints, ["css", "scss", "less"], 1);
- PreferencesManager.on("change", AllPreferences.EMMET, preferenceChanged);
+ PreferencesManager.on("change", "emmet", preferenceChanged);
preferenceChanged();
// For unit testing
diff --git a/src/extensions/default/HTMLCodeHints/main.js b/src/extensions/default/HTMLCodeHints/main.js
index 2e5815a6f8..464d3bcb15 100644
--- a/src/extensions/default/HTMLCodeHints/main.js
+++ b/src/extensions/default/HTMLCodeHints/main.js
@@ -33,7 +33,6 @@ define(function (require, exports, module) {
CSSUtils = brackets.getModule("language/CSSUtils"),
StringMatch = brackets.getModule("utils/StringMatch"),
LiveDevelopment = brackets.getModule("LiveDevelopment/main"),
- AllPreferences = brackets.getModule("preferences/AllPreferences"),
KeyEvent = brackets.getModule("utils/KeyEvent"),
Metrics = brackets.getModule("utils/Metrics"),
HTMLTags = require("text!HtmlTags.json"),
@@ -468,7 +467,7 @@ define(function (require, exports, module) {
return null;
}
- // to show emmet hint when either a single or three exclamation mark(s) is present
+ // not to show emmet hint when either a single or three exclamation mark(s) is present
if (line.includes('!!') && !line.includes('!!!')) {
return null;
}
@@ -1205,7 +1204,7 @@ define(function (require, exports, module) {
* Checks for preference changes, to enable/disable Emmet
*/
function preferenceChanged() {
- enabled = PreferencesManager.get(AllPreferences.EMMET);
+ enabled = PreferencesManager.get("emmet");
}
@@ -1222,11 +1221,11 @@ define(function (require, exports, module) {
CodeHintManager.registerHintProvider(attrHints, ["html"], 0);
NewFileContentManager.registerContentProvider(newDocContentProvider, ["html"], 0);
- PreferencesManager.on("change", AllPreferences.EMMET, preferenceChanged);
+ PreferencesManager.on("change", "emmet", preferenceChanged);
preferenceChanged();
var emmetMarkupHints = new EmmetMarkupHints();
- CodeHintManager.registerHintProvider(emmetMarkupHints, ["html", "php", "jsp"], 0);
+ CodeHintManager.registerHintProvider(emmetMarkupHints, ["html", "php"], 0);
// For unit testing
exports.emmetHintProvider = emmetMarkupHints;
diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js
index 92a1672dec..8db12e1a1a 100644
--- a/src/nls/root/strings.js
+++ b/src/nls/root/strings.js
@@ -524,6 +524,7 @@ define({
"CMD_BEAUTIFY_CODE": "Beautify Code",
"CMD_BEAUTIFY_CODE_ON_SAVE": "Beautify Code After Save",
"CMD_AUTO_RENAME_TAGS": "Auto Rename HTML Tags",
+ "CMD_TOGGLE_EMMET": "Emmet",
// Search menu commands
"FIND_MENU": "Find",
diff --git a/src/preferences/AllPreferences.js b/src/preferences/AllPreferences.js
deleted file mode 100644
index 4664246d0c..0000000000
--- a/src/preferences/AllPreferences.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * GNU AGPL-3.0 License
- *
- * Copyright (c) 2021 - present core.ai . All rights reserved.
- * Original work Copyright (c) 2012 - 2021 Adobe Systems Incorporated. All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see https://opensource.org/licenses/AGPL-3.0.
- *
- */
-
-/*
- * This file houses all the preferences used across Phoenix.
- *
- * To use:
- * ```
- * const AllPreferences = brackets.getModule("preferences/AllPreferences");
- * function preferenceChanged() {
- enabled = PreferencesManager.get(AllPreferences.EMMET);
- }
- * PreferencesManager.on("change", AllPreferences.EMMET, preferenceChanged);
- preferenceChanged();
- * ```
- */
-
- define(function (require, exports, module) {
- const PreferencesManager = require("preferences/PreferencesManager");
- const Strings = require("strings");
-
- // list of all the preferences
- const PREFERENCES_LIST = {
- EMMET: "emmet"
- };
-
- PreferencesManager.definePreference(PREFERENCES_LIST.EMMET, "boolean", true, {
- description: Strings.DESCRIPTION_EMMET
- });
-
- module.exports = PREFERENCES_LIST;
-});
\ No newline at end of file
diff --git a/test/SpecRunner.js b/test/SpecRunner.js
index bcb7fcbf2e..0e0bf45447 100644
--- a/test/SpecRunner.js
+++ b/test/SpecRunner.js
@@ -248,7 +248,6 @@ define(function (require, exports, module) {
require("worker/ExtensionsWorker");
require("thirdparty/tinycolor");
require("widgets/NotificationUI");
- require("preferences/AllPreferences");
// Load modules that self-register and just need to get included in the test-runner window
require("document/ChangedDocumentTracker");