Stackedit/js/extensions/buttonHtmlCode.js

39 lines
1.0 KiB
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() {
$("#input-html-code").click(function(event) {
event.stopPropagation();
});
$(".action-html-code").click(function() {
_.defer(function() {
$("#input-html-code").each(function() {
if($(this).is(":hidden"))
return;
$(this).get(0).select();
});
});
});
};
return buttonHtmlCode;
});