@tmagic/editor 1.0.0-beta.13 → 1.0.0-beta.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/coverage/clover.xml +703 -601
- package/coverage/coverage-final.json +35 -33
- package/coverage/lcov-report/index.html +56 -56
- package/coverage/lcov-report/src/Editor.vue.html +1 -1
- package/coverage/lcov-report/{layouts/sidebar/LayerMenu.vue.html → src/components/ContentMenu.vue.html} +137 -95
- package/coverage/lcov-report/src/components/Icon.vue.html +5 -5
- package/coverage/lcov-report/src/components/ScrollViewer.vue.html +1 -1
- package/coverage/lcov-report/src/components/ToolButton.vue.html +180 -63
- package/coverage/lcov-report/src/components/index.html +34 -19
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/Framework.vue.html +13 -13
- package/coverage/lcov-report/src/layouts/NavMenu.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/Resizer.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/index.html +15 -15
- package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +78 -12
- package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +149 -92
- package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +43 -121
- package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +23 -140
- package/coverage/lcov-report/{utils/undo-redo.ts.html → src/layouts/sidebar/TabPane.vue.html} +94 -118
- package/coverage/lcov-report/src/layouts/sidebar/index.html +64 -49
- package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +99 -12
- package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +86 -95
- package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +208 -97
- package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +3 -3
- package/coverage/lcov-report/src/layouts/workspace/index.html +35 -35
- package/coverage/lcov-report/src/services/BaseService.ts.html +11 -11
- package/coverage/lcov-report/src/services/componentList.ts.html +1 -1
- package/coverage/lcov-report/src/services/editor.ts.html +103 -10
- package/coverage/lcov-report/src/services/events.ts.html +1 -1
- package/coverage/lcov-report/src/services/history.ts.html +29 -8
- package/coverage/lcov-report/src/services/index.html +25 -25
- package/coverage/lcov-report/src/services/props.ts.html +4 -7
- package/coverage/lcov-report/src/services/ui.ts.html +1 -1
- package/coverage/lcov-report/src/type.ts.html +8 -14
- package/coverage/lcov-report/src/utils/compose.ts.html +4 -4
- package/coverage/lcov-report/src/utils/config.ts.html +1 -1
- package/coverage/lcov-report/src/utils/editor.ts.html +2 -2
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov-report/src/utils/index.ts.html +1 -1
- package/coverage/lcov-report/src/utils/logger.ts.html +1 -1
- package/coverage/lcov-report/src/utils/props.ts.html +59 -2
- package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +1 -1
- package/coverage/lcov-report/src/utils/undo-redo.ts.html +1 -1
- package/coverage/lcov.info +1679 -1402
- package/dist/style.css +47 -20
- package/dist/tmagic-editor.es.js +732 -485
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +733 -485
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/dist/types/src/Editor.vue.d.ts +1 -1
- package/dist/types/src/components/ToolButton.vue.d.ts +12 -1
- package/dist/types/src/fields/UISelect.vue.d.ts +4 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/layouts/CodeEditor.vue.d.ts +13 -4
- package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -0
- package/dist/types/src/layouts/sidebar/Sidebar.vue.d.ts +2 -3
- package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +14 -0
- package/dist/types/src/layouts/workspace/PageBar.vue.d.ts +2 -0
- package/dist/types/src/services/history.d.ts +1 -0
- package/dist/types/src/services/props.d.ts +2 -2
- package/dist/types/src/type.d.ts +6 -8
- package/dist/types/src/utils/polyfills.d.ts +0 -0
- package/package.json +15 -10
- package/src/components/ContentMenu.vue +107 -0
- package/src/components/ToolButton.vue +66 -27
- package/src/fields/UISelect.vue +14 -6
- package/src/index.ts +2 -0
- package/src/layouts/CodeEditor.vue +20 -10
- package/src/layouts/Framework.vue +6 -6
- package/src/layouts/sidebar/ComponentListPanel.vue +23 -1
- package/src/layouts/sidebar/LayerMenu.vue +91 -72
- package/src/layouts/sidebar/LayerPanel.vue +23 -49
- package/src/layouts/sidebar/Sidebar.vue +13 -52
- package/src/layouts/sidebar/TabPane.vue +68 -0
- package/src/layouts/workspace/PageBar.vue +35 -6
- package/src/layouts/workspace/Stage.vue +41 -44
- package/src/layouts/workspace/ViewerMenu.vue +104 -67
- package/src/layouts/workspace/Workspace.vue +2 -2
- package/src/services/editor.ts +33 -2
- package/src/services/history.ts +7 -0
- package/src/services/props.ts +2 -3
- package/src/theme/common/var.scss +1 -0
- package/src/theme/component-list-panel.scss +2 -0
- package/src/theme/content-menu.scss +33 -26
- package/src/theme/layer-panel.scss +1 -1
- package/src/theme/nav-menu.scss +6 -2
- package/src/theme/page-bar.scss +22 -1
- package/src/theme/props-panel.scss +4 -0
- package/src/type.ts +6 -8
- package/src/utils/editor.ts +1 -1
- package/src/utils/polyfills.ts +22 -0
- package/src/utils/props.ts +19 -0
- package/coverage/lcov-report/Icon.vue.html +0 -172
- package/coverage/lcov-report/ToolButton.vue.html +0 -655
- package/coverage/lcov-report/layouts/sidebar/index.html +0 -116
- package/coverage/lcov-report/utils/index.html +0 -116
- package/dist/types/src/layouts/sidebar/LayerPanel.vue.d.ts +0 -980
- package/dist/types/src/layouts/workspace/Stage.vue.d.ts +0 -188
- package/dist/types/src/layouts/workspace/ViewerMenu.vue.d.ts +0 -18
package/src/theme/page-bar.scss
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
z-index: 1;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
&-title {
|
|
44
44
|
max-width: 150px;
|
|
45
45
|
text-overflow: ellipsis;
|
|
46
46
|
white-space: nowrap;
|
|
@@ -48,3 +48,24 @@
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
.page-bar-popover {
|
|
53
|
+
&.el-popper.el-popover {
|
|
54
|
+
padding: 10px 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.menu-item {
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: all 0.2s ease 0s;
|
|
60
|
+
padding: 5px 14px;
|
|
61
|
+
|
|
62
|
+
.el-button--text,
|
|
63
|
+
i {
|
|
64
|
+
color: $--font-color;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&:hover {
|
|
68
|
+
background-color: $--hover-color;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
package/src/type.ts
CHANGED
|
@@ -53,6 +53,7 @@ export interface StoreState {
|
|
|
53
53
|
highlightNode: MNode | null;
|
|
54
54
|
stage: StageCore | null;
|
|
55
55
|
modifiedNodeIds: Map<Id, Id>;
|
|
56
|
+
pageLength: number;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export interface PropsState {
|
|
@@ -125,6 +126,8 @@ export interface MenuButton {
|
|
|
125
126
|
* zoom: 放大缩小
|
|
126
127
|
*/
|
|
127
128
|
type: 'button' | 'dropdown' | 'text' | 'divider' | 'zoom';
|
|
129
|
+
/** 当type为divider时有效,分割线方向, 默认vertical */
|
|
130
|
+
direction?: 'horizontal' | 'vertical';
|
|
128
131
|
/** 展示的文案 */
|
|
129
132
|
text?: string;
|
|
130
133
|
/** 鼠标悬浮是显示的气泡中的文案 */
|
|
@@ -136,14 +139,9 @@ export interface MenuButton {
|
|
|
136
139
|
/** 是否显示,默认为true */
|
|
137
140
|
display?: boolean | ((data?: Services) => boolean);
|
|
138
141
|
/** type为button/dropdown时点击运行的方法 */
|
|
139
|
-
handler?: (data
|
|
140
|
-
/** type为dropdown
|
|
141
|
-
items?:
|
|
142
|
-
/** 展示的文案 */
|
|
143
|
-
text: string;
|
|
144
|
-
/** 点击运行的方法 */
|
|
145
|
-
handler(data: Services): any;
|
|
146
|
-
}[];
|
|
142
|
+
handler?: (data: Services, event: MouseEvent) => Promise<any> | any;
|
|
143
|
+
/** type为dropdown时,下拉的菜单列表, 或者有子菜单时 */
|
|
144
|
+
items?: MenuButton[];
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
export interface MenuComponent {
|
package/src/utils/editor.ts
CHANGED
|
@@ -144,7 +144,7 @@ const setTop2Middle = (node: MNode, parentNode: MNode, stage: StageCore) => {
|
|
|
144
144
|
const style = node.style || {};
|
|
145
145
|
const height = style.height || 0;
|
|
146
146
|
|
|
147
|
-
if (!stage || style.top || !parentNode.style || !isNumber(height)) return style;
|
|
147
|
+
if (!stage || typeof style.top !== 'undefined' || !parentNode.style || !isNumber(height)) return style;
|
|
148
148
|
|
|
149
149
|
const { height: parentHeight } = parentNode.style;
|
|
150
150
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making TMagicEditor available.
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// serialize-javascript 依赖的 randombytes 依赖全局的 global 对象,因此此处需添加 global polyfill
|
|
20
|
+
if (typeof (window as any).global === 'undefined') {
|
|
21
|
+
(window as any).global = window;
|
|
22
|
+
}
|
package/src/utils/props.ts
CHANGED
|
@@ -142,6 +142,25 @@ export const fillConfig = (config: FormConfig = []) => [
|
|
|
142
142
|
},
|
|
143
143
|
],
|
|
144
144
|
},
|
|
145
|
+
{
|
|
146
|
+
type: 'fieldset',
|
|
147
|
+
legend: '字体',
|
|
148
|
+
items: [
|
|
149
|
+
{
|
|
150
|
+
name: 'color',
|
|
151
|
+
text: '颜色',
|
|
152
|
+
type: 'colorPicker',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'fontSize',
|
|
156
|
+
text: '大小',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'fontWeight',
|
|
160
|
+
text: '粗细',
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
},
|
|
145
164
|
],
|
|
146
165
|
},
|
|
147
166
|
],
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!doctype html>
|
|
3
|
-
<html lang="en">
|
|
4
|
-
|
|
5
|
-
<head>
|
|
6
|
-
<title>Code coverage report for Icon.vue</title>
|
|
7
|
-
<meta charset="utf-8" />
|
|
8
|
-
<link rel="stylesheet" href="prettify.css" />
|
|
9
|
-
<link rel="stylesheet" href="base.css" />
|
|
10
|
-
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
|
11
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
-
<style type='text/css'>
|
|
13
|
-
.coverage-summary .sorter {
|
|
14
|
-
background-image: url(sort-arrow-sprite.png);
|
|
15
|
-
}
|
|
16
|
-
</style>
|
|
17
|
-
</head>
|
|
18
|
-
|
|
19
|
-
<body>
|
|
20
|
-
<div class='wrapper'>
|
|
21
|
-
<div class='pad1'>
|
|
22
|
-
<h1><a href="index.html">All files</a> Icon.vue</h1>
|
|
23
|
-
<div class='clearfix'>
|
|
24
|
-
|
|
25
|
-
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">100% </span>
|
|
27
|
-
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>4/4</span>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">100% </span>
|
|
34
|
-
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>0/0</span>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">100% </span>
|
|
41
|
-
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>1/1</span>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">100% </span>
|
|
48
|
-
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>4/4</span>
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</div>
|
|
54
|
-
<p class="quiet">
|
|
55
|
-
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
-
</p>
|
|
57
|
-
<template id="filterTemplate">
|
|
58
|
-
<div class="quiet">
|
|
59
|
-
Filter:
|
|
60
|
-
<input oninput="onInput()" type="search" id="fileSearch">
|
|
61
|
-
</div>
|
|
62
|
-
</template>
|
|
63
|
-
</div>
|
|
64
|
-
<div class='status-line high'></div>
|
|
65
|
-
<pre><table class="coverage">
|
|
66
|
-
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
|
-
<a name='L2'></a><a href='#L2'>2</a>
|
|
68
|
-
<a name='L3'></a><a href='#L3'>3</a>
|
|
69
|
-
<a name='L4'></a><a href='#L4'>4</a>
|
|
70
|
-
<a name='L5'></a><a href='#L5'>5</a>
|
|
71
|
-
<a name='L6'></a><a href='#L6'>6</a>
|
|
72
|
-
<a name='L7'></a><a href='#L7'>7</a>
|
|
73
|
-
<a name='L8'></a><a href='#L8'>8</a>
|
|
74
|
-
<a name='L9'></a><a href='#L9'>9</a>
|
|
75
|
-
<a name='L10'></a><a href='#L10'>10</a>
|
|
76
|
-
<a name='L11'></a><a href='#L11'>11</a>
|
|
77
|
-
<a name='L12'></a><a href='#L12'>12</a>
|
|
78
|
-
<a name='L13'></a><a href='#L13'>13</a>
|
|
79
|
-
<a name='L14'></a><a href='#L14'>14</a>
|
|
80
|
-
<a name='L15'></a><a href='#L15'>15</a>
|
|
81
|
-
<a name='L16'></a><a href='#L16'>16</a>
|
|
82
|
-
<a name='L17'></a><a href='#L17'>17</a>
|
|
83
|
-
<a name='L18'></a><a href='#L18'>18</a>
|
|
84
|
-
<a name='L19'></a><a href='#L19'>19</a>
|
|
85
|
-
<a name='L20'></a><a href='#L20'>20</a>
|
|
86
|
-
<a name='L21'></a><a href='#L21'>21</a>
|
|
87
|
-
<a name='L22'></a><a href='#L22'>22</a>
|
|
88
|
-
<a name='L23'></a><a href='#L23'>23</a>
|
|
89
|
-
<a name='L24'></a><a href='#L24'>24</a>
|
|
90
|
-
<a name='L25'></a><a href='#L25'>25</a>
|
|
91
|
-
<a name='L26'></a><a href='#L26'>26</a>
|
|
92
|
-
<a name='L27'></a><a href='#L27'>27</a>
|
|
93
|
-
<a name='L28'></a><a href='#L28'>28</a>
|
|
94
|
-
<a name='L29'></a><a href='#L29'>29</a>
|
|
95
|
-
<a name='L30'></a><a href='#L30'>30</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
96
|
-
<span class="cline-any cline-neutral"> </span>
|
|
97
|
-
<span class="cline-any cline-neutral"> </span>
|
|
98
|
-
<span class="cline-any cline-neutral"> </span>
|
|
99
|
-
<span class="cline-any cline-neutral"> </span>
|
|
100
|
-
<span class="cline-any cline-neutral"> </span>
|
|
101
|
-
<span class="cline-any cline-neutral"> </span>
|
|
102
|
-
<span class="cline-any cline-neutral"> </span>
|
|
103
|
-
<span class="cline-any cline-yes">1x</span>
|
|
104
|
-
<span class="cline-any cline-yes">1x</span>
|
|
105
|
-
<span class="cline-any cline-neutral"> </span>
|
|
106
|
-
<span class="cline-any cline-yes">1x</span>
|
|
107
|
-
<span class="cline-any cline-neutral"> </span>
|
|
108
|
-
<span class="cline-any cline-neutral"> </span>
|
|
109
|
-
<span class="cline-any cline-neutral"> </span>
|
|
110
|
-
<span class="cline-any cline-neutral"> </span>
|
|
111
|
-
<span class="cline-any cline-neutral"> </span>
|
|
112
|
-
<span class="cline-any cline-neutral"> </span>
|
|
113
|
-
<span class="cline-any cline-neutral"> </span>
|
|
114
|
-
<span class="cline-any cline-neutral"> </span>
|
|
115
|
-
<span class="cline-any cline-neutral"> </span>
|
|
116
|
-
<span class="cline-any cline-neutral"> </span>
|
|
117
|
-
<span class="cline-any cline-neutral"> </span>
|
|
118
|
-
<span class="cline-any cline-yes">1x</span>
|
|
119
|
-
<span class="cline-any cline-neutral"> </span>
|
|
120
|
-
<span class="cline-any cline-neutral"> </span>
|
|
121
|
-
<span class="cline-any cline-neutral"> </span>
|
|
122
|
-
<span class="cline-any cline-neutral"> </span>
|
|
123
|
-
<span class="cline-any cline-neutral"> </span>
|
|
124
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"><template>
|
|
125
|
-
<el-icon v-if="!icon"><edit></edit></el-icon>
|
|
126
|
-
<img v-else-if="typeof icon === 'string' && icon.startsWith('http')" :src="icon" />
|
|
127
|
-
<i v-else-if="typeof icon === 'string'" :class="icon"></i>
|
|
128
|
-
<el-icon v-else><component :is="toRaw(icon)"></component></el-icon>
|
|
129
|
-
</template>
|
|
130
|
-
|
|
131
|
-
<script lang="ts">
|
|
132
|
-
import { Component, defineComponent, PropType, toRaw } from 'vue';
|
|
133
|
-
import { Edit } from '@element-plus/icons';
|
|
134
|
-
|
|
135
|
-
export default defineComponent({
|
|
136
|
-
name: 'm-icon',
|
|
137
|
-
|
|
138
|
-
components: { Edit },
|
|
139
|
-
|
|
140
|
-
props: {
|
|
141
|
-
icon: {
|
|
142
|
-
type: [String, Object] as PropType<string | Component>,
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
setup() {
|
|
147
|
-
return {
|
|
148
|
-
toRaw,
|
|
149
|
-
};
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
</script>
|
|
153
|
-
</pre></td></tr></table></pre>
|
|
154
|
-
|
|
155
|
-
<div class='push'></div><!-- for sticky footer -->
|
|
156
|
-
</div><!-- /wrapper -->
|
|
157
|
-
<div class='footer quiet pad2 space-top1 center small'>
|
|
158
|
-
Code coverage generated by
|
|
159
|
-
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
160
|
-
at Fri Apr 22 2022 12:07:07 GMT+0800 (China Standard Time)
|
|
161
|
-
</div>
|
|
162
|
-
<script src="prettify.js"></script>
|
|
163
|
-
<script>
|
|
164
|
-
window.onload = function () {
|
|
165
|
-
prettyPrint();
|
|
166
|
-
};
|
|
167
|
-
</script>
|
|
168
|
-
<script src="sorter.js"></script>
|
|
169
|
-
<script src="block-navigation.js"></script>
|
|
170
|
-
</body>
|
|
171
|
-
</html>
|
|
172
|
-
|