Skip to content

Commit c4cd4ca

Browse files
authored
📝 Improve text (#16135)
1 parent 33192d1 commit c4cd4ca

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

app/src/protyle/gutter/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,9 +874,10 @@ export class Gutter {
874874
id: "separator_quickMakeCard",
875875
type: "separator"
876876
}).element);
877+
const allCardsMade = !selectsElement.some(item => !item.hasAttribute(Constants.CUSTOM_RIFF_DECKS) && item.getAttribute("data-type") !== "NodeThematicBreak");
877878
window.siyuan.menus.menu.append(new MenuItem({
878-
id: "quickMakeCard",
879-
label: window.siyuan.languages.quickMakeCard,
879+
id: allCardsMade ? "removeCard" : "quickMakeCard",
880+
label: allCardsMade ? window.siyuan.languages.removeCard : window.siyuan.languages.quickMakeCard,
880881
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
881882
icon: "iconRiffCard",
882883
click() {
@@ -2000,10 +2001,11 @@ export class Gutter {
20002001
}).element);
20012002
}
20022003
if (type !== "NodeThematicBreak" && !window.siyuan.config.readonly) {
2004+
const isCardMade = nodeElement.hasAttribute(Constants.CUSTOM_RIFF_DECKS);
20032005
window.siyuan.menus.menu.append(new MenuItem({
2004-
id: "quickMakeCard",
2006+
id: isCardMade ? "removeCard" : "quickMakeCard",
20052007
icon: "iconRiffCard",
2006-
label: window.siyuan.languages.quickMakeCard,
2008+
label: isCardMade ? window.siyuan.languages.removeCard : window.siyuan.languages.quickMakeCard,
20072009
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
20082010
click() {
20092011
quickMakeCard(protyle, [nodeElement]);

app/src/protyle/header/openTitleMenu.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
129129
}
130130
}).element);
131131
}
132+
const isCardMade = !!response.data.ial[Constants.CUSTOM_RIFF_DECKS];
132133
const riffCardMenu: IMenu[] = [{
133134
id: "spaceRepetition",
134135
iconHTML: "",
@@ -151,9 +152,9 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
151152
});
152153
}
153154
}, {
154-
id: "quickMakeCard",
155+
id: isCardMade ? "removeCard" : "quickMakeCard",
155156
iconHTML: "",
156-
label: window.siyuan.languages.quickMakeCard,
157+
label: isCardMade ? window.siyuan.languages.removeCard : window.siyuan.languages.quickMakeCard,
157158
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
158159
click: () => {
159160
let titleElement = protyle.title?.element;

0 commit comments

Comments
 (0)