@sveltia/ui 0.22.0 → 0.22.1

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.
@@ -78,6 +78,9 @@
78
78
  const originalValue = inputValue;
79
79
 
80
80
  try {
81
+ // We should avoid an empty editor; there should be at least one `<p>`, so give it an empty
82
+ // string if the `value` is `undefined`
83
+ // @see https://github.com/facebook/lexical/issues/2308
81
84
  await convertMarkdownToLexical($editor, inputValue ?? '');
82
85
  } catch (ex) {
83
86
  $hasConverterError = true;
@@ -87,15 +90,6 @@
87
90
  }
88
91
  };
89
92
 
90
- $effect(() => {
91
- // We should avoid an empty editor; there should be at least one `<p>`, so give it an empty
92
- // string if the `value` is `undefined`
93
- // @see https://github.com/facebook/lexical/issues/2308
94
- if ($editor?.getEditorState().isEmpty()) {
95
- convertMarkdownToLexical($editor, '');
96
- }
97
- });
98
-
99
93
  $effect(() => {
100
94
  void $editor;
101
95
 
@@ -103,12 +97,14 @@
103
97
 
104
98
  // Avoid a cycle dependency & infinite loop
105
99
  untrack(() => {
106
- if (inputValue !== newValue) {
100
+ const hasChange = inputValue !== newValue;
101
+
102
+ if (hasChange) {
107
103
  inputValue = newValue ?? '';
104
+ }
108
105
 
109
- if ($useRichText) {
110
- convertMarkdown();
111
- }
106
+ if ($useRichText && (hasChange || $editor?.getEditorState().isEmpty())) {
107
+ convertMarkdown();
112
108
  }
113
109
  });
114
110
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -28,19 +28,19 @@
28
28
  "test:unit": "vitest"
29
29
  },
30
30
  "dependencies": {
31
- "@lexical/code": "^0.21.0",
32
- "@lexical/dragon": "^0.21.0",
33
- "@lexical/history": "^0.21.0",
34
- "@lexical/link": "^0.21.0",
35
- "@lexical/list": "^0.21.0",
36
- "@lexical/markdown": "^0.21.0",
37
- "@lexical/rich-text": "^0.21.0",
38
- "@lexical/selection": "^0.21.0",
39
- "@lexical/table": "^0.21.0",
40
- "@lexical/utils": "^0.21.0",
31
+ "@lexical/code": "^0.22.0",
32
+ "@lexical/dragon": "^0.22.0",
33
+ "@lexical/history": "^0.22.0",
34
+ "@lexical/link": "^0.22.0",
35
+ "@lexical/list": "^0.22.0",
36
+ "@lexical/markdown": "^0.22.0",
37
+ "@lexical/rich-text": "^0.22.0",
38
+ "@lexical/selection": "^0.22.0",
39
+ "@lexical/table": "^0.22.0",
40
+ "@lexical/utils": "^0.22.0",
41
41
  "@sveltia/utils": "^0.6.3",
42
42
  "prismjs": "^1.29.0",
43
- "lexical": "^0.21.0"
43
+ "lexical": "^0.22.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "svelte": "^5.0.0"
@@ -48,7 +48,7 @@
48
48
  "devDependencies": {
49
49
  "@playwright/test": "^1.49.1",
50
50
  "@sveltejs/adapter-auto": "^3.3.1",
51
- "@sveltejs/kit": "^2.14.1",
51
+ "@sveltejs/kit": "^2.15.0",
52
52
  "@sveltejs/package": "^2.3.7",
53
53
  "@sveltejs/vite-plugin-svelte": "5.0.3",
54
54
  "cspell": "^8.17.1",