Projet

Général

Profil

Souhaits #1568 » 0001-Use-Summernote-light-editor-refs-1568.patch

Guillaume AGNIERAY, 22/09/2021 22:47

Voir les différences:

galette/templates/default/common_scripts.tpl
<script type="text/javascript" src="{base_url}/{$scripts_dir}mass_changes.js"></script>
{/if}
{if $html_editor}
<script type="text/javascript" src="{base_url}/{$jquery_dir}markitup-{$jquery_markitup_version}/jquery.markitup.js"></script>
<script type="text/javascript" src="{base_url}/{$jquery_dir}markitup-{$jquery_markitup_version}/sets/html/set-{$galette_lang}.js"></script>
<!--<script type="text/javascript" src="{base_url}/{$jquery_dir}markitup-{$jquery_markitup_version}/jquery.markitup.js"></script>
<script type="text/javascript" src="{base_url}/{$jquery_dir}markitup-{$jquery_markitup_version}/sets/html/set-{$galette_lang}.js"></script>-->
<script language="javascript">
function toggleMailingEditor(id) {
function activateMailingEditor(id) {
if(!$('#mailing_html').attr('checked')){
$('#mailing_html').attr('checked', true);
}
$('input#html_editor_active').attr('value', '1');
{* While it is not possible to deactivate markItUp, we remove completly the functionnality *}
$('#toggle_editor').remove();
$('#mailing_corps').markItUp(galetteSettings);
$('#activate_editor').remove();
$('#summernote_toggler').html('<a href="javascript:deactivateMailingEditor(\'mailing_corps\');" id="deactivate_editor">{_T string="Deactivate HTML editor"}</a>');
$('#mailing_corps').summernote({
height: 240,
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'strikethrough', 'clear']],
['para', ['ul', 'ol', 'paragraph']],
['insert', ['link', 'picture']],
['view', ['codeview', 'help']]
],
styleTags: [
'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
]
});
$('#mailing_corps').summernote({
codeviewFilter: true,
codeviewIframeFilter: false
});
}
function deactivateMailingEditor(id) {
$('#mailing_corps').summernote('destroy');
$('#deactivate_editor').remove();
$('#summernote_toggler').html('<a href="javascript:activateMailingEditor(\'mailing_corps\');" id="activate_editor">{_T string="Activate HTML editor"}</a>');
}
{if $html_editor_active eq 1}
$(function(){
{* While it is not possible to deactivate markItUp, we remove completly the functionnality *}
$('#toggle_editor').remove();
$('#mailing_corps').markItUp(galetteSettings);
$('#activate_editor').remove();
$('#summernote_toggler').html('<a href="javascript:deactivateMailingEditor(\'mailing_corps\');" id="deactivate_editor">{_T string="Deactivate HTML editor"}</a>');
$('#mailing_corps').summernote({
height: 240,
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'strikethrough', 'clear']],
['para', ['ul', 'ol', 'paragraph']],
['insert', ['link', 'picture']],
['view', ['codeview', 'help']]
],
styleTags: [
'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
]
});
$('#mailing_corps').summernote({
codeviewFilter: true,
codeviewIframeFilter: false
});
});
{/if}
</script>
galette/templates/default/mailing_adherents.tpl
<input type="text" name="mailing_objet" id="mailing_objet" value="{$mailing->subject}" size="80" required/>
</div>
<div>
<span class="fright"><a href="javascript:toggleMailingEditor('mailing_corps');" id="toggle_editor">{_T string="(De)Activate HTML editor"}</a></span>
<span id="summernote_toggler" class="fright">
<a href="javascript:activateMailingEditor('mailing_corps');" id="activate_editor">{_T string="Activate HTML editor"}</a>
</span>
<label for="mailing_corps" class="bline">{_T string="Message:"}</label>
<textarea name="mailing_corps" id="mailing_corps" cols="80" rows="15" required>{$mailing->message|escape}</textarea>
<input type="hidden" name="html_editor_active" id="html_editor_active" value="{if $html_editor_active}1{else}0{/if}"/>
gulpfile.js
'./node_modules/jquery-ui-dist/jquery-ui.css',
'./galette/webroot/themes/default/jquery-ui/jquery-ui-1.12.1.custom.css',
'./node_modules/selectize/dist/css/selectize.default.css',
'./node_modules/summernote/dist/summernote-lite.min.css',
];
var main_scripts = [
......
'./node_modules/sifter/sifter.js',
'./node_modules/selectize/dist/js/selectize.min.js',
'./galette/webroot/js/jquery/jquery.bgFade.js',
'./node_modules/summernote/dist/summernote-lite.min.js',
'./galette/webroot/js/common.js',
];
......
{
'src': './node_modules/@fortawesome/fontawesome-free/webfonts/*',
'dest': '/webfonts/'
}, {
'src': './node_modules/summernote/dist/font/*',
'dest': '/webfonts/'
}, {
'src': './node_modules/jquery-ui-dist/images/*',
'dest': '/images/'
......
.pipe(replace('jquery-ui/images/', '../images/'))
.pipe(replace('("images/ui', '("../images/ui')) //
.pipe(replace('url(images/', 'url(../images/'))
.pipe(replace('url(font/', 'url(../webfonts/'))
.pipe(cleanCSS())
.pipe(concat('galette-main.bundle.min.css'))
.pipe(gulp.dest(_dir));
package-lock.json
"object-visit": "^1.0.0"
}
},
"markitup": {
"version": "3.0.0-0",
"resolved": "https://registry.npmjs.org/markitup/-/markitup-3.0.0-0.tgz",
"integrity": "sha1-0jn84Z5vuioDMIf/0bk7kOmwBX8="
},
"matchdep": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz",
......
"is-utf8": "^0.2.0"
}
},
"summernote": {
"version": "0.8.18",
"resolved": "https://registry.npmjs.org/summernote/-/summernote-0.8.18.tgz",
"integrity": "sha512-VlwBaNm9vSYMYXvO2f3UCUmY0Gm8jxLcBn+D08aX3pKs4x2vAoyQ4DcDQ6D+PchQiLrf86AGQVfVu56F4aP3ug=="
},
"supports-color": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
package.json
"jquery-ui-dist": "^1.12.1",
"jquery.cookie": "^1.4.1",
"jstree": "^3.3.9",
"markitup": "^3.0.0-0",
"selectize": "^0.12.6"
"selectize": "^0.12.6",
"summernote": "^0.8.18"
}
}
(1-1/6)