added media sorting to editor
This commit is contained in:
@@ -2,12 +2,49 @@
|
|||||||
// @import "../../public/skins/ui/oxide/content.min.css";
|
// @import "../../public/skins/ui/oxide/content.min.css";
|
||||||
// @import "../../public/skins/content/default/content.min.css";
|
// @import "../../public/skins/content/default/content.min.css";
|
||||||
|
|
||||||
.tox .tox-dialog.tox-dialog--width-lg {
|
.tox {
|
||||||
height: 650px;
|
.smeditor-select-group.tox-listboxfield {
|
||||||
max-height: 650px;
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.tox-dialog__body-content {
|
label {
|
||||||
height: auto !important;
|
font-size: 80%;
|
||||||
flex-basis: auto !important;
|
margin: 0 6px 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
right: 10px;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: 6px solid transparent;
|
||||||
|
border-right: 6px solid transparent;
|
||||||
|
border-top: 6px solid #000;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tox-listbox--select {
|
||||||
|
font-size: 80%;
|
||||||
|
padding-right: 28px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.smeditor-checkbox-group.tox-checkbox {
|
||||||
|
font-size: 80%;
|
||||||
|
margin: 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tox-dialog.tox-dialog--width-lg {
|
||||||
|
height: 650px;
|
||||||
|
max-height: 650px;
|
||||||
|
|
||||||
|
.tox-dialog__body-content {
|
||||||
|
height: auto !important;
|
||||||
|
flex-basis: auto !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,6 +445,14 @@ const imageBrowser = (callback, value, meta, gallery = false) => {
|
|||||||
searchFunc();
|
searchFunc();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
document.getElementById("image-library-sort-select").onchange =
|
||||||
|
function () {
|
||||||
|
updateLibrary();
|
||||||
|
};
|
||||||
|
document.getElementById("image-library-sort-desc-checkbox").onchange =
|
||||||
|
function () {
|
||||||
|
updateLibrary();
|
||||||
|
};
|
||||||
|
|
||||||
const libraryContainer = document.getElementById(
|
const libraryContainer = document.getElementById(
|
||||||
"image-library-content"
|
"image-library-content"
|
||||||
@@ -460,14 +468,40 @@ const imageBrowser = (callback, value, meta, gallery = false) => {
|
|||||||
loadingElem.classList.add("image-library-content-loading");
|
loadingElem.classList.add("image-library-content-loading");
|
||||||
libraryContainer.appendChild(loadingElem);
|
libraryContainer.appendChild(loadingElem);
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
limit: limit,
|
||||||
|
page: libraryPage,
|
||||||
|
mime: "image/",
|
||||||
|
title: title,
|
||||||
|
};
|
||||||
|
|
||||||
|
let sort = "";
|
||||||
|
const sortSelectElement = document.getElementById(
|
||||||
|
"image-library-sort-select"
|
||||||
|
) as HTMLSelectElement;
|
||||||
|
if (sortSelectElement !== null) {
|
||||||
|
if (sortSelectElement.value.length > 0) {
|
||||||
|
sort = sortSelectElement.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sortDescElement = document.getElementById(
|
||||||
|
"image-library-sort-desc-checkbox"
|
||||||
|
) as HTMLInputElement;
|
||||||
|
if (
|
||||||
|
sortDescElement !== null &&
|
||||||
|
sortDescElement.checked === true
|
||||||
|
) {
|
||||||
|
sort = `-${sort}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sort.length > 0) {
|
||||||
|
params["sort"] = sort;
|
||||||
|
}
|
||||||
|
|
||||||
api.get({
|
api.get({
|
||||||
url: "/media",
|
url: "/media",
|
||||||
params: {
|
params: params,
|
||||||
limit: limit,
|
|
||||||
page: libraryPage,
|
|
||||||
mime: "image/",
|
|
||||||
title: title,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
const data = result.data as MediaCollection;
|
const data = result.data as MediaCollection;
|
||||||
@@ -659,6 +693,20 @@ const imageBrowser = (callback, value, meta, gallery = false) => {
|
|||||||
type: "htmlpanel",
|
type: "htmlpanel",
|
||||||
html: `<div class="image-library">
|
html: `<div class="image-library">
|
||||||
<div id="image-library-toolbar">
|
<div id="image-library-toolbar">
|
||||||
|
<div class="smeditor-select-group image-library-sort-group tox-listboxfield">
|
||||||
|
<label for="image-library-sort-select">Sort:</label>
|
||||||
|
<select id="image-library-sort-select" class="tox-listbox--select">
|
||||||
|
<option value="">None</option>
|
||||||
|
<option value="title">Title</option>
|
||||||
|
<option value="created_at">Uploaded</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="smeditor-checkbox-group image-library-sort-desc-group tox-checkbox">
|
||||||
|
<label for="image-library-sort-desc-checkbox">
|
||||||
|
<input type="checkbox" id="image-library-sort-desc-checkbox">
|
||||||
|
Desc
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="image-library-search-group">
|
<div class="image-library-search-group">
|
||||||
<input type="text" id="image-library-search-input" placeholder="search" class="tox-textfield" />
|
<input type="text" id="image-library-search-input" placeholder="search" class="tox-textfield" />
|
||||||
<button id="image-library-search-button"><svg width="20" height="20" focusable="false"><path d="M14 15.7a6 6 0 1 1 1.06-1.06l3.54 3.54a1 1 0 0 1-1.06 1.06l-3.54-3.54Zm-4-.4a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9Z" fill-rule="nonzero"/></svg></button>
|
<button id="image-library-search-button"><svg width="20" height="20" focusable="false"><path d="M14 15.7a6 6 0 1 1 1.06-1.06l3.54 3.54a1 1 0 0 1-1.06 1.06l-3.54-3.54Zm-4-.4a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9Z" fill-rule="nonzero"/></svg></button>
|
||||||
@@ -856,13 +904,13 @@ const imageBrowser = (callback, value, meta, gallery = false) => {
|
|||||||
#image-library-toolbar {
|
#image-library-toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
|
||||||
.image-library-search-group {
|
.image-library-search-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
|
||||||
align-content: center;
|
align-content: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-right: 12px;
|
margin: 0 12px;
|
||||||
|
|
||||||
#image-library-search-input {
|
#image-library-search-input {
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|||||||
Reference in New Issue
Block a user