Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch label text selection and cue for dragging #599

Merged
merged 8 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion omero_figure/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def index(request, file_id=None, conn=None, **kwargs):
# bootstrap-icons. Use CDN when served by vite, but use static copy
# when served by omero-web
html = html.replace(
"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/",
"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/",
static_dir)
return HttpResponse(html)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@popperjs/core": "^2.11.5",
"backbone": "^1.4.1",
"bootstrap": "^5.2.0",
"bootstrap-icons": "^1.9.1",
"bootstrap-icons": "^1.11.0",
"dompurify": "^2.5.4",
"jquery": "^3.6.0",
"marked": "^4.2.12",
Expand Down
12 changes: 10 additions & 2 deletions src/css/figure.css
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,14 @@
text-decoration: none;
}

.form-inline{
cursor: move;
/* Center the drag label icon */
#sort_label_icon {
vertical-align: middle;
margin-left: 12px;
display: inline-block;
font-size: 16px;
transform: scale(1.2);
transform-origin: center;
opacity: 0.7;
cursor: grab;
}
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<!-- Use cdn for vite, but this is served from static by Django -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css"
Tom-TBT marked this conversation as resolved.
Show resolved Hide resolved
/>
</head>
<body id="body">
Expand Down
4 changes: 3 additions & 1 deletion src/js/views/right_panel_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,9 @@
},
onEnd: function(evt) {
self.handle_sort(evt);
}
},
filter: 'input', // Required to to select text in the label input
preventOnFilter: false // Required to to select text in the label input
});

// Store the sortable instance
Expand Down
7 changes: 4 additions & 3 deletions src/templates/labels_form_inner.template.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<div class="input-group input-group-sm float-start">
<input type="text" class="label-text form-control input-sm"
<input type="text" class="label-text form-control input-sm"
placeholder="Label" value="<% print(_.escape(l.text)) %>" />
<% if (!edit){ %>
<div class="input-group-btn">
Expand Down Expand Up @@ -74,7 +74,7 @@
</div>

<div class="btn-group">
<button type="button" class="label-position btn btn-outline-secondary btn-sm dropdown-toggle"
<button type="button" class="label-position btn btn-outline-secondary btn-sm dropdown-toggle"
title="Position" data-bs-toggle="dropdown">
<i data-position="<%= position %>" class="<%= position_icon_cls %> dropdown_icon"></i>
<span class="caret"></span>
Expand Down Expand Up @@ -105,7 +105,7 @@
<i data-position="left" class="bi-box-arrow-left dropdown_icon"></i> Left</a>
</li>
<li><a class="dropdown-item" href="#">
<i data-position="leftvert" class="bi-box-arrow-left dropdown_icon"></i>
<i data-position="leftvert" class="bi-box-arrow-left dropdown_icon"></i>
Left vertical
</a>
</li>
Expand Down Expand Up @@ -164,6 +164,7 @@
</div>

<% if (edit){ %>
<i id="sort_label_icon" class="bi-arrow-down-up" title="Drag to rearrange labels" ></i>
<button type="button" title="Delete Label" class="close btn btn-sm btn-light delete-label" aria-hidden="true">&times;</button>
<% } else { %>

Expand Down