cern-sis / react-formule

User-friendly, extensible form builder for React based on JSON Schema and RJSF
https://cern-sis.github.io/react-formule/
MIT License
7 stars 3 forks source link

share: highlight anchored field on page load #59

Open pamfilos opened 5 days ago

pamfilos commented 5 days ago

e.g.:

diff --git a/src/forms/templates/Field/FieldTemplate.jsx b/src/forms/templates/Field/FieldTemplate.jsx
index 1f04f1d..86c277a 100644
--- a/src/forms/templates/Field/FieldTemplate.jsx
+++ b/src/forms/templates/Field/FieldTemplate.jsx
@@ -121,6 +121,14 @@ const FieldTemplate = ({
     </WrapIfAdditional>
   );

+  if ( window.location.hash.replace("#", "") === id) {
+    content = (
+      <span style={{width: "100%", backgroundColor: '#d0a95b94', display: 'block'}}>
+        {content}
+      </span>
+    )
+  }
+
   if (id != "root" || uiSchema["ui:object"] == "tabView") return content;
   else {
     return (