Skip to content
Merged
19 changes: 14 additions & 5 deletions docs/API-Reference/command/CommandManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ const CommandManager = brackets.getModule("command/CommandManager")
* [.getID()](#Command+getID) ⇒ <code>string</code>
* [.execute()](#Command+execute) ⇒ <code>$.Promise</code>
* [.getEnabled()](#Command+getEnabled) ⇒ <code>boolean</code>
* [.getOptions()](#Command+getOptions) ⇒ <code>object</code>
* [.setEnabled(enabled)](#Command+setEnabled)
* [.setChecked(checked)](#Command+setChecked)
* [.getChecked()](#Command+getChecked) ⇒ <code>boolean</code>
* [.setName(name)](#Command+setName)
* [.setName(name, htmlName)](#Command+setName)
* [.getName()](#Command+getName) ⇒ <code>string</code>

<a name="new_Command_new"></a>
Expand Down Expand Up @@ -54,6 +55,12 @@ Executes the command. Additional arguments are passed to the executing function
### command.getEnabled() ⇒ <code>boolean</code>
Is command enabled?

**Kind**: instance method of [<code>Command</code>](#Command)
<a name="Command+getOptions"></a>

### command.getOptions() ⇒ <code>object</code>
get the command options

**Kind**: instance method of [<code>Command</code>](#Command)
<a name="Command+setEnabled"></a>

Expand Down Expand Up @@ -87,7 +94,7 @@ Is command checked?
**Kind**: instance method of [<code>Command</code>](#Command)
<a name="Command+setName"></a>

### command.setName(name)
### command.setName(name, htmlName)
Sets the name of the Command and dispatches "nameChange" so that
UI that reflects the command name can update.

Expand All @@ -97,9 +104,10 @@ use \uXXXX instead of an HTML entity.

**Kind**: instance method of [<code>Command</code>](#Command)

| Param | Type |
| --- | --- |
| name | <code>string</code> |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | |
| htmlName | <code>string</code> | If set, this will be displayed in ui menus instead of the name given. Eg. "Phoenix menu<i class='fa fa-car' style='margin-left: 4px;'></i>" |

<a name="Command+getName"></a>

Expand Down Expand Up @@ -156,6 +164,7 @@ Registers a global command.
| commandFn | <code>function</code> | the function to call when the command is executed. Any arguments passed to execute() (after the id) are passed as arguments to the function. If the function is asynchronous, it must return a jQuery promise that is resolved when the command completes. Otherwise, the CommandManager will assume it is synchronous, and return a promise that is already resolved. |
| [options] | <code>Object</code> | |
| options.eventSource | <code>boolean</code> | If set to true, the commandFn will be called with the first argument `event` with details about the source(invoker) as event.eventSource(one of the `CommandManager.SOURCE_*`) and event.sourceType(Eg. Ctrl-K) parameter. |
| options.htmlName | <code>string</code> | If set, this will be displayed in ui menus instead of the name given. Eg. "Phoenix menu<i class='fa fa-car' style='margin-left: 4px;'></i>" |

<a name="registerInternal"></a>

Expand Down
6 changes: 6 additions & 0 deletions docs/API-Reference/command/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,12 @@ Opens documentation
## HELP\_SUPPORT
Opens support resources

**Kind**: global variable
<a name="HELP_GET_PRO"></a>

## HELP\_GET\_PRO
Opens Phoenix Pro page

**Kind**: global variable
<a name="HELP_SUGGEST"></a>

Expand Down
9 changes: 8 additions & 1 deletion gulpfile.js/translateStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,16 @@ function aggregateUtilizationMetrics(obj) {
return globalUtilizationMetrics;
}

const translationContext =
`This is a bunch of strings extracted from a JavaScript file used to develop our product with is a text editor.
Some strings may have HTML or templates(mustache library used).
The brand name “Phoenix Pro” must remain in English and should never be translated.
Please translate these strings accurately.
`;

function getTranslationrequest(stringsToTranslate, lang) {
return {
translationContext: "This is a bunch of strings extracted from a JavaScript file used to develop our product with is a text editor. Some strings may have HTML or templates(mustache library used). Please translate these strings accurately.",
translationContext: translationContext,
"source": stringsToTranslate,
"provider": "vertex",
"sourceContext": {
Expand Down
21 changes: 19 additions & 2 deletions src/command/CommandManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ define(function (require, exports, module) {
return this._enabled;
};

/**
* get the command options
*
* @return {object}
*/
Command.prototype.getOptions = function () {
return this._options || {};
};

/**
* Sets enabled state of Command and dispatches "enabledStateChange"
* when the enabled state changes.
Expand Down Expand Up @@ -196,11 +205,17 @@ define(function (require, exports, module) {
* use \uXXXX instead of an HTML entity.
*
* @param {string} name
* @param {string} htmlName If set, this will be displayed in ui menus instead of the name given.
* Eg. "Phoenix menu<i class='fa fa-car' style='margin-left: 4px;'></i>"
*/
Command.prototype.setName = function (name) {
var changed = this._name !== name;
Command.prototype.setName = function (name, htmlName) {
let changed = this._name !== name;
this._name = name;

if (this._options.htmlName !== htmlName) {
changed = true;
this._options.htmlName = htmlName;
}
if (changed) {
this.trigger("nameChange");
}
Expand Down Expand Up @@ -233,6 +248,8 @@ define(function (require, exports, module) {
* @param {boolean} options.eventSource If set to true, the commandFn will be called with the first argument `event`
* with details about the source(invoker) as event.eventSource(one of the `CommandManager.SOURCE_*`) and
* event.sourceType(Eg. Ctrl-K) parameter.
* @param {string} options.htmlName If set, this will be displayed in ui menus instead of the name given.
* Eg. "Phoenix menu<i class='fa fa-car' style='margin-left: 4px;'></i>"
* @return {?Command}
*/
function register(name, id, commandFn, options={}) {
Expand Down
3 changes: 3 additions & 0 deletions src/command/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ define(function (require, exports, module) {
/** Opens support resources */
exports.HELP_SUPPORT = "help.support"; // HelpCommandHandlers.js _handleLinkMenuItem()

/** Opens Phoenix Pro page */
exports.HELP_GET_PRO = "help.getPro"; // HelpCommandHandlers.js _handleLinkMenuItem()

/** Opens feature suggestion page */
exports.HELP_SUGGEST = "help.suggest"; // HelpCommandHandlers.js _handleLinkMenuItem()

Expand Down
2 changes: 2 additions & 0 deletions src/command/DefaultMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ define(function (require, exports, module) {
menu.addMenuItem(Commands.HELP_DOCS);
menu.addMenuItem(Commands.HELP_SUPPORT);
menu.addMenuDivider();
menu.addMenuItem(Commands.HELP_GET_PRO);
menu.addMenuDivider();
if (brackets.config.suggest_feature_url) {
menu.addMenuItem(Commands.HELP_SUGGEST);
}
Expand Down
5 changes: 5 additions & 0 deletions src/command/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,11 @@ define(function (require, exports, module) {
}
});
} else {
const htmlName = this._command.getOptions().htmlName;
if(htmlName) {
$(_getHTMLMenuItem(this.id)).find(".menu-name").html(htmlName);
return;
}
$(_getHTMLMenuItem(this.id)).find(".menu-name").text(this._command.getName());
}
};
Expand Down
1 change: 1 addition & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"config": {
"app_title": "Phoenix Code",
"app_name_about": "Phoenix Code",
"main_pro_plan": "Phoenix Pro",
"about_icon": "styles/images/phoenix-icon.svg",
"account_url": "https://account.phcode.dev/",
"promotions_url": "https://promotions.phcode.dev/dev/",
Expand Down
5 changes: 5 additions & 0 deletions src/help/HelpCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,14 @@ define(function (require, exports, module) {
});
});

const getProString = `${Strings.CMD_GET_PRO}<i class='fa fa-feather' style='margin-left: 4px;'></i>`;

CommandManager.register(Strings.CMD_HOW_TO_USE_BRACKETS, Commands.HELP_HOW_TO_USE_BRACKETS, _handleLinkMenuItem(brackets.config.how_to_use_url));
CommandManager.register(Strings.CMD_DOCS, Commands.HELP_DOCS, _handleLinkMenuItem(brackets.config.docs_url));
CommandManager.register(Strings.CMD_SUPPORT, Commands.HELP_SUPPORT, _handleLinkMenuItem(brackets.config.support_url));
CommandManager.register(Strings.CMD_GET_PRO, Commands.HELP_GET_PRO, _handleLinkMenuItem(brackets.config.purchase_url), {
htmlName: getProString
});
CommandManager.register(Strings.CMD_SUGGEST, Commands.HELP_SUGGEST, _handleLinkMenuItem(brackets.config.suggest_feature_url));
CommandManager.register(Strings.CMD_REPORT_ISSUE, Commands.HELP_REPORT_ISSUE, _handleLinkMenuItem(brackets.config.report_issue_url));
CommandManager.register(Strings.CMD_RELEASE_NOTES, Commands.HELP_RELEASE_NOTES, _handleLinkMenuItem(brackets.config.release_notes_url));
Expand Down
5 changes: 4 additions & 1 deletion src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ define({
"CMD_AUTO_UPDATE": "Auto Update",
"CMD_HOW_TO_USE_BRACKETS": "How to Use {APP_NAME}",
"CMD_SUPPORT": "{APP_NAME} Support",
"CMD_GET_PRO": "Get Phoenix Pro",
"CMD_USER_PROFILE": "{APP_NAME} Account",
"CMD_DOCS": "Help, Getting Started",
"CMD_SUGGEST": "Suggest a Feature",
Expand Down Expand Up @@ -1678,5 +1679,7 @@ define({
"PROMO_CARD_4_MESSAGE": "Edit headings, buttons, and copy directly in the preview.",
"PROMO_LEARN_MORE": "Learn More\u2026",
"PROMO_GET_APP_UPSELL_BUTTON": "Get {0}",
"PROMO_PRO_ENDED_TITLE": "Your {0} upgrade has ended"
"PROMO_PRO_ENDED_TITLE": "Your {0} Trial has ended",
"PROMO_PRO_TRIAL_DAYS_LEFT": "Phoenix Pro Trial ({0} days left)",
"GET_PHOENIX_PRO": "Get Phoenix Pro"
});
12 changes: 12 additions & 0 deletions src/services/html/login-popup.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
<div class="profile-popup">
<div class="popup-header">
<h1 class="popup-title">{{Strings.PROFILE_POP_TITLE}}</h1>
{{#trialInfo}}
<div class="trial-plan-info">
<span class="phoenix-pro-title-plain">
<span class="pro-plan-name">{{planName}}</span>
<i class="fa-solid fa-feather" style="margin-left: 3px;"></i>
</span>
</div>
{{/trialInfo}}
<a href="{{getProLink}}" style="font-size: 13px;">
{{Strings.GET_PHOENIX_PRO}}
<i class="fa fa-arrow-right" style="font-size: 10px;margin-left: 4px;"></i>
</a>
</div>
<div class="popup-body">
<button id="phoenix-signin-btn" class="btn dialog-button primary">
Expand Down
4 changes: 4 additions & 0 deletions src/services/html/profile-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<div class="user-email"><secure-email></secure-email></div>
<iframe id="user-details-frame" class="user-details-iframe" style="display: none; padding: 0; border: none; background: transparent; width: 100%; height: auto; overflow: hidden;" scrolling="no"></iframe>
<div class="user-plan-name {{planClass}}">{{planName}}</div>
<a class="get-phoenix-pro-profile" href="{{getProLink}}" style="font-size: 13px;">
{{Strings.GET_PHOENIX_PRO}}
<i class="fa fa-arrow-right" style="font-size: 10px;margin-left: 4px;"></i>
</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/services/login-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ define(function (require, exports, module) {

// Only set exports for browser apps to avoid conflict with desktop login
if (!Phoenix.isNativeApp) {
init();
// kernal exports
// Add to existing KernalModeTrust.loginService from login-service.js
LoginService.isLoggedIn = isLoggedIn;
Expand All @@ -402,6 +401,7 @@ define(function (require, exports, module) {
LoginService.getProfile = getProfile;
LoginService.verifyLoginStatus = () => _verifyBrowserLogin(false);
LoginService.getAccountBaseURL = _getAccountBaseURL;
init();
}

// public exports
Expand Down
2 changes: 1 addition & 1 deletion src/services/login-desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,14 @@ define(function (require, exports, module) {

// Only set exports for native apps to avoid conflict with browser login
if (Phoenix.isNativeApp) {
init();
// kernal exports - add to existing KernalModeTrust.loginService from login-service.js
LoginService.isLoggedIn = isLoggedIn;
LoginService.signInToAccount = signInToAccount;
LoginService.signOutAccount = signOutAccount;
LoginService.getProfile = getProfile;
LoginService.verifyLoginStatus = () => _verifyLogin(false);
LoginService.getAccountBaseURL = getAccountBaseURL;
init();
}

// public exports
Expand Down
Loading
Loading