@firestitch/block-editor 12.3.4 → 12.3.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/app/components/block/block.component.d.ts +4 -3
- package/bundles/firestitch-block-editor.umd.js +12 -9
- package/bundles/firestitch-block-editor.umd.js.map +1 -1
- package/esm2015/app/components/block/block.component.js +14 -11
- package/fesm2015/firestitch-block-editor.js +12 -9
- package/fesm2015/firestitch-block-editor.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AfterContentInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { FsZoomPanComponent } from '@firestitch/zoom-pan';
|
|
3
3
|
import Moveable from 'moveable';
|
|
4
|
-
import { BlockEditorService } from './../../services';
|
|
4
|
+
import { BlockEditorService, GoogleFontService } from './../../services';
|
|
5
5
|
import { Block } from './../../interfaces';
|
|
6
6
|
import { BlockType } from '../../enums';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
@@ -9,6 +9,7 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
9
9
|
private _blockEditor;
|
|
10
10
|
private _elementRef;
|
|
11
11
|
private _cdRef;
|
|
12
|
+
private _googleFontService;
|
|
12
13
|
element: ElementRef;
|
|
13
14
|
contentElement: ElementRef;
|
|
14
15
|
contentEditable: ElementRef;
|
|
@@ -17,13 +18,12 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
17
18
|
zoompan: FsZoomPanComponent;
|
|
18
19
|
transformating: boolean;
|
|
19
20
|
unit: any;
|
|
20
|
-
content: string;
|
|
21
21
|
BlockType: typeof BlockType;
|
|
22
22
|
private _moveable;
|
|
23
23
|
private _editable;
|
|
24
24
|
private _transformable;
|
|
25
25
|
private _destroy$;
|
|
26
|
-
constructor(_blockEditor: BlockEditorService, _elementRef: ElementRef, _cdRef: ChangeDetectorRef);
|
|
26
|
+
constructor(_blockEditor: BlockEditorService, _elementRef: ElementRef, _cdRef: ChangeDetectorRef, _googleFontService: GoogleFontService);
|
|
27
27
|
get el(): any;
|
|
28
28
|
get moveable(): Moveable;
|
|
29
29
|
get editable(): any;
|
|
@@ -63,6 +63,7 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
63
63
|
private _updateElementGuidelines;
|
|
64
64
|
private _initMoveable;
|
|
65
65
|
private _initEvents;
|
|
66
|
+
private _initFonts;
|
|
66
67
|
static ɵfac: i0.ɵɵFactoryDeclaration<FsBlockComponent, never>;
|
|
67
68
|
static ɵcmp: i0.ɵɵComponentDeclaration<FsBlockComponent, "fs-block", never, { "block": "block"; "html": "html"; "zoompan": "zoompan"; }, {}, never, never>;
|
|
68
69
|
}
|
|
@@ -910,10 +910,11 @@
|
|
|
910
910
|
}], ctorParameters: function () { return [{ type: i1__namespace$1.HttpClient }]; } });
|
|
911
911
|
|
|
912
912
|
var FsBlockComponent = /** @class */ (function () {
|
|
913
|
-
function FsBlockComponent(_blockEditor, _elementRef, _cdRef) {
|
|
913
|
+
function FsBlockComponent(_blockEditor, _elementRef, _cdRef, _googleFontService) {
|
|
914
914
|
this._blockEditor = _blockEditor;
|
|
915
915
|
this._elementRef = _elementRef;
|
|
916
916
|
this._cdRef = _cdRef;
|
|
917
|
+
this._googleFontService = _googleFontService;
|
|
917
918
|
this.transformating = false;
|
|
918
919
|
this.BlockType = exports.BlockType;
|
|
919
920
|
this._editable = false;
|
|
@@ -1130,8 +1131,8 @@
|
|
|
1130
1131
|
FsBlockComponent.prototype.ngOnInit = function () {
|
|
1131
1132
|
var _this = this;
|
|
1132
1133
|
this.unit = this._blockEditor.config.unit;
|
|
1133
|
-
this.content = this.block.content;
|
|
1134
1134
|
this.block.shadowOpacity = this.block.shadowOpacity || 100;
|
|
1135
|
+
this._initFonts();
|
|
1135
1136
|
this._blockEditor.blockClippable$
|
|
1136
1137
|
.pipe(operators.filter(function () { return _this.isSelected; }), operators.takeUntil(this._destroy$))
|
|
1137
1138
|
.subscribe(function (clippable) {
|
|
@@ -1204,9 +1205,6 @@
|
|
|
1204
1205
|
FsBlockComponent.prototype._setTransform = function (transforms) {
|
|
1205
1206
|
if (transforms === void 0) { transforms = []; }
|
|
1206
1207
|
transforms = transforms !== null && transforms !== void 0 ? transforms : [];
|
|
1207
|
-
if (this.block.rotate) {
|
|
1208
|
-
transforms.push("rotate(" + this.block.rotate + "deg)");
|
|
1209
|
-
}
|
|
1210
1208
|
this.el.style.transform = transforms.join(' ');
|
|
1211
1209
|
};
|
|
1212
1210
|
FsBlockComponent.prototype._triggerChanged = function () {
|
|
@@ -1354,7 +1352,7 @@
|
|
|
1354
1352
|
var _this = this;
|
|
1355
1353
|
rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
|
|
1356
1354
|
.pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
|
|
1357
|
-
_this.block.content = event.target.
|
|
1355
|
+
_this.block.content = event.target.innerText;
|
|
1358
1356
|
_this._triggerChanged();
|
|
1359
1357
|
});
|
|
1360
1358
|
rxjs.fromEvent(this.el, 'mousedown')
|
|
@@ -1392,10 +1390,15 @@
|
|
|
1392
1390
|
}
|
|
1393
1391
|
});
|
|
1394
1392
|
};
|
|
1393
|
+
FsBlockComponent.prototype._initFonts = function () {
|
|
1394
|
+
if (this.block.fontFamily) {
|
|
1395
|
+
this._googleFontService.loadFont({ family: this.block.fontFamily });
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1395
1398
|
return FsBlockComponent;
|
|
1396
1399
|
}());
|
|
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 });
|
|
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 });
|
|
1400
|
+
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 }, { token: GoogleFontService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1401
|
+
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]=\"block.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 });
|
|
1399
1402
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
|
|
1400
1403
|
type: i0.Component,
|
|
1401
1404
|
args: [{
|
|
@@ -1404,7 +1407,7 @@
|
|
|
1404
1407
|
styleUrls: ['block.component.scss'],
|
|
1405
1408
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1406
1409
|
}]
|
|
1407
|
-
}], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { element: [{
|
|
1410
|
+
}], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: GoogleFontService }]; }, propDecorators: { element: [{
|
|
1408
1411
|
type: i0.ViewChild,
|
|
1409
1412
|
args: ['element', { static: true }]
|
|
1410
1413
|
}], contentElement: [{
|