Skip to content

Commit 3be3c20

Browse files
authored
Merge pull request #140 from JetBrains/ktl-616-scrollbar-options
ktl-616 Support CodeMirror's Scrollbar Style param
2 parents f45153c + 2c4fbf3 commit 3be3c20

File tree

5 files changed

+597
-337
lines changed

5 files changed

+597
-337
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ Use the following attributes on elements that are converted to editors to adjust
233233

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

236+
- `data-scrollbar-style`: Chooses a [scrollbar implementation](https://codemirror.net/doc/manual.html#config). Defaults to `overlay`.
237+
236238
## Supported keyboard shortcuts
237239

238240
- Ctrl+Space — code completion

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kotlin-playground",
3-
"version": "1.27.0",
3+
"version": "1.27.1",
44
"description": "Self-contained component to embed in websites for running Kotlin code",
55
"keywords": [
66
"kotlin",
@@ -42,10 +42,10 @@
4242
"monkberry-directives": "4.0.8",
4343
"monkberry-events": "4.0.8",
4444
"monkberry-loader": "4.0.9",
45-
"node-sass": "^4.12.0",
45+
"node-sass": "6.0.1",
4646
"postcss-loader": "3.0.0",
4747
"query-string": "^6.5.0",
48-
"sass-loader": "7.1.0",
48+
"sass-loader": "10.2.0",
4949
"shelljs": "^0.8.3",
5050
"style-loader": "^0.23.1",
5151
"svg-fill-loader": "0.0.8",

src/executable-code/executable-fragment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ export default class ExecutableFragment extends ExecutableCodeTemplate {
475475
mode: options.mode,
476476
theme: options.theme,
477477
matchBrackets: options.matchBrackets,
478-
scrollbarStyle: 'overlay',
478+
scrollbarStyle: options.scrollbarStyle || 'overlay',
479479
continueComments: true,
480480
autoCloseBrackets: true,
481481
indentUnit: options.indent,

src/executable-code/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ const ATTRIBUTES = {
5858
LINES: 'lines',
5959
AUTO_INDENT: 'auto-indent',
6060
TRACK_RUN_ID: 'data-track-run-id',
61-
CROSSLINK: 'data-crosslink'
61+
CROSSLINK: 'data-crosslink',
62+
SCROLLBAR_STYLE: 'data-scrollbar-style'
6263
};
6364

6465
const MODES = {
@@ -104,6 +105,7 @@ export default class ExecutableCode {
104105
const autoIndent = targetNode.getAttribute(ATTRIBUTES.AUTO_INDENT) === "true";
105106
const dataTrackRunId = targetNode.getAttribute(ATTRIBUTES.TRACK_RUN_ID);
106107
const dataShorterHeight = targetNode.getAttribute(ATTRIBUTES.SHORTER_HEIGHT);
108+
const dataScrollbarStyle = targetNode.getAttribute(ATTRIBUTES.SCROLLBAR_STYLE);
107109
const mode = this.getMode(targetNode);
108110
const code = replaceWhiteSpaces(targetNode.textContent);
109111
const cfg = merge(defaultConfig, config);
@@ -171,7 +173,8 @@ export default class ExecutableCode {
171173
isFoldedButton: isFoldedButton,
172174
dataTrackRunId,
173175
shorterHeight,
174-
outputHeight
176+
outputHeight,
177+
scrollbarStyle: dataScrollbarStyle
175178
}, eventFunctions));
176179

177180
this.config = cfg;

0 commit comments

Comments
 (0)