Skip to content
Closed
114 changes: 56 additions & 58 deletions dist/PublicLab.Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22151,7 +22151,7 @@ var woofmark = require("woofmark");
var domador = require("domador");
var megamark = require("megamark");

module.exports = function(textarea, _editor, _module) {
module.exports = function (textarea, _editor, _module) {
var icons = {
quote: "quote-right",
ol: "list-ol",
Expand All @@ -22163,7 +22163,7 @@ module.exports = function(textarea, _editor, _module) {

_module.options.tags =
_module.options.tags ||
function(data, done) {
function (data, done) {
done(null, [
{
list: [
Expand All @@ -22181,14 +22181,14 @@ module.exports = function(textarea, _editor, _module) {
storage: "ple-woofmark-mode",

render: {
modes: function(button, id) {
modes: function (button, id) {
button.className = "woofmark-mode-" + id;
if (id == "html") $(button).remove();
if (id == "markdown") button.innerHTML = "Markdown";
if (id == "wysiwyg") button.innerHTML = "Rich";
},

commands: function(button, id) {
commands: function (button, id) {
button.className = "woofmark-command-" + id;
var icon = icons[id] || id;
button.innerHTML = '<i class="fa fa-' + icon + '"></i>';
Expand All @@ -22208,14 +22208,14 @@ module.exports = function(textarea, _editor, _module) {
fieldKey: "image[photo]",

// additional form fields
formData: {nid: null, authenticity_token: _module.options.token},
formData: { nid: null, authenticity_token: _module.options.token },

// xhr upload options like CSRF token
xhrOptions: {
beforeSend: function(xhr) {
beforeSend: function (xhr) {
xhr.setRequestHeader(
"X-CSRF-Token",
$('meta[name="csrf-token"]').attr("content")
"X-CSRF-Token",
$('meta[name="csrf-token"]').attr("content")
);
}
},
Expand All @@ -22242,14 +22242,14 @@ module.exports = function(textarea, _editor, _module) {
fieldKey: "image[photo]",

// additional form fields
formData: {nid: null, authenticity_token: _module.options.token},
formData: { nid: null, authenticity_token: _module.options.token },

// xhr upload options like CSRF token
xhrOptions: {
beforeSend: function(xhr) {
beforeSend: function (xhr) {
xhr.setRequestHeader(
"X-CSRF-Token",
$('meta[name="csrf-token"]').attr("content")
"X-CSRF-Token",
$('meta[name="csrf-token"]').attr("content")
);
}
},
Expand Down Expand Up @@ -22280,7 +22280,7 @@ module.exports = function(textarea, _editor, _module) {
}
},

mergeHtmlAndAttachment: function(chunks, link) {
mergeHtmlAndAttachment: function (chunks, link) {
var linkText = chunks.selection || link.title;
console.log(link, chunks);
if (false) console.log(link);
Expand All @@ -22306,7 +22306,7 @@ module.exports = function(textarea, _editor, _module) {
}
},

parseMarkdown: function(input) {
parseMarkdown: function (input) {
_module.scrollTop = document.body.scrollTop;

return megamark(input, {
Expand Down Expand Up @@ -22376,42 +22376,42 @@ module.exports = function(textarea, _editor, _module) {
tokenizers: [
{
token: /(^|\s)@([A-z\_]+)\b/g, // @callouts
transform: function(all, separator, id) {
transform: function (all, separator, id) {
return (
separator + '<a href="/profile/' + id + '">@' + id + "</a>"
);
}
},
{
token: /(^|\s)#([A-z\-]+)\b/g, // #hashtags
transform: function(all, separator, id) {
transform: function (all, separator, id) {
return separator + '<a href="/tag/' + id + '">#' + id + "</a>";
}
},
{
token: /\[([\S\:\/]+)\]/, // [power:tags]
transform: function(all, keywords) {
transform: function (all, keywords) {
return '<div class="powertags">Power tag: ' + keywords + "</div>";
}
}
]
});
},

parseHTML: function(input) {
parseHTML: function (input) {
_module.scrollTop = document.body.scrollTop;

return domador(input, {
allowFrame: true,
inline: true,
fencing: true,
fencinglanguage: function(el) {
fencinglanguage: function (el) {
var match = el.className.match(/md-lang-((?:[^\s]|$)+)/);
if (match) {
return match.pop();
}
},
transform: function(el) {
transform: function (el) {
if (el.tagName === "IFRAME") {
return "\n\n\n" + el.outerHTML;
}
Expand All @@ -22436,46 +22436,46 @@ module.exports = function(textarea, _editor, _module) {
}
});
require("../modules/PublicLab.CustomInsert.js")(
_module,
wysiwyg
_module,
wysiwyg
);

// set up table generation tools:
require("../modules/PublicLab.RichTextModule.Table.js")(_module, wysiwyg);

// set up horizontal rule insertion tool:
require("../modules/PublicLab.RichTextModule.HorizontalRule.js")(
_module,
wysiwyg
_module,
wysiwyg
);

// set up auto center insertion tool:
require("../modules/PublicLab.RichTextModule.AutoCenter.js")(
_module,
wysiwyg
_module,
wysiwyg
);

// set up embed insertion tool:
require("../modules/PublicLab.RichTextModule.Embed.js")(_module, wysiwyg);

wysiwyg.stylePrompt = function() {
wysiwyg.stylePrompt = function () {
$(".wk-prompt button, span.wk-prompt-browse").addClass("btn btn-outline-secondary");
$(".wk-prompt input")
.addClass("input form-control")
.css("margin-bottom", "5px");
.addClass("input form-control")
.css("margin-bottom", "5px");
};

$(
".wk-commands button.woofmark-command-attachment, .wk-commands button.woofmark-command-image"
".wk-commands button.woofmark-command-attachment, .wk-commands button.woofmark-command-image"
).click(wysiwyg.stylePrompt);

wysiwyg.style = function() {
wysiwyg.style = function () {
$(".wk-commands").after(
'&nbsp; <span style="color:#888;display:none;" class="ple-history-saving btn"><i class="fa fa-clock-o"></i> <span class="hidden-xs">Saving...</span></span>'
'&nbsp; <span style="color:#888;display:none;" class="ple-history-saving btn"><i class="fa fa-clock-o"></i> <span class="hidden-xs">Saving...</span></span>'
);
$(".wk-commands, .wk-switchboard").addClass("btn-group");
$(".wk-commands button, .wk-switchboard button").addClass(
"btn btn-light"
"btn btn-light"
);

$(".wk-commands a.woofmark-command-insert").addClass("btn-light");
Expand All @@ -22486,20 +22486,20 @@ module.exports = function(textarea, _editor, _module) {
$(".wk-commands button.woofmark-command-attachment").addClass("hidden-xs");

$(".wk-switchboard button.woofmark-mode-markdown")
.parent()
.removeClass("btn-group");
.parent()
.removeClass("btn-group");
$(".wk-switchboard button.woofmark-mode-markdown").html(
'<span class="visible-xs">#</span><span class="hidden-xs">Markdown</span>'
'<span class="visible-xs">#</span><span class="hidden-xs">Markdown</span>'
);
$(".wk-switchboard button.woofmark-mode-wysiwyg").html(
'<span class="visible-xs">Aa</span><span class="hidden-xs">Rich</span>'
'<span class="visible-xs">Aa</span><span class="hidden-xs">Rich</span>'
);

if (wysiwyg.mode === "wysiwyg") {
$(".wk-switchboard button.woofmark-mode-wysiwyg").hide();
} else $(".wk-switchboard button.woofmark-mode-markdown").hide();

$(".wk-switchboard button").click(function() {
$(".wk-switchboard button").click(function () {
$(this).tooltip('hide');
$(".wk-switchboard button.woofmark-mode-markdown").toggle();
$(".wk-switchboard button.woofmark-mode-wysiwyg").toggle();
Expand All @@ -22522,7 +22522,6 @@ module.exports = function(textarea, _editor, _module) {

return wysiwyg;
};

},{"../modules/PublicLab.CustomInsert.js":186,"../modules/PublicLab.RichTextModule.AutoCenter.js":190,"../modules/PublicLab.RichTextModule.Embed.js":191,"../modules/PublicLab.RichTextModule.HorizontalRule.js":192,"../modules/PublicLab.RichTextModule.Table.js":193,"domador":15,"megamark":112,"woofmark":176}],184:[function(require,module,exports){
module.exports = {

Expand Down Expand Up @@ -23340,47 +23339,47 @@ module.exports = function initTables(_module, wysiwyg) {
// create a submenu for sizing tables
$('.wk-commands').append('<button class="woofmark-command-table btn btn-outline-secondary" data-toggle="table" title="Table <table>"><i class="fa fa-table"></i></button>');

$(document).ready(function() {
$(document).ready(function () {
$('[data-toggle="table"]').tooltip();
});

var builder = '<div class="form-inline form-group ple-table-popover" style="width:400px;">';
builder += '<a id="decRows" class="btn btn-sm btn-outline-secondary"><i class="fa fa-minus"></i></a> <span id="tableRows">4</span> <a id="incRows" class="btn btn-sm btn-outline-secondary"><i class="fa fa-plus"></i></a>';
builder += ' x ';
builder += '<a id="decCols" class="btn btn-sm btn-outline-secondary"><i class="fa fa-minus"></i></a> <span id="tableCols">3</span> <a id="incCols" class="btn btn-sm btn-outline-secondary"><i class="fa fa-plus"></i></a>';
builder += '<a id="decRows" class="btn btn-sm btn-outline-secondary"><i class="fa fa-minus"></i></a> <span id="tableRows" class="mx-1">4</span> <a id="incRows" class="btn btn-sm btn-outline-secondary"><i class="fa fa-plus"></i></a>';
builder += ' <span class="mx-1">x</span> ';
builder += '<a id="decCols" class="btn btn-sm btn-outline-secondary"><i class="fa fa-minus"></i></a> <span id="tableCols" class="mx-1">3</span> <a id="incCols" class="btn btn-sm btn-outline-secondary"><i class="fa fa-plus"></i></a>';
builder += '&nbsp;<a class="ple-table-size btn btn-outline-secondary">Add</a>';
builder += '</div>';

$('.woofmark-command-table').attr('data-content', builder);


$(document).on('click', '#incRows', function() {
$("#tableRows").text( Number($("#tableRows").text()) + 1 );
$(document).on('click', '#incRows', function () {
$("#tableRows").text(Number($("#tableRows").text()) + 1);
});
$(document).on('click', '#decRows', function() {
$(document).on('click', '#decRows', function () {
const numOfRows = Number($("#tableRows").text());
if (numOfRows > 1) $("#tableRows").text( numOfRows - 1 );
if (numOfRows > 1) $("#tableRows").text(numOfRows - 1);
});
$(document).on('click', '#incCols', function() {
$("#tableCols").text( Number($("#tableCols").text()) + 1 );
$(document).on('click', '#incCols', function () {
$("#tableCols").text(Number($("#tableCols").text()) + 1);
});
$(document).on('click', '#decCols', function() {
$(document).on('click', '#decCols', function () {
const numOfCols = Number($("#tableCols").text());
if (numOfCols > 1) $("#tableCols").text( numOfCols - 1 );
if (numOfCols > 1) $("#tableCols").text(numOfCols - 1);
});

$('.woofmark-command-table').attr('data-content', builder);
$('.woofmark-command-table').attr('data-container', 'body');
$('.woofmark-command-table').attr('data-placement', 'top');

$('.woofmark-command-table').popover({html: true});
$('.woofmark-command-table').popover({ html: true });

$('.wk-commands .woofmark-command-table').click(function() {
$('.ple-table-size').click(function() {
wysiwyg.runCommand(function(chunks, mode) {
$('.wk-commands .woofmark-command-table').click(function () {
$('.ple-table-size').click(function () {
wysiwyg.runCommand(function (chunks, mode) {
var table = createTable(
+Number($('.ple-table-popover #tableCols').text()),
+Number($('.ple-table-popover #tableRows').text())
+Number($('.ple-table-popover #tableCols').text()),
+Number($('.ple-table-popover #tableRows').text())
);

if (mode === 'markdown') chunks.before += table;
Expand All @@ -23394,7 +23393,6 @@ module.exports = function initTables(_module, wysiwyg) {
});
});
};

},{}],194:[function(require,module,exports){
/*
* Form module for rich text entry
Expand Down
Loading