-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/ms 447/scorer highlight plugin #101
base: develop
Are you sure you want to change the base?
Conversation
function highlight(highlighter, selection) { | ||
highlighter.highlightRanges(getAllRanges(selection)); | ||
//Sending the highlighIndex to parent so that it can be saved on MS side | ||
parent.postMessage({ event: 'indexUpdated', payload: highlighter.getHighlightIndex() }, '*'); |
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.
passing * is not a very good practice, as we know the target where we want the message to be sent we should use that, the only problem is we are not storing it in tao so IDK how and where we should store this info in tao. Failing to provide a specific target discloses the data you send to any interested malicious site.
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.
issue: Indeed, this might be a flaw.
suggestion: We use to have iframe by the past, and we have a legacy component to post message to a parent window: iframNotifier
.
A property must be set by the parent to make the iframe elligible to communication.
However, I'm wondering if this module is not deprecated.
Even if you cannot control the parent window, couldn't you still declare a valid context from the config?
nitpick: Moreover, please always use window
to namespace global context objects.
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.
Hmm, seems like iframNotifier
doesn't work with cross-origin, hasAccess
doesn't pass
https://github.com/oat-sa/tao-core-libs-fe/blob/06905acf3ca51d67c54e474fc59806c4172264fc/src/iframeNotifier.js#L22
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.
Yes, you are right. The iframeNotifier
is meant to be used with fully controlled parents. If you use different domain names and servers it won't work. Moreover, I don't know if this module is still usable.
The overall idea is to secur the messaging, preventing the window to communicate with untrusted wrappers.
@@ -13,7 +13,7 @@ | |||
$previewFrameShadow: rgba(0, 0, 0, .7); | |||
|
|||
width: 100%; | |||
height: 100%; | |||
padding-top: 3rem; |
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.
why do we need to touch the scale plugin? 🤔
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.
thought: Indeed, please be careful with the scale plugin, especially with its style. It might introduce regressions as it is very sensible.
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.
Unfortunately I have scroll bars for .devices-previewer - height: 100%;
when the highlighter element is added to .content-wrapper 😔
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.
Can we add display: flex; flex-direction: column;
to .content-wrapper or it will break something, WDYT?
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.
Well, this is hard to tell. AFAIR the devicesPreviewer
plugin was a pain to make working on every browsers.
But the isn't .content-wrapper
used in other places? If you target it, you must ensure it will only apply for the previewer.
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.
Seems like .item-previewer-scope -> .content-wrapper
is used only here
extension-tao-testqti-previewer/views/js/previewer/provider/item/scss/inc/_previewer-layout.scss
Line 80 in c9fa1ab
.content-wrapper { |
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.
Code review only.
A few remarks, but the overall look good. GJ!
@@ -13,7 +13,7 @@ | |||
$previewFrameShadow: rgba(0, 0, 0, .7); | |||
|
|||
width: 100%; | |||
height: 100%; | |||
padding-top: 3rem; |
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.
thought: Indeed, please be careful with the scale plugin, especially with its style. It might introduce regressions as it is very sensible.
function highlight(highlighter, selection) { | ||
highlighter.highlightRanges(getAllRanges(selection)); | ||
//Sending the highlighIndex to parent so that it can be saved on MS side | ||
parent.postMessage({ event: 'indexUpdated', payload: highlighter.getHighlightIndex() }, '*'); |
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.
issue: Indeed, this might be a flaw.
suggestion: We use to have iframe by the past, and we have a legacy component to post message to a parent window: iframNotifier
.
A property must be set by the parent to make the iframe elligible to communication.
However, I'm wondering if this module is not deprecated.
Even if you cannot control the parent window, couldn't you still declare a valid context from the config?
nitpick: Moreover, please always use window
to namespace global context objects.
//hide highlighter menu by default | ||
hider.hide(this.$highlighterTray); | ||
|
||
testRunner.after('renderitem', function () { |
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.
nitpick: A namespace should be used here. So that you can unregister the handler upon destroy.
Pull request summary
Related to MS-447.
Scorer's Highlight plugin
How to test
On MS side: