save
This commit is contained in:
parent
5756955d92
commit
dabd5841d7
|
@ -6,6 +6,6 @@
|
||||||
"description": "Allows you to easily display chessboards and play games in PGN format directly in your notes",
|
"description": "Allows you to easily display chessboards and play games in PGN format directly in your notes",
|
||||||
"author": "Riffaells",
|
"author": "Riffaells",
|
||||||
"authorUrl": "https://gihub.com/Riffaells",
|
"authorUrl": "https://gihub.com/Riffaells",
|
||||||
"fundingUrl": "https://gihub.com/Riffaells",
|
"fundingUrl": "",
|
||||||
"isDesktopOnly": false
|
"isDesktopOnly": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'settings.title': 'ChessMate Settings',
|
'settings.title': 'ChessMate Settings',
|
||||||
|
'settings.boardColor': 'Board Color',
|
||||||
|
'settings.boardColorDesc': 'Choose the color for the chess board',
|
||||||
|
'settings.maxBoardSize': 'Max Board Size',
|
||||||
|
'settings.maxBoardSizeDesc': 'Set the maximum size of the chess board (in pixels)',
|
||||||
'settings.boardTheme': 'Board Theme',
|
'settings.boardTheme': 'Board Theme',
|
||||||
'settings.boardThemeDesc': 'Choose the color theme for the chess board',
|
'settings.boardThemeDesc': 'Choose the color theme for the chess board',
|
||||||
'settings.themeBrown': 'Brown',
|
'settings.themeBrown': 'Brown',
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
// Russian
|
// Russian
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
'settings.title': 'Настройки ChessMate',
|
||||||
|
'settings.boardColor': 'Цвет доски',
|
||||||
|
'settings.boardColorDesc': 'Выберите цвет для шахматной доски',
|
||||||
|
'settings.maxBoardSize': 'Максимальный размер доски',
|
||||||
|
'settings.maxBoardSizeDesc': 'Установите максимальный размер шахматной доски (в пикселях)',
|
||||||
};
|
};
|
10
src/main.ts
10
src/main.ts
|
@ -25,7 +25,6 @@ export default class ChessMatePlugin extends Plugin {
|
||||||
pgn: options.pgn,
|
pgn: options.pgn,
|
||||||
orientation: (options.orientation as 'white' | 'black') || 'white',
|
orientation: (options.orientation as 'white' | 'black') || 'white',
|
||||||
fen: options.fen || undefined,
|
fen: options.fen || undefined,
|
||||||
// showMoves: options.showMoves === 'true' || this.settings.showMoves,
|
|
||||||
chessground: {
|
chessground: {
|
||||||
movable: {
|
movable: {
|
||||||
free: true,
|
free: true,
|
||||||
|
@ -42,16 +41,13 @@ export default class ChessMatePlugin extends Plugin {
|
||||||
red: { key: 'red', color: 'rgba(255,154,28,0.91)', opacity: 0.6 },
|
red: { key: 'red', color: 'rgba(255,154,28,0.91)', opacity: 0.6 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {},
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PgnViewer(boardElement, viewerConfig);
|
PgnViewer(boardElement, viewerConfig);
|
||||||
|
|
||||||
boardElement.style.setProperty('--board-color', this.settings.accentColor);
|
container.style.setProperty('--max-board-size', `${this.settings.maxBoardSize}px`);
|
||||||
|
container.style.setProperty('--board-color', this.settings.boardColor);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,19 +3,13 @@ import ChessMatePlugin from "./main";
|
||||||
import { t } from "./lang/helper";
|
import { t } from "./lang/helper";
|
||||||
|
|
||||||
export interface ChessMateSettings {
|
export interface ChessMateSettings {
|
||||||
boardTheme: string;
|
boardColor: string;
|
||||||
pieceTheme: string;
|
maxBoardSize: number;
|
||||||
showMoves: boolean;
|
|
||||||
accentColor: string;
|
|
||||||
boardSize: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DEFAULT_SETTINGS: ChessMateSettings = {
|
export const DEFAULT_SETTINGS: ChessMateSettings = {
|
||||||
boardTheme: 'brown',
|
boardColor: '#f0d9b5',
|
||||||
pieceTheme: 'cburnett',
|
maxBoardSize: 800
|
||||||
showMoves: true,
|
|
||||||
accentColor: "#ffeac3",
|
|
||||||
boardSize: 600
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ChessMateSettingTab extends PluginSettingTab {
|
export class ChessMateSettingTab extends PluginSettingTab {
|
||||||
|
@ -33,49 +27,24 @@ export class ChessMateSettingTab extends PluginSettingTab {
|
||||||
containerEl.createEl('h2', { text: t('settings.title') });
|
containerEl.createEl('h2', { text: t('settings.title') });
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName(t('settings.boardTheme'))
|
.setName(t('settings.boardColor'))
|
||||||
.setDesc(t('settings.boardThemeDesc'))
|
.setDesc(t('settings.boardColorDesc'))
|
||||||
.addText(text => text
|
.addText(text => text
|
||||||
.setValue(this.plugin.settings.boardTheme)
|
.setValue(this.plugin.settings.boardColor)
|
||||||
.onChange(async (value) => {
|
.onChange(async (value) => {
|
||||||
this.plugin.settings.boardTheme = value;
|
this.plugin.settings.boardColor = value;
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName(t('settings.pieceTheme'))
|
.setName(t('settings.maxBoardSize'))
|
||||||
.setDesc(t('settings.pieceThemeDesc'))
|
.setDesc(t('settings.maxBoardSizeDesc'))
|
||||||
.addDropdown(dropdown => dropdown
|
|
||||||
.addOptions({
|
|
||||||
cburnett: 'Cburnett',
|
|
||||||
alpha: 'Alpha',
|
|
||||||
classic: 'Classic'
|
|
||||||
})
|
|
||||||
.setValue(this.plugin.settings.pieceTheme)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings.pieceTheme = value;
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
}));
|
|
||||||
|
|
||||||
new Setting(containerEl)
|
|
||||||
.setName(t('settings.showMoves'))
|
|
||||||
.setDesc(t('settings.showMovesDesc'))
|
|
||||||
.addToggle(toggle => toggle
|
|
||||||
.setValue(this.plugin.settings.showMoves)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings.showMoves = value;
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
}));
|
|
||||||
|
|
||||||
new Setting(containerEl)
|
|
||||||
.setName(t('settings.boardSize'))
|
|
||||||
.setDesc(t('settings.boardSizeDesc'))
|
|
||||||
.addSlider(slider => slider
|
.addSlider(slider => slider
|
||||||
.setLimits(200, 800, 50)
|
.setLimits(200, 800, 50)
|
||||||
.setValue(this.plugin.settings.boardSize)
|
.setValue(this.plugin.settings.maxBoardSize)
|
||||||
.setDynamicTooltip()
|
.setDynamicTooltip()
|
||||||
.onChange(async (value) => {
|
.onChange(async (value) => {
|
||||||
this.plugin.settings.boardSize = value;
|
this.plugin.settings.maxBoardSize = value;
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
12
styles.css
12
styles.css
|
@ -397,7 +397,12 @@ cg-board square.current-premove {
|
||||||
}
|
}
|
||||||
|
|
||||||
.lpv__board {
|
.lpv__board {
|
||||||
grid-area: board
|
grid-area: board;
|
||||||
|
width: 100%; /* Или установите фиксированное значение */
|
||||||
|
height: auto;
|
||||||
|
max-width: var(--max-board-size, 1200); /* Установите максимальную ширину */
|
||||||
|
max-height: var(--max-board-size, 900); /* Установите максимальную высоту */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.lpv__side {
|
.lpv__side {
|
||||||
|
@ -417,7 +422,8 @@ cg-board square.current-premove {
|
||||||
}
|
}
|
||||||
|
|
||||||
.lpv__controls {
|
.lpv__controls {
|
||||||
grid-area: controls
|
grid-area: controls;
|
||||||
|
max-width: var(--max-board-size, 1200);
|
||||||
}
|
}
|
||||||
|
|
||||||
.lpv__menu, .lpv__pgn {
|
.lpv__menu, .lpv__pgn {
|
||||||
|
@ -447,7 +453,7 @@ cg-board square.current-premove {
|
||||||
/*}*/
|
/*}*/
|
||||||
|
|
||||||
.lpv__moves > index {
|
.lpv__moves > index {
|
||||||
flex: 0 0 15%;
|
flex: 0 0 10%;
|
||||||
margin-right: 3%;
|
margin-right: 3%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end
|
justify-content: flex-end
|
||||||
|
|
Loading…
Reference in New Issue