File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 8383 }
8484 } ) ) ;
8585
86+
8687 vm . layout = [ ] ; // The layout object specific to this Block Editor, will be a direct reference from Property Model.
8788 vm . availableBlockTypes = [ ] ; // Available block entries of this property editor.
8889 vm . labels = { } ;
190191 vm . containerHeight = "auto" ;
191192 vm . containerOverflow = "inherit"
192193
194+ // Add client validation for the markup part.
195+ unsubscribe . push ( $scope . $watch ( ( ) => vm . model ?. value ?. markup , validate ) ) ;
196+
193197 //queue file loading
194198 tinyMceAssets . forEach ( function ( tinyJsAsset ) {
195199 assetPromises . push ( assetsService . loadJs ( tinyJsAsset , $scope ) ) ;
337341 }
338342 }
339343
344+ function validate ( ) {
345+ var isValid = ! vm . model . validation . mandatory || (
346+ vm . model . value != null
347+ && vm . model . value . markup != null
348+ && vm . model . value . markup != ""
349+ ) ;
350+ vm . propertyForm . $setValidity ( "required" , isValid ) ;
351+ if ( vm . umbProperty ) {
352+ vm . umbProperty . setPropertyError ( vm . model . validation . mandatoryMessage || "Value cannot be empty" ) ;
353+ }
354+ } ;
355+
340356 // Called when we save the value, the server may return an updated data and our value is re-synced
341357 // we need to deal with that here so that our model values are all in sync so we basically re-initialize.
342358 function onServerValueChanged ( newVal , oldVal ) {
You can’t perform that action at this time.
0 commit comments