Skip to content

Commit

Permalink
fix: 复制html内容时有报错 #536;更新vscode插件
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsonliu committed Aug 20, 2023
1 parent 9ede7c8 commit 402a05d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/toolbars/hooks/Copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default class Copy extends MenuBase {
}

getStyleFromSheets(keyword) {
const sheets = Array.from(document.styleSheets).filter((item) => item.cssRules[0].cssText.indexOf(keyword) > -1);
const sheets = Array.from(document.styleSheets).filter(
(item) => item.cssRules[0] && item.cssRules[0].cssText.indexOf(keyword) > -1,
);
return `<style>${sheets.reduce((html, sheet) => {
return html + Array.from(sheet.cssRules).reduce((html, rule) => html + rule.cssText, '');
}, '')}</style>`;
Expand Down
2 changes: 1 addition & 1 deletion vscodePlugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cherry-markdown",
"displayName": "cherry-markdown",
"description": "A markdown previewer powered by [cherry-markdown](https://github.com/Tencent/cherry-markdown)",
"version": "0.0.10",
"version": "0.0.11",
"publisher": "cherryMarkdownPublisher",
"license": "Apache License",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion vscodePlugin/web-resources/dist/cherry-markdown.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vscodePlugin/web-resources/dist/cherry-markdown.min.js

Large diffs are not rendered by default.

0 comments on commit 402a05d

Please sign in to comment.