@node-projects/web-component-designer 0.0.37 → 0.0.43
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/dist/commandHandling/CommandType.d.ts +3 -3
- package/dist/commandHandling/CommandType.js +3 -3
- package/dist/elements/controls/DesignerTabControl.js +1 -1
- package/dist/elements/controls/NumericInput.d.ts +0 -0
- package/dist/elements/controls/NumericInput.js +1 -0
- package/dist/elements/controls/NumericPopup.d.ts +6 -0
- package/dist/elements/controls/NumericPopup.js +39 -0
- package/dist/elements/controls/NumericStyleInput.d.ts +16 -0
- package/dist/elements/controls/NumericStyleInput.js +56 -0
- package/dist/elements/controls/ThicknessEditor copy.d.ts +33 -0
- package/dist/elements/controls/ThicknessEditor copy.js +145 -0
- package/dist/elements/controls/ThicknessEditor.d.ts +20 -4
- package/dist/elements/controls/ThicknessEditor.js +74 -9
- package/dist/elements/helper/LayoutHelper.d.ts +0 -0
- package/dist/elements/helper/LayoutHelper.js +4 -0
- package/dist/elements/services/BaseServiceContainer.js +0 -2
- package/dist/elements/services/DefaultServiceBootstrap.js +2 -0
- package/dist/elements/services/ServiceContainer.d.ts +5 -0
- package/dist/elements/services/ServiceContainer.js +4 -0
- package/dist/elements/services/htmlWriterService/HtmlWriterService.js +2 -2
- package/dist/elements/services/modelCommandService/DefaultInstanceService.d.ts +8 -0
- package/dist/elements/services/modelCommandService/DefaultInstanceService.js +14 -0
- package/dist/elements/services/modelCommandService/DefaultModelCommandService.d.ts +7 -0
- package/dist/elements/services/modelCommandService/DefaultModelCommandService.js +68 -0
- package/dist/elements/services/modelCommandService/IInstanceService.d.ts +8 -0
- package/dist/elements/services/modelCommandService/IInstanceService.js +1 -0
- package/dist/elements/services/modelCommandService/IModelCommandService.d.ts +7 -0
- package/dist/elements/services/modelCommandService/IModelCommandService.js +1 -0
- package/dist/elements/services/placementService/DefaultPlacementService.js +2 -2
- package/dist/elements/services/propertiesService/propertyEditors/BasePropertyEditor.js +6 -1
- package/dist/elements/services/propertiesService/propertyEditors/ThicknessPropertyEditor.js +2 -2
- package/dist/elements/services/undoService/UndoService.d.ts +3 -0
- package/dist/elements/services/undoService/UndoService.js +7 -0
- package/dist/elements/widgets/designerView/DomConverter.js +2 -2
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +1 -2
- package/dist/elements/widgets/designerView/designerCanvas.js +18 -20
- package/dist/elements/widgets/designerView/extensions/AbstractExtension copy.d.ts +22 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtension copy.js +52 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtension.d.ts +2 -12
- package/dist/elements/widgets/designerView/extensions/AbstractExtension.js +3 -73
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.d.ts +16 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.js +50 -0
- package/dist/elements/widgets/designerView/extensions/AltToEnterContainerExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/CanvasExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextExtension.js +4 -4
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.js +14 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionType.d.ts +0 -3
- package/dist/elements/widgets/designerView/extensions/ExtensionType.js +0 -3
- package/dist/elements/widgets/designerView/extensions/GrayOutExtension.js +5 -5
- package/dist/elements/widgets/designerView/extensions/GridExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/IExtensionManger.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/InvisibleDivExtension.js +1 -1
- package/dist/elements/widgets/designerView/extensions/MouseOverExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/PathExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/PositionExtension.js +6 -6
- package/dist/elements/widgets/designerView/extensions/PrimarySelectionDefaultExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/PrimarySelectionDefaultExtensionProvider.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/PrimarySelectionDefaultExtensionProvider.js +4 -0
- package/dist/elements/widgets/designerView/extensions/ResizeExtension.js +21 -21
- package/dist/elements/widgets/designerView/extensions/ResizeExtensionProvider.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/ResizeExtensionProvider.js +4 -0
- package/dist/elements/widgets/designerView/extensions/RotateExtension.js +3 -3
- package/dist/elements/widgets/designerView/extensions/SelectionDefaultExtension.js +1 -1
- package/dist/elements/widgets/designerView/extensions/TransformOriginExtension.js +6 -6
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/AbstractDesignerPointerExtension.d.ts +3 -14
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/AbstractDesignerPointerExtension.js +4 -75
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension copy.d.ts +13 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension copy.js +27 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension.d.ts +13 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension.js +26 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtensionProvider.d.ts +7 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtensionProvider.js +10 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorRectanglePointerExtension copy.d.ts +7 -1
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorRectanglePointerExtension copy.js +15 -8
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/IDesignerPointerExtension.d.ts +1 -1
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/IDesignerPointerExtensionProvider.d.ts +1 -4
- package/dist/elements/widgets/designerView/overlayLayerView.d.ts +4 -0
- package/dist/elements/widgets/designerView/overlayLayerView.js +62 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -0
- package/package.json +3 -3
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { CommandType } from "../../../commandHandling/CommandType.js";
|
|
2
|
+
import { DesignItem } from "../../item/DesignItem.js";
|
|
3
|
+
import { MoveElementInDomAction } from "../undoService/transactionItems/MoveElementInDomAction.js";
|
|
4
|
+
export class DefaultModelCommandService {
|
|
5
|
+
canExecuteCommand(designerCanvas, command) {
|
|
6
|
+
if (command.type == CommandType.moveBackward ||
|
|
7
|
+
command.type == CommandType.moveForward ||
|
|
8
|
+
command.type == CommandType.moveToBack ||
|
|
9
|
+
command.type == CommandType.moveToFront)
|
|
10
|
+
return designerCanvas.instanceServiceContainer.selectionService.primarySelection != null;
|
|
11
|
+
if (command.type == CommandType.arrangeBottom ||
|
|
12
|
+
command.type == CommandType.arrangeCenter ||
|
|
13
|
+
command.type == CommandType.arrangeLeft ||
|
|
14
|
+
command.type == CommandType.arrangeMiddle ||
|
|
15
|
+
command.type == CommandType.arrangeRight ||
|
|
16
|
+
command.type == CommandType.arrangeTop ||
|
|
17
|
+
command.type == CommandType.unifyHeight ||
|
|
18
|
+
command.type == CommandType.unifyWidth)
|
|
19
|
+
return designerCanvas.instanceServiceContainer.selectionService.selectedElements.length > 1;
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
async executeCommand(designerCanvas, command) {
|
|
23
|
+
let sel = designerCanvas.instanceServiceContainer.selectionService.primarySelection;
|
|
24
|
+
if (command.type == CommandType.moveBackward)
|
|
25
|
+
designerCanvas.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.previousElementSibling), 'beforebegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
26
|
+
else if (command.type == CommandType.moveForward)
|
|
27
|
+
designerCanvas.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.nextElementSibling), 'afterend', DesignItem.GetDesignItem(sel.element.nextElementSibling), 'beforebegin'));
|
|
28
|
+
else if (command.type == CommandType.moveToBack)
|
|
29
|
+
designerCanvas.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.parentElement), 'afterbegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
30
|
+
else if (command.type == CommandType.moveToFront)
|
|
31
|
+
designerCanvas.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.parentElement), 'beforeend', DesignItem.GetDesignItem(sel.element.nextElementSibling), 'beforebegin'));
|
|
32
|
+
else if (command.type == CommandType.arrangeLeft) {
|
|
33
|
+
const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('arrangeLeft');
|
|
34
|
+
const left = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('left');
|
|
35
|
+
for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
36
|
+
s.setStyle('left', left);
|
|
37
|
+
}
|
|
38
|
+
grp.commit();
|
|
39
|
+
}
|
|
40
|
+
else if (command.type == CommandType.arrangeTop) {
|
|
41
|
+
const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('arrangeTop');
|
|
42
|
+
const top = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('top');
|
|
43
|
+
for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
44
|
+
s.setStyle('top', top);
|
|
45
|
+
}
|
|
46
|
+
grp.commit();
|
|
47
|
+
}
|
|
48
|
+
else if (command.type == CommandType.unifyHeight) {
|
|
49
|
+
const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('unifyHeight');
|
|
50
|
+
const height = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('height');
|
|
51
|
+
for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
52
|
+
s.setStyle('height', height);
|
|
53
|
+
}
|
|
54
|
+
grp.commit();
|
|
55
|
+
}
|
|
56
|
+
else if (command.type == CommandType.unifyWidth) {
|
|
57
|
+
const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('unifyWidth');
|
|
58
|
+
const width = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('width');
|
|
59
|
+
for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
60
|
+
s.setStyle('width', width);
|
|
61
|
+
}
|
|
62
|
+
grp.commit();
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
return null;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IService } from '../IService';
|
|
2
|
+
import { IElementDefinition } from '../elementsService/IElementDefinition';
|
|
3
|
+
import type { ServiceContainer } from '../ServiceContainer';
|
|
4
|
+
import type { InstanceServiceContainer } from '../InstanceServiceContainer';
|
|
5
|
+
import { IDesignItem } from '../../item/IDesignItem';
|
|
6
|
+
export interface IInstanceService extends IService {
|
|
7
|
+
getElement(definition: IElementDefinition, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer): Promise<IDesignItem>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IUiCommand } from '../../../commandHandling/IUiCommand.js';
|
|
2
|
+
import { IDesignerCanvas } from '../../widgets/designerView/IDesignerCanvas.js';
|
|
3
|
+
import { IService } from '../IService';
|
|
4
|
+
export interface IModelCommandService extends IService {
|
|
5
|
+
canExecuteCommand(designerCanvas: IDesignerCanvas, command: IUiCommand): boolean | null;
|
|
6
|
+
executeCommand(designerCanvas: IDesignerCanvas, command: IUiCommand): any;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -89,9 +89,9 @@ export class DefaultPlacementService {
|
|
|
89
89
|
let track = this.calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, items[0]);
|
|
90
90
|
for (const designItem of items) {
|
|
91
91
|
let movedElement = designItem.element;
|
|
92
|
-
let oldLeft =
|
|
92
|
+
let oldLeft = parseFloat(movedElement.style.left);
|
|
93
93
|
oldLeft = Number.isNaN(oldLeft) ? 0 : oldLeft;
|
|
94
|
-
let oldTop =
|
|
94
|
+
let oldTop = parseFloat(movedElement.style.top);
|
|
95
95
|
oldTop = Number.isNaN(oldTop) ? 0 : oldTop;
|
|
96
96
|
//let oldPosition = movedElement.style.position;
|
|
97
97
|
designItem.element.style.transform = null;
|
|
@@ -30,7 +30,12 @@ export class BasePropertyEditor {
|
|
|
30
30
|
else
|
|
31
31
|
this.element.classList.remove('unset-value');
|
|
32
32
|
this.disableChangeNotification = true;
|
|
33
|
-
|
|
33
|
+
try {
|
|
34
|
+
this.refreshValue(valueType, value);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
console.error(err);
|
|
38
|
+
}
|
|
34
39
|
this.disableChangeNotification = false;
|
|
35
40
|
}
|
|
36
41
|
}
|
|
@@ -5,10 +5,10 @@ export class ThicknessPropertyEditor extends BasePropertyEditor {
|
|
|
5
5
|
super(property);
|
|
6
6
|
const selector = new ThicknessEditor();
|
|
7
7
|
selector.property = property.name;
|
|
8
|
-
selector.
|
|
8
|
+
selector.valueLeftChanged.on((e) => this._valueChanged(e.newValue));
|
|
9
9
|
this.element = selector;
|
|
10
10
|
}
|
|
11
11
|
refreshValue(valueType, value) {
|
|
12
|
-
this.element.
|
|
12
|
+
this.element.valueLeft = value;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -2,10 +2,13 @@ import { ITransactionItem } from './ITransactionItem.js';
|
|
|
2
2
|
import { ChangeGroup } from "./ChangeGroup.js";
|
|
3
3
|
import { IUndoService } from './IUndoService.js';
|
|
4
4
|
import { IDesignItem } from '../../item/IDesignItem';
|
|
5
|
+
import { IDesignerCanvas } from '../../widgets/designerView/IDesignerCanvas.js';
|
|
5
6
|
export declare class UndoService implements IUndoService {
|
|
6
7
|
private _undoStack;
|
|
7
8
|
private _redoStack;
|
|
8
9
|
private _transactionStack;
|
|
10
|
+
private _designerCanvas;
|
|
11
|
+
constructor(designerCanvas?: IDesignerCanvas);
|
|
9
12
|
openGroup(title: string, affectedItems: IDesignItem[]): ChangeGroup;
|
|
10
13
|
private commitTransactionItem;
|
|
11
14
|
private abortTransactionItem;
|
|
@@ -6,6 +6,10 @@ export class UndoService {
|
|
|
6
6
|
_undoStack = [];
|
|
7
7
|
_redoStack = [];
|
|
8
8
|
_transactionStack = [];
|
|
9
|
+
_designerCanvas;
|
|
10
|
+
constructor(designerCanvas) {
|
|
11
|
+
this._designerCanvas = designerCanvas;
|
|
12
|
+
}
|
|
9
13
|
openGroup(title, affectedItems) {
|
|
10
14
|
let t = new ChangeGroup(title, affectedItems, (t) => this.commitTransactionItem(t), (t) => this.abortTransactionItem(t));
|
|
11
15
|
this._transactionStack.push(t);
|
|
@@ -37,6 +41,7 @@ export class UndoService {
|
|
|
37
41
|
else {
|
|
38
42
|
this._transactionStack[this._transactionStack.length - 1].execute(item);
|
|
39
43
|
}
|
|
44
|
+
this._designerCanvas.extensionManager.refreshAllExtensions(item.affectedItems);
|
|
40
45
|
}
|
|
41
46
|
clear() {
|
|
42
47
|
this._undoStack = [];
|
|
@@ -57,6 +62,7 @@ export class UndoService {
|
|
|
57
62
|
this.clear();
|
|
58
63
|
throw err;
|
|
59
64
|
}
|
|
65
|
+
this._designerCanvas.extensionManager.refreshAllExtensions(item.affectedItems);
|
|
60
66
|
}
|
|
61
67
|
redo() {
|
|
62
68
|
if (!this.canRedo())
|
|
@@ -72,6 +78,7 @@ export class UndoService {
|
|
|
72
78
|
this.clear();
|
|
73
79
|
throw err;
|
|
74
80
|
}
|
|
81
|
+
this._designerCanvas.extensionManager.refreshAllExtensions(item.affectedItems);
|
|
75
82
|
}
|
|
76
83
|
canUndo() {
|
|
77
84
|
return this._undoStack.length > 0;
|
|
@@ -2,12 +2,12 @@ import { IndentedTextWriter } from "../../helper/IndentedTextWriter";
|
|
|
2
2
|
export class DomConverter {
|
|
3
3
|
static normalizeAttributeValue(value) {
|
|
4
4
|
if (value)
|
|
5
|
-
return value.
|
|
5
|
+
return value.replaceAll('"', '"');
|
|
6
6
|
return value;
|
|
7
7
|
}
|
|
8
8
|
static normalizeContentValue(value) {
|
|
9
9
|
if (value)
|
|
10
|
-
return value.
|
|
10
|
+
return value.replaceAll('<', '<').replaceAll(' ', ' '); // !caution! -> this is not normal space, it's nbsp
|
|
11
11
|
return value;
|
|
12
12
|
}
|
|
13
13
|
static IsSelfClosingElement(tag) {
|
|
@@ -6,7 +6,6 @@ import { IDesignerCanvas } from './IDesignerCanvas';
|
|
|
6
6
|
import { Snaplines } from './Snaplines';
|
|
7
7
|
import { ContextMenuHelper } from '../../helper/contextMenu/ContextMenuHelper';
|
|
8
8
|
import { IPlacementView } from './IPlacementView';
|
|
9
|
-
import { CommandType } from '../../../commandHandling/CommandType';
|
|
10
9
|
import { IUiCommandHandler } from '../../../commandHandling/IUiCommandHandler';
|
|
11
10
|
import { IUiCommand } from '../../../commandHandling/IUiCommand';
|
|
12
11
|
import { IExtensionManager } from "./extensions/IExtensionManger";
|
|
@@ -40,6 +39,7 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
40
39
|
static readonly style: CSSStyleSheet;
|
|
41
40
|
static readonly template: HTMLTemplateElement;
|
|
42
41
|
extensionManager: IExtensionManager;
|
|
42
|
+
private _pointerextensions;
|
|
43
43
|
private _onDblClickBound;
|
|
44
44
|
constructor();
|
|
45
45
|
get designerWidth(): string;
|
|
@@ -53,7 +53,6 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
53
53
|
handleCopyCommand(): Promise<void>;
|
|
54
54
|
handlePasteCommand(): Promise<void>;
|
|
55
55
|
handleDeleteCommand(): void;
|
|
56
|
-
handleMoveCommand(command: CommandType): void;
|
|
57
56
|
initialize(serviceContainer: ServiceContainer): void;
|
|
58
57
|
elementFromPoint(x: number, y: number): Element;
|
|
59
58
|
connectedCallback(): void;
|
|
@@ -11,7 +11,6 @@ import { Snaplines } from './Snaplines';
|
|
|
11
11
|
import { ContextMenuHelper } from '../../helper/contextMenu/ContextMenuHelper';
|
|
12
12
|
import { DeleteAction } from '../../services/undoService/transactionItems/DeleteAction';
|
|
13
13
|
import { CommandType } from '../../../commandHandling/CommandType';
|
|
14
|
-
import { MoveElementInDomAction } from '../../services/undoService/transactionItems/MoveElementInDomAction';
|
|
15
14
|
import { DefaultHtmlParserService } from "../../services/htmlParserService/DefaultHtmlParserService";
|
|
16
15
|
import { ExtensionType } from "./extensions/ExtensionType";
|
|
17
16
|
import { ExtensionManager } from "./extensions/ExtensionManager";
|
|
@@ -103,13 +102,13 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
103
102
|
<div style="width: 100%;height: 100%;">
|
|
104
103
|
<div id="node-projects-designer-canvas-outercanvas2" style="width: 100%;height: 100%;position: relative;overflow: auto;">
|
|
105
104
|
<div id="node-projects-designer-canvas-canvasContainer" style="width: 100%;height: 100%;margin: auto;position: absolute;top: 0;/* bottom: 0; does not work with fixed sized when size is bigger then view */left: 0;user-select: none;">
|
|
106
|
-
<!-- <div id="zoomHelper" style="width: 10px; height: 10px; position: absolute; top: 0; left: 0; pointer-events: none;"></div> -->
|
|
107
105
|
<div id="node-projects-designer-canvas-canvas" part="canvas" tabindex="0"></div>
|
|
108
106
|
</div>
|
|
109
107
|
</div>
|
|
110
108
|
</div>
|
|
111
109
|
</div>`;
|
|
112
110
|
extensionManager;
|
|
111
|
+
_pointerextensions;
|
|
113
112
|
_onDblClickBound;
|
|
114
113
|
constructor() {
|
|
115
114
|
super();
|
|
@@ -117,7 +116,7 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
117
116
|
this._canvasContainer = this._getDomElement('node-projects-designer-canvas-canvasContainer');
|
|
118
117
|
this._outercanvas2 = this._getDomElement('node-projects-designer-canvas-outercanvas2');
|
|
119
118
|
this.instanceServiceContainer = new InstanceServiceContainer();
|
|
120
|
-
this.instanceServiceContainer.register("undoService", new UndoService);
|
|
119
|
+
this.instanceServiceContainer.register("undoService", new UndoService(this));
|
|
121
120
|
this.instanceServiceContainer.register("selectionService", new SelectionService);
|
|
122
121
|
this.extensionManager = new ExtensionManager(this);
|
|
123
122
|
this._onKeyDownBound = this.onKeyDown.bind(this);
|
|
@@ -162,6 +161,9 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
162
161
|
}
|
|
163
162
|
/* --- start IUiCommandHandler --- */
|
|
164
163
|
async executeCommand(command) {
|
|
164
|
+
let handeled = this.serviceContainer.modelCommandService.executeCommand(this, command);
|
|
165
|
+
if (handeled != null)
|
|
166
|
+
return;
|
|
165
167
|
switch (command.type) {
|
|
166
168
|
case CommandType.screenshot:
|
|
167
169
|
{
|
|
@@ -194,12 +196,6 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
194
196
|
case CommandType.redo:
|
|
195
197
|
this.instanceServiceContainer.undoService.redo();
|
|
196
198
|
break;
|
|
197
|
-
case CommandType.moveToFront:
|
|
198
|
-
case CommandType.moveForward:
|
|
199
|
-
case CommandType.moveBackward:
|
|
200
|
-
case CommandType.moveToBack:
|
|
201
|
-
this.handleMoveCommand(command.type);
|
|
202
|
-
break;
|
|
203
199
|
case CommandType.copy:
|
|
204
200
|
this.handleCopyCommand();
|
|
205
201
|
break;
|
|
@@ -216,6 +212,9 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
216
212
|
}
|
|
217
213
|
}
|
|
218
214
|
canExecuteCommand(command) {
|
|
215
|
+
let handeled = this.serviceContainer.modelCommandService.canExecuteCommand(this, command);
|
|
216
|
+
if (handeled !== null)
|
|
217
|
+
return handeled;
|
|
219
218
|
if (command.type === CommandType.undo) {
|
|
220
219
|
return this.instanceServiceContainer.undoService.canUndo();
|
|
221
220
|
}
|
|
@@ -256,17 +255,6 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
256
255
|
this.instanceServiceContainer.undoService.execute(new DeleteAction(items, this.extensionManager));
|
|
257
256
|
this.instanceServiceContainer.selectionService.setSelectedElements(null);
|
|
258
257
|
}
|
|
259
|
-
handleMoveCommand(command) {
|
|
260
|
-
let sel = this.instanceServiceContainer.selectionService.primarySelection;
|
|
261
|
-
if (command == CommandType.moveBackward)
|
|
262
|
-
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.previousElementSibling), 'beforebegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
263
|
-
else if (command == CommandType.moveForward)
|
|
264
|
-
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.nextElementSibling), 'afterend', DesignItem.GetDesignItem(sel.element.nextElementSibling), 'beforebegin'));
|
|
265
|
-
else if (command == CommandType.moveToBack)
|
|
266
|
-
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.parentElement), 'afterbegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
267
|
-
else if (command == CommandType.moveToFront)
|
|
268
|
-
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.parentElement), 'beforeend', DesignItem.GetDesignItem(sel.element.nextElementSibling), 'beforebegin'));
|
|
269
|
-
}
|
|
270
258
|
initialize(serviceContainer) {
|
|
271
259
|
this.serviceContainer = serviceContainer;
|
|
272
260
|
this.rootDesignItem = DesignItem.GetOrCreateDesignItem(this._canvas, this.serviceContainer, this.instanceServiceContainer);
|
|
@@ -276,6 +264,12 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
276
264
|
this._canvasContainer.appendChild(this.overlayLayer);
|
|
277
265
|
this.snapLines = new Snaplines(this.overlayLayer);
|
|
278
266
|
this.snapLines.initialize(this.rootDesignItem);
|
|
267
|
+
if (this.serviceContainer.designerPointerExtensions)
|
|
268
|
+
for (let pe of this.serviceContainer.designerPointerExtensions) {
|
|
269
|
+
if (!this._pointerextensions)
|
|
270
|
+
this._pointerextensions = [];
|
|
271
|
+
this._pointerextensions.push(pe.getExtension(this));
|
|
272
|
+
}
|
|
279
273
|
if (this.children) {
|
|
280
274
|
let children = this.children;
|
|
281
275
|
if (this.children.length == 1 && this.children[0] instanceof HTMLSlotElement) {
|
|
@@ -548,6 +542,10 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
548
542
|
_rect;
|
|
549
543
|
_pointerEventHandler(event) {
|
|
550
544
|
this._fillCalculationrects();
|
|
545
|
+
if (this._pointerextensions) {
|
|
546
|
+
for (let pe of this._pointerextensions)
|
|
547
|
+
pe.refresh(event);
|
|
548
|
+
}
|
|
551
549
|
if (event.composedPath().indexOf(this.eatEvents) >= 0)
|
|
552
550
|
return;
|
|
553
551
|
if (event.button == 2)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IDesignItem } from "../../../item/IDesignItem";
|
|
2
|
+
import { IDesignerCanvas } from "../IDesignerCanvas";
|
|
3
|
+
import { IDesignerExtension } from "./IDesignerExtension";
|
|
4
|
+
import { IExtensionManager } from "./IExtensionManger";
|
|
5
|
+
import { OverlayLayerView } from '../overlayLayerView';
|
|
6
|
+
import { OverlayLayer } from './OverlayLayer';
|
|
7
|
+
export declare abstract class AbstractExtension implements IDesignerExtension {
|
|
8
|
+
protected overlays: SVGGraphicsElement[];
|
|
9
|
+
protected overlayLayerView: OverlayLayerView;
|
|
10
|
+
protected extensionManager: IExtensionManager;
|
|
11
|
+
protected designerView: IDesignerCanvas;
|
|
12
|
+
protected extendedItem: IDesignItem;
|
|
13
|
+
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
14
|
+
abstract extend(): any;
|
|
15
|
+
abstract refresh(): any;
|
|
16
|
+
abstract dispose(): any;
|
|
17
|
+
protected _removeAllOverlays(): void;
|
|
18
|
+
_drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
19
|
+
_drawCircle(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
20
|
+
_drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
21
|
+
_drawText(text: string, x: number, y: number, className?: string, textEl?: SVGTextElement, overlayLayer?: OverlayLayer): SVGTextElement;
|
|
22
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export class AbstractExtension {
|
|
2
|
+
overlays = [];
|
|
3
|
+
overlayLayerView;
|
|
4
|
+
extensionManager;
|
|
5
|
+
designerView;
|
|
6
|
+
extendedItem;
|
|
7
|
+
constructor(extensionManager, designerView, extendedItem) {
|
|
8
|
+
this.extensionManager = extensionManager;
|
|
9
|
+
this.designerView = designerView;
|
|
10
|
+
this.extendedItem = extendedItem;
|
|
11
|
+
this.overlayLayerView = designerView.overlayLayer;
|
|
12
|
+
}
|
|
13
|
+
_removeAllOverlays() {
|
|
14
|
+
for (let o of this.overlays) {
|
|
15
|
+
try {
|
|
16
|
+
this.overlayLayerView.removeOverlay(o);
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
console.error(err);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
this.overlays = [];
|
|
23
|
+
}
|
|
24
|
+
_drawLine(x1, y1, x2, y2, className, line, overlayLayer) {
|
|
25
|
+
const newLine = this.overlayLayerView.drawLine(x1, y1, x2, y2, className, line, overlayLayer);
|
|
26
|
+
if (!line) {
|
|
27
|
+
this.overlays.push(newLine);
|
|
28
|
+
}
|
|
29
|
+
return newLine;
|
|
30
|
+
}
|
|
31
|
+
_drawCircle(x, y, radius, className, circle, overlayLayer) {
|
|
32
|
+
const newCircle = this.overlayLayerView.drawCircle(x, y, radius, className, circle, overlayLayer);
|
|
33
|
+
if (!circle) {
|
|
34
|
+
this.overlays.push(newCircle);
|
|
35
|
+
}
|
|
36
|
+
return circle;
|
|
37
|
+
}
|
|
38
|
+
_drawRect(x, y, w, h, className, rect, overlayLayer) {
|
|
39
|
+
const newRect = this.overlayLayerView.drawRect(x, y, w, h, className, rect, overlayLayer);
|
|
40
|
+
if (!rect) {
|
|
41
|
+
this.overlays.push(newRect);
|
|
42
|
+
}
|
|
43
|
+
return newRect;
|
|
44
|
+
}
|
|
45
|
+
_drawText(text, x, y, className, textEl, overlayLayer) {
|
|
46
|
+
const newText = this.overlayLayerView.drawText(text, x, y, className, textEl, overlayLayer);
|
|
47
|
+
if (!textEl) {
|
|
48
|
+
this.overlays.push(newText);
|
|
49
|
+
}
|
|
50
|
+
return newText;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -2,21 +2,11 @@ import { IDesignItem } from "../../../item/IDesignItem";
|
|
|
2
2
|
import { IDesignerCanvas } from "../IDesignerCanvas";
|
|
3
3
|
import { IDesignerExtension } from "./IDesignerExtension";
|
|
4
4
|
import { IExtensionManager } from "./IExtensionManger";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
export declare abstract class AbstractExtension implements IDesignerExtension {
|
|
8
|
-
protected overlays: SVGGraphicsElement[];
|
|
9
|
-
protected overlayLayerView: OverlayLayerView;
|
|
10
|
-
protected extensionManager: IExtensionManager;
|
|
11
|
-
protected designerView: IDesignerCanvas;
|
|
5
|
+
import { AbstractExtensionBase } from "./AbstractExtensionBase.js";
|
|
6
|
+
export declare abstract class AbstractExtension extends AbstractExtensionBase implements IDesignerExtension {
|
|
12
7
|
protected extendedItem: IDesignItem;
|
|
13
8
|
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
14
9
|
abstract extend(): any;
|
|
15
10
|
abstract refresh(): any;
|
|
16
11
|
abstract dispose(): any;
|
|
17
|
-
protected _removeAllOverlays(): void;
|
|
18
|
-
_drawLineOverlay(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
19
|
-
_drawCircleOverlay(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
20
|
-
_drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
21
|
-
_drawText(text: string, x: number, y: number, className?: string, textEl?: SVGTextElement, overlayLayer?: OverlayLayer): SVGTextElement;
|
|
22
12
|
}
|
|
@@ -1,78 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
overlayLayerView;
|
|
4
|
-
extensionManager;
|
|
5
|
-
designerView;
|
|
1
|
+
import { AbstractExtensionBase } from "./AbstractExtensionBase.js";
|
|
2
|
+
export class AbstractExtension extends AbstractExtensionBase {
|
|
6
3
|
extendedItem;
|
|
7
4
|
constructor(extensionManager, designerView, extendedItem) {
|
|
8
|
-
|
|
9
|
-
this.designerView = designerView;
|
|
5
|
+
super(extensionManager, designerView);
|
|
10
6
|
this.extendedItem = extendedItem;
|
|
11
|
-
this.overlayLayerView = designerView.overlayLayer;
|
|
12
|
-
}
|
|
13
|
-
_removeAllOverlays() {
|
|
14
|
-
for (let o of this.overlays) {
|
|
15
|
-
try {
|
|
16
|
-
this.overlayLayerView.removeOverlay(o);
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
console.error(err);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
this.overlays = [];
|
|
23
|
-
}
|
|
24
|
-
_drawLineOverlay(x1, y1, x2, y2, className, line, overlayLayer) {
|
|
25
|
-
if (!line) {
|
|
26
|
-
line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
27
|
-
this.overlayLayerView.addOverlay(line, overlayLayer);
|
|
28
|
-
this.overlays.push(line);
|
|
29
|
-
}
|
|
30
|
-
line.setAttribute('x1', x1);
|
|
31
|
-
line.setAttribute('y1', y1);
|
|
32
|
-
line.setAttribute('x2', x2);
|
|
33
|
-
line.setAttribute('y2', y2);
|
|
34
|
-
if (className)
|
|
35
|
-
line.setAttribute('class', className);
|
|
36
|
-
return line;
|
|
37
|
-
}
|
|
38
|
-
_drawCircleOverlay(x, y, radius, className, circle, overlayLayer) {
|
|
39
|
-
if (!circle) {
|
|
40
|
-
circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
41
|
-
this.overlayLayerView.addOverlay(circle, overlayLayer);
|
|
42
|
-
this.overlays.push(circle);
|
|
43
|
-
}
|
|
44
|
-
circle.setAttribute('cx', x);
|
|
45
|
-
circle.setAttribute('cy', y);
|
|
46
|
-
circle.setAttribute('r', radius);
|
|
47
|
-
if (className)
|
|
48
|
-
circle.setAttribute('class', className);
|
|
49
|
-
return circle;
|
|
50
|
-
}
|
|
51
|
-
_drawRect(x, y, w, h, className, rect, overlayLayer) {
|
|
52
|
-
if (!rect) {
|
|
53
|
-
rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
54
|
-
this.overlayLayerView.addOverlay(rect, overlayLayer);
|
|
55
|
-
this.overlays.push(rect);
|
|
56
|
-
}
|
|
57
|
-
rect.setAttribute('x', x);
|
|
58
|
-
rect.setAttribute('y', y);
|
|
59
|
-
rect.setAttribute('width', w);
|
|
60
|
-
rect.setAttribute('height', h);
|
|
61
|
-
if (className)
|
|
62
|
-
rect.setAttribute('class', className);
|
|
63
|
-
return rect;
|
|
64
|
-
}
|
|
65
|
-
_drawText(text, x, y, className, textEl, overlayLayer) {
|
|
66
|
-
if (!textEl) {
|
|
67
|
-
textEl = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
68
|
-
this.overlayLayerView.addOverlay(textEl, overlayLayer);
|
|
69
|
-
this.overlays.push(textEl);
|
|
70
|
-
}
|
|
71
|
-
textEl.setAttribute('x', x);
|
|
72
|
-
textEl.setAttribute('y', y);
|
|
73
|
-
textEl.textContent = text;
|
|
74
|
-
if (className)
|
|
75
|
-
textEl.setAttribute('class', className);
|
|
76
|
-
return textEl;
|
|
77
7
|
}
|
|
78
8
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IDesignerCanvas } from "../IDesignerCanvas";
|
|
2
|
+
import { IExtensionManager } from "./IExtensionManger";
|
|
3
|
+
import { OverlayLayerView } from '../overlayLayerView';
|
|
4
|
+
import { OverlayLayer } from './OverlayLayer';
|
|
5
|
+
export declare abstract class AbstractExtensionBase {
|
|
6
|
+
protected overlays: SVGGraphicsElement[];
|
|
7
|
+
protected overlayLayerView: OverlayLayerView;
|
|
8
|
+
protected extensionManager: IExtensionManager;
|
|
9
|
+
protected designerCanvas: IDesignerCanvas;
|
|
10
|
+
constructor(extensionManager: IExtensionManager, designerCanvas: IDesignerCanvas);
|
|
11
|
+
protected _removeAllOverlays(): void;
|
|
12
|
+
protected _drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
13
|
+
protected _drawCircle(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
14
|
+
protected _drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
15
|
+
protected _drawText(text: string, x: number, y: number, className?: string, textEl?: SVGTextElement, overlayLayer?: OverlayLayer): SVGTextElement;
|
|
16
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export class AbstractExtensionBase {
|
|
2
|
+
overlays = [];
|
|
3
|
+
overlayLayerView;
|
|
4
|
+
extensionManager;
|
|
5
|
+
designerCanvas;
|
|
6
|
+
constructor(extensionManager, designerCanvas) {
|
|
7
|
+
this.extensionManager = extensionManager;
|
|
8
|
+
this.designerCanvas = designerCanvas;
|
|
9
|
+
this.overlayLayerView = designerCanvas.overlayLayer;
|
|
10
|
+
}
|
|
11
|
+
_removeAllOverlays() {
|
|
12
|
+
for (let o of this.overlays) {
|
|
13
|
+
try {
|
|
14
|
+
this.overlayLayerView.removeOverlay(o);
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
console.error(err);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
this.overlays = [];
|
|
21
|
+
}
|
|
22
|
+
_drawLine(x1, y1, x2, y2, className, line, overlayLayer) {
|
|
23
|
+
const newLine = this.overlayLayerView.drawLine(x1, y1, x2, y2, className, line, overlayLayer);
|
|
24
|
+
if (!line) {
|
|
25
|
+
this.overlays.push(newLine);
|
|
26
|
+
}
|
|
27
|
+
return newLine;
|
|
28
|
+
}
|
|
29
|
+
_drawCircle(x, y, radius, className, circle, overlayLayer) {
|
|
30
|
+
const newCircle = this.overlayLayerView.drawCircle(x, y, radius, className, circle, overlayLayer);
|
|
31
|
+
if (!circle) {
|
|
32
|
+
this.overlays.push(newCircle);
|
|
33
|
+
}
|
|
34
|
+
return newCircle;
|
|
35
|
+
}
|
|
36
|
+
_drawRect(x, y, w, h, className, rect, overlayLayer) {
|
|
37
|
+
const newRect = this.overlayLayerView.drawRect(x, y, w, h, className, rect, overlayLayer);
|
|
38
|
+
if (!rect) {
|
|
39
|
+
this.overlays.push(newRect);
|
|
40
|
+
}
|
|
41
|
+
return newRect;
|
|
42
|
+
}
|
|
43
|
+
_drawText(text, x, y, className, textEl, overlayLayer) {
|
|
44
|
+
const newText = this.overlayLayerView.drawText(text, x, y, className, textEl, overlayLayer);
|
|
45
|
+
if (!textEl) {
|
|
46
|
+
this.overlays.push(newText);
|
|
47
|
+
}
|
|
48
|
+
return newText;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -11,8 +11,8 @@ export class AltToEnterContainerExtension extends AbstractExtension {
|
|
|
11
11
|
}
|
|
12
12
|
refresh() {
|
|
13
13
|
let itemRect = this.extendedItem.element.getBoundingClientRect();
|
|
14
|
-
this._text = this._drawText("Press ALT to enter container", itemRect.x - this.
|
|
15
|
-
this._rect = this._drawRect(itemRect.x - this.
|
|
14
|
+
this._text = this._drawText("Press ALT to enter container", itemRect.x - this.designerCanvas.containerBoundingRect.x + 5, itemRect.y - this.designerCanvas.containerBoundingRect.y + 12, 'svg-text-enter-container', this._text, OverlayLayer.Background);
|
|
15
|
+
this._rect = this._drawRect(itemRect.x - this.designerCanvas.containerBoundingRect.x, itemRect.y - this.designerCanvas.containerBoundingRect.y, itemRect.width, itemRect.height, 'svg-rect-enter-container', this._rect, OverlayLayer.Background);
|
|
16
16
|
}
|
|
17
17
|
dispose() {
|
|
18
18
|
this._removeAllOverlays();
|
|
@@ -7,8 +7,8 @@ export class CanvasExtension extends AbstractExtension {
|
|
|
7
7
|
let itemRect = this.extendedItem.element.getBoundingClientRect();
|
|
8
8
|
const computedStyle = getComputedStyle(this.extendedItem.element);
|
|
9
9
|
if (computedStyle.margin !== '0px') {
|
|
10
|
-
const xOffset = itemRect.x - this.
|
|
11
|
-
const yOffset = itemRect.y - this.
|
|
10
|
+
const xOffset = itemRect.x - this.designerCanvas.containerBoundingRect.x;
|
|
11
|
+
const yOffset = itemRect.y - this.designerCanvas.containerBoundingRect.y;
|
|
12
12
|
const left = Number.parseFloat(computedStyle.marginLeft.replace('px', ''));
|
|
13
13
|
const top = Number.parseFloat(computedStyle.marginTop.replace('px', ''));
|
|
14
14
|
const right = Number.parseFloat(computedStyle.marginRight.replace('px', ''));
|
|
@@ -29,13 +29,13 @@ export class EditTextExtension extends AbstractExtension {
|
|
|
29
29
|
this.extendedItem.element.addEventListener('input', this._contentEditedBound);
|
|
30
30
|
this.extendedItem.element.addEventListener('blur', this._blurBound);
|
|
31
31
|
this.extendedItem.element.focus();
|
|
32
|
-
this.
|
|
32
|
+
this.designerCanvas.eatEvents = this.extendedItem.element;
|
|
33
33
|
let itemRect = this.extendedItem.element.getBoundingClientRect();
|
|
34
34
|
const elements = EditTextExtension.template.content.cloneNode(true);
|
|
35
35
|
elements.querySelectorAll('button').forEach(x => x.onclick = () => this._formatSelection(x.dataset['command']));
|
|
36
36
|
let foreignObject = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject');
|
|
37
|
-
foreignObject.setAttribute('x', '' + (itemRect.x - this.
|
|
38
|
-
foreignObject.setAttribute('y', '' + (itemRect.y - this.
|
|
37
|
+
foreignObject.setAttribute('x', '' + (itemRect.x - this.designerCanvas.containerBoundingRect.x));
|
|
38
|
+
foreignObject.setAttribute('y', '' + (itemRect.y - this.designerCanvas.containerBoundingRect.y - 30));
|
|
39
39
|
foreignObject.setAttribute('width', '96');
|
|
40
40
|
foreignObject.setAttribute('height', '24');
|
|
41
41
|
foreignObject.appendChild(elements);
|
|
@@ -50,7 +50,7 @@ export class EditTextExtension extends AbstractExtension {
|
|
|
50
50
|
this.extendedItem.element.removeAttribute('contenteditable');
|
|
51
51
|
this.extendedItem.element.removeEventListener('input', this._contentEditedBound);
|
|
52
52
|
this.extendedItem.element.removeEventListener('blur', this._blurBound);
|
|
53
|
-
this.
|
|
53
|
+
this.designerCanvas.eatEvents = null;
|
|
54
54
|
this.extendedItem.updateChildrenFromNodesChildren();
|
|
55
55
|
}
|
|
56
56
|
_contentEdited() {
|
|
@@ -12,4 +12,5 @@ export declare class ExtensionManager implements IExtensionManager {
|
|
|
12
12
|
removeExtensions(designItems: IDesignItem[], extensionType?: ExtensionType): void;
|
|
13
13
|
refreshExtension(designItem: IDesignItem, extensionType?: ExtensionType): void;
|
|
14
14
|
refreshExtensions(designItems: IDesignItem[], extensionType?: ExtensionType): void;
|
|
15
|
+
refreshAllExtensions(designItems: IDesignItem[]): void;
|
|
15
16
|
}
|