Skip to content

Commit 8baf87a

Browse files
committed
deploy: 84352e3
1 parent f66fc0f commit 8baf87a

File tree

407 files changed

+226696
-336198
lines changed

Some content is hidden

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

407 files changed

+226696
-336198
lines changed

LiveDevelopment/BrowserScripts/LiveDevProtocolRemote.js

Lines changed: 17 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@
128128
}
129129
};
130130

131-
global._Brackets_MessageBroker = MessageBroker;
132-
133131
/**
134132
* Runtime Domain. Implements remote commands for "Runtime.*"
135133
*/
@@ -392,69 +390,27 @@
392390
function onDocumentClick(event) {
393391
// Get the user's current selection
394392
const selection = window.getSelection();
395-
var element = event.target;
396-
if (element && element.hasAttribute('data-brackets-id')) {
397-
// Check if it's a double-click for direct editing
398-
if (event.detail === 2 && !['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName)) {
399-
// Double-click detected, enable direct editing
400-
// Make the element editable
401-
if (window._LD && window._LD.DOMEditHandler) {
402-
// Use the existing DOMEditHandler to handle the edit
403-
window._LD.startEditing(element);
404-
} else {
405-
MessageBroker.send({
406-
"tagId": element.getAttribute('data-brackets-id'),
407-
"nodeID": element.id,
408-
"nodeClassList": element.classList,
409-
"nodeName": element.nodeName,
410-
"allSelectors": _getAllInheritedSelectorsInOrder(element),
411-
"contentEditable": element.contentEditable === 'true',
412-
"clicked": true,
413-
"edit": true
414-
});
415-
}
416393

417-
// Prevent default behavior and stop propagation
418-
event.preventDefault();
419-
event.stopPropagation();
420-
} else {
421-
// Regular click, just send the information
422-
// Check if there is a selection
423-
if (selection.toString().length > 0) {
424-
// if there is any selection like text or others, we don't see it as a live selection event
425-
// Eg: user may selects ome text in live preview to copy, in which case we should nt treat it
426-
// as a live select.
427-
return;
428-
}
429-
MessageBroker.send({
430-
"tagId": element.getAttribute('data-brackets-id'),
431-
"nodeID": element.id,
432-
"nodeClassList": element.classList,
433-
"nodeName": element.nodeName,
434-
"allSelectors": _getAllInheritedSelectorsInOrder(element),
435-
"contentEditable": element.contentEditable === 'true',
436-
"clicked": true
437-
});
438-
}
394+
// Check if there is a selection
395+
if (selection.toString().length > 0) {
396+
// if there is any selection like text or others, we don't see it as a live selection event
397+
// Eg: user may selects ome text in live preview to copy, in which case we should nt treat it
398+
// as a live select.
399+
return;
439400
}
440-
}
441-
window.document.addEventListener("click", onDocumentClick);
442-
window.document.addEventListener("keydown", function (e) {
443-
// for undo. refer to LivePreviewEdit.js file 'handleLivePreviewEditOperation' function
444-
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z") {
445-
MessageBroker.send({
446-
livePreviewEditEnabled: true,
447-
undoLivePreviewOperation: true
448-
});
449-
}
450-
451-
// for redo
452-
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "y") {
401+
var element = event.target;
402+
if (element && element.hasAttribute('data-brackets-id')) {
453403
MessageBroker.send({
454-
livePreviewEditEnabled: true,
455-
redoLivePreviewOperation: true
404+
"tagId": element.getAttribute('data-brackets-id'),
405+
"nodeID": element.id,
406+
"nodeClassList": element.classList,
407+
"nodeName": element.nodeName,
408+
"allSelectors": _getAllInheritedSelectorsInOrder(element),
409+
"contentEditable": element.contentEditable === 'true',
410+
"clicked": true
456411
});
457412
}
458-
});
413+
}
414+
window.document.addEventListener("click", onDocumentClick);
459415

460416
}(this));

LiveDevelopment/BrowserScripts/LivePreviewTransportRemote.js

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -103,37 +103,6 @@
103103
}
104104
}
105105

106-
function createLRU(max = 100) {
107-
const map = new Map();
108-
109-
return {
110-
set: function (key, value = true) {
111-
if (map.has(key)) {
112-
map.delete(key); // refresh order
113-
}
114-
map.set(key, value);
115-
if (map.size > max) {
116-
const oldestKey = map.keys().next().value;
117-
map.delete(oldestKey);
118-
}
119-
},
120-
has: function (key) {
121-
if (!map.has(key)) {
122-
return false;
123-
}
124-
const val = map.get(key);
125-
map.delete(key); // refresh order
126-
map.set(key, val);
127-
return true;
128-
},
129-
size: function() {
130-
return map.size;
131-
}
132-
};
133-
}
134-
135-
const processedMessageIDs = createLRU(1000);
136-
137106
const clientID = "" + Math.round( Math.random()*1000000000);
138107

139108
const worker = new Worker(TRANSPORT_CONFIG.LIVE_DEV_REMOTE_WORKER_SCRIPTS_FILE_NAME);
@@ -249,12 +218,7 @@
249218
case 'MESSAGE_FROM_PHOENIX':
250219
if (self._callbacks && self._callbacks.message) {
251220
const clientIDs = event.data.clientIDs,
252-
message = event.data.message,
253-
messageID = event.data.messageID;
254-
if(messageID && processedMessageIDs.has(messageID)){
255-
return; // we have already processed this message.
256-
}
257-
processedMessageIDs.set(messageID, true);
221+
message = event.data.message;
258222
if(clientIDs.includes(clientID) || clientIDs.length === 0){
259223
// clientIDs.length = 0 if the message is intended for all clients
260224
self._callbacks.message(message);
@@ -300,7 +264,6 @@
300264
_postLivePreviewMessage({
301265
type: 'BROWSER_MESSAGE',
302266
clientID: clientID,
303-
messageID: crypto.randomUUID(),
304267
message: msgStr
305268
});
306269
},

0 commit comments

Comments
 (0)