Fix Markdown preview links focus

This commit is contained in:
Frederic Guillot
2015-09-05 12:20:57 -04:00
parent 512840fe1d
commit ccaf78b348
4 changed files with 9 additions and 9 deletions

View File

@@ -10,6 +10,7 @@ Improvements:
Bug fixes: Bug fixes:
* Fix typo in template that prevent the Gitlab oauth link to be displayed * Fix typo in template that prevent the Gitlab oauth link to be displayed
* Fix Markdown preview links focus
Version 1.0.18 Version 1.0.18
-------------- --------------

View File

@@ -31,6 +31,7 @@
</head> </head>
<body data-status-url="<?= $this->url->href('app', 'status') ?>" <body data-status-url="<?= $this->url->href('app', 'status') ?>"
data-login-url="<?= $this->url->href('auth', 'login') ?>" data-login-url="<?= $this->url->href('auth', 'login') ?>"
data-markdown-preview-url="<?= $this->url->href('app', 'preview') ?>"
data-timezone="<?= $this->app->getTimezone() ?>" data-timezone="<?= $this->app->getTimezone() ?>"
data-js-lang="<?= $this->app->jsLang() ?>"> data-js-lang="<?= $this->app->jsLang() ?>">

File diff suppressed because one or more lines are too long

View File

@@ -4,14 +4,15 @@ function Markdown() {
Markdown.prototype.showPreview = function(e) { Markdown.prototype.showPreview = function(e) {
e.preventDefault(); e.preventDefault();
var link = $(this);
var nav = $(this).closest("ul");
var write = $(".write-area"); var write = $(".write-area");
var preview = $(".preview-area"); var preview = $(".preview-area");
var textarea = $("textarea"); var textarea = $("textarea");
$("#markdown-write").parent().removeClass("form-tab-selected");
$("#markdown-preview").parent().addClass("form-tab-selected");
var request = $.ajax({ var request = $.ajax({
url: "?controller=app&action=preview", // TODO: remoe harcoded url url: $("body").data("markdown-preview-url"),
contentType: "application/json", contentType: "application/json",
type: "POST", type: "POST",
processData: false, processData: false,
@@ -22,9 +23,6 @@ Markdown.prototype.showPreview = function(e) {
}); });
request.done(function(data) { request.done(function(data) {
nav.find("li").removeClass("form-tab-selected");
link.parent().addClass("form-tab-selected");
preview.find(".markdown").html(data) preview.find(".markdown").html(data)
preview.css("height", textarea.css("height")); preview.css("height", textarea.css("height"));
preview.css("width", textarea.css("width")); preview.css("width", textarea.css("width"));
@@ -37,8 +35,8 @@ Markdown.prototype.showPreview = function(e) {
Markdown.prototype.showWriter = function(e) { Markdown.prototype.showWriter = function(e) {
e.preventDefault(); e.preventDefault();
$(this).closest("ul").find("li").removeClass("form-tab-selected") $("#markdown-write").parent().addClass("form-tab-selected");
$(this).parent().addClass("form-tab-selected"); $("#markdown-preview").parent().removeClass("form-tab-selected");
$(".write-area").show(); $(".write-area").show();
$(".preview-area").hide(); $(".preview-area").hide();