Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#27880 closed defect (bug) (fixed)

Drag and Drop Media prevents Drag and Drop Text

Reported by: ipstenu's profile Ipstenu Owned by: nacin's profile nacin
Milestone: 3.9.1 Priority: normal
Severity: normal Version: 3.9
Component: Editor Keywords: fixed-major commit has-patch
Focuses: Cc:

Description

Related to #27465

Drag-and-drop text (that is selecting text and dragging it to the text editor window) no longer works in WordPress due to the new Drag & Drop Media feature. This is the case in the HTML and Visual editors. This has been reported in the WordPress.org forums by a few people.

https://wordpress.org/support/topic/text-editor-ruined-in-39

Attachments (3)

27880.diff (1.1 KB) - added by kraftbj 10 years ago.
Add a filter for the default args
exampleplugin.php (604 bytes) - added by kraftbj 10 years ago.
Example plugin for old behavior based on 27880.diff
27880.2.diff (2.4 KB) - added by azaozz 10 years ago.

Download all attachments as: .zip

Change History (16)

#1 @nacin
10 years ago

  • Milestone changed from Awaiting Review to 3.9.1

#2 @azaozz
10 years ago

Not sure how common is this. Testing on Win7, it will only let me drag selected text from one web browser to another, not from a text editor. It's quite inconvenient to drag too.

To fix, seems we will have to bring back something like isDraggingFile() from https://core.trac.wordpress.org/attachment/ticket/19845/19845.8.diff and throttle it down as there are some performance issues. Or maybe set a draggingFile var the first time we see a drag event and reset it when the dragging has finished.

#3 follow-up: @Ipstenu
10 years ago

It's hard to gauge. I think it's one of those 'Heavily used by people who knew about it' features. I find it useful in forums or tickets when I want to quote, but I'm really a little surprised it's in-use for writing posts.

Would it be possible to have an option (define option, not a check box) to allow people to turn off the whole-page drag/drop to get it back? That MIGHT get us a better idea of how it's used.

#4 @kraftbj
10 years ago

Agreeing with Ipstenu, would it make sense to add a filter for the default args for the Edit Posts editor and suggest a plugin for the previous behavior to save the performance hit of isDraggingFile()?

Attaching patch and example plugin in a moment.

Last edited 10 years ago by kraftbj (previous) (diff)

@kraftbj
10 years ago

Add a filter for the default args

@kraftbj
10 years ago

Example plugin for old behavior based on 27880.diff

#5 @azaozz
10 years ago

Not sure if another filter is needed there. If you want to disable drag/drop uploading from a plugin, this should do it:

add_action( 'after_wp_tiny_mce', 'my_disable_ddupload' );
function my_disable_ddupload() {
	?>
	<script>
	if ( typeof tinyMCEPreInit !== 'undefined' ) {
		delete tinyMCEPreInit.dragDropUpload;
	}
	</script>
	<?php
}

#6 in reply to: ↑ 3 @Zumatra
10 years ago

I'm not even sure I am allowed to post here as I am in no way involved in WP development but I was following a link from a thread I started on this subject.

I think that to be a little surprised that drag and drop is used in writing posts kind of suggests a narrow scope of how WP is used and that it is only used for blogging. As somebody else said, I used it to quote chunks of text and YouTube descriptions of videos which I embed. It saves a lot of time when one spends a couple of hours per day posting and the extra time spent soon mounts.

I definitely cannot drag and drop from one browser to another - at least not from Safari to Firefox because that's how I first discovered the problem. I can sometimes (but I haven't discovered the necessary conditions to do so) drag and drop from Mac TextEdit to Safari but only if I place the cursor at the text insertion point. It may be that text must have already been inserted but Drag and Drop from TextEdit to Safari isn't something I do very often - it's usually Safari-Firefox or Safari-Safari, neither of which work.

Replying to Ipstenu:

It's hard to gauge. I think it's one of those 'Heavily used by people who knew about it' features. I find it useful in forums or tickets when I want to quote, but I'm really a little surprised it's in-use for writing posts.

Would it be possible to have an option (define option, not a check box) to allow people to turn off the whole-page drag/drop to get it back? That MIGHT get us a better idea of how it's used.

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


10 years ago

@azaozz
10 years ago

#8 @azaozz
10 years ago

  • Keywords has-patch needs-testing added

27880.2.diff fixes it by looking at what is being dragged. It adds a bit of overhead especially while dragging in TinyMCE as it passes the normalized jQuery event to the parent document, but that is roughly the equivalent of attaching the events with jQuery in the iframe.

This ticket was mentioned in IRC in #wordpress-dev by nacin1. View the logs.


10 years ago

#10 @azaozz
10 years ago

In 28189:

Drag/drop on the editor to upload: don't trigger the uploader when selected test is being dragged from one window to another. See #27880, for trunk.

Last edited 10 years ago by azaozz (previous) (diff)

#11 @azaozz
10 years ago

  • Keywords fixed-major added; has-patch removed

#12 @samuelsidler
10 years ago

  • Keywords commit has-patch added; needs-testing removed

#13 @nacin
10 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 28262:

Drag/drop on the editor to upload: don't trigger the uploader when selected text is being dragged from one window to another.

Merges [28189] to the 3.9 branch.

props azaozz.
fixes #27880.

Note: See TracTickets for help on using tickets.