@plait/core 0.2.1 → 0.2.3
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/board/board.component.d.ts +2 -2
- package/core/element/context.d.ts +1 -0
- package/esm2020/board/board.component.mjs +18 -14
- package/esm2020/core/element/context.mjs +1 -1
- package/esm2020/core/element/element.component.mjs +2 -1
- package/esm2020/plait.module.mjs +5 -5
- package/fesm2015/plait-core.mjs +22 -17
- package/fesm2015/plait-core.mjs.map +1 -1
- package/fesm2020/plait-core.mjs +22 -17
- package/fesm2020/plait-core.mjs.map +1 -1
- package/package.json +1 -1
- package/plait.module.d.ts +2 -2
package/fesm2020/plait-core.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { takeUntil, filter } from 'rxjs/operators';
|
|
|
6
6
|
import produce, { createDraft, finishDraft, isDraft } from 'immer';
|
|
7
7
|
import { isKeyHotkey, isHotkey } from 'is-hotkey';
|
|
8
8
|
import * as i1 from '@angular/common';
|
|
9
|
-
import {
|
|
9
|
+
import { CommonModule } from '@angular/common';
|
|
10
10
|
|
|
11
11
|
// record richtext type status
|
|
12
12
|
const IS_BOARD_CACHE = new WeakMap();
|
|
@@ -2086,6 +2086,7 @@ class PlaitElementComponent {
|
|
|
2086
2086
|
const isSelected = isSelectedElement(this.board, this.element);
|
|
2087
2087
|
const context = {
|
|
2088
2088
|
element: this.element,
|
|
2089
|
+
parent: this.parent,
|
|
2089
2090
|
board: this.board,
|
|
2090
2091
|
selected: isSelected,
|
|
2091
2092
|
effect: this.effect
|
|
@@ -2266,16 +2267,20 @@ class PlaitBoardComponent {
|
|
|
2266
2267
|
});
|
|
2267
2268
|
this.roughSVG = roughSVG;
|
|
2268
2269
|
this.initializePlugins();
|
|
2269
|
-
this.
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2270
|
+
this.ngZone.runOutsideAngular(() => {
|
|
2271
|
+
this.initializeHookListener();
|
|
2272
|
+
this.viewportScrollListener();
|
|
2273
|
+
this.elementResizeListener();
|
|
2274
|
+
this.mouseLeaveListener();
|
|
2275
|
+
});
|
|
2273
2276
|
BOARD_TO_COMPONENT.set(this.board, this);
|
|
2274
2277
|
BOARD_TO_ROUGH_SVG.set(this.board, roughSVG);
|
|
2275
2278
|
BOARD_TO_HOST.set(this.board, this.host);
|
|
2276
2279
|
BOARD_TO_ELEMENT_HOST.set(this.board, elementHost);
|
|
2277
2280
|
BOARD_TO_ON_CHANGE.set(this.board, () => {
|
|
2278
|
-
this.
|
|
2281
|
+
this.ngZone.run(() => {
|
|
2282
|
+
this.detect();
|
|
2283
|
+
});
|
|
2279
2284
|
const changeEvent = {
|
|
2280
2285
|
children: this.board.children,
|
|
2281
2286
|
operations: this.board.operations,
|
|
@@ -2290,13 +2295,6 @@ class PlaitBoardComponent {
|
|
|
2290
2295
|
this.effect = {};
|
|
2291
2296
|
this.cdr.detectChanges();
|
|
2292
2297
|
}
|
|
2293
|
-
mouseLeaveListener() {
|
|
2294
|
-
fromEvent(this.host, 'mouseleave')
|
|
2295
|
-
.pipe(takeUntil(this.destroy$))
|
|
2296
|
-
.subscribe((event) => {
|
|
2297
|
-
BOARD_TO_MOVING_POINT.delete(this.board);
|
|
2298
|
-
});
|
|
2299
|
-
}
|
|
2300
2298
|
ngOnChanges(changes) {
|
|
2301
2299
|
if (this.hasInitialized) {
|
|
2302
2300
|
const valueChange = changes['plaitValue'];
|
|
@@ -2324,7 +2322,7 @@ class PlaitBoardComponent {
|
|
|
2324
2322
|
this.board.viewport = this.plaitViewport;
|
|
2325
2323
|
}
|
|
2326
2324
|
}
|
|
2327
|
-
|
|
2325
|
+
initializeHookListener() {
|
|
2328
2326
|
fromEvent(this.host, 'mousedown')
|
|
2329
2327
|
.pipe(takeUntil(this.destroy$))
|
|
2330
2328
|
.subscribe((event) => {
|
|
@@ -2429,6 +2427,13 @@ class PlaitBoardComponent {
|
|
|
2429
2427
|
});
|
|
2430
2428
|
this.resizeObserver.observe(this.nativeElement);
|
|
2431
2429
|
}
|
|
2430
|
+
mouseLeaveListener() {
|
|
2431
|
+
fromEvent(this.host, 'mouseleave')
|
|
2432
|
+
.pipe(takeUntil(this.destroy$))
|
|
2433
|
+
.subscribe((event) => {
|
|
2434
|
+
BOARD_TO_MOVING_POINT.delete(this.board);
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2432
2437
|
adaptHandle() {
|
|
2433
2438
|
fitViewport(this.board);
|
|
2434
2439
|
}
|
|
@@ -2529,13 +2534,13 @@ const COMPONENTS = [PlaitBoardComponent, PlaitChildrenElement, PlaitElementCompo
|
|
|
2529
2534
|
class PlaitModule {
|
|
2530
2535
|
}
|
|
2531
2536
|
PlaitModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: PlaitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2532
|
-
PlaitModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: PlaitModule, declarations: [PlaitBoardComponent, PlaitChildrenElement, PlaitElementComponent, PlaitToolbarComponent], imports: [
|
|
2533
|
-
PlaitModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: PlaitModule, imports: [
|
|
2537
|
+
PlaitModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: PlaitModule, declarations: [PlaitBoardComponent, PlaitChildrenElement, PlaitElementComponent, PlaitToolbarComponent], imports: [CommonModule], exports: [PlaitBoardComponent, PlaitChildrenElement, PlaitElementComponent, PlaitToolbarComponent] });
|
|
2538
|
+
PlaitModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: PlaitModule, imports: [CommonModule] });
|
|
2534
2539
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: PlaitModule, decorators: [{
|
|
2535
2540
|
type: NgModule,
|
|
2536
2541
|
args: [{
|
|
2537
2542
|
declarations: [...COMPONENTS],
|
|
2538
|
-
imports: [
|
|
2543
|
+
imports: [CommonModule],
|
|
2539
2544
|
exports: [...COMPONENTS]
|
|
2540
2545
|
}]
|
|
2541
2546
|
}] });
|