@seorii/tiptap 0.4.0 → 0.4.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.
@@ -81,6 +81,7 @@
81
81
  'data-resize-target',
82
82
  'data-resize-min-height',
83
83
  'data-resize-max-height',
84
+ 'data-resize-aspect-ratio',
84
85
  'data-bubble-menu',
85
86
  'data-hide-bubble-menu'
86
87
  ];
@@ -343,10 +344,13 @@
343
344
  .editable :global(.tiptap-media-resize-anchor) {
344
345
  width: 100%;
345
346
  display: flex;
346
- justify-content: center;
347
+ flex-direction: column;
348
+ align-items: center;
347
349
  margin: 6px 0 2px;
348
350
  line-height: 0;
349
351
  pointer-events: none;
352
+ position: relative;
353
+ overflow: visible;
350
354
  }
351
355
 
352
356
  .editable :global(.tiptap-media-resize-handle) {
@@ -379,6 +383,56 @@
379
383
  transform: translateY(1px);
380
384
  }
381
385
 
386
+ .editable :global(.tiptap-media-aspect-ratio-toolbar) {
387
+ display: none;
388
+ align-items: center;
389
+ gap: 4px;
390
+ padding: 4px;
391
+ border: 1px solid var(--primary-light3, rgba(120, 120, 120, 0.4));
392
+ border-radius: 999px;
393
+ background: var(--surface, #fff);
394
+ box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
395
+ pointer-events: auto;
396
+ line-height: 1;
397
+ position: absolute;
398
+ top: calc(100% + 6px);
399
+ left: 50%;
400
+ transform: translateX(-50%);
401
+ z-index: 4;
402
+ white-space: nowrap;
403
+ }
404
+
405
+ .editable
406
+ :global(.tiptap-media-resize-anchor.is-toolbar-open .tiptap-media-aspect-ratio-toolbar) {
407
+ display: flex;
408
+ }
409
+
410
+ .editable :global(.tiptap-media-aspect-ratio-option) {
411
+ appearance: none;
412
+ -webkit-appearance: none;
413
+ margin: 0;
414
+ padding: 2px 8px;
415
+ border: 0;
416
+ border-radius: 999px;
417
+ background: transparent;
418
+ color: var(--on-surface, #000);
419
+ font-size: 11px;
420
+ font-weight: 600;
421
+ cursor: pointer;
422
+ transition: background-color 0.15s ease;
423
+ }
424
+
425
+ .editable :global(.tiptap-media-aspect-ratio-option:hover),
426
+ .editable :global(.tiptap-media-aspect-ratio-option:focus-visible) {
427
+ background: var(--primary-light1, rgba(120, 120, 120, 0.14));
428
+ outline: none;
429
+ }
430
+
431
+ .editable :global(.tiptap-media-aspect-ratio-option[aria-pressed='true']) {
432
+ background: var(--primary-light4, rgba(120, 120, 120, 0.3));
433
+ color: var(--on-primary, #000);
434
+ }
435
+
382
436
  .editable :global(.tiptap-media-resize-proxy) {
383
437
  width: 100%;
384
438
  border-radius: 12px;
@@ -410,6 +464,7 @@
410
464
  & :global(img) {
411
465
  transition: all 0.2s ease-in-out;
412
466
  max-width: 100%;
467
+ object-fit: contain;
413
468
  border-radius: 12px;
414
469
  position: relative;
415
470
  }
@@ -470,21 +525,58 @@
470
525
  border-radius: 12px;
471
526
  }
472
527
 
473
- & :global(.iframe-wrapper) {
474
- position: relative;
475
- padding-bottom: 12px;
528
+ & :global(.iframe-wrapper),
529
+ & :global(.embed-wrapper) {
476
530
  overflow: hidden;
477
531
  width: 100%;
478
- height: 600px;
479
532
  border-radius: 12px;
480
533
  }
481
534
 
482
- & :global(iframe) {
483
- position: absolute;
484
- top: 0;
485
- left: 0;
535
+ & :global(iframe),
536
+ & :global(embed) {
537
+ display: block;
486
538
  width: 100%;
487
- height: 100%;
539
+ max-width: 100%;
540
+ }
541
+
542
+ & :global([data-resize-aspect-ratio='16:9']) {
543
+ --tiptap-media-aspect-ratio: 16 / 9;
544
+ }
545
+
546
+ & :global([data-resize-aspect-ratio='3:2']) {
547
+ --tiptap-media-aspect-ratio: 3 / 2;
548
+ }
549
+
550
+ & :global([data-resize-aspect-ratio='21:9']) {
551
+ --tiptap-media-aspect-ratio: 21 / 9;
552
+ }
553
+
554
+ & :global([data-resize-aspect-ratio='1:1']) {
555
+ --tiptap-media-aspect-ratio: 1 / 1;
556
+ }
557
+
558
+ & :global([data-resize-aspect-ratio='4:3']) {
559
+ --tiptap-media-aspect-ratio: 4 / 3;
560
+ }
561
+
562
+ & :global([data-resize-aspect-ratio='9:16']) {
563
+ --tiptap-media-aspect-ratio: 9 / 16;
564
+ }
565
+
566
+ & :global(iframe[data-resize-aspect-ratio='16:9']),
567
+ & :global(iframe[data-resize-aspect-ratio='3:2']),
568
+ & :global(iframe[data-resize-aspect-ratio='21:9']),
569
+ & :global(iframe[data-resize-aspect-ratio='1:1']),
570
+ & :global(iframe[data-resize-aspect-ratio='4:3']),
571
+ & :global(iframe[data-resize-aspect-ratio='9:16']),
572
+ & :global(embed[data-resize-aspect-ratio='16:9']),
573
+ & :global(embed[data-resize-aspect-ratio='3:2']),
574
+ & :global(embed[data-resize-aspect-ratio='21:9']),
575
+ & :global(embed[data-resize-aspect-ratio='1:1']),
576
+ & :global(embed[data-resize-aspect-ratio='4:3']),
577
+ & :global(embed[data-resize-aspect-ratio='9:16']) {
578
+ aspect-ratio: var(--tiptap-media-aspect-ratio, auto);
579
+ height: auto;
488
580
  }
489
581
  }
490
582
  </style>
@@ -26,6 +26,7 @@ import UploadSkeleton from '../plugin/upload/skeleton';
26
26
  import { MathInline, MathBlock } from '@seorii/prosemirror-math/tiptap';
27
27
  import Youtube from '../plugin/youtube';
28
28
  import Placeholder from '@tiptap/extension-placeholder';
29
+ import columns from '../plugin/columns';
29
30
  import command from '../plugin/command/suggest';
30
31
  import emoji from '../plugin/command/emoji';
31
32
  import { countSlashItems, moveSlashSelection, runSlashItemAt, slashState } from '../plugin/command/stores.svelte';
@@ -239,6 +240,7 @@ const extensions = (placeholder, plugins, crossorigin, codeBlockLanguageLabels)
239
240
  orderedlist,
240
241
  MathInline,
241
242
  MathBlock,
243
+ ...columns,
242
244
  table,
243
245
  tableHeader,
244
246
  tableRow,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seorii/tiptap",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "svelte-kit sync && svelte-package",