Modal dialog in Web Author
Posted: Wed Sep 26, 2018 9:30 am
Hi,
I would like to launch dialog box on a button in Web Author.
On this dialog I would like to select one or more values in a select box. And after I would like to add these values in an attribute.
I try to make this dialog "modal" to wait before to continue handling.
It doesn't work : the dialog is displayed and at the same time the attribute is changed.
Do you know how to makes the dialog modal?
It is possible to get selected values in the dialog to use it?
My code:
Thanks.
I would like to launch dialog box on a button in Web Author.
On this dialog I would like to select one or more values in a select box. And after I would like to add these values in an attribute.
I try to make this dialog "modal" to wait before to continue handling.
It doesn't work : the dialog is displayed and at the same time the attribute is changed.
Do you know how to makes the dialog modal?
It is possible to get selected values in the dialog to use it?
My code:
Code: Select all
WebLinkAction.prototype.actionPerformed = function(callback) {
text = window.prompt("Please enter the link attribute");
this.dialog = workspace.createDialog();
this.dialog.setModal(true);
this.dialog.setPreferredSize(150,120);
this.dialog.setContentPreferredSize(150,120);
this.dialog.setTitle('Select audience');
this.dialog.setButtonConfiguration(sync.api.Dialog.ButtonConfiguration.OK_CANCEL);
this.dialog.getElement().innerHTML = '<select name="audience" multiple style="width:100px;height:100px;"><option value="internal">internal</option><option value="ADA">ADA</option></select>';
this.dialog.show();
this.editor.getActionsManager().invokeOperation(
'ro.sync.ecss.extensions.commons.operations.ChangeAttributeOperation', {
name: 'audience',
value: 'internal'
}, callback);
};