diff --git a/blocks/edit/da-library/da-library.js b/blocks/edit/da-library/da-library.js
index b43924882..a8fe73a0c 100644
--- a/blocks/edit/da-library/da-library.js
+++ b/blocks/edit/da-library/da-library.js
@@ -8,6 +8,7 @@ import {
createRef,
ref,
nothing,
+ repeat,
} from 'da-lit';
import { htmlToProse } from '../utils/helpers.js';
import { getNx, sanitizePathParts } from '../../../scripts/utils.js';
@@ -62,6 +63,7 @@ class DaLibrary extends LitElement {
_blockPreviewPath: { state: true },
_previewItemName: { Type: String },
_previewStatus: { Type: Object },
+ _activePane: { state: true },
};
constructor() {
@@ -114,6 +116,8 @@ class DaLibrary extends LitElement {
return;
}
+ this._activePane = library.name;
+
if (library.experience === 'dialog') {
let dialog = this.shadowRoot.querySelector('.da-dialog-plugin');
if (dialog) dialog.remove();
@@ -176,19 +180,16 @@ class DaLibrary extends LitElement {
}
const { target } = e;
- const type = target.dataset.libraryName;
target.closest('.palette-pane').classList.add('backward');
target.closest('.palette-pane').inert = true;
- const toShow = this.shadowRoot.querySelector(`[data-library-type="${type}"]`);
+ const toShow = this.shadowRoot.querySelector(`[data-library-type="${library.name}"]`);
toShow.classList.remove('forward');
toShow.inert = false;
- const pluginIframe = toShow.querySelector('iframe');
- if (!pluginIframe) return;
- pluginIframe.src = pluginIframe.dataset.src;
}
handleBack(e) {
const { target } = e;
+ this._activePane = null;
target.closest('.palette-pane').classList.add('forward');
target.closest('.palette-pane').inert = true;
const wrapper = target.closest('.palette-wrapper');
@@ -199,6 +200,7 @@ class DaLibrary extends LitElement {
handleCloseSearch() {
this._searchStr = '';
+ this._activePane = null;
this.searchInputRef.value.value = '';
}
@@ -383,7 +385,6 @@ class DaLibrary extends LitElement {
@close=${this.handlePreviewClose}>
${status === 200 ? html`` : html`
${error || 'This block/template has not been previewed.'}
`}
@@ -531,8 +532,7 @@ class DaLibrary extends LitElement {
return html`
`;
@@ -570,11 +570,7 @@ class DaLibrary extends LitElement {
this._previewStatus = { ...this._previewStatus, ...status };
}
- async renderLibrary({ name, sources, url, format, class: className }) {
- const isPlugin = className.split(' ').some((val) => val === 'is-plugin');
-
- if (isPlugin) return this.renderPlugin({ sources, url });
-
+ async renderLibrary({ name, sources, format }) {
if (name === 'blocks') {
if (!data.blocks) {
data.blocks = await getBlocks(sources);
@@ -623,12 +619,14 @@ class DaLibrary extends LitElement {
renderMainMenu() {
return html`
- ${this._libraryList.map(
+ ${repeat(
+ this._libraryList,
+ (library) => library.name,
(library) => html`
-