packages/rich-text: fix tests
This commit is contained in:
parent
4fe03486eb
commit
2ea2444e84
|
@ -64,6 +64,7 @@ export interface RichTextFormat {
|
|||
formatType?: RichTextFormatType;
|
||||
attributes?: Record<string, any>;
|
||||
unregisteredAttributes?: Record<string, any>;
|
||||
innerHTML?: string;
|
||||
}
|
||||
|
||||
export interface SimpleRange {
|
||||
|
|
|
@ -31,16 +31,22 @@ export function useFormatTypes(): FormatTypeStore {
|
|||
|
||||
formatTypes.value = formatTypes.value.filter(({ name }) => {
|
||||
if (isArray) {
|
||||
return !!typesToRemove.find((type) => type === name);
|
||||
return !typesToRemove.find((type) => type === name);
|
||||
} else {
|
||||
return name === typesToRemove;
|
||||
return name !== typesToRemove;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const findFormatType = (fn: (f:RichTextFormatType) => boolean) => formatTypes.value.find(type => fn(type));
|
||||
const getFormatTypeByName = (name: string) => formatTypes.value.find(type => type.name === name);
|
||||
const getFormatTypeForClassName = (name: string) => formatTypes.value.find(type => type.className === name);
|
||||
const getFormatTypeForClassName = (name: string) => formatTypes.value.find(type => {
|
||||
if ( type.className === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ` ${ name } `.indexOf( ` ${ type.className } ` ) >= 0;
|
||||
} );
|
||||
const getFormatTypeForBareElement = (name: string) => formatTypes.value.find(type => type.tagName === name);
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue