Skip to content

Commit

Permalink
Fix: more generic check for empty wysiwyg
Browse files Browse the repository at this point in the history
  • Loading branch information
robertSt7 authored and aryaantony92 committed Oct 20, 2023
1 parent fd882e6 commit 273121b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
3 changes: 1 addition & 2 deletions public/js/pimcore/document/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ pimcore.document.edit = Class.create({
const name = editable.getName();
const type = editable.getType();
const value = editable.getValue();
if (type === "wysiwyg" &&
(value === "<p><br></p>" || value === "<p><br data-mce-bogus=\"1\"></p>")) {
if (type === "wysiwyg" && value.replace(/(<([^>]+)>)/gm, "") === "") {
values[name] = {
data: '',
type: type
Expand Down
6 changes: 1 addition & 5 deletions public/js/pimcore/object/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ pimcore.object.edit = Class.create({
//only include changed values in save response.
if(currentField.isDirty()) {
if (currentField.fieldConfig.fieldtype === "wysiwyg" &&
(
currentField.data === "<p><br></p>" ||
currentField.data === "<p><br data-mce-bogus=\"1\"></p>"
)
)
currentField.data.replace(/(<([^>]+)>)/gm, "") === "")
{
currentField.data = "";
}
Expand Down
2 changes: 1 addition & 1 deletion public/js/pimcore/settings/translationEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pimcore.settings.translation.editor = Class.create({
if (editorType == "wysiwyg") {
newValue = this.value;
// Check and reset what the TinyMCE returns when empty
if (newValue == '<p><br data-mce-bogus="1"></p>'){
if (newValue.replace(/(<([^>]+)>)/gm, "") === ""){
newValue = '';
}
} else {
Expand Down

0 comments on commit 273121b

Please sign in to comment.