bbang-react-editor 0.1.4 → 0.1.6

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/style.css CHANGED
@@ -385,6 +385,427 @@ ne-text {
385
385
  /* vertical-align: baseline; */
386
386
  }
387
387
 
388
+ .bbang-editor.ne-wps .ne-root ne-text:not(.ne-td-content ne-text) {
389
+ display: inline-block;
390
+ width: 100%;
391
+ box-sizing: border-box;
392
+ }
393
+
394
+ .bbang-editor.ne-wps .ne-root ne-list {
395
+ display: flow-root;
396
+ height: auto;
397
+ overflow: visible;
398
+ }
399
+
400
+ .bbang-editor.ne-wps .ne-root ne-list > ne-text {
401
+ display: block;
402
+ width: 100%;
403
+ box-sizing: border-box;
404
+ }
405
+
406
+ .bbang-editor.ne-wps .ne-root ne-block[data-block-type="paragraph"] ne-text:not(.ne-td-content ne-text) {
407
+ text-indent: var(--ne-wps-first-line-indent, 2em);
408
+ }
409
+
410
+ .bbang-editor.ne-wps .ne-root ne-block[data-block-type="paragraph"][data-text-indent-level="1"] ne-text:not(.ne-td-content ne-text) {
411
+ padding-left: var(--ne-wps-text-indent-step, 2em);
412
+ }
413
+
414
+ .bbang-editor.ne-wps .ne-root ne-block[data-block-type="paragraph"][data-text-indent-level="2"] ne-text:not(.ne-td-content ne-text) {
415
+ padding-left: calc(var(--ne-wps-text-indent-step, 2em) * 2);
416
+ }
417
+
418
+ .bbang-editor.ne-wps .ne-root ne-block[data-block-type="paragraph"][data-text-indent-level="3"] ne-text:not(.ne-td-content ne-text) {
419
+ padding-left: calc(var(--ne-wps-text-indent-step, 2em) * 3);
420
+ }
421
+
422
+ .bbang-editor.ne-wps .ne-root ne-block[data-block-type="paragraph"][data-text-indent-level="4"] ne-text:not(.ne-td-content ne-text) {
423
+ padding-left: calc(var(--ne-wps-text-indent-step, 2em) * 4);
424
+ }
425
+
426
+ .bbang-editor.ne-wps .ne-root ne-block[data-block-type="paragraph"][data-text-indent-level="5"] ne-text:not(.ne-td-content ne-text) {
427
+ padding-left: calc(var(--ne-wps-text-indent-step, 2em) * 5);
428
+ }
429
+
430
+ .bbang-editor.ne-wps .ne-root ne-block[data-block-type="paragraph"][data-text-indent-level="6"] ne-text:not(.ne-td-content ne-text) {
431
+ padding-left: calc(var(--ne-wps-text-indent-step, 2em) * 6);
432
+ }
433
+
434
+ ne-text[data-trailing-soft-break="true"]::after {
435
+ content: '\200B';
436
+ }
437
+
438
+ /* ── Image Block (block-level, ne-image-wrap inside ne-block) ── */
439
+ ne-block[data-block-type="image"] {
440
+ position: relative;
441
+ padding-top: 8px;
442
+ padding-bottom: 8px;
443
+ }
444
+
445
+ ne-image-wrap {
446
+ display: block;
447
+ position: relative;
448
+ width: var(--ne-image-width-percent, 100%);
449
+ max-width: 100%;
450
+ margin: 0;
451
+ line-height: 0;
452
+ border-radius: 6px;
453
+ transition: box-shadow 0.15s;
454
+ }
455
+
456
+ ne-image-wrap[data-align="center"] {
457
+ margin-left: auto;
458
+ margin-right: auto;
459
+ }
460
+
461
+ ne-image-wrap[data-align="right"] {
462
+ margin-left: auto;
463
+ margin-right: 0;
464
+ }
465
+
466
+ ne-image-wrap img {
467
+ display: block;
468
+ width: 100%;
469
+ height: auto;
470
+ aspect-ratio: var(--ne-image-aspect-ratio, auto);
471
+ object-fit: cover;
472
+ border-radius: 6px;
473
+ user-select: none;
474
+ -webkit-user-drag: none;
475
+ }
476
+
477
+ ne-image-wrap[data-ratio="auto"] img,
478
+ ne-image-wrap[data-ratio="default"] img {
479
+ aspect-ratio: auto;
480
+ object-fit: contain;
481
+ }
482
+
483
+ ne-image-wrap:not([data-loaded="true"]) > img {
484
+ opacity: 0;
485
+ position: absolute;
486
+ inset: 0;
487
+ }
488
+
489
+ .ne-image-fallback {
490
+ display: flex;
491
+ align-items: center;
492
+ justify-content: center;
493
+ width: 100%;
494
+ min-height: 120px;
495
+ background: #f3f4f6;
496
+ border-radius: 6px;
497
+ color: #9ca3af;
498
+ font-size: 14px;
499
+ user-select: none;
500
+ }
501
+
502
+ ne-image-wrap[data-loaded="true"] > .ne-image-fallback {
503
+ display: none;
504
+ }
505
+
506
+ /* ── Image Style Effects ── */
507
+ ne-image-wrap[data-image-style="border"] img {
508
+ border: 1px solid #e5e7eb;
509
+ }
510
+ ne-image-wrap[data-image-style="shadow"] img {
511
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
512
+ }
513
+
514
+ /* ── Image Toolbar (hover-visible, 语雀 style) ── */
515
+ .ne-image-toolbar {
516
+ position: absolute;
517
+ left: 50%;
518
+ top: 8px;
519
+ transform: translateX(-50%);
520
+ display: flex;
521
+ align-items: center;
522
+ gap: 2px;
523
+ background: #fff;
524
+ border: 1px solid #e5e7eb;
525
+ border-radius: 8px;
526
+ padding: 3px 4px;
527
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
528
+ z-index: 20;
529
+ line-height: 1;
530
+ opacity: 0;
531
+ pointer-events: none;
532
+ transition: opacity 0.15s;
533
+ white-space: nowrap;
534
+ }
535
+
536
+ ne-image-wrap:hover > .ne-image-toolbar,
537
+ .ne-image-toolbar:hover,
538
+ .ne-image-toolbar.has-open-popup {
539
+ opacity: 1;
540
+ pointer-events: auto;
541
+ }
542
+
543
+ .ne-image-toolbar-btn {
544
+ display: flex;
545
+ align-items: center;
546
+ justify-content: center;
547
+ gap: 4px;
548
+ padding: 4px 8px;
549
+ border: none;
550
+ background: transparent;
551
+ border-radius: 4px;
552
+ font-size: 13px;
553
+ color: #37352f;
554
+ cursor: pointer;
555
+ white-space: nowrap;
556
+ min-width: 28px;
557
+ height: 28px;
558
+ line-height: 1;
559
+ }
560
+
561
+ .ne-image-toolbar-btn:hover {
562
+ background: rgba(55, 53, 47, 0.08);
563
+ }
564
+
565
+ .ne-image-toolbar-btn.active {
566
+ background: rgba(35, 131, 226, 0.12);
567
+ color: #2383e2;
568
+ }
569
+
570
+ .ne-image-toolbar-btn.disabled {
571
+ opacity: 0.35;
572
+ cursor: not-allowed;
573
+ pointer-events: none;
574
+ display: none;
575
+ }
576
+
577
+ .ne-image-toolbar-btn .ne-toolbar-btn-icon {
578
+ display: flex;
579
+ align-items: center;
580
+ }
581
+
582
+ .ne-toolbar-arrow {
583
+ font-size: 10px;
584
+ margin-left: 1px;
585
+ opacity: 0.5;
586
+ }
587
+
588
+ .ne-image-toolbar-sep {
589
+ width: 1px;
590
+ height: 20px;
591
+ background: #e5e7eb;
592
+ margin: 0 2px;
593
+ flex-shrink: 0;
594
+ }
595
+
596
+ /* ── Image Toolbar Popups ── */
597
+ .ne-image-toolbar-popup {
598
+ background: #fff;
599
+ border: 1px solid #e5e7eb;
600
+ border-radius: 8px;
601
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
602
+ z-index: 30;
603
+ padding: 12px;
604
+ min-width: 200px;
605
+ }
606
+
607
+ /* ── Src (link) popup ── */
608
+ .ne-image-popup-src {
609
+ display: flex;
610
+ flex-direction: column;
611
+ gap: 8px;
612
+ width: 320px;
613
+ max-width: calc(100vw - 32px);
614
+ }
615
+
616
+ .ne-image-popup-input {
617
+ width: 100%;
618
+ box-sizing: border-box;
619
+ padding: 6px 10px;
620
+ border: 1px solid #e5e7eb;
621
+ border-radius: 6px;
622
+ font-size: 14px;
623
+ color: #37352f;
624
+ outline: none;
625
+ transition: border-color 0.15s;
626
+ }
627
+
628
+ .ne-image-popup-input:focus {
629
+ border-color: #2383e2;
630
+ box-shadow: 0 0 0 2px rgba(35, 131, 226, 0.15);
631
+ }
632
+
633
+ .ne-image-popup-input::placeholder {
634
+ color: #9ca3af;
635
+ }
636
+
637
+ .ne-image-popup-submit {
638
+ align-self: flex-end;
639
+ padding: 6px 16px;
640
+ border: none;
641
+ border-radius: 6px;
642
+ background: #2383e2;
643
+ color: #fff;
644
+ font-size: 13px;
645
+ font-weight: 500;
646
+ cursor: pointer;
647
+ transition: background 0.15s;
648
+ }
649
+
650
+ .ne-image-popup-submit:hover {
651
+ background: #1a6fc4;
652
+ }
653
+
654
+ /* ── Size popup ── */
655
+ .ne-image-popup-size {
656
+ display: flex;
657
+ flex-direction: column;
658
+ gap: 10px;
659
+ width: 280px;
660
+ max-width: calc(100vw - 32px);
661
+ }
662
+
663
+ .ne-image-size-row {
664
+ display: flex;
665
+ align-items: center;
666
+ gap: 8px;
667
+ }
668
+
669
+ .ne-image-size-label {
670
+ font-size: 13px;
671
+ color: #6b7280;
672
+ flex-shrink: 0;
673
+ }
674
+
675
+ .ne-image-size-input {
676
+ width: 80px;
677
+ box-sizing: border-box;
678
+ padding: 5px 8px;
679
+ border: 1px solid #e5e7eb;
680
+ border-radius: 6px;
681
+ font-size: 14px;
682
+ color: #37352f;
683
+ outline: none;
684
+ transition: border-color 0.15s;
685
+ -moz-appearance: textfield;
686
+ }
687
+
688
+ .ne-image-size-input::-webkit-inner-spin-button,
689
+ .ne-image-size-input::-webkit-outer-spin-button {
690
+ -webkit-appearance: none;
691
+ margin: 0;
692
+ }
693
+
694
+ .ne-image-size-input:focus {
695
+ border-color: #2383e2;
696
+ box-shadow: 0 0 0 2px rgba(35, 131, 226, 0.15);
697
+ }
698
+
699
+ .ne-image-size-presets {
700
+ display: flex;
701
+ gap: 0;
702
+ border: 1px solid #e5e7eb;
703
+ border-radius: 6px;
704
+ overflow: hidden;
705
+ }
706
+
707
+ .ne-image-size-preset-btn {
708
+ flex: 1;
709
+ padding: 5px 0;
710
+ border: none;
711
+ border-right: 1px solid #e5e7eb;
712
+ background: #fff;
713
+ font-size: 13px;
714
+ color: #37352f;
715
+ cursor: pointer;
716
+ transition: background 0.15s;
717
+ }
718
+
719
+ .ne-image-size-preset-btn:last-child {
720
+ border-right: none;
721
+ }
722
+
723
+ .ne-image-size-preset-btn:hover {
724
+ background: rgba(55, 53, 47, 0.06);
725
+ }
726
+
727
+ .ne-image-size-preset-btn.active {
728
+ background: rgba(35, 131, 226, 0.12);
729
+ color: #2383e2;
730
+ }
731
+
732
+ /* ── Dropdown (align / style) ── */
733
+ .ne-image-dropdown {
734
+ display: flex;
735
+ flex-direction: column;
736
+ min-width: 140px;
737
+ padding: 4px 0;
738
+ }
739
+
740
+ .ne-image-dropdown-item {
741
+ display: flex;
742
+ align-items: center;
743
+ gap: 8px;
744
+ padding: 6px 12px;
745
+ font-size: 14px;
746
+ color: #37352f;
747
+ cursor: pointer;
748
+ border-radius: 4px;
749
+ transition: background 0.1s;
750
+ }
751
+
752
+ .ne-image-dropdown-item:hover {
753
+ background: rgba(55, 53, 47, 0.06);
754
+ }
755
+
756
+ .ne-image-dropdown-item.active {
757
+ color: #2383e2;
758
+ }
759
+
760
+ .ne-image-dropdown-check {
761
+ width: 14px;
762
+ height: 14px;
763
+ display: flex;
764
+ align-items: center;
765
+ justify-content: center;
766
+ flex-shrink: 0;
767
+ color: #2383e2;
768
+ }
769
+
770
+ .ne-image-dropdown-icon {
771
+ display: flex;
772
+ align-items: center;
773
+ flex-shrink: 0;
774
+ }
775
+
776
+ .ne-image-popup-input::selection,
777
+ .ne-image-size-input::selection {
778
+ background: highlight;
779
+ }
780
+
781
+ /* Legacy inline ne-image (deprecated, kept for backward compat) */
782
+ ne-image {
783
+ display: inline-flex;
784
+ position: relative;
785
+ vertical-align: top;
786
+ width: var(--ne-image-width-percent, 40%);
787
+ max-width: 100%;
788
+ max-height: var(--ne-image-height-percent, 100%);
789
+ margin: 4px 6px;
790
+ line-height: 0;
791
+ }
792
+
793
+ ne-image img {
794
+ display: block;
795
+ width: 100%;
796
+ height: auto;
797
+ aspect-ratio: var(--ne-image-aspect-ratio, auto);
798
+ object-fit: cover;
799
+ border-radius: 4px;
800
+ }
801
+
802
+ ne-image .ne-image-placeholder {
803
+ position: absolute;
804
+ opacity: 0;
805
+ pointer-events: none;
806
+ font-size: 0;
807
+ }
808
+
388
809
  .ne-root *::selection {
389
810
  background: transparent;
390
811
  }
@@ -563,14 +984,13 @@ ne-cursor {
563
984
  .ne-color-popover {
564
985
  position: absolute;
565
986
  top: calc(100% + 6px);
566
- right: 0;
987
+ left: -185px;
567
988
  z-index: 200;
568
989
  background: #fff;
569
990
  border: 1px solid #e5e7eb;
570
991
  border-radius: 8px;
571
992
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
572
993
  padding: 8px;
573
- width: 220px;
574
994
  }
575
995
 
576
996
  .ne-color-section {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bbang-react-editor",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "BbangEditor - 轻量 React 块编辑器组件",
5
5
  "license": "UNLICENSED",
6
6
  "keywords": [