@tmagic/editor 1.3.0-alpha.6 → 1.3.0-alpha.7
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/style.css +3 -0
- package/dist/tmagic-editor.js +407 -243
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +409 -244
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/Editor.vue +3 -0
- package/src/components/ContentMenu.vue +15 -8
- package/src/components/FunctionEditor.vue +6 -4
- package/src/fields/CodeLink.vue +4 -2
- package/src/index.ts +3 -2
- package/src/initService.ts +2 -0
- package/src/layouts/Framework.vue +3 -2
- package/src/layouts/sidebar/LayerPanel.vue +50 -31
- package/src/layouts/workspace/Stage.vue +13 -3
- package/src/layouts/workspace/Workspace.vue +2 -2
- package/src/services/codeBlock.ts +3 -2
- package/src/services/keybinding.ts +148 -203
- package/src/services/storage.ts +3 -2
- package/src/theme/stage.scss +4 -0
- package/src/type.ts +56 -0
- package/src/utils/config.ts +1 -1
- package/src/utils/keybinding-config.ts +120 -0
- package/types/components/ContentMenu.vue.d.ts +2 -0
- package/types/index.d.ts +1 -1
- package/types/initService.d.ts +1 -1
- package/types/layouts/workspace/Workspace.vue.d.ts +1 -1
- package/types/services/keybinding.d.ts +13 -5
- package/types/type.d.ts +53 -0
- package/types/utils/config.d.ts +1 -1
- package/types/utils/keybinding-config.d.ts +3 -0
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import { KeyBindingItem } from '../type';
|
|
1
2
|
import BaseService from './BaseService';
|
|
2
3
|
declare class Keybinding extends BaseService {
|
|
3
|
-
|
|
4
|
-
private
|
|
5
|
-
|
|
4
|
+
ctrlKey: string;
|
|
5
|
+
private controllers;
|
|
6
|
+
private bindingList;
|
|
7
|
+
private commands;
|
|
8
|
+
registeCommand(command: string, handler: (e: KeyboardEvent) => void | Promise<void>): void;
|
|
9
|
+
unregisteCommand(command: string): void;
|
|
10
|
+
registeEl(name: string, el?: HTMLElement): void;
|
|
11
|
+
unregisteEl(name: string): void;
|
|
12
|
+
registe(maps: KeyBindingItem[]): void;
|
|
13
|
+
reset(): void;
|
|
6
14
|
destroy(): void;
|
|
7
|
-
private
|
|
8
|
-
private
|
|
15
|
+
private bind;
|
|
16
|
+
private getKeyconKeys;
|
|
9
17
|
}
|
|
10
18
|
export type KeybindingService = Keybinding;
|
|
11
19
|
declare const _default: Keybinding;
|
package/types/type.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import type { UndoRedo } from './utils/undo-redo';
|
|
|
18
18
|
export type BeforeAdd = (config: MNode, parent: MContainer) => Promise<MNode> | MNode;
|
|
19
19
|
export type GetConfig = (config: FormConfig) => Promise<FormConfig> | FormConfig;
|
|
20
20
|
export interface InstallOptions {
|
|
21
|
+
parseDSL: (dsl: string) => MApp;
|
|
21
22
|
[key: string]: any;
|
|
22
23
|
}
|
|
23
24
|
export interface Services {
|
|
@@ -346,3 +347,55 @@ export interface EventSelectConfig {
|
|
|
346
347
|
/** 联动代码配置 */
|
|
347
348
|
codeActionConfig?: FormItem;
|
|
348
349
|
}
|
|
350
|
+
export declare enum KeyBindingCommand {
|
|
351
|
+
/** 复制 */
|
|
352
|
+
COPY_NODE = "tmagic-system-copy-node",
|
|
353
|
+
/** 粘贴 */
|
|
354
|
+
PASTE_NODE = "tmagic-system-paste-node",
|
|
355
|
+
/** 删除 */
|
|
356
|
+
DELETE_NODE = "tmagic-system-delete-node",
|
|
357
|
+
/** 剪切 */
|
|
358
|
+
CUT_NODE = "tmagic-system-cut-node",
|
|
359
|
+
/** 撤销 */
|
|
360
|
+
UNDO = "tmagic-system-undo",
|
|
361
|
+
/** 重做 */
|
|
362
|
+
REDO = "tmagic-system-redo",
|
|
363
|
+
/** 放大 */
|
|
364
|
+
ZOOM_IN = "tmagic-system-zoom-in",
|
|
365
|
+
/** 缩小 */
|
|
366
|
+
ZOOM_OUT = "tmagic-system-zoom-out",
|
|
367
|
+
/** 缩放到实际大小 */
|
|
368
|
+
ZOOM_RESET = "tmagic-system-zoom-reset",
|
|
369
|
+
/** 缩放以适应 */
|
|
370
|
+
ZOOM_FIT = "tmagic-system-zoom-fit",
|
|
371
|
+
/** 向上移动1px */
|
|
372
|
+
MOVE_UP_1 = "tmagic-system-move-up-1",
|
|
373
|
+
/** 向下移动1px */
|
|
374
|
+
MOVE_DOWN_1 = "tmagic-system-move-down-1",
|
|
375
|
+
/** 向左移动1px */
|
|
376
|
+
MOVE_LEFT_1 = "tmagic-system-move-left-1",
|
|
377
|
+
/** 向右移动1px */
|
|
378
|
+
MOVE_RIGHT_1 = "tmagic-system-move-right-1",
|
|
379
|
+
/** 向上移动10px */
|
|
380
|
+
MOVE_UP_10 = "tmagic-system-move-up-10",
|
|
381
|
+
/** 向下移动10px */
|
|
382
|
+
MOVE_DOWN_10 = "tmagic-system-move-down-10",
|
|
383
|
+
/** 向左移动10px */
|
|
384
|
+
MOVE_LEFT_10 = "tmagic-system-move-left-10",
|
|
385
|
+
/** 向右移动10px */
|
|
386
|
+
MOVE_RIGHT_10 = "tmagic-system-move-right-10",
|
|
387
|
+
/** 切换组件 */
|
|
388
|
+
SWITCH_NODE = "tmagic-system-switch-node"
|
|
389
|
+
}
|
|
390
|
+
export interface KeyBindingItem {
|
|
391
|
+
command: KeyBindingCommand | string;
|
|
392
|
+
keybinding?: string | string[];
|
|
393
|
+
when: [string, 'keyup' | 'keydown'][];
|
|
394
|
+
}
|
|
395
|
+
export interface KeyBindingCacheItem {
|
|
396
|
+
type: string;
|
|
397
|
+
command: KeyBindingCommand | string;
|
|
398
|
+
keybinding?: string | string[];
|
|
399
|
+
eventType: 'keyup' | 'keydown';
|
|
400
|
+
binded: boolean;
|
|
401
|
+
}
|
package/types/utils/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { InstallOptions } from '../type';
|
|
2
2
|
declare const setConfig: (option: InstallOptions) => void;
|
|
3
|
-
declare const getConfig: (key:
|
|
3
|
+
declare const getConfig: <K extends keyof InstallOptions>(key: K) => InstallOptions[K];
|
|
4
4
|
export { getConfig, setConfig };
|