@leafer-in/editor 2.0.2 → 2.0.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/dist/editor.cjs +13 -6
- package/dist/editor.esm.js +13 -6
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.esm.min.js.map +1 -1
- package/dist/editor.js +13 -6
- package/dist/editor.min.cjs +1 -1
- package/dist/editor.min.cjs.map +1 -1
- package/dist/editor.min.js +1 -1
- package/dist/editor.min.js.map +1 -1
- package/package.json +6 -6
- package/src/decorator/data.ts +10 -3
- package/src/display/EditBox.ts +7 -4
- package/src/tool/InnerEditor.ts +3 -1
- package/types/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "@leafer-in/editor",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"leaferjs"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@leafer-ui/draw": "^2.0.
|
|
38
|
-
"@leafer-ui/core": "^2.0.
|
|
39
|
-
"@leafer-in/resize": "^2.0.
|
|
40
|
-
"@leafer-ui/interface": "^2.0.
|
|
41
|
-
"@leafer-in/interface": "^2.0.
|
|
37
|
+
"@leafer-ui/draw": "^2.0.3",
|
|
38
|
+
"@leafer-ui/core": "^2.0.3",
|
|
39
|
+
"@leafer-in/resize": "^2.0.3",
|
|
40
|
+
"@leafer-ui/interface": "^2.0.3",
|
|
41
|
+
"@leafer-in/interface": "^2.0.3"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/decorator/data.ts
CHANGED
|
@@ -28,8 +28,11 @@ export function targetAttr(fn: IFunction) {
|
|
|
28
28
|
else if (check === false) return
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
t.
|
|
32
|
-
|
|
31
|
+
const { dimOthers, bright } = t.editBox.mergedConfig || t.config // 没有配置时不强制取消bright
|
|
32
|
+
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
33
|
+
t.setDimOthers(false)
|
|
34
|
+
t.setBright(false)
|
|
35
|
+
}
|
|
33
36
|
|
|
34
37
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1) // fix: 单个锁定 + shift多选
|
|
35
38
|
if (t.single) {
|
|
@@ -54,7 +57,11 @@ export function mergeConfigAttr() {
|
|
|
54
57
|
return (target: IEditor, key: string) => {
|
|
55
58
|
defineKey(target, key, {
|
|
56
59
|
get() {
|
|
57
|
-
const { config, element, dragPoint, editBox, app } = this, mergeConfig = { ...config } // 实时合并,后期可优化
|
|
60
|
+
const { config, element, dragPoint, editBox, editTool, innerEditor, app } = this, mergeConfig = { ...config } // 实时合并,后期可优化
|
|
61
|
+
|
|
62
|
+
if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig) // innerEditor 上的配置
|
|
63
|
+
else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig) // editTool 上的配置
|
|
64
|
+
|
|
58
65
|
if (element && element.editConfig) {
|
|
59
66
|
let { editConfig } = element
|
|
60
67
|
if (editConfig.hover || editConfig.hoverStyle) { // 元素的hover样式,不能覆盖到总配置里
|
package/src/display/EditBox.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRect, IEventListenerId, IBoundsData, IPointData, IKeyEvent, IGroup, IBox, IBoxInputData, IAlign, IUI, IEditorConfig, IEditorDragStartData, ITransformTool, IUIEvent, IEditPointInputData } from '@leafer-ui/interface'
|
|
2
|
-
import { Group, Text, AroundHelper, Direction9, ResizeEvent, BoundsHelper, DataHelper, isArray, isString, isNumber, isNull, getPointData } from '@leafer-ui/draw'
|
|
2
|
+
import { Group, Text, AroundHelper, Direction9, ResizeEvent, BoundsHelper, DataHelper, isArray, isString, isNumber, isNull, getPointData, isUndefined } from '@leafer-ui/draw'
|
|
3
3
|
import { DragEvent, PointerEvent, KeyEvent, RotateEvent, ZoomEvent, MoveEvent } from '@leafer-ui/core'
|
|
4
4
|
|
|
5
5
|
import { IEditBox, IEditor, IEditPoint, IEditPointType } from '@leafer-in/interface'
|
|
@@ -171,8 +171,10 @@ export class EditBox extends Group implements IEditBox {
|
|
|
171
171
|
|
|
172
172
|
editMask.visible = mask ? true : 0
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
if (!isUndefined(dimOthers) || !isUndefined(bright)) { // 没有配置时不强制bright
|
|
175
|
+
editor.setDimOthers(dimOthers)
|
|
176
|
+
editor.setBright(!!dimOthers || bright)
|
|
177
|
+
}
|
|
176
178
|
|
|
177
179
|
if (spread) BoundsHelper.spread(bounds, spread)
|
|
178
180
|
|
|
@@ -201,7 +203,8 @@ export class EditBox extends Group implements IEditBox {
|
|
|
201
203
|
resizeL.set(point)
|
|
202
204
|
|
|
203
205
|
resizeL.visible = resizeP.visible && !hideResizeLines
|
|
204
|
-
resizeP.visible
|
|
206
|
+
if (resizeP.visible) resizeP.visible = !!middlePoint
|
|
207
|
+
if (rotateP.visible) rotateP.visible = !!middlePoint
|
|
205
208
|
|
|
206
209
|
if (((i + 1) / 2) % 2) { // top, bottom
|
|
207
210
|
resizeL.width = width + resizeL.height
|
package/src/tool/InnerEditor.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IGroup, IEventListenerId, IUI, IObject } from '@leafer-ui/interface'
|
|
1
|
+
import { IGroup, IEventListenerId, IUI, IObject, IEditorConfig } from '@leafer-ui/interface'
|
|
2
2
|
import { IInnerEditor, IEditor, IEditBox, IInnerEditorMode } from '@leafer-in/interface'
|
|
3
3
|
|
|
4
4
|
import { Group } from '@leafer-ui/draw'
|
|
@@ -19,6 +19,8 @@ export class InnerEditor implements IInnerEditor {
|
|
|
19
19
|
|
|
20
20
|
public config: IObject
|
|
21
21
|
|
|
22
|
+
public editConfig?: IEditorConfig
|
|
23
|
+
|
|
22
24
|
public editor: IEditor
|
|
23
25
|
|
|
24
26
|
protected _editBox: IEditBox
|
package/types/index.d.ts
CHANGED