Add the test for ckeditor with mode "inline" in setup page of ckeditor

This commit is contained in:
Laurent Destailleur 2019-04-12 17:44:22 +02:00
parent 4703444fbe
commit d728af9ced
2 changed files with 20 additions and 10 deletions

View File

@ -109,7 +109,7 @@ if (GETPOST('save', 'alpha'))
} else { } else {
$error ++; $error ++;
} }
$fckeditor_test = GETPOST('formtestfield'); $fckeditor_test = GETPOST('formtestfield');
if (! empty($fckeditor_test)) { if (! empty($fckeditor_test)) {
if (! dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity)) {
@ -156,7 +156,7 @@ else
{ {
// Si condition non remplie, on ne propose pas l'option // Si condition non remplie, on ne propose pas l'option
if (! $conditions[$const]) continue; if (! $conditions[$const]) continue;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="16">'.img_object("", $picto[$const]).'</td>'; print '<td width="16">'.img_object("", $picto[$const]).'</td>';
print '<td>'.$langs->trans($desc).'</td>'; print '<td>'.$langs->trans($desc).'</td>';
@ -181,12 +181,12 @@ else
print '<br>'."\n"; print '<br>'."\n";
print '<form name="formtest" method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form name="formtest" method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
// Skins // Skins
show_skin(null, 1); show_skin(null, 1);
print '<br>'."\n"; print '<br>'."\n";
$listofmodes=array('dolibarr_mailings','dolibarr_notes','dolibarr_details','dolibarr_readonly','Full'); $listofmodes=array('dolibarr_mailings', 'dolibarr_notes', 'dolibarr_details', 'dolibarr_readonly', 'Full', 'Full_inline');
$linkstomode=''; $linkstomode='';
foreach($listofmodes as $newmode) foreach($listofmodes as $newmode)
{ {
@ -200,10 +200,19 @@ else
$linkstomode.=''; $linkstomode.='';
print load_fiche_titre($langs->trans("TestSubmitForm"), $linkstomode, ''); print load_fiche_titre($langs->trans("TestSubmitForm"), $linkstomode, '');
print '<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).'">'; print '<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).'">';
$uselocalbrowser=true; if ($mode != 'Full_inline')
$readonly=($mode=='dolibarr_readonly'?1:0); {
$editor=new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST)?$conf->global->FCKEDITOR_TEST:'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly); $uselocalbrowser=true;
$editor->Create(); $readonly=($mode=='dolibarr_readonly'?1:0);
$editor=new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST)?$conf->global->FCKEDITOR_TEST:'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly);
$editor->Create();
}
else
{
print '<div style="border: 1px solid #888;" contenteditable="true">';
print $conf->global->FCKEDITOR_TEST;
print '</div>';
}
print '<br><div class="center"><input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"></div>'."\n"; print '<br><div class="center"><input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"></div>'."\n";
print '<div id="divforlog"></div>'; print '<div id="divforlog"></div>';
print '</form>'."\n"; print '</form>'."\n";

View File

@ -2922,11 +2922,12 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
// Change the contenteditable to "true" or "false" when mode Edit Inline is on or off // Change the contenteditable to "true" or "false" when mode Edit Inline is on or off
if (empty($conf->global->WEBSITE_EDITINLINE)) if (empty($conf->global->WEBSITE_EDITINLINE))
{ {
// Remove the contenteditable="true"
$newcontent = preg_replace('/(div|section)(\s[^\>]*)contenteditable="true"/', '\1\2', $newcontent); $newcontent = preg_replace('/(div|section)(\s[^\>]*)contenteditable="true"/', '\1\2', $newcontent);
} }
else else
{ {
// TODO Add the contenteditable="true" when mode Edit Inline is on // Keep the contenteditable="true" when mode Edit Inline is on
} }
$out.=dolWebsiteReplacementOfLinks($object, $newcontent)."\n"; $out.=dolWebsiteReplacementOfLinks($object, $newcontent)."\n";
//$out.=$newcontent; //$out.=$newcontent;