change: preview in same tab with back button

This commit is contained in:
quenousimporte 2024-10-07 17:57:18 +02:00
parent 2ba071e361
commit 22e0065507
1 changed files with 29 additions and 20 deletions

View File

@ -27,7 +27,7 @@
}
else if (isset($_POST['preview']))
{
header("Location: note.php?preview=1&title=" . $title);
header("Location: note.php?preview=true&title=" . $title);
exit;
}
else
@ -87,26 +87,35 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<form action="note.php" method="POST" <? if(isset($_GET['preview'])) echo 'hidden'; ?>>
<div>
<input type="submit" name="home" value="home" accesskey="h">
<input type="submit" name="save" value="save" accesskey="s">
<input type="submit" name="preview" value="preview" accesskey="p" formtarget="_bbn_preview">
<input type="submit" name="download" value="download" accesskey="d">
<input type="submit" name="delete" value="delete">
<input hidden name="lastchanged" value="<? echo $lastchanged; ?>">
<div><input autocomplete="off" class="title" name="title" value="<? echo $title; ?>"></div>
</div>
<div class="editor">
<textarea rows="<? echo $rows; ?>" autofocus name="content" spellcheck="false"><? echo $content; ?></textarea>
</div>
<input hidden name="previoustitle" value="<? echo $title; ?>">
<?php
echo '<div class="grey">' . $lines . '&nbsp;' . $words . '&nbsp;' . $chars . '&nbsp;' . $title . '.md</div>';
echo linksdiv($content);
?>
</form>
<!-- editor -->
<div <? if(isset($_GET['preview'])) echo 'hidden'; ?>>
<form action="note.php" method="POST">
<div>
<input type="submit" name="home" value="home" accesskey="h">
<input type="submit" name="save" value="save" accesskey="s">
<input type="submit" name="preview" value="preview" accesskey="p">
<input type="submit" name="download" value="download" accesskey="d">
<input type="submit" name="delete" value="delete">
<input hidden name="lastchanged" value="<? echo $lastchanged; ?>">
<div><input autocomplete="off" class="title" name="title" value="<? echo $title; ?>"></div>
</div>
<div class="editor">
<textarea rows="<? echo $rows; ?>" autofocus name="content" spellcheck="false"><? echo $content; ?></textarea>
</div>
<input hidden name="previoustitle" value="<? echo $title; ?>">
<?php
echo '<div class="grey">' . $lines . '&nbsp;' . $words . '&nbsp;' . $chars . '&nbsp;' . $title . '.md</div>';
echo linksdiv($content);
?>
</form>
</div>
<!-- preview -->
<div <? if(!isset($_GET['preview'])) echo 'hidden'; ?>>
<form action="note.php" method="GET">
<input type="submit" value="back">
<input hidden name="title" value="<? echo $title; ?>">
</form>
<?
echo computepreview($title, $content);
?>