-
Notifications
You must be signed in to change notification settings - Fork 10.3k
move hasHtml to AnnotationElement #6856
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
Conversation
@@ -199,6 +199,16 @@ var AnnotationElement = (function AnnotationElementClosure() { | |||
}, | |||
|
|||
/** | |||
* Check does this annotation need HTML element. |
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.
This sentence sounds a bit strange, how about e.g. Check if the annotation needs a HTML element.
instead?
I agree with the comments above. Aside from that, I think it's quite a lot of code compared to the current situation, with no clear advantage. We need to find a way to only call |
It is |
ed5003a
to
b0f8492
Compare
@@ -199,6 +199,16 @@ var AnnotationElement = (function AnnotationElementClosure() { | |||
}, | |||
|
|||
/** | |||
* Check if the annotation needs a HTML element. |
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.
Nit: an HTML element (here and below).
I agree with this sentiment. It seems like a lot of code to add, and I think that a "shorter" solution would be preferable. |
How about, instead of a method, use a member variable for this instead? I think |
@timvandermeij I was actually thinking something similar, but preferably I'd also avoid creating the container in this case. Similar to your idea, but could we maybe do something along these lines https://gist.github.com/Snuffleupagus/206b52763a250f6ba811? |
Yes, that looks like a clean solution to me! |
Updated per @Snuffleupagus's suggestion. |
@@ -310,7 +314,9 @@ var LinkAnnotationElement = (function LinkAnnotationElementClosure() { | |||
*/ | |||
var TextAnnotationElement = (function TextAnnotationElementClosure() { | |||
function TextAnnotationElement(parameters) { | |||
AnnotationElement.call(this, parameters); | |||
var isRenderable = !!(parameters.data.hasPopup|| |
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.
Nit: add a space after hasPopup
and before ||
5a274e4
to
89ebcbd
Compare
@Snuffleupagus Do you have any ideas to further improve this code (regarding the above)? |
@Snuffleupagus Ping for the above as I think this comment got lost in the pile of GitHub messages. This looks good as-is, but perhaps you have an idea to improve this even further (see above, about returning in the constructor). |
@@ -86,7 +86,8 @@ AnnotationElementFactory.prototype = | |||
return new StrikeOutAnnotationElement(parameters); | |||
|
|||
default: | |||
throw new Error('Unimplemented annotation type "' + subtype + '"'); | |||
warn('Unimplemented annotation type "' + parameters.data.subtype + '"'); | |||
return null; |
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.
Since we already warn
in annotation.js
for this case, I think that we can avoid duplicate warnings here.
Would return AnnotationElement(parameters);
make sense here, instead of returning null
?
Yeah, unfortunately that happened here (the problem with getting notified about everything), sorry for the lag! |
@timvandermeij @Snuffleupagus Updated. |
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/af7bec038130b4c/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/af7bec038130b4c/output.txt Total script time: 0.87 mins Published |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/7d57e20a57e6ddf/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/33aa3d9766f82fc/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/33aa3d9766f82fc/output.txt Total script time: 20.17 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/7d57e20a57e6ddf/output.txt Total script time: 21.66 mins
|
move hasHtml to AnnotationElement
Looks good, thank you! |
Required by #6172