-
-
Notifications
You must be signed in to change notification settings - Fork 18
Nav button fixes (BL-15345) #7565
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
e9255c0 to
3d2585d
Compare
JohnThomson
left a comment
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.
@JohnThomson reviewed 5 files and all commit messages, and made 7 comments.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @andrew-polk).
src/BloomBrowserUI/react_components/LinkTargetChooser/URLEditor.tsx line 108 at r1 (raw file):
function isExternalUrl(url: string): boolean { return /^(https?:)?\/\//i.test(url); }
Not quite sure which problem is being corrected here. It feels like a fairly drastic change...before we let C# handle any url not starting with /book, now we only let it handle https?: ones. I suppose it's unlikely we'd have any others, but a mailto: url could conceivably be wanted. Is there anything useful to say in a comment about why only http urls should be considered external?
src/BloomBrowserUI/bookEdit/js/CanvasElementContextControls.tsx line 1152 at r1 (raw file):
if ( !isNavigationButton(canvasElement) &&
I think it would be helpful to have a distinct comment here on why nav buttons don't do this...especially since having a link is the main reason for some kinds to exist. IIRC the reason is that it duplicates another command that is unique to nave buttons?
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 4927 at r1 (raw file):
undefined, undefined, keepInsideCanvas,
This is getting painful. Maybe it's time for finishAddingCanvasElement to take an object param, so you can include by name just the params you don't want a default for? I don't want to make a lot of extra work, so it's OK to say "too much trouble for now", but it seemed worth suggesting.
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 5216 at r1 (raw file):
{ width: 120, height: 120 }, doAfterElementCreated, true,
another example where it would be more readable as keepInsideCanvas: true
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 5460 at r1 (raw file):
// Technically, it only tries to move up and left if necessary to keep inside the canvas. if (keepInsideCanvas) {
Could we use all or part of the logic of ensureCanvasElementsIntersectParent() here? Or is it trying to do something distinctly different? I think it would be worth commenting, e.g., that here we want to make it entirely visible (if possible) whereas the other routine only wants to make sure it's at least partly visible.
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 5463 at r1 (raw file):
const bloomCanvas = bloomCanvasJQuery.get(0) as HTMLElement; const canvasSize = getExactClientSize(bloomCanvas); const elementWidth = canvasElement.clientWidth;
It should have a style.width and height, too...would we get any useful improvement in precision by using them?
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 5465 at r1 (raw file):
const elementWidth = canvasElement.clientWidth; const elementHeight = canvasElement.clientHeight; const currentLeft = CanvasElementManager.pxToNumber(
It's odd that we have elementWidth and elementHeight along with currentLeft and currentTop for variables that hold the current dimensions of the same element. I think it would be more readable if all four used one or the other. (I'd be inclined to use currentCeLeft etc.)
3d2585d to
24988aa
Compare
andrew-polk
left a comment
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.
@andrew-polk made 7 comments.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @JohnThomson).
src/BloomBrowserUI/bookEdit/js/CanvasElementContextControls.tsx line 1152 at r1 (raw file):
Previously, JohnThomson (John Thomson) wrote…
I think it would be helpful to have a distinct comment here on why nav buttons don't do this...especially since having a link is the main reason for some kinds to exist. IIRC the reason is that it duplicates another command that is unique to nave buttons?
Done.
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 4927 at r1 (raw file):
Previously, JohnThomson (John Thomson) wrote…
This is getting painful. Maybe it's time for finishAddingCanvasElement to take an object param, so you can include by name just the params you don't want a default for? I don't want to make a lot of extra work, so it's OK to say "too much trouble for now", but it seemed worth suggesting.
Done.
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 5216 at r1 (raw file):
Previously, JohnThomson (John Thomson) wrote…
another example where it would be more readable as keepInsideCanvas: true
Done.
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 5460 at r1 (raw file):
Previously, JohnThomson (John Thomson) wrote…
Could we use all or part of the logic of ensureCanvasElementsIntersectParent() here? Or is it trying to do something distinctly different? I think it would be worth commenting, e.g., that here we want to make it entirely visible (if possible) whereas the other routine only wants to make sure it's at least partly visible.
Done.
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 5463 at r1 (raw file):
Previously, JohnThomson (John Thomson) wrote…
It should have a style.width and height, too...would we get any useful improvement in precision by using them?
copilot doesn't think it is an improvement; but it did decide that getExactClientSize was an improvement
src/BloomBrowserUI/bookEdit/js/CanvasElementManager.ts line 5465 at r1 (raw file):
Previously, JohnThomson (John Thomson) wrote…
It's odd that we have elementWidth and elementHeight along with currentLeft and currentTop for variables that hold the current dimensions of the same element. I think it would be more readable if all four used one or the other. (I'd be inclined to use currentCeLeft etc.)
Done.
src/BloomBrowserUI/react_components/LinkTargetChooser/URLEditor.tsx line 108 at r1 (raw file):
Previously, JohnThomson (John Thomson) wrote…
Not quite sure which problem is being corrected here. It feels like a fairly drastic change...before we let C# handle any url not starting with /book, now we only let it handle https?: ones. I suppose it's unlikely we'd have any others, but a mailto: url could conceivably be wanted. Is there anything useful to say in a comment about why only http urls should be considered external?
Added comment and changed the name.
The main fix is to not include links in the current book which start with #.
JohnThomson
left a comment
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.
@JohnThomson reviewed 3 files and all commit messages, and resolved 7 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @andrew-polk).
This change is