Skip to content

Commit

Permalink
style: 💄 run Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Oct 31, 2024
1 parent 6f686ca commit f20a145
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/json-crdt-extensions/peritext/block/Inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ export class Inline extends Range implements Printable {
const stack = attributes[SliceTypes.Cursor];
if (!stack) return;
const attribute = stack[0];
if (attribute instanceof InlineAttrEnd || attribute instanceof InlineAttrContained || attribute instanceof InlineAttrEndPoint) {
if (
attribute instanceof InlineAttrEnd ||
attribute instanceof InlineAttrContained ||
attribute instanceof InlineAttrEndPoint
) {
const slice = attribute.slice;
return slice instanceof Cursor ? slice : void 0;
}
Expand Down
12 changes: 6 additions & 6 deletions src/json-crdt-peritext-ui/react/InlineView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ put('.' + CssClass.Inline, {
* Font *kerning* is the variable distance between every pair of characters.
* It is adjusted to make the text more readable. This disables it, so that
* there is always the same distance between characters.
*
*
* Useful because, while moving the cursor the characters can be arbitrarily
* grouped into <span> elements, the distance between them should be
* consistent to avoid layout shifts. Otherwise, there is a text shift when
* moving the cursor. For example, consider:
*
*
* ```jsx
* <span>Word</span>
* ```
*
*
* vs.
*
*
* ```jsx
* <span>W</span><span>ord</span>
* ```
*
*
* The kerning between letters "W" and "o" changes and results in a shift, if
* this property is not set.
*/
Expand All @@ -54,7 +54,7 @@ export const InlineView: React.FC<InlineViewProps> = (props) => {
const {renderers} = usePeritext();
const ref = React.useRef<HTMLSpanElement | null>(null);
const text = inline.text();

const span = ref.current;
if (span) (span as any)[ElementAttr.InlineOffset] = inline;

Expand Down

0 comments on commit f20a145

Please sign in to comment.