Skip to content

Commit 52c3c0a

Browse files
committed
deploy: 606b7d0
1 parent c030865 commit 52c3c0a

File tree

65 files changed

+1816
-1228
lines changed

Some content is hidden

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

65 files changed

+1816
-1228
lines changed

LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,9 @@ function RemoteFunctions(config = {}) {
11471147

11481148
NodeMoreOptionsBox.prototype = {
11491149
_registerDragDrop: function() {
1150+
// disable dragging on all elements and then enable it on the current element
1151+
const allElements = document.querySelectorAll('[data-brackets-id]');
1152+
allElements.forEach(el => el.setAttribute("draggable", false));
11501153
this.element.setAttribute("draggable", true);
11511154

11521155
this.element.addEventListener("dragstart", (event) => {
@@ -3006,6 +3009,8 @@ function RemoteFunctions(config = {}) {
30063009
// Make the element editable
30073010
element.setAttribute("contenteditable", "true");
30083011
element.focus();
3012+
// to compare with the new text content, if same we don't make any changes in the editor area
3013+
const oldContent = element.textContent;
30093014

30103015
// Move cursor to end if no existing selection
30113016
const selection = window.getSelection();
@@ -3015,19 +3020,46 @@ function RemoteFunctions(config = {}) {
30153020

30163021
dismissUIAndCleanupState();
30173022

3023+
// flag to check if escape is pressed, if pressed we prevent onBlur from handling it as keydown already handles
3024+
let isEscapePressed = false;
3025+
30183026
function onBlur() {
3019-
finishEditing(element);
3027+
// Small delay so that keydown can handle things first
3028+
setTimeout(() => {
3029+
if (isEscapePressed) {
3030+
isEscapePressed = false;
3031+
finishEditingCleanup(element);
3032+
return;
3033+
}
3034+
3035+
const newContent = element.textContent;
3036+
if (oldContent !== newContent) {
3037+
finishEditing(element);
3038+
} else { // if same content, we just cleanup things
3039+
finishEditingCleanup(element);
3040+
}
3041+
}, 10);
30203042
}
30213043

30223044
function onKeyDown(event) {
30233045
if (event.key === "Escape") {
3046+
isEscapePressed = true;
30243047
// Cancel editing
30253048
event.preventDefault();
3026-
finishEditing(element, false); // false means that the edit operation was cancelled
3049+
const newContent = element.textContent;
3050+
if (oldContent !== newContent) {
3051+
finishEditing(element, false); // false means that the edit operation was cancelled
3052+
} else { // no content change we can avoid sending details to the editor
3053+
finishEditingCleanup(element);
3054+
}
30273055
} else if (event.key === "Enter" && !event.shiftKey) {
3056+
isEscapePressed = false;
30283057
// Finish editing on Enter (unless Shift is held)
30293058
event.preventDefault();
30303059
finishEditing(element);
3060+
} else if ((event.key === " " || event.key === "Spacebar") && element.tagName.toLowerCase() === 'button') {
3061+
event.preventDefault();
3062+
document.execCommand("insertText", false, " ");
30313063
}
30323064
}
30333065

@@ -3041,9 +3073,7 @@ function RemoteFunctions(config = {}) {
30413073
};
30423074
}
30433075

3044-
// Function to finish editing and apply changes
3045-
// isEditSuccessful: this is a boolean value, defaults to true. false only when the edit operation is cancelled
3046-
function finishEditing(element, isEditSuccessful = true) {
3076+
function finishEditingCleanup(element) {
30473077
if (!isElementEditable(element) || !element.hasAttribute("contenteditable")) {
30483078
return;
30493079
}
@@ -3058,6 +3088,12 @@ function RemoteFunctions(config = {}) {
30583088
element.removeEventListener("keydown", element._editListeners.keydown);
30593089
delete element._editListeners;
30603090
}
3091+
}
3092+
3093+
// Function to finish editing and apply changes
3094+
// isEditSuccessful: this is a boolean value, defaults to true. false only when the edit operation is cancelled
3095+
function finishEditing(element, isEditSuccessful = true) {
3096+
finishEditingCleanup(element);
30613097

30623098
const tagId = element.getAttribute("data-brackets-id");
30633099
window._Brackets_MessageBroker.send({

LiveDevelopment/main.js

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -273,122 +273,6 @@ define(function main(require, exports, module) {
273273
return false;
274274
}
275275

276-
let $livePreviewPanel = null; // stores the live preview panel, need this as overlay is appended inside this
277-
let $overlayContainer = null; // the overlay container
278-
let shouldShowSyncErrorOverlay = true; // once user closes the overlay we don't show them again
279-
let shouldShowConnectingOverlay = true;
280-
let connectingOverlayTimer = null; // this is needed as we show the connecting overlay after 3s
281-
let connectingOverlayTimeDuration = 3000;
282-
283-
/**
284-
* this function is responsible to check whether to show the overlay or not and how it should be shown
285-
* because if user has closed the overlay manually, we don't show it again
286-
* secondly, for connecting overlay we show that after a 3s timer, but sync error overlay is shown immediately
287-
* @param {String} textMessage - the text that is written inside the overlay
288-
* @param {Number} status - 1 for connect, 4 for sync error but we match it using MultiBrowserLiveDev
289-
*/
290-
function _handleOverlay(textMessage, status) {
291-
if (!$livePreviewPanel) {
292-
$livePreviewPanel = $("#panel-live-preview");
293-
}
294-
295-
// remove any existing overlay & timer
296-
_hideOverlay();
297-
298-
// to not show the overlays if user has already closed it before
299-
if(status === MultiBrowserLiveDev.STATUS_CONNECTING && !shouldShowConnectingOverlay) { return; }
300-
if(status === MultiBrowserLiveDev.STATUS_SYNC_ERROR && !shouldShowSyncErrorOverlay) { return; }
301-
302-
// for connecting status, we delay showing the overlay by 3 seconds
303-
if(status === MultiBrowserLiveDev.STATUS_CONNECTING) {
304-
connectingOverlayTimer = setTimeout(() => {
305-
_createAndShowOverlay(textMessage, status);
306-
connectingOverlayTimer = null;
307-
}, connectingOverlayTimeDuration);
308-
return;
309-
}
310-
311-
// for sync error status, show immediately
312-
_createAndShowOverlay(textMessage, status);
313-
}
314-
315-
/**
316-
* this function is responsible to create & show the overlay.
317-
* so overlay is shown when the live preview is connecting or live preview stopped because of some syntax error
318-
* @param {String} textMessage - the text that is written inside the overlay
319-
* @param {Number} status - 1 for connect, 4 for sync error but we match it using MultiBrowserLiveDev
320-
*/
321-
function _createAndShowOverlay(textMessage, status) {
322-
if (!$livePreviewPanel) {
323-
$livePreviewPanel = $("#panel-live-preview");
324-
}
325-
326-
// create the overlay element
327-
// styled inside the 'src/extensionsIntegrated/Phoenix-live-preview/live-preview.css'
328-
$overlayContainer = $("<div>").addClass("live-preview-status-overlay"); // the wrapper for overlay element
329-
const $message = $("<div>").addClass("live-preview-overlay-message").text(textMessage);
330-
331-
// the close button at the right end of the overlay
332-
const $close = $("<div>").addClass("live-preview-overlay-close")
333-
.attr("title", Strings.LIVE_PREVIEW_HIDE_OVERLAY)
334-
.on('click', () => {
335-
if(status === MultiBrowserLiveDev.STATUS_CONNECTING) {
336-
shouldShowConnectingOverlay = false;
337-
} else if(status === MultiBrowserLiveDev.STATUS_SYNC_ERROR) {
338-
shouldShowSyncErrorOverlay = false;
339-
}
340-
_hideOverlay();
341-
});
342-
const $closeIcon = $("<i>").addClass("fas fa-times");
343-
344-
$close.append($closeIcon);
345-
$overlayContainer.append($message);
346-
$overlayContainer.append($close);
347-
$livePreviewPanel.append($overlayContainer);
348-
}
349-
350-
/**
351-
* responsible to hide the overlay
352-
*/
353-
function _hideOverlay() {
354-
_clearConnectingOverlayTimer();
355-
if ($overlayContainer) {
356-
$overlayContainer.remove();
357-
$overlayContainer = null;
358-
}
359-
}
360-
361-
/**
362-
* This is a helper function that just checks that if connectingOverlayTimer exists, we clear it
363-
*/
364-
function _clearConnectingOverlayTimer() {
365-
if (connectingOverlayTimer) {
366-
clearTimeout(connectingOverlayTimer);
367-
connectingOverlayTimer = null;
368-
}
369-
}
370-
371-
/**
372-
* this function adds/remove the full-width class from the overlay container
373-
* styled inside 'src/extensionsIntegrated/Phoenix-live-preview/live-preview.css'
374-
*
375-
* we need this because
376-
* normally when live preview has a good width (more than 305px) then a 3px divider is shown at the left end
377-
* so in that case we give the overlay a width of (100% - 3px),
378-
* but when the live preview width is reduced
379-
* then that divider line gets cut off, so in that case we make the width 100% for this overlay
380-
*
381-
* without this handling, a white gap appears on the left side, which is distracting
382-
*/
383-
function _setOverlayWidth() {
384-
if(!$overlayContainer || !$livePreviewPanel.length) { return; }
385-
if($livePreviewPanel.width() <= 305) {
386-
$overlayContainer.addClass("full-width");
387-
} else {
388-
$overlayContainer.removeClass("full-width");
389-
}
390-
}
391-
392276
/** Initialize LiveDevelopment */
393277
AppInit.appReady(function () {
394278
params.parse();
@@ -443,19 +327,6 @@ define(function main(require, exports, module) {
443327
exports.trigger(exports.EVENT_LIVE_PREVIEW_RELOAD, clientDetails);
444328
});
445329

446-
MultiBrowserLiveDev.on(MultiBrowserLiveDev.EVENT_STATUS_CHANGE, function(event, status) {
447-
if (status === MultiBrowserLiveDev.STATUS_CONNECTING) {
448-
_handleOverlay(Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, status);
449-
} else if (status === MultiBrowserLiveDev.STATUS_SYNC_ERROR) {
450-
_handleOverlay(Strings.LIVE_DEV_STATUS_TIP_SYNC_ERROR, status);
451-
} else {
452-
_hideOverlay();
453-
}
454-
});
455-
// to understand why we need this, pls read the _setOverlayWidth function
456-
new ResizeObserver(_setOverlayWidth).observe($("#main-plugin-panel")[0]);
457-
EditorManager.on("activeEditorChange", _hideOverlay);
458-
459330
// allow live preview to handle escape key event
460331
// Escape is mainly to hide boxes if they are visible
461332
WorkspaceManager.addEscapeKeyEventHandler("livePreview", _handleLivePreviewEscapeKey);

appConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ window.AppConfig = {
3131
"app_notification_url": "assets/notifications/dev/",
3232
"app_update_url": "https://updates.phcode.io/tauri/update-latest-experimental-build.json",
3333
"linting.enabled_by_default": true,
34-
"build_timestamp": "2025-09-10T09:22:02.772Z",
34+
"build_timestamp": "2025-09-14T06:18:11.483Z",
3535
"googleAnalyticsID": "G-P4HJFPDB76",
3636
"googleAnalyticsIDDesktop": "G-VE5BXWJ0HF",
3737
"mixPanelID": "49c4d164b592be2350fc7af06a259bf3",
@@ -43,7 +43,7 @@ window.AppConfig = {
4343
"bugsnagEnv": "development"
4444
},
4545
"name": "Phoenix Code",
46-
"version": "4.1.2-21429",
46+
"version": "4.1.2-21436",
4747
"apiVersion": "4.1.2",
4848
"homepage": "https://core.ai",
4949
"issues": {

assets/default-project/en.zip

0 Bytes
Binary file not shown.

assets/sample-projects/HTML5.zip

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

assets/sample-projects/explore.zip

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

0 commit comments

Comments
 (0)