<#assign textEditorCoreName = richTextEditorBackOffice() > <#assign textEditorBlogName = blog_editor!'' > <#assign textEditorName><#if textEditorBlogName !=''>${textEditorBlogName}<#else>${textEditorCoreName!} <#assign blogEditorFile=.get_optional_template('blog_${textEditorName}.html')> <#assign is_content_type = use_content_type!true > <#-- The blog editor (blog_xxx.html) edits the contenteditable div #div_html_content, copied into the textarea on submit. A core editor (editor_xxx.html: Autumn Note, Milkdown...) builds itself in place of a textarea and keeps it in sync. --> <#assign blogCoreEditor = false> <#if textEditorName?trim !=''> <#if blogEditorFile.exists> <@blogEditorFile.include /> <#else> <#assign coreEditorFile=.get_optional_template('/admin/util/editor/editor_${textEditorName}.html')> <#if coreEditorFile.exists><@coreEditorFile.include /><#assign blogCoreEditor = true> <#else> <#macro initEditor > <@row> <@columns> <@callOut color='warning w-25 mx-auto' titleLevel='h3' callOutIcon='alert-triangle' title='Aucun editeur disponible !' /> <#-- The content field of the post, shared by create_blog.html and modify_blog.html --> <#macro blogHtmlContent labelKey> <#-- In the textarea the HTML of the post is text: escaped, a or an entity it holds stays as it is --> <#local htmlContentText><#outputformat "HTML">${blog.htmlContent!} <#if blogCoreEditor> <@formGroup labelFor='html_content' labelKey=labelKey helpKey='#i18n{blog.edit_blog.message.help}' rows=2 class='mb-0'> <@input type='textarea' name='html_content' id='html_content' value=htmlContentText /> <#else> <@formGroup labelFor='div_html_content' labelKey=labelKey helpKey='#i18n{blog.edit_blog.message.help}' rows=2 class='mb-0'> <@input type='textarea' name='html_content' id='html_content' value=htmlContentText class='visually-hidden' /> <@div id='div_html_content' class='content-body vmin-dvh-50' params='contenteditable="true"'>${blog.htmlContent!} <#-- Starts the editor on the content field: a core editor is given the textarea, the blog editor finds its div by itself --> <#macro blogInitEditor> <#if blogCoreEditor><@initEditor selector='#html_content' /><#else><@initEditor /> <#macro blogJSInit requiredTags=0> <@initToast id='blogToastContainer' showAll=false > <@addToast id='blogToast' content='to change' /> <#function getFileExtension fileName> <#local lastDotIndex = fileName?last_index_of(".")> <#if lastDotIndex != -1> <#return fileName?substring(lastDotIndex + 1) > <#else> <#return '' > <#-- Tags and attachments cards of the editor side column, shared by create_blog.html and modify_blog.html. The ids (#tag-list, #tag_doc, #addTag, #content-list, #attachment, #fileType, #btn-add-files) are used by blog.js --> <#macro blogPropertiesCards> <#local acceptedTypes = accepted_file_types!'image/*,.pdf,.xls,.doc,.docx,.xlsx,.odt,.ods,.ppt,.pptx,.odp' /> <#-- Tags --> <@box class='mb-0'> <@boxHeader title='#i18n{blog.modify_blog.TagsTitle}' titleActions=true> <@aButton href='jsp/admin/plugins/blog/ManageTags.jsp?plugin_name=blog' target='_blank' color='' class='btn-action' buttonIcon='settings' title='#i18n{blog.manage_blogs.labelManageTags}' hideTitle=['all'] /> <@boxBody> <#if number_mandatory_tags gt 0> <@alert id='enoughTagsInfo' color='info' title='#i18n{blog.mandatoryTags.minimum.number} : ${number_mandatory_tags}' /> <@formGroup labelFor='tag_doc' labelKey='#i18n{blog.manage_tags.buttonAdd}' hideLabel=['all'] rows=2 class='mb-0'> <@inputGroup> <@select name='tag_doc' id='tag_doc' default_value='' items=list_tag /> <@button type='button' id='addTag' name='addTag' value='addTag' buttonIcon='plus' title='#i18n{blog.manage_tags.buttonAdd}' hideTitle=['all'] /> <@listGroup id='tag-list' class='list-group-flush'> <#list blog.tag as tg> <@listGroupItem id='tag_${tg.idTag}' class='d-flex align-items-center justify-content-between py-2'> <@span class='badge bg-blue-lt text-truncate'><@icon style='tag' /> ${tg.name!} <@btnGroup size='sm' ariaLabel='#i18n{portal.util.labelActions}'> <@button color='ghost-secondary' class='btn-icon btn-down' size='sm' buttonIcon='arrow-down' title='#i18n{blog.create_blog.labelDown}' hideTitle=['all'] params='onclick="doUpdatePriorityTag( ${tg.idTag}, \'moveDown\', ${blog.id} );"' /> <@button color='ghost-secondary' class='btn-icon btn-up' size='sm' buttonIcon='arrow-up' title='#i18n{blog.create_blog.labelUp}' hideTitle=['all'] params='onclick="doUpdatePriorityTag( ${tg.idTag}, \'moveUp\', ${blog.id} );"' /> <@button color='ghost-danger' class='btn-icon' size='sm' name='removeTag' value='removeTag' buttonIcon='x' title='#i18n{blog.create_blog.labelRemove}' hideTitle=['all'] params='onclick="doDeleteTag( ${tg.idTag}, \'${tg.name!?js_string}\', ${blog.id} );"' /> <#-- Attachments --> <@box class='mb-0'> <@boxHeader title='#i18n{blog.modify_blog.labelAttachment}' titleActions=true> <#if is_crop_image> <@button color='action' buttonIcon='upload' title='#i18n{blog.modify_blog.labelAttachment}' hideTitle=['all'] params='data-bs-toggle="modal" data-bs-target="#imageModal"' /> <#else> <@button id='btn-add-files' color='action' buttonIcon='upload' title='#i18n{blog.modify_blog.labelAttachment}' hideTitle=['all'] /> <@input class='visually-hidden' name='attachment' id='attachment' type='file' accept='${acceptedTypes}' params='onchange="getFile(${blog.id})"' /> <#-- The type of the next upload, read by the crop upload only (getCroppedCanva): getFile takes it from the MIME type of the file --> <#if is_content_type && is_crop_image> <@boxBody class='py-2'> <@formGroup labelFor='fileType' labelKey='#i18n{blog.create_blog.labelContentType}' rows=2 class='mb-0'> <@select name='fileType' id='fileType' class='form-select form-select-sm'> <#list image_type as type><@option value=type.idContentType label=type.label /> <@div class='blog-resources'> <@listGroup id='content-list' class='list-group-flush'> <#list blog.docContent![] as docContent> <@blogDocContentItem docId='${docContent.id}' docName=docContent.textValue!'' contentTypeId=(docContent.contentType.idContentType)!0 /> <#-- An attachment of the post. Also rendered in