Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
open-source
gridstack.js
Commits
21db4200
Unverified
Commit
21db4200
authored
Aug 15, 2017
by
silverwind
Browse files
preserve inline styles when moving/cloning items
parent
202ce9dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/gridstack.js
View file @
21db4200
...
...
@@ -106,6 +106,13 @@
height
=
parseFloat
(
match
[
1
]);
}
return
{
height
:
height
,
unit
:
heightUnit
};
},
removePositioningStyles
:
function
(
el
)
{
var
style
=
el
[
0
].
style
;
if
(
style
.
position
)
style
.
removeProperty
(
'
position
'
);
if
(
style
.
left
)
style
.
removeProperty
(
'
left
'
);
if
(
style
.
top
)
style
.
removeProperty
(
'
top
'
);
}
};
...
...
@@ -869,13 +876,14 @@
$
(
ui
.
helper
).
remove
();
node
.
el
=
el
;
self
.
placeholder
.
hide
();
Utils
.
removePositioningStyles
(
el
);
el
.
attr
(
'
data-gs-x
'
,
node
.
x
)
.
attr
(
'
data-gs-y
'
,
node
.
y
)
.
attr
(
'
data-gs-width
'
,
node
.
width
)
.
attr
(
'
data-gs-height
'
,
node
.
height
)
.
addClass
(
self
.
opts
.
itemClass
)
.
removeAttr
(
'
style
'
)
.
enableSelection
()
.
removeData
(
'
draggable
'
)
.
removeClass
(
'
ui-draggable ui-draggable-dragging ui-draggable-disabled
'
)
...
...
@@ -1170,19 +1178,19 @@
}
else
{
self
.
_clearRemovingTimeout
(
el
);
if
(
!
node
.
_temporaryRemoved
)
{
Utils
.
removePositioningStyles
(
o
);
o
.
attr
(
'
data-gs-x
'
,
node
.
x
)
.
attr
(
'
data-gs-y
'
,
node
.
y
)
.
attr
(
'
data-gs-width
'
,
node
.
width
)
.
attr
(
'
data-gs-height
'
,
node
.
height
)
.
removeAttr
(
'
style
'
);
.
attr
(
'
data-gs-height
'
,
node
.
height
);
}
else
{
Utils
.
removePositioningStyles
(
o
);
o
.
attr
(
'
data-gs-x
'
,
node
.
_beforeDragX
)
.
attr
(
'
data-gs-y
'
,
node
.
_beforeDragY
)
.
attr
(
'
data-gs-width
'
,
node
.
width
)
.
attr
(
'
data-gs-height
'
,
node
.
height
)
.
removeAttr
(
'
style
'
);
.
attr
(
'
data-gs-height
'
,
node
.
height
);
node
.
x
=
node
.
_beforeDragX
;
node
.
y
=
node
.
_beforeDragY
;
self
.
grid
.
addNode
(
node
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment