mirror of
https://github.com/chrislicodes/obsidian-chess-study.git
synced 2026-07-22 07:50:30 +00:00
fix: dont check if first move of variant exists
This commit is contained in:
parent
599c4cf645
commit
8d60425798
5 changed files with 18 additions and 26 deletions
30
README.md
30
README.md
|
|
@ -10,17 +10,19 @@ With this plugin, you can either import PGNs or simply start a fresh new game. I
|
|||
|
||||
## Table of contents
|
||||
|
||||
- [Motivation](#motivation)
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Features](#features)
|
||||
- [1.0.0](#100)
|
||||
- [1.0.1](#101)
|
||||
- [Settings](#settings)
|
||||
- [Roadmap](#roadmap)
|
||||
- [Tools Used](#tools-used)
|
||||
- [Alternatives](#alternatives)
|
||||
- [License](#license)
|
||||
- [Obsidian Chess Study](#obsidian-chess-study)
|
||||
- [Table of contents](#table-of-contents)
|
||||
- [Motivation](#motivation)
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Features](#features)
|
||||
- [1.0.0](#100)
|
||||
- [1.0.1](#101)
|
||||
- [Settings](#settings)
|
||||
- [Roadmap](#roadmap)
|
||||
- [Tools Used](#tools-used)
|
||||
- [Alternatives](#alternatives)
|
||||
- [License](#license)
|
||||
|
||||
## Motivation
|
||||
|
||||
|
|
@ -42,9 +44,9 @@ Once you click `Submit`, Obsidian Chess Study will parse the PGN, generate a new
|
|||
|
||||

|
||||
|
||||
After that the PGN viewer/editor will render and you are good to go:
|
||||
After that the PGN viewer/editor will render and you are good to go (styles are aligned with your theme and accent color):
|
||||
|
||||

|
||||

|
||||
|
||||
## Features
|
||||
|
||||
|
|
@ -62,6 +64,8 @@ After that the PGN viewer/editor will render and you are good to go:
|
|||
|
||||
- [x] Add support for variants (depth 1)
|
||||
|
||||

|
||||
|
||||
## Settings
|
||||
|
||||
Here are the available settings for a `chessStudy` code block:
|
||||
|
|
|
|||
BIN
imgs/chess-study-variants.png
Normal file
BIN
imgs/chess-study-variants.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
|
|
@ -187,7 +187,7 @@ export const ChessStudy = ({
|
|||
} else {
|
||||
const currentMove = moves[moveIndex];
|
||||
|
||||
//check if the next move is the same move
|
||||
// check if the next move is the same move
|
||||
const nextMove = moves[moveIndex + 1];
|
||||
|
||||
if (nextMove.san === newMove.san) {
|
||||
|
|
@ -195,16 +195,6 @@ export const ChessStudy = ({
|
|||
return draft;
|
||||
}
|
||||
|
||||
//check if a variant with this first move already exists
|
||||
const sameVariant = currentMove.variants.findIndex(
|
||||
(variant) => variant.moves[0]?.san === newMove.san
|
||||
);
|
||||
|
||||
if (sameVariant >= 0) {
|
||||
draft.currentMove = currentMove.variants[sameVariant].moves[0];
|
||||
return draft;
|
||||
}
|
||||
|
||||
const move = {
|
||||
...newMove,
|
||||
moveId: moveId,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ export const displayMoveInHistory = (
|
|||
|
||||
const chess = new Chess(moveToDisplay.after);
|
||||
|
||||
//TODO: Handle is view only if not the last move in variant - put this into a function also for inital setuo
|
||||
chessView.set({
|
||||
fen: moveToDisplay.after,
|
||||
check: chess.isCheck(),
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue