diff -u b/core/misc/dialog.ajax.js b/core/misc/dialog.ajax.js --- b/core/misc/dialog.ajax.js +++ b/core/misc/dialog.ajax.js @@ -38,7 +38,8 @@ */ prepareDialogButtons: function($dialog) { var buttons = []; - $dialog.find('.form-actions input[type=submit], button').each(function () { + var $buttons = $dialog.find('.form-actions input[type=submit], button'); + $buttons.each(function () { var $originalButton = $(this).hide(); buttons.push({ 'text': $originalButton.html() || $originalButton.attr('value'), @@ -49,10 +50,12 @@ } }); }); - $dialog.find('form').on('submit.dialogSubmit', function(e) { - $dialog.find('.form-actions input[type=submit], button').first().trigger('mousedown'); - e.preventDefault(); - }); + if ($buttons.length) { + $dialog.find('form').on('submit.dialogSubmit', function(e) { + $buttons.first().trigger('mousedown'); + e.preventDefault(); + }); + } return buttons; } }; diff -u b/core/misc/dialog.js b/core/misc/dialog.js --- b/core/misc/dialog.js +++ b/core/misc/dialog.js @@ -23,7 +23,7 @@ // Trigger a global event to allow scripts to bind events to the dialog. $(window).trigger('dialog:beforecreate', [dialog, $element, settings]); $element.dialog(settings); - if (settings['autoResize']) { + if (settings['autoResize'] !== 'false' && settings['autoResize'] !== false) { $(window).on('resize.dialogResize scroll.dialogResize', autoResize); resetPosition(); } @@ -36,7 +36,7 @@ $element.dialog('close'); dialog.returnValue = value; dialog.open = false; - $(window).off('resize.dialogResize scroll.dialogResize', autoResize); + $(window).off('.dialogResize'); $(window).trigger('dialog:afterclose', [dialog, $element]); } diff -u b/core/misc/dialog.theme.css b/core/misc/dialog.theme.css --- b/core/misc/dialog.theme.css +++ b/core/misc/dialog.theme.css @@ -3,8 +3,8 @@ */ .ui-dialog { - position: fixed; - z-index: 400; + position: absolute; + z-index: 1260; overflow: visible; color: #000; background: #fff; diff -u b/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js --- b/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -140,6 +140,9 @@ var classes = dialogSettings['dialogClass'] ? dialogSettings['dialogClass'].split(' ') : []; classes.push('editor-dialog'); dialogSettings['dialogClass'] = classes.join(' '); + dialogSettings['maxHeight'] = '95%'; + dialogSettings['resizable'] = false; + dialogSettings['autoResize'] = $(window).width() > 600; // Generate a pseudo-AJAX object for ajax.js to use in making this request. Drupal.settings.ajax = Drupal.settings.ajax || {}; diff -u b/core/modules/editor/css/editor.css b/core/modules/editor/css/editor.css --- b/core/modules/editor/css/editor.css +++ b/core/modules/editor/css/editor.css @@ -8,3 +8,8 @@ max-width: 500px; - position: fixed; +} + +@media screen and (max-width: 600px) { + .editor-dialog { + width: 95% !important; + } } diff -u b/core/modules/editor/editor.module b/core/modules/editor/editor.module --- b/core/modules/editor/editor.module +++ b/core/modules/editor/editor.module @@ -86,7 +86,7 @@ 'title' => 'Text Editor Dialog', 'version' => VERSION, 'js' => array( - $path . '/js/editor.dialog.js' => array(), + $path . '/js/editor.dialog.js' => array('weight' => 2), ), 'dependencies' => array( array('system', 'jquery'), diff -u b/core/modules/editor/editor.routing.yml b/core/modules/editor/editor.routing.yml --- b/core/modules/editor/editor.routing.yml +++ b/core/modules/editor/editor.routing.yml @@ -20,6 +19,0 @@ -editor_anchor_dialog: - pattern: '/editor/dialog/anchor/{filter_format}' - defaults: - _form: '\Drupal\editor\Form\EditorAnchorDialog' - requirements: - _filter_access: 'TRUE' diff -u b/core/modules/editor/lib/Drupal/editor/EditorController.php b/core/modules/editor/lib/Drupal/editor/EditorController.php --- b/core/modules/editor/lib/Drupal/editor/EditorController.php +++ b/core/modules/editor/lib/Drupal/editor/EditorController.php @@ -13,6 +13,8 @@ use Drupal\Core\Ajax\CloseModalDialogCommand; use Drupal\Core\Entity\EntityInterface; use Drupal\editor\Ajax\GetUntransformedTextCommand; +use Drupal\editor\Form\EditorImageDialog; +use Drupal\editor\Form\EditorLinkDialog; use Drupal\filter\Plugin\Core\Entity\FilterFormat; /** @@ -49,10 +51,2 @@ - public function imageDialog(FilterFormat $filter_format = NULL) { - $response = new AjaxResponse(); - - $response->addCommand(new OpenModalDialogCommand(t('Insert image'), 'test')); - - return $response; - } - } diff -u b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php --- b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php +++ b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php @@ -7,7 +7,6 @@ namespace Drupal\editor\Form; -use Drupal\Core\ControllerInterface; use Drupal\Core\Form\FormInterface; use Drupal\filter\Plugin\Core\Entity\FilterFormat; use Drupal\Core\Ajax\AjaxResponse; @@ -40,6 +39,8 @@ $form['#tree'] = TRUE; $form['#attached']['library'][] = array('editor', 'drupal.editor.dialog'); + $form['#prefix'] = '
'; + $form['#suffix'] = '
'; // Everything under the "attributes" key is merged directly into the // generate img tag's attributes. @@ -119,9 +120,10 @@ $response = new AjaxResponse(); if (form_get_errors()) { + unset($form['#prefix'], $form['#suffix']); $output = drupal_render($form); $output = '
' . theme('status_messages') . $output . '
'; - $response->addCommand(new HtmlCommand('#drupal-modal', $output)); + $response->addCommand(new HtmlCommand('#editor-image-dialog', $output)); } else { $response->addCommand(new EditorDialogSave($form_state['values'])); diff -u b/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php b/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php --- b/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php +++ b/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php @@ -7,7 +7,6 @@ namespace Drupal\editor\Form; -use Drupal\Core\ControllerInterface; use Drupal\Core\Form\FormInterface; use Drupal\filter\Plugin\Core\Entity\FilterFormat; use Drupal\Core\Ajax\AjaxResponse; @@ -40,6 +39,8 @@ $form['#tree'] = TRUE; $form['#attached']['library'][] = array('editor', 'drupal.editor.dialog'); + $form['#prefix'] = ''; // Everything under the "attributes" key is merged directly into the // generate img tag's attributes. @@ -86,9 +87,10 @@ $response = new AjaxResponse(); if (form_get_errors()) { + unset($form['#prefix'], $form['#suffix']); $output = drupal_render($form); $output = '
' . theme('status_messages') . $output . '
'; - $response->addCommand(new HtmlCommand('#drupal-modal', $output)); + $response->addCommand(new HtmlCommand('#editor-link-dialog', $output)); } else { $response->addCommand(new EditorDialogSave($form_state['values'])); diff -u b/core/modules/ckeditor/css/ckeditor-iframe.css b/core/modules/ckeditor/css/ckeditor-iframe.css --- a/core/modules/ckeditor/css/ckeditor-iframe.css +++ b/core/modules/ckeditor/css/ckeditor-iframe.css @@ -9,6 +9,13 @@ body { margin: 8px; } +@media screen and (max-width: 600px) { + /* A font-size of 16px prevents iOS from zooming. */ + body { + font-size: 16px; + } +} + ol, ul, dl { /* IE7: reset rtl list margin. (CKEditor issue #7334) */ *margin-right: 0px;