diff --git a/app/View/Elements/markdownEditor/markdownEditor.ctp b/app/View/Elements/markdownEditor/markdownEditor.ctp
index 1e46c3c68..ea898d8dd 100644
--- a/app/View/Elements/markdownEditor/markdownEditor.ctp
+++ b/app/View/Elements/markdownEditor/markdownEditor.ctp
@@ -98,7 +98,7 @@
-
+
= __('Edit report') ?>
@@ -221,4 +221,4 @@
if (!empty($additionalMarkdownElements)) {
echo $this->element($additionalMarkdownElements['path'], $additionalMarkdownElements['variables']);
}
-?>
\ No newline at end of file
+?>
diff --git a/app/webroot/js/markdownEditor/markdownEditor.js b/app/webroot/js/markdownEditor/markdownEditor.js
index 68d9ee5dc..ddb5bfb9e 100644
--- a/app/webroot/js/markdownEditor/markdownEditor.js
+++ b/app/webroot/js/markdownEditor/markdownEditor.js
@@ -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() {