Skip to content

Commit

Permalink
Partial fix #1261 - Single line wysiwyg editor (with the button toolb…
Browse files Browse the repository at this point in the history
…ar) adds new lines
  • Loading branch information
torinfo committed Nov 5, 2023
1 parent 28a2cca commit 9d63dd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 10 additions & 5 deletions editor/js/toolbox.js
Expand Up @@ -1484,15 +1484,15 @@ var EDITOR = (function ($, parent) {
stripP = function (val) {
if (val.indexOf('<p>') == 0)
{
var strippedValue = val.substr(3);
var strippedValue = val.substring(3);
if (strippedValue.lastIndexOf('</p>') != strippedValue.length - 4)
{
// Strip extra newline
strippedValue = strippedValue.substr(0, strippedValue.length-5);
strippedValue = strippedValue.substring(0, strippedValue.length-5);
}
else
{
strippedValue = strippedValue.substr(0, strippedValue.length-4);
strippedValue = strippedValue.substring(0, strippedValue.length-4);
}
return strippedValue.trim();
}
Expand Down Expand Up @@ -4844,9 +4844,14 @@ var EDITOR = (function ($, parent) {
html = $('<div>')
.attr('id', id)
.addClass('inlinewysiwyg')
.attr('contenteditable', 'true')
.append('<p>' + value + '</p>');
.attr('contenteditable', 'true');

// Do not always add a paragraph tag if the value already starts with a <p tag (with for example a class attribute)
if (value.indexOf('<p') === 0) {
html = html.append(value);
} else {
html = html.append('<p>' + value + '</p>');
}
textinputs_options.push({id: id, key: key, name: name, options: options});
}
else {
Expand Down
@@ -0,0 +1,4 @@
// Fill the array with all url's that should be recognised as n embedded peertube video
x_peertube_urls = [
// "https://video.dlearning.nl/videos/embed"
];

0 comments on commit 9d63dd9

Please sign in to comment.