Skip to content

Commit

Permalink
fix horizontal scrolling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
acarl005 committed Mar 26, 2022
1 parent ea50095 commit c4b5603
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ I modified [CodeFlask](https://github.com/kazzkiq/CodeFlask) to be able to...
1. Make PrismJS a peer dependency
1. Attach custom event listeners to the editor
1. Support the [Line Highlight](https://prismjs.com/plugins/line-highlight/) plugin in PrismJS
1. Fix this issue: kazzkiq/CodeFlask#69

```javascript
import CodeFlask from "codeflask"
Expand All @@ -33,4 +34,4 @@ flask.highlightLines("4-7")
PrismJS is highly customizable.
It actually offers custom builds with more plugins that you can opt into.
This is an awesome and rare feature b/c you can minimize the bundle by omitting unneeded functionality.
Therefore, it should be a peer dependency, b/c CodeFlask can't know which build with which plugins you'll need.
Therefore, it should be a peer dependency, b/c CodeFlask can't know which build with which plugins you'll need.
2 changes: 1 addition & 1 deletion build/codeflask.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/codeflask.module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acarl005/codeflask",
"version": "2.0.5",
"version": "2.0.6",
"description": "A micro code-editor for awesome web pages",
"main": "build/codeflask.min.js",
"module": "build/codeflask.module.js",
Expand Down
1 change: 1 addition & 0 deletions src/codeflask.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export default class CodeFlask {
this.elPre.style.transform = `translate3d(-${e.target.scrollLeft}px, -${e.target.scrollTop}px, 0)`
if (this.elLineNumbers) {
this.elLineNumbers.style.transform = `translate3d(0, -${e.target.scrollTop}px, 0)`
this.elPre.style.width = `calc(100% - 40px + ${e.target.scrollLeft}px)`
}

This comment has been minimized.

Copy link
@Hydrock

Hydrock Jun 18, 2023

@acarl005 Can you make a Pull Request?

})
}
Expand Down
6 changes: 4 additions & 2 deletions src/styles/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ export const editorCss = `
height: 100%;
text-align: right;
color: #999;
z-index: 2;
border-right: 1px solid #f8f8f8;
background-color: #fafafa;
z-index: 5;

This comment has been minimized.

Copy link
@acarl005

acarl005 Mar 26, 2022

Author Owner

Make the line numbers overlap the code when the code scrolls left. It needs higher z-index and also its own background-color in order to cover the code beneath it

This comment has been minimized.

Copy link
@Hydrock

Hydrock Jun 18, 2023

I tried this part of css code on my CodeFlask. It strange, but my z-index property is crossed out.
image
Something happening, z-index doesn't work.

}
.codeflask__lines__line {
Expand All @@ -109,4 +111,4 @@ export const editorCss = `
background: #eee;
z-index: 1;
}
`
`

0 comments on commit c4b5603

Please sign in to comment.