Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
6e2c3dc
feat: live preview hover inspect ui initial
abose Jul 3, 2025
c8a0710
feat: live preview hover highlights improved
abose Jul 3, 2025
addf4c2
feat: element selection and content editable setting
abose Jul 6, 2025
98ddfb9
feat: create the DOM manipulation option box when an element is click…
devvaannsh Jul 16, 2025
07c32a0
feat: add click handler to the DOM advance option buttons
devvaannsh Jul 16, 2025
d84ae16
fix: dom more options box background color changing when hovered
devvaannsh Jul 16, 2025
24abd1f
feat: add border when a element is clicked
devvaannsh Jul 17, 2025
f7cd3f7
fix: change border to outline to prevent content shifting
devvaannsh Jul 17, 2025
4451767
fix: more options box positioning when live preview is scrolled
devvaannsh Jul 17, 2025
b6f481a
fix: offset height gives invalid px and puts the more options box bel…
devvaannsh Jul 17, 2025
e10e89d
fix: box getting out of viewport horizontally
devvaannsh Jul 17, 2025
22a16a4
fix: positioning of the element info box
devvaannsh Jul 17, 2025
6a661bd
fix: horizontal positioning of both the boxes
devvaannsh Jul 17, 2025
7fe3498
feat: enable deletion of elements in source code from live preview
devvaannsh Jul 18, 2025
8451ee0
fix: use existing APIs to reference the source code of the element gi…
devvaannsh Jul 18, 2025
42c5178
fix: remove the popup after it is handled
devvaannsh Jul 18, 2025
ff22ce6
feat: implement live preview duplicate option functionality
devvaannsh Jul 18, 2025
a5d982f
feat: implement select-parent option in live preview edit
devvaannsh Jul 19, 2025
0cc7413
fix: implement shadow DOM to prevent box styles being overridden by u…
devvaannsh Jul 19, 2025
444d009
fix: box now moves along with the selected element when scrolled
devvaannsh Jul 19, 2025
735627f
fix: positioning of the info box
devvaannsh Jul 19, 2025
c2f8cad
fix: remove properties after setting values
devvaannsh Jul 20, 2025
25d823c
feat: add event listener for dragging inside live preview
devvaannsh Jul 20, 2025
29df4b8
feat: implement live preview edit text functionality
devvaannsh Jul 20, 2025
db02790
fix: duplication issue when there is some content before the element
devvaannsh Jul 21, 2025
1794526
fix: disbale live preview edit for html & body tags
devvaannsh Jul 21, 2025
d4b0e20
fix: show more options box at the correct position when live preview …
devvaannsh Jul 21, 2025
216c83d
fix: bold italic type of tags break inside live preview and leaks int…
devvaannsh Jul 21, 2025
d37c0d3
fix: use current live doc instead of active editor
devvaannsh Jul 21, 2025
186c5ae
fix: editing text inside live preview leaks phoenix internal attributes
devvaannsh Jul 22, 2025
baae736
fix: file rename to make it consistent
devvaannsh Jul 22, 2025
1159d1a
fix: typo in file name
devvaannsh Jul 22, 2025
ebc68ae
fix: show info box along with more option box when a DOM element is c…
devvaannsh Jul 22, 2025
3fb7175
fix: overlapping issue between the info box and the more options box
devvaannsh Jul 23, 2025
d222ea6
fix: calculate info box width based on char count
devvaannsh Jul 23, 2025
fdaa01a
fix: positioning of the info box
devvaannsh Jul 23, 2025
dca465f
fix: info box getting out of bounds
devvaannsh Jul 23, 2025
80bbb32
fix: remove redundant positioning checks
devvaannsh Jul 23, 2025
2e7ea12
feat: enable undo in live preview to undo live preview edit operations
devvaannsh Jul 23, 2025
f9df628
feat: drag drop live preview implementation
devvaannsh Jul 24, 2025
bc07af8
fix: indent of target element after drag & drop operation
devvaannsh Jul 24, 2025
06f2944
feat: allow dropping before as well as after the element
devvaannsh Jul 24, 2025
e832ac2
fix: internal live preview editing styles leak on users source code
devvaannsh Jul 25, 2025
d91dc27
fix: remove extra line after drag-drop operation
devvaannsh Jul 25, 2025
1d7f006
feat: remove boxes when escape key is pressed or user clicks on a emp…
devvaannsh Jul 25, 2025
898ace0
fix: delete empty lines when deleting an element from the live preview
devvaannsh Jul 25, 2025
e78ec69
fix: error when trying to remove node info box
devvaannsh Jul 25, 2025
85d08de
fix: live preview not handling escape keypress when highlight pref is on
devvaannsh Jul 25, 2025
6823f6a
feat: enable redo when ctrl + y is pressed in live preview
devvaannsh Jul 26, 2025
9b47097
fix: prevent links and buttons to move to another webpage when edit m…
devvaannsh Jul 26, 2025
0eea051
feat: add pen icon to edit text in the more options box
devvaannsh Jul 26, 2025
8662ebc
fix: more options box doesn't appear because click event was removed
devvaannsh Jul 26, 2025
1ecee71
fix: do delete and duplicate operation in batch so that undo and redo…
devvaannsh Jul 26, 2025
f8d2e96
feat: hide edit option when element is non-editable
devvaannsh Jul 26, 2025
a007746
feat: hide select-parent option when element doesn't supports it
devvaannsh Jul 26, 2025
19755fb
fix: unable to edit text inside elements with no text content
devvaannsh Jul 26, 2025
c1f5191
fix: more options box gets out of viewport with very long elements
devvaannsh Jul 26, 2025
cb92fa1
fix: button's onclick was overriding more options box
devvaannsh Jul 26, 2025
a38b2f9
fix: revert code as it broke the existing tests
devvaannsh Jul 26, 2025
7f4c6cd
fix: more option box reappearing after operation performed
devvaannsh Jul 27, 2025
218b316
fix: info box not visible in viewport when element is at the very bottom
devvaannsh Jul 27, 2025
ab82a76
fix: more options box not getting hidden after drag & drop operation
devvaannsh Jul 27, 2025
72e5d72
fix: make sure info box is within live preview bounds
devvaannsh Jul 27, 2025
44699c5
fix: remove boxes when user scrolls the live preview
devvaannsh Jul 27, 2025
518d693
fix: remove more options box when user starts editing
devvaannsh Jul 27, 2025
29f5f2d
fix: drag & drop logic breaks when target is after source
devvaannsh Jul 27, 2025
4de8d9a
fix: move cursor to end of the text content when editing a text
devvaannsh Jul 27, 2025
52d90c9
fix: unable to select text because start editing was called again and…
devvaannsh Jul 27, 2025
bb9c0cc
fix: text content becomes undefined when user presses escape
devvaannsh Jul 27, 2025
4f37db1
fix: duplication and deletion gives syntax error when code is not bea…
devvaannsh Jul 30, 2025
c24875a
fix: use start range from instead of the current cursor position to f…
devvaannsh Jul 30, 2025
018a586
fix: use findMatchingTag to get the end position as it is more robust
devvaannsh Jul 30, 2025
4fc035e
fix: fix architecture of move function by using the getMatchingTag fu…
devvaannsh Jul 30, 2025
ae230ea
fix: browser removing incorrect css syntax from code which is uninten…
devvaannsh Jul 31, 2025
3808094
refactor: remove dead code
devvaannsh Aug 1, 2025
36a0fdd
fix: operations doesn't work for empty tags as we were relying on the…
devvaannsh Aug 1, 2025
943f651
refactor: allow buttons to be editable
devvaannsh Aug 1, 2025
e67fd2d
fix: text formatting not working when trying to edit text in live pre…
devvaannsh Aug 2, 2025
cd61d01
fix: body tag gets removed from source code when trying to edit a bod…
devvaannsh Aug 2, 2025
d099ba2
refactor: calculate the position of the boxes
devvaannsh Aug 2, 2025
964d62f
fix: move boxes to down when no space at top
devvaannsh Aug 2, 2025
1b1ade5
feat: update background color when a option button is hovered
devvaannsh Aug 3, 2025
b3bc4d1
fix: positioning of the info box
devvaannsh Aug 3, 2025
31a9f7b
fix: node more options box positioning
devvaannsh Aug 3, 2025
7e4508d
fix: boxes overlapping each other
devvaannsh Aug 3, 2025
8960285
fix: use screenOffset to calculate overflow
devvaannsh Aug 3, 2025
6bfc561
fix: phoenix internal attributes leaking into users source code
devvaannsh Aug 3, 2025
7c965ee
fix: boxes gets out of viewport
devvaannsh Aug 3, 2025
a1501b1
feat: disable all the live preview advance features when its disabled
devvaannsh Aug 3, 2025
2c0130a
feat: add a setting to show elements highlights on hover or click
devvaannsh Aug 4, 2025
899728d
feat: change live preview effect when setting is changed
devvaannsh Aug 4, 2025
840b701
fix: element highlights setting not getting applied immediately directly
devvaannsh Aug 5, 2025
9c8859f
feat: add strings for elements highlight feature
devvaannsh Aug 5, 2025
bfd3c16
feat: improve styles for element highlight setting
devvaannsh Aug 5, 2025
81a2216
fix: make sure the info box never gets out of bounds
devvaannsh Aug 5, 2025
baaf59f
feat: show element highlights boxes when user edits source code for a…
devvaannsh Aug 5, 2025
75be123
fix: don't remove the boxes when the preview is scrolled
devvaannsh Aug 5, 2025
276979f
fix: don't show boxes on non-existant elements
devvaannsh Aug 6, 2025
a341479
fix: cursor jump to that start of element when an element in clicked …
devvaannsh Aug 6, 2025
97fb92d
fix: don't show UI boxes when element is hidden
devvaannsh Aug 6, 2025
8b30015
refactor: update duplicate icon
devvaannsh Aug 6, 2025
bcf9736
fix: live preview jumping automatically
devvaannsh Aug 7, 2025
a210f97
feat: advance drag-drop implementation
devvaannsh Aug 7, 2025
1d6fd2e
refactor: make code more DRY
devvaannsh Aug 7, 2025
8dead8c
fix: indentation not consistent after drag-drop
devvaannsh Aug 8, 2025
a968827
fix: boxes drifts away from elements when elements are fixed positioned
devvaannsh Aug 8, 2025
fa1c4f4
fix: don't close popup after duplicate operation
devvaannsh Aug 8, 2025
1fab5c6
fix: data-ld-highlight attribute leaks in the source code
devvaannsh Aug 8, 2025
b226601
fix: drag-drop causing elements to disappear when target is inside so…
devvaannsh Aug 10, 2025
13037e0
fix: get actual indent instead of assuming it to be 4 spaces
devvaannsh Aug 10, 2025
65704aa
fix: boxes disappear when scrolling too slow
devvaannsh Aug 11, 2025
e8deb87
fix: drag markers not getting positioned correctly when webpage has f…
devvaannsh Aug 11, 2025
802a353
fix: boxes overlapping when triggered for different elements
devvaannsh Aug 11, 2025
53aff27
feat: allow auto scrolling when on viewport edges
devvaannsh Aug 11, 2025
678df80
fix: when highlight is set to false livePreviewEdit on hover also sto…
devvaannsh Aug 11, 2025
edd0d82
fix: background color from some elements doesn't get removed when con…
devvaannsh Aug 11, 2025
c3127a6
feat: add select mode button in the live preview toolbar
devvaannsh Aug 12, 2025
482cbea
chore: remove highlights button from live preview toolbar
devvaannsh Aug 12, 2025
51da71b
fix: remove markers and highlights when edit mode is disabled
devvaannsh Aug 12, 2025
e629173
fix: flickering issue with very long elements
devvaannsh Aug 12, 2025
adf0e43
feat: add preview mode option in live preview
devvaannsh Aug 14, 2025
5dc3885
feat: add AI prompt box in live preview
devvaannsh Aug 15, 2025
efd41fc
feat: add live preview mode settings to preferences
devvaannsh Aug 15, 2025
014044f
feat: move all the strings to strings.js file
devvaannsh Aug 15, 2025
97bcc75
refactor: clean the select parent function
devvaannsh Aug 16, 2025
0e4a28c
feat: move edit elements on hover from settings to dropdown
devvaannsh Aug 16, 2025
782048c
fix: clean dirty icons when no changes are made in the editor
devvaannsh Aug 16, 2025
855eb85
fix: error when click highlight is null and adding a selector to that
devvaannsh Aug 16, 2025
981da5d
feat: add checkmark icon in the current active mode
devvaannsh Aug 16, 2025
8859176
fix: ai box width set on smaller screens
devvaannsh Aug 16, 2025
cd1b780
feat: show pro icon on edit mode
devvaannsh Aug 18, 2025
0eee7dd
feat: send data to AI when element is edited with AI
devvaannsh Aug 18, 2025
0b871bc
feat: show dialog when subscribe button is clicked
devvaannsh Aug 18, 2025
b3a587d
feat: allow selecting model when sending message to AI
devvaannsh Aug 18, 2025
d4a86c9
fix: background color doesn't get removed when switching from edit mo…
devvaannsh Aug 19, 2025
659853c
fix: user styles overriding our elements styling
devvaannsh Aug 21, 2025
d23af23
chore: move strings to related strings file
devvaannsh Aug 21, 2025
87261a0
fix: minor styling fixes
devvaannsh Aug 21, 2025
1a929d1
refactor: make highlight/edit mode as default when edit features are …
devvaannsh Aug 21, 2025
e63a372
fix: tests failing because of edit mode default behaviour
devvaannsh Aug 21, 2025
a9db70d
fix: drag operating affecting styles permanently for some elements
devvaannsh Aug 21, 2025
cccc40f
chore: retrigger CI after base moved
abose Aug 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 61 additions & 17 deletions src/LiveDevelopment/BrowserScripts/LiveDevProtocolRemote.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
}
};

global._Brackets_MessageBroker = MessageBroker;

/**
* Runtime Domain. Implements remote commands for "Runtime.*"
*/
Expand Down Expand Up @@ -390,27 +392,69 @@
function onDocumentClick(event) {
// Get the user's current selection
const selection = window.getSelection();

// Check if there is a selection
if (selection.toString().length > 0) {
// if there is any selection like text or others, we don't see it as a live selection event
// Eg: user may selects ome text in live preview to copy, in which case we should nt treat it
// as a live select.
return;
}
var element = event.target;
if (element && element.hasAttribute('data-brackets-id')) {
MessageBroker.send({
"tagId": element.getAttribute('data-brackets-id'),
"nodeID": element.id,
"nodeClassList": element.classList,
"nodeName": element.nodeName,
"allSelectors": _getAllInheritedSelectorsInOrder(element),
"contentEditable": element.contentEditable === 'true',
"clicked": true
});
// Check if it's a double-click for direct editing
if (event.detail === 2 && !['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName)) {
// Double-click detected, enable direct editing
// Make the element editable
if (window._LD && window._LD.DOMEditHandler) {
// Use the existing DOMEditHandler to handle the edit
window._LD.startEditing(element);
} else {
MessageBroker.send({
"tagId": element.getAttribute('data-brackets-id'),
"nodeID": element.id,
"nodeClassList": element.classList,
"nodeName": element.nodeName,
"allSelectors": _getAllInheritedSelectorsInOrder(element),
"contentEditable": element.contentEditable === 'true',
"clicked": true,
"edit": true
});
}

// Prevent default behavior and stop propagation
event.preventDefault();
event.stopPropagation();
} else {
// Regular click, just send the information
// Check if there is a selection
if (selection.toString().length > 0) {
// if there is any selection like text or others, we don't see it as a live selection event
// Eg: user may selects ome text in live preview to copy, in which case we should nt treat it
// as a live select.
return;
}
MessageBroker.send({
"tagId": element.getAttribute('data-brackets-id'),
"nodeID": element.id,
"nodeClassList": element.classList,
"nodeName": element.nodeName,
"allSelectors": _getAllInheritedSelectorsInOrder(element),
"contentEditable": element.contentEditable === 'true',
"clicked": true
});
}
}
}
window.document.addEventListener("click", onDocumentClick);
window.document.addEventListener("keydown", function (e) {
// for undo. refer to LivePreviewEdit.js file 'handleLivePreviewEditOperation' function
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to consider these playform specific shortcuts.Here’s the standard set of undo/redo shortcuts across major platforms:

Undo

  • Windows / Linux: Ctrl + Z
  • macOS: Cmd (⌘) + Z

Redo

There are two conventions for redo, depending on app:

  • Windows / Linux:

    • Most apps: Ctrl + Y
    • Some apps (especially text/code editors): Ctrl + Shift + Z
  • macOS:

    • Standard: Cmd (⌘) + Shift + Z

So the general pattern is:

  • Undo = Ctrl/Cmd + Z
  • Redo = Ctrl + Y (Win/Linux) or Cmd + Shift + Z (Mac), with some editors preferring Ctrl + Shift + Z everywhere for consistency.

MessageBroker.send({
livePreviewEditEnabled: true,
undoLivePreviewOperation: true
});
}

// for redo
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "y") {
MessageBroker.send({
livePreviewEditEnabled: true,
redoLivePreviewOperation: true
});
}
});

}(this));
Loading
Loading