This repository was archived by the owner on Mar 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
[Outline View] Added node have event handler information. #290
Closed
xuqingkuang
wants to merge
1
commit into
intel:master
from
xuqingkuang:outlineViewEventHandlerPrompt
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -160,7 +160,9 @@ | |
| return null; | ||
| return model.getSelectedNode() || model.getActivePage(); | ||
| }, | ||
| _renderPageNode: function (domNode, node) { | ||
| _renderSpecialNode: function (domNode, node) { | ||
| var id, titleNode, element, icon; | ||
| // Display ID when type is Page. | ||
| if (node.getType() === "Page") { | ||
| //set page id | ||
| var id = node.getProperty('id'), | ||
|
|
@@ -170,6 +172,20 @@ | |
| .appendTo(domNode.find("> a")); | ||
| titleNode.text(' (' + id + ')'); | ||
| } | ||
|
|
||
| // Add event handler icon to outline view. | ||
| if (node.hasEventHandlers()) { | ||
| element = domNode.find('a'); | ||
| icon = $('<a class="eventHandlerIcon" title="Open event handler.">Event Handler</a>') | ||
| .click(function(e) { | ||
| // After 0.1 second will trigger open dialog action | ||
| // Because property view construction is delayed. | ||
| setTimeout(function() { | ||
| $('#eventHandlerElement').trigger('click'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using ID to find an element is not reliable. As there are two property views, only the button in the property view of layoutView will be found and it might is showing another widget's property if it's invisible. |
||
| }, 100); | ||
| }); | ||
| element.append(icon); | ||
| } | ||
| }, | ||
| _render: function (domNode, data) { | ||
| var labelFunc, parentNode = data.getParent(), newTopLevelNode; | ||
|
|
@@ -187,7 +203,7 @@ | |
| $('<li class="label">' + label + '</li>') | ||
| .insertBefore(domNode).data('adm-node', parentNode); | ||
| } | ||
| this._renderPageNode(domNode, data); | ||
| this._renderSpecialNode(domNode, data); | ||
| }, | ||
| _nodeSelected: function (treeModelNode, data) { | ||
| this.options.model.setSelected(data.getUid()); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using setTimeout is not reliable and should be avoid if possible. A better solution might be to extract the event handler code to a function in eventHandler.js so that both property view and outline view can call it.