From eb349ad1c0fe13b37bfd106ea061a4a8ed1e4885 Mon Sep 17 00:00:00 2001 From: nh758 <7259@pm.me> Date: Wed, 12 Feb 2025 11:51:23 +0700 Subject: [PATCH] add hooks to load editor and view properties from plugins https://github.com/digi-serve/planning/issues/572 --- src/rootPages/Designer/editors/EditorManager.js | 7 +++++++ src/rootPages/Designer/properties/PropertyManager.js | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/rootPages/Designer/editors/EditorManager.js b/src/rootPages/Designer/editors/EditorManager.js index 776d728..ccc29e6 100644 --- a/src/rootPages/Designer/editors/EditorManager.js +++ b/src/rootPages/Designer/editors/EditorManager.js @@ -4,6 +4,8 @@ * An Interface for managing all the various Component Editors we support. * */ +import _ABViewDefault from "./views/_ABViewDefault"; + export default function (AB) { const Editors = []; // {array} @@ -44,6 +46,11 @@ export default function (AB) { Editors.push(Klass); }); + // Load editors from plugins + AB.plugins().forEach((p) => { + if (p.editor) Editors.push(p.editor(AB, _ABViewDefault)); + }); + return { /* * @function editors diff --git a/src/rootPages/Designer/properties/PropertyManager.js b/src/rootPages/Designer/properties/PropertyManager.js index 369d08e..1221e71 100644 --- a/src/rootPages/Designer/properties/PropertyManager.js +++ b/src/rootPages/Designer/properties/PropertyManager.js @@ -4,6 +4,7 @@ * An Interface for managing all the various Property Editors we support. * */ +import ABView from "./views/ABView"; var PropertyMgr = null; @@ -121,6 +122,10 @@ export default function (AB) { Views.push(V.default(AB)); }); + AB.plugins().forEach((p) => { + if (p.viewProperty) Views.push(p.viewProperty(AB, ABView)); + }); + var MobileViews = []; // {array} // All the ABMobileViewXXX Property Interfaces Available.