Pregunta

It seems that some plugins of CKEditor specify values of properties. For example, the left-to-right plugin has the following rule:

{
  "styles":null,
  "requiredStyles":null,
  "classes":null,
  "requiredClasses":null,
  "attributes":{
    "dir":"ltr"
  },
  "requiredAttributes":{
    "dir":true
  },
  "elements":{
    "span":true
  },
  "featureName":"styles",
  "propertiesOnly":false,
  "match":null
},

How can I specify values with string format rules? Something like span[!dir=ltr].

¿Fue útil?

Solución

You can't. String format doesn't allow such definition. You can specify span[!dir] so all spans require dir attribute and nothing else. With object definition you can do more, e.g. use functions:

...
'ul, li: true,
'$0': {
    match: function( el ) {
        return el.name == 'b';
    },
    propertiesOnly: true,
    attributes: 'dir'
}
'$1': {
...

Why do you persist to use string format? You can use objects and store it as JSON.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top