Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ CodeSnap is highly configurable. Here's a list of settings you can change to tun

**`codesnap.backgroundColor`:** The background color of the snippet's container. Can be any valid CSS color.

**`codesnap.fixedWidth`:** The width of the container for the snippet. Can be any valid CSS width.

**`codesnap.boxShadow`:** The CSS box-shadow for the snippet. Can be any valid CSS box shadow.

**`codesnap.containerPadding`:** The padding for the snippet's container. Can be any valid CSS padding.
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
"default": "#abb8c3",
"description": "The background color of the snippet's container"
},
"codesnap.fixedWidth": {
"scope": "resource",
"type": "string",
"default": "",
"description": "The width of the container for the snippet (Leave blank for dynamic width)"
},
"codesnap.boxShadow": {
"scope": "resource",
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const getConfig = () => {

const extensionSettings = getSettings('codesnap', [
'backgroundColor',
'fixedWidth',
'boxShadow',
'containerPadding',
'roundedCorners',
Expand Down
4 changes: 3 additions & 1 deletion webview/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ window.addEventListener('message', ({ data: { type, ...cfg } }) => {
roundedCorners,
showWindowControls,
showWindowTitle,
windowTitle
windowTitle,
fixedWidth
} = config;

setVar('ligatures', fontLigatures ? 'normal' : 'none');
Expand All @@ -38,6 +39,7 @@ window.addEventListener('message', ({ data: { type, ...cfg } }) => {
setVar('box-shadow', boxShadow);
setVar('container-padding', containerPadding);
setVar('window-border-radius', roundedCorners ? '4px' : 0);
if (fixedWidth) setVar('window-width', fixedWidth);

navbarNode.hidden = !showWindowControls && !showWindowTitle;
windowControlsNode.hidden = !showWindowControls;
Expand Down
3 changes: 2 additions & 1 deletion webview/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ html {
--box-shadow: rgba(0, 0, 0, 0.55) 0px 20px 68px;
--container-padding: 3em;
--window-border-radius: 4px;
--window-width: max-content;
box-sizing: border-box;
}
body {
Expand Down Expand Up @@ -38,7 +39,7 @@ body {
box-shadow: var(--box-shadow);
overflow: hidden;
resize: horizontal;
width: max-content;
width: var(--window-width);
min-width: 100px;
padding: 18px;
background-color: var(--vscode-editor-background);
Expand Down