editorjs-image 1.0.10 → 1.0.12
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/package.json +1 -1
- package/src/index.css +22 -5
- package/src/index.js +29 -24
package/package.json
CHANGED
package/src/index.css
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
.cdx-image-tool-tune--sizeSmall .image-tool__caption { max-height: 200px; }
|
|
43
43
|
.cdx-image-tool-tune--sizeSmall img {
|
|
44
44
|
max-height: 200px !important;
|
|
45
45
|
object-fit:cover;
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
max-width: 25% !important;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
.cdx-image-tool-tune--sizeMiddle .image-tool__caption { max-height: 300px; }
|
|
52
53
|
.cdx-image-tool-tune--sizeMiddle img {
|
|
53
54
|
max-height: 300px !important;
|
|
54
55
|
object-fit:cover;
|
|
@@ -56,7 +57,8 @@
|
|
|
56
57
|
.cdx-image-tool-tune--sizeMiddle .cdx-block {
|
|
57
58
|
max-width: 50% !important;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
|
|
61
|
+
.cdx-image-tool-tune--sizeLarge .image-tool__caption { max-height: 400px; }
|
|
60
62
|
.cdx-image-tool-tune--sizeLarge img {
|
|
61
63
|
max-height: 400px !important;
|
|
62
64
|
object-fit:cover;
|
|
@@ -65,6 +67,22 @@
|
|
|
65
67
|
max-width: 75% !important;
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
.cdx-image-tool-tune--sizeLarge img,
|
|
71
|
+
.cdx-image-tool-tune--sizeMiddle img,
|
|
72
|
+
.cdx-image-tool-tune--sizeSmall img,
|
|
73
|
+
.cdx-image-tool-tune--floatLeft img,
|
|
74
|
+
.cdx-image-tool-tune--floatRight img
|
|
75
|
+
{ max-height:500px; }
|
|
76
|
+
|
|
77
|
+
.cdx-image-tool-tune--sizeLarge .image-tool__caption,
|
|
78
|
+
.cdx-image-tool-tune--sizeMiddle .image-tool__caption,
|
|
79
|
+
.cdx-image-tool-tune--sizeSmall .image-tool__caption,
|
|
80
|
+
.cdx-image-tool-tune--floatLeft .image-tool__caption,
|
|
81
|
+
.cdx-image-tool-tune--floatRight .image-tool__caption
|
|
82
|
+
{
|
|
83
|
+
max-height:500px;
|
|
84
|
+
}
|
|
85
|
+
|
|
68
86
|
.codex-editor.read-only .cdx-input.image-tool__caption:empty,
|
|
69
87
|
.read-only > .codex-editor .cdx-input.image-tool__caption:empty
|
|
70
88
|
{
|
|
@@ -139,10 +157,9 @@
|
|
|
139
157
|
.cdx-image-tool-tune--crop .image-tool__image .crop-save {
|
|
140
158
|
position: absolute;
|
|
141
159
|
top: 0;
|
|
142
|
-
|
|
143
|
-
padding:
|
|
160
|
+
left: 0;
|
|
161
|
+
padding: 7px;
|
|
144
162
|
background: #4286f4;
|
|
145
|
-
border-radius: 5px;
|
|
146
163
|
color: white;
|
|
147
164
|
text-align: center;
|
|
148
165
|
line-height: 20px;
|
package/src/index.js
CHANGED
|
@@ -271,9 +271,6 @@ export class ImageToolTune {
|
|
|
271
271
|
this.apply( blockContent );
|
|
272
272
|
|
|
273
273
|
this.block.dispatchChange();
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
274
|
}
|
|
278
275
|
|
|
279
276
|
|
|
@@ -512,7 +509,8 @@ export class ImageToolTune {
|
|
|
512
509
|
|
|
513
510
|
//remove isCropped class
|
|
514
511
|
|
|
515
|
-
blockContent.getElementsByClassName( 'cdx-block' )[ 0 ]
|
|
512
|
+
var img = blockContent.getElementsByClassName( 'cdx-block' )[ 0 ]?.getElementsByTagName( 'img' )[ 0 ] || undefined;
|
|
513
|
+
if(img) img.classList.remove( 'isCropped' );
|
|
516
514
|
|
|
517
515
|
//remove isCropping class
|
|
518
516
|
blockContent.getElementsByClassName( 'cdx-block' )[ 0 ].classList.remove( 'isCropping' );
|
|
@@ -522,38 +520,42 @@ export class ImageToolTune {
|
|
|
522
520
|
blockContent.getElementsByClassName( 'cdx-block' )[ 0 ].style.maxWidth = '';
|
|
523
521
|
|
|
524
522
|
//remove image width and height
|
|
525
|
-
blockContent.getElementsByClassName( 'image-tool__image' )[ 0 ]
|
|
526
|
-
|
|
523
|
+
var imgBlockEl = blockContent.getElementsByClassName( 'image-tool__image' )[ 0 ];
|
|
524
|
+
if (imgBlockEl) {
|
|
525
|
+
imgBlockEl.style.width = '';
|
|
526
|
+
imgBlockEl.style.height = '';
|
|
527
|
+
}
|
|
527
528
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
blockContent.getElementsByClassName( 'image-tool__image' )[ 0 ].getElementsByTagName( 'img' )[ 0 ].style.top = '';
|
|
529
|
+
var imgEl = imgBlockEl?.getElementsByTagName( 'img' )[ 0 ] || undefined;
|
|
530
|
+
if(imgEl) {
|
|
531
531
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
532
|
+
//remove image left and top
|
|
533
|
+
imgEl.style.left = '';
|
|
534
|
+
imgEl.style.top = '';
|
|
535
535
|
|
|
536
|
+
//remove image width and height
|
|
537
|
+
imgEl.style.width = '';
|
|
538
|
+
imgEl.style.height = '';
|
|
539
|
+
}
|
|
536
540
|
|
|
537
541
|
|
|
538
542
|
blockContent.classList.remove( 'isCropping' );
|
|
539
543
|
|
|
540
|
-
|
|
541
|
-
|
|
542
544
|
//remove cropper interface
|
|
545
|
+
|
|
543
546
|
if ( this.cropperInterface ) {
|
|
544
547
|
this.cropperInterface.destroy();
|
|
545
|
-
}
|
|
546
548
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
this.block.dispatchChange();
|
|
549
|
+
//remove crop data
|
|
550
|
+
this.data.cropperFrameHeight = 0;
|
|
551
|
+
this.data.cropperFrameWidth = 0;
|
|
552
|
+
this.data.cropperFrameLeft = 0;
|
|
553
|
+
this.data.cropperFrameTop = 0;
|
|
554
|
+
this.data.cropperImageHeight = 0;
|
|
555
|
+
this.data.cropperImageWidth = 0;
|
|
556
556
|
|
|
557
|
+
this.block.dispatchChange();
|
|
558
|
+
}
|
|
557
559
|
}
|
|
558
560
|
|
|
559
561
|
|
|
@@ -708,6 +710,8 @@ export class ImageToolTune {
|
|
|
708
710
|
button.classList.remove( this.CSS.buttonActive );
|
|
709
711
|
} );
|
|
710
712
|
|
|
713
|
+
blockContent.classList.remove( this.CSS.wrapper );
|
|
714
|
+
|
|
711
715
|
//remove isFloatLeft class
|
|
712
716
|
blockContent.classList.remove( this.CSS.isFloatLeft );
|
|
713
717
|
|
|
@@ -802,6 +806,7 @@ export class ImageToolTune {
|
|
|
802
806
|
this.wrapper = this.createView();
|
|
803
807
|
}
|
|
804
808
|
|
|
809
|
+
blockContent.classList.add( this.CSS.wrapper );
|
|
805
810
|
|
|
806
811
|
this.apply( blockContent );
|
|
807
812
|
|