$::auth->assert('sales_quotation_edit');
$::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec);
- $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec);
+ $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec ckeditor/ckeditor ckeditor/adapters/jquery);
$self->init_visible_section;
return 1;
->insertAfter($html, '#text-block-' . $self->text_block->id)
->jstree->select_node('#tree', '#tb-' . $self->text_block->id)
->focus('#edit_text_block_' . $self->text_block->id . '_title')
+ ->reinit_widgets
->render($self);
}
$self->js
->action($params{insert_after_id} ? 'insertAfter' : 'appendTo', $html, '#text-block-' . ($params{insert_after_id} || 'list'))
+ ->reinit_widgets
->focus('#' . $id_base . '_title');
}
use SL::DB::MetaSetup::RequirementSpecTextBlock;
use SL::DB::Manager::RequirementSpecTextBlock;
use SL::DB::Helper::ActsAsList;
+use SL::DB::Helper::AttrHTML;
use SL::Locale::String;
__PACKAGE__->meta->add_relationship(
__PACKAGE__->meta->initialize;
__PACKAGE__->configure_acts_as_list(group_by => [qw(requirement_spec_id output_position)]);
+__PACKAGE__->attr_html('text');
__PACKAGE__->before_save(\ &_before_save_invalidate_requirement_spec_version);
__PACKAGE__->before_delete(\&_before_delete_invalidate_requirement_spec_version);
sub content_excerpt {
my ($self) = @_;
- return Common::truncate($self->text // '', at => 200);
+ return Common::truncate($self->text_as_stripped_html // '', at => 200);
}
1;
<tr>
<th align="right" valign="top">[%- LxERP.t8("Description") %]:</th>
- <td valign="top">[% L.textarea_tag(id_base _ '.text', SELF.text_block.text, style = style, rows = 10) %]</td>
+ <td valign="top">[% L.textarea_tag(id_base _ '.text_as_restricted_html', SELF.text_block.text_as_restricted_html, id = id_base _ '_text', style = style _ '; height: 200px', class='texteditor') %]</td>
</tr>
</table>
|| confirm('[%- LxERP.t8("Do you want to overwrite your current title?") %]')))
title_ctrl.val(pt.title);
- if ((pt.text || '') != '') {
- var text_ctrl = $('#[% id_base %]_text');
- var text = text_ctrl.val() || '';
- if (text != '')
- text += "\n\n";
-
- text_ctrl.val(text + pt.text);
- }
+ if ((pt.text || '') != '')
+ $('#[% id_base %]_text').ckeditorGet().insertHtml(pt.text);
return false;
}
</div>
[% ELSE %]
<div class="requirement-spec-text-block-text">
- [% L.simple_format(text_block.text) %]
+ [% text_block.text_as_restricted_html %]
</div>
[% END %]