fix(embed): 大小不能拖动
This commit is contained in:
parent
95315707bf
commit
6da6466cc9
|
@ -413,7 +413,10 @@ class CardModel implements CardModelInterface {
|
||||||
card.activate(true);
|
card.activate(true);
|
||||||
} else if (card.isEditable) {
|
} else if (card.isEditable) {
|
||||||
card.select(false);
|
card.select(false);
|
||||||
} else if (trigger === CardActiveTrigger.MOUSE_DOWN) {
|
} else if (
|
||||||
|
trigger === CardActiveTrigger.MOUSE_DOWN &&
|
||||||
|
node.name !== 'input'
|
||||||
|
) {
|
||||||
event?.preventDefault();
|
event?.preventDefault();
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -16,6 +16,7 @@ class Resize implements ResizeInterface {
|
||||||
private point?: { x: number; y: number };
|
private point?: { x: number; y: number };
|
||||||
private options: ResizeCreateOptions = {};
|
private options: ResizeCreateOptions = {};
|
||||||
private component?: NodeInterface;
|
private component?: NodeInterface;
|
||||||
|
private start: boolean = false;
|
||||||
|
|
||||||
constructor(editor: EditorInterface, card: CardInterface) {
|
constructor(editor: EditorInterface, card: CardInterface) {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
|
@ -44,16 +45,17 @@ class Resize implements ResizeInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
render(container: NodeInterface = this.card.root, minHeight: number = 80) {
|
render(container: NodeInterface = this.card.root, minHeight: number = 80) {
|
||||||
let start: boolean = false;
|
this.start = false;
|
||||||
let height: number = 0,
|
let height: number = 0,
|
||||||
moveHeight: number = 0;
|
moveHeight: number = 0;
|
||||||
this.create({
|
this.create({
|
||||||
dragStart: () => {
|
dragStart: () => {
|
||||||
height = container.height();
|
height = container.height();
|
||||||
start = true;
|
this.start = true;
|
||||||
|
this.card.onActivate(false);
|
||||||
},
|
},
|
||||||
dragMove: (y) => {
|
dragMove: (y) => {
|
||||||
if (start) {
|
if (this.start) {
|
||||||
moveHeight = height + y;
|
moveHeight = height + y;
|
||||||
moveHeight =
|
moveHeight =
|
||||||
moveHeight < minHeight ? minHeight : moveHeight;
|
moveHeight < minHeight ? minHeight : moveHeight;
|
||||||
|
@ -61,11 +63,12 @@ class Resize implements ResizeInterface {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dragEnd: () => {
|
dragEnd: () => {
|
||||||
if (start) {
|
if (this.start) {
|
||||||
this.card.setValue({
|
this.card.setValue({
|
||||||
height: container.height(),
|
height: container.height(),
|
||||||
} as any);
|
} as any);
|
||||||
start = false;
|
this.start = false;
|
||||||
|
this.card.onActivate(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -128,7 +131,7 @@ class Resize implements ResizeInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
this.component?.hide();
|
if (!this.start) this.component?.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
|
|
@ -158,8 +158,7 @@ class EmbedComponent<V extends EmbedValue = EmbedValue> extends Card<V> {
|
||||||
}
|
}
|
||||||
this.setValue(value as V);
|
this.setValue(value as V);
|
||||||
this.render();
|
this.render();
|
||||||
this.#mask?.hide();
|
super.didRender();
|
||||||
this.toolbarModel?.show();
|
|
||||||
} else {
|
} else {
|
||||||
this.editor.messageError(locales['addressInvalid']);
|
this.editor.messageError(locales['addressInvalid']);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue