define([ "jquery", "text!html/buttonHtmlCode.html", ], function($, buttonHtmlCodeHTML) { var buttonHtmlCode = { extensionId: "buttonHtmlCode", extensionName: 'Button "HTML code"', optional: true, settingsBloc: '
Adds a "HTML code" button over the preview.
' }; 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; });