Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Live Preview : Duplicates elements on copy/paste of entire document #10634

Open
gideonthomas opened this issue Feb 19, 2015 · 3 comments
Open

Comments

@gideonthomas
Copy link

Hi,

It seems like when you copy and paste an entire html document into the editor (that already has content), DOM elements in the body are duplicated in the Live Preview. This happens regardless of whether the new body content you paste in is the same or different.

I am running the latest version of Brackets on Mac OS X Mavericks.

Here's a screencap of it:
livepreviewfail

Thanks :)

@gideonthomas
Copy link
Author

I dug into the code a bit and I think I tracked it down to this function

This statement results in null because the new <html> tag gets a new tagID which cannot be mapped to a corresponding <html> tag in the old DOM structure.

So, it fails the if(oldElement) check and executes this. In the function generateChildEdits, it fails this condition, not entering the loop where the delete/insert operation (delete the old html tag with the old tagID and insert the new one) happens. It instead only does the insert operation.

Seems like the problem comes from passing in null as the first parameter into generateChildEdits. But not sure how to fix it though.

@peterflynn
Copy link
Member

Possibly related to #5336

xyin96 added a commit to xyin96/brackets that referenced this issue Feb 25, 2015
xyin96 added a commit to xyin96/brackets that referenced this issue Feb 25, 2015
xyin96 added a commit to xyin96/brackets that referenced this issue Feb 25, 2015
gideonthomas pushed a commit to gideonthomas/brackets that referenced this issue Mar 13, 2015
gideonthomas pushed a commit to gideonthomas/brackets that referenced this issue Mar 13, 2015
gideonthomas pushed a commit to gideonthomas/brackets that referenced this issue Mar 13, 2015
gideonthomas added a commit to mozilla/brackets that referenced this issue Mar 13, 2015
gideonthomas added a commit to gideonthomas/brackets that referenced this issue Mar 13, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue Mar 18, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue Mar 18, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue Mar 18, 2015
humphd added a commit to mozilla/brackets that referenced this issue Apr 3, 2015
This reverts commit 3603319.
humphd added a commit to mozilla/brackets that referenced this issue Apr 3, 2015
This reverts commit f99cac9.
humphd added a commit to mozilla/brackets that referenced this issue Apr 3, 2015
This reverts commit d72b612.
humphd pushed a commit to mozilla/brackets that referenced this issue Apr 15, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue Apr 15, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue Apr 15, 2015
humphd added a commit to mozilla/brackets that referenced this issue Apr 15, 2015
This reverts commit 3603319.
humphd added a commit to mozilla/brackets that referenced this issue Apr 15, 2015
This reverts commit f99cac9.
humphd added a commit to mozilla/brackets that referenced this issue Apr 15, 2015
This reverts commit d72b612.
humphd pushed a commit to mozilla/brackets that referenced this issue May 15, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue May 15, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue May 15, 2015
humphd added a commit to mozilla/brackets that referenced this issue May 15, 2015
This reverts commit 3603319.
humphd added a commit to mozilla/brackets that referenced this issue May 15, 2015
This reverts commit f99cac9.
humphd added a commit to mozilla/brackets that referenced this issue May 15, 2015
This reverts commit d72b612.
humphd pushed a commit to mozilla/brackets that referenced this issue May 20, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue May 20, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue May 20, 2015
humphd added a commit to mozilla/brackets that referenced this issue May 20, 2015
This reverts commit 3603319.
humphd added a commit to mozilla/brackets that referenced this issue May 20, 2015
This reverts commit f99cac9.
humphd added a commit to mozilla/brackets that referenced this issue May 20, 2015
This reverts commit d72b612.
humphd pushed a commit to mozilla/brackets that referenced this issue May 26, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue May 26, 2015
humphd pushed a commit to mozilla/brackets that referenced this issue May 26, 2015
humphd added a commit to mozilla/brackets that referenced this issue May 26, 2015
This reverts commit 3603319.
humphd added a commit to mozilla/brackets that referenced this issue May 26, 2015
This reverts commit f99cac9.
humphd added a commit to mozilla/brackets that referenced this issue May 26, 2015
This reverts commit d72b612.
@MohabAli
Copy link

solved ... just disable (StaticServer)
go to ... Extension manager >> Default >> disable (StaticServer)
and use an alternative (Autosave) extension then enable (auto save (400 ms))
it will be in (File) after installation
https://github.com/nmaxcom/brackets-autosaver
run (live preview) enjoy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants