Added default content

This commit is contained in:
benweet 2013-04-29 22:41:10 +01:00
parent aae18b1bfb
commit 2c0ca1096d
7 changed files with 40 additions and 31 deletions

View File

@ -332,7 +332,8 @@ hr {
}
#modal-settings textarea {
height: 180px;
height: 80px;
max-width: 206px;
}
.tooltip-inner {

View File

@ -483,6 +483,15 @@
class="input-mini"><span class="help-inline">px</span>
</div>
</div>
<div class="control-group">
<label class="control-label"
for="textarea-settings-default-content">Default content <a
href="#" class="tooltip-default-content">(?)</a>
</label>
<div class="controls">
<textarea id="textarea-settings-default-content"></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="tabpane-settings-publish">

View File

@ -210,7 +210,8 @@ define(
layoutOrientation : "horizontal",
scrollLink : true,
editorFontSize : 14,
commitMsg : "Published by StackEdit",
defaultContent: "\n\n\n> Written with [StackEdit](http://benweet.github.io/stackedit/).",
commitMsg : "Published by http://benweet.github.io/stackedit",
template : ['<!DOCTYPE html>\n',
'<html>\n',
'<head>\n',
@ -228,19 +229,16 @@ define(
// Layout orientation
$("input:radio[name=radio-layout-orientation][value="
+ core.settings.layoutOrientation + "]").prop("checked", true);
// Scroll Link
$("#input-settings-scroll-link").prop("checked", core.settings.scrollLink);
// Converter type
$("#input-settings-converter-type").val(core.settings.converterType);
// Editor font size
$("#input-settings-editor-font-size").val(core.settings.editorFontSize);
// Default content
$("#textarea-settings-default-content").val(core.settings.defaultContent);
// Commit message
$("#input-settings-publish-commit-msg").val(core.settings.commitMsg);
// Template
$("#textarea-settings-publish-template").val(core.settings.template);
};
@ -251,19 +249,16 @@ define(
// Layout orientation
newSettings.layoutOrientation = $(
"input:radio[name=radio-layout-orientation]:checked").prop("value");
// Converter type
newSettings.converterType = $("#input-settings-converter-type").val();
// Scroll Link
newSettings.scrollLink = $("#input-settings-scroll-link").prop("checked");
// Editor font size
newSettings.editorFontSize = core.getInputIntValue($("#input-settings-editor-font-size"), event, 1, 99);
// Default content
newSettings.defaultContent = $("#textarea-settings-default-content").val();
// Commit message
newSettings.commitMsg = core.getInputValue($("#input-settings-publish-commit-msg"), event);
// Template
newSettings.template = core.getInputValue($("#textarea-settings-publish-template"), event);
@ -917,6 +912,12 @@ define(
'Therefore, if your document does not contain any title, the mapping will be linear and consequently less efficient.',
].join("")
});
$(".tooltip-default-content").tooltip({
html: true,
container: '#modal-settings',
placement: 'right',
title: 'Thanks for supporting StackEdit by adding a backlink in your documents!'
});
$(".tooltip-template").tooltip({
html: true,
container: '#modal-settings',

View File

@ -49,7 +49,7 @@ define(["jquery", "core", "synchronizer", "publisher", "text!../WELCOME.md", "un
};
fileManager.createFile = function(title, content, syncIndexes) {
content = content || "";
content = content || core.settings.defaultContent;
syncIndexes = syncIndexes || [];
if (!title) {
// Create a file title
@ -135,13 +135,15 @@ define(["jquery", "core", "synchronizer", "publisher", "text!../WELCOME.md", "un
synchronizer.resetSyncFlags();
function composeTitle(fileIndex) {
var result = " " + localStorage[fileIndex + ".title"];
var result = [];
var providerIdList = synchronizer.getSyncProvidersFromFile(fileIndex);
providerIsList = _.extend(providerIdList, publisher.getPublishProvidersFromFile(fileIndex));
_.each(providerIdList, function(providerId) {
result = '<i class="icon-' + providerId + '"></i>' + result;
providerIdList = providerIdList.concat(publisher.getPublishProvidersFromFile(fileIndex));
_.each(providerIdList.sort(), function(providerId) {
result.push('<i class="icon-' + providerId + '"></i>');
});
return result;
result.push(" ");
result.push(localStorage[fileIndex + ".title"]);
return result.join("");
}
// Update the file title
@ -231,7 +233,7 @@ define(["jquery", "core", "synchronizer", "publisher", "text!../WELCOME.md", "un
});
$("#file-title").click(function() {
$(this).hide();
$("#file-title-input").show().focus();
$("#file-title-input").show().focus().get(0).select();
});
function applyTitle(input) {
var title = $.trim(input.val());

View File

@ -210,10 +210,10 @@ define(["jquery", "core", "github-provider", "blogger-provider", "dropbox-provid
publisher.getPublishProvidersFromFile = function(fileIndex) {
var publishIndexList = _.compact(localStorage[fileIndex + ".publish"].split(";"));
var providerIdList = {};
var providerIdList = [];
_.each(publishIndexList, function(publishIndex) {
var publishAttributes = JSON.parse(localStorage[publishIndex]);
providerIdList[publishAttributes.provider] = publishAttributes.provider;
providerIdList.push(publishAttributes.provider);
});
return providerIdList;
};

View File

@ -225,13 +225,12 @@ define(["jquery", "core", "dropbox-provider", "gdrive-provider", "underscore"],
});
};
synchronizer.getSyncProvidersFromFile = function(fileIndex) {
var sync = localStorage[fileIndex + ".sync"];
var providerIdList = {};
_.each(providerMap, function(provider) {
if (sync.indexOf(";sync." + provider.providerId + ".") !== -1) {
provider.useSync = true;
providerIdList[provider.providerId] = provider.providerId;
}
var syncIndexList = _.compact(localStorage[fileIndex + ".sync"].split(";"));
var providerIdList = [];
_.each(syncIndexList, function(syncIndex) {
var syncAttributes = JSON.parse(localStorage[syncIndex]);
providerIdList.push(syncAttributes.provider);
providerMap[syncAttributes.provider].useSync = true;
});
return providerIdList;
};

View File

@ -1,3 +0,0 @@
> Written with [StackEdit](http://benweet.github.io/stackedit/).