diff --git a/js/yamlform.element.html_editor.js b/js/yamlform.element.html_editor.js index 3cf06d9..722b60e 100644 --- a/js/yamlform.element.html_editor.js +++ b/js/yamlform.element.html_editor.js @@ -16,13 +16,15 @@ attach: function (context) { $(context).find('.js-form-type-yamlform-html-editor textarea').once().each(function () { var $textarea = $(this); - CKEDITOR.replace(this.id, { // Turn off external config and styles. customConfig: '', stylesSet: false, contentsCss: [], allowedContent: true, + // Use
tags instead of

tags. + enterMode: CKEDITOR.ENTER_BR, + shiftEnterMode: CKEDITOR.ENTER_BR, // Set height, hide the status bar, and remove plugins. height: '100px', resize_enabled: false, diff --git a/src/Form/YamlFormAdminSettingsForm.php b/src/Form/YamlFormAdminSettingsForm.php index de048d6..46cc4d4 100644 --- a/src/Form/YamlFormAdminSettingsForm.php +++ b/src/Form/YamlFormAdminSettingsForm.php @@ -123,15 +123,13 @@ class YamlFormAdminSettingsForm extends ConfigFormBase { '#tree' => TRUE, ]; $form['form']['default_form_closed_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default closed message'), '#required' => TRUE, '#default_value' => $config->get('settings.default_form_closed_message'), ]; $form['form']['default_form_exception_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default closed exception message'), '#required' => TRUE, '#default_value' => $config->get('settings.default_form_exception_message'), @@ -144,8 +142,7 @@ class YamlFormAdminSettingsForm extends ConfigFormBase { '#default_value' => $settings['default_form_submit_label'], ]; $form['form']['default_form_confidential_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default confidential message'), '#required' => TRUE, '#default_value' => $config->get('settings.default_form_confidential_message'), @@ -221,8 +218,7 @@ class YamlFormAdminSettingsForm extends ConfigFormBase { '#default_value' => $settings['default_preview_prev_button_label'], ]; $form['preview']['default_preview_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default preview message'), '#required' => TRUE, '#default_value' => $settings['default_preview_message'], @@ -242,15 +238,13 @@ class YamlFormAdminSettingsForm extends ConfigFormBase { '#default_value' => $settings['default_draft_button_label'], ]; $form['draft']['default_draft_saved_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default draft save message'), '#required' => TRUE, '#default_value' => $settings['default_draft_saved_message'], ]; $form['draft']['default_draft_loaded_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default draft load message'), '#required' => TRUE, '#default_value' => $settings['default_draft_loaded_message'], @@ -263,8 +257,7 @@ class YamlFormAdminSettingsForm extends ConfigFormBase { '#tree' => TRUE, ]; $form['confirmation']['default_confirmation_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default confirmation message'), '#required' => TRUE, '#default_value' => $config->get('settings.default_confirmation_message'), @@ -277,15 +270,13 @@ class YamlFormAdminSettingsForm extends ConfigFormBase { '#tree' => TRUE, ]; $form['limit']['default_limit_total_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default total submissions limit message'), '#required' => TRUE, '#default_value' => $config->get('settings.default_limit_total_message'), ]; $form['limit']['default_limit_user_message'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Default per user submission limit message'), '#required' => TRUE, '#default_value' => $config->get('settings.default_limit_user_message'), diff --git a/src/Plugin/YamlFormElement/YamlFormMarkup.php b/src/Plugin/YamlFormElement/YamlFormMarkup.php index 7c1078b..2d4fb12 100644 --- a/src/Plugin/YamlFormElement/YamlFormMarkup.php +++ b/src/Plugin/YamlFormElement/YamlFormMarkup.php @@ -41,8 +41,7 @@ class YamlFormMarkup extends YamlFormMarkupBase { public function form(array $form, FormStateInterface $form_state) { $form = parent::form($form, $form_state); $form['markup']['markup'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('HTML markup'), '#description' => $this->t('Enter custom HTML into your form.'), ]; diff --git a/src/YamlFormEntityForm.php b/src/YamlFormEntityForm.php index 72c100b..1f2a91e 100644 --- a/src/YamlFormEntityForm.php +++ b/src/YamlFormEntityForm.php @@ -119,11 +119,9 @@ class YamlFormEntityForm extends BundleEntityFormBase { ], ]; $form['description'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Administrative description'), '#default_value' => $yamlform->get('description'), - '#rows' => 2, ]; $form = $this->protectBundleIdElement($form); } diff --git a/src/YamlFormEntityListBuilder.php b/src/YamlFormEntityListBuilder.php index c40300f..e7e2964 100644 --- a/src/YamlFormEntityListBuilder.php +++ b/src/YamlFormEntityListBuilder.php @@ -75,7 +75,7 @@ class YamlFormEntityListBuilder extends ConfigEntityListBuilder { // actions and add the needed dialog attributes. // @see https://www.drupal.org/node/2585169 if ($this->moduleHandler()->moduleExists('yamlform_ui')) { - $add_form_attributes = YamlFormDialogHelper::getModalDialogAttributes(400, ['button', 'button-action', 'button--primary', 'button--small']); + $add_form_attributes = YamlFormDialogHelper::getModalDialogAttributes(640, ['button', 'button-action', 'button--primary', 'button--small']); } else { $add_form_attributes = ['class' => ['button', 'button-action', 'button--primary', 'button--small']]; @@ -228,7 +228,7 @@ class YamlFormEntityListBuilder extends ConfigEntityListBuilder { 'title' => $this->t('Duplicate'), 'weight' => 23, 'url' => Url::fromRoute('entity.yamlform.duplicate_form', $route_parameters), - 'attributes' => YamlFormDialogHelper::getModalDialogAttributes(400), + 'attributes' => YamlFormDialogHelper::getModalDialogAttributes(640), ]; } } diff --git a/src/YamlFormEntitySettingsForm.php b/src/YamlFormEntitySettingsForm.php index 816e8ee..1973b93 100644 --- a/src/YamlFormEntitySettingsForm.php +++ b/src/YamlFormEntitySettingsForm.php @@ -44,11 +44,9 @@ class YamlFormEntitySettingsForm extends EntityForm { '#id' => 'title', ]; $form['general']['description'] = [ - '#type' => 'yamlform_codemirror', - '#mode' => 'html', + '#type' => 'yamlform_html_editor', '#title' => $this->t('Administrative description'), '#default_value' => $yamlform->get('description'), - '#rows' => 2, ]; $form['general']['template'] = [ '#type' => 'checkbox', diff --git a/src/YamlFormSubmissionListBuilder.php b/src/YamlFormSubmissionListBuilder.php index 0c1c4c7..5403f24 100644 --- a/src/YamlFormSubmissionListBuilder.php +++ b/src/YamlFormSubmissionListBuilder.php @@ -373,7 +373,7 @@ class YamlFormSubmissionListBuilder extends EntityListBuilder { '#type' => 'link', '#title' => new FormattableMarkup('', ['@state' => $state]), '#url' => Url::fromRoute($route_name, $route_parameters, $route_options), - '#attributes' => YamlFormDialogHelper::getModalDialogAttributes(400), + '#attributes' => YamlFormDialogHelper::getModalDialogAttributes(640), ], 'class' => ['yamlform-results__icon'], ];