@node-projects/web-component-designer 0.0.61 → 0.0.62
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.
|
@@ -7,6 +7,7 @@ import { IDemoView } from './widgets/demoView/IDemoView';
|
|
|
7
7
|
import { IUiCommandHandler } from "../commandHandling/IUiCommandHandler";
|
|
8
8
|
import { IUiCommand } from "../commandHandling/IUiCommand";
|
|
9
9
|
import { IDisposable } from "../interfaces/IDisposable";
|
|
10
|
+
import { ISelectionChangedEvent } from "./services/selectionService/ISelectionChangedEvent.js";
|
|
10
11
|
export declare class DocumentContainer extends BaseCustomWebComponentLazyAppend implements IUiCommandHandler, IDisposable {
|
|
11
12
|
designerView: DesignerView;
|
|
12
13
|
codeView: ICodeView & HTMLElement;
|
|
@@ -23,6 +24,7 @@ export declare class DocumentContainer extends BaseCustomWebComponentLazyAppend
|
|
|
23
24
|
static get style(): CSSStyleSheet;
|
|
24
25
|
constructor(serviceContainer: ServiceContainer, content?: string);
|
|
25
26
|
refreshInSplitView(): void;
|
|
27
|
+
designerSelectionChanged(e: ISelectionChangedEvent): void;
|
|
26
28
|
dispose(): void;
|
|
27
29
|
executeCommand(command: IUiCommand): void;
|
|
28
30
|
canExecuteCommand(command: IUiCommand): boolean;
|
|
@@ -43,12 +43,14 @@ export class DocumentContainer extends BaseCustomWebComponentLazyAppend {
|
|
|
43
43
|
this.designerView = new DesignerView();
|
|
44
44
|
this.designerView.setAttribute('exportparts', 'canvas');
|
|
45
45
|
this._designerDiv = document.createElement("div");
|
|
46
|
+
this._tabControl.appendChild(this._designerDiv);
|
|
46
47
|
this._designerDiv.title = 'Designer';
|
|
47
48
|
this._designerDiv.appendChild(this.designerView);
|
|
48
|
-
this._tabControl.appendChild(this._designerDiv);
|
|
49
49
|
this.designerView.initialize(this._serviceContainer);
|
|
50
|
+
this.designerView.instanceServiceContainer.selectionService.onSelectionChanged.on(e => this.designerSelectionChanged(e));
|
|
50
51
|
this.codeView = new serviceContainer.config.codeViewWidget();
|
|
51
52
|
this._codeDiv = document.createElement("div");
|
|
53
|
+
this._tabControl.appendChild(this._codeDiv);
|
|
52
54
|
this._codeDiv.title = 'Code';
|
|
53
55
|
this._codeDiv.appendChild(this.codeView);
|
|
54
56
|
this.codeView.onTextChanged.on(text => {
|
|
@@ -57,7 +59,6 @@ export class DocumentContainer extends BaseCustomWebComponentLazyAppend {
|
|
|
57
59
|
this.refreshInSplitViewDebounced();
|
|
58
60
|
}
|
|
59
61
|
});
|
|
60
|
-
this._tabControl.appendChild(this._codeDiv);
|
|
61
62
|
this._splitDiv = document.createElement("div");
|
|
62
63
|
this._splitDiv.title = 'Split';
|
|
63
64
|
this._splitDiv.className = 'split-div';
|
|
@@ -73,6 +74,16 @@ export class DocumentContainer extends BaseCustomWebComponentLazyAppend {
|
|
|
73
74
|
refreshInSplitView() {
|
|
74
75
|
this.designerView.parseHTML(this._content);
|
|
75
76
|
}
|
|
77
|
+
designerSelectionChanged(e) {
|
|
78
|
+
let primarySelection = this.instanceServiceContainer.selectionService.primarySelection;
|
|
79
|
+
if (primarySelection) {
|
|
80
|
+
let designItemsAssignmentList = new Map();
|
|
81
|
+
this._content = this.designerView.getHTML(designItemsAssignmentList);
|
|
82
|
+
this._selectionPosition = designItemsAssignmentList.get(primarySelection);
|
|
83
|
+
this.codeView.setSelection(this._selectionPosition);
|
|
84
|
+
this._selectionPosition = null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
76
87
|
dispose() {
|
|
77
88
|
this.codeView.dispose();
|
|
78
89
|
}
|
|
@@ -71,12 +71,12 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
71
71
|
});
|
|
72
72
|
this._monacoEditor.layout();
|
|
73
73
|
let changeContentListener = this._monacoEditor.getModel().onDidChangeContent(e => {
|
|
74
|
-
|
|
74
|
+
this.onTextChanged.emit(this._monacoEditor.getValue());
|
|
75
75
|
});
|
|
76
76
|
this._monacoEditor.onDidChangeModel(e => {
|
|
77
77
|
changeContentListener.dispose();
|
|
78
78
|
changeContentListener = this._monacoEditor.getModel().onDidChangeContent(e => {
|
|
79
|
-
|
|
79
|
+
this.onTextChanged.emit(this._monacoEditor.getValue());
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
82
|
});
|