bbang-react-editor 0.1.3 → 0.1.5
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/README.md +30 -0
- package/dist/index.d.mts +74 -76
- package/dist/index.d.ts +74 -76
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/style.css +235 -2
- package/package.json +11 -1
package/dist/style.css
CHANGED
|
@@ -385,6 +385,240 @@ 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:hover {
|
|
457
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
ne-image-wrap[data-align="center"] {
|
|
461
|
+
margin-left: auto;
|
|
462
|
+
margin-right: auto;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
ne-image-wrap[data-align="right"] {
|
|
466
|
+
margin-left: auto;
|
|
467
|
+
margin-right: 0;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
ne-image-wrap img {
|
|
471
|
+
display: block;
|
|
472
|
+
width: 100%;
|
|
473
|
+
height: auto;
|
|
474
|
+
aspect-ratio: var(--ne-image-aspect-ratio, auto);
|
|
475
|
+
object-fit: cover;
|
|
476
|
+
border-radius: 6px;
|
|
477
|
+
user-select: none;
|
|
478
|
+
-webkit-user-drag: none;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
ne-image-wrap[data-ratio="auto"] img,
|
|
482
|
+
ne-image-wrap[data-ratio="default"] img {
|
|
483
|
+
aspect-ratio: auto;
|
|
484
|
+
object-fit: contain;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
ne-image-wrap:not([data-loaded="true"]) > img {
|
|
488
|
+
opacity: 0;
|
|
489
|
+
position: absolute;
|
|
490
|
+
inset: 0;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.ne-image-fallback {
|
|
494
|
+
display: flex;
|
|
495
|
+
align-items: center;
|
|
496
|
+
justify-content: center;
|
|
497
|
+
width: 100%;
|
|
498
|
+
min-height: 120px;
|
|
499
|
+
background: #f3f4f6;
|
|
500
|
+
border-radius: 6px;
|
|
501
|
+
color: #9ca3af;
|
|
502
|
+
font-size: 14px;
|
|
503
|
+
user-select: none;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
ne-image-wrap[data-loaded="true"] > .ne-image-fallback {
|
|
507
|
+
display: none;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/* ── Image Toolbar (hover-visible, table-bar style) ── */
|
|
511
|
+
.ne-image-toolbar {
|
|
512
|
+
position: absolute;
|
|
513
|
+
left: 50%;
|
|
514
|
+
top: -40px;
|
|
515
|
+
transform: translateX(-50%);
|
|
516
|
+
display: flex;
|
|
517
|
+
align-items: center;
|
|
518
|
+
gap: 2px;
|
|
519
|
+
background: #fff;
|
|
520
|
+
border: 1px solid #e5e7eb;
|
|
521
|
+
border-radius: 6px;
|
|
522
|
+
padding: 3px 4px;
|
|
523
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
524
|
+
z-index: 20;
|
|
525
|
+
line-height: 1;
|
|
526
|
+
opacity: 0;
|
|
527
|
+
pointer-events: none;
|
|
528
|
+
transition: opacity 0.15s;
|
|
529
|
+
white-space: nowrap;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
ne-block[data-block-type="image"]::before {
|
|
533
|
+
content: '';
|
|
534
|
+
position: absolute;
|
|
535
|
+
top: -50px;
|
|
536
|
+
left: 0;
|
|
537
|
+
right: 0;
|
|
538
|
+
height: 50px;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
ne-block[data-block-type="image"]:hover .ne-image-toolbar {
|
|
542
|
+
opacity: 1;
|
|
543
|
+
pointer-events: auto;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.ne-image-toolbar-btn {
|
|
547
|
+
display: flex;
|
|
548
|
+
align-items: center;
|
|
549
|
+
justify-content: center;
|
|
550
|
+
gap: 4px;
|
|
551
|
+
padding: 4px 8px;
|
|
552
|
+
border: none;
|
|
553
|
+
background: transparent;
|
|
554
|
+
border-radius: 4px;
|
|
555
|
+
font-size: 13px;
|
|
556
|
+
color: #37352f;
|
|
557
|
+
cursor: pointer;
|
|
558
|
+
white-space: nowrap;
|
|
559
|
+
min-width: 28px;
|
|
560
|
+
height: 26px;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.ne-image-toolbar-btn:hover {
|
|
564
|
+
background: rgba(55, 53, 47, 0.08);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.ne-image-toolbar-btn.active {
|
|
568
|
+
background: rgba(35, 131, 226, 0.12);
|
|
569
|
+
color: #2383e2;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.ne-image-toolbar-sep {
|
|
573
|
+
width: 1px;
|
|
574
|
+
height: 20px;
|
|
575
|
+
background: #e5e7eb;
|
|
576
|
+
margin: 0 2px;
|
|
577
|
+
flex-shrink: 0;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.ne-image-toolbar-width {
|
|
581
|
+
display: flex;
|
|
582
|
+
align-items: center;
|
|
583
|
+
gap: 2px;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.ne-image-width-label {
|
|
587
|
+
font-size: 12px;
|
|
588
|
+
color: #37352f;
|
|
589
|
+
min-width: 32px;
|
|
590
|
+
text-align: center;
|
|
591
|
+
user-select: none;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/* Legacy inline ne-image (deprecated, kept for backward compat) */
|
|
595
|
+
ne-image {
|
|
596
|
+
display: inline-flex;
|
|
597
|
+
position: relative;
|
|
598
|
+
vertical-align: top;
|
|
599
|
+
width: var(--ne-image-width-percent, 40%);
|
|
600
|
+
max-width: 100%;
|
|
601
|
+
max-height: var(--ne-image-height-percent, 100%);
|
|
602
|
+
margin: 4px 6px;
|
|
603
|
+
line-height: 0;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
ne-image img {
|
|
607
|
+
display: block;
|
|
608
|
+
width: 100%;
|
|
609
|
+
height: auto;
|
|
610
|
+
aspect-ratio: var(--ne-image-aspect-ratio, auto);
|
|
611
|
+
object-fit: cover;
|
|
612
|
+
border-radius: 4px;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
ne-image .ne-image-placeholder {
|
|
616
|
+
position: absolute;
|
|
617
|
+
opacity: 0;
|
|
618
|
+
pointer-events: none;
|
|
619
|
+
font-size: 0;
|
|
620
|
+
}
|
|
621
|
+
|
|
388
622
|
.ne-root *::selection {
|
|
389
623
|
background: transparent;
|
|
390
624
|
}
|
|
@@ -563,14 +797,13 @@ ne-cursor {
|
|
|
563
797
|
.ne-color-popover {
|
|
564
798
|
position: absolute;
|
|
565
799
|
top: calc(100% + 6px);
|
|
566
|
-
|
|
800
|
+
left: -185px;
|
|
567
801
|
z-index: 200;
|
|
568
802
|
background: #fff;
|
|
569
803
|
border: 1px solid #e5e7eb;
|
|
570
804
|
border-radius: 8px;
|
|
571
805
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
572
806
|
padding: 8px;
|
|
573
|
-
width: 220px;
|
|
574
807
|
}
|
|
575
808
|
|
|
576
809
|
.ne-color-section {
|
package/package.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bbang-react-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "BbangEditor - 轻量 React 块编辑器组件",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"bbang",
|
|
8
|
+
"bbangeditor",
|
|
9
|
+
"react",
|
|
10
|
+
"editor",
|
|
11
|
+
"markdown",
|
|
12
|
+
"block-editor",
|
|
13
|
+
"rich-text-editor"
|
|
14
|
+
],
|
|
5
15
|
"main": "./dist/index.js",
|
|
6
16
|
"module": "./dist/index.mjs",
|
|
7
17
|
"types": "./dist/index.d.ts",
|