@sveltia/ui 0.35.1 → 0.35.3

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.
@@ -212,15 +212,14 @@ const getSelectionTypes = () => {
212
212
  /**
213
213
  * Listen to changes made on the editor and trigger the Update event.
214
214
  * @param {LexicalEditor} editor Editor instance.
215
- * @param {any[]} transformers Active transformers for this editor instance.
216
215
  */
217
- const onEditorUpdate = (editor, transformers) => {
216
+ const onEditorUpdate = (editor) => {
218
217
  editor.getRootElement()?.dispatchEvent(
219
218
  new CustomEvent('Update', {
220
219
  detail: {
221
220
  value: $convertToMarkdownString(
222
221
  // Use underscores for italic text in Markdown instead of asterisks
223
- transformers.filter((/** @type {any} */ { tag }) => tag !== '*'),
222
+ allTransformers.filter((/** @type {any} */ { tag }) => tag !== '*'),
224
223
  ) // Remove unnecessary backslash for underscore and backslash characters
225
224
  // @see https://github.com/sveltia/sveltia-cms/issues/430
226
225
  // @see https://github.com/sveltia/sveltia-cms/issues/512
@@ -246,16 +245,12 @@ export const initEditor = ({
246
245
  isCodeEditor = false,
247
246
  defaultLanguage = 'plain',
248
247
  }) => {
249
- // Build per-instance copies to avoid permanently mutating the shared module-level arrays
250
- const localNodes = components.length
251
- ? [...components.map(({ node }) => node), .../** @type {any[]} */ (editorConfig.nodes)]
252
- : editorConfig.nodes;
253
-
254
- const localTransformers = components.length
255
- ? [...components.map(({ transformer }) => transformer), ...allTransformers]
256
- : allTransformers;
248
+ components.forEach(({ node, transformer }) => {
249
+ /** @type {any[]} */ (editorConfig.nodes).unshift(node);
250
+ allTransformers.unshift(transformer);
251
+ });
257
252
 
258
- const editor = createEditor({ ...editorConfig, nodes: localNodes });
253
+ const editor = createEditor(editorConfig);
259
254
 
260
255
  registerRichText(editor);
261
256
  registerDragonSupport(editor);
@@ -331,7 +326,7 @@ export const initEditor = ({
331
326
  }
332
327
  }
333
328
 
334
- onEditorUpdate(editor, localTransformers);
329
+ onEditorUpdate(editor);
335
330
  });
336
331
  });
337
332
 
@@ -42,6 +42,7 @@
42
42
  top: 0;
43
43
  z-index: 100;
44
44
  display: flex;
45
+ flex-wrap: wrap;
45
46
  gap: 4px;
46
47
  border-width: 1px 1px 0;
47
48
  border-style: solid;
@@ -51,7 +52,8 @@
51
52
  border-end-start-radius: 0;
52
53
  border-end-end-radius: 0;
53
54
  padding: 0 4px;
54
- height: 40px;
55
+ height: auto;
56
+ min-height: 40px;
55
57
  background-color: var(--sui-tertiary-background-color);
56
58
  }
57
59
  @media (width < 768px) {
@@ -144,5 +144,10 @@ textarea[aria-invalid=true] {
144
144
  .clone {
145
145
  overflow: hidden;
146
146
  visibility: hidden;
147
+ }
148
+
149
+ textarea,
150
+ .clone {
147
151
  white-space: pre-wrap;
152
+ word-break: break-all;
148
153
  }</style>
@@ -59,12 +59,14 @@
59
59
  * @param {InputEvent} event The `input` event object.
60
60
  */
61
61
  const fireInput = (event) => {
62
- value = /** @type {HTMLInputElement} */ (event.target).value;
62
+ value = element?.value;
63
63
  oninput?.(event);
64
64
  };
65
65
 
66
66
  /**
67
- * Handle the `input` event. If `debounce` is `true`, the event will be debounced by 300ms.
67
+ * Handle the `input` event. If `debounce` is `true`, the event will be debounced by 300ms. We use
68
+ * `oninputcapture` to ensure that the event is fired before any `oninput` handlers on parent
69
+ * elements, including the Lexical editor.
68
70
  * @param {InputEvent} event The `input` event object.
69
71
  */
70
72
  const handleInput = (event) => {
@@ -110,7 +112,7 @@
110
112
  aria-readonly={readonly}
111
113
  aria-required={required}
112
114
  aria-invalid={invalid}
113
- oninput={handleInput}
115
+ oninputcapture={handleInput}
114
116
  use:activateKeyShortcuts={keyShortcuts}
115
117
  />
116
118
  {#if ariaLabel && showInlineLabel}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.35.1",
3
+ "version": "0.35.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -41,7 +41,7 @@
41
41
  "eslint-plugin-jsdoc": "^62.8.0",
42
42
  "eslint-plugin-svelte": "^2.46.1",
43
43
  "happy-dom": "^20.8.4",
44
- "oxlint": "^1.55.0",
44
+ "oxlint": "^1.56.0",
45
45
  "postcss": "^8.5.8",
46
46
  "postcss-html": "^1.8.1",
47
47
  "prettier": "^3.8.1",
@@ -50,7 +50,7 @@
50
50
  "stylelint": "^17.4.0",
51
51
  "stylelint-config-recommended-scss": "^17.0.0",
52
52
  "stylelint-scss": "^7.0.0",
53
- "svelte": "^5.53.12",
53
+ "svelte": "^5.54.0",
54
54
  "svelte-check": "^4.4.5",
55
55
  "svelte-preprocess": "^6.0.3",
56
56
  "tslib": "^2.8.1",