Stackedit/js/extensions/buttonHtmlCode.js

35 lines
930 B
JavaScript
Raw Normal View History

2013-06-19 20:33:46 +00:00
define([
"jquery",
"text!html/buttonHtmlCode.html",
], function($, buttonHtmlCodeHTML) {
var buttonHtmlCode = {
extensionId: "buttonHtmlCode",
extensionName: 'Button "HTML code"',
optional: true,
settingsBloc: '<p>Adds a "HTML code" button over the preview.</p>'
};
buttonHtmlCode.onCreatePreviewButton = function() {
return $(buttonHtmlCodeHTML);
};
buttonHtmlCode.onPreviewFinished = function() {
$("#input-html-code").val($("#wmd-preview").html());
};
buttonHtmlCode.onReady = function() {
$(".action-html-code").click(function() {
_.defer(function() {
$("#input-html-code").each(function() {
if($(this).is(":hidden"))
return;
$(this).get(0).select();
});
});
});
};
return buttonHtmlCode;
});