@x33025/sveltely 0.1.17 → 0.1.18
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.
- package/dist/components/Library/ArticleEditor/ArticleEditor.svelte +2 -2
- package/dist/components/Library/ArticleEditor/ArticleEditorBody.svelte +59 -74
- package/dist/components/Library/ArticleEditor/ArticleEditorHeader.svelte +3 -3
- package/dist/components/Library/ArticleEditor/{ArticleBlockCode.svelte → Blocks/Code.svelte} +2 -2
- package/dist/components/Library/ArticleEditor/Blocks/Code.svelte.d.ts +8 -0
- package/dist/components/Library/ArticleEditor/{ArticleBlockFAQ.svelte → Blocks/FAQ.svelte} +2 -2
- package/dist/components/Library/ArticleEditor/Blocks/FAQ.svelte.d.ts +8 -0
- package/dist/components/Library/ArticleEditor/{ArticleBlockHeading.svelte → Blocks/Heading.svelte} +2 -2
- package/dist/components/Library/ArticleEditor/{ArticleBlockHeading.svelte.d.ts → Blocks/Heading.svelte.d.ts} +4 -4
- package/dist/components/Library/ArticleEditor/{ArticleBlockImage.svelte → Blocks/Image.svelte} +4 -4
- package/dist/components/Library/ArticleEditor/Blocks/Image.svelte.d.ts +9 -0
- package/dist/components/Library/ArticleEditor/Blocks/ImagePreview.svelte.d.ts +8 -0
- package/dist/components/Library/ArticleEditor/{ArticleBlockList.svelte → Blocks/List.svelte} +2 -2
- package/dist/components/Library/ArticleEditor/{ArticleBlockList.svelte.d.ts → Blocks/List.svelte.d.ts} +4 -4
- package/dist/components/Library/ArticleEditor/{ArticleBlockParagraph.svelte → Blocks/Paragraph.svelte} +2 -2
- package/dist/components/Library/ArticleEditor/{ArticleBlockFallback.svelte.d.ts → Blocks/Paragraph.svelte.d.ts} +4 -4
- package/dist/components/Library/ArticleEditor/{ArticleBlockTable.svelte → Blocks/Table.svelte} +1 -1
- package/dist/components/Library/ArticleEditor/{ArticleBlockTable.svelte.d.ts → Blocks/Table.svelte.d.ts} +4 -4
- package/dist/components/Library/ArticleEditor/Blocks/index.d.ts +8 -0
- package/dist/components/Library/ArticleEditor/Blocks/index.js +8 -0
- package/dist/components/Library/ArticleEditor/index.d.ts +1 -9
- package/dist/components/Library/ArticleEditor/index.js +1 -9
- package/dist/style.css +0 -3
- package/package.json +1 -1
- package/dist/components/Library/ArticleEditor/ArticleBlockCode.svelte.d.ts +0 -8
- package/dist/components/Library/ArticleEditor/ArticleBlockFAQ.svelte.d.ts +0 -8
- package/dist/components/Library/ArticleEditor/ArticleBlockFallback.svelte +0 -79
- package/dist/components/Library/ArticleEditor/ArticleBlockImage.svelte.d.ts +0 -9
- package/dist/components/Library/ArticleEditor/ArticleBlockParagraph.svelte.d.ts +0 -15
- package/dist/components/Library/ArticleEditor/ArticleImagePreview.svelte.d.ts +0 -8
- /package/dist/components/Library/ArticleEditor/{ArticleImagePreview.svelte → Blocks/ImagePreview.svelte} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import VStack from '../VStack';
|
|
3
3
|
import TextEditor from '../TextEditor';
|
|
4
|
-
import ArticleBlockFAQ from './ArticleBlockFAQ.svelte';
|
|
5
4
|
import ArticleEditorBody from './ArticleEditorBody.svelte';
|
|
6
5
|
import ArticleEditorHeader from './ArticleEditorHeader.svelte';
|
|
6
|
+
import FAQ from './Blocks/FAQ.svelte';
|
|
7
7
|
import type { BlockInsertKind, BlockTextFormat } from './articleEditor.svelte.js';
|
|
8
8
|
import type { ArticleEditorArticle, BlockDraft } from './types.js';
|
|
9
9
|
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
className="text-2xl leading-tight font-semibold tracking-[-0.025em] text-zinc-950 placeholder:text-zinc-300"
|
|
173
173
|
placeholder="FAQ title"
|
|
174
174
|
/>
|
|
175
|
-
<
|
|
175
|
+
<FAQ {block} onUpdateItem={onUpdateFAQItem} />
|
|
176
176
|
{/each}
|
|
177
177
|
</VStack>
|
|
178
178
|
</section>
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
import VStack from '../VStack';
|
|
3
3
|
import type { BlockInsertKind, BlockTextFormat } from './articleEditor.svelte.js';
|
|
4
4
|
import type { BlockDraft } from './types.js';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
5
|
+
import Code from './Blocks/Code.svelte';
|
|
6
|
+
import Heading from './Blocks/Heading.svelte';
|
|
7
|
+
import Image from './Blocks/Image.svelte';
|
|
8
|
+
import List from './Blocks/List.svelte';
|
|
9
|
+
import Paragraph from './Blocks/Paragraph.svelte';
|
|
10
|
+
import Table from './Blocks/Table.svelte';
|
|
11
11
|
import ArticleBlockShell from './ArticleBlockShell.svelte';
|
|
12
|
-
import ArticleBlockTable from './ArticleBlockTable.svelte';
|
|
13
12
|
|
|
14
13
|
let {
|
|
15
14
|
draftTitle,
|
|
@@ -237,7 +236,7 @@
|
|
|
237
236
|
});
|
|
238
237
|
</script>
|
|
239
238
|
|
|
240
|
-
<VStack gap={5}
|
|
239
|
+
<VStack gap={5}>
|
|
241
240
|
{#each articleBlocks as block (block.id)}
|
|
242
241
|
{@const dropPlacement = dropPlacementFor(block.id)}
|
|
243
242
|
{@const textFormat = blockTextFormat(block)}
|
|
@@ -257,72 +256,58 @@
|
|
|
257
256
|
onDragStart={handleBlockDragStart}
|
|
258
257
|
onDragEnd={handleBlockDragEnd}
|
|
259
258
|
>
|
|
260
|
-
{#
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
{
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
{
|
|
311
|
-
|
|
312
|
-
{:else}
|
|
313
|
-
<ArticleBlockFallback
|
|
314
|
-
{block}
|
|
315
|
-
onUpdate={onUpdateBlock}
|
|
316
|
-
{onCreateParagraphAfter}
|
|
317
|
-
{onMergeBlockWithPrevious}
|
|
318
|
-
{onRemoveBlock}
|
|
319
|
-
{onConvertToList}
|
|
320
|
-
shouldFocus={focusTarget === block.id}
|
|
321
|
-
focusPosition={focusTarget === block.id ? focusPosition : null}
|
|
322
|
-
onFocused={onFocusHandled}
|
|
323
|
-
/>
|
|
324
|
-
{/if}
|
|
325
|
-
{/snippet}
|
|
259
|
+
{#if block.type === 'heading'}
|
|
260
|
+
<Heading
|
|
261
|
+
{block}
|
|
262
|
+
onUpdate={onUpdateBlock}
|
|
263
|
+
{onCreateParagraphAfter}
|
|
264
|
+
{onMergeBlockWithPrevious}
|
|
265
|
+
{onRemoveBlock}
|
|
266
|
+
shouldFocus={focusTarget === block.id}
|
|
267
|
+
focusPosition={focusTarget === block.id ? focusPosition : null}
|
|
268
|
+
onFocused={onFocusHandled}
|
|
269
|
+
/>
|
|
270
|
+
{:else if block.type === 'paragraph'}
|
|
271
|
+
<Paragraph
|
|
272
|
+
{block}
|
|
273
|
+
onUpdate={onUpdateBlock}
|
|
274
|
+
{onCreateParagraphAfter}
|
|
275
|
+
{onMergeBlockWithPrevious}
|
|
276
|
+
{onRemoveBlock}
|
|
277
|
+
{onConvertToList}
|
|
278
|
+
shouldFocus={focusTarget === block.id}
|
|
279
|
+
focusPosition={focusTarget === block.id ? focusPosition : null}
|
|
280
|
+
onFocused={onFocusHandled}
|
|
281
|
+
/>
|
|
282
|
+
{:else if block.type === 'bullet_list' || block.type === 'list' || block.type === 'numbered_list'}
|
|
283
|
+
<List
|
|
284
|
+
{block}
|
|
285
|
+
onUpdateItem={onUpdateListItem}
|
|
286
|
+
onInsertItemAfter={onInsertListItemAfter}
|
|
287
|
+
{onMergeListItemWithPrevious}
|
|
288
|
+
{onCreateParagraphAfter}
|
|
289
|
+
{onRemoveListItem}
|
|
290
|
+
focusItemIndex={focusTarget?.startsWith(`${block.id}:`)
|
|
291
|
+
? Number(focusTarget.split(':')[1])
|
|
292
|
+
: null}
|
|
293
|
+
focusPosition={focusTarget?.startsWith(`${block.id}:`) ? focusPosition : null}
|
|
294
|
+
onFocused={onFocusHandled}
|
|
295
|
+
/>
|
|
296
|
+
{:else if block.type === 'image'}
|
|
297
|
+
<Image {block} titleFallback={draftTitle} onUpdate={onUpdateBlock} />
|
|
298
|
+
{:else if block.type === 'table'}
|
|
299
|
+
<Table
|
|
300
|
+
{block}
|
|
301
|
+
onUpdateHeader={onUpdateTableHeader}
|
|
302
|
+
onUpdateCell={onUpdateTableCell}
|
|
303
|
+
onAddColumn={onAddTableColumn}
|
|
304
|
+
onAddRow={onAddTableRow}
|
|
305
|
+
onRemoveColumn={onRemoveTableColumn}
|
|
306
|
+
onRemoveRow={onRemoveTableRow}
|
|
307
|
+
/>
|
|
308
|
+
{:else if block.type === 'code'}
|
|
309
|
+
<Code {block} onUpdate={onUpdateBlock} />
|
|
310
|
+
{/if}
|
|
326
311
|
</ArticleBlockShell>
|
|
327
312
|
{/each}
|
|
328
313
|
</VStack>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import VStack from '../VStack';
|
|
3
|
-
import ArticleImagePreview from './ArticleImagePreview.svelte';
|
|
4
3
|
import TextEditor from '../TextEditor';
|
|
4
|
+
import ImagePreview from './Blocks/ImagePreview.svelte';
|
|
5
5
|
import type { ArticleEditorArticle } from './types.js';
|
|
6
6
|
|
|
7
7
|
let { article, draftTitle, draftImageAltText, onTitleChange, onImageAltTextChange } = $props<{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}>();
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<VStack gap={
|
|
16
|
+
<VStack gap={10}>
|
|
17
17
|
<TextEditor
|
|
18
18
|
autosize
|
|
19
19
|
value={draftTitle}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
/>
|
|
26
26
|
|
|
27
27
|
{#if article.imageURL}
|
|
28
|
-
<
|
|
28
|
+
<ImagePreview
|
|
29
29
|
src={article.imageURL}
|
|
30
30
|
alt={draftImageAltText || article.title}
|
|
31
31
|
aspectRatio="4 / 3"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BlockDraft } from '../types.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
block: BlockDraft;
|
|
4
|
+
onUpdate: (id: string, patch: Partial<BlockDraft>) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const Code: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type Code = ReturnType<typeof Code>;
|
|
8
|
+
export default Code;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import TextEditor from '
|
|
3
|
-
import type { BlockDraft } from '
|
|
2
|
+
import TextEditor from '../../TextEditor';
|
|
3
|
+
import type { BlockDraft } from '../types.js';
|
|
4
4
|
|
|
5
5
|
let { block, onUpdateItem } = $props<{
|
|
6
6
|
block: BlockDraft;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BlockDraft } from '../types.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
block: BlockDraft;
|
|
4
|
+
onUpdateItem: (blockID: string, index: number, field: 'question' | 'answer', value: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const FAQ: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type FAQ = ReturnType<typeof FAQ>;
|
|
8
|
+
export default FAQ;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BlockDraft } from '
|
|
1
|
+
import type { BlockDraft } from '../types.js';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
block: BlockDraft;
|
|
4
4
|
onUpdate: (id: string, patch: Partial<BlockDraft>) => void;
|
|
@@ -9,6 +9,6 @@ type $$ComponentProps = {
|
|
|
9
9
|
focusPosition?: number | null;
|
|
10
10
|
onFocused?: () => void;
|
|
11
11
|
};
|
|
12
|
-
declare const
|
|
13
|
-
type
|
|
14
|
-
export default
|
|
12
|
+
declare const Heading: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
|
+
type Heading = ReturnType<typeof Heading>;
|
|
14
|
+
export default Heading;
|
package/dist/components/Library/ArticleEditor/{ArticleBlockImage.svelte → Blocks/Image.svelte}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type { BlockDraft } from '
|
|
2
|
+
import TextEditor from '../../TextEditor';
|
|
3
|
+
import ImagePreview from './ImagePreview.svelte';
|
|
4
|
+
import type { BlockDraft } from '../types.js';
|
|
5
5
|
|
|
6
6
|
let { block, titleFallback, onUpdate } = $props<{
|
|
7
7
|
block: BlockDraft;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<div class="article-block-image">
|
|
14
|
-
<
|
|
14
|
+
<ImagePreview src={block.imageURL} alt={block.imageAlt ?? titleFallback} />
|
|
15
15
|
<div>
|
|
16
16
|
<TextEditor
|
|
17
17
|
autosize
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockDraft } from '../types.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
block: BlockDraft;
|
|
4
|
+
titleFallback: string;
|
|
5
|
+
onUpdate: (id: string, patch: Partial<BlockDraft>) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const Image: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type Image = ReturnType<typeof Image>;
|
|
9
|
+
export default Image;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BlockDraft } from '
|
|
1
|
+
import type { BlockDraft } from '../types.js';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
block: BlockDraft;
|
|
4
4
|
onUpdateItem: (blockID: string, index: number, value: string) => void;
|
|
@@ -10,6 +10,6 @@ type $$ComponentProps = {
|
|
|
10
10
|
focusPosition?: number | null;
|
|
11
11
|
onFocused?: () => void;
|
|
12
12
|
};
|
|
13
|
-
declare const
|
|
14
|
-
type
|
|
15
|
-
export default
|
|
13
|
+
declare const List: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
|
+
type List = ReturnType<typeof List>;
|
|
15
|
+
export default List;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BlockDraft } from '
|
|
1
|
+
import type { BlockDraft } from '../types.js';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
block: BlockDraft;
|
|
4
4
|
onUpdate: (id: string, patch: Partial<BlockDraft>) => void;
|
|
@@ -10,6 +10,6 @@ type $$ComponentProps = {
|
|
|
10
10
|
focusPosition?: number | null;
|
|
11
11
|
onFocused?: () => void;
|
|
12
12
|
};
|
|
13
|
-
declare const
|
|
14
|
-
type
|
|
15
|
-
export default
|
|
13
|
+
declare const Paragraph: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
|
+
type Paragraph = ReturnType<typeof Paragraph>;
|
|
15
|
+
export default Paragraph;
|
package/dist/components/Library/ArticleEditor/{ArticleBlockTable.svelte → Blocks/Table.svelte}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Plus, Trash2 } from '@lucide/svelte';
|
|
3
|
-
import type { BlockDraft } from '
|
|
3
|
+
import type { BlockDraft } from '../types.js';
|
|
4
4
|
|
|
5
5
|
let { block, onUpdateHeader, onUpdateCell, onAddColumn, onAddRow, onRemoveColumn, onRemoveRow } =
|
|
6
6
|
$props<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BlockDraft } from '
|
|
1
|
+
import type { BlockDraft } from '../types.js';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
block: BlockDraft;
|
|
4
4
|
onUpdateHeader: (blockID: string, cellIndex: number, value: string) => void;
|
|
@@ -8,6 +8,6 @@ type $$ComponentProps = {
|
|
|
8
8
|
onRemoveColumn: (blockID: string, columnIndex: number) => void;
|
|
9
9
|
onRemoveRow: (blockID: string, rowIndex: number) => void;
|
|
10
10
|
};
|
|
11
|
-
declare const
|
|
12
|
-
type
|
|
13
|
-
export default
|
|
11
|
+
declare const Table: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
|
+
type Table = ReturnType<typeof Table>;
|
|
13
|
+
export default Table;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Code } from './Code.svelte';
|
|
2
|
+
export { default as FAQ } from './FAQ.svelte';
|
|
3
|
+
export { default as Heading } from './Heading.svelte';
|
|
4
|
+
export { default as Image } from './Image.svelte';
|
|
5
|
+
export { default as ImagePreview } from './ImagePreview.svelte';
|
|
6
|
+
export { default as List } from './List.svelte';
|
|
7
|
+
export { default as Paragraph } from './Paragraph.svelte';
|
|
8
|
+
export { default as Table } from './Table.svelte';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Code } from './Code.svelte';
|
|
2
|
+
export { default as FAQ } from './FAQ.svelte';
|
|
3
|
+
export { default as Heading } from './Heading.svelte';
|
|
4
|
+
export { default as Image } from './Image.svelte';
|
|
5
|
+
export { default as ImagePreview } from './ImagePreview.svelte';
|
|
6
|
+
export { default as List } from './List.svelte';
|
|
7
|
+
export { default as Paragraph } from './Paragraph.svelte';
|
|
8
|
+
export { default as Table } from './Table.svelte';
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
export { default as ArticleEditor } from './ArticleEditor.svelte';
|
|
2
2
|
export { default as ArticleEditorBody } from './ArticleEditorBody.svelte';
|
|
3
|
-
export { default as ArticleBlockCode } from './ArticleBlockCode.svelte';
|
|
4
|
-
export { default as ArticleBlockFAQ } from './ArticleBlockFAQ.svelte';
|
|
5
|
-
export { default as ArticleBlockFallback } from './ArticleBlockFallback.svelte';
|
|
6
|
-
export { default as ArticleBlockHeading } from './ArticleBlockHeading.svelte';
|
|
7
|
-
export { default as ArticleBlockImage } from './ArticleBlockImage.svelte';
|
|
8
3
|
export { default as ArticleBlockInsertControl } from './ArticleBlockInsertControl.svelte';
|
|
9
4
|
export { default as ArticleBlockDragControl } from './ArticleBlockDragControl.svelte';
|
|
10
|
-
export { default as ArticleBlockList } from './ArticleBlockList.svelte';
|
|
11
|
-
export { default as ArticleBlockParagraph } from './ArticleBlockParagraph.svelte';
|
|
12
5
|
export { default as ArticleBlockShell } from './ArticleBlockShell.svelte';
|
|
13
|
-
export
|
|
6
|
+
export * as Blocks from './Blocks';
|
|
14
7
|
export { default as ArticleEditorHeader } from './ArticleEditorHeader.svelte';
|
|
15
|
-
export { default as ArticleImagePreview } from './ArticleImagePreview.svelte';
|
|
16
8
|
export { articleBlockLabel, createArticleEditor } from './articleEditor.svelte.js';
|
|
17
9
|
export type { BlockInsertKind, BlockTextFormat } from './articleEditor.svelte.js';
|
|
18
10
|
export type { ArticleBlock, ArticleEditorArticle, BlockDraft } from './types.js';
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
export { default as ArticleEditor } from './ArticleEditor.svelte';
|
|
2
2
|
export { default as ArticleEditorBody } from './ArticleEditorBody.svelte';
|
|
3
|
-
export { default as ArticleBlockCode } from './ArticleBlockCode.svelte';
|
|
4
|
-
export { default as ArticleBlockFAQ } from './ArticleBlockFAQ.svelte';
|
|
5
|
-
export { default as ArticleBlockFallback } from './ArticleBlockFallback.svelte';
|
|
6
|
-
export { default as ArticleBlockHeading } from './ArticleBlockHeading.svelte';
|
|
7
|
-
export { default as ArticleBlockImage } from './ArticleBlockImage.svelte';
|
|
8
3
|
export { default as ArticleBlockInsertControl } from './ArticleBlockInsertControl.svelte';
|
|
9
4
|
export { default as ArticleBlockDragControl } from './ArticleBlockDragControl.svelte';
|
|
10
|
-
export { default as ArticleBlockList } from './ArticleBlockList.svelte';
|
|
11
|
-
export { default as ArticleBlockParagraph } from './ArticleBlockParagraph.svelte';
|
|
12
5
|
export { default as ArticleBlockShell } from './ArticleBlockShell.svelte';
|
|
13
|
-
export
|
|
6
|
+
export * as Blocks from './Blocks';
|
|
14
7
|
export { default as ArticleEditorHeader } from './ArticleEditorHeader.svelte';
|
|
15
|
-
export { default as ArticleImagePreview } from './ArticleImagePreview.svelte';
|
|
16
8
|
export { articleBlockLabel, createArticleEditor } from './articleEditor.svelte.js';
|
package/dist/style.css
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { BlockDraft } from './types.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
block: BlockDraft;
|
|
4
|
-
onUpdate: (id: string, patch: Partial<BlockDraft>) => void;
|
|
5
|
-
};
|
|
6
|
-
declare const ArticleBlockCode: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type ArticleBlockCode = ReturnType<typeof ArticleBlockCode>;
|
|
8
|
-
export default ArticleBlockCode;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { BlockDraft } from './types.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
block: BlockDraft;
|
|
4
|
-
onUpdateItem: (blockID: string, index: number, field: 'question' | 'answer', value: string) => void;
|
|
5
|
-
};
|
|
6
|
-
declare const ArticleBlockFAQ: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type ArticleBlockFAQ = ReturnType<typeof ArticleBlockFAQ>;
|
|
8
|
-
export default ArticleBlockFAQ;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import TextEditor from '../TextEditor';
|
|
3
|
-
import type { BlockDraft } from './types.js';
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
block,
|
|
7
|
-
onUpdate,
|
|
8
|
-
onCreateParagraphAfter,
|
|
9
|
-
onMergeBlockWithPrevious,
|
|
10
|
-
onConvertToList,
|
|
11
|
-
onRemoveBlock,
|
|
12
|
-
shouldFocus,
|
|
13
|
-
focusPosition,
|
|
14
|
-
onFocused
|
|
15
|
-
} = $props<{
|
|
16
|
-
block: BlockDraft;
|
|
17
|
-
onUpdate: (id: string, patch: Partial<BlockDraft>) => void;
|
|
18
|
-
onCreateParagraphAfter?: (id: string, text?: string, currentText?: string | null) => void;
|
|
19
|
-
onMergeBlockWithPrevious?: (id: string) => void;
|
|
20
|
-
onConvertToList?: (id: string, kind: 'bullet_list' | 'numbered_list') => void;
|
|
21
|
-
onRemoveBlock?: (id: string) => void;
|
|
22
|
-
shouldFocus?: boolean;
|
|
23
|
-
focusPosition?: number | null;
|
|
24
|
-
onFocused?: () => void;
|
|
25
|
-
}>();
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<TextEditor
|
|
29
|
-
autosize
|
|
30
|
-
rows={1}
|
|
31
|
-
value={block.text ?? ''}
|
|
32
|
-
onInput={(event) =>
|
|
33
|
-
onUpdate(block.id, {
|
|
34
|
-
text: (event.currentTarget as HTMLTextAreaElement).value
|
|
35
|
-
})}
|
|
36
|
-
onKeyDown={(event) => {
|
|
37
|
-
const value = (event.currentTarget as HTMLTextAreaElement).value.trim();
|
|
38
|
-
if (event.key === ' ' && value === '-') {
|
|
39
|
-
event.preventDefault();
|
|
40
|
-
onConvertToList?.(block.id, 'bullet_list');
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (event.key === ' ' && /^\d+\.$/.test(value)) {
|
|
44
|
-
event.preventDefault();
|
|
45
|
-
onConvertToList?.(block.id, 'numbered_list');
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (event.key === 'Enter' && !event.shiftKey) {
|
|
49
|
-
event.preventDefault();
|
|
50
|
-
const textarea = event.currentTarget as HTMLTextAreaElement;
|
|
51
|
-
const text = textarea.value;
|
|
52
|
-
const before = text.slice(0, textarea.selectionStart);
|
|
53
|
-
const after = text.slice(textarea.selectionEnd);
|
|
54
|
-
if (!text.trim()) {
|
|
55
|
-
onRemoveBlock?.(block.id);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
onCreateParagraphAfter?.(block.id, after, before);
|
|
59
|
-
}
|
|
60
|
-
if (
|
|
61
|
-
event.key === 'Backspace' &&
|
|
62
|
-
!event.shiftKey &&
|
|
63
|
-
!event.metaKey &&
|
|
64
|
-
!event.ctrlKey &&
|
|
65
|
-
!event.altKey
|
|
66
|
-
) {
|
|
67
|
-
const textarea = event.currentTarget as HTMLTextAreaElement;
|
|
68
|
-
if (textarea.selectionStart === 0 && textarea.selectionEnd === 0) {
|
|
69
|
-
event.preventDefault();
|
|
70
|
-
onMergeBlockWithPrevious?.(block.id);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}}
|
|
74
|
-
{shouldFocus}
|
|
75
|
-
{focusPosition}
|
|
76
|
-
{onFocused}
|
|
77
|
-
className="text-[16px] leading-7 text-zinc-700 placeholder:text-zinc-300"
|
|
78
|
-
placeholder="Block content"
|
|
79
|
-
/>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BlockDraft } from './types.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
block: BlockDraft;
|
|
4
|
-
titleFallback: string;
|
|
5
|
-
onUpdate: (id: string, patch: Partial<BlockDraft>) => void;
|
|
6
|
-
};
|
|
7
|
-
declare const ArticleBlockImage: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
-
type ArticleBlockImage = ReturnType<typeof ArticleBlockImage>;
|
|
9
|
-
export default ArticleBlockImage;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { BlockDraft } from './types.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
block: BlockDraft;
|
|
4
|
-
onUpdate: (id: string, patch: Partial<BlockDraft>) => void;
|
|
5
|
-
onCreateParagraphAfter?: (id: string, text?: string, currentText?: string | null) => void;
|
|
6
|
-
onMergeBlockWithPrevious?: (id: string) => void;
|
|
7
|
-
onConvertToList?: (id: string, kind: 'bullet_list' | 'numbered_list') => void;
|
|
8
|
-
onRemoveBlock?: (id: string) => void;
|
|
9
|
-
shouldFocus?: boolean;
|
|
10
|
-
focusPosition?: number | null;
|
|
11
|
-
onFocused?: () => void;
|
|
12
|
-
};
|
|
13
|
-
declare const ArticleBlockParagraph: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
|
-
type ArticleBlockParagraph = ReturnType<typeof ArticleBlockParagraph>;
|
|
15
|
-
export default ArticleBlockParagraph;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
src?: string | null;
|
|
3
|
-
alt: string;
|
|
4
|
-
aspectRatio?: string;
|
|
5
|
-
};
|
|
6
|
-
declare const ArticleImagePreview: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type ArticleImagePreview = ReturnType<typeof ArticleImagePreview>;
|
|
8
|
-
export default ArticleImagePreview;
|
|
File without changes
|