-
Notifications
You must be signed in to change notification settings - Fork 368
Put the left and right sides of the editor in separate scroll areas. #3832
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
Changes from all commits
34df5db
35cad34
44e5544
0aebe50
daec79f
9f97211
1c84c0c
86a0c74
e92260f
734ebef
fc7c446
c5b61ac
5343d60
f607ffb
b748a73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@khanacademy/perseus-editor": patch | ||
| --- | ||
|
|
||
| Put the left and right sides of the editor in separate scroll areas |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,7 +230,6 @@ code { | |
| } | ||
| #perseus { | ||
| margin: 20px; | ||
| width: calc(100% - 500px); | ||
| z-index: 10; | ||
| } | ||
| #perseus #problemarea #workarea { | ||
|
|
@@ -265,30 +264,43 @@ code { | |
| z-index: 3; | ||
| /* interactive-content */ | ||
| } | ||
| .perseus-editor-table { | ||
| clear: both; | ||
| display: table; | ||
| table-layout: fixed; | ||
| } | ||
| .perseus-editor-row { | ||
| display: table-row; | ||
|
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. Since you are removing the table-based styling for the row and cell, you should also remove the |
||
| display: flex; | ||
| flex-direction: row; | ||
| } | ||
| .perseus-editor-left-cell { | ||
| display: table-cell; | ||
| padding-right: 30px; | ||
| display: flex; | ||
| flex-direction: column; | ||
| vertical-align: top; | ||
| width: 360px; | ||
| max-width: 360px; | ||
| min-width: 360px; | ||
| position: relative; | ||
| z-index: 10; | ||
| /* Make the left cell scrollable. */ | ||
| overflow-y: auto; | ||
| /* Don't show the the horizontal scrollbar that only appears when | ||
| * the vertical scrollbar appears. */ | ||
| overflow-x: hidden; | ||
| /* Keep the left cell scroll area within the viewport. (244px to account | ||
| * for the header.) */ | ||
| max-height: calc(95vh - 244px); | ||
| } | ||
| .perseus-editor-right-cell { | ||
| box-sizing: border-box; | ||
| display: table-cell; | ||
| display: flex; | ||
| flex-direction: column; | ||
| padding: 30px; | ||
| padding-top: 5px; | ||
| vertical-align: top; | ||
| /* Make the right cell scrollable. */ | ||
| overflow-y: auto; | ||
| /* Keep the left cell scroll area within the viewport. (244px to account | ||
| * for the header.) */ | ||
| max-height: calc(95vh - 244px); | ||
| /* Don't shrink below the preview's intrinsic width. We need this to | ||
| * preserve the Tablet and Desktop preview widths. */ | ||
| flex-shrink: 0; | ||
| } | ||
| .perseus-hint-editor { | ||
| padding-bottom: 20px; | ||
|
|
@@ -330,10 +342,6 @@ code { | |
| margin-bottom: 20px; | ||
| margin-top: 20px; | ||
| } | ||
| .perseus-article-editor .perseus-editor-table { | ||
| margin-left: auto; | ||
| margin-right: auto; | ||
| } | ||
| .perseus-article-editor .perseus-single-editor { | ||
| margin-bottom: 10px; | ||
| } | ||
|
|
@@ -363,7 +371,14 @@ code { | |
| padding: 32px 20px; | ||
| } | ||
| .perseus-article-editor .editor-preview { | ||
| display: table-cell; | ||
| /* Make the preview scrollable. */ | ||
| overflow-y: auto; | ||
| /* Keep the left cell scroll area within the viewport. (244px to account | ||
| * for the header.) */ | ||
| max-height: calc(95vh - 244px); | ||
| /* Don't shrink below the preview's intrinsic width. We need this to | ||
| * preserve the Tablet and Desktop preview widths. */ | ||
| flex-shrink: 0; | ||
| } | ||
| .perseus-article-editor .editor-preview.full-width { | ||
| width: 100%; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,15 @@ const ExercisePreviewPage = () => { | |
| const [iframeId, setIframeId] = React.useState<string | null>(null); | ||
| const containerRef = React.useRef<HTMLDivElement>(null); | ||
|
|
||
| // Set the overflow to hidden on the body within the iframe | ||
| // to prevent nested scrollbars from appearing. | ||
| React.useEffect(() => { | ||
| document.body.style.overflow = "hidden"; | ||
|
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. I'm not really thrilled with setting the
Contributor
Author
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. I'm good with revisiting it another time. I'm not sure the best way to revisit the nested scroll bars otherwise. |
||
| return () => { | ||
| document.body.style.overflow = "auto"; | ||
| }; | ||
| }, []); | ||
|
|
||
| // Read iframe configuration from dataset attributes | ||
| React.useEffect(() => { | ||
| // eslint-disable-next-line no-restricted-syntax | ||
|
|
||
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.
These overflows were causing nested scroll bars within the preview iframe.