|
@@ -8,7 +8,7 @@ import {Files} from "./dock/Files";
|
|
|
import {Outline} from "./dock/Outline";
|
|
|
import {Bookmark} from "./dock/Bookmark";
|
|
|
import {Tag} from "./dock/Tag";
|
|
|
-import {getAllModels, getAllTabs} from "./getAll";
|
|
|
+import {getAllModels, getAllTabs, getAllWnds} from "./getAll";
|
|
|
import {Asset} from "../asset";
|
|
|
import {Search} from "../search";
|
|
|
import {Dock} from "./dock";
|
|
@@ -53,6 +53,7 @@ export const setPanelFocus = (element: Element) => {
|
|
|
});
|
|
|
if (element.getAttribute("data-type") === "wnd") {
|
|
|
element.classList.add("layout__wnd--active");
|
|
|
+ element.querySelector(".layout-tab-bar .item--focus")?.setAttribute("data-activetime", (new Date()).getTime().toString());
|
|
|
} else {
|
|
|
element.classList.add("layout__tab--active");
|
|
|
Array.from(element.classList).find(item => {
|
|
@@ -123,14 +124,13 @@ export const switchWnd = (newWnd: Wnd, targetWnd: Wnd) => {
|
|
|
};
|
|
|
|
|
|
export const getWndByLayout: (layout: Layout) => Wnd = (layout: Layout) => {
|
|
|
- for (let i = 0; i < layout.children.length; i++) {
|
|
|
- const item = layout.children[i];
|
|
|
- if (item instanceof Wnd) {
|
|
|
- return item;
|
|
|
- } else {
|
|
|
- return getWndByLayout(item);
|
|
|
+ const wndsTemp: Wnd[] = [];
|
|
|
+ getAllWnds(layout, wndsTemp);
|
|
|
+ return wndsTemp.sort((a, b) => {
|
|
|
+ if (a.element.querySelector(".fn__flex .item--focus")?.getAttribute("data-activetime") > b.element.querySelector(".fn__flex .item--focus")?.getAttribute("data-activetime")) {
|
|
|
+ return -1;
|
|
|
}
|
|
|
- }
|
|
|
+ })[0];
|
|
|
};
|
|
|
|
|
|
const dockToJSON = (dock: Dock) => {
|