+  $self->js
+    ->run(SORTABLE_PICTURE_LIST())
+    ->render($self);
+}
+
+sub action_ajax_copy {
+  my ($self, %params) = @_;
+
+  SL::Clipboard->new->copy($self->text_block);
+  SL::ClientJS->new->render($self);
+}
+
+sub action_ajax_paste {
+  my ($self, %params) = @_;
+
+  my $copied = SL::Clipboard->new->get_entry(qr/^RequirementSpec(?:TextBlock|Picture)$/);
+  if (!$copied) {
+    return SL::ClientJS->new
+      ->error(t8("The clipboard does not contain anything that can be pasted here."))
+      ->render($self);
+  }
+
+  if (ref($copied) =~ m/Picture$/) {
+    $self->load_requirement_spec_text_block;
+    return $self->paste_picture($copied);
+  }
+
+  my $current_output_position = $self->output_position_from_id($::form->{current_content_id}, $::form->{current_content_type});
+  my $new_output_position     = $::form->{id} ? $self->output_position_from_id($::form->{id}) : $::form->{output_position};
+  my $front_back              = 0 == $new_output_position ? 'front' : 'back';
+
+  $self->text_block($copied->to_object);
+  $self->text_block->update_attributes(requirement_spec_id => $::form->{requirement_spec_id}, output_position => $new_output_position);
+  $self->text_block->add_to_list(position => 'after', reference => $::form->{id}) if $::form->{id};
+
+  if ($current_output_position == $new_output_position) {
+    my $html = $self->render('requirement_spec_text_block/_text_block', { output => 0 }, text_block => $self->text_block);
+    $self->js->action($::form->{id} ? 'insertAfter' : 'appendTo', $html, '#text-block-' . ($::form->{id} || 'list'));
+  }
+
+  my $node = $self->presenter->requirement_spec_text_block_jstree_data($self->text_block);
+  $self->invalidate_version
+    ->run(SORTABLE_PICTURE_LIST())
+    ->jstree->create_node('#tree', $::form->{id} ? ('#tb-' . $::form->{id}, 'after') : ("#tb-${front_back}", 'last'), $node)
+    ->render($self);
+}
+
+#
+# actions for pictures
+#
+
+sub action_ajax_add_picture {
+  my ($self) = @_;
+
+  $self->picture(SL::DB::RequirementSpecPicture->new);
+  $self->render('requirement_spec_text_block/_picture_form', { layout => 0 });
+}
+
+sub action_ajax_edit_picture {
+  my ($self) = @_;
+
+  $self->text_block($self->picture->text_block);
+  $self->render('requirement_spec_text_block/_picture_form', { layout => 0 });
+}
+
+sub action_ajax_create_picture {
+  my ($self, %params)              = @_;
+
+  my $attributes                   = $::form->{ $::form->{form_prefix} } || die "Missing attributes";
+  $attributes->{picture_file_name} = ((($::form->{ATTACHMENTS} || {})->{ $::form->{form_prefix} } || {})->{picture_content} || {})->{filename};
+  my @errors                       = $self->picture(SL::DB::RequirementSpecPicture->new(%{ $attributes }))->validate;
+
+  return $self->js->error(@errors)->render($self) if @errors;
+
+  $self->picture->save;
+
+  $self->text_block($self->picture->text_block);
+  my $html = $self->render('requirement_spec_text_block/_text_block_picture', { output => 0 }, picture => $self->picture);
+
+  $self->invalidate_version
+    ->dialog->close('#jqueryui_popup_dialog')
+    ->append('#text-block-' . $self->text_block->id . '-pictures', $html)
+    ->show('#text-block-' . $self->text_block->id . '-pictures')
+    ->render($self);
+}
+
+sub action_ajax_update_picture {
+  my ($self)     = @_;
+
+  my $attributes = $::form->{ $::form->{form_prefix} } || die "Missing attributes";
+
+  if (!$attributes->{picture_content}) {
+    delete $attributes->{picture_content};
+  } else {
+    $attributes->{picture_file_name} = ((($::form->{ATTACHMENTS} || {})->{ $::form->{form_prefix} } || {})->{picture_content} || {})->{filename};
+  }
+
+  $self->picture->assign_attributes(%{ $attributes });
+  my @errors = $self->picture->validate;
+
+  return $self->js->error(@errors)->render($self) if @errors;
+
+  $self->picture->save;
+
+  $self->text_block($self->picture->text_block);
+  my $html = $self->render('requirement_spec_text_block/_text_block_picture', { output => 0 }, picture => $self->picture);
+
+  $self->invalidate_version
+    ->dialog->close('#jqueryui_popup_dialog')
+    ->replaceWith('#text-block-picture-' . $self->picture->id, $html)
+    ->show('#text-block-' . $self->text_block->id . '-pictures')
+    ->render($self);
+}
+
+sub action_ajax_delete_picture {
+  my ($self) = @_;
+
+  $self->picture->delete;
+  $self->text_block(SL::DB::RequirementSpecTextBlock->new(id => $self->picture->text_block_id)->load);
+
+  $self->invalidate_version
+    ->remove('#text-block-picture-' . $self->picture->id)
+    ->action_if(!@{ $self->text_block->pictures }, 'hide', '#text-block-' . $self->text_block->id . '-pictures')
+    ->render($self);
+}
+
+sub action_ajax_download_picture {
+  my ($self) = @_;
+
+  $self->send_file(\$self->picture->{picture_content}, type => $self->picture->picture_content_type, name => $self->picture->picture_file_name);
+}
+
+sub action_ajax_copy_picture {
+  my ($self, %params) = @_;
+
+  SL::Clipboard->new->copy($self->picture);
+  SL::ClientJS->new->render($self);
+}
+
+sub action_ajax_paste_picture {
+  my ($self, %params) = @_;
+
+  my $copied = SL::Clipboard->new->get_entry(qr/^RequirementSpecPicture$/);
+  if (!$copied) {
+    return SL::ClientJS->new
+      ->error(t8("The clipboard does not contain anything that can be pasted here."))
+      ->render($self);
+  }
+
+  $self->text_block($self->picture->text_block);   # Save text block via the picture the user clicked on
+
+  $self->paste_picture($copied);
+}
+
+sub action_reorder_pictures {
+  my ($self) = @_;