fixes switch

between MD code edition & Quill edition
This commit is contained in:
2017-01-24 15:42:21 +01:00
parent 6dd06b123f
commit 5bcb88ee2c

View File

@ -52,7 +52,8 @@
var onchange = function(){
var nv = $(this).val();
var tid = $(this).data('from');
$('#'+tid).html(htmlize(nv))
$('#'+tid).html(htmlize(nv));
initQuill();
};
$("#Content").change(onchange);
$("#Title").change(onchange);
@ -68,44 +69,42 @@
$(".mdcoding").addClass('hidden');
}
});
var editortitre = new Quill('#titleview', {
modules: { toolbar: '#Titletoolbar' },
theme: 'snow'
});
var editorcontenu = new Quill('#contentview', {
modules: { toolbar: '#contentbar' },
theme: 'snow'
});
editortitre.on('selection-change', function(range) {
if (range) {
$('#contentbar').addClass('hidden');
$('#Titletoolbar').removeClass('hidden');
}
});
editortitre.on('text-change',function(delta,source){
if (source=='user')
{
updateMD('Title',$('#titleview').html())
}
});
editorcontenu.on('selection-change', function(range) {
if (range) {
$('#contentbar').removeClass('hidden');
$('#Titletoolbar').addClass('hidden');
}
});
editorcontenu.on('text-change',function(delta,source){
if (source=='user')
{
updateMD('Content',$('#contentview').html())
}
});
$('#contentview').focus(function(){
$('#contentbar').removeClass('hidden');
$('#Titletoolbar').addClass('hidden');
})
var initQuill = function() {
var editortitre = new Quill('#titleview', {
modules: { toolbar: '#Titletoolbar' },
theme: 'snow'
});
var editorcontenu = new Quill('#contentview', {
modules: { toolbar: '#contentbar' },
theme: 'snow'
});
editortitre.on('selection-change', function(range) {
if (range) {
$('#contentbar').addClass('hidden');
$('#Titletoolbar').removeClass('hidden');
}
});
editortitre.on('text-change',function(delta,source){
if (source=='user')
{
updateMD('Title',$('#titleview').html())
}
});
editorcontenu.on('selection-change', function(range) {
if (range) {
$('#contentbar').removeClass('hidden');
$('#Titletoolbar').addClass('hidden');
}
});
editorcontenu.on('text-change',function(delta,source){
if (source=='user')
{
updateMD('Content',$('#contentview').html())
}
});
};
initQuill();
Dropzone.options.postfiles= {
maxFilesize: 2, // MB