mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Disable drag-and-drop in active form input
Summary: Drag-and-drop was interfering with text selection in inputs for form labels and paragraphs. Test Plan: Manual. Reviewers: jarek Reviewed By: jarek Subscribers: jarek Differential Revision: https://phab.getgrist.com/D4209
This commit is contained in:
parent
e4d104ee41
commit
2ebf350bdf
@ -123,6 +123,11 @@ export function buildEditor(props: Props, ...args: IDomArgs<HTMLElement>) {
|
|||||||
dom.on('dragstart', (ev) => {
|
dom.on('dragstart', (ev) => {
|
||||||
// Prevent propagation, as we might be in a nested editor.
|
// Prevent propagation, as we might be in a nested editor.
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
if (props.editMode?.get()) {
|
||||||
|
ev.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ev.dataTransfer?.setData('text/plain', JSON.stringify(box.toJSON()));
|
ev.dataTransfer?.setData('text/plain', JSON.stringify(box.toJSON()));
|
||||||
ev.dataTransfer!.dropEffect = "move";
|
ev.dataTransfer!.dropEffect = "move";
|
||||||
dragging.set(true);
|
dragging.set(true);
|
||||||
|
@ -27,6 +27,7 @@ export class ParagraphModel extends BoxModel {
|
|||||||
return buildEditor({
|
return buildEditor({
|
||||||
box: this,
|
box: this,
|
||||||
overlay: this._overlay,
|
overlay: this._overlay,
|
||||||
|
editMode,
|
||||||
content: css.cssMarkdownRendered(
|
content: css.cssMarkdownRendered(
|
||||||
css.markdown(use => use(text) || '', dom.hide(editMode)),
|
css.markdown(use => use(text) || '', dom.hide(editMode)),
|
||||||
dom.maybe(use => !use(text) && !use(editMode), () => cssEmpty('(empty)')),
|
dom.maybe(use => !use(text) && !use(editMode), () => cssEmpty('(empty)')),
|
||||||
|
Loading…
Reference in New Issue
Block a user