@placeholderco/placeholder-ui 3.0.6 → 3.1.2

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.
Files changed (53) hide show
  1. package/dist/app.css +32 -3
  2. package/dist/cards/GitCard.svelte +4 -4
  3. package/dist/display/Avatar.svelte +1 -1
  4. package/dist/display/LinkCollection.svelte +5 -5
  5. package/dist/display/Paper.svelte +1 -1
  6. package/dist/display/filetree/FileTree.svelte +2 -2
  7. package/dist/display/filetree/FileTreeItem.svelte +6 -6
  8. package/dist/editors/CodeMirror.svelte +6 -6
  9. package/dist/editors/tiptap/LinkActionMenu.svelte +25 -25
  10. package/dist/editors/tiptap/TipTap.svelte +38 -17
  11. package/dist/editors/tiptap/TipTap.svelte.d.ts +7 -2
  12. package/dist/editors/tiptap/TipTapBubble.svelte +38 -17
  13. package/dist/editors/tiptap/TipTapBubble.svelte.d.ts +7 -2
  14. package/dist/editors/tiptap/extensions/codeBlockEditor.css +9 -9
  15. package/dist/editors/tiptap/toolbar/AlertButton.svelte +22 -22
  16. package/dist/editors/tiptap/toolbar/ButtonLinkButton.svelte +26 -26
  17. package/dist/editors/tiptap/toolbar/ColorButton.svelte +19 -19
  18. package/dist/editors/tiptap/toolbar/HtmlButton.svelte +3 -3
  19. package/dist/editors/tiptap/toolbar/LinkButton.svelte +19 -19
  20. package/dist/editors/tiptap/toolbar/TableButton.svelte +18 -18
  21. package/dist/editors/tiptap/toolbar/ToolbarButton.svelte +4 -4
  22. package/dist/form/Checkbox.svelte +10 -10
  23. package/dist/form/Chips.svelte +2 -2
  24. package/dist/form/ColorPicker.svelte +5 -5
  25. package/dist/form/CronBuilder.svelte +2 -2
  26. package/dist/form/Radio.svelte +7 -7
  27. package/dist/form/RadioGroup.svelte +1 -1
  28. package/dist/form/SelectMulti.svelte +1 -1
  29. package/dist/form/Slider.svelte +7 -7
  30. package/dist/form/TextArea.svelte +2 -2
  31. package/dist/layout/Navbar.svelte +3 -3
  32. package/dist/layout/Sidenav.svelte +2 -2
  33. package/dist/ui/ActionIcon.svelte +1 -1
  34. package/dist/ui/Badge.svelte +7 -7
  35. package/dist/ui/Button.svelte +2 -2
  36. package/dist/ui/ContextMenu.svelte +1 -1
  37. package/dist/ui/ContextMenuList.svelte +5 -5
  38. package/dist/ui/DialogEvents.svelte.d.ts +1 -7
  39. package/dist/ui/DialogEvents.svelte.js +3 -3
  40. package/dist/ui/Drawer.svelte +1 -1
  41. package/dist/ui/Dropdown.svelte +3 -3
  42. package/dist/ui/Dropzone.svelte +2 -2
  43. package/dist/ui/Loader.svelte +5 -1
  44. package/dist/ui/Pagination.svelte +2 -2
  45. package/dist/ui/Popover.svelte +2 -2
  46. package/dist/ui/ProgressBar.svelte +3 -3
  47. package/dist/ui/Table.svelte +11 -11
  48. package/dist/ui/Tabs.svelte +57 -15
  49. package/dist/ui/Tabs.svelte.d.ts +4 -1
  50. package/dist/ui/Tooltip.svelte +3 -3
  51. package/dist/uiTheme.svelte.d.ts +6 -0
  52. package/dist/uiTheme.svelte.js +2 -0
  53. package/package.json +20 -20
package/dist/app.css CHANGED
@@ -25,6 +25,10 @@
25
25
  --ui-font-family:
26
26
  ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif, 'Apple Color Emoji',
27
27
  'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
28
+ /* Root font size: 1rem. Component sizes are in rem/em, so the whole UI scales with it.
29
+ On the root, rem is relative to the browser's default size (normally 16px), so 0.875rem
30
+ is 14px by default and still follows the user's browser text-size setting. */
31
+ --ui-font-size: 0.875rem;
28
32
 
29
33
  /* ---- Brand colors (neutral defaults) ---- */
30
34
  --ui-primary-rgb: 30 58 95;
@@ -82,19 +86,20 @@
82
86
  --label-color: #6c757d;
83
87
 
84
88
  /* layout */
85
- --header-height: 46px;
89
+ --header-height: 2.875rem;
86
90
  --page-content-height: calc(100vh - var(--header-height));
87
91
 
88
92
  background-color: var(--page-bg);
89
93
  color: var(--text-color);
90
94
  font-family: var(--ui-font-family);
95
+ font-size: var(--ui-font-size);
91
96
  }
92
97
 
93
98
  /* The `site` Navbar variant is a taller marketing header. Raising the token here (rather than
94
99
  on the header itself) keeps --page-content-height, Sidenav and Drawer in step with it.
95
100
  :where() keeps specificity at :root level so a consumer's own --header-height still wins. */
96
101
  :root:where(:has(.pui-navbar.site)) {
97
- --header-height: 68px;
102
+ --header-height: 4.25rem;
98
103
  }
99
104
 
100
105
  .dark {
@@ -130,6 +135,30 @@ textarea {
130
135
  font-family: inherit;
131
136
  }
132
137
 
138
+ /* iOS Safari zooms the page when a field with text under 16px is focused, and the 14px root
139
+ puts every field under that. -webkit-touch-callout is only supported on iOS/iPadOS WebKit,
140
+ so desktop sizes are untouched. !important is needed to beat the components' scoped rules.
141
+ (A `maximum-scale=1` viewport also stops the zoom but blocks pinch-zoom on Android.) */
142
+ @supports (-webkit-touch-callout: none) {
143
+ input:not(
144
+ [type='checkbox'],
145
+ [type='radio'],
146
+ [type='range'],
147
+ [type='color'],
148
+ [type='file'],
149
+ [type='button'],
150
+ [type='submit'],
151
+ [type='reset'],
152
+ [type='image'],
153
+ [type='hidden']
154
+ ),
155
+ select,
156
+ textarea,
157
+ [contenteditable]:not([contenteditable='false']) {
158
+ font-size: max(16px, 1rem) !important;
159
+ }
160
+ }
161
+
133
162
  header a {
134
163
  text-decoration: none;
135
164
  color: var(--ui-primary-text-color);
@@ -180,7 +209,7 @@ a:hover {
180
209
  display: inline-block;
181
210
  padding: 0.5rem 1rem;
182
211
  border: 0;
183
- border-radius: 6px;
212
+ border-radius: 0.375rem;
184
213
  background-color: var(--editor-button-bg);
185
214
  color: var(--editor-button-fg);
186
215
  font-size: 0.875rem;
@@ -59,13 +59,13 @@
59
59
  display: flex;
60
60
  border-top-left-radius: 3rem;
61
61
  overflow: hidden;
62
- width: 375px;
62
+ width: 23.4375rem;
63
63
  }
64
64
 
65
65
  .git-image {
66
- width: 96px;
67
- flex: 0 0 96px;
68
- height: 96px;
66
+ width: 6rem;
67
+ flex: 0 0 6rem;
68
+ height: 6rem;
69
69
  }
70
70
 
71
71
  .git-info {
@@ -144,7 +144,7 @@
144
144
  }
145
145
 
146
146
  .avatar.rounded {
147
- border-radius: 6px;
147
+ border-radius: 0.375rem;
148
148
  }
149
149
 
150
150
  .initials {
@@ -45,7 +45,7 @@
45
45
  onclick={link.onclick}
46
46
  >
47
47
  {#if link.svg}
48
- <Icon svg={link.svg} size="18px" />
48
+ <Icon svg={link.svg} size="1.125rem" />
49
49
  {/if}
50
50
  {link.text}
51
51
  </Link>
@@ -59,14 +59,14 @@
59
59
  >
60
60
  <div class="link-inner left">
61
61
  {#if item.leftSvg}
62
- <Icon svg={item.leftSvg} size="18px" />
62
+ <Icon svg={item.leftSvg} size="1.125rem" />
63
63
  {/if}
64
64
  <div>{@html item.leftContent}</div>
65
65
  </div>
66
66
  <div class="link-inner right">
67
67
  <div>{@html item.rightContent}</div>
68
68
  {#if item.rightSvg}
69
- <Icon svg={item.rightSvg} size="18px" />
69
+ <Icon svg={item.rightSvg} size="1.125rem" />
70
70
  {/if}
71
71
  </div>
72
72
  </Link>
@@ -82,7 +82,7 @@
82
82
  onclick={button.onclick}
83
83
  >
84
84
  {#if button.svg}
85
- <Icon svg={button.svg} size="18px" />
85
+ <Icon svg={button.svg} size="1.125rem" />
86
86
  {/if}
87
87
  {button.text}
88
88
  </Link>
@@ -97,7 +97,7 @@
97
97
  display: flex;
98
98
  flex-direction: column;
99
99
  border: 1px solid var(--border-color);
100
- border-radius: 6px;
100
+ border-radius: 0.375rem;
101
101
  }
102
102
 
103
103
  .link-collection.not-rounded {
@@ -75,7 +75,7 @@
75
75
 
76
76
  /* Stretch out the paper body so that a loader can show */
77
77
  .paper-body:has(> .loader) {
78
- min-height: 60px;
78
+ min-height: 3.75rem;
79
79
  }
80
80
 
81
81
  .paper-body-bg {
@@ -95,7 +95,7 @@
95
95
  collapsible = true,
96
96
  showTitles = false,
97
97
  menuItems,
98
- menuMinWidth = '180px',
98
+ menuMinWidth = '11.25rem',
99
99
  onSelect,
100
100
  onDoubleClick,
101
101
  onContextMenu,
@@ -246,7 +246,7 @@
246
246
  .pui-filetree {
247
247
  display: flex;
248
248
  flex-direction: column;
249
- min-height: 80px;
249
+ min-height: 5rem;
250
250
  }
251
251
 
252
252
  .ft-empty {
@@ -194,10 +194,10 @@
194
194
  if (isFolder && collapsible) e.stopPropagation();
195
195
  }}
196
196
  >
197
- <Icon svg={iconChevronRight} size="14px" />
197
+ <Icon svg={iconChevronRight} size="0.875rem" />
198
198
  </span>
199
199
  <span class="ft-icon">
200
- <Icon svg={node.icon ?? (isFolder ? iconFolder : iconFile)} size="16px" />
200
+ <Icon svg={node.icon ?? (isFolder ? iconFolder : iconFile)} size="1rem" />
201
201
  </span>
202
202
  {#if nodeContent}
203
203
  {@render nodeContent(node)}
@@ -251,7 +251,7 @@
251
251
  display: flex;
252
252
  align-items: center;
253
253
  border-left: 3px solid transparent;
254
- border-radius: 0 3px 3px 0;
254
+ border-radius: 0 0.1875rem 0.1875rem 0;
255
255
  transition: background-color 0.15s ease;
256
256
  }
257
257
 
@@ -318,7 +318,7 @@
318
318
 
319
319
  .ft-indent-line {
320
320
  display: inline-block;
321
- width: 14px;
321
+ width: 0.875rem;
322
322
  height: 100%;
323
323
  border-left: 1px solid var(--border-color);
324
324
  margin-right: 2px;
@@ -328,10 +328,10 @@
328
328
  display: inline-flex;
329
329
  align-items: center;
330
330
  justify-content: center;
331
- width: 16px;
331
+ width: 1rem;
332
332
  flex-shrink: 0;
333
333
  cursor: pointer;
334
- border-radius: 3px;
334
+ border-radius: 0.1875rem;
335
335
  transition: transform 0.12s ease;
336
336
  }
337
337
 
@@ -71,7 +71,7 @@
71
71
  lineNumbers = true,
72
72
  copyButton = false,
73
73
  class: className = '',
74
- height = '500px',
74
+ height = '31.25rem',
75
75
  onChange,
76
76
  onCopy
77
77
  }: CodeMirrorProps = $props();
@@ -249,7 +249,7 @@
249
249
  <div class="codemirror-copy" class:copied class:dark={isDark}>
250
250
  <ActionIcon
251
251
  svg={copied ? iconCheck : iconCopy}
252
- size="16px"
252
+ size="1rem"
253
253
  tooltip={copied ? 'Copied' : 'Copy to clipboard'}
254
254
  ariaLabel={copied ? 'Copied to clipboard' : 'Copy to clipboard'}
255
255
  onclick={copyToClipboard}
@@ -264,7 +264,7 @@
264
264
  position: relative;
265
265
  width: 100%;
266
266
  border: 1px solid var(--border-color, #ddd);
267
- border-radius: 6px;
267
+ border-radius: 0.375rem;
268
268
  overflow: hidden;
269
269
  background: var(--input-bg-color);
270
270
  }
@@ -273,11 +273,11 @@
273
273
  an opaque backing so it stays readable over the code underneath. */
274
274
  .codemirror-copy {
275
275
  position: absolute;
276
- top: 6px;
277
- right: 6px;
276
+ top: 0.375rem;
277
+ right: 0.375rem;
278
278
  z-index: 2;
279
279
  display: inline-flex;
280
- border-radius: 6px;
280
+ border-radius: 0.375rem;
281
281
  opacity: 0.65;
282
282
  transition: opacity 0.15s ease;
283
283
  }
@@ -142,10 +142,10 @@
142
142
  type="text"
143
143
  />
144
144
  <button class="link-icon-button primary" onclick={applyLink} title="Apply" type="button">
145
- <Icon svg={iconCheck} size="16px" />
145
+ <Icon svg={iconCheck} size="1rem" />
146
146
  </button>
147
147
  <button class="link-icon-button" onclick={cancelEditing} title="Cancel" type="button">
148
- <Icon svg={iconX} size="16px" />
148
+ <Icon svg={iconX} size="1rem" />
149
149
  </button>
150
150
  </div>
151
151
  <label class="link-checkbox-label">
@@ -157,11 +157,11 @@
157
157
  {href}
158
158
  </button>
159
159
  <button class="link-icon-button primary" onclick={openLink} title="Open link" type="button">
160
- <Icon svg={iconExternalLink} size="16px" />
160
+ <Icon svg={iconExternalLink} size="1rem" />
161
161
  </button>
162
162
  {#if editable}
163
163
  <button class="link-icon-button" onclick={startEditing} title="Edit link" type="button">
164
- <Icon svg={iconEdit} size="16px" />
164
+ <Icon svg={iconEdit} size="1rem" />
165
165
  </button>
166
166
  <button
167
167
  class="link-icon-button danger"
@@ -169,7 +169,7 @@
169
169
  title="Remove link"
170
170
  type="button"
171
171
  >
172
- <Icon svg={iconTrash} size="16px" />
172
+ <Icon svg={iconTrash} size="1rem" />
173
173
  </button>
174
174
  {/if}
175
175
  {/if}
@@ -179,11 +179,11 @@
179
179
  .link-action-menu {
180
180
  display: flex;
181
181
  align-items: center;
182
- gap: 6px;
183
- max-width: min(560px, calc(100vw - 32px));
184
- padding: 6px;
182
+ gap: 0.375rem;
183
+ max-width: min(35rem, calc(100vw - 2rem));
184
+ padding: 0.375rem;
185
185
  border: 1px solid var(--border-color);
186
- border-radius: 6px;
186
+ border-radius: 0.375rem;
187
187
  background: var(--paper-title-bg);
188
188
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
189
189
  color: var(--text-color);
@@ -196,16 +196,16 @@
196
196
 
197
197
  .link-url {
198
198
  min-width: 0;
199
- max-width: 320px;
200
- padding: 5px 8px;
199
+ max-width: 20rem;
200
+ padding: 0.3125rem 0.5rem;
201
201
  overflow: hidden;
202
202
  border: 1px solid var(--border-color);
203
- border-radius: 4px;
203
+ border-radius: 0.25rem;
204
204
  background: var(--paper-body-bg);
205
205
  color: var(--ui-link-color);
206
206
  cursor: pointer;
207
207
  font: inherit;
208
- font-size: 13px;
208
+ font-size: 0.8125rem;
209
209
  text-overflow: ellipsis;
210
210
  white-space: nowrap;
211
211
  }
@@ -217,20 +217,20 @@
217
217
  .link-edit-row {
218
218
  display: flex;
219
219
  align-items: center;
220
- gap: 4px;
221
- min-width: min(360px, calc(100vw - 80px));
220
+ gap: 0.25rem;
221
+ min-width: min(22.5rem, calc(100vw - 5rem));
222
222
  }
223
223
 
224
224
  .link-input {
225
225
  flex: 1;
226
226
  min-width: 0;
227
- padding: 6px 10px;
227
+ padding: 0.375rem 0.625rem;
228
228
  border: 1px solid var(--border-color);
229
- border-radius: 4px;
229
+ border-radius: 0.25rem;
230
230
  background: var(--paper-body-bg);
231
231
  color: var(--text-color);
232
232
  font: inherit;
233
- font-size: 14px;
233
+ font-size: 0.875rem;
234
234
  outline: none;
235
235
  }
236
236
 
@@ -248,11 +248,11 @@
248
248
  display: inline-flex;
249
249
  align-items: center;
250
250
  justify-content: center;
251
- width: 28px;
252
- height: 28px;
251
+ width: 1.75rem;
252
+ height: 1.75rem;
253
253
  padding: 0;
254
254
  border: none;
255
- border-radius: 4px;
255
+ border-radius: 0.25rem;
256
256
  background: transparent;
257
257
  color: var(--text-color);
258
258
  cursor: pointer;
@@ -299,14 +299,14 @@
299
299
  .link-checkbox-label {
300
300
  display: flex;
301
301
  align-items: center;
302
- gap: 6px;
303
- font-size: 13px;
302
+ gap: 0.375rem;
303
+ font-size: 0.8125rem;
304
304
  white-space: nowrap;
305
305
  }
306
306
 
307
307
  .link-checkbox {
308
- width: 16px;
309
- height: 16px;
308
+ width: 1rem;
309
+ height: 1rem;
310
310
  cursor: pointer;
311
311
  accent-color: var(--ui-primary);
312
312
  }
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { onMount, onDestroy } from 'svelte';
3
- import { Editor, Extension, type AnyExtension } from '@tiptap/core';
3
+ import { useDialogEvents } from '../../ui/DialogEvents.svelte.js';
4
+ import { Editor, Extension, type AnyExtension, type FocusPosition } from '@tiptap/core';
4
5
  import { StarterKit } from '@tiptap/starter-kit';
5
6
  import { BubbleMenu } from '@tiptap/extension-bubble-menu';
6
7
  import Underline from '@tiptap/extension-underline';
@@ -77,6 +78,11 @@
77
78
  editable?: boolean;
78
79
  /** Placeholder text when editor is empty */
79
80
  placeholder?: string;
81
+ /** Auto-focus the editor on mount. `true` places the cursor at the start; pass
82
+ * 'end', 'all' or a document position to choose where. Ignored when not editable. */
83
+ autofocus?: FocusPosition;
84
+ /** Auto-focus the editor every time the parent Dialog opens */
85
+ autofocusDialog?: boolean;
80
86
  /** Additional CSS classes */
81
87
  class?: string;
82
88
  /** Async handler for image uploads, returns URL or null */
@@ -105,6 +111,8 @@
105
111
  tooltipLocation = 'top',
106
112
  editable = true,
107
113
  placeholder = 'Start typing...',
114
+ autofocus = false,
115
+ autofocusDialog = false,
108
116
  class: className = '',
109
117
  onImageUpload,
110
118
  onDocumentUpload,
@@ -350,6 +358,7 @@
350
358
  extensions,
351
359
  content: collaboration ? undefined : value,
352
360
  editable: editable,
361
+ autofocus: editable ? autofocus : false,
353
362
  editorProps: {
354
363
  transformPastedHTML: stripPastedColors
355
364
  },
@@ -373,6 +382,18 @@
373
382
  }
374
383
  });
375
384
 
385
+ // Content inside a Dialog mounts while it is closed, so the mount-time autofocus
386
+ // can't take; focus again once the dialog is showing
387
+ useDialogEvents({
388
+ onFirstOpen: () => {
389
+ if (!editable) return;
390
+ if (autofocus !== false && autofocus !== null && !autofocusDialog) focus(autofocus);
391
+ },
392
+ onOpen: () => {
393
+ if (editable && autofocusDialog) focus(autofocus || true);
394
+ }
395
+ });
396
+
376
397
  onDestroy(() => {
377
398
  element?.removeEventListener('click', handleEditorClick, true);
378
399
  element?.removeEventListener('paste', handlePaste as unknown as EventListener);
@@ -404,10 +425,10 @@
404
425
  editor.commands.clearContent();
405
426
  }
406
427
 
407
- export function focus() {
428
+ export function focus(position?: FocusPosition) {
408
429
  const editor = editorState.editor;
409
430
  if (!editor || editor.isDestroyed) return;
410
- editor.commands.focus();
431
+ editor.commands.focus(position);
411
432
  }
412
433
  </script>
413
434
 
@@ -525,7 +546,7 @@
525
546
  .editor-container {
526
547
  position: relative;
527
548
  border: 1px solid var(--border-color);
528
- border-radius: 6px;
549
+ border-radius: 0.375rem;
529
550
  background: var(--paper-body-bg);
530
551
  font-family: var(--ui-font-family);
531
552
  transition: border-color 0.2s ease;
@@ -539,11 +560,11 @@
539
560
  .toolbar {
540
561
  display: flex;
541
562
  align-items: center;
542
- gap: 4px;
543
- padding: 6px;
563
+ gap: 0.25rem;
564
+ padding: 0.375rem;
544
565
  border-bottom: 1px solid var(--border-color);
545
566
  background: var(--paper-title-bg);
546
- border-radius: 6px 6px 0 0;
567
+ border-radius: 0.375rem 0.375rem 0 0;
547
568
  flex-wrap: wrap;
548
569
  }
549
570
 
@@ -555,9 +576,9 @@
555
576
 
556
577
  .toolbar-divider {
557
578
  width: 1px;
558
- height: 24px;
579
+ height: 1.5rem;
559
580
  background: var(--border-color);
560
- margin: 0 4px;
581
+ margin: 0 0.25rem;
561
582
  }
562
583
 
563
584
  .link-bubble-menu {
@@ -565,8 +586,8 @@
565
586
  }
566
587
 
567
588
  .editor-content {
568
- padding: 16px;
569
- min-height: 200px;
589
+ padding: 1rem;
590
+ min-height: 12.5rem;
570
591
  color: var(--text-color);
571
592
  }
572
593
 
@@ -605,8 +626,8 @@
605
626
 
606
627
  .editor-content :global(.ProseMirror code) {
607
628
  background: var(--page-bg);
608
- padding: 2px 6px;
609
- border-radius: 3px;
629
+ padding: 2px 0.375rem;
630
+ border-radius: 0.1875rem;
610
631
  font-family: 'Monaco', 'Courier New', monospace;
611
632
  font-size: 0.9em;
612
633
  color: var(--ui-accent-text-color);
@@ -680,7 +701,7 @@
680
701
  .editor-content :global(.ProseMirror td) {
681
702
  position: relative;
682
703
  border: 1px solid var(--border-color);
683
- padding: 6px 10px;
704
+ padding: 0.375rem 0.625rem;
684
705
  vertical-align: top;
685
706
  min-width: 1em;
686
707
  box-sizing: border-box;
@@ -714,7 +735,7 @@
714
735
  top: 0;
715
736
  bottom: -2px;
716
737
  right: -2px;
717
- width: 4px;
738
+ width: 0.25rem;
718
739
  background: var(--ui-tertiary);
719
740
  pointer-events: none;
720
741
  z-index: 20;
@@ -862,11 +883,11 @@
862
883
  position: absolute;
863
884
  top: -1.4em;
864
885
  left: -1px;
865
- font-size: 12px;
886
+ font-size: 0.75rem;
866
887
  font-weight: 600;
867
888
  line-height: normal;
868
889
  padding: 0.1rem 0.3rem;
869
- border-radius: 3px 3px 3px 0;
890
+ border-radius: 0.1875rem 0.1875rem 0.1875rem 0;
870
891
  color: #fff;
871
892
  white-space: nowrap;
872
893
  user-select: none;
@@ -1,4 +1,4 @@
1
- import { type AnyExtension } from '@tiptap/core';
1
+ import { type AnyExtension, type FocusPosition } from '@tiptap/core';
2
2
  import { type CodeBlocksOptions } from './extensions/index.js';
3
3
  import type { CollaborationConfig } from './collaboration.js';
4
4
  /** Result returned from a document upload: the link text and its destination URL */
@@ -25,6 +25,11 @@ export interface TipTapProps {
25
25
  editable?: boolean;
26
26
  /** Placeholder text when editor is empty */
27
27
  placeholder?: string;
28
+ /** Auto-focus the editor on mount. `true` places the cursor at the start; pass
29
+ * 'end', 'all' or a document position to choose where. Ignored when not editable. */
30
+ autofocus?: FocusPosition;
31
+ /** Auto-focus the editor every time the parent Dialog opens */
32
+ autofocusDialog?: boolean;
28
33
  /** Additional CSS classes */
29
34
  class?: string;
30
35
  /** Async handler for image uploads, returns URL or null */
@@ -48,7 +53,7 @@ declare const TipTap: import("svelte").Component<TipTapProps, {
48
53
  getJSON: () => object;
49
54
  setContent: (html: string) => void;
50
55
  clear: () => void;
51
- focus: () => void;
56
+ focus: (position?: FocusPosition) => void;
52
57
  }, "value">;
53
58
  type TipTap = ReturnType<typeof TipTap>;
54
59
  export default TipTap;