@firestitch/block-editor 12.3.3 → 12.3.4
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/app/components/block/block.component.d.ts +14 -6
- package/app/interfaces/block.d.ts +4 -1
- package/app/services/block-editor.service.d.ts +4 -1
- package/bundles/firestitch-block-editor.umd.js +184 -65
- package/bundles/firestitch-block-editor.umd.js.map +1 -1
- package/esm2015/app/components/artboard/artboard.component.js +5 -5
- package/esm2015/app/components/block/block.component.js +127 -46
- package/esm2015/app/components/sidebar/sidebar.component.js +2 -2
- package/esm2015/app/interfaces/block.js +1 -1
- package/esm2015/app/services/block-editor.service.js +9 -3
- package/esm2015/app/services/blocks-store.service.js +1 -1
- package/fesm2015/firestitch-block-editor.js +139 -52
- package/fesm2015/firestitch-block-editor.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,16 +27,23 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
27
27
|
get el(): any;
|
|
28
28
|
get moveable(): Moveable;
|
|
29
29
|
get editable(): any;
|
|
30
|
-
get
|
|
30
|
+
get styleTop(): string;
|
|
31
|
+
get styleLeft(): string;
|
|
32
|
+
get styleWidth(): string;
|
|
33
|
+
get styleHeight(): string;
|
|
34
|
+
get styleImageHeight(): string;
|
|
35
|
+
get styleImageWidth(): string;
|
|
36
|
+
get styleImageTop(): string;
|
|
37
|
+
get styleImageLeft(): string;
|
|
38
|
+
get styleClipPath(): string;
|
|
39
|
+
get styleBoxShadow(): string;
|
|
31
40
|
set elementGuidelines(value: any);
|
|
32
41
|
set editable(value: any);
|
|
33
|
-
|
|
42
|
+
get isSelected(): boolean;
|
|
43
|
+
get clippable(): boolean;
|
|
44
|
+
set clippable(value: boolean);
|
|
34
45
|
get transformable(): boolean;
|
|
35
46
|
set transformable(value: boolean);
|
|
36
|
-
set width(value: any);
|
|
37
|
-
set height(value: any);
|
|
38
|
-
set top(value: any);
|
|
39
|
-
set left(value: any);
|
|
40
47
|
set rotate(value: any);
|
|
41
48
|
set index(value: any);
|
|
42
49
|
set keepRatio(value: any);
|
|
@@ -45,6 +52,7 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
45
52
|
ngAfterContentInit(): void;
|
|
46
53
|
pxToIn(px: any): number;
|
|
47
54
|
round(value: any, decimals: any): number;
|
|
55
|
+
select(): void;
|
|
48
56
|
deselect(): void;
|
|
49
57
|
disableContentEdit(): void;
|
|
50
58
|
deselectContent(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnDestroy } from '@angular/core';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
2
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
3
|
import { FsFile } from '@firestitch/file';
|
|
4
4
|
import { FsDialog } from '@firestitch/dialog';
|
|
5
5
|
import { BlocksStore } from './blocks-store.service';
|
|
@@ -16,6 +16,7 @@ export declare class BlockEditorService implements OnDestroy {
|
|
|
16
16
|
private _selectedBlocks$;
|
|
17
17
|
private _selectionRange;
|
|
18
18
|
private _blockComponents;
|
|
19
|
+
private _blockClippable$;
|
|
19
20
|
private _destroy$;
|
|
20
21
|
private _blockInited$;
|
|
21
22
|
constructor(_store: BlocksStore, _dialog: FsDialog);
|
|
@@ -28,6 +29,8 @@ export declare class BlockEditorService implements OnDestroy {
|
|
|
28
29
|
removeSelectedBlocks(): void;
|
|
29
30
|
get blocks$(): Observable<Block[]>;
|
|
30
31
|
get blockChanged$(): Observable<Block>;
|
|
32
|
+
get blockClippable$(): BehaviorSubject<boolean>;
|
|
33
|
+
set blockClippable(value: any);
|
|
31
34
|
get blockAdded$(): Observable<Block>;
|
|
32
35
|
get blockInited$(): Observable<Block>;
|
|
33
36
|
get blockRemoved$(): Observable<Block>;
|
|
@@ -662,6 +662,7 @@
|
|
|
662
662
|
this._dialog = _dialog;
|
|
663
663
|
this._selectedBlocks$ = new rxjs.BehaviorSubject([]);
|
|
664
664
|
this._blockComponents = new Map();
|
|
665
|
+
this._blockClippable$ = new rxjs.BehaviorSubject(null);
|
|
665
666
|
this._destroy$ = new rxjs.Subject();
|
|
666
667
|
this._blockInited$ = new rxjs.Subject();
|
|
667
668
|
}
|
|
@@ -718,6 +719,20 @@
|
|
|
718
719
|
enumerable: false,
|
|
719
720
|
configurable: true
|
|
720
721
|
});
|
|
722
|
+
Object.defineProperty(BlockEditorService.prototype, "blockClippable$", {
|
|
723
|
+
get: function () {
|
|
724
|
+
return this._blockClippable$;
|
|
725
|
+
},
|
|
726
|
+
enumerable: false,
|
|
727
|
+
configurable: true
|
|
728
|
+
});
|
|
729
|
+
Object.defineProperty(BlockEditorService.prototype, "blockClippable", {
|
|
730
|
+
set: function (value) {
|
|
731
|
+
this._blockClippable$.next(value);
|
|
732
|
+
},
|
|
733
|
+
enumerable: false,
|
|
734
|
+
configurable: true
|
|
735
|
+
});
|
|
721
736
|
Object.defineProperty(BlockEditorService.prototype, "blockAdded$", {
|
|
722
737
|
get: function () {
|
|
723
738
|
return this._store.blockAdded$;
|
|
@@ -784,9 +799,8 @@
|
|
|
784
799
|
set: function (blocks) {
|
|
785
800
|
this.blockComponents
|
|
786
801
|
.forEach(function (blockComponent) {
|
|
787
|
-
blockComponent.editable = false;
|
|
788
802
|
if (blocks.indexOf(blockComponent.block) !== -1) {
|
|
789
|
-
blockComponent.
|
|
803
|
+
blockComponent.select();
|
|
790
804
|
}
|
|
791
805
|
else {
|
|
792
806
|
blockComponent.deselect();
|
|
@@ -933,75 +947,157 @@
|
|
|
933
947
|
enumerable: false,
|
|
934
948
|
configurable: true
|
|
935
949
|
});
|
|
936
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
950
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleTop", {
|
|
937
951
|
get: function () {
|
|
938
|
-
|
|
939
|
-
|
|
952
|
+
var top = this.block.top;
|
|
953
|
+
return "" + top + this.unit;
|
|
954
|
+
},
|
|
955
|
+
enumerable: false,
|
|
956
|
+
configurable: true
|
|
957
|
+
});
|
|
958
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleLeft", {
|
|
959
|
+
get: function () {
|
|
960
|
+
var left = this.block.left;
|
|
961
|
+
return "" + left + this.unit;
|
|
962
|
+
},
|
|
963
|
+
enumerable: false,
|
|
964
|
+
configurable: true
|
|
965
|
+
});
|
|
966
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleWidth", {
|
|
967
|
+
get: function () {
|
|
968
|
+
var width = this.block.width;
|
|
969
|
+
if (this.block.clipPath) {
|
|
970
|
+
width -= (this.block.width * this.block.clipPath.values[1] / 100) + (this.block.width * this.block.clipPath.values[3] / 100);
|
|
940
971
|
}
|
|
941
|
-
|
|
942
|
-
var shadow = this.block.shadowX + "pt " + (this.block.shadowY || 0) + "pt " + (this.block.shadowBlur || 0) + "pt " + (this.block.shadowSpread || 0) + "pt " + this.block.shadowColor;
|
|
943
|
-
return shadow;
|
|
972
|
+
return "" + width + this.unit;
|
|
944
973
|
},
|
|
945
974
|
enumerable: false,
|
|
946
975
|
configurable: true
|
|
947
976
|
});
|
|
948
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
949
|
-
|
|
950
|
-
this.
|
|
977
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleHeight", {
|
|
978
|
+
get: function () {
|
|
979
|
+
var height = this.block.height;
|
|
980
|
+
if (this.block.clipPath) {
|
|
981
|
+
height -= (this.block.height * this.block.clipPath.values[0] / 100) + (this.block.height * this.block.clipPath.values[2] / 100);
|
|
982
|
+
}
|
|
983
|
+
return "" + height + this.unit;
|
|
951
984
|
},
|
|
952
985
|
enumerable: false,
|
|
953
986
|
configurable: true
|
|
954
987
|
});
|
|
955
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
956
|
-
|
|
957
|
-
this.
|
|
988
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleImageHeight", {
|
|
989
|
+
get: function () {
|
|
990
|
+
var height = this.block.height;
|
|
991
|
+
if (this.block.clipPath) {
|
|
992
|
+
var values = this.block.clipPath.values || {};
|
|
993
|
+
//height += (values[0]/100 * height) + (values[2]/100 * height);
|
|
994
|
+
}
|
|
995
|
+
return "" + height + this.unit;
|
|
958
996
|
},
|
|
959
997
|
enumerable: false,
|
|
960
998
|
configurable: true
|
|
961
999
|
});
|
|
962
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
1000
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleImageWidth", {
|
|
963
1001
|
get: function () {
|
|
964
|
-
|
|
1002
|
+
var width = this.block.width;
|
|
1003
|
+
if (this.block.clipPath) {
|
|
1004
|
+
var values = this.block.clipPath.values || {};
|
|
1005
|
+
//width += (values[1]/100 * width) + (values[3]/100 * width);
|
|
1006
|
+
}
|
|
1007
|
+
return "" + width + this.unit;
|
|
965
1008
|
},
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1009
|
+
enumerable: false,
|
|
1010
|
+
configurable: true
|
|
1011
|
+
});
|
|
1012
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleImageTop", {
|
|
1013
|
+
get: function () {
|
|
1014
|
+
var top = 0;
|
|
1015
|
+
if (this.block.clipPath) {
|
|
1016
|
+
var values = this.block.clipPath.values || {};
|
|
1017
|
+
top = (values[0] / 100) * this.block.width * -1;
|
|
1018
|
+
}
|
|
1019
|
+
return "" + top + this.unit;
|
|
971
1020
|
},
|
|
972
1021
|
enumerable: false,
|
|
973
1022
|
configurable: true
|
|
974
1023
|
});
|
|
975
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
this.
|
|
1024
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleImageLeft", {
|
|
1025
|
+
get: function () {
|
|
1026
|
+
var left = 0;
|
|
1027
|
+
if (this.block.clipPath) {
|
|
1028
|
+
var values = this.block.clipPath.values || {};
|
|
1029
|
+
left = (values[3] / 100) * this.block.width * -1;
|
|
1030
|
+
}
|
|
1031
|
+
return "" + left + this.unit;
|
|
1032
|
+
},
|
|
1033
|
+
enumerable: false,
|
|
1034
|
+
configurable: true
|
|
1035
|
+
});
|
|
1036
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleClipPath", {
|
|
1037
|
+
get: function () {
|
|
1038
|
+
if (!this.block.clipPath) {
|
|
1039
|
+
return null;
|
|
1040
|
+
}
|
|
1041
|
+
var values = this.block.clipPath.values || {};
|
|
1042
|
+
var top = values[0] / 100 * this.block.height;
|
|
1043
|
+
var right = (values[1]) / 100 * this.block.width;
|
|
1044
|
+
var bottom = (values[2]) / 100 * this.block.height;
|
|
1045
|
+
var left = values[3] / 100 * this.block.width;
|
|
1046
|
+
var clipPath = "inset(" + top + this.unit + " " + right + this.unit + " " + bottom + this.unit + " " + left + this.unit + ")";
|
|
1047
|
+
return clipPath;
|
|
1048
|
+
},
|
|
1049
|
+
enumerable: false,
|
|
1050
|
+
configurable: true
|
|
1051
|
+
});
|
|
1052
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleBoxShadow", {
|
|
1053
|
+
get: function () {
|
|
1054
|
+
if (!this.block.shadowColor) {
|
|
1055
|
+
return null;
|
|
1056
|
+
}
|
|
1057
|
+
var shadow = this.block.shadowX + "pt " + (this.block.shadowY || 0) + "pt " + (this.block.shadowBlur || 0) + "pt " + (this.block.shadowSpread || 0) + "pt " + this.block.shadowColor;
|
|
1058
|
+
return shadow;
|
|
979
1059
|
},
|
|
980
1060
|
enumerable: false,
|
|
981
1061
|
configurable: true
|
|
982
1062
|
});
|
|
983
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
1063
|
+
Object.defineProperty(FsBlockComponent.prototype, "elementGuidelines", {
|
|
984
1064
|
set: function (value) {
|
|
985
|
-
this.
|
|
986
|
-
this.moveable.updateRect();
|
|
1065
|
+
this.moveable.elementGuidelines = value;
|
|
987
1066
|
},
|
|
988
1067
|
enumerable: false,
|
|
989
1068
|
configurable: true
|
|
990
1069
|
});
|
|
991
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
1070
|
+
Object.defineProperty(FsBlockComponent.prototype, "isSelected", {
|
|
1071
|
+
get: function () {
|
|
1072
|
+
return this._blockEditor.selectedBlocks.includes(this.block);
|
|
1073
|
+
},
|
|
1074
|
+
enumerable: false,
|
|
1075
|
+
configurable: true
|
|
1076
|
+
});
|
|
1077
|
+
Object.defineProperty(FsBlockComponent.prototype, "clippable", {
|
|
1078
|
+
get: function () {
|
|
1079
|
+
return !!this.moveable.clippable;
|
|
1080
|
+
},
|
|
992
1081
|
set: function (value) {
|
|
993
|
-
this.
|
|
994
|
-
|
|
995
|
-
|
|
1082
|
+
this.moveable.clippable = value;
|
|
1083
|
+
if (this.isSelected) {
|
|
1084
|
+
this.moveable.resizable = !value;
|
|
1085
|
+
this.moveable.rotatable = !value;
|
|
1086
|
+
this.moveable.scalable = !value;
|
|
1087
|
+
}
|
|
996
1088
|
},
|
|
997
1089
|
enumerable: false,
|
|
998
1090
|
configurable: true
|
|
999
1091
|
});
|
|
1000
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
1092
|
+
Object.defineProperty(FsBlockComponent.prototype, "transformable", {
|
|
1093
|
+
get: function () {
|
|
1094
|
+
return this._transformable;
|
|
1095
|
+
},
|
|
1001
1096
|
set: function (value) {
|
|
1002
|
-
this.
|
|
1003
|
-
this.
|
|
1004
|
-
this.moveable.
|
|
1097
|
+
this._transformable = value;
|
|
1098
|
+
this.moveable.resizable = value;
|
|
1099
|
+
this.moveable.rotatable = value;
|
|
1100
|
+
this.moveable.scalable = value;
|
|
1005
1101
|
},
|
|
1006
1102
|
enumerable: false,
|
|
1007
1103
|
configurable: true
|
|
@@ -1036,16 +1132,17 @@
|
|
|
1036
1132
|
this.unit = this._blockEditor.config.unit;
|
|
1037
1133
|
this.content = this.block.content;
|
|
1038
1134
|
this.block.shadowOpacity = this.block.shadowOpacity || 100;
|
|
1135
|
+
this._blockEditor.blockClippable$
|
|
1136
|
+
.pipe(operators.filter(function () { return _this.isSelected; }), operators.takeUntil(this._destroy$))
|
|
1137
|
+
.subscribe(function (clippable) {
|
|
1138
|
+
_this.clippable = clippable;
|
|
1139
|
+
_this._cdRef.markForCheck();
|
|
1140
|
+
});
|
|
1039
1141
|
this._blockEditor.blockChanged$
|
|
1040
1142
|
.pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
|
|
1041
1143
|
.subscribe(function (block) {
|
|
1042
1144
|
_this.keepRatio = block.keepRatio;
|
|
1043
|
-
_this.width = block.width;
|
|
1044
|
-
_this.height = block.height;
|
|
1045
|
-
_this.top = block.top;
|
|
1046
|
-
_this.left = block.left;
|
|
1047
1145
|
_this.rotate = _this.block.rotate;
|
|
1048
|
-
_this.clippable = _this.block.clippable;
|
|
1049
1146
|
_this._cdRef.markForCheck();
|
|
1050
1147
|
});
|
|
1051
1148
|
};
|
|
@@ -1055,10 +1152,6 @@
|
|
|
1055
1152
|
_this._initEvents();
|
|
1056
1153
|
_this._initMoveable();
|
|
1057
1154
|
_this._setTransform();
|
|
1058
|
-
_this.width = _this.block.width;
|
|
1059
|
-
_this.height = _this.block.height;
|
|
1060
|
-
_this.top = _this.block.top;
|
|
1061
|
-
_this.left = _this.block.left;
|
|
1062
1155
|
_this.rotate = _this.block.rotate;
|
|
1063
1156
|
_this._blockEditor.initBlock(_this.block, _this);
|
|
1064
1157
|
_this._blockEditor.blockInited$
|
|
@@ -1074,7 +1167,12 @@
|
|
|
1074
1167
|
FsBlockComponent.prototype.round = function (value, decimals) {
|
|
1075
1168
|
return parseFloat(value.toFixed(decimals));
|
|
1076
1169
|
};
|
|
1170
|
+
FsBlockComponent.prototype.select = function () {
|
|
1171
|
+
this.transformable = true;
|
|
1172
|
+
};
|
|
1077
1173
|
FsBlockComponent.prototype.deselect = function () {
|
|
1174
|
+
this.editable = false;
|
|
1175
|
+
this.clippable = false;
|
|
1078
1176
|
this.transformable = false;
|
|
1079
1177
|
this.disableContentEdit();
|
|
1080
1178
|
};
|
|
@@ -1131,6 +1229,8 @@
|
|
|
1131
1229
|
rotatable: false,
|
|
1132
1230
|
warpable: false,
|
|
1133
1231
|
origin: false,
|
|
1232
|
+
clipRelative: true,
|
|
1233
|
+
clipArea: true,
|
|
1134
1234
|
keepRatio: this.block.keepRatio,
|
|
1135
1235
|
snappable: true,
|
|
1136
1236
|
snapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
|
|
@@ -1145,9 +1245,24 @@
|
|
|
1145
1245
|
this._updateElementGuidelines();
|
|
1146
1246
|
this.moveable
|
|
1147
1247
|
.on('clip', function (e) {
|
|
1148
|
-
_this.
|
|
1248
|
+
_this.moveable.keepRatio = false;
|
|
1149
1249
|
e.target.style.clipPath = e.clipStyle;
|
|
1250
|
+
_this.block.clipPath = {
|
|
1251
|
+
type: 'inset',
|
|
1252
|
+
values: e.clipStyles
|
|
1253
|
+
.map(function (value) {
|
|
1254
|
+
var number = Number(value.replace('%', ''));
|
|
1255
|
+
return number > 0 ? number : 0;
|
|
1256
|
+
}),
|
|
1257
|
+
};
|
|
1258
|
+
})
|
|
1259
|
+
.on('clipEnd', function (e) {
|
|
1260
|
+
_this.moveable.keepRatio = true;
|
|
1261
|
+
e.target.style.clipPath = null;
|
|
1150
1262
|
_this._triggerChanged();
|
|
1263
|
+
setTimeout(function () {
|
|
1264
|
+
_this.moveable.updateRect();
|
|
1265
|
+
}, 100);
|
|
1151
1266
|
})
|
|
1152
1267
|
.on('dragStart', function () {
|
|
1153
1268
|
_this.disableContentEdit();
|
|
@@ -1160,10 +1275,10 @@
|
|
|
1160
1275
|
target.style.top = _this.pxToIn(top) + _this.unit;
|
|
1161
1276
|
_this.block.top = _this.pxToIn(top);
|
|
1162
1277
|
_this.block.left = _this.pxToIn(left);
|
|
1163
|
-
_this._triggerChanged();
|
|
1164
1278
|
})
|
|
1165
1279
|
.on('dragEnd', function () {
|
|
1166
1280
|
_this.transformating = false;
|
|
1281
|
+
_this._triggerChanged();
|
|
1167
1282
|
_this._cdRef.markForCheck();
|
|
1168
1283
|
})
|
|
1169
1284
|
.on('resizeStart', function () {
|
|
@@ -1192,20 +1307,22 @@
|
|
|
1192
1307
|
transform[0] = dist[0] * -1;
|
|
1193
1308
|
}
|
|
1194
1309
|
_this._setTransform(["translate(" + transform[0] + "px, " + transform[1] + "px)"]);
|
|
1195
|
-
_this._triggerChanged();
|
|
1196
1310
|
})
|
|
1197
1311
|
.on('resizeEnd', function (_a) {
|
|
1198
1312
|
var target = _a.target;
|
|
1199
1313
|
var matrix = new WebKitCSSMatrix(target.style.transform);
|
|
1200
1314
|
_this.block.top = parseFloat(target.style.top) + _this.pxToIn(matrix.m42);
|
|
1201
1315
|
_this.block.left = parseFloat(target.style.left) + _this.pxToIn(matrix.m41);
|
|
1202
|
-
target.style.top = _this.block.top + _this.unit;
|
|
1203
|
-
target.style.left = _this.block.left + _this.unit;
|
|
1204
1316
|
_this._setTransform();
|
|
1205
1317
|
_this._triggerChanged();
|
|
1206
1318
|
_this.zoompan.enable();
|
|
1207
1319
|
_this.transformating = false;
|
|
1208
1320
|
_this._cdRef.markForCheck();
|
|
1321
|
+
target.style.top = _this.block.top + "in";
|
|
1322
|
+
target.style.left = _this.block.left + "in";
|
|
1323
|
+
target.style.width = _this.block.width + "in";
|
|
1324
|
+
target.style.height = _this.block.height + "in";
|
|
1325
|
+
_this.moveable.updateRect();
|
|
1209
1326
|
})
|
|
1210
1327
|
.on('rotateStart', function (_a) {
|
|
1211
1328
|
var inputEvent = _a.inputEvent;
|
|
@@ -1221,7 +1338,6 @@
|
|
|
1221
1338
|
_this.el.style.transform = transform;
|
|
1222
1339
|
_this.block.rotate = rotation % 360;
|
|
1223
1340
|
if (inputEvent) {
|
|
1224
|
-
_this._triggerChanged();
|
|
1225
1341
|
_this.zoompan.enable();
|
|
1226
1342
|
}
|
|
1227
1343
|
})
|
|
@@ -1230,6 +1346,7 @@
|
|
|
1230
1346
|
if (inputEvent) {
|
|
1231
1347
|
_this.transformating = false;
|
|
1232
1348
|
_this._cdRef.markForCheck();
|
|
1349
|
+
_this._triggerChanged();
|
|
1233
1350
|
}
|
|
1234
1351
|
});
|
|
1235
1352
|
};
|
|
@@ -1243,15 +1360,17 @@
|
|
|
1243
1360
|
rxjs.fromEvent(this.el, 'mousedown')
|
|
1244
1361
|
.pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
|
|
1245
1362
|
_this.zoompan.disable();
|
|
1246
|
-
if (_this.
|
|
1247
|
-
if (_this.
|
|
1248
|
-
event.
|
|
1249
|
-
|
|
1250
|
-
|
|
1363
|
+
if (!_this.moveable.clippable) {
|
|
1364
|
+
if (_this.editable) {
|
|
1365
|
+
if (_this.contentElement.nativeElement.isSameNode(event.target)) {
|
|
1366
|
+
event.preventDefault();
|
|
1367
|
+
event.stopImmediatePropagation();
|
|
1368
|
+
event.stopPropagation();
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
else {
|
|
1372
|
+
_this._blockEditor.selectedBlock = _this.block;
|
|
1251
1373
|
}
|
|
1252
|
-
}
|
|
1253
|
-
else {
|
|
1254
|
-
_this._blockEditor.selectedBlock = _this.block;
|
|
1255
1374
|
}
|
|
1256
1375
|
});
|
|
1257
1376
|
rxjs.fromEvent(this.el, 'mouseup')
|
|
@@ -1276,7 +1395,7 @@
|
|
|
1276
1395
|
return FsBlockComponent;
|
|
1277
1396
|
}());
|
|
1278
1397
|
FsBlockComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1279
|
-
FsBlockComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { properties: { "class.transforming": "this.transformating" } }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'pt' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'pt' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'pt' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'pt' : ''\"\n [style.
|
|
1398
|
+
FsBlockComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { properties: { "class.transforming": "this.transformating" } }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [style.top]=\"styleTop\"\n [style.left]=\"styleLeft\"\n [style.width]=\"styleWidth\"\n [style.height]=\"styleHeight\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'pt' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'pt' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'pt' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'pt' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + 'pt' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + 'pt' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + 'pt' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + 'pt' : ''\"\n [style.boxShadow]=\"styleBoxShadow\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <img [src]=\"block.imageUrl\">\n </ng-container>\n <img \n *ngIf=\"block.imageUrl\" \n [style.clipPath]=\"styleClipPath\" \n [style.height]=\"styleImageHeight\" \n [style.width]=\"styleImageWidth\" \n [style.top]=\"styleImageTop\" \n [style.left]=\"styleImageLeft\" \n [src]=\"block.imageUrl\">\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none;cursor:pointer}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block.block-radiobutton{border-radius:50%}.block.required{background-color:#f7adaa}.block .content-editable{outline:none;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:0px solid transparent;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i13__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1280
1399
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
|
|
1281
1400
|
type: i0.Component,
|
|
1282
1401
|
args: [{
|
|
@@ -1478,7 +1597,7 @@
|
|
|
1478
1597
|
};
|
|
1479
1598
|
SidebarComponent.prototype.imageClip = function () {
|
|
1480
1599
|
this.clippable = !this.clippable;
|
|
1481
|
-
this._blockEditor.
|
|
1600
|
+
this._blockEditor.blockClippable = true;
|
|
1482
1601
|
};
|
|
1483
1602
|
SidebarComponent.prototype.blockChangeProperty = function (value, name) {
|
|
1484
1603
|
this._blockEditor.selectedBlockComponentChangeProperty(value, name);
|
|
@@ -1662,16 +1781,16 @@
|
|
|
1662
1781
|
.forEach(function (blockComponent) {
|
|
1663
1782
|
switch (event.key) {
|
|
1664
1783
|
case 'ArrowUp':
|
|
1665
|
-
blockComponent.top = blockComponent.block.top - inchPixel;
|
|
1784
|
+
blockComponent.block.top = blockComponent.block.top - inchPixel;
|
|
1666
1785
|
break;
|
|
1667
1786
|
case 'ArrowDown':
|
|
1668
|
-
blockComponent.top = blockComponent.block.top + inchPixel;
|
|
1787
|
+
blockComponent.block.top = blockComponent.block.top + inchPixel;
|
|
1669
1788
|
break;
|
|
1670
1789
|
case 'ArrowLeft':
|
|
1671
|
-
blockComponent.left = blockComponent.block.left - inchPixel;
|
|
1790
|
+
blockComponent.block.left = blockComponent.block.left - inchPixel;
|
|
1672
1791
|
break;
|
|
1673
1792
|
case 'ArrowRight':
|
|
1674
|
-
blockComponent.left = blockComponent.block.left + inchPixel;
|
|
1793
|
+
blockComponent.block.left = blockComponent.block.left + inchPixel;
|
|
1675
1794
|
break;
|
|
1676
1795
|
}
|
|
1677
1796
|
_this._blockEditor.blockChange(blockComponent.block);
|