Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions resources/js/app/directives/richeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'tinymce/tinymce';
import 'tinymce/icons/default';
import 'tinymce/themes/silver';
import 'tinymce/plugins/paste';
import 'tinymce/plugins/autoresize';
import 'tinymce/plugins/charmap';
import 'tinymce/plugins/link';
import 'tinymce/plugins/lists';
Expand Down Expand Up @@ -85,22 +84,29 @@ export default {
if (!binding.modifiers?.placeholders) {
items = items.replace(/\bplaceholders\b/, '');
}

const sizes = {};
if (BEDITA?.richeditorByPropertyConfig?.[element?.name]?.config?.height) {
sizes.height = BEDITA?.richeditorByPropertyConfig?.[element?.name]?.config?.height;
}
sizes.min_height = BEDITA?.richeditorByPropertyConfig?.[element?.name]?.config?.min_height || sizes.height || 300;
if (BEDITA?.richeditorByPropertyConfig?.[element?.name]?.config?.max_height) {
sizes.max_height = BEDITA?.richeditorByPropertyConfig?.[element?.name]?.config?.max_height;
}
sizes.max_height = sizes.min_height > 500 ? sizes.min_height + 500 : 500;
const { default: contentCSS } = await import('../../../richeditor.lazy.scss');
const [editor] = await tinymce.init({
target: element,
skin: false,
content_css: contentCSS,
menubar: false,
branding: true,
max_height: 500,
... sizes,
toolbar: items,
toolbar_mode: 'wrap',
block_formats: 'Paragraph=p; Header 1=h1; Header 2=h2; Header 3=h3',
entity_encoding: 'raw',
plugins: [
'paste',
'autoresize',
'code',
'charmap',
'link',
Expand All @@ -112,7 +118,7 @@ export default {
'typos',
'visualblocks',
].join(' '),
autoresize_bottom_margin: 50,
resize: true,
convert_urls: false,
relative_urls: false,
paste_block_drop: true,
Expand All @@ -124,15 +130,6 @@ export default {
editor.on('change', () => {
EventBus.send('refresh-placeholders', {id: editor.id, content: editor.getContent()});
});
editor.on('init', () => {
// force height from config
const height = BEDITA?.richeditorByPropertyConfig?.[element?.name]?.config?.height;
if (height) {
const id = editor.id;
const elem = document.getElementById(id + '_ifr').parentNode.parentNode.parentNode.parentNode;
elem.style.height = height;
}
});
}
});

Expand Down
6 changes: 2 additions & 4 deletions templates/Element/Form/related_item.twig
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@

<h3 class="title m-0 has-text-size-small" style="padding-bottom: 7px;">
{% if translation %}
<span :title="related.attributes.translated_fields.title" v-if="related.attributes.translated_fields && related.attributes.translated_fields.title ">
<: truncate(related.attributes.translated_fields.title, 50) :>
<span v-html="truncate(related.attributes.translated_fields.title, 50)" :title=" related.attributes.translated_fields.title" v-if=" related.attributes.translated_fields && related.attributes.translated_fields.title ">
</span>
{% else %}
<span :title="related?.attributes?.title || related?.attributes?.name || related?.attributes?.uname || '-'">
<: truncate(related?.attributes?.title || related?.attributes?.name || related?.attributes?.uname || '-', 50) :>
<span v-html="truncate(related?.attributes?.title || related?.attributes?.name || related?.attributes?.uname || '-', 50)" :title=" related?.attributes?.title || related?.attributes?.name || related?.attributes?.uname || '-' ">
</span>
{% endif %}
</h3>
Expand Down
2 changes: 1 addition & 1 deletion templates/Pages/Translations/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<input type="checkbox" name="oneItem" value="{{ object.id }}" v-model="selectedRows" {% if not Perms.canRead(object.type) %}disabled="disabled"{% endif %}>
</div>
<div class="narrow">
{{ object.attributes.translated_fields.title|truncate(80)|default('no title') }}
{{ object.attributes.translated_fields.title|striptags|truncate(80)|default('no title') }}
</div>
<div class="narrow">
{% if translated.attributes.lang %}
Expand Down
Loading