You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugins/_index.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,6 +124,41 @@ Right now, you can only add one plugin of each type (e.g. one SelectTokenCallbac
124
124
</html>
125
125
```
126
126
127
+
#### `Autogrow`: Let code-input elements resize to fit their content (optionally between limits) {#playground-preset-prism-line-numbers}
128
+
129
+
```
130
+
<!DOCTYPE html>
131
+
<html>
132
+
<body>
133
+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
134
+
<!--Prism+code-input-->
135
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
#### `FindAndReplace`: Add an openable dialog to find and replace matches to a search term, including highlighting the matches {#playground-preset-find-and-replace}
Make code-input elements resize automatically and fit their content live using CSS classes, optionally between a minimum and maximum size specified using CSS variables.
34
+
35
+
Files: [autogrow.css](./autogrow.css) (NO JS FILE)
height:var(--code-input_autogrow_min-height)!important; /* So minimum height possible while containing highlighted code */
18
+
height:calc(var(--code-input_autogrow_min-height) -var(--padding-top,16px) -var(--padding-bottom,16px))!important; /* So minimum height possible while containing highlighted code */
width:var(--code-input_autogrow_min-width)!important; /* So minimum width possible while containing highlighted code */
30
+
width:calc(var(--code-input_autogrow_min-width) -var(--padding-left,16px) -var(--padding-right,16px))!important; /* So minimum width possible while containing highlighted code */
width:calc(var(--code-input_autogrow_min-width) -max(3.8em,var(--padding-left,16px)) -var(--padding-right,16px))!important; /* So minimum width possible while containing highlighted code */
testAssertion("Autogrow","font-size Decrease Decreases Height",textarea.parentElement.clientHeight<fullHeight,`${textarea.parentElement.clientHeight} should be < ${fullHeight}`);
addText(textarea,"// A very very very very extremely vastly very very very very long line of code is written here in this very comment; yes, this very comment!");
testAssertion("Autogrow","font-size Decrease Decreases Width",textarea.parentElement.clientWidth<fullWidth,`${textarea.parentElement.clientWidth} should be < ${fullWidth}`);
0 commit comments