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