feat: md-deck print
This commit is contained in:
@@ -53,6 +53,9 @@ export interface DeckState {
|
||||
|
||||
// 错误状态
|
||||
error: string | null;
|
||||
|
||||
// 打印状态
|
||||
isPrinting: boolean;
|
||||
}
|
||||
|
||||
export interface DeckActions {
|
||||
@@ -94,6 +97,10 @@ export interface DeckActions {
|
||||
// 生成代码
|
||||
generateCode: () => string;
|
||||
copyCode: () => Promise<void>;
|
||||
|
||||
// 打印操作
|
||||
setPrinting: (printing: boolean) => void;
|
||||
printDeck: () => void;
|
||||
}
|
||||
|
||||
export interface DeckStore {
|
||||
@@ -128,7 +135,8 @@ export function createDeckStore(
|
||||
selectStart: null,
|
||||
selectEnd: null,
|
||||
isLoading: false,
|
||||
error: null
|
||||
error: null,
|
||||
isPrinting: false
|
||||
});
|
||||
|
||||
// 更新尺寸并重新计算 dimensions
|
||||
@@ -265,6 +273,12 @@ export function createDeckStore(
|
||||
}
|
||||
};
|
||||
|
||||
const setPrinting = (printing: boolean) => setState({ isPrinting: printing });
|
||||
|
||||
const printDeck = () => {
|
||||
setState({ isPrinting: true });
|
||||
};
|
||||
|
||||
const actions: DeckActions = {
|
||||
setSizeW,
|
||||
setSizeH,
|
||||
@@ -290,7 +304,9 @@ export function createDeckStore(
|
||||
setError,
|
||||
clearError,
|
||||
generateCode,
|
||||
copyCode
|
||||
copyCode,
|
||||
setPrinting,
|
||||
printDeck
|
||||
};
|
||||
|
||||
return { state, actions };
|
||||
|
||||
Reference in New Issue
Block a user