<\/div>| )*$/,"")},c.prototype.updateToolbar=function(a,c,d){d.activeToolbarClass&&b(d.toolbarSelector).find(c).each(function(){var a=b(this),c=a.data(d.commandRole).split(" "),e=c[0];c.length>1&&document.queryCommandEnabled(e)&&document.queryCommandValue(e)===c[1]?a.addClass(d.activeToolbarClass):1===c.length&&document.queryCommandEnabled(e)&&document.queryCommandState(e)?a.addClass(d.activeToolbarClass):a.removeClass(d.activeToolbarClass)})},c.prototype.execCommand=function(a,b,c,d,e){var f=a.split(" "),g=f.shift(),h=f.join(" ")+(b||""),i=a.split("-");1===i.length?document.execCommand(g,!1,h):"format"===i[0]&&2===i.length&&document.execCommand("formatBlock",!1,i[1]),c.trigger("change"),this.updateToolbar(c,e,d)},c.prototype.bindHotkeys=function(a,c,d){var e=this;b.each(c.hotKeys,function(f,g){g&&b(a).keydown(f,function(f){a.attr("contenteditable")&&b(a).is(":visible")&&(f.preventDefault(),f.stopPropagation(),e.execCommand(g,null,a,c,d))}).keyup(f,function(c){a.attr("contenteditable")&&b(a).is(":visible")&&(c.preventDefault(),c.stopPropagation())})}),a.keyup(function(){a.trigger("change")})},c.prototype.getCurrentRange=function(){var b,c;return a.getSelection?(b=a.getSelection(),b.getRangeAt&&b.rangeCount&&(c=b.getRangeAt(0))):document.selection&&(c=document.selection.createRange()),c},c.prototype.saveSelection=function(){this.selectedRange=this.getCurrentRange()},c.prototype.restoreSelection=function(){var b;if(a.getSelection||document.createRange){if(b=a.getSelection(),this.selectedRange){try{b.removeAllRanges()}catch(c){document.body.createTextRange().select(),document.selection.empty()}b.addRange(this.selectedRange)}}else document.selection&&this.selectedRange&&this.selectedRange.select()},c.prototype.toggleHtmlEdit=function(a){if(!0!==a.data("wysiwyg-html-mode")){var c=a.html(),d=b("
");b(d).append(document.createTextNode(c)),b(d).attr("contenteditable",!0),b(a).html(" "),b(a).append(b(d)),b(a).attr("contenteditable",!1),b(a).data("wysiwyg-html-mode",!0),b(d).focus()}else b(a).html(b(a).text()),b(a).attr("contenteditable",!0),b(a).data("wysiwyg-html-mode",!1),b(a).focus()},c.prototype.insertFiles=function(a,c,d,e){var f=this;d.focus(),b.each(a,function(a,g){/^image\//.test(g.type)?b.when(f.readFileIntoDataUrl(g)).done(function(a){f.execCommand("insertimage",a,d,c,e),d.trigger("image-inserted")}).fail(function(a){c.fileUploadError("file-reader",a)}):c.fileUploadError("unsupported-file-type",g.type)})},c.prototype.markSelection=function(a,b){this.restoreSelection(),document.queryCommandSupported("hiliteColor")&&document.execCommand("hiliteColor",!1,a||"transparent"),this.saveSelection()},c.prototype.bindToolbar=function(c,e,f,g){var h=this;e.find(g).click(function(){h.restoreSelection(),c.focus(),"html"===c.data(f.commandRole)?h.toggleHtmlEdit(c):h.execCommand(b(this).data(f.commandRole),null,c,f,g),h.saveSelection()}),e.find("[data-toggle=dropdown]").on("click",function(){h.markSelection(f.selectionColor,f)}),e.on("hide.bs.dropdown",function(){h.markSelection(!1,f)}),e.find("input[type=text][data-"+f.commandRole+"]").on("webkitspeechchange change",function(){var e=this.value;this.value="",h.restoreSelection(),""===a.getSelection().toString().trim()&&e&&(h.editor.append("
"+e+""),d(b("span:last",h.editor)[0])),e&&(c.focus(),h.execCommand(b(this).data(f.commandRole),e,c,f,g)),h.saveSelection()}).on("blur",function(){b(this);h.markSelection(!1,f)}),e.find("input[type=file][data-"+f.commandRole+"]").change(function(){h.restoreSelection(),"file"===this.type&&this.files&&this.files.length>0&&h.insertFiles(this.files,f,c,g),h.saveSelection(),this.value=""})},c.prototype.initFileDrops=function(a,b,c){var d=this;a.on("dragenter dragover",!1).on("drop",function(e){var f=e.originalEvent.dataTransfer;e.stopPropagation(),e.preventDefault(),f&&f.files&&f.files.length>0&&d.insertFiles(f.files,b,a,c)})},b.fn.wysiwyg=function(a){new c(this,a)}}(window,window.jQuery);
\ No newline at end of file
+!function(a,b){"use strict";function c(c,d){this.selectedRange=null,this.editor=b(c);var e=b(c),f={hotKeys:{"Ctrl+b meta+b":"bold","Ctrl+i meta+i":"italic","Ctrl+u meta+u":"underline","Ctrl+z":"undo","Ctrl+y meta+y meta+shift+z":"redo","Ctrl+l meta+l":"justifyleft","Ctrl+r meta+r":"justifyright","Ctrl+e meta+e":"justifycenter","Ctrl+j meta+j":"justifyfull","Shift+tab":"outdent",tab:"indent"},toolbarSelector:"[data-role=editor-toolbar]",commandRole:"edit",activeToolbarClass:"btn-info",selectionMarker:"edit-focus-marker",selectionColor:"darkgrey",dragAndDropImages:!0,keypressTimeout:200,fileUploadError:function(a,b){console.log("File upload error",a,b)}},g=b.extend(!0,{},f,d),h="a[data-"+g.commandRole+"],button[data-"+g.commandRole+"],input[type=button][data-"+g.commandRole+"]";this.bindHotkeys(e,g,h),g.dragAndDropImages&&this.initFileDrops(e,g,h),this.bindToolbar(e,b(g.toolbarSelector),g,h),e.attr("contenteditable",!0).on("mouseup keyup mouseout",function(){this.saveSelection(),this.updateToolbar(e,h,g)}.bind(this)),b(a).bind("touchend",function(a){var b=e.is(a.target)||e.has(a.target).length>0,c=this.getCurrentRange(),d=c&&c.startContainer===c.endContainer&&c.startOffset===c.endOffset;(!d||b)&&(this.saveSelection(),this.updateToolbar(e,h,g))})}c.prototype.readFileIntoDataUrl=function(a){var c=b.Deferred(),d=new FileReader;return d.onload=function(a){c.resolve(a.target.result)},d.onerror=c.reject,d.onprogress=c.notify,d.readAsDataURL(a),c.promise()},c.prototype.cleanHtml=function(a){var c=this;if(b(c).data("wysiwyg-html-mode")===!0&&(b(c).html(b(c).text()),b(c).attr("contenteditable",!0),b(c).data("wysiwyg-html-mode",!1)),a===!0&&b(c).parent().is("form")){var d=b(c).html;if(b(d).has("img").length){var e=b("img",b(d)),f=[],g=b(c).parent();b.each(e,function(a,c){b(c).attr("src").match(/^data:image\/.*$/)&&(f.push(e[a]),b(g).prepend("
"),b(c).attr("src","postedimage/"+a))})}}var h=b(c).html();return h&&h.replace(/(
|\s|
<\/div>| )*$/,"")},c.prototype.updateToolbar=function(a,c,d){d.activeToolbarClass&&b(d.toolbarSelector).find(c).each(function(){var a=b(this),c=a.data(d.commandRole).split(" "),e=c[0];c.length>1&&document.queryCommandEnabled(e)&&document.queryCommandValue(e)===c[1]?a.addClass(d.activeToolbarClass):1===c.length&&document.queryCommandEnabled(e)&&document.queryCommandState(e)?a.addClass(d.activeToolbarClass):a.removeClass(d.activeToolbarClass)})},c.prototype.execCommand=function(a,b,c,d,e){var f=a.split(" "),g=f.shift(),h=f.join(" ")+(b||""),i=a.split("-");1===i.length?document.execCommand(g,!1,h):"format"===i[0]&&2===i.length&&document.execCommand("formatBlock",!1,i[1]),c.trigger("change"),this.updateToolbar(c,e,d)},c.prototype.bindHotkeys=function(a,c,d){var e=this;b.each(c.hotKeys,function(f,g){b(a).keydown(f,function(f){a.attr("contenteditable")&&b(a).is(":visible")&&(f.preventDefault(),f.stopPropagation(),e.execCommand(g,null,a,c,d))}).keyup(f,function(c){a.attr("contenteditable")&&b(a).is(":visible")&&(c.preventDefault(),c.stopPropagation())})}),a.keyup(function(){a.trigger("change")})},c.prototype.getCurrentRange=function(){var b,c;return a.getSelection?(b=a.getSelection(),b.getRangeAt&&b.rangeCount&&(c=b.getRangeAt(0))):document.selection&&(c=document.selection.createRange()),c},c.prototype.saveSelection=function(){this.selectedRange=this.getCurrentRange()},c.prototype.restoreSelection=function(){var b;if(a.getSelection||document.createRange){if(b=a.getSelection(),this.selectedRange){try{b.removeAllRanges()}catch(c){document.body.createTextRange().select(),document.selection.empty()}b.addRange(this.selectedRange)}}else document.selection&&this.selectedRange&&this.selectedRange.select()},c.prototype.toggleHtmlEdit=function(a){if(a.data("wysiwyg-html-mode")!==!0){var c=a.html(),d=b("
");b(d).append(document.createTextNode(c)),b(d).attr("contenteditable",!0),b(a).html(" "),b(a).append(b(d)),b(a).attr("contenteditable",!1),b(a).data("wysiwyg-html-mode",!0),b(d).focus()}else b(a).html(b(a).text()),b(a).attr("contenteditable",!0),b(a).data("wysiwyg-html-mode",!1),b(a).focus()},c.prototype.insertFiles=function(a,c,d,e){var f=this;d.focus(),b.each(a,function(a,g){/^image\//.test(g.type)?b.when(f.readFileIntoDataUrl(g)).done(function(a){f.execCommand("insertimage",a,d,c,e),d.trigger("image-inserted")}).fail(function(a){c.fileUploadError("file-reader",a)}):c.fileUploadError("unsupported-file-type",g.type)})},c.prototype.markSelection=function(a,b,c){this.restoreSelection(),document.queryCommandSupported("hiliteColor")&&document.execCommand("hiliteColor",!1,b||"transparent"),this.saveSelection(),a.data(c.selectionMarker,b)},c.prototype.bindToolbar=function(a,c,d,e){var f=this;c.find(e).click(function(){f.restoreSelection(),a.focus(),"html"===a.data(d.commandRole)?f.toggleHtmlEdit(a):f.execCommand(b(this).data(d.commandRole),null,a,d,e),f.saveSelection()}),c.find("[data-toggle=dropdown]").click(this.restoreSelection()),c.find("input[type=text][data-"+d.commandRole+"]").on("webkitspeechchange change",function(){var c=this.value;this.value="",f.restoreSelection(),c&&(a.focus(),f.execCommand(b(this).data(d.commandRole),c,a,d,e)),f.saveSelection()}).on("focus",function(){var a=b(this);a.data(d.selectionMarker)||(f.markSelection(a,d.selectionColor,d),a.focus())}).on("blur",function(){var a=b(this);a.data(d.selectionMarker)&&f.markSelection(a,!1,d)}),c.find("input[type=file][data-"+d.commandRole+"]").change(function(){f.restoreSelection(),"file"===this.type&&this.files&&this.files.length>0&&f.insertFiles(this.files,d,a,e),f.saveSelection(),this.value=""})},c.prototype.initFileDrops=function(a,b,c){var d=this;a.on("dragenter dragover",!1).on("drop",function(e){var f=e.originalEvent.dataTransfer;e.stopPropagation(),e.preventDefault(),f&&f.files&&f.files.length>0&&d.insertFiles(f.files,b,a,c)})},b.fn.wysiwyg=function(a){new c(this,a)}}(window,window.jQuery);
\ No newline at end of file
diff --git a/OpenRobertaWeb/gulpfile.js b/OpenRobertaWeb/gulpfile.js
index 5afcb4fa66..8ab9ebf4df 100644
--- a/OpenRobertaWeb/gulpfile.js
+++ b/OpenRobertaWeb/gulpfile.js
@@ -19,17 +19,70 @@ const files = {
jsPath: 'src/**/*',
nodePaths: [
{
- //folder name in libs
moduleName: 'ace',
- //base path for the node module
- base: '../OpenRobertaWeb/node_modules/ace-builds/src-min-noconflict',
- //defines files to be copied over
- src: [
- //you may add '/**/*.js' instead of a {folder: '', file['']} structure or similar paths with wildcard
+ bases: [
{
- //the base folder is just an empty string, files may also be described as *.js if all files of a given folder should be copied
- folder: '',
- files: ['ace.js', 'ext-language_tools.js', 'mode-c_cpp.js', 'mode-java.js', 'mode-python.js', 'mode-json.js'],
+ base: '../OpenRobertaWeb/node_modules/ace-builds/src-min-noconflict',
+ //defines files to be copied over
+ src: [
+ //you may add '/**/*.js' instead of a {folder: '', file['']} structure or similar paths with wildcard
+ {
+ //the base folder is just an empty string, files may also be described as *.js if all files of a given folder should be copied
+ folderSrc: '',
+ folderDest: '',
+ files: ['ace.js', 'ext-language_tools.js', 'mode-c_cpp.js', 'mode-java.js', 'mode-python.js', 'mode-json.js'],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ moduleName: 'bootstrap',
+ bases: [
+ {
+ base: '../OpenRobertaWeb/node_modules/bootstrap',
+ src: [
+ {
+ folderSrc: 'dist/js',
+ folderDest: '',
+ files: ['bootstrap.bundle.min.js'],
+ },
+ ],
+ },
+ {
+ base: '../OpenRobertaWeb/node_modules/bootstrap-tagsinput',
+ src: [
+ {
+ folderSrc: 'dist',
+ folderDest: '',
+ files: ['bootstrap-tagsinput.min.js'],
+ },
+ ],
+ },
+ {
+ base: '../OpenRobertaWeb/node_modules/bootstrap-wysiwyg/',
+ src: [
+ {
+ folderSrc: 'js',
+ folderDest: '',
+ files: ['bootstrap-wysiwyg.min.js'],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ moduleName: 'dapjs',
+ bases: [
+ {
+ base: '../OpenRobertaWeb/node_modules/dapjs',
+ src: [
+ {
+ folderSrc: 'dist',
+ folderDest: '',
+ files: ['dap.umd.js'],
+ },
+ ],
},
],
},
@@ -68,21 +121,23 @@ function jsTask() {
function nodeTask() {
const streams = files.nodePaths.map(function (module) {
- return module.src.map(function (source) {
- if (typeof source === 'string') {
- return src(module.base + source, { sourcemaps: true }) // set source and turn on sourcemaps
- .pipe(dest('../OpenRobertaServer/staticResources/libs/' + module.moduleName, { sourcemaps: '.' }));
- } else if (source.folder !== undefined && source.files !== undefined) {
- return source.files.map(function (file) {
- return src(module.base + '/' + source.folder + '/' + file).pipe(
- dest('../OpenRobertaServer/staticResources/libs/' + module.moduleName + '/' + source.folder, { sourcemaps: '.' })
+ return module.bases.map(function (base) {
+ return base.src.map(function (source) {
+ if (typeof source === 'string') {
+ return src(base.base + source, { sourcemaps: true }) // set source and turn on sourcemaps
+ .pipe(dest('../OpenRobertaServer/staticResources/libs/' + module.moduleName, { sourcemaps: '.' }));
+ } else if (source.folderSrc !== undefined && source.folderDest !== undefined && source.files !== undefined) {
+ return source.files.map(function (file) {
+ return src(base.base + '/' + source.folderSrc + '/' + file).pipe(
+ dest('../OpenRobertaServer/staticResources/libs/' + module.moduleName + '/' + source.folderDest, { sourcemaps: '.' })
+ );
+ });
+ } else {
+ throw Error(
+ 'make sure to define folder and files for each source or add a plain string as path, for copying from base folder leave this as an empty String'
);
- });
- } else {
- throw Error(
- 'make sure to define folder and files for each source or add a plain string as path, for copying from base folder leave this as an empty String'
- );
- }
+ }
+ });
});
});
return merge(...streams);
diff --git a/OpenRobertaWeb/package-lock.json b/OpenRobertaWeb/package-lock.json
index 1a6db27ebe..d8c9152c98 100644
--- a/OpenRobertaWeb/package-lock.json
+++ b/OpenRobertaWeb/package-lock.json
@@ -12,7 +12,9 @@
"@types/ace": "^0.0.52",
"ace-builds": "^1.35.2",
"bootstrap": "^5.3.2",
- "bootstrap-table": "^1.22.1",
+ "bootstrap-table": "^1.22.2",
+ "bootstrap-tagsinput": "^0.7.1",
+ "bootstrap-wysiwyg": "^2.0.1",
"d3": "^3.5.16",
"dapjs": "^2.3.0",
"gulp": "^5.0.0",
@@ -699,13 +701,23 @@
}
},
"node_modules/bootstrap-table": {
- "version": "1.22.1",
- "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.22.1.tgz",
- "integrity": "sha512-Nw8p+BmaiMDSfoer/p49YeI3vJQAWhudxhyKMuqnJBb3NRvCRewMk7JDgiN9SQO3YeSejOirKtcdWpM0dtddWg==",
+ "version": "1.23.2",
+ "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.23.2.tgz",
+ "integrity": "sha512-1IFiWFZzbKlleXgYEHdwHkX6rxlQMEx2N1tA8rJK/j08pI+NjIGnxFeXUL26yQLQ0U135eis/BX3OV1+anY25g==",
"peerDependencies": {
"jquery": "3"
}
},
+ "node_modules/bootstrap-tagsinput": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/bootstrap-tagsinput/-/bootstrap-tagsinput-0.7.1.tgz",
+ "integrity": "sha512-xSks67GWgXLnmO5gqp788vhh7WoXd9mHj5uKE5zg8rvw3sNYYSCjrSlrPRlPdpYKwmuxeuf2jsNjBSWEucyB1w=="
+ },
+ "node_modules/bootstrap-wysiwyg": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/bootstrap-wysiwyg/-/bootstrap-wysiwyg-2.0.1.tgz",
+ "integrity": "sha512-lZsz2sU0NoOJmUaVg86ZJHmNXSfAb13EThfzMhY1K/nUAXPHcBPAxvG3sIfaonKkchEDDAI1jAWxQUsmvsOR4A=="
+ },
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
diff --git a/OpenRobertaWeb/package.json b/OpenRobertaWeb/package.json
index bd2e52c234..cdf801ad11 100644
--- a/OpenRobertaWeb/package.json
+++ b/OpenRobertaWeb/package.json
@@ -18,7 +18,9 @@
"@types/ace": "^0.0.52",
"ace-builds": "^1.35.2",
"bootstrap": "^5.3.2",
- "bootstrap-table": "^1.22.1",
+ "bootstrap-table": "^1.22.2",
+ "bootstrap-tagsinput": "^0.7.1",
+ "bootstrap-wysiwyg": "^2.0.1",
"d3": "^3.5.16",
"dapjs": "^2.3.0",
"gulp": "^5.0.0",