@peers-app/peers-ui 0.31.3 → 0.31.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,12 @@
1
1
  import { type Observable } from "@peers-app/peers-sdk";
2
+ /** The editor's markdown transformers: mentions and checklists, then Lexical's own (no headings). */
2
3
  export declare const customMarkdownTransformers: import("@lexical/markdown").Transformer[];
3
4
  interface IProps {
4
5
  markdownObs: Observable<string>;
5
6
  }
7
+ /**
8
+ * Keeps the editor and a markdown observable in step: the observable's value is loaded into the
9
+ * editor (without moving the caret or taking focus), and edits are written back as markdown.
10
+ */
6
11
  export declare function MarkdownPlugin(props: IProps): null;
7
12
  export {};
@@ -22,8 +22,13 @@ function getIndent(whitespaces) {
22
22
  }
23
23
  return indent;
24
24
  }
25
+ /**
26
+ * Lexical's list `replace`, for the checklist transformer. Typing a list prefix moves the caret
27
+ * into the new item; loading saved markdown (`isImport`) must not, or the editor takes focus
28
+ * whenever its value is set.
29
+ */
25
30
  const listReplace = (listType) => {
26
- return (parentNode, children, match) => {
31
+ return (parentNode, children, match, isImport) => {
27
32
  const previousNode = parentNode.getPreviousSibling();
28
33
  const nextNode = parentNode.getNextSibling();
29
34
  const listItem = (0, list_1.$createListItemNode)(listType === "check" ? match[3] === "x" : undefined);
@@ -48,7 +53,8 @@ const listReplace = (listType) => {
48
53
  parentNode.replace(list);
49
54
  }
50
55
  listItem.append(...children);
51
- listItem.select(0, 0);
56
+ if (!isImport)
57
+ listItem.select(0, 0);
52
58
  const indent = getIndent(match[1]);
53
59
  if (indent) {
54
60
  listItem.setIndent(indent);
@@ -116,6 +122,7 @@ const MENTION_TRANSFORMER = {
116
122
  textNode.replace(node);
117
123
  },
118
124
  };
125
+ /** The editor's markdown transformers: mentions and checklists, then Lexical's own (no headings). */
119
126
  exports.customMarkdownTransformers = [
120
127
  MENTION_TRANSFORMER,
121
128
  CHECK_LIST_TRANSFORMER, // This needs to be first or checklists will be treated as unordered lists
@@ -128,6 +135,10 @@ exports.customMarkdownTransformers = [
128
135
  return true;
129
136
  }),
130
137
  ];
138
+ /**
139
+ * Keeps the editor and a markdown observable in step: the observable's value is loaded into the
140
+ * editor (without moving the caret or taking focus), and edits are written back as markdown.
141
+ */
131
142
  function MarkdownPlugin(props) {
132
143
  const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
133
144
  const { markdownObs } = props;
@@ -13,7 +13,6 @@ const INFO_TEXT = `### What does registering do?
13
13
 
14
14
  Registering your account links your **public key** with the Peers cloud service. This enables cloud-powered features like:
15
15
 
16
- - **AI Assistant** - use the built-in assistant powered by hosted LLM inference
17
16
  - **Cloud relay** - improved connectivity between your devices
18
17
  - **Future services** - new cloud features as they become available
19
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peers-app/peers-ui",
3
- "version": "0.31.3",
3
+ "version": "0.31.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/peers-app/peers-ui.git"
@@ -36,7 +36,7 @@
36
36
  "lint:fix": "biome check --write ."
37
37
  },
38
38
  "peerDependencies": {
39
- "@peers-app/peers-sdk": "^0.31.3",
39
+ "@peers-app/peers-sdk": "^0.31.5",
40
40
  "bootstrap": "^5.3.3",
41
41
  "react": "^18.0.0",
42
42
  "react-dom": "^18.0.0"
@@ -47,7 +47,7 @@
47
47
  "@babel/preset-react": "^7.24.1",
48
48
  "@babel/preset-typescript": "^7.27.1",
49
49
  "@biomejs/biome": "2.3.11",
50
- "@peers-app/peers-sdk": "0.31.3",
50
+ "@peers-app/peers-sdk": "0.31.5",
51
51
  "@testing-library/dom": "^10.4.0",
52
52
  "@testing-library/jest-dom": "^6.6.3",
53
53
  "@testing-library/react": "^16.3.0",