Opened 5 years ago

Closed 4 years ago

#10202 closed New Feature (fixed)

Introduce string based validators with wildcards

Reported by: Piotrek Koszuliński Owned by: Piotrek Koszuliński
Priority: Normal Milestone: CKEditor 4.4.0
Component: General Version: 4.1
Keywords: Drupal Cc: wim.leers@…

Description

Extracted from #10191. That patch removes support for function and regexp based validators, so we can introduce wildcards support for string based ones.

E.g.: attributes: 'data-*'

Change History (14)

comment:1 Changed 5 years ago by Piotrek Koszuliński

Status: newconfirmed

comment:2 Changed 5 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.2

Required by #9764.

comment:3 Changed 5 years ago by Olek Nowodziński

Owner: set to Olek Nowodziński
Status: confirmedassigned

comment:4 Changed 5 years ago by Olek Nowodziński

Status: assignedreview

Created branch t/10202 + tests.

Introduced:

  • Wildcards in string format:
    span[data-*](class*)
    
  • Regex in object format:
    'h*': true,
    a: {
    	attributes: [ 'href(lang)?$', 'rel' ],
    	classes: [ 'class[^\\d]?(?!.*moo$)' ]
    },
    '$1': {
    	elements: 's(ub|up)'
    }
    

comment:5 Changed 5 years ago by Wim Leers

Cc: wim.leers@… added
Keywords: Drupal added

comment:6 Changed 5 years ago by Piotrek Koszuliński

Status: reviewreview_failed

I pushed both branches. Dev is rebased on major, tests rebased and one commit is added.

As failing tests prove:

  • Required attributes do not work when used with wildcard. It may be unclear how span[!data-*] should work, but I think that the rule is simple - at least one data-* attribute is required. Making this work will require changes to the hasAllRequired funtion.
  • The * character in object format should not be replaced with .* as it is done for string format. Thus, that replacement has to be done earlier - when we still know that string format was an input - perhaps during rule normalization. This implies that only the regexp format will land in filter.allowedContent. So more tests for rules normalization have to be added.

Note: I reviewed only filter/filter tests - the rest may require update too.

comment:7 Changed 5 years ago by Piotrek Koszuliński

Workaround for this missing feature was described here: http://dev.ckeditor.com/ticket/10471#comment:1

comment:8 Changed 5 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 4.2CKEditor 4.3

comment:9 Changed 5 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 4.3 Beta

We need feedback on this to understand if this is still critical and therefore eventually target it to the 4.3.

comment:10 Changed 5 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.4

comment:11 Changed 4 years ago by Piotrek Koszuliński

Owner: changed from Olek Nowodziński to Piotrek Koszuliński
Status: review_failedassigned

comment:12 Changed 4 years ago by Piotrek Koszuliński

Status: assignedreview

Pushed branch:t/10202b on dev and tests.

comment:13 Changed 4 years ago by Frederico Caldeira Knabben

Status: reviewreview_passed

comment:14 Changed 4 years ago by Piotrek Koszuliński

Resolution: fixed
Status: review_passedclosed

Fixed on major with git:6563276 on dev and 74d2a6b on tests.

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy