Skip to content

Commit e403073

Browse files
committed
deploy: 84352e3
1 parent cd69f48 commit e403073

File tree

377 files changed

+12662
-1928
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+12662
-1928
lines changed

.well-known/assetlinks.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"relation": ["delegate_permission/common.handle_all_urls"],
4+
"target": {
5+
"namespace": "android_app",
6+
"package_name": "prod.phcode.twa",
7+
"sha256_cert_fingerprints":
8+
["18:BF:CD:EE:B2:5B:BA:CB:F8:BE:76:FD:42:91:FE:0E:9F:43:EE:8B:51:4A:C5:3C:45:93:29:7C:70:CA:01:98"]
9+
}
10+
}
11+
]

LiveDevelopment/BrowserScripts/LivePreviewTransportRemote.js

Lines changed: 119 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,130 @@
329329
}
330330
});
331331

332+
function alertPatch(message, titleText) {
333+
// Create the modal container
334+
const modal = document.createElement('div');
335+
modal.style.position = 'fixed';
336+
modal.style.top = '0';
337+
modal.style.left = '0';
338+
modal.style.width = '100%';
339+
modal.style.height = '100vh';
340+
modal.style.backgroundColor = 'rgba(0,0,0,0.5)';
341+
modal.style.display = 'flex';
342+
modal.style.justifyContent = 'center';
343+
modal.style.alignItems = 'center';
344+
modal.style.zIndex = '1000000000';
345+
346+
// Create the modal content box
347+
const modalContent = document.createElement('div');
348+
modalContent.style.backgroundColor = 'white';
349+
modalContent.style.padding = '20px';
350+
modalContent.style.borderRadius = '5px';
351+
modalContent.style.minWidth = '300px';
352+
modalContent.style.margin = 'auto';
353+
modalContent.style.textAlign = 'center';
354+
355+
// Add title to the modal with the current page URL
356+
const title = document.createElement('h3');
357+
title.textContent = titleText || "alert"; // not translated as window.alert is same in all languages.
358+
title.style.marginBottom = '10px';
359+
360+
// Add text to the modal
361+
const text = document.createElement('p');
362+
text.textContent = message;
363+
text.style.marginBottom = '20px';
364+
365+
// Create OK button to close the modal
366+
const button = document.createElement('button');
367+
button.textContent = 'OK';
368+
button.style.padding = '10px 20px';
369+
button.style.border = 'none';
370+
button.style.backgroundColor = '#007BFF';
371+
button.style.color = 'white';
372+
button.style.borderRadius = '5px';
373+
button.style.cursor = 'pointer';
374+
375+
button.onclick = function() {
376+
document.body.removeChild(modal);
377+
};
378+
379+
// Append elements
380+
modalContent.appendChild(title);
381+
modalContent.appendChild(text);
382+
modalContent.appendChild(button);
383+
modal.appendChild(modalContent);
384+
document.body.appendChild(modal);
385+
}
386+
387+
function unsupportedConfirm() {
388+
alertPatch(TRANSPORT_CONFIG.STRINGS.UNSUPPORTED_DOM_APIS_CONFIRM, "window.confirm");
389+
}
390+
function unsupportedPrompt() {
391+
alertPatch(TRANSPORT_CONFIG.STRINGS.UNSUPPORTED_DOM_APIS_CONFIRM, "window.prompt");
392+
}
393+
394+
// all externally opened live previews have the phcodeLivePreview="true" query string parameter set.
395+
const currentUrl = new URL(window.location.href);
396+
const queryParams = new URLSearchParams(currentUrl.search);
397+
const isExternalBrowser = queryParams.get("phcodeLivePreview") === "true";
398+
const isTauri = TRANSPORT_CONFIG.IS_NATIVE_APP;
399+
const platform = TRANSPORT_CONFIG.PLATFORM;
400+
401+
let alertQueue = [], confirmCalled = false, promptCalled = false;
402+
let addToQueue = true;
403+
if(!isExternalBrowser){
404+
// this is an embedded iframe we always take hold of the alert api for better ux within the live preivew frame.
405+
window.__PHOENIX_EMBED_INFO = {isTauri, platform};
406+
const shouldPatchAlert = (isTauri && platform === "mac");
407+
if(shouldPatchAlert){
408+
// In Mac embedded live preview iframe in tauri, alert, prompt, and confirm apis
409+
// are not available, so we need to patch the other apis in mac
410+
window.alert = function (...args) {
411+
// at this time, we cant add our html alert as body is not loaded yet. So we queue alerts.
412+
addToQueue && alertQueue.push(...args);
413+
};
414+
window.confirm = function () {
415+
// confirm and prompt is no-op in mac, we just need to show that the api is not supported, so we just
416+
// keep a flag.
417+
confirmCalled = true;
418+
};
419+
window.prompt = function () {
420+
promptCalled = true;
421+
};
422+
function drainAlertQueues() {
423+
addToQueue = false;
424+
if(confirmCalled) {
425+
unsupportedConfirm();
426+
}
427+
if(promptCalled) {
428+
unsupportedPrompt();
429+
}
430+
for(let i=0; i<alertQueue.length; i++) {
431+
alertPatch(alertQueue[i]);
432+
}
433+
alertQueue = [];
434+
window.alert = alertPatch;
435+
window.confirm = unsupportedConfirm;
436+
window.prompt = unsupportedPrompt;
437+
}
438+
439+
document.addEventListener('DOMContentLoaded', function() {
440+
drainAlertQueues();
441+
});
442+
}
443+
}
444+
332445
// this is for managing who am i context in iframes embedded in phoenix to have special handling.
333446
window.addEventListener('message', function(event) {
334447
if (!TRANSPORT_CONFIG.TRUSTED_ORIGINS_EMBED[event.origin]) {
335448
return; // Ignore messages from unexpected origins
336449
}
337-
338-
window.__PHOENIX_EMBED_INFO = {
339-
isTauri: event.data.isTauri
340-
};
450+
if(event.data.type === "WHO_AM_I_RESPONSE") {
451+
if(!window.__PHOENIX_EMBED_INFO){
452+
// this is set from transport config. We should be here
453+
console.error("Expected window.__PHOENIX_EMBED_INFO to be set, but not???");
454+
}
455+
}
341456
});
342457
if(window.self !== window.parent){
343458
// in an iframe

LiveDevelopment/MultiBrowserImpl/protocol/LiveDevProtocol.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ define(function (require, exports, module) {
163163
activeEditor && activeEditor.focus(); // restore focus from live preview
164164
return;
165165
}
166-
const openFullEditors = MainViewManager.findInOpenPane(liveDocPath);
167-
const openLiveDocEditor = openFullEditors.length ? openFullEditors[0].editor : null;
166+
const allOpenFileCount = MainViewManager.getWorkingSetSize(MainViewManager.ALL_PANES);
168167
function selectInHTMLEditor(fullHtmlEditor) {
169168
const position = HTMLInstrumentation.getPositionFromTagId(fullHtmlEditor, parseInt(tagId, 10));
170169
if(position && fullHtmlEditor) {
@@ -180,22 +179,13 @@ define(function (require, exports, module) {
180179
// the active editor takes the priority in the workflow. If a css related file is active,
181180
// then we dont need to open the html live doc. For less files, we dont check if its related as
182181
// its not directly linked usually and needs a compile step. so we just do a fuzzy search.
183-
activeEditor.focus();
182+
_focusEditorIfNeeded(activeEditor, nodeName, contentEditable);
184183
_searchAndCursorIfCSS(activeEditor, allSelectors, nodeName);
185184
// in this case, see if we need to do any css reverse highlight magic here
186-
} else if(openLiveDocEditor) {
187-
// If we are on multi pane mode, the html doc was open in an inactive unfocused editor.
188-
selectInHTMLEditor(openLiveDocEditor);
189-
} else {
190-
// no open editor for the live doc in panes, check if there is one in the working set.
191-
const foundInWorkingSetPane = MainViewManager.findInAllWorkingSets(liveDocPath);
192-
const paneToUse = foundInWorkingSetPane.length ?
193-
foundInWorkingSetPane[0].paneId:
194-
MainViewManager.ACTIVE_PANE; // if pane id is active pane, then the file is not open in working set
195-
const viewToUse = (paneToUse === MainViewManager.ACTIVE_PANE) ?
196-
FileViewController.PROJECT_MANAGER:
197-
FileViewController.WORKING_SET_VIEW;
198-
FileViewController.openAndSelectDocument(liveDocPath, viewToUse, paneToUse)
185+
} else if(!allOpenFileCount){
186+
// no open editor in any panes, then open the html file directly.
187+
FileViewController.openAndSelectDocument(liveDocPath,
188+
FileViewController.WORKING_SET_VIEW, MainViewManager.ACTIVE_PANE)
199189
.done(()=>{
200190
selectInHTMLEditor(EditorManager.getActiveEditor());
201191
});

LiveDevelopment/MultiBrowserImpl/transports/LivePreviewTransport.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ define(function (require, exports, module) {
2727

2828
const LiveDevProtocol = require("LiveDevelopment/MultiBrowserImpl/protocol/LiveDevProtocol"),
2929
EventDispatcher = require("utils/EventDispatcher"),
30+
Strings = require("strings"),
3031
Metrics = require("utils/Metrics");
3132

3233
const METRIC_SEND_INTERVAL_MS = 1000;
@@ -75,9 +76,14 @@ define(function (require, exports, module) {
7576
_transportBridge.getRemoteTransportScript()) || "";
7677
transportScript = "const TRANSPORT_CONFIG={};" +
7778
`TRANSPORT_CONFIG.PHOENIX_INSTANCE_ID = "${Phoenix.PHOENIX_INSTANCE_ID}";\n` +
79+
`TRANSPORT_CONFIG.IS_NATIVE_APP = ${Phoenix.isNativeApp};\n` +
80+
`TRANSPORT_CONFIG.PLATFORM = "${Phoenix.platform}";\n` +
7881
`TRANSPORT_CONFIG.LIVE_DEV_REMOTE_WORKER_SCRIPTS_FILE_NAME = "${LiveDevProtocol.LIVE_DEV_REMOTE_WORKER_SCRIPTS_FILE_NAME}";\n` +
7982
`TRANSPORT_CONFIG.LIVE_PREVIEW_DEBUG_ENABLED = ${logger.loggingOptions.logLivePreview};\n`+
8083
`TRANSPORT_CONFIG.TRUSTED_ORIGINS_EMBED = ${JSON.stringify(Phoenix.TRUSTED_ORIGINS)};\n`+
84+
`TRANSPORT_CONFIG.STRINGS = {
85+
UNSUPPORTED_DOM_APIS_CONFIRM: "${Strings.UNSUPPORTED_DOM_APIS_CONFIRM}"
86+
};\n`+
8187
transportScript;
8288
return LivePreviewTransportRemote.replace(replaceString, transportScript)
8389
+ "\n";

appConfig.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ window.AppConfig = {
2626
"app_notification_url": "assets/notifications/dev/",
2727
"app_update_url": "https://updates.phcode.io/tauri/update-latest-experimental-build.json",
2828
"linting.enabled_by_default": true,
29-
"build_timestamp": "2024-06-27T13:27:52.261Z",
29+
"build_timestamp": "2024-09-09T05:20:19.451Z",
3030
"googleAnalyticsID": "G-P4HJFPDB76",
3131
"googleAnalyticsIDDesktop": "G-VE5BXWJ0HF",
3232
"mixPanelID": "49c4d164b592be2350fc7af06a259bf3",
@@ -38,8 +38,8 @@ window.AppConfig = {
3838
"bugsnagEnv": "development"
3939
},
4040
"name": "Phoenix Code",
41-
"version": "3.8.9-20450",
42-
"apiVersion": "3.8.9",
41+
"version": "3.9.3-20557",
42+
"apiVersion": "3.9.3",
4343
"homepage": "https://core.ai",
4444
"issues": {
4545
"url": "https://github.com/phcode-dev/phoenix/issues"

assets/default-project/en.zip

422 Bytes
Binary file not shown.

assets/default-project/en/Newly_added_features.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@ We are continuously adding features every week to improve the life of web develo
77

88
Here's a list of top features recently added to Phoenix:
99

10+
## Auto Tab and Spacing detection
11+
12+
`Added on August, 2024`
13+
14+
Phoenix Code can now automatically detect and apply the indentation style (tabs or spaces) based on the existing code in the file.
15+
[Read more...](https://docs.phcode.dev/docs/editing-text/#auto-space-detection)
16+
17+
![image](https://github.com/user-attachments/assets/0adc47c5-a561-4002-bffb-d7bcde999b9d)
18+
19+
## Auto rename start and end of HTML/XML/SVG tags
20+
21+
`Added on July, 2024`
22+
23+
Automatically rename paired HTML/XML/SVG tags as you type at the start or end of the tag. [Read more...](https://docs.phcode.dev/docs/editing-text/#auto-rename-tag)
24+
25+
![tag sync](https://github.com/user-attachments/assets/ad82db8c-df1c-4c83-a5db-145caab539ec)
26+
27+
## Now Available on ChromeOS
28+
29+
`Added on July, 2024`
30+
31+
All new native ChromeOS app is now available on the Google Play Store.
32+
The ChromeOS app is a highly requested feature and is specially made for education and student use.
33+
34+
[![google play icon (1)](https://github.com/user-attachments/assets/0a7f20ce-653c-43a8-ac3e-3875ea74df5b)](https://play.google.com/store/apps/details?id=prod.phcode.twa)
35+
1036
## Drag and Drop Files and Folders in Desktop Apps - Experimental
1137

1238
`Added on June, 2024`

assets/phoenix-splash/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<img id="logo" src="images/phoenix-logo.svg"/>
1313
<div id="MainText">
1414
<h1>Phoenix Code</h1>
15-
<span>Code Creatively: Visual Editing Tailored for Developers</span>
15+
<span>The text editor designed to make coding as simple and fun as playing a video game</span>
1616
<br><br>
1717
<button id="load-status-display-btn" class="primary-button">Loading Editor...</button>
1818
<p style= "color: white; font-size:13px;" id="load-status-display-text" >...</p>

assets/sample-projects/HTML5.zip

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)