This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
FIX: Creating a resizable panel using an HTML code fragment starting … #13574
Open
khatastroffik
wants to merge
3
commits into
adobe:master
Choose a base branch
from
khatastroffik:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…with a comment will break As mentioned in adobe#6252, the original error msg isn't really helpful. The modified msg could be improved as well, though: Since the content of the panel may be a **HTML fragment** (usually starting with a DIV node), mentioning that ```the **first** (root) DOM node must have an ID that will be used as a pref key``` would help. Nevertheless, the mangled code in WorkspaceManager.js isn't reliable since it will _break_ when the panel content **starts with a html comment**. Such a comment may be necessary when a plugin like HTMLhint is used. On a "panel" code fragment, this plugin attests an error due to a missing doctype. To disable this error, one may put a comment at the top of the html code: ```<!--htmlhint doctype-first: false-->```. WorkspaceManager.js will fail creating the panel, then. The proposed modification fixes such an issue. **sample test code for a resizable panel** ``` <!--htmlhint doctype-first: false--> <!--This comment is of no use but for testing purpose--> <div id="my-very-special-testing-panel"><span style="color: red">Elvis</span> was here!</div> ```
petetnt
approved these changes
Jul 21, 2017
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.
Hi @lbegue! Thanks for this contribution!
LGTM, maybe a inline comment on the change would be nice as it's not immediately obvious why the root node might not be what you expect it to be 👍
my pleasure :-) |
The function "normalizeKeyDescriptorString(origDescriptor)" is not declared as private (also apply to the API documentation), though it wasn't exported. The function should be made available, since it may be useful to develop extensions e.g. to check if a key is already bound by looking up in the key map for the corresponding (normalized) descriptor. See: http://brackets.io/docs/current/modules/command/KeyBindingManager.html
This change seems to break my extension when I add a comment at the start of the panel's html. // Since the panel source code may start with a html comment,
// the 'root' DOM node must be targeted explicitly using a filter removing all comments.
this.$panel = $panel.filter("*");
var $rootNodeWithID = this.panel[0]; PS: In future I would prefer if you don't misk unrelated things in the same PR. So the normalizedKey thing should have been in another PR, but not a big deal in this case. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
…with a comment will break
As mentioned in #6252, the original error msg isn't really helpful.
The modified msg could be improved as well, though:
Since the content of the panel may be a HTML fragment (usually starting with a DIV node), mentioning that
the first (root) DOM node must have an ID that will be used as a pref key
would help.Nevertheless, the mangled code in WorkspaceManager.js isn't reliable since it will break when the panel content starts with a html comment. Such a comment may be necessary when a plugin like HTMLhint is used. On a "panel" code fragment, this plugin attests an error due to a missing doctype. To disable this error, one may put a comment at the top of the html code:
<!--htmlhint doctype-first: false-->
. WorkspaceManager.js will fail creating the panel, then. The proposed modification fixes such an issue.sample test code for a resizable panel