Drag and drop files on the editor to upload: add new argument to wp_editor() to enable, fixes #27465

git-svn-id: https://develop.svn.wordpress.org/trunk@27901 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2014-04-02 02:41:24 +00:00
parent c28fff3b65
commit 7b272d3a26
4 changed files with 26 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ final class _WP_Editors {
private static $has_quicktags = false;
private static $has_medialib = false;
private static $editor_buttons_css = true;
private static $drag_drop_upload = false;
private function __construct() {}
@@ -38,6 +39,8 @@ final class _WP_Editors {
* @type bool $media_buttons Whether to show the Add Media/other media buttons.
* @type string $default_editor When both TinyMCE and Quicktags are used, set which
* editor is shown on page load. Default empty.
* @type bool $drag_drop_upload Whether to enable drag & drop on the editor uploading. Default false.
* Requires the media modal.
* @type string $textarea_name Give the textarea a unique name here. Square brackets
* can be used here. Default $editor_id.
* @type int $textarea_rows Number rows in the editor textarea. Default 20.
@@ -63,6 +66,7 @@ final class _WP_Editors {
'wpautop' => true,
'media_buttons' => true,
'default_editor' => '',
'drag_drop_upload' => false,
'textarea_name' => $editor_id,
'textarea_rows' => 20,
'tabindex' => '',
@@ -124,6 +128,10 @@ final class _WP_Editors {
$switch_class = 'html-active';
$toolbar = $buttons = $autocomplete = '';
if ( $set['drag_drop_upload'] ) {
self::$drag_drop_upload = true;
}
if ( ! empty( $set['editor_height'] ) )
$height = ' style="height: ' . $set['editor_height'] . 'px"';
else
@@ -980,6 +988,13 @@ final class _WP_Editors {
tinyMCEPreInit = {
baseURL: "<?php echo self::$baseurl; ?>",
suffix: "<?php echo $suffix; ?>",
<?php
if ( self::$drag_drop_upload ) {
echo 'dragDropUpload: true,';
}
?>
mceInit: <?php echo $mceInit; ?>,
qtInit: <?php echo $qtInit; ?>,
ref: <?php echo self::_parse_init( $ref ); ?>,