Browse Source

Support custom modal as function

pull/3795/head
Artur Arseniev 5 years ago
parent
commit
ba50f39307
  1. 2
      docs/modules/Modal.md
  2. 7
      src/modal_dialog/index.js

2
docs/modules/Modal.md

@ -114,7 +114,7 @@ editor.on('modal', props => {
// props.close (Function) - A callback to use when you want to close the modal programmatically
// Here you would put the logic to control your modal.
})
});
```

7
src/modal_dialog/index.js

@ -33,7 +33,7 @@
* @module Modal
*/
import { debounce, isString } from 'underscore';
import { debounce, isFunction, isString } from 'underscore';
import { createText } from '../utils/dom';
import defaults from './config/config';
import ModalM from './model/Modal';
@ -80,7 +80,10 @@ export default () => {
model.on(
'change',
debounce(() => {
em.trigger('modal', this._evData());
const data = this._evData();
const { custom } = this.getConfig();
isFunction(custom) && custom(data);
em.trigger('modal', data);
})
);

Loading…
Cancel
Save