From d7a8212af2fc23e1f4cbfd73b79ff103fde11ebf Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sat, 21 Jul 2018 12:19:32 +0200 Subject: [PATCH] Add the possibility to open the modal with title and content via options `editor.Modal.open({ title: 'Title', content: 'Content' })` --- src/modal_dialog/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modal_dialog/index.js b/src/modal_dialog/index.js index efcbcbf30..62e4ad679 100644 --- a/src/modal_dialog/index.js +++ b/src/modal_dialog/index.js @@ -70,9 +70,14 @@ module.exports = () => { /** * Open the modal window + * @param {Object} [opts={}] Options + * @param {String|HTMLElement} [opts.title] Title to set for the modal + * @param {String|HTMLElement} [opts.content] Content to set for the modal * @return {this} */ - open() { + open(opts = {}) { + opts.title && this.setTitle(opts.title); + opts.content && this.setContent(opts.content); modal.show(); return this; },