Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 11643 #18257

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function () {

Check notice on line 1 in src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.component.js

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 5.03 to 5.13, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
"use strict";

/**
@@ -83,6 +83,7 @@
}
}));


vm.layout = []; // The layout object specific to this Block Editor, will be a direct reference from Property Model.
vm.availableBlockTypes = []; // Available block entries of this property editor.
vm.labels = {};
@@ -190,6 +191,9 @@
vm.containerHeight = "auto";
vm.containerOverflow = "inherit"

// Add client validation for the markup part.
unsubscribe.push($scope.$watch(() => vm.model?.value?.markup, validate));

Check warning on line 196 in src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.component.js

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

❌ Getting worse: Complex Method

BlockRteController.onInit increases in cyclomatic complexity from 32 to 34, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
//queue file loading
tinyMceAssets.forEach(function (tinyJsAsset) {
assetPromises.push(assetsService.loadJs(tinyJsAsset, $scope));
@@ -337,6 +341,18 @@
}
}

function validate() {
var isValid = !vm.model.validation.mandatory || (
vm.model.value != null
&& vm.model.value.markup != null
&& vm.model.value.markup != ""
);
vm.propertyForm.$setValidity("required", isValid);
if (vm.umbProperty) {
vm.umbProperty.setPropertyError(vm.model.validation.mandatoryMessage || "Value cannot be empty");
}
};

// Called when we save the value, the server may return an updated data and our value is re-synced
// we need to deal with that here so that our model values are all in sync so we basically re-initialize.
function onServerValueChanged(newVal, oldVal) {
Loading