Open StanlyShauro opened 3 months ago
Dear all,
Problem: There is a list of classes, e.g. class1, class2, class3. We have them rolled up into format my_class like this
import { ClassAttributor, Scope} from 'parchment'; const config = { scope: Scope.BLOCK, whitelist: ['class1', 'class2', 'class3'] }; const AlignClass = new ClassAttributor('align', '', config);
Draw attention, prefix is an empty string.
In this case I expect dom element classes like class1, class2, class3, but they are -class1, -class2 -class3.
Current code does not support empty prefix src/attributor/class.ts
src/attributor/class.ts
function match(node: HTMLElement, prefix: string): string[] { const className = node.getAttribute('class') || ''; return className .split(/\s+/) .filter((name) => name.indexOf(`${prefix}-`) === 0); }
Dear all,
Problem: There is a list of classes, e.g. class1, class2, class3. We have them rolled up into format my_class like this
Draw attention, prefix is an empty string.
In this case I expect dom element classes like class1, class2, class3, but they are -class1, -class2 -class3.
Current code does not support empty prefix
src/attributor/class.ts