diff --git a/dist/PublicLab.Editor.js b/dist/PublicLab.Editor.js
index 48e89b62..b193f8b0 100644
--- a/dist/PublicLab.Editor.js
+++ b/dist/PublicLab.Editor.js
@@ -21735,7 +21735,7 @@ PL.Editor = Class.extend({
});
-},{"./PublicLab.Errors.js":179,"./PublicLab.Help.js":180,"./PublicLab.History.js":181,"./adapters/PublicLab.Formatter.js":182,"./adapters/PublicLab.Woofmark.js":183,"./core/Util.js":184,"./modules/PublicLab.MainImageModule.js":185,"./modules/PublicLab.MapModule.js":186,"./modules/PublicLab.Module.js":187,"./modules/PublicLab.RichTextModule.js":192,"./modules/PublicLab.TagsModule.js":193,"./modules/PublicLab.TitleModule.js":195,"resig-class":117}],179:[function(require,module,exports){
+},{"./PublicLab.Errors.js":179,"./PublicLab.Help.js":180,"./PublicLab.History.js":181,"./adapters/PublicLab.Formatter.js":182,"./adapters/PublicLab.Woofmark.js":183,"./core/Util.js":184,"./modules/PublicLab.MainImageModule.js":187,"./modules/PublicLab.MapModule.js":188,"./modules/PublicLab.Module.js":189,"./modules/PublicLab.RichTextModule.js":194,"./modules/PublicLab.TagsModule.js":195,"./modules/PublicLab.TitleModule.js":197,"resig-class":117}],179:[function(require,module,exports){
/*
* Error display; error format is:
* "title": ["can't be blank"]
@@ -22292,7 +22292,7 @@ module.exports = function(textarea, _editor, _module) {
],
allowedAttributes: {
- a: ["href", "name", "class", "target", "title", "aria-label"],
+ a: ["href", "name", "target", "title", "aria-label"],
iframe: [
"allowfullscreen",
"frameborder",
@@ -22362,12 +22362,16 @@ module.exports = function(textarea, _editor, _module) {
}
if (el.tagName === "DIV" && $(el).hasClass("powertags")) {
- return "[" + el.innerHTML.replace("Power tag: ", "") + "]";
+ return "[" + el.innerHTML.replace("Power tag: ", "") + "]" + '\n';
}
}
});
}
});
+ require("../modules/PublicLab.CustomInsert.js")(
+ _module,
+ wysiwyg
+ );
// set up table generation tools:
require("../modules/PublicLab.RichTextModule.Table.js")(_module, wysiwyg);
@@ -22450,7 +22454,7 @@ module.exports = function(textarea, _editor, _module) {
return wysiwyg;
};
-},{"../modules/PublicLab.RichTextModule.AutoCenter.js":188,"../modules/PublicLab.RichTextModule.Embed.js":189,"../modules/PublicLab.RichTextModule.HorizontalRule.js":190,"../modules/PublicLab.RichTextModule.Table.js":191,"domador":15,"megamark":112,"woofmark":176}],184:[function(require,module,exports){
+},{"../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 = {
getUrlHashParameter: function(sParam) {
@@ -22584,6 +22588,151 @@ module.exports = {
};
},{}],185:[function(require,module,exports){
+ var builder = '
';
+ builder += '';
+ builder += '';
+ builder += '
';
+ builder += '';
+ builder += '';
+ builder += '';
+ builder += '
';
+ builder += '';
+ builder += '';
+ builder += '';
+ builder += '';
+ builder += '';
+ builder += '
';
+ module.exports = builder;
+},{}],186:[function(require,module,exports){
+module.exports = function CustomInsert(_module, wysiwyg) {
+
+ function Syntax(tag, Option1, Option2) {
+ if (Option2 === "List") {
+ switch (Option1) {
+ case "Notes":
+ var syn = "[notes:" + tag + "]";
+ break;
+ case "Wikis":
+ var syn = "[wikis:" + tag + "]";
+ break;
+ case "Nodes(Wikis + Notes)":
+ var syn = "[nodes:" + tag + "]";
+ break;
+ case "Activity":
+ var syn = "[activity:" + tag + "]";
+ break;
+ case "Questions":
+ var syn = "[questions:" + tag + "]";
+ break;
+ }
+ }
+ if (Option2 == "Grid") {
+ switch (Option1) {
+ case "Notes":
+ var syn = "[notes:grid:" + tag + "]";
+ break;
+ case "Wikis":
+ var syn = "[wikis:grid:" + tag + "]";
+ break;
+ case "Nodes(Wikis + Notes)":
+ var syn = "[nodes:grid:" + tag + "]";
+ break;
+ case "Activity":
+ var syn = "[activity:grid:" + tag + "]";
+ break;
+ case "Questions":
+ var syn = "[questions:grid:" + tag + "]";
+ break;
+ }
+ }
+ return syn;
+ }
+ $.fn.extend({
+ insertAtCaret: function(myValue) {
+ return this.each(function(i) {
+ if (document.selection) {
+ // For browsers like Internet Explorer
+ this.focus();
+ var sel = document.selection.createRange();
+ sel.text = myValue;
+ this.focus();
+ } else if (this.selectionStart || this.selectionStart == '0') {
+ // For browsers like Firefox and Webkit based
+ var startPos = this.selectionStart;
+ var endPos = this.selectionEnd;
+ var scrollTop = this.scrollTop;
+ this.value = this.value.substring(0, startPos)+myValue+this.value.substring(endPos, this.value.length);
+ this.focus();
+ this.selectionStart = startPos + myValue.length;
+ this.selectionEnd = startPos + myValue.length;
+ this.scrollTop = scrollTop;
+ } else {
+ this.value += myValue;
+ this.focus();
+ }
+ });
+ }
+ });
+ const builder = require("./PublicLab.CustomInsert.Template.js");
+ $('.wk-commands').append('');
+ var Option1 = "Notes";
+ var Option2 = "List";
+ $('.woofmark-command-insert').attr('data-content', builder);
+ $('.woofmark-command-insert').attr('data-container', 'body');
+ $('.woofmark-command-insert').attr('data-placement', 'top');
+ $('.woofmark-command-insert').popover({html: true, sanitize: false});
+ $('.wk-commands .woofmark-command-insert').click(function() {
+ var sel = window.getSelection();
+ if (sel.anchorNode !== null) {
+ var range = sel.getRangeAt(0);
+ } else {
+ range = null;
+ }
+ $(".menu1 a").click(function() {
+ Option1 = $(this).text();
+ $(".selected").text($(this).text());
+ });
+ $(".menu2 a").click(function() {
+ Option2 = $(this).text();
+ $(".selected2").text($(this).text());
+ });
+ $('.go1').click(function() {
+ var syntax = Syntax($('.inputText')[0].value, Option1, Option2);
+ if ($('.woofmark-mode-markdown')[0].disabled === false && range !== null) {
+ range.deleteContents();
+ range.insertNode(document.createTextNode(syntax));
+ $('.woofmark-mode-markdown').click();
+ $('.woofmark-mode-wysiwyg').click();
+ } else {
+ wysiwyg.runCommand(function(chunks, mode) {
+ if (mode === 'markdown') {
+ $(".ple-textarea").insertAtCaret("");
+ chunks.before += (syntax);
+ } else {
+ chunks.before += _module.wysiwyg.parseMarkdown(syntax);
+ }
+ });
+ }
+ });
+ });
+};
+
+},{"./PublicLab.CustomInsert.Template.js":185}],187:[function(require,module,exports){
/*
* Form module for main post image
*/
@@ -22758,7 +22907,7 @@ module.exports = PublicLab.MainImageModule = PublicLab.Module.extend({
});
-},{}],186:[function(require,module,exports){
+},{}],188:[function(require,module,exports){
/*
MapModule for adding Map .
Adds/Removes Tag lat:XX , lon:XX from TagsModule .
@@ -22824,7 +22973,7 @@ module.exports = PublicLab.MapModule = PublicLab.Module.extend({
}
});
-},{}],187:[function(require,module,exports){
+},{}],189:[function(require,module,exports){
/*
* Form modules like title, tags, body, main image
*/
@@ -22881,7 +23030,7 @@ module.exports = PublicLab.Module = Class.extend({
});
-},{}],188:[function(require,module,exports){
+},{}],190:[function(require,module,exports){
/*
Auto Center insertion: ****
*/
@@ -23016,7 +23165,7 @@ module.exports = function initAutoCenter(_module, wysiwyg) {
});
};
-},{}],189:[function(require,module,exports){
+},{}],191:[function(require,module,exports){
/*
Embed insertion:
*/
@@ -23047,7 +23196,7 @@ module.exports = function initEmbed(_module, wysiwyg) {
});
};
-},{}],190:[function(require,module,exports){
+},{}],192:[function(require,module,exports){
/*
Horizontal Rule insertion: ****
*/
@@ -23070,7 +23219,7 @@ module.exports = function initHorizontalRule(_module, wysiwyg) {
});
};
-},{}],191:[function(require,module,exports){
+},{}],193:[function(require,module,exports){
/*
Table generation:
@@ -23169,7 +23318,7 @@ module.exports = function initTables(_module, wysiwyg) {
});
};
-},{}],192:[function(require,module,exports){
+},{}],194:[function(require,module,exports){
/*
* Form module for rich text entry
*/
@@ -23503,7 +23652,7 @@ module.exports = PublicLab.RichTextModule = PublicLab.Module.extend({
}
});
-},{"crossvent":12}],193:[function(require,module,exports){
+},{"crossvent":12}],195:[function(require,module,exports){
/*
* Form module for post tags
*/
@@ -23616,7 +23765,7 @@ module.exports = PublicLab.TagsModule = PublicLab.Module.extend({
});
-},{}],194:[function(require,module,exports){
+},{}],196:[function(require,module,exports){
/* Displays related posts to associate this one with.
* Pass this a fetchRelated() method which runs show() with returned JSON data.
* Example:
@@ -23703,7 +23852,7 @@ module.exports = function relatedNodes(module) {
return relatedEl;
};
-},{}],195:[function(require,module,exports){
+},{}],197:[function(require,module,exports){
/*
* Form module for post title
*/
@@ -23813,4 +23962,4 @@ module.exports = PublicLab.TitleModule = PublicLab.Module.extend({
});
-},{"./PublicLab.TitleModule.Related.js":194}]},{},[178]);
+},{"./PublicLab.TitleModule.Related.js":196}]},{},[178]);
diff --git a/package-lock.json b/package-lock.json
index 3d5f1a24..de2aea8a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1384,8 +1384,8 @@
"integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==",
"dev": true,
"requires": {
- "clean-stack": "^2.0.0",
- "indent-string": "^4.0.0"
+ "clean-stack": "2.2.0",
+ "indent-string": "4.0.0"
}
},
"ajv": {
@@ -2339,7 +2339,6 @@
},
"bureaucracy": {
"version": "git://github.com/jywarren/bureaucracy.git#f2522f42eba0f09444971e7138a56179cd8bffa9",
- "from": "git://github.com/jywarren/bureaucracy.git#f2522f42eba0f09444971e7138a56179cd8bffa9",
"requires": {
"contra": "1.9.4",
"crossvent": "1.5.4",
@@ -2541,7 +2540,7 @@
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
"dev": true,
"requires": {
- "restore-cursor": "^3.1.0"
+ "restore-cursor": "3.1.0"
}
},
"cli-truncate": {
@@ -2550,8 +2549,8 @@
"integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==",
"dev": true,
"requires": {
- "slice-ansi": "^3.0.0",
- "string-width": "^4.2.0"
+ "slice-ansi": "3.0.0",
+ "string-width": "4.2.0"
},
"dependencies": {
"ansi-styles": {
@@ -2560,8 +2559,8 @@
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"dev": true,
"requires": {
- "@types/color-name": "^1.1.1",
- "color-convert": "^2.0.1"
+ "@types/color-name": "1.1.1",
+ "color-convert": "2.0.1"
}
},
"astral-regex": {
@@ -2576,7 +2575,7 @@
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
- "color-name": "~1.1.4"
+ "color-name": "1.1.4"
}
},
"color-name": {
@@ -2591,9 +2590,9 @@
"integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==",
"dev": true,
"requires": {
- "ansi-styles": "^4.0.0",
- "astral-regex": "^2.0.0",
- "is-fullwidth-code-point": "^3.0.0"
+ "ansi-styles": "4.2.1",
+ "astral-regex": "2.0.0",
+ "is-fullwidth-code-point": "3.0.0"
}
}
}
@@ -4396,7 +4395,7 @@
"integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
"dev": true,
"requires": {
- "escape-string-regexp": "^1.0.5"
+ "escape-string-regexp": "1.0.5"
}
},
"file-entry-cache": {
@@ -4950,7 +4949,6 @@
},
"grow-textarea": {
"version": "git://github.com/jywarren/grow.git#d54141c9456343f14cc6c935faa0915af09eb669",
- "from": "git://github.com/jywarren/grow.git#d54141c9456343f14cc6c935faa0915af09eb669",
"requires": {
"component-event": "^0.1.4",
"ianstormtaylor-css": "^0.3.1"
@@ -8663,21 +8661,21 @@
"integrity": "sha512-LRRrSogzbixYaZItE2APaS4l2eJMjjf5MbclRZpLJtcQJShcvUzKXsNeZgsLIZ0H0+fg2tL4B59fU9wHIHtFIA==",
"dev": true,
"requires": {
- "chalk": "^4.0.0",
+ "chalk": "4.1.0",
"cli-truncate": "2.1.0",
- "commander": "^5.1.0",
- "cosmiconfig": "^6.0.0",
- "debug": "^4.1.1",
- "dedent": "^0.7.0",
- "enquirer": "^2.3.5",
- "execa": "^4.0.1",
- "listr2": "^2.1.0",
- "log-symbols": "^4.0.0",
- "micromatch": "^4.0.2",
- "normalize-path": "^3.0.0",
- "please-upgrade-node": "^3.2.0",
+ "commander": "5.1.0",
+ "cosmiconfig": "6.0.0",
+ "debug": "4.1.1",
+ "dedent": "0.7.0",
+ "enquirer": "2.3.6",
+ "execa": "4.0.3",
+ "listr2": "2.2.0",
+ "log-symbols": "4.0.0",
+ "micromatch": "4.0.2",
+ "normalize-path": "3.0.0",
+ "please-upgrade-node": "3.2.0",
"string-argv": "0.3.1",
- "stringify-object": "^3.3.0"
+ "stringify-object": "3.3.0"
},
"dependencies": {
"ansi-styles": {
@@ -8686,8 +8684,8 @@
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"dev": true,
"requires": {
- "@types/color-name": "^1.1.1",
- "color-convert": "^2.0.1"
+ "@types/color-name": "1.1.1",
+ "color-convert": "2.0.1"
}
},
"braces": {
@@ -8696,7 +8694,7 @@
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
- "fill-range": "^7.0.1"
+ "fill-range": "7.0.1"
}
},
"chalk": {
@@ -8705,8 +8703,8 @@
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"requires": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
+ "ansi-styles": "4.2.1",
+ "supports-color": "7.1.0"
}
},
"color-convert": {
@@ -8715,7 +8713,7 @@
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
- "color-name": "~1.1.4"
+ "color-name": "1.1.4"
}
},
"color-name": {
@@ -8736,9 +8734,9 @@
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
"dev": true,
"requires": {
- "path-key": "^3.1.0",
- "shebang-command": "^2.0.0",
- "which": "^2.0.1"
+ "path-key": "3.1.1",
+ "shebang-command": "2.0.0",
+ "which": "2.0.2"
}
},
"debug": {
@@ -8747,7 +8745,7 @@
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"dev": true,
"requires": {
- "ms": "^2.1.1"
+ "ms": "2.1.2"
}
},
"execa": {
@@ -8756,15 +8754,15 @@
"integrity": "sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A==",
"dev": true,
"requires": {
- "cross-spawn": "^7.0.0",
- "get-stream": "^5.0.0",
- "human-signals": "^1.1.1",
- "is-stream": "^2.0.0",
- "merge-stream": "^2.0.0",
- "npm-run-path": "^4.0.0",
- "onetime": "^5.1.0",
- "signal-exit": "^3.0.2",
- "strip-final-newline": "^2.0.0"
+ "cross-spawn": "7.0.3",
+ "get-stream": "5.1.0",
+ "human-signals": "1.1.1",
+ "is-stream": "2.0.0",
+ "merge-stream": "2.0.0",
+ "npm-run-path": "4.0.1",
+ "onetime": "5.1.0",
+ "signal-exit": "3.0.3",
+ "strip-final-newline": "2.0.0"
}
},
"fill-range": {
@@ -8773,7 +8771,7 @@
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
- "to-regex-range": "^5.0.1"
+ "to-regex-range": "5.0.1"
}
},
"get-stream": {
@@ -8782,7 +8780,7 @@
"integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==",
"dev": true,
"requires": {
- "pump": "^3.0.0"
+ "pump": "3.0.0"
}
},
"has-flag": {
@@ -8809,8 +8807,8 @@
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
"dev": true,
"requires": {
- "braces": "^3.0.1",
- "picomatch": "^2.0.5"
+ "braces": "3.0.2",
+ "picomatch": "2.2.2"
}
},
"ms": {
@@ -8831,7 +8829,7 @@
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
"dev": true,
"requires": {
- "path-key": "^3.0.0"
+ "path-key": "3.1.1"
}
},
"path-key": {
@@ -8846,7 +8844,7 @@
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"requires": {
- "shebang-regex": "^3.0.0"
+ "shebang-regex": "3.0.0"
}
},
"shebang-regex": {
@@ -8861,7 +8859,7 @@
"integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
"dev": true,
"requires": {
- "has-flag": "^4.0.0"
+ "has-flag": "4.0.0"
}
},
"to-regex-range": {
@@ -8870,7 +8868,7 @@
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
- "is-number": "^7.0.0"
+ "is-number": "7.0.0"
}
},
"which": {
@@ -8879,7 +8877,7 @@
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
- "isexe": "^2.0.0"
+ "isexe": "2.0.0"
}
}
}
@@ -8890,14 +8888,14 @@
"integrity": "sha512-WhuhT7xpVi2otpY/OzJJ8DQhf6da8MjGiEhMdA9oQquwtsSfzZt+YKlasUBer717Uocd0oPmbPeiTD7MvGzctw==",
"dev": true,
"requires": {
- "chalk": "^4.0.0",
- "cli-truncate": "^2.1.0",
- "figures": "^3.2.0",
- "indent-string": "^4.0.0",
- "log-update": "^4.0.0",
- "p-map": "^4.0.0",
- "rxjs": "^6.5.5",
- "through": "^2.3.8"
+ "chalk": "4.1.0",
+ "cli-truncate": "2.1.0",
+ "figures": "3.2.0",
+ "indent-string": "4.0.0",
+ "log-update": "4.0.0",
+ "p-map": "4.0.0",
+ "rxjs": "6.6.0",
+ "through": "2.3.8"
},
"dependencies": {
"ansi-styles": {
@@ -8906,8 +8904,8 @@
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"dev": true,
"requires": {
- "@types/color-name": "^1.1.1",
- "color-convert": "^2.0.1"
+ "@types/color-name": "1.1.1",
+ "color-convert": "2.0.1"
}
},
"chalk": {
@@ -8916,8 +8914,8 @@
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"requires": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
+ "ansi-styles": "4.2.1",
+ "supports-color": "7.1.0"
}
},
"color-convert": {
@@ -8926,7 +8924,7 @@
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
- "color-name": "~1.1.4"
+ "color-name": "1.1.4"
}
},
"color-name": {
@@ -8947,7 +8945,7 @@
"integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
"dev": true,
"requires": {
- "has-flag": "^4.0.0"
+ "has-flag": "4.0.0"
}
}
}
@@ -8996,7 +8994,7 @@
"integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==",
"dev": true,
"requires": {
- "chalk": "^4.0.0"
+ "chalk": "4.1.0"
},
"dependencies": {
"ansi-styles": {
@@ -9005,8 +9003,8 @@
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"dev": true,
"requires": {
- "@types/color-name": "^1.1.1",
- "color-convert": "^2.0.1"
+ "@types/color-name": "1.1.1",
+ "color-convert": "2.0.1"
}
},
"chalk": {
@@ -9015,8 +9013,8 @@
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"requires": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
+ "ansi-styles": "4.2.1",
+ "supports-color": "7.1.0"
}
},
"color-convert": {
@@ -9025,7 +9023,7 @@
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
- "color-name": "~1.1.4"
+ "color-name": "1.1.4"
}
},
"color-name": {
@@ -9046,7 +9044,7 @@
"integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
"dev": true,
"requires": {
- "has-flag": "^4.0.0"
+ "has-flag": "4.0.0"
}
}
}
@@ -9057,10 +9055,10 @@
"integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==",
"dev": true,
"requires": {
- "ansi-escapes": "^4.3.0",
- "cli-cursor": "^3.1.0",
- "slice-ansi": "^4.0.0",
- "wrap-ansi": "^6.2.0"
+ "ansi-escapes": "4.3.1",
+ "cli-cursor": "3.1.0",
+ "slice-ansi": "4.0.0",
+ "wrap-ansi": "6.2.0"
},
"dependencies": {
"ansi-styles": {
@@ -9069,8 +9067,8 @@
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"dev": true,
"requires": {
- "@types/color-name": "^1.1.1",
- "color-convert": "^2.0.1"
+ "@types/color-name": "1.1.1",
+ "color-convert": "2.0.1"
}
},
"astral-regex": {
@@ -9085,7 +9083,7 @@
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
- "color-name": "~1.1.4"
+ "color-name": "1.1.4"
}
},
"color-name": {
@@ -9100,9 +9098,9 @@
"integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==",
"dev": true,
"requires": {
- "ansi-styles": "^4.0.0",
- "astral-regex": "^2.0.0",
- "is-fullwidth-code-point": "^3.0.0"
+ "ansi-styles": "4.2.1",
+ "astral-regex": "2.0.0",
+ "is-fullwidth-code-point": "3.0.0"
}
}
}
@@ -10210,7 +10208,7 @@
"integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==",
"dev": true,
"requires": {
- "aggregate-error": "^3.0.0"
+ "aggregate-error": "3.0.1"
}
},
"p-try": {
@@ -11062,8 +11060,8 @@
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
"dev": true,
"requires": {
- "onetime": "^5.1.0",
- "signal-exit": "^3.0.2"
+ "onetime": "5.1.0",
+ "signal-exit": "3.0.3"
}
},
"ret": {
@@ -11130,7 +11128,7 @@
"integrity": "sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg==",
"dev": true,
"requires": {
- "tslib": "^1.9.0"
+ "tslib": "1.13.0"
}
},
"safe-buffer": {
@@ -12102,9 +12100,9 @@
"integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==",
"dev": true,
"requires": {
- "get-own-enumerable-property-symbols": "^3.0.0",
- "is-obj": "^1.0.1",
- "is-regexp": "^1.0.0"
+ "get-own-enumerable-property-symbols": "3.0.2",
+ "is-obj": "1.0.1",
+ "is-regexp": "1.0.0"
}
},
"strip-ansi": {
@@ -13301,7 +13299,6 @@
},
"woofmark": {
"version": "git://github.com/jywarren/woofmark.git#12e2c1d4559268e2de605ad6084d5dce24ea42c6",
- "from": "git://github.com/jywarren/woofmark.git#12e2c1d4559268e2de605ad6084d5dce24ea42c6",
"requires": {
"bullseye": "1.4.6",
"bureaucracy": "git://github.com/jywarren/bureaucracy.git#f2522f42eba0f09444971e7138a56179cd8bffa9",
diff --git a/src/adapters/PublicLab.Woofmark.js b/src/adapters/PublicLab.Woofmark.js
index ac1f7e99..f57c11d6 100644
--- a/src/adapters/PublicLab.Woofmark.js
+++ b/src/adapters/PublicLab.Woofmark.js
@@ -216,7 +216,7 @@ module.exports = function(textarea, _editor, _module) {
],
allowedAttributes: {
- a: ["href", "name", "class", "target", "title", "aria-label"],
+ a: ["href", "name", "target", "title", "aria-label"],
iframe: [
"allowfullscreen",
"frameborder",
@@ -286,12 +286,16 @@ module.exports = function(textarea, _editor, _module) {
}
if (el.tagName === "DIV" && $(el).hasClass("powertags")) {
- return "[" + el.innerHTML.replace("Power tag: ", "") + "]";
+ return "[" + el.innerHTML.replace("Power tag: ", "") + "]" + '\n';
}
}
});
}
});
+ require("../modules/PublicLab.CustomInsert.js")(
+ _module,
+ wysiwyg
+ );
// set up table generation tools:
require("../modules/PublicLab.RichTextModule.Table.js")(_module, wysiwyg);
diff --git a/src/modules/PublicLab.CustomInsert.Template.js b/src/modules/PublicLab.CustomInsert.Template.js
new file mode 100644
index 00000000..6d72a752
--- /dev/null
+++ b/src/modules/PublicLab.CustomInsert.Template.js
@@ -0,0 +1,30 @@
+var builder = '';
+builder += '';
+builder += '';
+builder += '
';
+builder += '';
+builder += '';
+builder += '';
+builder += '
';
+builder += '';
+builder += '';
+builder += '';
+builder += '';
+builder += '';
+builder += '
';
+module.exports = builder;
diff --git a/src/modules/PublicLab.CustomInsert.js b/src/modules/PublicLab.CustomInsert.js
new file mode 100644
index 00000000..bbbb8196
--- /dev/null
+++ b/src/modules/PublicLab.CustomInsert.js
@@ -0,0 +1,111 @@
+module.exports = function CustomInsert(_module, wysiwyg) {
+ function Syntax(tag, Option1, Option2) {
+ if (Option2 === "List") {
+ switch (Option1) {
+ case "Notes":
+ var syn = "[notes:" + tag + "]";
+ break;
+ case "Wikis":
+ var syn = "[wikis:" + tag + "]";
+ break;
+ case "Nodes(Wikis + Notes)":
+ var syn = "[nodes:" + tag + "]";
+ break;
+ case "Activity":
+ var syn = "[activity:" + tag + "]";
+ break;
+ case "Questions":
+ var syn = "[questions:" + tag + "]";
+ break;
+ }
+ }
+ if (Option2 == "Grid") {
+ switch (Option1) {
+ case "Notes":
+ var syn = "[notes:grid:" + tag + "]";
+ break;
+ case "Wikis":
+ var syn = "[wikis:grid:" + tag + "]";
+ break;
+ case "Nodes(Wikis + Notes)":
+ var syn = "[nodes:grid:" + tag + "]";
+ break;
+ case "Activity":
+ var syn = "[activity:grid:" + tag + "]";
+ break;
+ case "Questions":
+ var syn = "[questions:grid:" + tag + "]";
+ break;
+ }
+ }
+ return syn;
+ }
+ $.fn.extend({
+ insertAtCaret: function(myValue) {
+ return this.each(function(i) {
+ if (document.selection) {
+ // For browsers like Internet Explorer
+ this.focus();
+ var sel = document.selection.createRange();
+ sel.text = myValue;
+ this.focus();
+ } else if (this.selectionStart || this.selectionStart == '0') {
+ // For browsers like Firefox and Webkit based
+ var startPos = this.selectionStart;
+ var endPos = this.selectionEnd;
+ var scrollTop = this.scrollTop;
+ this.value = this.value.substring(0, startPos)+myValue+this.value.substring(endPos, this.value.length);
+ this.focus();
+ this.selectionStart = startPos + myValue.length;
+ this.selectionEnd = startPos + myValue.length;
+ this.scrollTop = scrollTop;
+ } else {
+ this.value += myValue;
+ this.focus();
+ }
+ });
+ }
+ });
+ const builder = require("./PublicLab.CustomInsert.Template.js");
+ $('.wk-commands').append('');
+ var Option1 = "Notes";
+ var Option2 = "List";
+ $('.woofmark-command-insert').attr('data-content', builder);
+ $('.woofmark-command-insert').attr('data-container', 'body');
+ $('.woofmark-command-insert').attr('data-placement', 'top');
+ $('.woofmark-command-insert').popover({html: true, sanitize: false});
+ $('.wk-commands .woofmark-command-insert').click(function() {
+ var sel = window.getSelection();
+ if (sel.anchorNode !== null) {
+ var range = sel.getRangeAt(0);
+ } else {
+ range = null;
+ }
+ $(".menu1 a").click(function() {
+ Option1 = $(this).text();
+ $(".selected").text($(this).text());
+ });
+ $(".menu2 a").click(function() {
+ Option2 = $(this).text();
+ $(".selected2").text($(this).text());
+ });
+ $('.go1').click(function() {
+ var syntax = Syntax($('.inputText')[0].value, Option1, Option2);
+ if ($('.woofmark-mode-markdown')[0].disabled === false && range !== null) {
+ range.deleteContents();
+ range.insertNode(document.createTextNode(syntax));
+ $('.woofmark-mode-markdown').click();
+ $('.woofmark-mode-wysiwyg').click();
+ } else {
+ wysiwyg.runCommand(function(chunks, mode) {
+ if (mode === 'markdown') {
+ $(".ple-textarea").insertAtCaret("");
+ chunks.before += (syntax);
+ } else {
+ chunks.before += _module.wysiwyg.parseMarkdown(syntax);
+ }
+ });
+ }
+ });
+ });
+};
diff --git a/test/ui-testing/CustomInsert.test.js b/test/ui-testing/CustomInsert.test.js
new file mode 100644
index 00000000..7e634192
--- /dev/null
+++ b/test/ui-testing/CustomInsert.test.js
@@ -0,0 +1,60 @@
+const timeout = process.env.SLOWMO ? 60000 : 10000;
+const fs = require('fs');
+beforeAll(async () => {
+ path = fs.realpathSync('file://../examples/index.html');
+ await page.goto('file://' + path, {waitUntil: 'domcontentloaded'});
+});
+
+describe('Custom Insert text', () => {
+ test('Add Custom Insert text in rich text mode', async () => {
+ await page.waitForSelector('.ple-module-body');
+ // Click on insert text button
+ await page.click('.woofmark-command-insert');
+ // Select the option 'Nodes' from Menu: What Do you want to insert?
+ await page.waitForSelector('.dropdownMenu1');
+ await page.click('.dropdownMenu1');
+ await page.waitForSelector('.Nodes');
+ await page.click('.Nodes');
+ // Select the option 'List' from Menu: Insert as a?
+ await page.click('.dropdownMenu2');
+ await page.waitForSelector('.List');
+ await page.click('.List');
+ // Add input tag
+ await page.$eval('.inputText', (el) => el.value = 'tag');
+ // Press the Go! button
+ await page.click('.go1');
+ await page.click('.woofmark-command-insert');
+ // Evaluate the expression
+ await page.waitForSelector('.powertags');
+ const stringIsIncluded = await page.evaluate(() => document.querySelector('.wk-wysiwyg').textContent.includes("Power tag: nodes:tag"));
+ expect(stringIsIncluded).toBe(true);
+ }, timeout);
+
+ test('Adds strong text in rich text mode', async () => {
+ await page.waitForSelector('.ple-module-body');
+ // Click on Mardown mode button
+ await page.waitForSelector('.woofmark-mode-markdown');
+ await page.click('.woofmark-mode-markdown');
+ await page.evaluate(() => document.querySelector('.ple-textarea').value += ' ');
+ // Click on insert text button
+ await page.click('.woofmark-command-insert');
+ // Select the option 'Notes' from Menu: What Do you want to insert?
+ await page.waitForSelector('.dropdownMenu1');
+ await page.click('.dropdownMenu1');
+ await page.waitForSelector('.Notes');
+ await page.click('.Notes');
+ // Select the option 'List' from Menu: Insert as a?
+ await page.click('.dropdownMenu2');
+ await page.waitForSelector('.List');
+ await page.click('.List');
+ // Add input tag
+ await page.$eval('.inputText', (el) => el.value = 'tag');
+ // Press the Go! button
+ await page.click('.go1');
+ await page.click('.woofmark-command-insert');
+ // Evaluate the expression
+ const stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('[notes:tag]'));
+ expect(stringIsIncluded).toBe(true);
+ await page.click('.woofmark-mode-wysiwyg');
+ }, timeout);
+});
diff --git a/test/ui-testing/center.test.js b/test/ui-testing/center.test.js
index b93137e1..71491f37 100644
--- a/test/ui-testing/center.test.js
+++ b/test/ui-testing/center.test.js
@@ -28,5 +28,6 @@ describe('Center Text', () => {
closing = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('<-'));
expect(opening).toBe(false);
expect(closing).toBe(false);
+ await page.click('.woofmark-mode-wysiwyg');
}, timeout);
});
diff --git a/test/ui-testing/title.test.js b/test/ui-testing/title.test.js
index 276e42a8..2f7c213e 100644
--- a/test/ui-testing/title.test.js
+++ b/test/ui-testing/title.test.js
@@ -9,6 +9,5 @@ describe('Title of the page', () => {
test('Title of the page', async () => {
const title = await page.title();
expect(title).toBe('PublicLab.Editor');
-
}, timeout);
});