Skip to content

Commit

Permalink
fix(icon): 修复图标为正常渲染问题
Browse files Browse the repository at this point in the history
  • Loading branch information
czfadmin committed Nov 21, 2024
1 parent 1663959 commit d7a0a85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/stores/bookmark-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,10 @@ export const BookmarksStore = types
file: idxInFileGroup,
workspace: idxInWorkspaceGroup,
},
icon: selectionContent.length
? defaultLabeledBookmarkIcon
: defaultBookmarkIcon,
icon:
label.length || description.length
? defaultLabeledBookmarkIcon
: defaultBookmarkIcon,
});

const colorGroupInfo = self.groupInfo.find(
Expand Down
16 changes: 10 additions & 6 deletions src/stores/bookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,18 @@ export const Bookmark = types
*/
get iconPath() {
const root = getRoot<Instance<typeof GlobalStore>>(self);
const icon =
root.icons.find(it => it.id === self.icon)?.id ||
(self.selectionContent.length
? root.configure.configure.defaultLabeledBookmarkIcon
: root.configure.configure.defaultBookmarkIcon);
const {defaultLabeledBookmarkIcon, defaultBookmarkIcon} =
root.configure.configure;
let iconId = self.icon
? self.icon
: self.label.length || self.description.length
? defaultLabeledBookmarkIcon
: defaultBookmarkIcon;

const icon = root.icons.find(it => it.id === iconId);

const body = icon?.body.replace(
/fill=/gi,
/fill="currentColor"/gi,
`fill="${(self as Instance<typeof Bookmark>).escapedColor}"`,
);
return Uri.parse(
Expand Down

0 comments on commit d7a0a85

Please sign in to comment.