Skip to content

Commit 2c4fbf3

Browse files
committed
ktl-616 chore: support CodeMirror's scrollbar style param
1 parent c1a1ef1 commit 2c4fbf3

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
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: 1 addition & 1 deletion
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",

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)