mirror of https://github.com/MISP/MISP
chg: [UI] Go directly to edit mode after clicking to "Edit report" button
parent
8403bdee44
commit
df5f65da25
|
@ -98,7 +98,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
<?php elseif($canEdit && !empty($editRedirect)): ?>
|
||||
<a id="saveMarkdownButton" type="button" class="btn btn-primary" href="<?= h($editRedirect) ?>" target="_blank">
|
||||
<a type="button" class="btn btn-primary" href="<?= h($editRedirect) ?>#splitscreen" target="_blank">
|
||||
<i class="<?= $this->FontAwesome->getClass('edit') ?>"></i>
|
||||
<?= __('Edit report') ?>
|
||||
</a>
|
||||
|
@ -221,4 +221,4 @@
|
|||
if (!empty($additionalMarkdownElements)) {
|
||||
echo $this->element($additionalMarkdownElements['path'], $additionalMarkdownElements['variables']);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -40,7 +40,15 @@ $(document).ready(function() {
|
|||
initCodeMirror()
|
||||
toggleSaveButton(false)
|
||||
}
|
||||
setMode(defaultMode)
|
||||
var mode = defaultMode;
|
||||
if (window.location.hash) {
|
||||
// Switch to mode by using #[mode_name] in URL
|
||||
var anchor = window.location.hash.substr(1);
|
||||
if ((canEdit && (anchor === 'editor' || anchor === 'splitscreen')) || anchor === 'viewer' || anchor === 'raw') {
|
||||
mode = anchor;
|
||||
}
|
||||
}
|
||||
setMode(mode)
|
||||
if (canEdit) {
|
||||
setEditorData(originalRaw);
|
||||
|
||||
|
@ -337,20 +345,20 @@ function setMode(mode) {
|
|||
$mardownViewerToolbar.find('button[data-togglemode="' + mode + '"]').addClass('btn-inverse')
|
||||
hideAll()
|
||||
$editorContainer.css('width', '');
|
||||
if (mode == 'raw') {
|
||||
if (mode === 'raw') {
|
||||
$rawContainer.show()
|
||||
}
|
||||
if (mode == 'splitscreen') {
|
||||
if (mode === 'splitscreen') {
|
||||
$resizableHandle.show()
|
||||
$splitContainer.addClass('split-actif')
|
||||
} else {
|
||||
$resizableHandle.hide()
|
||||
$splitContainer.removeClass('split-actif')
|
||||
}
|
||||
if (mode == 'viewer' || mode == 'splitscreen') {
|
||||
if (mode === 'viewer' || mode === 'splitscreen') {
|
||||
$viewerContainer.show()
|
||||
}
|
||||
if (mode == 'editor' || mode == 'splitscreen') {
|
||||
if (mode === 'editor' || mode === 'splitscreen') {
|
||||
$editorContainer.show({
|
||||
duration: 0,
|
||||
complete: function() {
|
||||
|
|
Loading…
Reference in New Issue