Opened 11 years ago

Closed 10 years ago

#11354 closed Bug (invalid)

Filter.check not properly working with ACF rules

Reported by: Eugen Owned by:
Priority: Normal Milestone:
Component: Core : Parser Version:
Keywords: Cc:



when using general rules working for allowedContent or for creating rules in combination with CKeditor.filter.check, the parser seems to return false most of the time.

To illustrate the issue i created a jsfiddle with the current 4.3.1 version of CKEditor:

The second case should work, since i check for exactly the same rule i created the filter for.

Some of the rule features work, like checking for the src attribute or alt, but .e.g not checking for class. Does not really make sense.

Is there a different parser for both ( would not make sense and would not realy comply wit the docs check

Change History (1)

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

Keywords: ACF Filter Parser removed
Resolution: invalid
Status: newclosed
Version: 4.3.1

First of all, we're sorry for a late reply.

As for the problem, you're not using check() correctly. But I've got to say that it took me a while to figure out what's wrong :).

The thing is that CKEDITOR.filter.contentRule which is a type of argument accepted by check(), is not the same as CKEDITOR.filter.allowedContentRules. It's ACRs simplified version, which does not accept object format, multiple elements and required properties. That was your first mistake - you used the same rule for filter constructor and check.

Your second mistake was that you used class in attributes list, when this and the style attributes have their special place in ACR.

So this works fine:

var r = 'img[!src](!a,b,c)';
var f = new CKEDITOR.filter( r );
f.check( 'img[src](a,b,c)' ); // true

Now, does it make any sense to handle ACRs in check()? I don't think so and we haven't got any need for that when we were integrating entire editor with ACF. A feature's allowed content is a different thing than its required content. For example image allows img[!src,alt,width,height]... but requires img[src] to work. There are of course cases in which the same set of properties could be used, but it's not a reason to identify CRs with ACRs.

PS. Separate thing is a documentation for that. I'll check now what we've got and try to clarify it a little bit better.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy