Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3485117
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3485117
Commits
dcf9ab4a
Commit
dcf9ab4a
authored
9 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2489826
by droplet: tabledrag is broken
parent
73b5652a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/misc/tabledrag.js
+15
-15
15 additions, 15 deletions
core/misc/tabledrag.js
with
15 additions
and
15 deletions
core/misc/tabledrag.js
+
15
−
15
View file @
dcf9ab4a
...
...
@@ -313,18 +313,18 @@
var
self
=
this
;
var
$item
=
$
(
item
);
// Add a class to the title link
$item
.
find
(
'
td
'
).
eq
(
0
).
find
(
'
a
'
).
addClass
(
'
menu-item__link
'
);
$item
.
find
(
'
td
:first-of-type
'
).
find
(
'
a
'
).
addClass
(
'
menu-item__link
'
);
// Create the handle.
var
handle
=
$
(
'
<a href="#" class="tabledrag-handle"><div class="handle"> </div></a>
'
).
attr
(
'
title
'
,
Drupal
.
t
(
'
Drag to re-order
'
));
// Insert the handle after indentations (if any).
var
$indentationLast
=
$item
.
find
(
'
td
'
).
eq
(
0
).
find
(
'
.js-indentation
'
).
eq
(
-
1
);
var
$indentationLast
=
$item
.
find
(
'
td
:first-of-type
'
).
find
(
'
.js-indentation
'
).
eq
(
-
1
);
if
(
$indentationLast
.
length
)
{
$indentationLast
.
after
(
handle
);
// Update the total width of indentation in this entire table.
self
.
indentCount
=
Math
.
max
(
$item
.
find
(
'
.js-indentation
'
).
length
,
self
.
indentCount
);
}
else
{
$item
.
find
(
'
td
'
).
eq
(
0
).
prepend
(
handle
);
$item
.
find
(
'
td
:first-of-type
'
).
prepend
(
handle
);
}
if
(
Modernizr
.
touch
)
{
...
...
@@ -376,10 +376,10 @@
break
;
case
38
:
// Up arrow.
case
63232
:
// Safari up arrow.
var
$previousRow
=
$
(
self
.
rowObject
.
element
).
prev
(
'
tr
'
).
eq
(
0
);
var
$previousRow
=
$
(
self
.
rowObject
.
element
).
prev
(
'
tr
:first-of-type
'
);
var
previousRow
=
$previousRow
.
get
(
0
);
while
(
previousRow
&&
$previousRow
.
is
(
'
:hidden
'
))
{
$previousRow
=
$
(
previousRow
).
prev
(
'
tr
'
).
eq
(
0
);
$previousRow
=
$
(
previousRow
).
prev
(
'
tr
:first-of-type
'
);
previousRow
=
$previousRow
.
get
(
0
);
}
if
(
previousRow
)
{
...
...
@@ -391,7 +391,7 @@
// Swap with the previous top-level row.
groupHeight
=
0
;
while
(
previousRow
&&
$previousRow
.
find
(
'
.js-indentation
'
).
length
)
{
$previousRow
=
$
(
previousRow
).
prev
(
'
tr
'
).
eq
(
0
);
$previousRow
=
$
(
previousRow
).
prev
(
'
tr
:first-of-type
'
);
previousRow
=
$previousRow
.
get
(
0
);
groupHeight
+=
$previousRow
.
is
(
'
:hidden
'
)
?
0
:
previousRow
.
offsetHeight
;
}
...
...
@@ -419,10 +419,10 @@
break
;
case
40
:
// Down arrow.
case
63233
:
// Safari down arrow.
var
$nextRow
=
$
(
self
.
rowObject
.
group
).
eq
(
-
1
).
next
(
'
tr
'
).
eq
(
0
);
var
$nextRow
=
$
(
self
.
rowObject
.
group
).
eq
(
-
1
).
next
(
'
tr
:first-of-type
'
);
var
nextRow
=
$nextRow
.
get
(
0
);
while
(
nextRow
&&
$nextRow
.
is
(
'
:hidden
'
))
{
$nextRow
=
$
(
nextRow
).
next
(
'
tr
'
).
eq
(
0
);
$nextRow
=
$
(
nextRow
).
next
(
'
tr
:first-of-type
'
);
nextRow
=
$nextRow
.
get
(
0
);
}
if
(
nextRow
)
{
...
...
@@ -718,7 +718,7 @@
// take into account hidden rows. Skip backwards until we find a draggable
// row.
while
(
$row
.
is
(
'
:hidden
'
)
&&
$row
.
prev
(
'
tr
'
).
is
(
'
:hidden
'
))
{
$row
=
$row
.
prev
(
'
tr
'
).
eq
(
0
);
$row
=
$row
.
prev
(
'
tr
:first-of-type
'
);
row
=
$row
.
get
(
0
);
}
return
row
;
...
...
@@ -766,9 +766,9 @@
}
// Siblings are easy, check previous and next rows.
else
if
(
rowSettings
.
relationship
===
'
sibling
'
)
{
$previousRow
=
$changedRow
.
prev
(
'
tr
'
).
eq
(
0
);
$previousRow
=
$changedRow
.
prev
(
'
tr
:first-of-type
'
);
previousRow
=
$previousRow
.
get
(
0
);
var
$nextRow
=
$changedRow
.
next
(
'
tr
'
).
eq
(
0
);
var
$nextRow
=
$changedRow
.
next
(
'
tr
:first-of-type
'
);
var
nextRow
=
$nextRow
.
get
(
0
);
sourceRow
=
changedRow
;
if
(
$previousRow
.
is
(
'
.draggable
'
)
&&
$previousRow
.
find
(
'
.
'
+
group
).
length
)
{
...
...
@@ -811,7 +811,7 @@
// Use the first row in the table as source, because it's guaranteed to
// be at the root level. Find the first item, then compare this row
// against it as a sibling.
sourceRow
=
$
(
this
.
table
).
find
(
'
tr.draggable
'
).
eq
(
0
).
get
(
0
);
sourceRow
=
$
(
this
.
table
).
find
(
'
tr.draggable
:first-of-type
'
).
get
(
0
);
if
(
sourceRow
===
this
.
rowObject
.
element
)
{
sourceRow
=
$
(
this
.
rowObject
.
group
[
this
.
rowObject
.
group
.
length
-
1
]).
next
(
'
tr.draggable
'
).
get
(
0
);
}
...
...
@@ -1165,11 +1165,11 @@
for
(
var
n
=
1
;
n
<=
Math
.
abs
(
indentDiff
);
n
++
)
{
// Add or remove indentations.
if
(
indentDiff
<
0
)
{
$group
.
find
(
'
.js-indentation
'
).
eq
(
0
).
remove
();
$group
.
find
(
'
.js-indentation
:first-of-type
'
).
remove
();
this
.
indents
--
;
}
else
{
$group
.
find
(
'
td
'
).
eq
(
0
).
prepend
(
Drupal
.
theme
(
'
tableDragIndentation
'
));
$group
.
find
(
'
td
:first-of-type
'
).
prepend
(
Drupal
.
theme
(
'
tableDragIndentation
'
));
this
.
indents
++
;
}
}
...
...
@@ -1249,7 +1249,7 @@
*/
Drupal
.
tableDrag
.
prototype
.
row
.
prototype
.
markChanged
=
function
()
{
var
marker
=
Drupal
.
theme
(
'
tableDragChangedMarker
'
);
var
cell
=
$
(
this
.
element
).
find
(
'
td
'
).
eq
(
0
);
var
cell
=
$
(
this
.
element
).
find
(
'
td
:first-of-type
'
);
if
(
cell
.
find
(
'
abbr.tabledrag-changed
'
).
length
===
0
)
{
cell
.
append
(
marker
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment