How to open a dialog from jiraIssueContents

Hi,
I am new to JIRA dev, but I couldn’t find a straight answer how to trigger a dialog.

I want to open a dialog window triggered by the button in jiraIssueContents.

What I do:


**atlassian-connect.json**
"modules": {
         "jiraIssueContents": [
             {
"target": {
					"type": "web_panel",
					"url": "/aPlugin.html"
				 },
				 "tooltip": {
				  "value": "This is a tooltip"
				},
                 "key": "startPlugin",
				 "icon": {
					"width": 20,
					"height": 20,
					"url": "/icon.jpg"
				},     
                 "name": {
                     "value": "button name"
                 }
             }
         ]
     }

**aPlugin.html**
<html lang="en">
    <head>
        <link rel="stylesheet" href="https://unpkg.com/@atlaskit/css-reset@2.0.0/dist/bundle.css" media="all">
        <script src="https://connect-cdn.atl-paas.net/all.js" async></script>
    </head>
	<script>
		AP.events.on('ISSUE_QUICK_ADD_CLICKED', function(event){
		  // display a dialog when quick add button was clicked. event = { isNewToIssue: boolean }
		  // isNewToIssue is true if this is first time content panel being added to current issue.
		  // isNewToIssue is false if content panel is already on issue view, and it is selected.
		  AP.dialog.create({
				key: 'sized-panel',
				width: '500px',
				height: '200px',
				chrome: true,
				header: JSON.stringify(event)
		  });
		 });
	</script>
</html>

Solved myself. I switched to ACE and used dialogs from atlassian-connect.json