Skip to content

Commit 3888607

Browse files
committed
deploy: 84352e3
1 parent 831935b commit 3888607

File tree

62 files changed

+910
-378
lines changed

Some content is hidden

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

62 files changed

+910
-378
lines changed

LiveDevelopment/BrowserScripts/LiveDevProtocolRemote.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@
367367
* the HTML tag corresponding to the clicked element.
368368
*/
369369
function onDocumentClick(event) {
370+
// Get the user's current selection
371+
const selection = window.getSelection();
372+
373+
// Check if there is a selection
374+
if (selection.toString().length > 0) {
375+
// if there is any selection like text or others, we don't see it as a live selection event
376+
// Eg: user may selects ome text in live preview to copy, in which case we should nt treat it
377+
// as a live select.
378+
return;
379+
}
370380
var element = event.target;
371381
if (element && element.hasAttribute('data-brackets-id')) {
372382
MessageBroker.send({

LiveDevelopment/BrowserScripts/LivePreviewTransportRemote.js

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,25 +298,53 @@
298298
targetElement = targetElement.parentElement;
299299
}
300300

301-
if (targetElement && targetElement.tagName === 'A' && (targetElement.target === '_blank')) {
301+
if (window.__PHOENIX_EMBED_INFO && window.__PHOENIX_EMBED_INFO.isTauri &&
302+
targetElement && targetElement.tagName === 'A' && (targetElement.target === '_blank')) {
303+
// in desktop phoenix builds, tauri will not open anchor tags in browser if it is in
304+
// an iframe(except for the intel mac bug)
305+
// in normal browsers, we dont need to do this and the borwser will do its thing.
302306
const href = getAbsoluteUrl(targetElement.getAttribute('href'));
303307
window.parent.postMessage({
304308
handlerName: "ph-liveServer",
305309
eventName: 'embeddedIframeHrefClick',
306310
href: href
307311
}, "*");
312+
// in intel mac desktop, tauri seems to open in browser
313+
// causing 2 tabs to open. in m1 macs its not there. so we prevent default behavior.
314+
event.stopImmediatePropagation();
315+
event.preventDefault();
308316
}
309-
});
317+
}, true);
310318
document.addEventListener('contextmenu', function(event) {
311319
(document.activeElement || document.body).focus();
312320
});
313321
document.addEventListener('keydown', function(event) {
314-
if (event.key === 'Escape' || event.key === 'Esc') { // Check for Escape key
315-
// Perform the desired action for the Escape key
322+
if (window.__PHOENIX_EMBED_INFO &&
323+
(event.key === 'Escape' || event.key === 'Esc')) { // Check for Escape key
324+
// Perform the desired action for the Escape key only if its within iframe inside phoenix
316325
window.parent.postMessage({
317326
handlerName: "ph-liveServer",
318327
eventName: 'embeddedEscapeKeyPressed'
319328
}, "*");
320329
}
321330
});
331+
332+
// this is for managing who am i context in iframes embedded in phoenix to have special handling.
333+
window.addEventListener('message', function(event) {
334+
if (!TRANSPORT_CONFIG.TRUSTED_ORIGINS_EMBED[event.origin]) {
335+
return; // Ignore messages from unexpected origins
336+
}
337+
338+
window.__PHOENIX_EMBED_INFO = {
339+
isTauri: event.data.isTauri
340+
};
341+
});
342+
if(window.self !== window.parent){
343+
// in an iframe
344+
window.parent.postMessage({
345+
handlerName: "ph-liveServer",
346+
eventName: 'whoAmIframePhoenix',
347+
href: location.href
348+
}, "*");
349+
}
322350
}(this));

LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* modules should define a single function that returns an object of all
2929
* exported functions.
3030
*/
31-
function RemoteFunctions(config, remoteWSPort) {
31+
function RemoteFunctions(config) {
3232

3333

3434
var experimental;
@@ -997,42 +997,7 @@ function RemoteFunctions(config, remoteWSPort) {
997997
if (experimental) {
998998
window.document.addEventListener("keydown", onKeyDown);
999999
}
1000-
1001-
var _ws = null;
1002-
1003-
function onDocumentClick(event) {
1004-
var element = event.target,
1005-
currentDataId,
1006-
newDataId;
1007-
1008-
if (_ws && element && element.hasAttribute('data-brackets-id')) {
1009-
_ws.send(JSON.stringify({
1010-
type: "message",
1011-
message: element.getAttribute('data-brackets-id')
1012-
}));
1013-
}
1014-
}
1015-
1016-
1017-
function createWebSocket() {
1018-
_ws = new WebSocket("ws://localhost:" + remoteWSPort);
1019-
_ws.onopen = function () {
1020-
window.document.addEventListener("click", onDocumentClick);
1021-
};
1022-
1023-
_ws.onmessage = function (evt) {
1024-
};
1025-
1026-
_ws.onclose = function () {
1027-
// websocket is closed
1028-
window.document.removeEventListener("click", onDocumentClick);
1029-
};
1030-
}
1031-
1032-
if (remoteWSPort) {
1033-
createWebSocket();
1034-
}
1035-
1000+
10361001
return {
10371002
"DOMEditHandler" : DOMEditHandler,
10381003
"showGoto" : showGoto,

LiveDevelopment/MultiBrowserImpl/transports/LivePreviewTransport.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ define(function (require, exports, module) {
7777
`TRANSPORT_CONFIG.PHOENIX_INSTANCE_ID = "${Phoenix.PHOENIX_INSTANCE_ID}";\n` +
7878
`TRANSPORT_CONFIG.LIVE_DEV_REMOTE_WORKER_SCRIPTS_FILE_NAME = "${LiveDevProtocol.LIVE_DEV_REMOTE_WORKER_SCRIPTS_FILE_NAME}";\n` +
7979
`TRANSPORT_CONFIG.LIVE_PREVIEW_DEBUG_ENABLED = ${logger.loggingOptions.logLivePreview};\n`+
80+
`TRANSPORT_CONFIG.TRUSTED_ORIGINS_EMBED = ${JSON.stringify(Phoenix.TRUSTED_ORIGINS)};\n`+
8081
transportScript;
8182
return LivePreviewTransportRemote.replace(replaceString, transportScript)
8283
+ "\n";

appConfig.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ window.AppConfig = {
2424
"app_notification_url": "assets/notifications/dev/",
2525
"app_update_url": "https://updates.phcode.io/tauri/update-latest-experimental-build.json",
2626
"linting.enabled_by_default": true,
27-
"build_timestamp": "2024-03-23T05:30:58.578Z",
27+
"build_timestamp": "2024-03-27T09:43:45.968Z",
2828
"googleAnalyticsID": "G-P4HJFPDB76",
2929
"googleAnalyticsIDDesktop": "G-VE5BXWJ0HF",
3030
"mixPanelID": "49c4d164b592be2350fc7af06a259bf3",
@@ -36,8 +36,8 @@ window.AppConfig = {
3636
"bugsnagEnv": "development"
3737
},
3838
"name": "Phoenix Code",
39-
"version": "3.5.2-20051",
40-
"apiVersion": "3.5.2",
39+
"version": "3.5.7-20071",
40+
"apiVersion": "3.5.7",
4141
"homepage": "https://core.ai",
4242
"issues": {
4343
"url": "https://github.com/phcode-dev/phoenix/issues"

assets/default-project/en.zip

0 Bytes
Binary file not shown.

assets/images/socialcard.png

24.6 KB
Loading

assets/sample-projects/HTML5.zip

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

0 commit comments

Comments
 (0)