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 #4443 from adobe/untitled-documents
Browse files Browse the repository at this point in the history
Untitled document support
  • Loading branch information
peterflynn committed Jul 12, 2013
2 parents 64a33be + 0caa95c commit 220fae6
Show file tree
Hide file tree
Showing 15 changed files with 522 additions and 142 deletions.
2 changes: 1 addition & 1 deletion src/base-config/keyboard.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"file.new": [
"file.newDoc": [
"Ctrl-N"
],
"file.open": [
Expand Down
1 change: 1 addition & 0 deletions src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ define(function (require, exports, module) {
Menus : Menus,
KeyBindingManager : KeyBindingManager,
CodeHintManager : CodeHintManager,
Dialogs : Dialogs,
CSSUtils : require("language/CSSUtils"),
LiveDevelopment : require("LiveDevelopment/LiveDevelopment"),
LiveDevServerManager : require("LiveDevelopment/LiveDevServerManager"),
Expand Down
3 changes: 2 additions & 1 deletion src/command/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ define(function (require, exports, module) {
*/

// FILE
exports.FILE_NEW = "file.new";
exports.FILE_NEW_UNTITLED = "file.newDoc";
exports.FILE_NEW = "file.newFile";
exports.FILE_NEW_FOLDER = "file.newFolder";
exports.FILE_OPEN = "file.open";
exports.FILE_OPEN_FOLDER = "file.openFolder";
Expand Down
2 changes: 1 addition & 1 deletion src/command/DefaultMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ define(function (require, exports, module) {
*/
var menu;
menu = Menus.addMenu(Strings.FILE_MENU, Menus.AppMenuBar.FILE_MENU);
menu.addMenuItem(Commands.FILE_NEW);
menu.addMenuItem(Commands.FILE_NEW_UNTITLED);
menu.addMenuItem(Commands.FILE_NEW_FOLDER);
menu.addMenuItem(Commands.FILE_OPEN);
menu.addMenuItem(Commands.FILE_OPEN_FOLDER);
Expand Down
12 changes: 11 additions & 1 deletion src/document/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
define(function (require, exports, module) {
"use strict";

var EditorManager = require("editor/EditorManager"),
var NativeFileSystem = require("file/NativeFileSystem").NativeFileSystem,
EditorManager = require("editor/EditorManager"),
FileUtils = require("file/FileUtils"),
PerfUtils = require("utils/PerfUtils"),
LanguageManager = require("language/LanguageManager");
Expand Down Expand Up @@ -441,6 +442,15 @@ define(function (require, exports, module) {
// File extension may have changed
this._updateLanguage();
};

/**
* Is this an untitled document?
*
* @return {boolean} - whether or not the document is untitled
*/
Document.prototype.isUntitled = function () {
return this.file instanceof NativeFileSystem.InaccessibleFileEntry;
};


// Define public API
Expand Down
Loading

0 comments on commit 220fae6

Please sign in to comment.