Skip to content

Commit

Permalink
Merge pull request #6 from AssisrMatheus/1.0.4
Browse files Browse the repository at this point in the history
1.0.4
  • Loading branch information
AssisrMatheus authored Nov 12, 2020
2 parents 582874e + 0e1e680 commit 39f4262
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 9 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- run: npm install
- uses: lannonbr/vsce-action@master
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v0
id: publishToOpenVSX
with:
args: 'publish -p $VSCE_TOKEN'
env:
VSCE_TOKEN: ${{ secrets.VSCE_PAT }}
pat: ${{ secrets.OPEN_VSX_TOKEN }}
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v0
with:
pat: ${{ secrets.VSCE_PAT }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }}
packagePath: ''
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,35 @@ Write down notes directly in the sidebar using markdown.

- Multiple pages
- Github Flavored Markdown Support
- The notes are saved when you close the editor

## Available configurations

- `sidebar-markdown-notes.leftMargin`: Adds a left margin to the entire view so it aligns with other content in the sidebar.

## Release Notes

### 1.0.4

- Added the `sidebar-markdown-notes.leftMargin` setting
- Changed background color from `--vscode-editor-background` to `--vscode-sideBar-background`
- Added the extension to [Open VSX Registry](https://open-vsx.org/)

### 1.0.3

- Fixed a bug where switching from preview/edit mode would not display anything

### 1.0.2

- Fixed a bug when loading saved nodes when switching pages

### 1.0.1

- Fixed a readme typo

### 1.0.0

Initial Release 🎉
- Initial Release 🎉

---

Expand Down
1 change: 1 addition & 0 deletions media/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
height: 100%;
resize: none;
outline: 0;
white-space: break-spaces;
}

html,
Expand Down
2 changes: 1 addition & 1 deletion media/vscode.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body {
font-size: var(--vscode-font-size);
font-weight: var(--vscode-font-weight);
font-family: var(--vscode-font-family);
background-color: var(--vscode-editor-background);
background-color: var(--vscode-sideBar-background);
}

ol,
Expand Down
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sidebar-markdown-notes",
"displayName": "sidebar-markdown-notes",
"description": "Take notes in your sidebar using markdown",
"version": "1.0.3",
"version": "1.0.4",
"publisher": "assisrMatheus",
"author": {
"email": "[email protected]",
Expand Down Expand Up @@ -96,7 +96,17 @@
"when": "view == sidebarMarkdownNotes.webview"
}
]
}
},
"configuration": [{
"title": "Sidebar markdown notes",
"properties": {
"sidebar-markdown-notes.leftMargin": {
"type": "boolean",
"default": false,
"description": "Whether or not a left margin should be added to the main view. To align it with other elements"
}
}
}]
},
"scripts": {
"vscode:prepublish": "npm run compile",
Expand Down
22 changes: 21 additions & 1 deletion src/webviewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default class SidebarMarkdownNotesProvider implements vscode.WebviewViewP

private _view?: vscode.WebviewView;

private config = vscode.workspace.getConfiguration('sidebar-markdown-notes');

constructor(private readonly _extensionUri: vscode.Uri, private _statusBar?: vscode.StatusBarItem) {}

/**
Expand Down Expand Up @@ -45,6 +47,13 @@ export default class SidebarMarkdownNotesProvider implements vscode.WebviewViewP
}
}
});

vscode.workspace.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration('sidebar-markdown-notes')) {
this.config = vscode.workspace.getConfiguration('sidebar-markdown-notes');
webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);
}
});
}

public resetData() {
Expand Down Expand Up @@ -110,7 +119,9 @@ export default class SidebarMarkdownNotesProvider implements vscode.WebviewViewP
Use a content security policy to only allow loading images from https or from our extension directory,
and only allow scripts that have a specific nonce.
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${webview.cspSource}; script-src 'nonce-${nonce}';">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${
webview.cspSource
}; script-src 'nonce-${nonce}';">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand All @@ -126,6 +137,15 @@ export default class SidebarMarkdownNotesProvider implements vscode.WebviewViewP
<div id="render"></div>
<div id="content"><textarea id="text-input" name="text-input" placeholder="Start by typing your markdown notes..."></textarea></div>
<script nonce="${nonce}">
(function () {
const renderElement = document.getElementById('render');
const editorElement = document.getElementById('content');
renderElement.style.paddingLeft = ${this.config.get<boolean>('leftMargin') === true ? '"20px"' : '"0px"'};
editorElement.style.paddingLeft = ${this.config.get<boolean>('leftMargin') === true ? '"20px"' : '"0px"'};
})();
</script>
<script nonce="${nonce}" src="${lodashUri}"></script>
<script nonce="${nonce}" src="${purifyUri}"></script>
<script nonce="${nonce}" src="${markedUri}"></script>
Expand Down

0 comments on commit 39f4262

Please sign in to comment.