Configurable font family. Fixes #24
This commit is contained in:
parent
0b180a0981
commit
cc5ffbd7ef
@ -343,7 +343,6 @@ hr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#wmd-input,#md-section-helper {
|
#wmd-input,#md-section-helper {
|
||||||
font-family: "Courier New", Courier, monospace;
|
|
||||||
resize: none;
|
resize: none;
|
||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
16
index.html
16
index.html
@ -447,6 +447,13 @@
|
|||||||
placeholder="repository-name">
|
placeholder="repository-name">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control-group modal-publish-github">
|
||||||
|
<label class="control-label" for="input-publish-github-username">Username (optional)</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="input-publish-github-username"
|
||||||
|
placeholder="username">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="control-group modal-publish-github">
|
<div class="control-group modal-publish-github">
|
||||||
<label class="control-label" for="input-publish-github-branch">Branch</label>
|
<label class="control-label" for="input-publish-github-branch">Branch</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
@ -660,10 +667,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label"
|
<label class="control-label"
|
||||||
for="input-settings-editor-font-size">Editor font size</label>
|
for="input-settings-editor-font-family">Editor font</label>
|
||||||
<div class="controls">
|
<div class="controls form-inline">
|
||||||
<input type="text" id="input-settings-editor-font-size"
|
<input type="text" id="input-settings-editor-font-family"
|
||||||
class="input-mini"><span class="help-inline">px</span>
|
class="span2"> <input type="text" id="input-settings-editor-font-size"
|
||||||
|
class="input-mini"><span class="help-inline">px</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
@ -104,6 +104,8 @@ define([
|
|||||||
utils.setInputValue("#input-settings-theme", localStorage.theme);
|
utils.setInputValue("#input-settings-theme", localStorage.theme);
|
||||||
// Lazy rendering
|
// Lazy rendering
|
||||||
utils.setInputChecked("#input-settings-lazy-rendering", settings.lazyRendering);
|
utils.setInputChecked("#input-settings-lazy-rendering", settings.lazyRendering);
|
||||||
|
// Editor font family
|
||||||
|
utils.setInputValue("#input-settings-editor-font-family", settings.editorFontFamily);
|
||||||
// Editor font size
|
// Editor font size
|
||||||
utils.setInputValue("#input-settings-editor-font-size", settings.editorFontSize);
|
utils.setInputValue("#input-settings-editor-font-size", settings.editorFontSize);
|
||||||
// Default content
|
// Default content
|
||||||
@ -129,6 +131,8 @@ define([
|
|||||||
var theme = utils.getInputValue("#input-settings-theme");
|
var theme = utils.getInputValue("#input-settings-theme");
|
||||||
// Lazy Rendering
|
// Lazy Rendering
|
||||||
newSettings.lazyRendering = utils.getInputChecked("#input-settings-lazy-rendering");
|
newSettings.lazyRendering = utils.getInputChecked("#input-settings-lazy-rendering");
|
||||||
|
// Editor font family
|
||||||
|
newSettings.editorFontFamily = utils.getInputTextValue("#input-settings-editor-font-family", event);
|
||||||
// Editor font size
|
// Editor font size
|
||||||
newSettings.editorFontSize = utils.getInputIntValue("#input-settings-editor-font-size", event, 1, 99);
|
newSettings.editorFontSize = utils.getInputIntValue("#input-settings-editor-font-size", event, 1, 99);
|
||||||
// Default content
|
// Default content
|
||||||
@ -440,7 +444,8 @@ define([
|
|||||||
|
|
||||||
// Editor's textarea
|
// Editor's textarea
|
||||||
$("#wmd-input, #md-section-helper").css({
|
$("#wmd-input, #md-section-helper").css({
|
||||||
// Apply editor font size
|
// Apply editor font
|
||||||
|
"font-family": settings.editorFontFamily,
|
||||||
"font-size": settings.editorFontSize + "px",
|
"font-size": settings.editorFontSize + "px",
|
||||||
"line-height": Math.round(settings.editorFontSize * (20 / 14)) + "px"
|
"line-height": Math.round(settings.editorFontSize * (20 / 14)) + "px"
|
||||||
});
|
});
|
||||||
|
@ -173,21 +173,9 @@ define([
|
|||||||
|
|
||||||
// Create extension preview buttons
|
// Create extension preview buttons
|
||||||
logger.log("onCreatePreviewButton");
|
logger.log("onCreatePreviewButton");
|
||||||
function showDropdown(btnGroup) {
|
|
||||||
$("#extension-preview-buttons .open").removeClass("open").find(".dropdown-menu").addClass("hide");
|
|
||||||
if(btnGroup !== undefined) {
|
|
||||||
btnGroup.addClass("open").find(".dropdown-menu").removeClass("hide");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var onCreatePreviewButtonCallbackList = getExtensionCallbackList("onCreatePreviewButton");
|
var onCreatePreviewButtonCallbackList = getExtensionCallbackList("onCreatePreviewButton");
|
||||||
_.each(onCreatePreviewButtonCallbackList, function(callback) {
|
_.each(onCreatePreviewButtonCallbackList, function(callback) {
|
||||||
$("#extension-preview-buttons").append($('<div class="btn-group">').append(callback()).each(function() {
|
$("#extension-preview-buttons").append($('<div class="btn-group">').append(callback()));
|
||||||
// Toggle dropdown manually
|
|
||||||
var btnGroup = $(this);
|
|
||||||
btnGroup.find(".dropdown-toggle").click(function() {
|
|
||||||
showDropdown(btnGroup.is(".open") ? undefined : btnGroup);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Call extensions onReady callbacks
|
// Call extensions onReady callbacks
|
||||||
|
@ -67,9 +67,15 @@ define([
|
|||||||
_gaq.push([
|
_gaq.push([
|
||||||
'_trackEvent',
|
'_trackEvent',
|
||||||
"Settings",
|
"Settings",
|
||||||
'editorFontSize',
|
'editorFontFamily',
|
||||||
"" + settings.editorFontSize
|
"" + settings.editorFontFamily
|
||||||
]);
|
]);
|
||||||
|
_gaq.push([
|
||||||
|
'_trackEvent',
|
||||||
|
"Settings",
|
||||||
|
'editorFontSize',
|
||||||
|
"" + settings.editorFontSize
|
||||||
|
]);
|
||||||
// Check if user has removed back links
|
// Check if user has removed back links
|
||||||
_gaq.push([
|
_gaq.push([
|
||||||
'_trackEvent',
|
'_trackEvent',
|
||||||
|
@ -110,25 +110,24 @@ define([
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
githubHelper.upload = function(reponame, branch, path, content, commitMsg, callback) {
|
githubHelper.upload = function(reponame, username, branch, path, content, commitMsg, callback) {
|
||||||
var task = new AsyncTask();
|
var task = new AsyncTask();
|
||||||
connect(task);
|
connect(task);
|
||||||
authenticate(task);
|
authenticate(task);
|
||||||
task.onRun(function() {
|
task.onRun(function() {
|
||||||
var userLogin = undefined;
|
function getUsername() {
|
||||||
function getUserLogin() {
|
|
||||||
var user = github.getUser();
|
var user = github.getUser();
|
||||||
user.show(undefined, function(err, result) {
|
user.show(undefined, function(err, result) {
|
||||||
if(err) {
|
if(err) {
|
||||||
handleError(err, task);
|
handleError(err, task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userLogin = result.login;
|
username = result.login;
|
||||||
task.chain(write);
|
task.chain(write);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function write() {
|
function write() {
|
||||||
var repo = github.getRepo(userLogin, reponame);
|
var repo = github.getRepo(username, reponame);
|
||||||
repo.write(branch, path, content, commitMsg, function(err) {
|
repo.write(branch, path, content, commitMsg, function(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
handleError(err, task);
|
handleError(err, task);
|
||||||
@ -137,7 +136,12 @@ define([
|
|||||||
task.chain();
|
task.chain();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
task.chain(getUserLogin);
|
if(username) {
|
||||||
|
task.chain(write);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
task.chain(getUsername);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
task.onSuccess(function() {
|
task.onSuccess(function() {
|
||||||
callback();
|
callback();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<button class="btn dropdown-toggle action-html-code" title="HTML code">
|
<button class="btn dropdown-toggle action-html-code" title="HTML code" data-toggle="dropdown">
|
||||||
<i class="icon-code"></i>
|
<i class="icon-code"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu pull-right">
|
<div class="dropdown-menu pull-right">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<button class="btn dropdown-toggle" title="Markdown syntax">
|
<button class="btn dropdown-toggle" title="Markdown syntax" data-toggle="dropdown">
|
||||||
<i class="icon-question-sign"></i>
|
<i class="icon-question-sign"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu pull-right">
|
<div class="dropdown-menu pull-right">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<button class="btn dropdown-toggle" title="Document statistics">
|
<button class="btn dropdown-toggle" title="Document statistics" data-toggle="dropdown">
|
||||||
<i class="icon-stat"></i>
|
<i class="icon-stat"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu pull-right">
|
<div class="dropdown-menu pull-right">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<button class="btn dropdown-toggle" title="Table of contents">
|
<button class="btn dropdown-toggle" title="Table of contents" data-toggle="dropdown">
|
||||||
<i class="icon-th-list"></i>
|
<i class="icon-list"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu pull-right">
|
<div class="dropdown-menu pull-right">
|
||||||
<h3>Table of contents</h3>
|
<h3>Table of contents</h3>
|
||||||
|
@ -8,17 +8,19 @@ define([
|
|||||||
var githubProvider = new Provider("github", "GitHub");
|
var githubProvider = new Provider("github", "GitHub");
|
||||||
githubProvider.publishPreferencesInputIds = [
|
githubProvider.publishPreferencesInputIds = [
|
||||||
"github-reponame",
|
"github-reponame",
|
||||||
|
"github-username",
|
||||||
"github-branch"
|
"github-branch"
|
||||||
];
|
];
|
||||||
|
|
||||||
githubProvider.publish = function(publishAttributes, title, content, callback) {
|
githubProvider.publish = function(publishAttributes, title, content, callback) {
|
||||||
var commitMsg = settings.commitMsg;
|
var commitMsg = settings.commitMsg;
|
||||||
githubHelper.upload(publishAttributes.repository, publishAttributes.branch, publishAttributes.path, content, commitMsg, callback);
|
githubHelper.upload(publishAttributes.repository, publishAttributes.username, publishAttributes.branch, publishAttributes.path, content, commitMsg, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
githubProvider.newPublishAttributes = function(event) {
|
githubProvider.newPublishAttributes = function(event) {
|
||||||
var publishAttributes = {};
|
var publishAttributes = {};
|
||||||
publishAttributes.repository = utils.getInputTextValue("#input-publish-github-reponame", event);
|
publishAttributes.repository = utils.getInputTextValue("#input-publish-github-reponame", event);
|
||||||
|
publishAttributes.username = utils.getInputTextValue("#input-publish-github-username");
|
||||||
publishAttributes.branch = utils.getInputTextValue("#input-publish-github-branch", event);
|
publishAttributes.branch = utils.getInputTextValue("#input-publish-github-branch", event);
|
||||||
publishAttributes.path = utils.getInputTextValue("#input-publish-file-path", event);
|
publishAttributes.path = utils.getInputTextValue("#input-publish-file-path", event);
|
||||||
if(event.isPropagationStopped()) {
|
if(event.isPropagationStopped()) {
|
||||||
|
@ -6,6 +6,7 @@ define([
|
|||||||
var settings = {
|
var settings = {
|
||||||
layoutOrientation: "horizontal",
|
layoutOrientation: "horizontal",
|
||||||
lazyRendering: true,
|
lazyRendering: true,
|
||||||
|
editorFontFamily: "Courier New, Courier, monospace",
|
||||||
editorFontSize: 14,
|
editorFontSize: 14,
|
||||||
defaultContent: "\n\n\n> Written with [StackEdit](" + MAIN_URL + ").",
|
defaultContent: "\n\n\n> Written with [StackEdit](" + MAIN_URL + ").",
|
||||||
commitMsg: "Published with " + MAIN_URL,
|
commitMsg: "Published with " + MAIN_URL,
|
||||||
|
Loading…
Reference in New Issue
Block a user