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