Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #14391 from adobe/master
Browse files Browse the repository at this point in the history
Merging master to release for 1.13
  • Loading branch information
vickramdhawal authored Jun 4, 2018
2 parents d3b783b + db9583f commit 8f04753
Show file tree
Hide file tree
Showing 78 changed files with 4,501 additions and 311 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ package-lock.json

# ignore node_modules inside src
/src/node_modules
/src/JSUtils/node_modules
/src/JSUtils/node/node_modules

# ignore files copied from node_modules to src/thirdparty
/src/thirdparty/CodeMirror
Expand Down
16 changes: 13 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,7 @@ module.exports = function (grunt) {
// Update version number in package.json and rewrite src/config.json
grunt.registerTask('set-release', ['update-release-number', 'write-config:dev']);

// task: build
grunt.registerTask('build', [
'write-config:dist',
grunt.registerTask('build-common', [
'eslint:src',
'jasmine',
'clean',
Expand All @@ -414,6 +412,18 @@ module.exports = function (grunt) {
'build-config'
]);

// task: build
grunt.registerTask('build', [
'write-config:dist',
'build-common'
]);

// task: build
grunt.registerTask('build-prerelease', [
'write-config:prerelease',
'build-common'
]);

// Default task.
grunt.registerTask('default', ['test']);
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Brackets",
"version": "1.12.0-0",
"apiVersion": "1.12.0",
"version": "1.13.0-0",
"apiVersion": "1.13.0",
"homepage": "http://brackets.io",
"issues": {
"url": "http://github.com/adobe/brackets/issues"
Expand Down
10 changes: 9 additions & 1 deletion src/LiveDevelopment/LiveDevelopment.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ define(function LiveDevelopment(require, exports, module) {
StringUtils = require("utils/StringUtils"),
UserServer = require("LiveDevelopment/Servers/UserServer").UserServer,
WebSocketTransport = require("LiveDevelopment/transports/WebSocketTransport"),
PreferencesManager = require("preferences/PreferencesManager");
PreferencesManager = require("preferences/PreferencesManager"),
HealthLogger = require("utils/HealthLogger");

// Inspector
var Inspector = require("LiveDevelopment/Inspector/Inspector");
Expand Down Expand Up @@ -1350,6 +1351,13 @@ define(function LiveDevelopment(require, exports, module) {
});
}
}
// Send analytics data when Live Preview is opened
HealthLogger.sendAnalyticsData(
"livePreviewOpen",
"usage",
"livePreview",
"open"
);

// Register user defined server provider and keep handlers for further clean-up
_regServers.push(LiveDevServerManager.registerServer({ create: _createUserServer }, 99));
Expand Down
4 changes: 3 additions & 1 deletion src/brackets.config.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"healthDataServerURL" : "https://healthdev.brackets.io/healthDataLog",
"analyticsDataServerURL" : "https://cc-api-data-stage.adobe.io/ingest",
"serviceKey" : "brackets-service",
"environment" : "stage"
"environment" : "stage",
"update_info_url" : "https://s3.amazonaws.com/files.brackets.io/updates/prerelease/<locale>.json",
"buildtype" : "dev"
}
4 changes: 3 additions & 1 deletion src/brackets.config.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"healthDataServerURL" : "https://health.brackets.io/healthDataLog",
"analyticsDataServerURL" : "https://cc-api-data.adobe.io/ingest",
"serviceKey" : "brackets-service",
"environment" : "production"
"environment" : "production",
"update_info_url" : "https://getupdates.brackets.io/getupdates/",
"buildtype" : "production"
}
1 change: 0 additions & 1 deletion src/brackets.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"app_title" : "Brackets",
"app_name_about" : "Brackets",
"about_icon" : "styles/images/brackets_icon.svg",
"update_info_url" : "https://getupdates.brackets.io/getupdates/",
"how_to_use_url" : "https://github.com/adobe/brackets/wiki/How-to-Use-Brackets",
"support_url" : "https://github.com/adobe/brackets/wiki/Troubleshooting",
"suggest_feature_url" : "https://github.com/adobe/brackets/wiki/Suggest-a-Feature",
Expand Down
8 changes: 8 additions & 0 deletions src/brackets.config.prerelease.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"healthDataServerURL" : "https://health.brackets.io/healthDataLog",
"analyticsDataServerURL" : "https://cc-api-data.adobe.io/ingest",
"serviceKey" : "brackets-service",
"environment" : "production",
"update_info_url" : "https://s3.amazonaws.com/files.brackets.io/updates/prerelease/<locale>.json",
"buildtype" : "prerelease"
}
1 change: 1 addition & 0 deletions src/command/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ define(function (require, exports, module) {
exports.TOGGLE_LINE_NUMBERS = "view.toggleLineNumbers"; // EditorOptionHandlers.js _getToggler()
exports.TOGGLE_ACTIVE_LINE = "view.toggleActiveLine"; // EditorOptionHandlers.js _getToggler()
exports.TOGGLE_WORD_WRAP = "view.toggleWordWrap"; // EditorOptionHandlers.js _getToggler()
exports.TOGGLE_SEARCH_AUTOHIDE = "view.toggleSearchAutoHide"; // EditorOptionHandlers.js _getToggler()

exports.CMD_OPEN = "cmd.open";
exports.CMD_ADD_TO_WORKINGSET_AND_OPEN = "cmd.addToWorkingSetAndOpen"; // DocumentCommandHandlers.js handleOpenDocumentInNewPane()
Expand Down
1 change: 1 addition & 0 deletions src/command/DefaultMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ define(function (require, exports, module) {
menu.addMenuItem(Commands.CMD_SPLITVIEW_HORIZONTAL);
menu.addMenuDivider();
menu.addMenuItem(Commands.VIEW_HIDE_SIDEBAR);
menu.addMenuItem(Commands.TOGGLE_SEARCH_AUTOHIDE);
menu.addMenuDivider();
menu.addMenuItem(Commands.VIEW_INCREASE_FONT_SIZE);
menu.addMenuItem(Commands.VIEW_DECREASE_FONT_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion src/command/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ define(function (require, exports, module) {
posLeft += 3;

if (clip.right > 0) {
posLeft = Math.max(0, posLeft - 2 * $parentMenuItem.outerWidth());
posLeft = Math.max(0, posLeft - $parentMenuItem.outerWidth() - $menuWindow.outerWidth());
}
} else {
this.trigger("beforeContextMenuOpen");
Expand Down
10 changes: 5 additions & 5 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"app_title": "Brackets",
"app_name_about": "Brackets",
"about_icon": "styles/images/brackets_icon.svg",
"update_info_url": "https://getupdates.brackets.io/getupdates/",
"how_to_use_url": "https://github.com/adobe/brackets/wiki/How-to-Use-Brackets",
"support_url": "https://github.com/adobe/brackets/wiki/Troubleshooting",
"suggest_feature_url": "https://github.com/adobe/brackets/wiki/Suggest-a-Feature",
Expand All @@ -23,11 +22,12 @@
"healthDataServerURL": "https://healthdev.brackets.io/healthDataLog",
"analyticsDataServerURL": "https://cc-api-data-stage.adobe.io/ingest",
"serviceKey": "brackets-service",
"environment": "stage"
"environment": "stage",
"update_info_url": "https://s3.amazonaws.com/files.brackets.io/updates/prerelease/<locale>.json"
},
"name": "Brackets",
"version": "1.12.0-0",
"apiVersion": "1.12.0",
"version": "1.13.0-0",
"apiVersion": "1.13.0",
"homepage": "http://brackets.io",
"issues": {
"url": "http://github.com/adobe/brackets/issues"
Expand Down Expand Up @@ -99,4 +99,4 @@
"url": "https://github.com/adobe/brackets/blob/master/LICENSE"
}
]
}
}
1 change: 1 addition & 0 deletions src/document/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ define(function (require, exports, module) {
*/
function Document(file, initialTimestamp, rawText) {
this.file = file;
this.editable = !file.readOnly;
this._updateLanguage();
this.refreshText(rawText, initialTimestamp, true);
// List of full editors which are initialized as master editors for this doc.
Expand Down
62 changes: 43 additions & 19 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ define(function (require, exports, module) {
CommandManager = require("command/CommandManager"),
Commands = require("command/Commands"),
DeprecationWarning = require("utils/DeprecationWarning"),
EventDispatcher = require("utils/EventDispatcher"),
ProjectManager = require("project/ProjectManager"),
DocumentManager = require("document/DocumentManager"),
MainViewManager = require("view/MainViewManager"),
Expand Down Expand Up @@ -135,7 +136,14 @@ define(function (require, exports, module) {
PreferencesManager.definePreference("defaultExtension", "string", "", {
excludeFromHints: true
});
EventDispatcher.makeEventDispatcher(exports);

/**
* Event triggered when File Save is cancelled, when prompted to save dirty files
*/
var APP_QUIT_CANCELLED = "appQuitCancelled";


/**
* JSLint workaround for circular dependency
* @type {function}
Expand All @@ -149,7 +157,9 @@ define(function (require, exports, module) {
function _updateTitle() {
var currentDoc = DocumentManager.getCurrentDocument(),
windowTitle = brackets.config.app_title,
currentlyViewedPath = MainViewManager.getCurrentlyViewedPath(MainViewManager.ACTIVE_PANE);
currentlyViewedFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE),
currentlyViewedPath = currentlyViewedFile.fullPath,
readOnlyString = currentlyViewedFile.readOnly ? "[Read Only] - " : "";

if (!brackets.nativeMenus) {
if (currentlyViewedPath) {
Expand Down Expand Up @@ -189,7 +199,7 @@ define(function (require, exports, module) {
var projectName = projectRoot.name;
// Construct shell/browser window title, e.g. "• index.html (myProject) — Brackets"
if (currentlyViewedPath) {
windowTitle = StringUtils.format(WINDOW_TITLE_STRING_DOC, _currentTitlePath, projectName, brackets.config.app_title);
windowTitle = StringUtils.format(WINDOW_TITLE_STRING_DOC, readOnlyString + _currentTitlePath, projectName, brackets.config.app_title);
// Display dirty dot when there are unsaved changes
if (currentDoc && currentDoc.isDirty) {
windowTitle = "• " + windowTitle;
Expand Down Expand Up @@ -847,6 +857,14 @@ define(function (require, exports, module) {

return result.promise();
}

/**
* Dispatches the app quit cancelled event
*/
function dispatchAppQuitCancelledEvent() {
exports.trigger(exports.APP_QUIT_CANCELLED);
}


/**
* Opens the native OS save as dialog and saves document.
Expand Down Expand Up @@ -996,6 +1014,7 @@ define(function (require, exports, module) {
if (selectedPath) {
_doSaveAfterSaveDialog(selectedPath);
} else {
dispatchAppQuitCancelledEvent();
result.reject(USER_CANCELED);
}
} else {
Expand Down Expand Up @@ -1217,6 +1236,7 @@ define(function (require, exports, module) {
)
.done(function (id) {
if (id === Dialogs.DIALOG_BTN_CANCEL) {
dispatchAppQuitCancelledEvent();
result.reject();
} else if (id === Dialogs.DIALOG_BTN_OK) {
// "Save" case: wait until we confirm save has succeeded before closing
Expand Down Expand Up @@ -1322,6 +1342,7 @@ define(function (require, exports, module) {
)
.done(function (id) {
if (id === Dialogs.DIALOG_BTN_CANCEL) {
dispatchAppQuitCancelledEvent();
result.reject();
} else if (id === Dialogs.DIALOG_BTN_OK) {
// Save all unsaved files, then if that succeeds, close all
Expand Down Expand Up @@ -1722,28 +1743,29 @@ define(function (require, exports, module) {
/**
* Attach a beforeunload handler to notify user about unsaved changes and URL redirection in CEF.
* Prevents data loss in scenario reported under #13708
* Make sure we don't attach this handler if the current window is actually a test window
**/
window.onbeforeunload = function(e) {
if (window.location.pathname.indexOf('SpecRunner') > -1) {
return;
}

var openDocs = DocumentManager.getAllOpenDocuments();
var isTestWindow = (new window.URLSearchParams(window.location.search || "")).get("testEnvironment");
if (!isTestWindow) {
window.onbeforeunload = function(e) {
var openDocs = DocumentManager.getAllOpenDocuments();

// Detect any unsaved changes
openDocs = openDocs.filter(function(doc) {
return doc && doc.isDirty;
});
// Detect any unsaved changes
openDocs = openDocs.filter(function(doc) {
return doc && doc.isDirty;
});

// Ensure we are not in normal app-quit or reload workflow
if (!_isReloading && !_windowGoingAway) {
if (openDocs.length > 0) {
return Strings.WINDOW_UNLOAD_WARNING_WITH_UNSAVED_CHANGES;
} else {
return Strings.WINDOW_UNLOAD_WARNING;
// Ensure we are not in normal app-quit or reload workflow
if (!_isReloading && !_windowGoingAway) {
if (openDocs.length > 0) {
return Strings.WINDOW_UNLOAD_WARNING_WITH_UNSAVED_CHANGES;
} else {
return Strings.WINDOW_UNLOAD_WARNING;
}
}
}
};
};
}

/** Do some initialization when the DOM is ready **/
AppInit.htmlReady(function () {
Expand Down Expand Up @@ -1783,6 +1805,8 @@ define(function (require, exports, module) {

// Define public API
exports.showFileOpenError = showFileOpenError;
exports.APP_QUIT_CANCELLED = APP_QUIT_CANCELLED;


// Deprecated commands
CommandManager.register(Strings.CMD_ADD_TO_WORKING_SET, Commands.FILE_ADD_TO_WORKING_SET, handleFileAddToWorkingSet);
Expand Down
5 changes: 3 additions & 2 deletions src/document/DocumentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,11 @@ define(function (require, exports, module) {
* If all you need is the Document's getText() value, use the faster getDocumentText() instead.
*
* @param {!string} fullPath
* @param {!object} fileObj actual File|RemoteFile or some other protocol adapter handle
* @return {$.Promise} A promise object that will be resolved with the Document, or rejected
* with a FileSystemError if the file is not yet open and can't be read from disk.
*/
function getDocumentForPath(fullPath) {
function getDocumentForPath(fullPath, fileObj) {
var doc = getOpenDocumentForPath(fullPath);

if (doc) {
Expand All @@ -342,7 +343,7 @@ define(function (require, exports, module) {
return promise;
}

var file = FileSystem.getFileForPath(fullPath),
var file = fileObj || FileSystem.getFileForPath(fullPath),
pendingPromise = getDocumentForPath._pendingDocumentPromises[file.id];

if (pendingPromise) {
Expand Down
9 changes: 9 additions & 0 deletions src/editor/CSSInlineEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ define(function (require, exports, module) {
MultiRangeInlineEditor = require("editor/MultiRangeInlineEditor"),
Strings = require("strings"),
ViewUtils = require("utils/ViewUtils"),
HealthLogger = require("utils/HealthLogger"),
_ = require("thirdparty/lodash");

var _newRuleCmd,
Expand Down Expand Up @@ -169,6 +170,14 @@ define(function (require, exports, module) {
return null;
}

//Send analytics data for QuickEdit open
HealthLogger.sendAnalyticsData(
"QuickEditOpen",
"usage",
"quickEdit",
"open"
);

// Only provide CSS editor if the selection is within a single line
var sel = hostEditor.getSelection();
if (sel.start.line !== sel.end.line) {
Expand Down
13 changes: 13 additions & 0 deletions src/editor/CodeHintList.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ define(function (require, exports, module) {

$item.find("a").addClass("highlight");
ViewUtils.scrollElementIntoView($view, $item, false);

if (this.handleHighlight) {
this.handleHighlight($item.find("a"));
}
}
};

Expand Down Expand Up @@ -544,6 +548,15 @@ define(function (require, exports, module) {
this.handleSelect = callback;
};

/**
* Set the hint list highlight callback function
*
* @param {Function} callback
*/
CodeHintList.prototype.onHighlight = function (callback) {
this.handleHighlight = callback;
};

/**
* Set the hint list closure callback function
*
Expand Down
6 changes: 6 additions & 0 deletions src/editor/CodeHintManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ define(function (require, exports, module) {

sessionEditor = editor;
hintList = new CodeHintList(sessionEditor, insertHintOnTab, maxCodeHints);
hintList.onHighlight(function ($hint) {
// If the current hint provider listening for hint item highlight change
if (sessionProvider.onHighlight) {
sessionProvider.onHighlight($hint);
}
});
hintList.onSelect(function (hint) {
var restart = sessionProvider.insertHint(hint),
previousEditor = sessionEditor;
Expand Down
Loading

0 comments on commit 8f04753

Please sign in to comment.