Comments (3)
This can actually be done on a per-form basis by adding keyboardBuilder = true as a custom property in form settings. The related PRs can be found here and [here] (formio/formio.js#5152).
from react.
@lane-formio , I have tried the way you suggested but it doesn't suffice my requirement, instead what I did I have added a tabindex="0" to the formcomponent
const sideBarBtns = document.querySelectorAll(".formcomponent.drag-copy");
sideBarBtns.forEach((btn) => {
//console.log(btn);
btn.setAttribute("tabIndex", "0");
btn.addEventListener("keydown", function (e) {
performOnEnter(e);
});
});
and the tabIndex works fine. Now my intension is to open the Edit modal screen on "keydown"
event. To make this happen I feel that I have to extend the WebformBuilder
class. I'm importing the formiojs by var _formiojs = require("formiojs");
There I can see are few methods like initDragula
, onDrop
. Could you please suggest which method I should trigger?
Thanks in advance
from react.
At least got some success to open the edit modal on hitting the Enter key. Created a new method
WebformBuilder.default.prototype.addKeyBoardEvent = function () {
console.log('ADDKEYB', this);
this.refs['sidebar-component'].forEach((component) => {
component.setAttribute('tabindex', '0');
this.addEventListener(component, 'keydown', (event) => {
if (event.keyCode === 13) {
this.addNewComponent(component);
}
});
});
const componentEdit = this.componentEdit;
const _self = this;
if (componentEdit) {
const removeBtn = componentEdit.querySelector('[ref="removeButton"]');
removeBtn.addEventListener('keydown', (event) => {
if (event.keyCode === 13) {
console.log(this);
//this.saved = true;
//this.editForm.detach();
//this.removeComponent();
_self.dialog.close();
//this.highlightInvalidComponents();
}
});
}
};
called the method inside
WebformBuilder.default.prototype.initDragula = function () {
this.addKeyBoardEvent();
}
But I can observe (however I can understand that I'm doing wrong somewhere) that on hitting the "Enter" key on the "Save" button it's not working. Throwing an error "Cannot read properties of null (reading 'component')" . Any idea or feedback on this? Appreciate any help. Thanks.
from react.
Related Issues (20)
- Text Input Components is Not Supported Within Dialog Component Wrappers of bootstrap or material HOT 1
- Collapse does not work HOT 3
- Tailwind CSS integration with formio/react HOT 3
- <Form /> has runtime errors when `noDefault` is `true` HOT 1
- `readOnly` option change doesn't re-render the <Form /> editability status HOT 2
- How can I make reference to <Form /> from external javascript code ? HOT 1
- ReferenceError: navigator is not defined in Nextjs HOT 2
- importScript Error while Drag and Drap New Text field HOT 7
- Bug: Component Style Not Applied Correctly
- adding custom component to formio . HOT 1
- React is null in @formio/react src/components HOT 1
- [BUG] Warning for Custom Components above React version 18 HOT 1
- "window is not defined" error in Next.js 14 HOT 3
- Plugins don't support asynchronous functions HOT 4
- I am using FormBuilder in the react functional base component and am not able to re-render Formio Builder on state change.
- Using an external button and Hebrew name in API HOT 4
- Address field does not pre-fill when passing data into submission object HOT 3
- Drop babel-polyfill
- Parse library for data collected by form?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.