@@ -58,6 +58,7 @@ import {
5858 type UpdateCriteriaComponent ,
5959 type UserResult
6060} from '@hcengineering/process'
61+ import { isEmptyMarkup } from '@hcengineering/text-core'
6162import { showPopup } from '@hcengineering/ui'
6263import { type AttributeCategory } from '@hcengineering/view'
6364import process from './plugin'
@@ -821,6 +822,17 @@ export async function approveRequestRejected (
821822 return context . todo ?. group === params . _id && context . todo ?. approved === false
822823}
823824
825+ function getMarkupParams ( card : Card , params : Record < string , any > , client : Client ) : Record < string , any > {
826+ const markup : Record < string , any > = { }
827+ for ( const [ key , value ] of Object . entries ( params ) ) {
828+ const attr = client . getHierarchy ( ) . findAttribute ( card . _class , key )
829+ if ( attr ?. type ?. _class === core . class . TypeMarkup ) {
830+ markup [ key ] = value
831+ }
832+ }
833+ return markup
834+ }
835+
824836export function matchCardCheck (
825837 client : Client ,
826838 execution : Execution ,
@@ -834,6 +846,11 @@ export function matchCardCheck (
834846 if ( client . getHierarchy ( ) . isMixin ( process . masterTag ) ) {
835847 doc = client . getHierarchy ( ) . as ( doc , process . masterTag )
836848 }
849+ const markup = getMarkupParams ( doc , params , client )
850+ for ( const key of Object . keys ( markup ) ) {
851+ if ( isEmptyMarkup ( doc [ key ] ) ) return false
852+ }
853+
837854 const res = matchQuery ( [ doc ] , params , doc . _class , client . getHierarchy ( ) , true )
838855 return res . length > 0
839856}
@@ -849,6 +866,11 @@ export function fieldChangesCheck (
849866 const operations = ( context . operations ?? { } ) as DocumentUpdate < Doc >
850867 const target = Object . keys ( params ) [ 0 ]
851868 if ( ! TxProcessor . hasUpdate ( operations , target ) ) return false
869+ const markup = getMarkupParams ( doc , params , client )
870+ for ( const key of Object . keys ( markup ) ) {
871+ if ( isEmptyMarkup ( doc [ key ] ) ) return false
872+ }
873+
852874 const res = matchQuery ( [ doc ] , params , doc . _class , client . getHierarchy ( ) , true )
853875 return res . length > 0
854876}
0 commit comments