toolbar-item-unavailable ai-balloon-menu

Created on 12 May 2025, 18 days ago

I'm testing this module with the 1.1x branch of the AI module. It doesn't want to work for me. I'm getting an error in the console about the ai_balloon_menu being unavailable.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States keiserjb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @keiserjb
  • πŸ‡ΊπŸ‡ΈUnited States keiserjb

    Turns out the javascript wasn't the problem at all.

    In 1.1.x, the AiCKEditorPluginBase::buildCkEditorModalForm() method was refactored to add new structure (response_wrapper, generate_actions, etc.) and handle more logic internally. This breaks any contrib plugins (like ai_summarize_document) that were written against the 1.0.x structure and manually added response_text, selected_text, or actions['generate'].

    public function buildCkEditorModalForm(array $form, FormStateInterface $form_state, array $settings = []) {
    
        $form = parent::buildCkEditorModalForm($form, $form_state);
    
        $form['document'] = [
          '#type' => 'entity_autocomplete',
          '#target_type' => 'media',
          '#title' => t('Document'),
          '#required' => TRUE,
          '#selection_settings' => [
            'target_bundles' => [$this->configuration['document_bundle']],
          ],
        ];
    
        $form['tone'] = [
          '#type' => 'select',
          '#title' => $this->t('Choose the tone'),
          '#required' => FALSE,
          '#empty_option' => $this->t('- None -'),
          '#description' => $this->t('Selecting one of the options will adjust/reword the body content to be appropriate for the target audience.'),
          '#access' => !empty($this->configuration['tone_vocabulary']),
        ];
        $form['tone']['#options'] = $this->getTermOptions($this->configuration['tone_vocabulary']);
    
        $form['length'] = [
          '#type' => 'select',
          '#title' => $this->t('Choose the length of the response'),
          '#required' => FALSE,
          '#empty_option' => $this->t('- None -'),
          '#description' => $this->t('Selecting one of the options will limit the length of the response text.'),
          '#access' => !empty($this->configuration['length_vocabulary']),
        ];
        $form['length']['#options'] = $this->getTermOptions($this->configuration['length_vocabulary']);
    
        // Remove the selected text field since we don't need it
        unset($form['selected_text']);
    
        return $form;
      }
    
      /**
       * {@inheritdoc}
       */
      protected function needsSelectedText() {
        return FALSE;
      }
    
  • πŸ‡ΊπŸ‡ΈUnited States keiserjb

    This should probably be a new 1.1x branch.

  • Merge request !3Edit SummarizeDocument.php β†’ (Open) created by keiserjb
  • Pipeline finished with Success
    18 days ago
    Total: 138s
    #495188
Production build 0.71.5 2024