@firestitch/block-editor 12.3.14 → 12.3.16
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-editor/block-editor.component.d.ts +3 -2
- package/app/components/sidebar/sidebar.component.d.ts +3 -3
- package/bundles/firestitch-block-editor.umd.js +35 -25
- package/bundles/firestitch-block-editor.umd.js.map +1 -1
- package/esm2015/app/components/block/block.component.js +2 -2
- package/esm2015/app/components/block-editor/block-editor.component.js +15 -6
- package/esm2015/app/components/sidebar/sidebar.component.js +7 -6
- package/fesm2015/firestitch-block-editor.js +31 -21
- package/fesm2015/firestitch-block-editor.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ElementRef, OnDestroy, OnInit, QueryList } from '@angular/core';
|
|
2
2
|
import { FsZoomPanComponent } from '@firestitch/zoom-pan';
|
|
3
|
+
import { FsBlockEditorSidebarPanelDirective } from './../../directives/block-editor-sidebar-panel.directive';
|
|
4
|
+
import { Block } from './../../interfaces/block';
|
|
3
5
|
import { BlockEditorConfig } from './../../interfaces/block-editor-config';
|
|
4
6
|
import { BlockEditorService } from './../../services/block-editor.service';
|
|
5
|
-
import { Block } from './../../interfaces/block';
|
|
6
|
-
import { FsBlockEditorSidebarPanelDirective } from './../../directives/block-editor-sidebar-panel.directive';
|
|
7
7
|
import { SidebarComponent } from './../sidebar/sidebar.component';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
9
|
export declare class FsBlockEditorComponent implements OnInit, OnDestroy {
|
|
@@ -21,6 +21,7 @@ export declare class FsBlockEditorComponent implements OnInit, OnDestroy {
|
|
|
21
21
|
get el(): any;
|
|
22
22
|
ngOnInit(): void;
|
|
23
23
|
zoomCenter(): void;
|
|
24
|
+
editorContainerKeyDown(event: KeyboardEvent): void;
|
|
24
25
|
editorContainerClick(event: any): void;
|
|
25
26
|
ngOnDestroy(): void;
|
|
26
27
|
static ɵfac: i0.ɵɵFactoryDeclaration<FsBlockEditorComponent, never>;
|
|
@@ -2,11 +2,11 @@ import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, QueryLi
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { FsFile } from '@firestitch/file';
|
|
4
4
|
import { FsPrompt } from '@firestitch/prompt';
|
|
5
|
-
import { BlockEditorConfig } from '../../interfaces/block-editor-config';
|
|
6
|
-
import { BlockEditorService, GoogleFontService } from '../../services';
|
|
7
|
-
import { Block } from '../../interfaces/block';
|
|
8
5
|
import { FsBlockEditorSidebarPanelDirective } from '../../directives/block-editor-sidebar-panel.directive';
|
|
9
6
|
import { BlockType } from '../../enums';
|
|
7
|
+
import { Block } from '../../interfaces/block';
|
|
8
|
+
import { BlockEditorConfig } from '../../interfaces/block-editor-config';
|
|
9
|
+
import { BlockEditorService, GoogleFontService } from '../../services';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
11
|
export declare class SidebarComponent implements OnInit, OnDestroy {
|
|
12
12
|
private _el;
|
|
@@ -1439,7 +1439,7 @@
|
|
|
1439
1439
|
return FsBlockComponent;
|
|
1440
1440
|
}());
|
|
1441
1441
|
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 });
|
|
1442
|
-
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 lock: block.lock,\n selected: selected\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 + '
|
|
1442
|
+
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 lock: block.lock,\n selected: selected\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 + 'in' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'in' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'in' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'in' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + '%' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + '%' : ''\"\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 *ngIf=\"block.imageUrl\">\n <img \n [style.opacity]=\"block.imageOpacity ? block.imageOpacity/100 : 1\"\n [src]=\"block.imageUrl\">\n </ng-container>\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 class=\"outline\"></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;box-sizing:border-box}.block.lock{border-color:#e4181886;border-style:dashed}.block.selected{border-color:#31a2ff95}.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;margin:-1px}.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}.block.selected .outline,.block:hover .outline{border:1px solid rgba(68,170,255,.7);position:absolute;top:0;left:0;bottom:0;right:0}: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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1443
1443
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
|
|
1444
1444
|
type: i0.Component,
|
|
1445
1445
|
args: [{
|
|
@@ -1488,6 +1488,28 @@
|
|
|
1488
1488
|
type: i0.Input
|
|
1489
1489
|
}] } });
|
|
1490
1490
|
|
|
1491
|
+
var FsBlockEditorMarginDirective = /** @class */ (function () {
|
|
1492
|
+
function FsBlockEditorMarginDirective(_elementRef) {
|
|
1493
|
+
this._elementRef = _elementRef;
|
|
1494
|
+
}
|
|
1495
|
+
Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
|
|
1496
|
+
get: function () {
|
|
1497
|
+
return this._elementRef.nativeElement;
|
|
1498
|
+
},
|
|
1499
|
+
enumerable: false,
|
|
1500
|
+
configurable: true
|
|
1501
|
+
});
|
|
1502
|
+
return FsBlockEditorMarginDirective;
|
|
1503
|
+
}());
|
|
1504
|
+
FsBlockEditorMarginDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1505
|
+
FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
|
|
1506
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
|
|
1507
|
+
type: i0.Directive,
|
|
1508
|
+
args: [{
|
|
1509
|
+
selector: '[fsBlockEditorMargin]'
|
|
1510
|
+
}]
|
|
1511
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
|
|
1512
|
+
|
|
1491
1513
|
var BlockFormats = [
|
|
1492
1514
|
{ value: BlockFormat.Number, name: 'Number', blockTypes: [exports.BlockType.ShortText, exports.BlockType.LongText] },
|
|
1493
1515
|
{ value: BlockFormat.Currency, name: 'Currency', blockTypes: [exports.BlockType.ShortText, exports.BlockType.LongText] },
|
|
@@ -1660,7 +1682,8 @@
|
|
|
1660
1682
|
};
|
|
1661
1683
|
SidebarComponent.prototype.blockRemoveClick = function () {
|
|
1662
1684
|
var _this = this;
|
|
1663
|
-
|
|
1685
|
+
var _a;
|
|
1686
|
+
if (this.config.blocksRemove && ((_a = this._blockEditor.selectedBlocks) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1664
1687
|
this._prompt.confirm({
|
|
1665
1688
|
title: 'Confirm',
|
|
1666
1689
|
template: 'Are you sure your would like to delete this block?',
|
|
@@ -1760,28 +1783,6 @@
|
|
|
1760
1783
|
type: i0.Output
|
|
1761
1784
|
}] } });
|
|
1762
1785
|
|
|
1763
|
-
var FsBlockEditorMarginDirective = /** @class */ (function () {
|
|
1764
|
-
function FsBlockEditorMarginDirective(_elementRef) {
|
|
1765
|
-
this._elementRef = _elementRef;
|
|
1766
|
-
}
|
|
1767
|
-
Object.defineProperty(FsBlockEditorMarginDirective.prototype, "element", {
|
|
1768
|
-
get: function () {
|
|
1769
|
-
return this._elementRef.nativeElement;
|
|
1770
|
-
},
|
|
1771
|
-
enumerable: false,
|
|
1772
|
-
configurable: true
|
|
1773
|
-
});
|
|
1774
|
-
return FsBlockEditorMarginDirective;
|
|
1775
|
-
}());
|
|
1776
|
-
FsBlockEditorMarginDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1777
|
-
FsBlockEditorMarginDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0__namespace });
|
|
1778
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorMarginDirective, decorators: [{
|
|
1779
|
-
type: i0.Directive,
|
|
1780
|
-
args: [{
|
|
1781
|
-
selector: '[fsBlockEditorMargin]'
|
|
1782
|
-
}]
|
|
1783
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
|
|
1784
|
-
|
|
1785
1786
|
var ArtboardComponent = /** @class */ (function () {
|
|
1786
1787
|
function ArtboardComponent(_el, _blockEditor, _cdRef) {
|
|
1787
1788
|
this._el = _el;
|
|
@@ -1913,6 +1914,12 @@
|
|
|
1913
1914
|
FsBlockEditorComponent.prototype.zoomCenter = function () {
|
|
1914
1915
|
this.zoompan.center(this.artboard.nativeElement, { vertical: false });
|
|
1915
1916
|
};
|
|
1917
|
+
FsBlockEditorComponent.prototype.editorContainerKeyDown = function (event) {
|
|
1918
|
+
if (event.key === 'Delete' || event.key === 'Backspace') {
|
|
1919
|
+
this.sidebar.blockRemoveClick();
|
|
1920
|
+
event.preventDefault();
|
|
1921
|
+
}
|
|
1922
|
+
};
|
|
1916
1923
|
FsBlockEditorComponent.prototype.editorContainerClick = function (event) {
|
|
1917
1924
|
if (event.target.classList.contains('deselectable') ||
|
|
1918
1925
|
event.target.classList.contains('fs-zoom-pan-container')) {
|
|
@@ -1927,7 +1934,7 @@
|
|
|
1927
1934
|
return FsBlockEditorComponent;
|
|
1928
1935
|
}());
|
|
1929
1936
|
FsBlockEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockEditorComponent, deps: [{ token: i0__namespace.ElementRef }, { token: BlockEditorService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1930
|
-
FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
|
|
1937
|
+
FsBlockEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, host: { listeners: { "document:keydown": "editorContainerKeyDown($event)" } }, providers: [
|
|
1931
1938
|
BlockEditorService,
|
|
1932
1939
|
BlocksStore,
|
|
1933
1940
|
], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "zoompan", first: true, predicate: i2$2.FsZoomPanComponent, descendants: true, static: true }, { propertyName: "artboardContainer", first: true, predicate: ["artboardContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "artboard", first: true, predicate: ArtboardComponent, descendants: true, read: i0.ElementRef }], ngImport: i0__namespace, template: "<div \n class=\"editor-container deselectable\"\n (mousedown)=\"editorContainerClick($event)\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n class=\"deselectable\"\n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n (zoomCenter)=\"zoomCenter()\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative;height:100%;background:#d8d8d8;overflow:hidden}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0}.editor-container .zoom-pan-container{flex:1}fs-zoom-pan{height:100%}\n"], components: [{ type: i2__namespace$2.FsZoomPanComponent, selector: "fs-zoom-pan", inputs: ["zoomMax", "zoomMin", "zoomDefault", "top", "left"], outputs: ["moved", "zoomed"] }, { type: ArtboardComponent, selector: "app-artboard", inputs: ["config", "zoompan"] }, { type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks"], outputs: ["zoomCenter"] }], directives: [{ type: i2__namespace$2.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
@@ -1960,6 +1967,9 @@
|
|
|
1960
1967
|
args: [ArtboardComponent, { read: i0.ElementRef }]
|
|
1961
1968
|
}], config: [{
|
|
1962
1969
|
type: i0.Input
|
|
1970
|
+
}], editorContainerKeyDown: [{
|
|
1971
|
+
type: i0.HostListener,
|
|
1972
|
+
args: ['document:keydown', ['$event']]
|
|
1963
1973
|
}] } });
|
|
1964
1974
|
|
|
1965
1975
|
var FsBlockEditorModule = /** @class */ (function () {
|