Choose whether you want to use the public link or the protected link (requires authentication and authorization).
@@ -616,6 +621,7 @@ class CCPRemoteFileInputWidgetController extends CCPBaseInputWidgetController {
@@ -637,12 +643,28 @@ class CCPRemoteFileInputWidgetController extends CCPBaseInputWidgetController {
this.#publiclink = this.#protectedlink = this.#target = this.#index = null
const newev = new Event("input", { bubbles : true})
this.dispatchEvent(newev)
- }
- else return;
+ }else{
+ this.#publicorprotected_dialog.style.display = "none"
+ this.#publicorprotected_dialog.classList.remove("show")
+ this.#publiclink = this.#protectedlink = this.#target = this.#index = null
+ }
}
})
const ws = this.rootdoc.querySelector("div[name=ws]")
+ const st = ws.querySelector("d4s-storage-tree")
+ this.addEventListener("click", ev=>{
+ ev.stopPropagation()
+ ev.preventDefault()
+ if (ev.target.getAttribute("name") == "selectbtn") {
+ this.#publicorprotected_dialog.style.display = "block"
+ this.#publicorprotected_dialog.classList.add("show")
+ this.#target = this.querySelector("input")
+ this.#index = 0
+ this.#publiclink = st.d4sWorkspace.getPublicLink(st.currentId)
+ this.#protectedlink = st.d4sWorkspace.getDownloadLink(st.currentId)
+ }
+ })
this.rootdoc.querySelector("svg[name=trigger]").addEventListener("click", ev => {
ws.classList.toggle("d-none")
ev.preventDefault()
@@ -671,6 +693,13 @@ class CCPRemoteFileInputWidgetController extends CCPBaseInputWidgetController {
}
})
+ this.addEventListener("input", ev => {
+ ev.stopPropagation()
+ if (ev.target.getAttribute("name") == this.name && ev.target.getAttribute("data-index") != null) {
+ this.value[Number(ev.target.getAttribute("data-index"))] = ev.target.value
+ }
+ })
+
document.addEventListener("keydown", ev => {
if (ev.code == 'Escape') ws.classList.add("d-none");
})
diff --git a/storage/d4s-storage.js b/storage/d4s-storage.js
index 435090a..9f30865 100644
--- a/storage/d4s-storage.js
+++ b/storage/d4s-storage.js
@@ -16,10 +16,7 @@ class D4SStorageHtmlElement extends HTMLElement {
}
connectedCallback() {
- let linkElem = document.createElement('link');
- linkElem.setAttribute('rel', 'stylesheet');
- linkElem.setAttribute('href', 'https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css');
- this.shadowRoot.appendChild(linkElem);
+
}
get srcBaseURL() {
@@ -98,7 +95,7 @@ class D4SStorageToolbar extends D4SStorageHtmlElement {
class D4SStorageTree extends D4SStorageHtmlElement {
- static tree_event_name = "d4s-toolbar";
+ static tree_event_name = "d4s-tree";
static folder_data_event_name = "d4s-folder-data";
static dataid_attr = 'data-id';
@@ -226,8 +223,10 @@ class D4SStorageTree extends D4SStorageHtmlElement {
const div = document.createElement('div')
div.innerHTML = /*css*/`
+