Comments (3)
Jk. I figured it out. attaching the event listener in the onLoad like so
onLoad = () => {
const { design } = this.props.values;
if (design) {
window.unlayer.loadDesign(design);
}
window.unlayer.addEventListener('design:updated', (data) => {
this.setState({ designUpdated: true });
});
}
from react-email-editor.
@carylgaskell does your event listener trigger on each keystroke? As far as I can tell. A user can click into the editor and start typing and the 'design:updated' listener does not trigger. If the user clicks out of the iframe, it triggers.
There used to be a bunch of different listeners, and one of them (not sure which) would trigger the call back on each keystroke if someone were typing into the iframe. It was convenient, because, like you, i needed to know when the form was 'dirty'.
In lieu of that, I added an event listener to tell me when the user clicks into the iframe, which assumes that they will start typing once they click, which is not entirely ideal.
var listener = window.addEventListener('blur', () => {
if (document.activeElement.nodeName === "IFRAME") {
//do something here
}
window.removeEventListener('blur', listener);
});
from react-email-editor.
Here is a sample, with on change and load existing design.
https://github.com/ajiths10/EmailEditor-ReactApp/blob/main/src/component/AdvancedEditor.tsx
from react-email-editor.
Related Issues (20)
- Docs for Custom CSS - Available classes / variables to edit HOT 6
- Hide Drag and Drop
- Rich Text Editor doesn't work properly in custom tool.
- Adding custom loading spinner component HOT 2
- Usage and Save Post API request fails with 502 Request Code Bad Gateway HOT 4
- Running unlayer.init in React HOT 3
- Query regarding the APIs Auth Session triggered
- AccessDeniedAccess error HOT 10
- date field in form (Unlayer)
- image export failing
- List overflow causes vertical spacing between blocks
- Box on left and right side
- loading template in react-email-editor HOT 6
- How to add API-KEY in react-email-editor HOT 1
- how can disable a card like "HTML" and "menu" if we don't need it. IS there any option to disable cards HOT 1
- Renders twice with latest nextjs HOT 1
- "design:updated" event is not triggered when consecutive changes are made to the currently focused element
- manage colors via design tags
- Editor is reloading when press ENTER in the link inputs
- Unlayer Types not correct for the newer version HOT 7
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-email-editor.