@firestitch/block-editor 12.3.4 → 12.3.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.
@@ -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,13 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
17
18
  zoompan: FsZoomPanComponent;
18
19
  transformating: boolean;
19
20
  unit: any;
20
- content: string;
21
+ content: any;
21
22
  BlockType: typeof BlockType;
22
23
  private _moveable;
23
24
  private _editable;
24
25
  private _transformable;
25
26
  private _destroy$;
26
- constructor(_blockEditor: BlockEditorService, _elementRef: ElementRef, _cdRef: ChangeDetectorRef);
27
+ constructor(_blockEditor: BlockEditorService, _elementRef: ElementRef, _cdRef: ChangeDetectorRef, _googleFontService: GoogleFontService);
27
28
  get el(): any;
28
29
  get moveable(): Moveable;
29
30
  get editable(): any;
@@ -63,6 +64,7 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
63
64
  private _updateElementGuidelines;
64
65
  private _initMoveable;
65
66
  private _initEvents;
67
+ private _initFonts;
66
68
  static ɵfac: i0.ɵɵFactoryDeclaration<FsBlockComponent, never>;
67
69
  static ɵcmp: i0.ɵɵComponentDeclaration<FsBlockComponent, "fs-block", never, { "block": "block"; "html": "html"; "zoompan": "zoompan"; }, {}, never, never>;
68
70
  }
@@ -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;
@@ -1132,6 +1133,7 @@
1132
1133
  this.unit = this._blockEditor.config.unit;
1133
1134
  this.content = this.block.content;
1134
1135
  this.block.shadowOpacity = this.block.shadowOpacity || 100;
1136
+ this._initFonts();
1135
1137
  this._blockEditor.blockClippable$
1136
1138
  .pipe(operators.filter(function () { return _this.isSelected; }), operators.takeUntil(this._destroy$))
1137
1139
  .subscribe(function (clippable) {
@@ -1204,9 +1206,6 @@
1204
1206
  FsBlockComponent.prototype._setTransform = function (transforms) {
1205
1207
  if (transforms === void 0) { transforms = []; }
1206
1208
  transforms = transforms !== null && transforms !== void 0 ? transforms : [];
1207
- if (this.block.rotate) {
1208
- transforms.push("rotate(" + this.block.rotate + "deg)");
1209
- }
1210
1209
  this.el.style.transform = transforms.join(' ');
1211
1210
  };
1212
1211
  FsBlockComponent.prototype._triggerChanged = function () {
@@ -1352,9 +1351,15 @@
1352
1351
  };
1353
1352
  FsBlockComponent.prototype._initEvents = function () {
1354
1353
  var _this = this;
1354
+ rxjs.fromEvent(this.contentEditable.nativeElement, 'paste')
1355
+ .pipe(operators.delay(100), operators.takeUntil(this._destroy$)).subscribe(function (event) {
1356
+ _this.content = _this.block.content;
1357
+ //this.block.content = event.target.innerText;
1358
+ _this._triggerChanged();
1359
+ });
1355
1360
  rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
1356
1361
  .pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
1357
- _this.block.content = event.target.innerHTML;
1362
+ _this.block.content = event.target.innerText;
1358
1363
  _this._triggerChanged();
1359
1364
  });
1360
1365
  rxjs.fromEvent(this.el, 'mousedown')
@@ -1392,9 +1397,14 @@
1392
1397
  }
1393
1398
  });
1394
1399
  };
1400
+ FsBlockComponent.prototype._initFonts = function () {
1401
+ if (this.block.fontFamily) {
1402
+ this._googleFontService.loadFont({ family: this.block.fontFamily });
1403
+ }
1404
+ };
1395
1405
  return FsBlockComponent;
1396
1406
  }());
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 });
1407
+ 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 });
1398
1408
  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 });
1399
1409
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
1400
1410
  type: i0.Component,
@@ -1404,7 +1414,7 @@
1404
1414
  styleUrls: ['block.component.scss'],
1405
1415
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1406
1416
  }]
1407
- }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { element: [{
1417
+ }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: GoogleFontService }]; }, propDecorators: { element: [{
1408
1418
  type: i0.ViewChild,
1409
1419
  args: ['element', { static: true }]
1410
1420
  }], contentElement: [{