Skip to content

Commit

Permalink
Fixed issue where image alignment setting was not saved.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Mar 3, 2024
1 parent e8b4e6d commit 4adfb52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Added link to link editor in the toolbar to simplify link testing.

## Fixed

- Fixed issue where image alignment setting was not saved.

# 0.6.5 - 2024-02-25

## Fixed
Expand Down
30 changes: 16 additions & 14 deletions src/lib/models/chapter/EmbedNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class EmbedNode extends BlockNode {
description: string,
caption?: FormatNode,
credit?: FormatNode,
position: Position = '|'
position: Position = '|',
) {
super();

Expand Down Expand Up @@ -62,8 +62,8 @@ export default class EmbedNode extends BlockNode {
return this.isLocal()
? 'images/small/' + this.getURL()
: this.hasSmallURL()
? this.#urls.split(URL_SEPARATOR)[1]
: this.getURL();
? this.#urls.split(URL_SEPARATOR)[1]
: this.getURL();
}
hasSmallURL() {
return (
Expand Down Expand Up @@ -112,7 +112,9 @@ export default class EmbedNode extends BlockNode {
toBookdown(): string {
return `|${this.#urls}|${
this.#description
}|${this.#caption.toBookdown()}|${this.#credit.toBookdown()}|`;
}|${this.#caption.toBookdown()}|${this.#credit.toBookdown()}|${
this.#position === '|' ? '' : this.#position
}`;
}
toJSON() {
return {
Expand All @@ -129,7 +131,7 @@ export default class EmbedNode extends BlockNode {
this.#description,
this.#caption.copy(),
this.#credit.copy(),
this.#position
this.#position,
) as this;
}

Expand All @@ -150,7 +152,7 @@ export default class EmbedNode extends BlockNode {
this.#description,
newCaption,
newCredit,
this.#position
this.#position,
) as this)
: undefined;
}
Expand All @@ -165,7 +167,7 @@ export default class EmbedNode extends BlockNode {
this.#description,
this.#caption,
this.#credit,
this.#position
this.#position,
);
}
withURLs(url: string, thumbnail: string) {
Expand All @@ -174,7 +176,7 @@ export default class EmbedNode extends BlockNode {
this.#description,
this.#caption,
this.#credit,
this.#position
this.#position,
);
}
withDescription(description: string) {
Expand All @@ -183,7 +185,7 @@ export default class EmbedNode extends BlockNode {
description,
this.#caption,
this.#credit,
this.#position
this.#position,
);
}
withCaption(caption: FormatNode) {
Expand All @@ -192,7 +194,7 @@ export default class EmbedNode extends BlockNode {
this.#description,
caption,
this.#credit,
this.#position
this.#position,
);
}
withCredit(credit: FormatNode) {
Expand All @@ -201,7 +203,7 @@ export default class EmbedNode extends BlockNode {
this.#description,
this.#caption,
credit,
this.#position
this.#position,
);
}
withPosition(position: Position) {
Expand All @@ -210,7 +212,7 @@ export default class EmbedNode extends BlockNode {
this.#description,
this.#caption,
this.#credit,
position
position,
);
}

Expand All @@ -234,7 +236,7 @@ export default class EmbedNode extends BlockNode {
this.#description,
newCaption,
newCredit,
this.#position
this.#position,
) as this;
}

Expand All @@ -244,7 +246,7 @@ export default class EmbedNode extends BlockNode {

previousWord(root: RootNode): Caret {
const previous = root.getPreviousTextOrAtom(
this.#caption.getFirstTextNode()
this.#caption.getFirstTextNode(),
);
return previous
? {
Expand Down

0 comments on commit 4adfb52

Please sign in to comment.