Skip to content

Commit

Permalink
Merge pull request #140 from JetBrains/ktl-616-scrollbar-options
Browse files Browse the repository at this point in the history
ktl-616 Support CodeMirror's Scrollbar Style param
  • Loading branch information
nikpachoo authored Jan 12, 2022
2 parents f45153c + 2c4fbf3 commit 3be3c20
Show file tree
Hide file tree
Showing 5 changed files with 597 additions and 337 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ Use the following attributes on elements that are converted to editors to adjust

- `data-shorter-height="100"`: show expander if height more than value of attribute

- `data-scrollbar-style`: Chooses a [scrollbar implementation](https://codemirror.net/doc/manual.html#config). Defaults to `overlay`.

## Supported keyboard shortcuts

- Ctrl+Space — code completion
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kotlin-playground",
"version": "1.27.0",
"version": "1.27.1",
"description": "Self-contained component to embed in websites for running Kotlin code",
"keywords": [
"kotlin",
Expand Down Expand Up @@ -42,10 +42,10 @@
"monkberry-directives": "4.0.8",
"monkberry-events": "4.0.8",
"monkberry-loader": "4.0.9",
"node-sass": "^4.12.0",
"node-sass": "6.0.1",
"postcss-loader": "3.0.0",
"query-string": "^6.5.0",
"sass-loader": "7.1.0",
"sass-loader": "10.2.0",
"shelljs": "^0.8.3",
"style-loader": "^0.23.1",
"svg-fill-loader": "0.0.8",
Expand Down
2 changes: 1 addition & 1 deletion src/executable-code/executable-fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ export default class ExecutableFragment extends ExecutableCodeTemplate {
mode: options.mode,
theme: options.theme,
matchBrackets: options.matchBrackets,
scrollbarStyle: 'overlay',
scrollbarStyle: options.scrollbarStyle || 'overlay',
continueComments: true,
autoCloseBrackets: true,
indentUnit: options.indent,
Expand Down
7 changes: 5 additions & 2 deletions src/executable-code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const ATTRIBUTES = {
LINES: 'lines',
AUTO_INDENT: 'auto-indent',
TRACK_RUN_ID: 'data-track-run-id',
CROSSLINK: 'data-crosslink'
CROSSLINK: 'data-crosslink',
SCROLLBAR_STYLE: 'data-scrollbar-style'
};

const MODES = {
Expand Down Expand Up @@ -104,6 +105,7 @@ export default class ExecutableCode {
const autoIndent = targetNode.getAttribute(ATTRIBUTES.AUTO_INDENT) === "true";
const dataTrackRunId = targetNode.getAttribute(ATTRIBUTES.TRACK_RUN_ID);
const dataShorterHeight = targetNode.getAttribute(ATTRIBUTES.SHORTER_HEIGHT);
const dataScrollbarStyle = targetNode.getAttribute(ATTRIBUTES.SCROLLBAR_STYLE);
const mode = this.getMode(targetNode);
const code = replaceWhiteSpaces(targetNode.textContent);
const cfg = merge(defaultConfig, config);
Expand Down Expand Up @@ -171,7 +173,8 @@ export default class ExecutableCode {
isFoldedButton: isFoldedButton,
dataTrackRunId,
shorterHeight,
outputHeight
outputHeight,
scrollbarStyle: dataScrollbarStyle
}, eventFunctions));

this.config = cfg;
Expand Down
Loading

0 comments on commit 3be3c20

Please sign in to comment.